@pega/cosmos-react-core 4.0.0-dev.19.2 → 4.0.0-dev.19.3
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.js +1 -1
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationList.js +3 -3
- package/lib/components/AppShell/NavigationList.js.map +1 -1
- package/lib/components/AppShell/Operator.d.ts +2 -2
- package/lib/components/AppShell/Operator.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts +2 -2
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts +3 -3
- package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Card/CardContent.d.ts +2 -2
- package/lib/components/Card/CardContent.d.ts.map +1 -1
- package/lib/components/Card/CardContent.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.d.ts +1 -1
- package/lib/components/DateTime/utils.d.ts +2 -1
- package/lib/components/DateTime/utils.d.ts.map +1 -1
- package/lib/components/DateTime/utils.js.map +1 -1
- package/lib/components/File/FileInput.d.ts +1 -1
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +1 -1
- package/lib/components/FormField/FormField.d.ts +2 -2
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +1 -1
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +2 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/semitruck-solid.icon.d.ts +5 -0
- package/lib/components/Icon/icons/semitruck-solid.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/semitruck-solid.icon.js +7 -0
- package/lib/components/Icon/icons/semitruck-solid.icon.js.map +1 -0
- package/lib/components/Icon/icons/semitruck.icon.d.ts +5 -0
- package/lib/components/Icon/icons/semitruck.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/semitruck.icon.js +7 -0
- package/lib/components/Icon/icons/semitruck.icon.js.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +2 -2
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/Modal/Modal.styles.d.ts +1 -1
- package/lib/components/Modal/Modal.styles.d.ts.map +1 -1
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/Number/NumberInput.styles.d.ts +2 -2
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.d.ts.map +1 -1
- package/lib/components/Tree/Tree.d.ts +2 -11
- package/lib/components/Tree/Tree.d.ts.map +1 -1
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/theme/ThemeMachine.d.ts +1 -1
- package/lib/theme/ThemeMachine.d.ts.map +1 -1
- package/lib/theme/ThemeMachine.js.map +1 -1
- package/lib/theme/theme.d.ts +549 -549
- package/lib/types/types.d.ts +14 -6
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -285,7 +285,7 @@ export const StyledNavListItem = styled.li(({ theme, nestedListCollapsed, single
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
[aria-current='page'] {
|
|
289
289
|
position: relative;
|
|
290
290
|
font-weight: ${semiBold};
|
|
291
291
|
border-block: ${pxToRem(1)} solid ${borderColor};
|
|
@@ -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,C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wBACY,EAAE;;;eAGX,KAAK;;;MAGd,cAAc;0BACM,EAAE;eACb,KAAK;;;;4BAIQ,EAAE;sBACR,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;;GAG1C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACrE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACpE,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAE5B,IAAI,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,EAAE;QAChC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KAC1B;IAED,MAAM,KAAK,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;IAEhC,OAAO,GAAG,CAAA;wBACY,EAAE;aACb,KAAK;;2BAES,KAAK,CAAC,IAAI,CAAC,OAAO;;MAEvC,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 { darken, getContrast, lighten, readableColor, transparentize } 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 { 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';\nimport { navContrastColors, pxToRem } from './style-utils';\n\nexport const navWidth = '4rem';\nexport const navOpenWidth = '18.75rem';\nexport const headerHeight = '3rem';\n\nexport const StyledAppInfo = styled.a(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const { hoverBg, foreground } = navContrastColors(theme);\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 &:hover,\n button&:hover {\n background-color: ${hoverBg};\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: ${foreground};\n }\n\n span:first-of-type {\n font-size: ${fontSize.s};\n color: ${foreground};\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 navBg = theme.components['app-shell'].nav['background-color'];\n const { navOpen } = useContext(AppShellContext);\n\n return css`\n position: fixed;\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n background: ${navBg};\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 border-inline-end: ${pxToRem(1)} solid ${transparentize(0.9, '#000')};\n ${!showEnv &&\n css`\n padding-block-start: ${theme.base.spacing};\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 {\n base: {\n 'font-weight': { 'semi-bold': semiBold }\n }\n } = theme;\n\n const { navOpen } = useContext(AppShellContext);\n const { hoverBg, foreground, border: borderColor } = navContrastColors(theme);\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 opacity: 0;\n left: ${navOpen ? 'auto' : '100%'};\n top: 50%;\n bottom: 50%;\n margin: auto 0;\n color: ${foreground};\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n\n &:hover,\n &:focus {\n opacity: 1;\n }\n `}\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: ${foreground};\n cursor: pointer;\n text-decoration: none;\n border-block: ${pxToRem(1)} solid transparent;\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: ${foreground};\n background: ${hoverBg};\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 position: relative;\n font-weight: ${semiBold};\n border-block: ${pxToRem(1)} solid ${borderColor};\n\n &::before {\n content: '';\n position: absolute;\n width: ${pxToRem(4)};\n inset-inline-start: 0;\n top: 0;\n bottom: 0;\n background-color: ${foreground};\n }\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 return css`\n ${StyledNavListItem} {\n > :first-child {\n padding-inline-start: calc(${navWidth} + 2 * ${theme.base.spacing});\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 { border: borderColor } = navContrastColors(theme);\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\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\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 /* 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 const bg = theme.components.tooltip['background-color'];\n const color = readableColor(bg);\n\n return css`\n background-color: ${bg};\n padding: 0;\n header {\n color: ${color};\n border-bottom: none;\n }\n ${StyledMenuItem} {\n background-color: ${bg};\n color: ${color};\n\n &:hover,\n &:focus {\n background-color: ${bg};\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n `;\n});\n\nStyledAppShellTooltip.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellToggleButton = styled(Button)(({ theme }) => {\n const navBg = theme.components['app-shell'].nav['background-color'];\n let bg = darken(0.2, navBg);\n\n if (getContrast(navBg, bg) < 1.3) {\n bg = lighten(0.2, navBg);\n }\n\n const color = readableColor(bg);\n\n return css`\n background-color: ${bg};\n color: ${color};\n border: none;\n margin-top: calc(1 * ${theme.base.spacing});\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,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD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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 { darken, getContrast, lighten, readableColor, transparentize } 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 { 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';\nimport { navContrastColors, pxToRem } from './style-utils';\n\nexport const navWidth = '4rem';\nexport const navOpenWidth = '18.75rem';\nexport const headerHeight = '3rem';\n\nexport const StyledAppInfo = styled.a(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const { hoverBg, foreground } = navContrastColors(theme);\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 &:hover,\n button&:hover {\n background-color: ${hoverBg};\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: ${foreground};\n }\n\n span:first-of-type {\n font-size: ${fontSize.s};\n color: ${foreground};\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 navBg = theme.components['app-shell'].nav['background-color'];\n const { navOpen } = useContext(AppShellContext);\n\n return css`\n position: fixed;\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n background: ${navBg};\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 border-inline-end: ${pxToRem(1)} solid ${transparentize(0.9, '#000')};\n ${!showEnv &&\n css`\n padding-block-start: ${theme.base.spacing};\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 {\n base: {\n 'font-weight': { 'semi-bold': semiBold }\n }\n } = theme;\n\n const { navOpen } = useContext(AppShellContext);\n const { hoverBg, foreground, border: borderColor } = navContrastColors(theme);\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 opacity: 0;\n left: ${navOpen ? 'auto' : '100%'};\n top: 50%;\n bottom: 50%;\n margin: auto 0;\n color: ${foreground};\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n\n &:hover,\n &:focus {\n opacity: 1;\n }\n `}\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: ${foreground};\n cursor: pointer;\n text-decoration: none;\n border-block: ${pxToRem(1)} solid transparent;\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: ${foreground};\n background: ${hoverBg};\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'] {\n position: relative;\n font-weight: ${semiBold};\n border-block: ${pxToRem(1)} solid ${borderColor};\n\n &::before {\n content: '';\n position: absolute;\n width: ${pxToRem(4)};\n inset-inline-start: 0;\n top: 0;\n bottom: 0;\n background-color: ${foreground};\n }\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 return css`\n ${StyledNavListItem} {\n > :first-child {\n padding-inline-start: calc(${navWidth} + 2 * ${theme.base.spacing});\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 { border: borderColor } = navContrastColors(theme);\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\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\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 /* 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 const bg = theme.components.tooltip['background-color'];\n const color = readableColor(bg);\n\n return css`\n background-color: ${bg};\n padding: 0;\n header {\n color: ${color};\n border-bottom: none;\n }\n ${StyledMenuItem} {\n background-color: ${bg};\n color: ${color};\n\n &:hover,\n &:focus {\n background-color: ${bg};\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n `;\n});\n\nStyledAppShellTooltip.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellToggleButton = styled(Button)(({ theme }) => {\n const navBg = theme.components['app-shell'].nav['background-color'];\n let bg = darken(0.2, navBg);\n\n if (getContrast(navBg, bg) < 1.3) {\n bg = lighten(0.2, navBg);\n }\n\n const color = readableColor(bg);\n\n return css`\n background-color: ${bg};\n color: ${color};\n border: none;\n margin-top: calc(1 * ${theme.base.spacing});\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":"NavigationList.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EASH,MAAM,OAAO,CAAC;AA0Bf,OAAO,EACL,gBAAgB,EAEhB,YAAY,EAEb,MAAM,kBAAkB,CAAC;AA0F1B,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"NavigationList.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EASH,MAAM,OAAO,CAAC;AA0Bf,OAAO,EACL,gBAAgB,EAEhB,YAAY,EAEb,MAAM,kBAAkB,CAAC;AA0F1B,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,gBAAgB,CAwInD,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,YAAY,CA4DpC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -39,7 +39,7 @@ const NavigationMenu = props => {
|
|
|
39
39
|
_jsxs(BareButton, { id: uid, ref: itemRef, "aria-expanded": !collapsed, "aria-controls": `${uid}-menu`, "aria-label": primary, onClick: toggleCollapsed, children: [visual && _jsx(StyledNavItemIconBox, { children: visual }), secondary ? (_jsxs(Flex, { container: { direction: 'column', alignItems: 'start' }, children: [_jsx("span", { children: primary }), _jsx(Text, { variant: 'secondary', children: secondary })] })) : (_jsx("span", { children: primary })), navState === 'open' && _jsx(Icon, { name: `caret-${end}`, as: StyledNavListItemExpandCollapse })] }),
|
|
40
40
|
_jsx(NavigationList, { id: `${uid}-menu`, nestedList: true, items: items, collapsed: !navOpen || collapsed })));
|
|
41
41
|
};
|
|
42
|
-
export const NavigationListItem = ({ visual, primary, secondary, href, onClick, items, collapseItems = false, onDismiss, actions, forwardedRef, isMenuItem, count, singleSelect, selected, 'aria-labelledby': ariaLabelledBy, ...restProps }) => {
|
|
42
|
+
export const NavigationListItem = ({ visual, primary, secondary, href, onClick, items, collapseItems = false, onDismiss, actions, forwardedRef, isMenuItem, count, singleSelect, selected, 'aria-labelledby': ariaLabelledBy, 'aria-current': ariaCurrent, ...restProps }) => {
|
|
43
43
|
const { navOpen, navState } = useContext(AppShellContext);
|
|
44
44
|
const t = useI18n();
|
|
45
45
|
const listItemRef = useConsolidatedRef(forwardedRef);
|
|
@@ -85,7 +85,7 @@ export const NavigationListItem = ({ visual, primary, secondary, href, onClick,
|
|
|
85
85
|
const { end } = useDirection();
|
|
86
86
|
const primaryId = useUID();
|
|
87
87
|
return (_createElement(StyledNavListItem, { ...restProps, key: primary, singleSelect: singleSelect, nestedListCollapsed: true },
|
|
88
|
-
_jsx(NavigationListItemWrapper, { tooltipLabel: secondary ? `${primary} ${secondary}` : primary, label: primary, childElementRef: listItemRef, items: actions || items || caseItems, onMenuToggle: setMenuState, children: _jsxs(Component, { ...compProps, ref: listItemRef, ...(navOpen && isMenuItem ? { tabIndex: -1, role: 'menuitem' } : {}), "aria-labelledby": `${primaryId} ${count ? `${primary}-count` : ''} ${ariaLabelledBy}`, ...(hasItems && { 'aria-haspopup': 'menu', 'aria-expanded': menuState === 'open' }), children: [singleSelect && (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledSingleSelectIconBox, children: selected && _jsx(Icon, { name: 'check' }) })), visual && _jsx(StyledNavItemIconBox, { children: visual }), secondary ? (_jsxs(Flex, { container: { direction: 'column', alignItems: 'start' }, children: [_jsx("span", { id: primaryId, children: primary }), _jsx(Text, { variant: 'secondary', children: secondary })] })) : (_jsx("span", { id: primaryId, children: primary })), (hasItems || actions) && navState === 'open' && (_jsx(Icon, { name: `caret-${end}`, as: StyledNavListItemExpandCollapse }))] }) }),
|
|
88
|
+
_jsx(NavigationListItemWrapper, { tooltipLabel: secondary ? `${primary} ${secondary}` : primary, label: primary, childElementRef: listItemRef, items: actions || items || caseItems, onMenuToggle: setMenuState, children: _jsxs(Component, { ...compProps, ref: listItemRef, ...(navOpen && isMenuItem ? { tabIndex: -1, role: 'menuitem' } : {}), "aria-labelledby": `${primaryId} ${count ? `${primary}-count` : ''} ${ariaLabelledBy}`, ...(hasItems && { 'aria-haspopup': 'menu', 'aria-expanded': menuState === 'open' }), "aria-current": ariaCurrent, children: [singleSelect && (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, as: StyledSingleSelectIconBox, children: selected && _jsx(Icon, { name: 'check' }) })), visual && _jsx(StyledNavItemIconBox, { children: visual }), secondary ? (_jsxs(Flex, { container: { direction: 'column', alignItems: 'start' }, children: [_jsx("span", { id: primaryId, children: primary }), _jsx(Text, { variant: 'secondary', children: secondary })] })) : (_jsx("span", { id: primaryId, children: primary })), (hasItems || actions) && navState === 'open' && (_jsx(Icon, { name: `caret-${end}`, as: StyledNavListItemExpandCollapse }))] }) }),
|
|
89
89
|
onDismiss && navOpen && (_jsx(Button, { icon: true, variant: 'simple', as: StyledCaseClose, onClick: onDismiss, "aria-label": t('dismiss_case'), children: _jsx(Icon, { name: 'times' }) })),
|
|
90
90
|
hasItems && (
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
@@ -118,7 +118,7 @@ const NavigationList = ({ items = [], nestedList, id, collapsed, singleSelect })
|
|
|
118
118
|
else {
|
|
119
119
|
ItemComponent = NavigationListItem;
|
|
120
120
|
}
|
|
121
|
-
return (_jsx(ItemComponent, { isMenuItem: nestedList, singleSelect: singleSelect, ...item }, item.id || item.primary));
|
|
121
|
+
return (_jsx(ItemComponent, { isMenuItem: nestedList, singleSelect: singleSelect, "aria-current": item['aria-current'], ...item }, item.id || item.primary));
|
|
122
122
|
}) }));
|
|
123
123
|
};
|
|
124
124
|
export default NavigationList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationList.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAGL,cAAc,EAGd,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,MAAM,EACN,OAAO,EACP,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAG/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OA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,aAAa,GAAG,kBAAkB,CAAC;aACpC;YAED,OAAO,CACL,KAAC,aAAa,IAEZ,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,KACtB,IAAI,IAHH,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,OAAO,CAI5B,CACH,CAAC;QACJ,CAAC,CAAC,GACQ,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n ElementType,\n FC,\n isValidElement,\n MouseEvent,\n MouseEventHandler,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState\n} from 'react';\n\nimport {\n useTheme,\n useArrows,\n useConsolidatedRef,\n useDirection,\n useUID,\n useI18n,\n useEscape\n} from '../../hooks';\nimport ExpandCollapse from '../ExpandCollapse';\nimport BareButton from '../Button/BareButton';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport Text from '../Text';\nimport Button from '../Button';\nimport { OmitStrict } from '../../types';\nimport { PopoverProps } from '../Popover';\nimport Link from '../Link';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport * as caretLeftIcon from '../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\n\nimport NavigationListItemWrapper from './NavigationListItemWrapper';\nimport {\n NavListItemProps,\n NavListItemWrapperProps,\n NavListProps,\n NavMenuProps\n} from './AppShell.types';\nimport {\n StyledNavList,\n StyledNestedNavList,\n StyledNavItemIconBox,\n StyledNavListItem,\n StyledNavListItemExpandCollapse,\n StyledCaseClose,\n StyledSingleSelectIconBox\n} from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\n\nregisterIcon(timesIcon, checkIcon, caretLeftIcon, caretRightIcon);\n\nconst NavigationMenu: FC<NavMenuProps> = props => {\n const { navOpen } = useContext(AppShellContext);\n const {\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n onDismiss,\n actions,\n forwardedRef,\n ...restProps\n } = props;\n\n const uid = useUID();\n\n const { navState } = useContext(AppShellContext);\n const [collapsed, setCollapsed] = useState(true);\n\n const toggleCollapsed = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setCollapsed(state => !state);\n },\n [setCollapsed]\n );\n\n const itemRef = useConsolidatedRef(forwardedRef);\n\n const menuRef = useRef<HTMLLIElement>(null);\n\n useArrows(menuRef, { selector: '[role=\"menuitem\"]', cycle: true });\n\n useEscape(() => {\n setCollapsed(true);\n itemRef.current?.focus();\n }, menuRef);\n\n const { end } = useDirection();\n\n return (\n <StyledNavListItem {...restProps} key={primary} nestedListCollapsed={collapsed} ref={menuRef}>\n <BareButton\n id={uid}\n ref={itemRef}\n aria-expanded={!collapsed}\n aria-controls={`${uid}-menu`}\n aria-label={primary}\n onClick={toggleCollapsed}\n >\n {visual && <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>}\n\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span>{primary}</span>\n )}\n\n {navState === 'open' && <Icon name={`caret-${end}`} as={StyledNavListItemExpandCollapse} />}\n </BareButton>\n\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <NavigationList\n id={`${uid}-menu`}\n nestedList\n items={items}\n collapsed={!navOpen || collapsed}\n />\n </StyledNavListItem>\n );\n};\n\nexport const NavigationListItem: FC<NavListItemProps> = ({\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n collapseItems = false,\n onDismiss,\n actions,\n forwardedRef,\n isMenuItem,\n count,\n singleSelect,\n selected,\n 'aria-labelledby': ariaLabelledBy,\n ...restProps\n}) => {\n const { navOpen, navState } = useContext(AppShellContext);\n const t = useI18n();\n const listItemRef = useConsolidatedRef(forwardedRef);\n const [menuState, setMenuState] = useState('');\n const hasItems =\n (Array.isArray(items) && items.length > 0) || (Array.isArray(actions) && actions.length > 0);\n const compProps: {\n href?: string;\n onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>;\n actions?: NavListItemProps['actions'];\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n 'aria-label'?: string;\n } = {\n onClick: (e: MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>) => {\n e.stopPropagation();\n onClick?.(e);\n },\n href\n };\n\n let caseItems: NavListItemWrapperProps['items'] | undefined;\n if (onDismiss) {\n caseItems = [\n {\n primary: t('go_to_noun', [primary]),\n onClick\n },\n {\n primary: t('dismiss_case'),\n onClick: onDismiss\n }\n ];\n }\n\n let Component: ElementType;\n\n if (href) {\n Component = Link;\n } else {\n Component = BareButton;\n }\n\n useEffect(() => {\n if (!navOpen && actions) {\n const node = document.getElementsByTagName('body')[0];\n const clickEvent = document.createEvent('MouseEvent');\n clickEvent.initEvent('mousedown', true, true);\n node.dispatchEvent(clickEvent);\n }\n if (navOpen && isMenuItem && listItemRef.current?.parentElement?.matches(':first-child'))\n listItemRef.current?.focus();\n }, [navOpen]);\n\n const { end } = useDirection();\n const primaryId = useUID();\n\n return (\n <StyledNavListItem {...restProps} key={primary} singleSelect={singleSelect} nestedListCollapsed>\n <NavigationListItemWrapper\n tooltipLabel={secondary ? `${primary} ${secondary}` : primary}\n label={primary}\n childElementRef={listItemRef}\n items={actions || items || caseItems}\n onMenuToggle={setMenuState}\n >\n <Component\n {...compProps}\n ref={listItemRef}\n {...(navOpen && isMenuItem ? { tabIndex: -1, role: 'menuitem' } : {})}\n aria-labelledby={`${primaryId} ${count ? `${primary}-count` : ''} ${ariaLabelledBy}`}\n {...(hasItems && { 'aria-haspopup': 'menu', 'aria-expanded': menuState === 'open' })}\n >\n {singleSelect && (\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledSingleSelectIconBox}\n >\n {selected && <Icon name='check' />}\n </Flex>\n )}\n\n {visual && <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>}\n\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span id={primaryId}>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span id={primaryId}>{primary}</span>\n )}\n\n {(hasItems || actions) && navState === 'open' && (\n <Icon name={`caret-${end}`} as={StyledNavListItemExpandCollapse} />\n )}\n </Component>\n </NavigationListItemWrapper>\n\n {onDismiss && navOpen && (\n <Button\n icon\n variant='simple'\n as={StyledCaseClose}\n onClick={onDismiss}\n aria-label={t('dismiss_case')}\n >\n <Icon name='times' />\n </Button>\n )}\n\n {hasItems && (\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n <NavigationList nestedList items={actions || items} collapsed={!navOpen || collapseItems} />\n )}\n </StyledNavListItem>\n );\n};\n\nconst NavigationList: FC<NavListProps> = ({\n items = [],\n nestedList,\n id,\n collapsed,\n singleSelect\n}) => {\n let Component: ElementType = StyledNavList;\n let ItemComponent: ElementType;\n const { navOpen } = useContext(AppShellContext);\n\n let fwdProps: {\n as?: ElementType;\n forwardedAs?: ElementType;\n nullWhenCollapsed?: boolean;\n transitionSpeed?: string;\n collapsed: boolean;\n } = {\n collapsed: !!collapsed\n };\n\n const {\n base: { animation }\n } = useTheme();\n\n if (nestedList) {\n fwdProps = {\n as: ExpandCollapse,\n forwardedAs: 'ul',\n nullWhenCollapsed: true,\n transitionSpeed: items.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed,\n ...fwdProps\n };\n\n Component = StyledNestedNavList;\n }\n\n return (\n <Component {...(nestedList ? { role: 'menu', id } : {})} {...fwdProps}>\n {items.map(item => {\n if (isValidElement<any>(item)) return item;\n\n if (item.items && item.items.length > 0 && navOpen) {\n ItemComponent = NavigationMenu;\n } else {\n ItemComponent = NavigationListItem;\n }\n\n return (\n <ItemComponent\n key={item.id || item.primary}\n isMenuItem={nestedList}\n singleSelect={singleSelect}\n {...item}\n />\n );\n })}\n </Component>\n );\n};\n\nexport default NavigationList;\n"]}
|
|
1
|
+
{"version":3,"file":"Navig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EAAE,IAAI;YACvB,eAAe,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,YAAY,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK;YACtF,GAAG,QAAQ;SACZ,CAAC;QAEF,SAAS,GAAG,mBAAmB,CAAC;KACjC;IAED,OAAO,CACL,KAAC,SAAS,OAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAM,QAAQ,YAClE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAChB,IAAI,cAAc,CAAM,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YAE3C,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,EAAE;gBAClD,aAAa,GAAG,cAAc,CAAC;aAChC;iBAAM;gBACL,aAAa,GAAG,kBAAkB,CAAC;aACpC;YAED,OAAO,CACL,KAAC,aAAa,IAEZ,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,kBACZ,IAAI,CAAC,cAAc,CAAC,KAC9B,IAAI,IAJH,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,OAAO,CAK5B,CACH,CAAC;QACJ,CAAC,CAAC,GACQ,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n ElementType,\n FC,\n isValidElement,\n MouseEvent,\n MouseEventHandler,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState\n} from 'react';\n\nimport {\n useTheme,\n useArrows,\n useConsolidatedRef,\n useDirection,\n useUID,\n useI18n,\n useEscape\n} from '../../hooks';\nimport ExpandCollapse from '../ExpandCollapse';\nimport BareButton from '../Button/BareButton';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport Text from '../Text';\nimport Button from '../Button';\nimport { OmitStrict } from '../../types';\nimport { PopoverProps } from '../Popover';\nimport Link from '../Link';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport * as caretLeftIcon from '../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\n\nimport NavigationListItemWrapper from './NavigationListItemWrapper';\nimport {\n NavListItemProps,\n NavListItemWrapperProps,\n NavListProps,\n NavMenuProps\n} from './AppShell.types';\nimport {\n StyledNavList,\n StyledNestedNavList,\n StyledNavItemIconBox,\n StyledNavListItem,\n StyledNavListItemExpandCollapse,\n StyledCaseClose,\n StyledSingleSelectIconBox\n} from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\n\nregisterIcon(timesIcon, checkIcon, caretLeftIcon, caretRightIcon);\n\nconst NavigationMenu: FC<NavMenuProps> = props => {\n const { navOpen } = useContext(AppShellContext);\n const {\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n onDismiss,\n actions,\n forwardedRef,\n ...restProps\n } = props;\n\n const uid = useUID();\n\n const { navState } = useContext(AppShellContext);\n const [collapsed, setCollapsed] = useState(true);\n\n const toggleCollapsed = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setCollapsed(state => !state);\n },\n [setCollapsed]\n );\n\n const itemRef = useConsolidatedRef(forwardedRef);\n\n const menuRef = useRef<HTMLLIElement>(null);\n\n useArrows(menuRef, { selector: '[role=\"menuitem\"]', cycle: true });\n\n useEscape(() => {\n setCollapsed(true);\n itemRef.current?.focus();\n }, menuRef);\n\n const { end } = useDirection();\n\n return (\n <StyledNavListItem {...restProps} key={primary} nestedListCollapsed={collapsed} ref={menuRef}>\n <BareButton\n id={uid}\n ref={itemRef}\n aria-expanded={!collapsed}\n aria-controls={`${uid}-menu`}\n aria-label={primary}\n onClick={toggleCollapsed}\n >\n {visual && <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>}\n\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span>{primary}</span>\n )}\n\n {navState === 'open' && <Icon name={`caret-${end}`} as={StyledNavListItemExpandCollapse} />}\n </BareButton>\n\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <NavigationList\n id={`${uid}-menu`}\n nestedList\n items={items}\n collapsed={!navOpen || collapsed}\n />\n </StyledNavListItem>\n );\n};\n\nexport const NavigationListItem: FC<NavListItemProps> = ({\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n collapseItems = false,\n onDismiss,\n actions,\n forwardedRef,\n isMenuItem,\n count,\n singleSelect,\n selected,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-current': ariaCurrent,\n ...restProps\n}) => {\n const { navOpen, navState } = useContext(AppShellContext);\n const t = useI18n();\n const listItemRef = useConsolidatedRef(forwardedRef);\n const [menuState, setMenuState] = useState('');\n const hasItems =\n (Array.isArray(items) && items.length > 0) || (Array.isArray(actions) && actions.length > 0);\n const compProps: {\n href?: string;\n onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>;\n actions?: NavListItemProps['actions'];\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n 'aria-label'?: string;\n } = {\n onClick: (e: MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>) => {\n e.stopPropagation();\n onClick?.(e);\n },\n href\n };\n\n let caseItems: NavListItemWrapperProps['items'] | undefined;\n if (onDismiss) {\n caseItems = [\n {\n primary: t('go_to_noun', [primary]),\n onClick\n },\n {\n primary: t('dismiss_case'),\n onClick: onDismiss\n }\n ];\n }\n\n let Component: ElementType;\n\n if (href) {\n Component = Link;\n } else {\n Component = BareButton;\n }\n\n useEffect(() => {\n if (!navOpen && actions) {\n const node = document.getElementsByTagName('body')[0];\n const clickEvent = document.createEvent('MouseEvent');\n clickEvent.initEvent('mousedown', true, true);\n node.dispatchEvent(clickEvent);\n }\n if (navOpen && isMenuItem && listItemRef.current?.parentElement?.matches(':first-child'))\n listItemRef.current?.focus();\n }, [navOpen]);\n\n const { end } = useDirection();\n const primaryId = useUID();\n\n return (\n <StyledNavListItem {...restProps} key={primary} singleSelect={singleSelect} nestedListCollapsed>\n <NavigationListItemWrapper\n tooltipLabel={secondary ? `${primary} ${secondary}` : primary}\n label={primary}\n childElementRef={listItemRef}\n items={actions || items || caseItems}\n onMenuToggle={setMenuState}\n >\n <Component\n {...compProps}\n ref={listItemRef}\n {...(navOpen && isMenuItem ? { tabIndex: -1, role: 'menuitem' } : {})}\n aria-labelledby={`${primaryId} ${count ? `${primary}-count` : ''} ${ariaLabelledBy}`}\n {...(hasItems && { 'aria-haspopup': 'menu', 'aria-expanded': menuState === 'open' })}\n aria-current={ariaCurrent}\n >\n {singleSelect && (\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledSingleSelectIconBox}\n >\n {selected && <Icon name='check' />}\n </Flex>\n )}\n\n {visual && <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>}\n\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span id={primaryId}>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span id={primaryId}>{primary}</span>\n )}\n\n {(hasItems || actions) && navState === 'open' && (\n <Icon name={`caret-${end}`} as={StyledNavListItemExpandCollapse} />\n )}\n </Component>\n </NavigationListItemWrapper>\n\n {onDismiss && navOpen && (\n <Button\n icon\n variant='simple'\n as={StyledCaseClose}\n onClick={onDismiss}\n aria-label={t('dismiss_case')}\n >\n <Icon name='times' />\n </Button>\n )}\n\n {hasItems && (\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n <NavigationList nestedList items={actions || items} collapsed={!navOpen || collapseItems} />\n )}\n </StyledNavListItem>\n );\n};\n\nconst NavigationList: FC<NavListProps> = ({\n items = [],\n nestedList,\n id,\n collapsed,\n singleSelect\n}) => {\n let Component: ElementType = StyledNavList;\n let ItemComponent: ElementType;\n const { navOpen } = useContext(AppShellContext);\n\n let fwdProps: {\n as?: ElementType;\n forwardedAs?: ElementType;\n nullWhenCollapsed?: boolean;\n transitionSpeed?: string;\n collapsed: boolean;\n } = {\n collapsed: !!collapsed\n };\n\n const {\n base: { animation }\n } = useTheme();\n\n if (nestedList) {\n fwdProps = {\n as: ExpandCollapse,\n forwardedAs: 'ul',\n nullWhenCollapsed: true,\n transitionSpeed: items.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed,\n ...fwdProps\n };\n\n Component = StyledNestedNavList;\n }\n\n return (\n <Component {...(nestedList ? { role: 'menu', id } : {})} {...fwdProps}>\n {items.map(item => {\n if (isValidElement<any>(item)) return item;\n\n if (item.items && item.items.length > 0 && navOpen) {\n ItemComponent = NavigationMenu;\n } else {\n ItemComponent = NavigationListItem;\n }\n\n return (\n <ItemComponent\n key={item.id || item.primary}\n isMenuItem={nestedList}\n singleSelect={singleSelect}\n aria-current={item['aria-current']}\n {...item}\n />\n );\n })}\n </Component>\n );\n};\n\nexport default NavigationList;\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { PopoverProps } from '../Popover';
|
|
3
|
-
import type { AsProp
|
|
3
|
+
import type { AsProp } from '../../types';
|
|
4
4
|
import { OperatorProps } from './AppShell.types';
|
|
5
5
|
declare const Operator: import("react").ForwardRefExoticComponent<{
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
actions: OperatorProps['actions'];
|
|
8
|
-
popover?:
|
|
8
|
+
popover?: Pick<PopoverProps<string>, "ref" | "className" | "placement" | "arrow" | "modifiers" | "strategy" | "portal" | "showDelay" | "hideDelay" | "groupId" | "hideOnTargetHidden" | "onHide"> | undefined;
|
|
9
9
|
} & AsProp & import("react").RefAttributes<HTMLButtonElement>>;
|
|
10
10
|
export default Operator;
|
|
11
11
|
//# sourceMappingURL=Operator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operator.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Operator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAO,SAAS,EAAuB,MAAM,OAAO,CAAC;AAIjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Operator.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Operator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAO,SAAS,EAAuB,MAAM,OAAO,CAAC;AAIjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,aAAa,CAAC;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,QAAA,MAAM,QAAQ;cAQE,SAAS;aACV,aAAa,CAAC,SAAS,CAAC;;8DA6DtC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FunctionComponent, Ref, SyntheticEvent } from 'react';
|
|
2
|
-
import { BaseProps, ForwardProps, PropsWithDefaults, NoChildrenProp
|
|
2
|
+
import { BaseProps, ForwardProps, PropsWithDefaults, NoChildrenProp } from '../../types';
|
|
3
3
|
export interface AvatarProps extends BaseProps, NoChildrenProp {
|
|
4
4
|
/** The name of the identity the Avatar represents. */
|
|
5
5
|
name: string;
|
|
@@ -30,7 +30,7 @@ export interface AvatarProps extends BaseProps, NoChildrenProp {
|
|
|
30
30
|
}
|
|
31
31
|
type AvatarPropsWithDefaults = PropsWithDefaults<AvatarProps, 'shape' | 'size'>;
|
|
32
32
|
export declare const StyledAvatarImage: import("styled-components").StyledComponent<FunctionComponent<import("../Image").ImageProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
33
|
-
export declare const StyledAvatar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme,
|
|
33
|
+
export declare const StyledAvatar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<AvatarPropsWithDefaults, "color" | "size" | "icon" | "backgroundColor" | "ref" | "status" | "className" | "shape" | "imageSrc" | "onImageError"> & {
|
|
34
34
|
hasSrc?: boolean | undefined;
|
|
35
35
|
hasBrokenImage?: boolean | undefined;
|
|
36
36
|
}, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,GAAG,EAEH,cAAc,EAIf,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,cAAc,
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,GAAG,EAEH,cAAc,EAIf,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,cAAc,EAEf,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,WAAY,SAAQ,SAAS,EAAE,cAAc;IAC5D,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;IAC9B,yDAAyD;IACzD,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,kEAAkE;IAClE,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC/D,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG,gBAAgB,CAAC,CAAC;CAC9C;AAED,KAAK,uBAAuB,GAAG,iBAAiB,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;AAuBhF,eAAO,MAAM,iBAAiB,mKAQ7B,CAAC;AAEF,eAAO,MAAM,YAAY;;;SAuExB,CAAC;AAIF,eAAO,MAAM,YAAY,4IA0BvB,CAAC;AAiBH;;;;GAIG;AACH,QAAA,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,GAAG,YAAY,CAyDzD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode, Ref, MouseEvent } from 'react';
|
|
2
|
-
import { BaseProps, ForwardProps } from '../../types';
|
|
2
|
+
import { BaseProps, ForwardProps, ExcludeStrict } from '../../types';
|
|
3
3
|
import { FlexProps } from '../Flex';
|
|
4
4
|
export interface BackdropProps extends BaseProps {
|
|
5
5
|
/**
|
|
@@ -10,7 +10,7 @@ export interface BackdropProps extends BaseProps {
|
|
|
10
10
|
/** Any React Node to be rendered on top of the Backdrop component. */
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
/** Props passed to Flex container. */
|
|
13
|
-
container?:
|
|
13
|
+
container?: ExcludeStrict<FlexProps['container'], true>;
|
|
14
14
|
/**
|
|
15
15
|
* Toggles visibility of Backdrop.
|
|
16
16
|
* @default false
|
|
@@ -44,7 +44,7 @@ export interface BackdropProps extends BaseProps {
|
|
|
44
44
|
/** Ref for a Backdrop's root div element. */
|
|
45
45
|
ref?: Ref<HTMLDivElement>;
|
|
46
46
|
}
|
|
47
|
-
export declare const StyledBackdrop: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme,
|
|
47
|
+
export declare const StyledBackdrop: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<BackdropProps, "children" | "ref" | "className" | "onClick" | "variant" | "container" | "onBeforeTransitionIn" | "onAfterTransitionIn" | "onBeforeTransitionOut" | "onAfterTransitionOut"> & Required<Pick<BackdropProps, "alpha" | "open" | "position" | "transitionSpeed">> & {
|
|
48
48
|
opacity: 0 | 1;
|
|
49
49
|
}, never>;
|
|
50
50
|
declare const Backdrop: FunctionComponent<BackdropProps & ForwardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Backdrop.d.ts","sourceRoot":"","sources":["../../../src/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EAKT,GAAG,EACH,UAAU,EAEX,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,SAAS,EAAqB,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Backdrop.d.ts","sourceRoot":"","sources":["../../../src/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EAKT,GAAG,EACH,UAAU,EAEX,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,SAAS,EAAqB,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxF,OAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,sCAAsC;IACtC,SAAS,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,CAAC;IACxD;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,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BAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;QAC9D,4EAA4E;QAC5E,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,GAAG,EAAE;YAC1C,mFAAmF;YACnF,uDAAuD;YACvD,oBAAoB,EAAE,EAAE,CAAC;YACzB,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACpB;QACD,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,GAAG,EAAE;YAC1C,sBAAsB;YACtB,mBAAmB,EAAE,EAAE,CAAC;YACxB,QAAQ,CAAC,MAAM,CAAC,CAAC;SAClB;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CAAC,IAAI,IAAI,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC1C,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EACpE,EAAE,EAAE,cAAc,EAClB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACxD,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,GAAG,EAAE,IAAI,KACL,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n FunctionComponent,\n ReactNode,\n useEffect,\n useState,\n useCallback,\n forwardRef,\n Ref,\n MouseEvent,\n PropsWithoutRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { reflow } from '../../utils';\nimport { BaseProps, PropsWithDefaults, ForwardProps } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport { useConsolidatedRef } from '../../hooks';\n\nexport interface BackdropProps extends BaseProps {\n /**\n * Opacity of the Backdrop.\n * @default 0.4\n */\n alpha?: number;\n /** Any React Node to be rendered on top of the Backdrop component. */\n children?: ReactNode;\n /** Props passed to Flex container. */\n container?:
|
|
1
|
+
{"version":3,"file":"Backdrop.js","sourceRoot":"","sources":["../../../src/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,UAAU,EAIX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAmDjD,MAAM,sBAAsB,GAAG;IAC7B,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,CAAC;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAiD,KAAK,CAAC,EAAE;IAC/F,MAAM,EACJ,KAAK,EAAE,EAAE,IAAI,EAAE,EAChB,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACpD,MAAM,kBAAkB,GAAG,YAAY,sBAAsB,CAAC,KAAK,CAAC,eAAe,CAAC,MAClF,IAAI,CAAC,SAAS,CAAC,KACjB,SAAS,CAAC;IAEV,OAAO,GAAG,CAAA;gBACI,QAAQ;eACT,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CA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AAE,UAAU,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EACpE,EAAE,EAAE,cAAc,EAClB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACxD,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,GAAG,EAAE,IAAI,KACL,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n FunctionComponent,\n ReactNode,\n useEffect,\n useState,\n useCallback,\n forwardRef,\n Ref,\n MouseEvent,\n PropsWithoutRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { reflow } from '../../utils';\nimport { BaseProps, PropsWithDefaults, ForwardProps, ExcludeStrict } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport { useConsolidatedRef } from '../../hooks';\n\nexport interface BackdropProps extends BaseProps {\n /**\n * Opacity of the Backdrop.\n * @default 0.4\n */\n alpha?: number;\n /** Any React Node to be rendered on top of the Backdrop component. */\n children?: ReactNode;\n /** Props passed to Flex container. */\n container?: ExcludeStrict<FlexProps['container'], true>;\n /**\n * Toggles visibility of Backdrop.\n * @default false\n */\n open?: boolean;\n /**\n * Determines the color of the Backdrop.\n * @default 'dark'\n */\n variant?: 'dark' | 'light';\n /**\n * Transition speed of Backdrop animation.\n * @default 'medium'\n */\n transitionSpeed?: 'slow' | 'medium' | 'fast' | 'none';\n /**\n * The position of the Backdrop.\n * @default 'fixed'\n */\n position?: 'absolute' | 'fixed';\n /** Accepts a callback function for click event on Backdrop. */\n onClick?: (e: MouseEvent<HTMLDivElement>) => void;\n /** Accepts a callback that gets invoked before opening Backdrop. */\n onBeforeTransitionIn?: () => void;\n /** Accepts a callback that gets invoked after opening Backdrop. */\n onAfterTransitionIn?: () => void;\n /** Accepts a callback that gets invoked before closing Backdrop. */\n onBeforeTransitionOut?: () => void;\n /** Accepts a callback that gets invoked after closing Backdrop */\n onAfterTransitionOut?: () => void;\n /** Ref for a Backdrop's root div element. */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype BackdropPropsWithDefaults = PropsWithDefaults<\n BackdropProps,\n 'open' | 'transitionSpeed' | 'alpha' | 'position'\n>;\n\nconst transitionSpeedToTheme = {\n slow: 2,\n medium: 1,\n fast: 0.5,\n none: 0\n} as const;\n\nexport const StyledBackdrop = styled.div<BackdropPropsWithDefaults & { opacity: 0 | 1 }>(props => {\n const {\n theme: { base }\n } = props;\n const { opacity, alpha, variant, position } = props;\n const transitionDuration = `max(calc(${transitionSpeedToTheme[props.transitionSpeed]} * ${\n base.animation.speed\n }), 1ms)`;\n\n return css`\n position: ${position};\n z-index: ${position === 'fixed' ? base['z-index'].backdrop : base['z-index'].popover + 1};\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n border-radius: inherit;\n opacity: ${opacity};\n transition-property: opacity;\n transition-timing-function: ${props.theme.base.animation.timing.ease};\n /* stylelint-disable declaration-block-no-duplicate-properties */\n transition-duration: 1ms;\n transition-duration: ${transitionDuration};\n /* stylelint-enable declaration-block-no-duplicate-properties */\n\n ${variant === 'dark' &&\n css`\n background: rgba(0, 0, 0, ${alpha});\n `}\n\n ${variant === 'light' &&\n css`\n background: rgba(255, 255, 255, ${alpha});\n `}\n `;\n});\n\nStyledBackdrop.defaultProps = defaultThemeProp;\n\ntype State = 'closed' | 'opening' | 'open' | 'closing';\n\nconst Backdrop: FunctionComponent<BackdropProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<BackdropProps>, ref: BackdropProps['ref']) => {\n const {\n children,\n container,\n open = false,\n variant = 'dark',\n transitionSpeed = 'medium',\n alpha = 0.6,\n position = 'fixed',\n onBeforeTransitionIn,\n onAfterTransitionIn,\n onBeforeTransitionOut,\n onAfterTransitionOut,\n ...restProps\n } = props;\n\n const cRef = useConsolidatedRef(ref);\n\n const [state, setState] = useState<State>('closed');\n\n const onTransitionEnd = useCallback(\n (e: TransitionEvent) => {\n if (e.propertyName !== 'opacity' || e.target !== e.currentTarget) return;\n let nextState: State;\n\n if (state === 'closing') {\n nextState = 'closed';\n onAfterTransitionOut?.();\n } else {\n nextState = 'open';\n onAfterTransitionIn?.();\n }\n\n setState(nextState);\n },\n [state, onAfterTransitionOut, onAfterTransitionIn]\n );\n\n useEffect(() => {\n if (open) {\n if (state === 'closed' || state === 'closing') {\n onBeforeTransitionIn?.();\n reflow();\n setState('opening');\n }\n } else if (state === 'open' || state === 'opening') {\n onBeforeTransitionOut?.();\n setState('closing');\n }\n }, [open]);\n\n // Using a separate effect instead of combined logic above as it seems more intuitive to mentally manage.\n useEffect(() => {\n if (!cRef.current) return;\n const opacity = window.getComputedStyle(cRef.current).opacity;\n // If the opacity is already at the destination value, sync the state value.\n if (state === 'closing' && opacity === '0') {\n // Since the transition never ran, we have to pretend it did and call the callback.\n // TODO: This maybe can be fixed with the animation api\n onAfterTransitionOut?.();\n setState('closed');\n }\n if (state === 'opening' && opacity === '1') {\n // ditto, see above...\n onAfterTransitionIn?.();\n setState('open');\n }\n }, [state]);\n\n return !open && state === 'closed' ? null : (\n <Flex\n container={{ justify: 'center', alignItems: 'center', ...container }}\n as={StyledBackdrop}\n transitionSpeed={transitionSpeed}\n opacity={state === 'opening' || state === 'open' ? 1 : 0}\n alpha={alpha}\n variant={variant}\n position={position}\n onTransitionEnd={onTransitionEnd}\n ref={cRef}\n {...restProps}\n >\n {children}\n </Flex>\n );\n }\n);\n\nexport default Backdrop;\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
-
import { BaseProps, ForwardProps } from '../../types';
|
|
2
|
+
import { BaseProps, ExcludeStrict, ForwardProps } from '../../types';
|
|
3
3
|
import { FlexProps } from '../Flex';
|
|
4
4
|
export interface CardContentProps extends BaseProps {
|
|
5
5
|
/** The content of the Card. */
|
|
6
6
|
children: ReactNode;
|
|
7
|
-
container?:
|
|
7
|
+
container?: ExcludeStrict<FlexProps['container'], true>;
|
|
8
8
|
}
|
|
9
9
|
export declare const StyledCardContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
10
|
declare const CardContent: FunctionComponent<CardContentProps & ForwardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACrE,OAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAM1C,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,+BAA+B;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,CAAC;CACzD;AAED,eAAO,MAAM,iBAAiB,yGAY5B,CAAC;AAIH,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAUnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.js","sourceRoot":"","sources":["../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;MACN,aAAa,aAAa,UAAU,IAAI,UAAU;;4BAE5B,KAAK,CAAC,IAAI,CAAC,OAAO,UAAU,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO;;;YAGzE,gBAAgB;;;;GAIzB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,WAAW,GAAuD,CAAC,EACvE,QAAQ,EACR,SAAS,EACT,GAAG,SAAS,EACuC,EAAE,EAAE;IACvD,OAAO,CACL,KAAC,IAAI,OAAK,SAAS,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE,EAAE,iBAAiB,YACzF,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { FunctionComponent, PropsWithChildren, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport { StyledPopover } from '../Popover';\n\nimport { StyledCard } from './Card';\nimport { StyledCardFooter } from './CardFooter';\n\nexport interface CardContentProps extends BaseProps {\n /** The content of the Card. */\n children: ReactNode;\n container?:
|
|
1
|
+
{"version":3,"file":"CardContent.js","sourceRoot":"","sources":["../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;MACN,aAAa,aAAa,UAAU,IAAI,UAAU;;4BAE5B,KAAK,CAAC,IAAI,CAAC,OAAO,UAAU,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO;;;YAGzE,gBAAgB;;;;GAIzB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,WAAW,GAAuD,CAAC,EACvE,QAAQ,EACR,SAAS,EACT,GAAG,SAAS,EACuC,EAAE,EAAE;IACvD,OAAO,CACL,KAAC,IAAI,OAAK,SAAS,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE,EAAE,iBAAiB,YACzF,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { FunctionComponent, PropsWithChildren, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ExcludeStrict, ForwardProps } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport { StyledPopover } from '../Popover';\n\nimport { StyledCard } from './Card';\nimport { StyledCardFooter } from './CardFooter';\n\nexport interface CardContentProps extends BaseProps {\n /** The content of the Card. */\n children: ReactNode;\n container?: ExcludeStrict<FlexProps['container'], true>;\n}\n\nexport const StyledCardContent = styled.div(({ theme }) => {\n return css`\n ${StyledPopover} &, &:not(${StyledCard} ${StyledCard} > &) {\n position: relative;\n padding: calc(1.5 * ${theme.base.spacing}) calc(${theme.components.card.padding} * 2);\n\n & + &,\n & + ${StyledCardFooter} {\n padding-block-start: 0;\n }\n }\n `;\n});\n\nStyledCardContent.defaultProps = defaultThemeProp;\n\nconst CardContent: FunctionComponent<CardContentProps & ForwardProps> = ({\n children,\n container,\n ...restProps\n}: PropsWithChildren<CardContentProps & ForwardProps>) => {\n return (\n <Flex {...restProps} container={{ direction: 'column', ...container }} as={StyledCardContent}>\n {children}\n </Flex>\n );\n};\n\nexport default CardContent;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const StyledSelectInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
-
export declare const StyledComboBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("
|
|
2
|
+
export declare const StyledComboBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<import("../FormControl").FormControlProps, keyof import("../FormControl").FormControlProps> & Required<Pick<import("../FormControl").FormControlProps, never>> & {
|
|
3
3
|
hasSuggestion?: boolean | undefined;
|
|
4
4
|
}, never>;
|
|
5
5
|
//# sourceMappingURL=ComboBox.styles.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TranslationFunction, TranslationPack } from '../../i18n';
|
|
2
|
+
import { ExcludeStrict } from '../../types';
|
|
2
3
|
import { DateTimeFormat, DateTimeVariant } from './DateTime.types';
|
|
3
4
|
import { ClockFormat } from './Input/utils';
|
|
4
5
|
type DateTimeFormatOptions = {
|
|
@@ -7,7 +8,7 @@ type DateTimeFormatOptions = {
|
|
|
7
8
|
timeZone?: string;
|
|
8
9
|
clockFormat?: ClockFormat;
|
|
9
10
|
} & ({
|
|
10
|
-
variant:
|
|
11
|
+
variant: ExcludeStrict<DateTimeVariant, 'quarteryear'>;
|
|
11
12
|
t?: TranslationFunction<TranslationPack>;
|
|
12
13
|
} | {
|
|
13
14
|
variant: 'quarteryear';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAmB,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,WAAW,EAMZ,MAAM,eAAe,CAAC;AAavB,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GAAG,CACA;IACE,OAAO,EAAE,aAAa,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IACvD,CAAC,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CAC1C,GACD;IAAE,OAAO,EAAE,aAAa,CAAC;IAAC,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAA;CAAE,CACtE,CAAC;AA+HF,wBAAgB,cAAc,CAC5B,KAAK,EAAE,IAAI,EACX,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,EA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,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAEzC,IAAI,KAAK,GAAG,CAAC,EAAE;YACb,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACvC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;gBAC7E,KAAK,EAAE,MAAM;gBACb,IAAI;gBACJ,WAAW;aACZ,CAAC,CAAC;YAEH,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;SACzE;KACF;IACD,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import { TranslationFunction, TranslationPack } from '../../i18n';\nimport { cap } from '../../utils';\n\nimport { AbsoluteVariant, DateTimeFormat, DateTimeVariant } from './DateTime.types';\nimport {\n ClockFormat,\n getEndOfWeek,\n getQuarter,\n getStartOfWeek,\n getWeek,\n getWeekYear\n} from './Input/utils';\n\nconst unitsInMs = {\n year: 24 * 60 * 60 * 1000 * 365,\n month: (24 * 60 * 60 * 1000 * 365) / 12,\n day: 24 * 60 * 60 * 1000,\n hour: 60 * 60 * 1000,\n minute: 60 * 1000,\n second: 1000\n} satisfies Partial<Record<Intl.RelativeTimeFormatUnit, number>>;\n\ntype TimeUnit = keyof typeof unitsInMs;\n\ntype DateTimeFormatOptions = {\n locale: string;\n format: DateTimeFormat;\n timeZone?: string;\n clockFormat?: ClockFormat;\n} & (\n | {\n variant: Exclude<DateTimeVariant, 'quarteryear'>;\n t?: TranslationFunction<TranslationPack>;\n }\n | { variant: 'quarteryear'; t: TranslationFunction<TranslationPack> }\n);\n\ntype TimeOptions = Pick<Intl.DateTimeFormatOptions, 'hour' | 'minute' | 'second' | 'hour12'>;\n\nconst timeShort = {\n hour: 'numeric',\n minute: 'numeric'\n} satisfies TimeOptions;\n\nconst timeShort12 = {\n ...timeShort,\n hour12: true\n} satisfies TimeOptions;\n\nconst timeShort24 = {\n ...timeShort,\n hour12: false\n} satisfies TimeOptions;\n\nconst timeLong = {\n ...timeShort,\n second: 'numeric'\n} satisfies TimeOptions;\n\nconst timeLong12 = {\n ...timeShort12,\n second: 'numeric'\n} satisfies TimeOptions;\n\nconst timeLong24 = {\n ...timeShort24,\n second: 'numeric'\n} satisfies TimeOptions;\n\ntype AddClockFormatToTimeKeys<Key extends DateTimeVariant> = Key extends `${string}time`\n ? `${Key}${'' | 12 | 24}`\n : Key;\n\nconst formatMapping = {\n date: {\n short: { year: 'numeric', month: 'short', day: 'numeric' },\n long: { year: 'numeric', month: 'long', day: 'numeric' },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric' }\n },\n datetime: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort }\n },\n datetime12: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort12 },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong12 },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort12 }\n },\n datetime24: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort24 },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong24 },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort24 }\n },\n time: {\n short: timeShort,\n long: timeLong,\n numeric: timeShort\n },\n time12: {\n short: timeShort12,\n long: timeLong12,\n numeric: timeShort12\n },\n time24: {\n short: timeShort24,\n long: timeLong24,\n numeric: timeShort24\n },\n month: {\n short: { month: 'short' },\n long: { month: 'long' },\n numeric: { month: 'numeric' }\n },\n monthyear: {\n short: { year: 'numeric', month: 'short' },\n long: { year: 'numeric', month: 'long' },\n numeric: { year: 'numeric', month: 'numeric' }\n },\n week: {\n short: { month: 'short', day: 'numeric' },\n long: { month: 'long', day: 'numeric' },\n numeric: { month: 'numeric', day: 'numeric' }\n },\n year: {\n short: { year: 'numeric' },\n long: { year: 'numeric' },\n numeric: { year: '2-digit' }\n },\n relative: {\n short: { style: 'long', numeric: 'auto' },\n long: { style: 'long', numeric: 'auto' },\n numeric: { style: 'short', numeric: 'auto' }\n }\n} satisfies Record<\n AddClockFormatToTimeKeys<Exclude<AbsoluteVariant, 'quarteryear'>>,\n Record<DateTimeFormat, Intl.DateTimeFormatOptions>\n> &\n Record<'relative', Record<DateTimeFormat, Intl.RelativeTimeFormatOptions>>;\n\nconst dateTimeFormatCache: Record<\n // locale\n string,\n Record<\n // timeZone\n string,\n Map<Intl.DateTimeFormatOptions, Intl.DateTimeFormat>\n >\n> = {};\n\nconst relativeTimeFormatCache: Record<\n // locale\n string,\n Map<Intl.RelativeTimeFormatOptions, Intl.RelativeTimeFormat>\n> = {};\n\nconst displayNamesCache: Record<\n // locale\n string,\n Intl.DateTimeDisplayNames\n> = {};\n\nexport function formatDateTime(\n value: Date,\n { t, locale, format, variant, clockFormat, timeZone }: DateTimeFormatOptions\n) {\n const getFormattedDate = (\n date: Date,\n dateVariant: Exclude<AbsoluteVariant, 'quarteryear'>,\n overrideTimeZone?: string\n ) => {\n const resolvedVariant: AddClockFormatToTimeKeys<typeof dateVariant> =\n dateVariant === 'time' || dateVariant === 'datetime'\n ? `${dateVariant}${clockFormat ?? ''}`\n : dateVariant;\n const resolvedTimeZone = overrideTimeZone ?? timeZone;\n const resolvedOptions = formatMapping[resolvedVariant][format];\n\n dateTimeFormatCache[locale] ??= {};\n dateTimeFormatCache[locale][`${resolvedTimeZone}`] ??= new Map();\n\n const map = dateTimeFormatCache[locale][`${resolvedTimeZone}`];\n\n if (!map.has(resolvedOptions)) {\n map.set(\n resolvedOptions,\n new Intl.DateTimeFormat(locale, {\n ...resolvedOptions,\n timeZone: resolvedTimeZone\n })\n );\n }\n\n return map.get(resolvedOptions)!.format(date);\n };\n\n const relativeTimeFormatter = (relativeValue: number, unit: TimeUnit) => {\n const resolvedOptions = formatMapping.relative[format];\n\n relativeTimeFormatCache[locale] ??= new Map();\n const map = relativeTimeFormatCache[locale];\n\n if (!map.has(resolvedOptions)) {\n map.set(resolvedOptions, new Intl.RelativeTimeFormat(locale, resolvedOptions));\n }\n\n return map.get(resolvedOptions)!.format(relativeValue, unit);\n };\n\n const getUnitsElapsed = (date: Date, unit: TimeUnit): number => {\n let amount: number;\n const now = new Date();\n\n switch (unit) {\n case 'year':\n amount = date.getUTCFullYear() - now.getUTCFullYear();\n break;\n case 'month':\n if (date.getUTCFullYear() === now.getUTCFullYear()) {\n amount = date.getUTCMonth() - now.getUTCMonth();\n } else if (date < now) {\n amount = (11 - date.getUTCMonth() + now.getUTCMonth() + 1) * -1;\n } else {\n amount = 11 - now.getUTCMonth() + date.getUTCMonth() + 1;\n }\n break;\n case 'day':\n if (date.getUTCMonth() === now.getUTCMonth()) {\n amount = date.getUTCDate() - now.getUTCDate();\n } else if (date < now) {\n const maximalDayOfMonth = new Date(\n Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 0)\n ).getUTCDate();\n amount = (maximalDayOfMonth - date.getUTCDate() + now.getUTCDate()) * -1;\n } else {\n const maximalDayOfMonth = new Date(\n Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 0)\n ).getUTCDate();\n amount = maximalDayOfMonth - now.getUTCDate() + date.getUTCDate() + 1;\n }\n break;\n case 'hour':\n if (date.getUTCDate() === now.getUTCDate()) {\n amount = date.getUTCHours() - now.getUTCHours();\n } else if (date < now) {\n amount = (23 - date.getUTCHours() + now.getUTCHours() + 1) * -1;\n } else {\n amount = 23 - now.getUTCHours() + date.getUTCHours() + 1;\n }\n break;\n case 'minute':\n if (date.getUTCHours() === now.getUTCHours()) {\n amount = date.getUTCMinutes() - now.getUTCMinutes();\n } else if (date < now) {\n amount = (59 - date.getUTCMinutes() + now.getUTCMinutes() + 1) * -1;\n } else {\n amount = 59 - now.getUTCMinutes() + date.getUTCMinutes() + 1;\n }\n break;\n default:\n amount = 0;\n break;\n }\n return amount;\n };\n\n const getRelativeTime = (date: Date) => {\n let elapsed = date.getTime() - Date.now();\n // Deliberately reduce precision to 1 minute\n if (Math.abs(elapsed) < 60000) elapsed = 0;\n const unit = (Object.keys(unitsInMs).find(u => Math.abs(elapsed) >= unitsInMs[u as TimeUnit]) ||\n 'second') as TimeUnit;\n const amount = getUnitsElapsed(date, unit);\n\n return relativeTimeFormatter(amount, unit);\n };\n\n const getFormattedWeek = (date: Date) => {\n displayNamesCache[locale] ??= new Intl.DisplayNames(locale, {\n style: 'long',\n type: 'dateTimeField'\n }) as Intl.DateTimeDisplayNames;\n\n const displayNames = displayNamesCache[locale];\n const adjustedUTCDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n const startDate = getFormattedDate(getStartOfWeek(adjustedUTCDate), 'week', 'UTC');\n const endDate = getFormattedDate(getEndOfWeek(adjustedUTCDate), 'week', 'UTC');\n return `${cap(displayNames.of('weekOfYear'))} ${getWeek(adjustedUTCDate)}, ${getWeekYear(\n adjustedUTCDate\n )} (${startDate} - ${endDate})`;\n };\n\n const getFormattedQuarterYear = (date: Date) => {\n const formattedYear = getFormattedDate(date, 'year');\n const adjustedUTCDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n const quarterNumber = getQuarter(adjustedUTCDate);\n return `${t!(`date_quarter_q${quarterNumber}`, [formattedYear])}`;\n };\n\n switch (variant) {\n case 'relative':\n return getRelativeTime(value);\n case 'week':\n return getFormattedWeek(value);\n case 'quarteryear':\n return getFormattedQuarterYear(value);\n default:\n return getFormattedDate(value, variant);\n }\n}\n\nconst dayInMs = 24 * 60 * 60 * 1000;\nconst hourInMs = 60 * 60 * 1000;\nconst minuteInMs = 60 * 1000;\nconst secondInMs = 1000;\n\ninterface DurationFormatOptions {\n locale: string;\n significantUnits: 4 | 3 | 2 | 1;\n unitDisplay?: Intl.NumberFormatOptions['unitDisplay'];\n}\n\nconst numberFormatCache: Record<\n // locale\n string,\n Record<\n // unit\n string,\n Record<\n // unitDisplay\n string,\n Intl.NumberFormat\n >\n >\n> = {};\n\nexport function formatDuration(\n valueInMs: number,\n { locale, significantUnits, unitDisplay = 'narrow' }: DurationFormatOptions\n) {\n numberFormatCache[locale] ??= {};\n\n const sign = valueInMs < 0 ? '-' : '';\n const absMs = Math.abs(valueInMs);\n if (absMs < secondInMs) {\n numberFormatCache[locale].seconds ??= {};\n\n numberFormatCache[locale].seconds.narrow ??= new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: 'second',\n unitDisplay: 'narrow'\n });\n\n return numberFormatCache[locale].seconds.narrow.format(0);\n }\n\n const durationParts = [\n { unit: 'day', value: Math.floor(absMs / dayInMs) },\n { unit: 'hour', value: Math.floor((absMs % dayInMs) / hourInMs) },\n { unit: 'minute', value: Math.floor((absMs % hourInMs) / minuteInMs) },\n { unit: 'second', value: Math.floor((absMs % minuteInMs) / secondInMs) }\n ];\n\n const result = [];\n for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {\n const { value, unit } = durationParts[i];\n\n if (value > 0) {\n numberFormatCache[locale][unit] ??= {};\n numberFormatCache[locale][unit][unitDisplay] ??= new Intl.NumberFormat(locale, {\n style: 'unit',\n unit,\n unitDisplay\n });\n\n result.push(numberFormatCache[locale][unit][unitDisplay].format(value));\n }\n }\n return `${sign}${result.join(' ')}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/DateTime/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAEL,YAAY,EACZ,UAAU,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB,MAAM,SAAS,G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import { TranslationFunction, TranslationPack } from '../../i18n';\nimport { ExcludeStrict } from '../../types';\nimport { cap } from '../../utils';\n\nimport { AbsoluteVariant, DateTimeFormat, DateTimeVariant } from './DateTime.types';\nimport {\n ClockFormat,\n getEndOfWeek,\n getQuarter,\n getStartOfWeek,\n getWeek,\n getWeekYear\n} from './Input/utils';\n\nconst unitsInMs = {\n year: 24 * 60 * 60 * 1000 * 365,\n month: (24 * 60 * 60 * 1000 * 365) / 12,\n day: 24 * 60 * 60 * 1000,\n hour: 60 * 60 * 1000,\n minute: 60 * 1000,\n second: 1000\n} satisfies Partial<Record<Intl.RelativeTimeFormatUnit, number>>;\n\ntype TimeUnit = keyof typeof unitsInMs;\n\ntype DateTimeFormatOptions = {\n locale: string;\n format: DateTimeFormat;\n timeZone?: string;\n clockFormat?: ClockFormat;\n} & (\n | {\n variant: ExcludeStrict<DateTimeVariant, 'quarteryear'>;\n t?: TranslationFunction<TranslationPack>;\n }\n | { variant: 'quarteryear'; t: TranslationFunction<TranslationPack> }\n);\n\ntype TimeOptions = Pick<Intl.DateTimeFormatOptions, 'hour' | 'minute' | 'second' | 'hour12'>;\n\nconst timeShort = {\n hour: 'numeric',\n minute: 'numeric'\n} satisfies TimeOptions;\n\nconst timeShort12 = {\n ...timeShort,\n hour12: true\n} satisfies TimeOptions;\n\nconst timeShort24 = {\n ...timeShort,\n hour12: false\n} satisfies TimeOptions;\n\nconst timeLong = {\n ...timeShort,\n second: 'numeric'\n} satisfies TimeOptions;\n\nconst timeLong12 = {\n ...timeShort12,\n second: 'numeric'\n} satisfies TimeOptions;\n\nconst timeLong24 = {\n ...timeShort24,\n second: 'numeric'\n} satisfies TimeOptions;\n\ntype AddClockFormatToTimeKeys<Key extends DateTimeVariant> = Key extends `${string}time`\n ? `${Key}${'' | 12 | 24}`\n : Key;\n\nconst formatMapping = {\n date: {\n short: { year: 'numeric', month: 'short', day: 'numeric' },\n long: { year: 'numeric', month: 'long', day: 'numeric' },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric' }\n },\n datetime: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort }\n },\n datetime12: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort12 },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong12 },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort12 }\n },\n datetime24: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort24 },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong24 },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort24 }\n },\n time: {\n short: timeShort,\n long: timeLong,\n numeric: timeShort\n },\n time12: {\n short: timeShort12,\n long: timeLong12,\n numeric: timeShort12\n },\n time24: {\n short: timeShort24,\n long: timeLong24,\n numeric: timeShort24\n },\n month: {\n short: { month: 'short' },\n long: { month: 'long' },\n numeric: { month: 'numeric' }\n },\n monthyear: {\n short: { year: 'numeric', month: 'short' },\n long: { year: 'numeric', month: 'long' },\n numeric: { year: 'numeric', month: 'numeric' }\n },\n week: {\n short: { month: 'short', day: 'numeric' },\n long: { month: 'long', day: 'numeric' },\n numeric: { month: 'numeric', day: 'numeric' }\n },\n year: {\n short: { year: 'numeric' },\n long: { year: 'numeric' },\n numeric: { year: '2-digit' }\n },\n relative: {\n short: { style: 'long', numeric: 'auto' },\n long: { style: 'long', numeric: 'auto' },\n numeric: { style: 'short', numeric: 'auto' }\n }\n} satisfies Record<\n AddClockFormatToTimeKeys<ExcludeStrict<AbsoluteVariant, 'quarteryear'>>,\n Record<DateTimeFormat, Intl.DateTimeFormatOptions>\n> &\n Record<'relative', Record<DateTimeFormat, Intl.RelativeTimeFormatOptions>>;\n\nconst dateTimeFormatCache: Record<\n // locale\n string,\n Record<\n // timeZone\n string,\n Map<Intl.DateTimeFormatOptions, Intl.DateTimeFormat>\n >\n> = {};\n\nconst relativeTimeFormatCache: Record<\n // locale\n string,\n Map<Intl.RelativeTimeFormatOptions, Intl.RelativeTimeFormat>\n> = {};\n\nconst displayNamesCache: Record<\n // locale\n string,\n Intl.DateTimeDisplayNames\n> = {};\n\nexport function formatDateTime(\n value: Date,\n { t, locale, format, variant, clockFormat, timeZone }: DateTimeFormatOptions\n) {\n const getFormattedDate = (\n date: Date,\n dateVariant: ExcludeStrict<AbsoluteVariant, 'quarteryear'>,\n overrideTimeZone?: string\n ) => {\n const resolvedVariant: AddClockFormatToTimeKeys<typeof dateVariant> =\n dateVariant === 'time' || dateVariant === 'datetime'\n ? `${dateVariant}${clockFormat ?? ''}`\n : dateVariant;\n const resolvedTimeZone = overrideTimeZone ?? timeZone;\n const resolvedOptions = formatMapping[resolvedVariant][format];\n\n dateTimeFormatCache[locale] ??= {};\n dateTimeFormatCache[locale][`${resolvedTimeZone}`] ??= new Map();\n\n const map = dateTimeFormatCache[locale][`${resolvedTimeZone}`];\n\n if (!map.has(resolvedOptions)) {\n map.set(\n resolvedOptions,\n new Intl.DateTimeFormat(locale, {\n ...resolvedOptions,\n timeZone: resolvedTimeZone\n })\n );\n }\n\n return map.get(resolvedOptions)!.format(date);\n };\n\n const relativeTimeFormatter = (relativeValue: number, unit: TimeUnit) => {\n const resolvedOptions = formatMapping.relative[format];\n\n relativeTimeFormatCache[locale] ??= new Map();\n const map = relativeTimeFormatCache[locale];\n\n if (!map.has(resolvedOptions)) {\n map.set(resolvedOptions, new Intl.RelativeTimeFormat(locale, resolvedOptions));\n }\n\n return map.get(resolvedOptions)!.format(relativeValue, unit);\n };\n\n const getUnitsElapsed = (date: Date, unit: TimeUnit): number => {\n let amount: number;\n const now = new Date();\n\n switch (unit) {\n case 'year':\n amount = date.getUTCFullYear() - now.getUTCFullYear();\n break;\n case 'month':\n if (date.getUTCFullYear() === now.getUTCFullYear()) {\n amount = date.getUTCMonth() - now.getUTCMonth();\n } else if (date < now) {\n amount = (11 - date.getUTCMonth() + now.getUTCMonth() + 1) * -1;\n } else {\n amount = 11 - now.getUTCMonth() + date.getUTCMonth() + 1;\n }\n break;\n case 'day':\n if (date.getUTCMonth() === now.getUTCMonth()) {\n amount = date.getUTCDate() - now.getUTCDate();\n } else if (date < now) {\n const maximalDayOfMonth = new Date(\n Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 0)\n ).getUTCDate();\n amount = (maximalDayOfMonth - date.getUTCDate() + now.getUTCDate()) * -1;\n } else {\n const maximalDayOfMonth = new Date(\n Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 0)\n ).getUTCDate();\n amount = maximalDayOfMonth - now.getUTCDate() + date.getUTCDate() + 1;\n }\n break;\n case 'hour':\n if (date.getUTCDate() === now.getUTCDate()) {\n amount = date.getUTCHours() - now.getUTCHours();\n } else if (date < now) {\n amount = (23 - date.getUTCHours() + now.getUTCHours() + 1) * -1;\n } else {\n amount = 23 - now.getUTCHours() + date.getUTCHours() + 1;\n }\n break;\n case 'minute':\n if (date.getUTCHours() === now.getUTCHours()) {\n amount = date.getUTCMinutes() - now.getUTCMinutes();\n } else if (date < now) {\n amount = (59 - date.getUTCMinutes() + now.getUTCMinutes() + 1) * -1;\n } else {\n amount = 59 - now.getUTCMinutes() + date.getUTCMinutes() + 1;\n }\n break;\n default:\n amount = 0;\n break;\n }\n return amount;\n };\n\n const getRelativeTime = (date: Date) => {\n let elapsed = date.getTime() - Date.now();\n // Deliberately reduce precision to 1 minute\n if (Math.abs(elapsed) < 60000) elapsed = 0;\n const unit = (Object.keys(unitsInMs).find(u => Math.abs(elapsed) >= unitsInMs[u as TimeUnit]) ||\n 'second') as TimeUnit;\n const amount = getUnitsElapsed(date, unit);\n\n return relativeTimeFormatter(amount, unit);\n };\n\n const getFormattedWeek = (date: Date) => {\n displayNamesCache[locale] ??= new Intl.DisplayNames(locale, {\n style: 'long',\n type: 'dateTimeField'\n }) as Intl.DateTimeDisplayNames;\n\n const displayNames = displayNamesCache[locale];\n const adjustedUTCDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n const startDate = getFormattedDate(getStartOfWeek(adjustedUTCDate), 'week', 'UTC');\n const endDate = getFormattedDate(getEndOfWeek(adjustedUTCDate), 'week', 'UTC');\n return `${cap(displayNames.of('weekOfYear'))} ${getWeek(adjustedUTCDate)}, ${getWeekYear(\n adjustedUTCDate\n )} (${startDate} - ${endDate})`;\n };\n\n const getFormattedQuarterYear = (date: Date) => {\n const formattedYear = getFormattedDate(date, 'year');\n const adjustedUTCDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n const quarterNumber = getQuarter(adjustedUTCDate);\n return `${t!(`date_quarter_q${quarterNumber}`, [formattedYear])}`;\n };\n\n switch (variant) {\n case 'relative':\n return getRelativeTime(value);\n case 'week':\n return getFormattedWeek(value);\n case 'quarteryear':\n return getFormattedQuarterYear(value);\n default:\n return getFormattedDate(value, variant);\n }\n}\n\nconst dayInMs = 24 * 60 * 60 * 1000;\nconst hourInMs = 60 * 60 * 1000;\nconst minuteInMs = 60 * 1000;\nconst secondInMs = 1000;\n\ninterface DurationFormatOptions {\n locale: string;\n significantUnits: 4 | 3 | 2 | 1;\n unitDisplay?: Intl.NumberFormatOptions['unitDisplay'];\n}\n\nconst numberFormatCache: Record<\n // locale\n string,\n Record<\n // unit\n string,\n Record<\n // unitDisplay\n string,\n Intl.NumberFormat\n >\n >\n> = {};\n\nexport function formatDuration(\n valueInMs: number,\n { locale, significantUnits, unitDisplay = 'narrow' }: DurationFormatOptions\n) {\n numberFormatCache[locale] ??= {};\n\n const sign = valueInMs < 0 ? '-' : '';\n const absMs = Math.abs(valueInMs);\n if (absMs < secondInMs) {\n numberFormatCache[locale].seconds ??= {};\n\n numberFormatCache[locale].seconds.narrow ??= new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: 'second',\n unitDisplay: 'narrow'\n });\n\n return numberFormatCache[locale].seconds.narrow.format(0);\n }\n\n const durationParts = [\n { unit: 'day', value: Math.floor(absMs / dayInMs) },\n { unit: 'hour', value: Math.floor((absMs % dayInMs) / hourInMs) },\n { unit: 'minute', value: Math.floor((absMs % hourInMs) / minuteInMs) },\n { unit: 'second', value: Math.floor((absMs % minuteInMs) / secondInMs) }\n ];\n\n const result = [];\n for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {\n const { value, unit } = durationParts[i];\n\n if (value > 0) {\n numberFormatCache[locale][unit] ??= {};\n numberFormatCache[locale][unit][unitDisplay] ??= new Intl.NumberFormat(locale, {\n style: 'unit',\n unit,\n unitDisplay\n });\n\n result.push(numberFormatCache[locale][unit][unitDisplay].format(value));\n }\n }\n return `${sign}${result.join(' ')}`;\n}\n"]}
|
|
@@ -39,7 +39,7 @@ export interface FileInputProps extends BaseProps, NoChildrenProp, TestIdProp {
|
|
|
39
39
|
export declare const StyledDropZone: import("styled-components").StyledComponent<FunctionComponent<FormControlProps & ForwardProps>, import("styled-components").DefaultTheme, {
|
|
40
40
|
dragOver: boolean;
|
|
41
41
|
}, never>;
|
|
42
|
-
export declare const StyledFileInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme,
|
|
42
|
+
export declare const StyledFileInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<FileInputProps, keyof FileInputProps> & Required<Pick<FileInputProps, never>> & ForwardProps, never>;
|
|
43
43
|
declare const _default: FunctionComponent<FileInputProps & ForwardProps> & {
|
|
44
44
|
getTestIds: (testIdProp?: string | undefined) => import("../../types").TestIdsRecord<readonly ["control", "files", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
|
|
45
45
|
};
|