@pega/cosmos-react-core 10.0.0-build.2.12 → 10.0.0-build.2.14
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/ClassificationMarking/ClassificationMarking.styles.d.ts.map +1 -1
- package/lib/components/ClassificationMarking/ClassificationMarking.styles.js +5 -3
- package/lib/components/ClassificationMarking/ClassificationMarking.styles.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.js +1 -0
- package/lib/components/Lightbox/Lightbox.styles.js.map +1 -1
- package/lib/components/Preview/PreviewManager.d.ts.map +1 -1
- package/lib/components/Preview/PreviewManager.js +10 -1
- package/lib/components/Preview/PreviewManager.js.map +1 -1
- package/lib/components/Preview/PreviewPanel.d.ts.map +1 -1
- package/lib/components/Preview/PreviewPanel.js +6 -1
- package/lib/components/Preview/PreviewPanel.js.map +1 -1
- package/lib/components/ResponsiveActions/ResponsiveActions.d.ts.map +1 -1
- package/lib/components/ResponsiveActions/ResponsiveActions.js +1 -0
- package/lib/components/ResponsiveActions/ResponsiveActions.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +2 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +2 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +3 -1
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +2 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.d.ts.map +1 -1
- package/lib/theme/index.js +1 -0
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/theme.d.ts +24 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +12 -0
- package/lib/theme/themeOverrides.schema.json +18 -0
- package/lib/theme/themes/aurigaDarkTheme.json +146 -0
- package/lib/theme/themes/aurigaTheme.json +4 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassificationMarking.styles.d.ts","sourceRoot":"","sources":["../../../src/components/ClassificationMarking/ClassificationMarking.styles.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,gCAAgC;YACnC,MAAM;EAKf,CAAC;AAEF,eAAO,MAAM,aAAa;gBACZ,MAAM;WACX,MAAM;YACL,MAAM;eACH,MAAM;iBACJ,MAAM;eACR,KAAK,GAAG,QAAQ;
|
|
1
|
+
{"version":3,"file":"ClassificationMarking.styles.d.ts","sourceRoot":"","sources":["../../../src/components/ClassificationMarking/ClassificationMarking.styles.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,gCAAgC;YACnC,MAAM;EAKf,CAAC;AAEF,eAAO,MAAM,aAAa;gBACZ,MAAM;WACX,MAAM;YACL,MAAM;eACH,MAAM;iBACJ,MAAM;eACR,KAAK,GAAG,QAAQ;YAoB3B,CAAC;AAIH,eAAO,MAAM,uBAAuB;YAC1B,MAAM;YAKd,CAAC"}
|
|
@@ -14,9 +14,11 @@ export const StyledMarking = styled.div(({ background, color, height, fontSize,
|
|
|
14
14
|
position: fixed;
|
|
15
15
|
${placement}: 0;
|
|
16
16
|
inset-inline: 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
box-sizing: content-box;
|
|
18
|
+
height: ${height};
|
|
19
|
+
${placement === 'bottom'
|
|
20
|
+
? 'padding-block-end: var(--safe-area-inset-block-end, 0);'
|
|
21
|
+
: 'padding-block-start: var(--safe-area-inset-block-start, 0);'}
|
|
20
22
|
line-height: ${height};
|
|
21
23
|
text-align: center;
|
|
22
24
|
font-weight: ${theme.base['font-weight'].bold};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClassificationMarking.styles.js","sourceRoot":"","sources":["../../../src/components/ClassificationMarking/ClassificationMarking.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,iBAAiB,CAE/D;;wBAEsB,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM;;CAE7C,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAOpC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3E,OAAO,GAAG,CAAA;;MAEN,SAAS
|
|
1
|
+
{"version":3,"file":"ClassificationMarking.styles.js","sourceRoot":"","sources":["../../../src/components/ClassificationMarking/ClassificationMarking.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,iBAAiB,CAE/D;;wBAEsB,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM;;CAE7C,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAOpC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3E,OAAO,GAAG,CAAA;;MAEN,SAAS;;;cAGD,MAAM;MACd,SAAS,KAAK,QAAQ;QACtB,CAAC,CAAC,yDAAyD;QAC3D,CAAC,CAAC,6DAA6D;mBAClD,MAAM;;mBAEN,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI;MAC3C,UAAU,CAAC,CAAC,CAAC,gBAAgB,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE;MAC/C,QAAQ,CAAC,CAAC,CAAC,cAAc,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE;eAChC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG;kBACtB,UAAU;aACf,KAAK;GACf,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAE9C,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;IAChB,OAAO,GAAG,CAAA;wBACY,MAAM;GAC3B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css, createGlobalStyle } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\n\n/**\n * Promotes --marking-height to :root so portaled elements\n * (Fullscreen, Lightbox) can read it outside the StyledClassifiedContent tree.\n */\nexport const ClassificationMarkingGlobalStyle = createGlobalStyle<{\n height: string;\n}>`\n :root {\n --marking-height: ${({ height }) => height};\n }\n`;\n\nexport const StyledMarking = styled.div<{\n background: string;\n color: string;\n height: string;\n fontSize?: string;\n fontFamily?: string;\n placement: 'top' | 'bottom';\n}>(({ background, color, height, fontSize, fontFamily, placement, theme }) => {\n return css`\n position: fixed;\n ${placement}: 0;\n inset-inline: 0;\n box-sizing: content-box;\n height: ${height};\n ${placement === 'bottom'\n ? 'padding-block-end: var(--safe-area-inset-block-end, 0);'\n : 'padding-block-start: var(--safe-area-inset-block-start, 0);'}\n line-height: ${height};\n text-align: center;\n font-weight: ${theme.base['font-weight'].bold};\n ${fontFamily ? `font-family: ${fontFamily};` : ''}\n ${fontSize ? `font-size: ${fontSize};` : ''}\n z-index: ${theme.base['z-index'].max};\n background: ${background};\n color: ${color};\n `;\n});\n\nStyledMarking.defaultProps = defaultThemeProp;\n\nexport const StyledClassifiedContent = styled.div<{\n height: string;\n}>(({ height }) => {\n return css`\n --marking-height: ${height};\n `;\n});\n\nStyledClassifiedContent.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lightbox.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Lightbox/Lightbox.styles.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,YAAY;YAA2B,OAAO;YAuBzD,CAAC;AAIH,eAAO,MAAM,kBAAkB,6NAY7B,CAAC;AAIH,eAAO,MAAM,UAAU,6NAWrB,CAAC;AAIH,eAAO,MAAM,eAAe;;0KAgE1B,CAAC;AAIH,eAAO,MAAM,eAAe,6NAW1B,CAAC;AAIH,eAAO,MAAM,oBAAoB;YAAwB,OAAO;
|
|
1
|
+
{"version":3,"file":"Lightbox.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Lightbox/Lightbox.styles.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,YAAY;YAA2B,OAAO;YAuBzD,CAAC;AAIH,eAAO,MAAM,kBAAkB,6NAY7B,CAAC;AAIH,eAAO,MAAM,UAAU,6NAWrB,CAAC;AAIH,eAAO,MAAM,eAAe;;0KAgE1B,CAAC;AAIH,eAAO,MAAM,eAAe,6NAW1B,CAAC;AAIH,eAAO,MAAM,oBAAoB;YAAwB,OAAO;YAwC9D,CAAC;AAEH,eAAO,MAAM,YAAY,yOAKxB,CAAC;AAIF,eAAO,MAAM,mBAAmB,6NAG/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,6NAE5B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;uJAG/B,CAAC;AAEF,eAAO,MAAM,cAAc;;;YAA8B,OAAO;;;iDAW9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lightbox.styles.js","sourceRoot":"","sources":["../../../src/components/Lightbox/Lightbox.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GA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CAAC,GAAG,CAAsB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;IACxF,OAAO,GAAG,CAAA;;;MAGN,CAAC,MAAM;QACT,GAAG,CAAA;0BACmB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;KACzD;;;;;;;MAOC,gBAAgB;;YAEV,UAAU;iBACL,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK;;;;;;;;;;;;;;;QAejC,CAAC,MAAM;QACT,GAAG,CAAA;mCAC0B,KAAK,CAAC,IAAI,CAAC,OAAO;sCACf,KAAK,CAAC,IAAI,CAAC,OAAO;OACjD;;GAEJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;CAKxC,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG5C,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;IACtC,YAAY;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;IAE3C,gBAAgB;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAsB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IACxF,OAAO,GAAG,CAAA;MACN,MAAM;QACR,GAAG,CAAA;iBACU,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG;KACrC;;;;;GAKF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { hideVisually, rgba } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { calculateFontSize } from '../../styles';\nimport BareButton from '../Button/BareButton';\nimport { StyledIcon } from '../Icon';\nimport { StyledMetaList } from '../MetaList/MetaList';\nimport { StyledErrorState } from '../ErrorState';\nimport Text, { StyledText } from '../Text';\nimport { useDirection } from '../../hooks';\nimport Backdrop from '../Backdrop';\nimport { StyledLink } from '../Link/Link';\nimport { ellipsisOverflow } from '../../styles/mixins';\n\nexport const StyledHeader = styled.header<{ global: boolean }>(({ theme, global }) => {\n const color: string | undefined = tryCatch(() =>\n rgba(theme.base.palette.light, theme.base.transparency['transparent-2'])\n );\n\n return css`\n position: relative;\n width: 100%;\n padding: ${theme.base.spacing};\n color: ${color};\n ${!global &&\n css`\n background-color: ${theme.base.colors.gray['extra-dark']};\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n `}\n\n ${StyledMetaList} {\n justify-content: center;\n li {\n color: ${color};\n }\n }\n `;\n});\n\nStyledHeader.defaultProps = defaultThemeProp;\n\nexport const StyledCountTracker = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n font-size: ${fontSize.xs};\n text-align: center;\n min-width: calc(2 * ${theme.base['hit-area']['mouse-min']});\n\n @media (pointer: coarse) {\n min-width: calc(2 * ${theme.base['hit-area']['finger-min']});\n }\n `;\n});\n\nStyledCountTracker.defaultProps = defaultThemeProp;\n\nexport const StyledInfo = styled.div(({ theme }) => {\n return css`\n color: ${theme.base.palette.light};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n min-width: 0;\n\n ${StyledLink} {\n color: inherit;\n text-decoration: underline;\n }\n `;\n});\n\nStyledInfo.defaultProps = defaultThemeProp;\n\nexport const StyledNavButton = styled(BareButton)(({ theme }) => {\n const bg = tryCatch(() => rgba(theme.base.colors.gray.medium, 0.5));\n const hoverBg = tryCatch(() => rgba(theme.base.colors.gray.medium, 0.7));\n const { rtl } = useDirection();\n\n return css`\n position: absolute;\n z-index: 1;\n inset-block: 0;\n min-width: ${theme.base['hit-area']['mouse-min']};\n color: ${theme.base.palette['foreground-color']};\n box-shadow: none;\n border-radius: 0;\n\n @media (pointer: coarse) {\n min-width: ${theme.base['hit-area']['finger-min']};\n }\n\n &[hidden] {\n display: none;\n }\n\n & > span {\n display: inline-block;\n background-color: ${bg};\n\n ${StyledIcon} {\n color: ${theme.base.palette.light};\n width: 2rem;\n height: 3rem;\n\n ${rtl &&\n css`\n transform: rotateZ(180deg);\n `}\n }\n }\n\n &:nth-of-type(1) {\n inset-inline-start: 0;\n text-align: start;\n & > span {\n border-start-end-radius: calc(${theme.base['border-radius']} / 2);\n border-end-end-radius: calc(${theme.base['border-radius']} / 2);\n }\n }\n\n &:nth-of-type(2) {\n inset-inline-end: 0;\n text-align: end;\n & > span {\n border-start-start-radius: calc(${theme.base['border-radius']} / 2);\n border-end-start-radius: calc(${theme.base['border-radius']} / 2);\n }\n }\n\n &:hover > span {\n background-color: ${hoverBg};\n }\n\n &:focus > span {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledNavButton.defaultProps = defaultThemeProp;\n\nexport const StyledContainer = styled.div(({ theme }) => {\n return css`\n button {\n padding: ${theme.base.spacing};\n color: ${theme.base.palette.light};\n\n &:focus:enabled {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n `;\n});\n\nStyledContainer.defaultProps = defaultThemeProp;\n\nexport const StyledMediaContainer = styled.div<{ global: boolean }>(({ theme, global }) => {\n return css`\n position: relative;\n\n ${!global &&\n css`\n background-color: ${theme.base.colors.gray['extra-dark']};\n `}\n\n & > div {\n position: absolute;\n inset: 0;\n }\n\n ${StyledErrorState} {\n margin: auto;\n & > ${StyledText} {\n color: ${theme.base.palette.light};\n }\n }\n\n img,\n video,\n audio {\n display: block;\n max-width: calc(100% - 5rem);\n max-height: 100%;\n margin: auto;\n }\n\n img,\n video {\n ${!global &&\n css`\n margin-block-start: calc(${theme.base.spacing} * 4);\n max-width: calc(100% - calc(${theme.base.spacing} * 4));\n `}\n }\n `;\n});\n\nexport const StyledObject = styled.object`\n display: block;\n margin: auto;\n width: calc(100% - 5rem);\n height: 100%;\n`;\n\nStyledMediaContainer.defaultProps = defaultThemeProp;\n\nexport const StyledPreviewRegion = styled.div`\n position: relative;\n width: 100%;\n`;\n\nexport const StyledLiveRegion = styled.div`\n ${hideVisually}\n`;\n\nexport const StyledLightboxTitle = styled(Text)`\n max-width: 100%;\n ${ellipsisOverflow};\n`;\n\nexport const StyledLightbox = styled(Backdrop)<{ global: boolean }>(({ global, theme }) => {\n return css`\n ${global &&\n css`\n z-index: ${theme.base['z-index'].max};\n `}\n\n &:focus {\n outline: none;\n }\n `;\n});\n\nStyledLightbox.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Lightbox.styles.js","sourceRoot":"","sources":["../../../src/components/Lightbox/Lightbox.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE9C,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,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;A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AAC,GAAG,CAAA;;;CAG5C,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;IACtC,YAAY;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;IAE3C,gBAAgB;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAsB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IACxF,OAAO,GAAG,CAAA;MACN,MAAM;QACR,GAAG,CAAA;iBACU,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG;KACrC;;;;;GAKF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { hideVisually, rgba } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { calculateFontSize } from '../../styles';\nimport BareButton from '../Button/BareButton';\nimport { StyledIcon } from '../Icon';\nimport { StyledMetaList } from '../MetaList/MetaList';\nimport { StyledErrorState } from '../ErrorState';\nimport Text, { StyledText } from '../Text';\nimport { useDirection } from '../../hooks';\nimport Backdrop from '../Backdrop';\nimport { StyledLink } from '../Link/Link';\nimport { ellipsisOverflow } from '../../styles/mixins';\n\nexport const StyledHeader = styled.header<{ global: boolean }>(({ theme, global }) => {\n const color: string | undefined = tryCatch(() =>\n rgba(theme.base.palette.light, theme.base.transparency['transparent-2'])\n );\n\n return css`\n position: relative;\n width: 100%;\n padding: ${theme.base.spacing};\n color: ${color};\n ${!global &&\n css`\n background-color: ${theme.base.colors.gray['extra-dark']};\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n `}\n\n ${StyledMetaList} {\n justify-content: center;\n li {\n color: ${color};\n }\n }\n `;\n});\n\nStyledHeader.defaultProps = defaultThemeProp;\n\nexport const StyledCountTracker = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n font-size: ${fontSize.xs};\n text-align: center;\n min-width: calc(2 * ${theme.base['hit-area']['mouse-min']});\n\n @media (pointer: coarse) {\n min-width: calc(2 * ${theme.base['hit-area']['finger-min']});\n }\n `;\n});\n\nStyledCountTracker.defaultProps = defaultThemeProp;\n\nexport const StyledInfo = styled.div(({ theme }) => {\n return css`\n color: ${theme.base.palette.light};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n min-width: 0;\n\n ${StyledLink} {\n color: inherit;\n text-decoration: underline;\n }\n `;\n});\n\nStyledInfo.defaultProps = defaultThemeProp;\n\nexport const StyledNavButton = styled(BareButton)(({ theme }) => {\n const bg = tryCatch(() => rgba(theme.base.colors.gray.medium, 0.5));\n const hoverBg = tryCatch(() => rgba(theme.base.colors.gray.medium, 0.7));\n const { rtl } = useDirection();\n\n return css`\n position: absolute;\n z-index: 1;\n inset-block: 0;\n min-width: ${theme.base['hit-area']['mouse-min']};\n color: ${theme.base.palette['foreground-color']};\n box-shadow: none;\n border-radius: 0;\n\n @media (pointer: coarse) {\n min-width: ${theme.base['hit-area']['finger-min']};\n }\n\n &[hidden] {\n display: none;\n }\n\n & > span {\n display: inline-block;\n background-color: ${bg};\n\n ${StyledIcon} {\n color: ${theme.base.palette.light};\n width: 2rem;\n height: 3rem;\n\n ${rtl &&\n css`\n transform: rotateZ(180deg);\n `}\n }\n }\n\n &:nth-of-type(1) {\n inset-inline-start: 0;\n text-align: start;\n & > span {\n border-start-end-radius: calc(${theme.base['border-radius']} / 2);\n border-end-end-radius: calc(${theme.base['border-radius']} / 2);\n }\n }\n\n &:nth-of-type(2) {\n inset-inline-end: 0;\n text-align: end;\n & > span {\n border-start-start-radius: calc(${theme.base['border-radius']} / 2);\n border-end-start-radius: calc(${theme.base['border-radius']} / 2);\n }\n }\n\n &:hover > span {\n background-color: ${hoverBg};\n }\n\n &:focus > span {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledNavButton.defaultProps = defaultThemeProp;\n\nexport const StyledContainer = styled.div(({ theme }) => {\n return css`\n button {\n padding: ${theme.base.spacing};\n color: ${theme.base.palette.light};\n\n &:focus:enabled {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n `;\n});\n\nStyledContainer.defaultProps = defaultThemeProp;\n\nexport const StyledMediaContainer = styled.div<{ global: boolean }>(({ theme, global }) => {\n return css`\n position: relative;\n\n ${!global &&\n css`\n background-color: ${theme.base.colors.gray['extra-dark']};\n overflow-y: auto;\n `}\n\n & > div {\n position: absolute;\n inset: 0;\n }\n\n ${StyledErrorState} {\n margin: auto;\n & > ${StyledText} {\n color: ${theme.base.palette.light};\n }\n }\n\n img,\n video,\n audio {\n display: block;\n max-width: calc(100% - 5rem);\n max-height: 100%;\n margin: auto;\n }\n\n img,\n video {\n ${!global &&\n css`\n margin-block-start: calc(${theme.base.spacing} * 4);\n max-width: calc(100% - calc(${theme.base.spacing} * 4));\n `}\n }\n `;\n});\n\nexport const StyledObject = styled.object`\n display: block;\n margin: auto;\n width: calc(100% - 5rem);\n height: 100%;\n`;\n\nStyledMediaContainer.defaultProps = defaultThemeProp;\n\nexport const StyledPreviewRegion = styled.div`\n position: relative;\n width: 100%;\n`;\n\nexport const StyledLiveRegion = styled.div`\n ${hideVisually}\n`;\n\nexport const StyledLightboxTitle = styled(Text)`\n max-width: 100%;\n ${ellipsisOverflow};\n`;\n\nexport const StyledLightbox = styled(Backdrop)<{ global: boolean }>(({ global, theme }) => {\n return css`\n ${global &&\n css`\n z-index: ${theme.base['z-index'].max};\n `}\n\n &:focus {\n outline: none;\n }\n `;\n});\n\nStyledLightbox.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewManager.d.ts","sourceRoot":"","sources":["../../../src/components/Preview/PreviewManager.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2B,OAAO,EAAoC,MAAM,OAAO,CAAC;AAIhG,OAAO,YAAY,CAAC;AAKpB,OAAO,KAAK,EAEV,0BAA0B,EAG1B,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAiB,aAAa;QAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;KAC7D;CACF;
|
|
1
|
+
{"version":3,"file":"PreviewManager.d.ts","sourceRoot":"","sources":["../../../src/components/Preview/PreviewManager.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA2B,OAAO,EAAoC,MAAM,OAAO,CAAC;AAIhG,OAAO,YAAY,CAAC;AAKpB,OAAO,KAAK,EAEV,0BAA0B,EAG1B,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,QAAQ,YAAY,CAAC;IAC1B,UAAiB,aAAa;QAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;KAC7D;CACF;AA8GD,QAAA,MAAM,cAAc,GAAI,cAAc,mBAAmB,4CA0FxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { useReducer, useState, useMemo, useContext, useRef, useEffect, memo } fr
|
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { createUID, windowIsAvailable } from '../../utils';
|
|
6
6
|
import '../../init';
|
|
7
|
-
import { useConfiguration } from '../../hooks';
|
|
7
|
+
import { useBreakpoint, useConfiguration } from '../../hooks';
|
|
8
8
|
import PreviewPanel from './PreviewPanel';
|
|
9
9
|
import { PreviewContext, PreviewManagerContext } from './Contexts';
|
|
10
10
|
const reducer = (previews, payload) => {
|
|
@@ -30,6 +30,8 @@ const reducer = (previews, payload) => {
|
|
|
30
30
|
: preview);
|
|
31
31
|
case 'unmount':
|
|
32
32
|
return previews.filter(preview => preview.id !== payload.id);
|
|
33
|
+
case 'clear':
|
|
34
|
+
return [];
|
|
33
35
|
default:
|
|
34
36
|
return previews;
|
|
35
37
|
}
|
|
@@ -76,6 +78,13 @@ const PreviewManager = ({ children }) => {
|
|
|
76
78
|
const [previewActive, setPreviewActive] = useState(false);
|
|
77
79
|
const previewTriggerRef = useRef(null);
|
|
78
80
|
const { portalTarget } = useConfiguration();
|
|
81
|
+
const isSmallOrAbove = useBreakpoint('sm');
|
|
82
|
+
// Dismiss all previews when screen size reflows below sm breakpoint
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!isSmallOrAbove && previews.length > 0) {
|
|
85
|
+
dispatch({ type: 'clear' });
|
|
86
|
+
}
|
|
87
|
+
}, [isSmallOrAbove, previews.length]);
|
|
79
88
|
const providerValue = useMemo(() => ({
|
|
80
89
|
previewActive,
|
|
81
90
|
setPreviewActive,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewManager.js","sourceRoot":"","sources":["../../../src/components/Preview/PreviewManager.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAQ1C,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAanE,MAAM,OAAO,GAAG,CACd,QAA8B,EAC9B,OAAiC,EACR,EAAE;IAC3B,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,QAAQ;YACX,oCAAoC;YACpC,6EAA6E;YAC7E,OAAO,CAAC,OAAO,CAAC,OAA2C,CAAC,CAAC;QAE/D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,CACV,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CACtB,eAAC,cAAc,OACT,OAAO,EACX,GAAG,EAAE,OAAO,CAAC,EAAE,EACf,kBAAkB,EAAE,gBAAgB,EACpC,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CAAC,EACF,YAAY,CACb;QACH,CAAC,CAAC,IAAI,CAAC;IAEX,OAAO,CACL,KAAC,OAAO,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,YAEpC,MAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,EAAE,aACtE,QAAQ,EACR,aAAa,IACU,GACT,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useReducer, useState, useMemo, useContext, useRef, useEffect, memo } from 'react';\nimport type { ComponentType, Dispatch, Context, MutableRefObject, SetStateAction } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { createUID, windowIsAvailable } from '../../utils';\nimport '../../init';\nimport { useConfiguration } from '../../hooks';\nimport type { DeferInfer } from '../../types';\n\nimport PreviewPanel from './PreviewPanel';\nimport type {\n PreviewOptions,\n PreviewManagerContextValue,\n PreviewMethods,\n PreviewObject,\n PreviewManagerProps\n} from './Preview.types';\nimport { PreviewContext, PreviewManagerContext } from './Contexts';\n\ndeclare module '../../init' {\n export interface CosmosGlobals {\n previewManagerContext?: Context<PreviewManagerContextValue>;\n }\n}\n\ntype PreviewReducerPayload<P extends object> =\n | { type: 'create'; preview: PreviewObject<P> }\n | { type: 'update'; id: string; props: Partial<P>; options?: Partial<PreviewOptions> }\n | { type: 'unmount'; id: string };\n\nconst reducer = <P extends object>(\n previews: PreviewObject[] | [],\n payload: PreviewReducerPayload<P>\n): PreviewObject<object>[] => {\n switch (payload.type) {\n case 'create':\n // Stub for multiple preview support\n // return [...previews, payload.preview as unknown as PreviewObject<object>];\n return [payload.preview as unknown as PreviewObject<object>];\n\n case 'update':\n return previews.map(preview =>\n preview.id === payload.id\n ? {\n ...preview,\n props: { ...preview.props, ...payload.props },\n options: {\n ...preview.options,\n ...payload.options,\n previewProps: {\n ...preview.options?.previewProps,\n ...payload.options?.previewProps\n }\n }\n }\n : preview\n );\n\n case 'unmount':\n return previews.filter(preview => preview.id !== payload.id);\n\n default:\n return previews;\n }\n};\n\nconst WrappedPreview = memo(\n ({\n Component,\n props,\n options,\n previewStateSetter,\n previewTriggerRef,\n methods\n }: PreviewObject & {\n previewStateSetter: Dispatch<SetStateAction<boolean>>;\n previewTriggerRef: MutableRefObject<HTMLElement | null>;\n }) => {\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n // This state change is required to transition the case preview in.\n const [open, setOpen] = useState(false);\n const openRef = useRef(false);\n\n const cleanupPreview = () => {\n setOpen(false);\n openRef.current = false;\n previewStateSetter(false);\n optionsRef.current?.previewProps.onAfterClose?.();\n methods.unmountPreview();\n };\n\n useEffect(() => {\n setOpen(true);\n openRef.current = true;\n previewStateSetter(true);\n return () => {\n // Guard with openRef so we don't double-fire if already closed via the close button.\n if (openRef.current) {\n optionsRef.current?.previewProps.onBeforeClose?.();\n cleanupPreview();\n }\n };\n }, []);\n\n return (\n <PreviewContext.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n initialized: true,\n previewTriggerRef,\n ...methods\n }}\n >\n <PreviewPanel\n open={open}\n {...options?.previewProps}\n onAfterClose={() => {\n cleanupPreview();\n }}\n >\n <Component {...(props as Record<string, unknown>)} />\n </PreviewPanel>\n </PreviewContext.Provider>\n );\n }\n);\n\nconst PreviewManager = ({ children }: PreviewManagerProps) => {\n const [previews, dispatch] = useReducer(reducer, []);\n const [previewActive, setPreviewActive] = useState(false);\n const previewTriggerRef = useRef<HTMLElement | null>(null);\n const { portalTarget } = useConfiguration();\n\n const providerValue = useMemo(\n () => ({\n previewActive,\n setPreviewActive,\n createPreview: <P extends object>(\n Component: ComponentType<P>,\n props?: DeferInfer<P>,\n options?: PreviewOptions\n ): PreviewMethods<P> => {\n const id = createUID();\n\n const methods = {\n updatePreview: (updatedProps: Partial<P>, updatedOptions?: Partial<PreviewOptions>) => {\n (dispatch as Dispatch<PreviewReducerPayload<P>>)({\n type: 'update',\n id,\n props: updatedProps,\n options: updatedOptions\n });\n },\n unmountPreview: () => {\n dispatch({ type: 'unmount', id });\n }\n };\n\n (dispatch as Dispatch<PreviewReducerPayload<P>>)({\n type: 'create',\n preview: {\n id,\n Component,\n methods,\n props: (props ?? {}) as P,\n options\n }\n });\n\n return methods;\n },\n PreviewContext,\n initialized: true\n }),\n [previewActive]\n );\n\n const context = windowIsAvailable\n ? window.cosmos.previewManagerContext ?? PreviewManagerContext\n : PreviewManagerContext;\n const priorCtx = useContext(context);\n\n // Don't create additional Preview managers.\n if (priorCtx.initialized) return <context.Provider value={priorCtx}>{children}</context.Provider>;\n\n const previewPortal =\n portalTarget && previews.length > 0\n ? createPortal(\n previews.map(preview => (\n <WrappedPreview\n {...preview}\n key={preview.id}\n previewStateSetter={setPreviewActive}\n previewTriggerRef={previewTriggerRef}\n />\n )),\n portalTarget\n )\n : null;\n\n return (\n <context.Provider value={providerValue}>\n {/* eslint-disable-next-line react/jsx-no-constructed-context-values */}\n <PreviewContext.Provider value={{ initialized: false, previewTriggerRef }}>\n {children}\n {previewPortal}\n </PreviewContext.Provider>\n </context.Provider>\n );\n};\n\nexport default PreviewManager;\n"]}
|
|
1
|
+
{"version":3,"file":"PreviewManager.js","sourceRoot":"","sources":["../../../src/components/Preview/PreviewManager.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,YAAY,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","sourcesContent":["import { useReducer, useState, useMemo, useContext, useRef, useEffect, memo } from 'react';\nimport type { ComponentType, Dispatch, Context, MutableRefObject, SetStateAction } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { createUID, windowIsAvailable } from '../../utils';\nimport '../../init';\nimport { useBreakpoint, useConfiguration } from '../../hooks';\nimport type { DeferInfer } from '../../types';\n\nimport PreviewPanel from './PreviewPanel';\nimport type {\n PreviewOptions,\n PreviewManagerContextValue,\n PreviewMethods,\n PreviewObject,\n PreviewManagerProps\n} from './Preview.types';\nimport { PreviewContext, PreviewManagerContext } from './Contexts';\n\ndeclare module '../../init' {\n export interface CosmosGlobals {\n previewManagerContext?: Context<PreviewManagerContextValue>;\n }\n}\n\ntype PreviewReducerPayload<P extends object> =\n | { type: 'create'; preview: PreviewObject<P> }\n | { type: 'update'; id: string; props: Partial<P>; options?: Partial<PreviewOptions> }\n | { type: 'unmount'; id: string }\n | { type: 'clear' };\n\nconst reducer = <P extends object>(\n previews: PreviewObject[] | [],\n payload: PreviewReducerPayload<P>\n): PreviewObject<object>[] => {\n switch (payload.type) {\n case 'create':\n // Stub for multiple preview support\n // return [...previews, payload.preview as unknown as PreviewObject<object>];\n return [payload.preview as unknown as PreviewObject<object>];\n\n case 'update':\n return previews.map(preview =>\n preview.id === payload.id\n ? {\n ...preview,\n props: { ...preview.props, ...payload.props },\n options: {\n ...preview.options,\n ...payload.options,\n previewProps: {\n ...preview.options?.previewProps,\n ...payload.options?.previewProps\n }\n }\n }\n : preview\n );\n\n case 'unmount':\n return previews.filter(preview => preview.id !== payload.id);\n\n case 'clear':\n return [];\n\n default:\n return previews;\n }\n};\n\nconst WrappedPreview = memo(\n ({\n Component,\n props,\n options,\n previewStateSetter,\n previewTriggerRef,\n methods\n }: PreviewObject & {\n previewStateSetter: Dispatch<SetStateAction<boolean>>;\n previewTriggerRef: MutableRefObject<HTMLElement | null>;\n }) => {\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n // This state change is required to transition the case preview in.\n const [open, setOpen] = useState(false);\n const openRef = useRef(false);\n\n const cleanupPreview = () => {\n setOpen(false);\n openRef.current = false;\n previewStateSetter(false);\n optionsRef.current?.previewProps.onAfterClose?.();\n methods.unmountPreview();\n };\n\n useEffect(() => {\n setOpen(true);\n openRef.current = true;\n previewStateSetter(true);\n return () => {\n // Guard with openRef so we don't double-fire if already closed via the close button.\n if (openRef.current) {\n optionsRef.current?.previewProps.onBeforeClose?.();\n cleanupPreview();\n }\n };\n }, []);\n\n return (\n <PreviewContext.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n initialized: true,\n previewTriggerRef,\n ...methods\n }}\n >\n <PreviewPanel\n open={open}\n {...options?.previewProps}\n onAfterClose={() => {\n cleanupPreview();\n }}\n >\n <Component {...(props as Record<string, unknown>)} />\n </PreviewPanel>\n </PreviewContext.Provider>\n );\n }\n);\n\nconst PreviewManager = ({ children }: PreviewManagerProps) => {\n const [previews, dispatch] = useReducer(reducer, []);\n const [previewActive, setPreviewActive] = useState(false);\n const previewTriggerRef = useRef<HTMLElement | null>(null);\n const { portalTarget } = useConfiguration();\n const isSmallOrAbove = useBreakpoint('sm');\n\n // Dismiss all previews when screen size reflows below sm breakpoint\n useEffect(() => {\n if (!isSmallOrAbove && previews.length > 0) {\n dispatch({ type: 'clear' });\n }\n }, [isSmallOrAbove, previews.length]);\n\n const providerValue = useMemo(\n () => ({\n previewActive,\n setPreviewActive,\n createPreview: <P extends object>(\n Component: ComponentType<P>,\n props?: DeferInfer<P>,\n options?: PreviewOptions\n ): PreviewMethods<P> => {\n const id = createUID();\n\n const methods = {\n updatePreview: (updatedProps: Partial<P>, updatedOptions?: Partial<PreviewOptions>) => {\n (dispatch as Dispatch<PreviewReducerPayload<P>>)({\n type: 'update',\n id,\n props: updatedProps,\n options: updatedOptions\n });\n },\n unmountPreview: () => {\n dispatch({ type: 'unmount', id });\n }\n };\n\n (dispatch as Dispatch<PreviewReducerPayload<P>>)({\n type: 'create',\n preview: {\n id,\n Component,\n methods,\n props: (props ?? {}) as P,\n options\n }\n });\n\n return methods;\n },\n PreviewContext,\n initialized: true\n }),\n [previewActive]\n );\n\n const context = windowIsAvailable\n ? window.cosmos.previewManagerContext ?? PreviewManagerContext\n : PreviewManagerContext;\n const priorCtx = useContext(context);\n\n // Don't create additional Preview managers.\n if (priorCtx.initialized) return <context.Provider value={priorCtx}>{children}</context.Provider>;\n\n const previewPortal =\n portalTarget && previews.length > 0\n ? createPortal(\n previews.map(preview => (\n <WrappedPreview\n {...preview}\n key={preview.id}\n previewStateSetter={setPreviewActive}\n previewTriggerRef={previewTriggerRef}\n />\n )),\n portalTarget\n )\n : null;\n\n return (\n <context.Provider value={providerValue}>\n {/* eslint-disable-next-line react/jsx-no-constructed-context-values */}\n <PreviewContext.Provider value={{ initialized: false, previewTriggerRef }}>\n {children}\n {previewPortal}\n </PreviewContext.Provider>\n </context.Provider>\n );\n};\n\nexport default PreviewManager;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewPanel.d.ts","sourceRoot":"","sources":["../../../src/components/Preview/PreviewPanel.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,eAAO,MAAM,mBAAmB,mVA2B9B,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"PreviewPanel.d.ts","sourceRoot":"","sources":["../../../src/components/Preview/PreviewPanel.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,eAAO,MAAM,mBAAmB,mVA2B9B,CAAC;;;;AAqIH,wBAAiE"}
|
|
@@ -72,6 +72,11 @@ const StyledCloseButton = styled(Button)(({ theme }) => {
|
|
|
72
72
|
`;
|
|
73
73
|
});
|
|
74
74
|
StyledCloseButton.defaultProps = defaultThemeProp;
|
|
75
|
+
const StyledContentOverflow = styled(Flex) `
|
|
76
|
+
min-height: 0;
|
|
77
|
+
overflow-y: auto;
|
|
78
|
+
`;
|
|
79
|
+
StyledContentOverflow.defaultProps = defaultThemeProp;
|
|
75
80
|
const PreviewPanel = forwardRef(function PreviewPanel({ testId, previewLabel, open, children, progress, onBeforeOpen, onAfterOpen, onBeforeClose, onAfterClose, ...restProps }, ref) {
|
|
76
81
|
const testIds = useTestIds(testId, getPreviewPanelTestIds);
|
|
77
82
|
const t = useI18n();
|
|
@@ -104,7 +109,7 @@ const PreviewPanel = forwardRef(function PreviewPanel({ testId, previewLabel, op
|
|
|
104
109
|
previewTriggerRef.current?.focus();
|
|
105
110
|
}, ref: setCloseButtonEl, label: t('close_preview'), children: _jsx(Icon, { name: 'times', size: 'font-size' }) }), _jsx(Progress, { "data-testid": testIds.progress, placement: 'local', visible: !!progress, focusOnVisible: true, delay: true, onTransitionStartIn: () => {
|
|
106
111
|
setProgressVisible(true);
|
|
107
|
-
}, onTransitionEndOut: () => setProgressVisible(false) }), !progress && children] }));
|
|
112
|
+
}, onTransitionEndOut: () => setProgressVisible(false) }), _jsx(StyledContentOverflow, { item: { grow: 1, basis: '0' }, children: !progress && children })] }));
|
|
108
113
|
});
|
|
109
114
|
export default withTestIds(PreviewPanel, getPreviewPanelTestIds);
|
|
110
115
|
//# sourceMappingURL=PreviewPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewPanel.js","sourceRoot":"","sources":["../../../src/components/Preview/PreviewPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO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EAAE,EAClC,GAAG,EAAE,UAAU,EACf,QAAQ,EAAC,OAAO,EAChB,SAAS,EAAE,SAAS,CAAC,GAAG,EACxB,IAAI,EAAE,wBAAwB,gBAClB,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAC9E,IAAI,EAAE,IAAI,EACV,UAAU,QACV,MAAM,QACN,cAAc,WACV,SAAS,aAEb,KAAC,iBAAiB,mBACH,OAAO,CAAC,KAAK,EAC1B,IAAI,QACJ,OAAO,QACP,OAAO,EAAE,GAAG,EAAE;oBACZ,aAAa,EAAE,EAAE,CAAC;oBAClB,YAAY,EAAE,EAAE,CAAC;oBACjB,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;gBACrC,CAAC,EACD,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC,YAEzB,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAC,WAAW,GAAG,GACpB,EAEpB,KAAC,QAAQ,mBACM,OAAO,CAAC,QAAQ,EAC7B,SAAS,EAAC,OAAO,EACjB,OAAO,EAAE,CAAC,CAAC,QAAQ,EACnB,cAAc,QACd,KAAK,QACL,mBAAmB,EAAE,GAAG,EAAE;oBACxB,kBAAkB,CAAC,IAAI,CAAC,CAAC;gBAC3B,CAAC,EACD,kBAAkB,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,GACnD,EACD,CAAC,QAAQ,IAAI,QAAQ,IACf,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useEffect } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport { defaultThemeProp } from '../../theme';\nimport Drawer from '../Drawer';\nimport Flex from '../Flex';\nimport getFocusables from '../../utils/getFocusables';\nimport Icon, { registerIcon } from '../Icon';\nimport Progress from '../Progress';\nimport { readableHue } from '../../styles/utils';\nimport {\n resizeDrawerDefaultWidth,\n resizeDrawerMaxWidth,\n resizeDrawerMinWidth\n} from '../../styles/constants';\nimport { StyledResizeHandle } from '../Drawer/ResizeHandle';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport useConsolidatedRef from '../../hooks/useConsolidatedRef';\nimport useDirection from '../../hooks/useDirection';\nimport useElement from '../../hooks/useElement';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport useI18n from '../../hooks/useI18n';\nimport usePreviewContext from '../../hooks/usePreviewContext';\nimport useTestIds from '../../hooks/useTestIds';\nimport { withTestIds } from '../../utils';\n\nimport { getPreviewPanelTestIds } from './PreviewPanel.test-ids';\nimport type { PreviewPanelProps } from './Preview.types';\n\nregisterIcon(timesIcon);\n\nexport const StyledPreviewDrawer = styled(Drawer)(({ theme }) => {\n return css`\n min-width: ${resizeDrawerMinWidth};\n max-width: ${resizeDrawerMaxWidth};\n width: var(--resize-drawer-width);\n background-color: ${theme.base.palette['app-background']};\n height: auto;\n inset-block-start: var(--appshell-top-offset, 0);\n inset-block-end: var(--appshell-bottom-offset, 0);\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n transition-property: transform, box-shadow, opacity, border-inline-start;\n transition-duration: max(${theme.base.animation.speed}, 1ms);\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${StyledResizeHandle} {\n z-index: calc(${theme.base['z-index'].max - 1});\n }\n\n @media (width >= ${theme.base.breakpoints.md}) {\n box-shadow: none;\n border-inline-start: 0.0625rem solid\n ${readableHue(theme.base.palette['border-line'], theme.base.palette['app-background'], {\n mode: 'both',\n level: 'AANonText'\n })};\n }\n `;\n});\n\nStyledPreviewDrawer.defaultProps = defaultThemeProp;\n\nconst StyledCloseButton = styled(Button)(({ theme }) => {\n return css`\n --half-btn-compact-difference: calc(\n (${theme.base['hit-area'].mouse} - ${theme.base['hit-area'].compact}) / 2\n );\n @media (pointer: coarse) {\n --half-btn-compact-difference: calc(\n (${theme.base['hit-area'].finger} - ${theme.base['hit-area'].compact}) / 2\n );\n }\n position: absolute;\n border: none;\n\n /* Places above resize handle */\n z-index: ${theme.base['z-index'].max};\n box-shadow: ${theme.base.shadow.low};\n inset-inline-start: calc(-${theme.base['hit-area'].compact} / 2);\n inset-block-start: calc(2 * ${theme.base.spacing} + var(--half-btn-compact-difference));\n `;\n});\n\nStyledCloseButton.defaultProps = defaultThemeProp;\n\nconst PreviewPanel = forwardRef(function PreviewPanel(\n {\n testId,\n previewLabel,\n open,\n children,\n progress,\n onBeforeOpen,\n onAfterOpen,\n onBeforeClose,\n onAfterClose,\n ...restProps\n }: PropsWithoutRef<PreviewPanelProps>,\n ref: Ref<HTMLDivElement>\n) {\n const testIds = useTestIds(testId, getPreviewPanelTestIds);\n\n const t = useI18n();\n const direction = useDirection();\n const previewRef = useConsolidatedRef(ref);\n const { previewTriggerRef } = usePreviewContext();\n\n const [closeButtonEl, setCloseButtonEl] = useElement<HTMLButtonElement>();\n const [progressVisible, setProgressVisible] = useState(false);\n\n const setFocus = () => {\n if (progressVisible) return;\n\n const focusables = getFocusables(previewRef).filter(el => el !== closeButtonEl);\n const focusable = focusables[0] ?? closeButtonEl;\n focusable?.focus();\n };\n\n useEffect(() => {\n if (!progressVisible) {\n setFocus();\n }\n }, [progressVisible]);\n\n useFocusTrap(previewRef, true, [], false);\n\n return (\n <Drawer\n data-testid={testIds.root}\n onBeforeOpen={() => {\n onBeforeOpen?.();\n }}\n onAfterOpen={() => {\n setFocus();\n onAfterOpen?.();\n }}\n as={StyledPreviewDrawer}\n role='complementary'\n forwardedAs={Flex}\n container={{ direction: 'column' }}\n ref={previewRef}\n position='fixed'\n placement={direction.end}\n size={resizeDrawerDefaultWidth}\n aria-label={previewLabel ? t('preview_of_noun', [previewLabel]) : t('preview')}\n open={open}\n resizeable\n shadow\n nullWhenClosed\n {...restProps}\n >\n <StyledCloseButton\n data-testid={testIds.close}\n icon\n compact\n onClick={() => {\n onBeforeClose?.();\n onAfterClose?.();\n previewTriggerRef.current?.focus();\n }}\n ref={setCloseButtonEl}\n label={t('close_preview')}\n >\n <Icon name='times' size='font-size' />\n </StyledCloseButton>\n\n <Progress\n data-testid={testIds.progress}\n placement='local'\n visible={!!progress}\n focusOnVisible\n delay\n onTransitionStartIn={() => {\n setProgressVisible(true);\n }}\n onTransitionEndOut={() => setProgressVisible(false)}\n />\n {!progress && children}\n </Drawer>\n );\n});\n\nexport default withTestIds(PreviewPanel, getPreviewPanelTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"PreviewPanel.js","sourceRoot":"","sources":["../../../src/components/Preview/PreviewPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,kBAAkB,MAAM,gCAAgC,CAAC;AAChE,OAAO,YAAY,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Ac,WACV,SAAS,aAEb,KAAC,iBAAiB,mBACH,OAAO,CAAC,KAAK,EAC1B,IAAI,QACJ,OAAO,QACP,OAAO,EAAE,GAAG,EAAE;oBACZ,aAAa,EAAE,EAAE,CAAC;oBAClB,YAAY,EAAE,EAAE,CAAC;oBACjB,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;gBACrC,CAAC,EACD,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,CAAC,CAAC,eAAe,CAAC,YAEzB,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAC,WAAW,GAAG,GACpB,EAEpB,KAAC,QAAQ,mBACM,OAAO,CAAC,QAAQ,EAC7B,SAAS,EAAC,OAAO,EACjB,OAAO,EAAE,CAAC,CAAC,QAAQ,EACnB,cAAc,QACd,KAAK,QACL,mBAAmB,EAAE,GAAG,EAAE;oBACxB,kBAAkB,CAAC,IAAI,CAAC,CAAC;gBAC3B,CAAC,EACD,kBAAkB,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,GACnD,EACF,KAAC,qBAAqB,IAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,YACjD,CAAC,QAAQ,IAAI,QAAQ,GACA,IACjB,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { forwardRef, useState, useEffect } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport { defaultThemeProp } from '../../theme';\nimport Drawer from '../Drawer';\nimport Flex from '../Flex';\nimport getFocusables from '../../utils/getFocusables';\nimport Icon, { registerIcon } from '../Icon';\nimport Progress from '../Progress';\nimport { readableHue } from '../../styles/utils';\nimport {\n resizeDrawerDefaultWidth,\n resizeDrawerMaxWidth,\n resizeDrawerMinWidth\n} from '../../styles/constants';\nimport { StyledResizeHandle } from '../Drawer/ResizeHandle';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport useConsolidatedRef from '../../hooks/useConsolidatedRef';\nimport useDirection from '../../hooks/useDirection';\nimport useElement from '../../hooks/useElement';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport useI18n from '../../hooks/useI18n';\nimport usePreviewContext from '../../hooks/usePreviewContext';\nimport useTestIds from '../../hooks/useTestIds';\nimport { withTestIds } from '../../utils';\n\nimport { getPreviewPanelTestIds } from './PreviewPanel.test-ids';\nimport type { PreviewPanelProps } from './Preview.types';\n\nregisterIcon(timesIcon);\n\nexport const StyledPreviewDrawer = styled(Drawer)(({ theme }) => {\n return css`\n min-width: ${resizeDrawerMinWidth};\n max-width: ${resizeDrawerMaxWidth};\n width: var(--resize-drawer-width);\n background-color: ${theme.base.palette['app-background']};\n height: auto;\n inset-block-start: var(--appshell-top-offset, 0);\n inset-block-end: var(--appshell-bottom-offset, 0);\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n transition-property: transform, box-shadow, opacity, border-inline-start;\n transition-duration: max(${theme.base.animation.speed}, 1ms);\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${StyledResizeHandle} {\n z-index: calc(${theme.base['z-index'].max - 1});\n }\n\n @media (width >= ${theme.base.breakpoints.md}) {\n box-shadow: none;\n border-inline-start: 0.0625rem solid\n ${readableHue(theme.base.palette['border-line'], theme.base.palette['app-background'], {\n mode: 'both',\n level: 'AANonText'\n })};\n }\n `;\n});\n\nStyledPreviewDrawer.defaultProps = defaultThemeProp;\n\nconst StyledCloseButton = styled(Button)(({ theme }) => {\n return css`\n --half-btn-compact-difference: calc(\n (${theme.base['hit-area'].mouse} - ${theme.base['hit-area'].compact}) / 2\n );\n @media (pointer: coarse) {\n --half-btn-compact-difference: calc(\n (${theme.base['hit-area'].finger} - ${theme.base['hit-area'].compact}) / 2\n );\n }\n position: absolute;\n border: none;\n\n /* Places above resize handle */\n z-index: ${theme.base['z-index'].max};\n box-shadow: ${theme.base.shadow.low};\n inset-inline-start: calc(-${theme.base['hit-area'].compact} / 2);\n inset-block-start: calc(2 * ${theme.base.spacing} + var(--half-btn-compact-difference));\n `;\n});\n\nStyledCloseButton.defaultProps = defaultThemeProp;\n\nconst StyledContentOverflow = styled(Flex)`\n min-height: 0;\n overflow-y: auto;\n`;\n\nStyledContentOverflow.defaultProps = defaultThemeProp;\n\nconst PreviewPanel = forwardRef(function PreviewPanel(\n {\n testId,\n previewLabel,\n open,\n children,\n progress,\n onBeforeOpen,\n onAfterOpen,\n onBeforeClose,\n onAfterClose,\n ...restProps\n }: PropsWithoutRef<PreviewPanelProps>,\n ref: Ref<HTMLDivElement>\n) {\n const testIds = useTestIds(testId, getPreviewPanelTestIds);\n\n const t = useI18n();\n const direction = useDirection();\n const previewRef = useConsolidatedRef(ref);\n const { previewTriggerRef } = usePreviewContext();\n\n const [closeButtonEl, setCloseButtonEl] = useElement<HTMLButtonElement>();\n const [progressVisible, setProgressVisible] = useState(false);\n\n const setFocus = () => {\n if (progressVisible) return;\n\n const focusables = getFocusables(previewRef).filter(el => el !== closeButtonEl);\n const focusable = focusables[0] ?? closeButtonEl;\n focusable?.focus();\n };\n\n useEffect(() => {\n if (!progressVisible) {\n setFocus();\n }\n }, [progressVisible]);\n\n useFocusTrap(previewRef, true, [], false);\n\n return (\n <Drawer\n data-testid={testIds.root}\n onBeforeOpen={() => {\n onBeforeOpen?.();\n }}\n onAfterOpen={() => {\n setFocus();\n onAfterOpen?.();\n }}\n as={StyledPreviewDrawer}\n role='complementary'\n forwardedAs={Flex}\n container={{ direction: 'column' }}\n ref={previewRef}\n position='fixed'\n placement={direction.end}\n size={resizeDrawerDefaultWidth}\n aria-label={previewLabel ? t('preview_of_noun', [previewLabel]) : t('preview')}\n open={open}\n resizeable\n shadow\n nullWhenClosed\n {...restProps}\n >\n <StyledCloseButton\n data-testid={testIds.close}\n icon\n compact\n onClick={() => {\n onBeforeClose?.();\n onAfterClose?.();\n previewTriggerRef.current?.focus();\n }}\n ref={setCloseButtonEl}\n label={t('close_preview')}\n >\n <Icon name='times' size='font-size' />\n </StyledCloseButton>\n\n <Progress\n data-testid={testIds.progress}\n placement='local'\n visible={!!progress}\n focusOnVisible\n delay\n onTransitionStartIn={() => {\n setProgressVisible(true);\n }}\n onTransitionEndOut={() => setProgressVisible(false)}\n />\n <StyledContentOverflow item={{ grow: 1, basis: '0' }}>\n {!progress && children}\n </StyledContentOverflow>\n </Drawer>\n );\n});\n\nexport default withTestIds(PreviewPanel, getPreviewPanelTestIds);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveActions.d.ts","sourceRoot":"","sources":["../../../src/components/ResponsiveActions/ResponsiveActions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlD,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1D,KAAK,sBAAsB,GAAG,cAAc,CAC1C,KAAK,EACL,MAAM,GAAG;IAEP,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAEnC,SAAS,EAAE,SAAS,CAAC;CACtB,CACF,CAAC;AAEF,eAAO,MAAM,gCAAgC;cAA0B,OAAO;
|
|
1
|
+
{"version":3,"file":"ResponsiveActions.d.ts","sourceRoot":"","sources":["../../../src/components/ResponsiveActions/ResponsiveActions.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlD,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1D,KAAK,sBAAsB,GAAG,cAAc,CAC1C,KAAK,EACL,MAAM,GAAG;IAEP,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAEnC,SAAS,EAAE,SAAS,CAAC;CACtB,CACF,CAAC;AAEF,eAAO,MAAM,gCAAgC;cAA0B,OAAO;YAwB7E,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,6CAA6C,sBAAsB,4CAoE7F,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -23,6 +23,7 @@ export const StyledResponsiveActionsContainer = styled.div(({ stacked }) => css
|
|
|
23
23
|
&[aria-hidden='true'] {
|
|
24
24
|
position: fixed;
|
|
25
25
|
visibility: hidden;
|
|
26
|
+
inset-inline-end: 100lvi;
|
|
26
27
|
}
|
|
27
28
|
`);
|
|
28
29
|
const ResponsiveActions = ({ actionsRef, actionsEl, as, ...restProps }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveActions.js","sourceRoot":"","sources":["../../../src/components/ResponsiveActions/ResponsiveActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAazC,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC,GAAG,CACxD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;MAChB,YAAY,MAAM,YAAY;;;;;;;;MAQ9B,CAAC,OAAO;IACV,GAAG,CAAA;;;;;KAKF
|
|
1
|
+
{"version":3,"file":"ResponsiveActions.js","sourceRoot":"","sources":["../../../src/components/ResponsiveActions/ResponsiveActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,Y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ReactNode, RefObject } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Flex from '../Flex';\nimport { StyledButton } from '../Button';\nimport type { AsProp, WithAttributes } from '../../types';\n\ntype ResponsiveActionsProps = WithAttributes<\n 'div',\n AsProp & {\n /* Ref assigned to the actions region. */\n actionsRef: RefObject<HTMLElement>;\n /* Actions region content. */\n actionsEl: ReactNode;\n }\n>;\n\nexport const StyledResponsiveActionsContainer = styled.div<{ stacked?: boolean }>(\n ({ stacked }) => css`\n ${StyledButton} + ${StyledButton} {\n margin-inline-start: unset;\n }\n\n & > :not(a, button) {\n display: contents;\n }\n\n ${!stacked &&\n css`\n & > :is(a, button):first-child:not(:last-child),\n & > :first-child:not(:last-child) :is(a, button):first-child {\n margin-inline-end: auto;\n }\n `}\n\n &[aria-hidden='true'] {\n position: fixed;\n visibility: hidden;\n inset-inline-end: 100lvi;\n }\n `\n);\n\nconst ResponsiveActions = ({ actionsRef, actionsEl, as, ...restProps }: ResponsiveActionsProps) => {\n const hiddenActionsRef = useRef<HTMLDivElement>(null);\n const [stacked, setStacked] = useState(false);\n\n useLayoutEffect(() => {\n if (hiddenActionsRef.current && actionsRef.current) {\n const minInlineWidth = hiddenActionsRef.current.getBoundingClientRect().width;\n\n const resizeObserver = new ResizeObserver(entries => {\n setTimeout(() => {\n if (stacked && entries[0].borderBoxSize[0].inlineSize > minInlineWidth) {\n setStacked(false);\n } else if (!stacked && entries[0].borderBoxSize[0].inlineSize <= minInlineWidth) {\n setStacked(true);\n }\n }, 0);\n });\n\n resizeObserver.observe(actionsRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n });\n\n useLayoutEffect(() => {\n hiddenActionsRef.current?.querySelectorAll('a, button').forEach(action => {\n if (action.hasAttribute('id')) {\n action.removeAttribute('id');\n }\n if (action.hasAttribute('data-testid')) {\n action.removeAttribute('data-testid');\n }\n action.setAttribute('role', 'none');\n });\n });\n\n return (\n <>\n <Flex\n {...restProps}\n as={StyledResponsiveActionsContainer}\n forwardedAs={as}\n ref={actionsRef}\n stacked={stacked}\n container={{\n gap: 1,\n ...(stacked ? { direction: 'column' } : { justify: 'end' })\n }}\n >\n {actionsEl}\n </Flex>\n <Flex\n as={StyledResponsiveActionsContainer}\n ref={hiddenActionsRef}\n aria-hidden\n inert=''\n container={{\n gap: 1,\n direction: 'row',\n justify: 'end'\n }}\n >\n {actionsEl}\n </Flex>\n </>\n );\n};\n\nexport default ResponsiveActions;\n"]}
|
package/lib/hooks/useI18n.d.ts
CHANGED
|
@@ -1875,6 +1875,8 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
|
|
|
1875
1875
|
app_info_view_content: string;
|
|
1876
1876
|
app_info_switch_branch: string;
|
|
1877
1877
|
app_info_update_from_main: string;
|
|
1878
|
+
app_info_commit_private_changes: string;
|
|
1879
|
+
app_info_merge_to_main: string;
|
|
1878
1880
|
app_info_view_branches: string;
|
|
1879
1881
|
app_info_application_version: string;
|
|
1880
1882
|
app_preview_loading: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/lib/i18n/default.d.ts
CHANGED
|
@@ -1878,6 +1878,8 @@ declare const _default: {
|
|
|
1878
1878
|
app_info_view_content: string;
|
|
1879
1879
|
app_info_switch_branch: string;
|
|
1880
1880
|
app_info_update_from_main: string;
|
|
1881
|
+
app_info_commit_private_changes: string;
|
|
1882
|
+
app_info_merge_to_main: string;
|
|
1881
1883
|
app_info_view_branches: string;
|
|
1882
1884
|
app_info_application_version: string;
|
|
1883
1885
|
/** studio-dx-components: Preview */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/i18n/default.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;AA1sE3C,wBA0vEE"}
|
package/lib/i18n/default.js
CHANGED
|
@@ -2023,7 +2023,9 @@ export default {
|
|
|
2023
2023
|
app_info_create_branch: 'Create branch',
|
|
2024
2024
|
app_info_view_content: 'View branch contents',
|
|
2025
2025
|
app_info_switch_branch: 'Switch to branch',
|
|
2026
|
-
app_info_update_from_main: 'Update from
|
|
2026
|
+
app_info_update_from_main: 'Update from Main',
|
|
2027
|
+
app_info_commit_private_changes: 'Commit private changes to branch',
|
|
2028
|
+
app_info_merge_to_main: 'Merge to Main',
|
|
2027
2029
|
app_info_view_branches: 'View all branches',
|
|
2028
2030
|
app_info_application_version: '{0} - v. {1}',
|
|
2029
2031
|
/** studio-dx-components: Preview */
|