@pega/cosmos-react-social 2.0.0-rc.5 → 2.0.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"RepeatingView.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/RepeatingView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAML,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC5B,kCAAkC;IAClC,QAAQ,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,SAAS,CAAC;IAC/C,gBAAgB;IAChB,IAAI,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC1B,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,mDAAmD;IACnD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,uBAAuB;IACvB,eAAe,CAAC,EAAE,eAAe,GAAG,eAAe,CAAC;CACrD;AACD,eAAO,MAAM,uBAAuB,wGAOlC,CAAC;AAGH,eAAO,MAAM,qBAAqB,wGAKjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,yGAE/B,CAAC;AAEF,eAAO,MAAM,eAAe,yGAM3B,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAwDvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"RepeatingView.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/RepeatingView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAML,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC5B,kCAAkC;IAClC,QAAQ,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,SAAS,CAAC;IAC/C,gBAAgB;IAChB,IAAI,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC1B,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,mDAAmD;IACnD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,uBAAuB;IACvB,eAAe,CAAC,EAAE,eAAe,GAAG,eAAe,CAAC;CACrD;AACD,eAAO,MAAM,uBAAuB,wGAOlC,CAAC;AAGH,eAAO,MAAM,qBAAqB,wGAKjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,yGAE/B,CAAC;AAEF,eAAO,MAAM,eAAe,yGAM3B,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CA6DvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -32,7 +32,7 @@ const RepeatingView = forwardRef((props, ref) => {
32
32
  const listRef = useConsolidatedRef(ref);
33
33
  useItemIntersection(listRef, offset, () => {
34
34
  loadMore?.();
35
- });
35
+ }, ':scope > li');
36
36
  return (_jsxs(Flex, { container: {
37
37
  alignItems: 'center',
38
38
  justify: 'center'
@@ -1 +1 @@
1
- {"version":3,"file":"RepeatingView.js","sourceRoot":"","sources":["../../../src/components/Chat/RepeatingView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAsC,UAAU,EAAkB,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAyBjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7D,OAAO,GAAG,CAAA;;;oBAGQ,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;GAExC,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;CAK7C,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE5C,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAMxC,CAAC;AAEF,MAAM,aAAa,GAAyD,UAAU,CACpF,CAAC,KAA0C,EAAE,GAA8B,EAAE,EAAE;IAC7E,MAAM,EACJ,QAAQ,EAAE,QAAQ,EAClB,MAAM,GAAG,CAAC,CAAC,EACX,QAAQ,EACR,OAAO,EAAE,SAAS,GAAG,KAAK,EAC1B,IAAI,GAAG,EAAE,EACT,SAAS,EACT,eAAe,GAAG,eAAe,EACjC,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IAEV,MAAM,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACxC,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE;QACxC,QAAQ,EAAE,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,MAAC,IAAI,IACH,SAAS,EAAE;YACT,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,QAAQ;SAClB,EACD,QAAQ,EAAE,CAAC,EACX,EAAE,EAAE,mBAAmB,KACnB,SAAS,aAEb,MAAC,IAAI,OACC,SAAS,EACb,SAAS,EAAE;oBACT,SAAS,EAAE,eAAe,KAAK,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB;iBAC7E,EACD,EAAE,EAAE,qBAAqB,EACzB,GAAG,EAAE,OAAO,aAEX,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;wBACd,MAAM,EAAE,SAAS,EAAE,GAAG,YAAY,EAAE,GAAG,GAAG,CAAC;wBAC3C,OAAO,CACL,KAAC,uBAAuB,kBAAa,SAAS,EAAE,QAAQ,EAAE,CAAC,YACxD,QAAQ,CAAC,YAAY,CAAC,IADyC,GAAG,CAAC,EAAE,CAE9C,CAC3B,CAAC;oBACJ,CAAC,CAAC,EACD,SAAS,IAAI,CACZ,KAAC,uBAAuB,cACtB,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,WAAG,IADJ,QAAQ,CAEX,CAC3B,YACI,EACN,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,IAAI,CAC/C,KAAC,eAAe,cAAE,SAAS,WAAmB,CAC/C,YACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FunctionComponent, PropsWithoutRef, forwardRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Progress,\n useItemIntersection,\n useConsolidatedRef,\n defaultThemeProp,\n ForwardProps\n} from '@pega/cosmos-react-core';\n\nexport interface RepeatingViewRow {\n id: string | number;\n ariaLabel?: string;\n}\n\nexport interface RepeatingViewProps {\n /** ref to the list element */\n ref?: Ref<HTMLUListElement>;\n /** Callback to render the view */\n children: (row: RepeatingViewRow) => ReactNode;\n /** Data rows */\n rows?: RepeatingViewRow[];\n /** Indicates if the data is being currently loading */\n loading?: boolean;\n /** Offset of the row item that need to trigger the load more callback */\n offset?: number;\n /** Callback to fetch more rows */\n loadMore?: () => void;\n /** UI that needs to be shown when list is empty */\n emptyView?: ReactNode;\n /** Scroll direction */\n scrollDirection?: 'top-to-bottom' | 'bottom-to-top';\n}\nexport const StyledRepeatingViewItem = styled.li(({ theme }) => {\n return css`\n outline: none;\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\nStyledRepeatingViewItem.defaultProps = defaultThemeProp;\n\nexport const StyledRepeatingViewUL = styled.ul`\n list-style-type: none;\n overflow-y: auto;\n height: 100%;\n width: 100%;\n`;\n\nexport const StyledRepeatingView = styled.div`\n position: relative;\n`;\n\nexport const StyledEmptyView = styled.div`\n position: absolute;\n bottom: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1;\n`;\n\nconst RepeatingView: FunctionComponent<RepeatingViewProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<RepeatingViewProps>, ref: RepeatingViewProps['ref']) => {\n const {\n children: renderer,\n offset = -1,\n loadMore,\n loading: isLoading = false,\n rows = [],\n emptyView,\n scrollDirection = 'top-to-bottom',\n ...restProps\n } = props;\n\n const listRef = useConsolidatedRef(ref);\n useItemIntersection(listRef, offset, () => {\n loadMore?.();\n });\n\n return (\n <Flex\n container={{\n alignItems: 'center',\n justify: 'center'\n }}\n tabindex={0}\n as={StyledRepeatingView}\n {...restProps}\n >\n <Flex\n {...restProps}\n container={{\n direction: scrollDirection === 'top-to-bottom' ? 'column' : 'column-reverse'\n }}\n as={StyledRepeatingViewUL}\n ref={listRef}\n >\n {rows.map(row => {\n const { ariaLabel, ...rowRestProps } = row;\n return (\n <StyledRepeatingViewItem aria-label={ariaLabel} tabIndex={0} key={row.id}>\n {renderer(rowRestProps)}\n </StyledRepeatingViewItem>\n );\n })}\n {isLoading && (\n <StyledRepeatingViewItem key='loader'>\n <Progress placement='inline' />\n </StyledRepeatingViewItem>\n )}\n </Flex>\n {!isLoading && rows.length === 0 && emptyView && (\n <StyledEmptyView>{emptyView}</StyledEmptyView>\n )}\n </Flex>\n );\n }\n);\n\nexport default RepeatingView;\n"]}
1
+ {"version":3,"file":"RepeatingView.js","sourceRoot":"","sources":["../../../src/components/Chat/RepeatingView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAsC,UAAU,EAAkB,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAyBjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7D,OAAO,GAAG,CAAA;;;oBAGQ,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;GAExC,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;CAK7C,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE5C,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAMxC,CAAC;AAEF,MAAM,aAAa,GAAyD,UAAU,CACpF,CAAC,KAA0C,EAAE,GAA8B,EAAE,EAAE;IAC7E,MAAM,EACJ,QAAQ,EAAE,QAAQ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CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FunctionComponent, PropsWithoutRef, forwardRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Progress,\n useItemIntersection,\n useConsolidatedRef,\n defaultThemeProp,\n ForwardProps\n} from '@pega/cosmos-react-core';\n\nexport interface RepeatingViewRow {\n id: string | number;\n ariaLabel?: string;\n}\n\nexport interface RepeatingViewProps {\n /** ref to the list element */\n ref?: Ref<HTMLUListElement>;\n /** Callback to render the view */\n children: (row: RepeatingViewRow) => ReactNode;\n /** Data rows */\n rows?: RepeatingViewRow[];\n /** Indicates if the data is being currently loading */\n loading?: boolean;\n /** Offset of the row item that need to trigger the load more callback */\n offset?: number;\n /** Callback to fetch more rows */\n loadMore?: () => void;\n /** UI that needs to be shown when list is empty */\n emptyView?: ReactNode;\n /** Scroll direction */\n scrollDirection?: 'top-to-bottom' | 'bottom-to-top';\n}\nexport const StyledRepeatingViewItem = styled.li(({ theme }) => {\n return css`\n outline: none;\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\nStyledRepeatingViewItem.defaultProps = defaultThemeProp;\n\nexport const StyledRepeatingViewUL = styled.ul`\n list-style-type: none;\n overflow-y: auto;\n height: 100%;\n width: 100%;\n`;\n\nexport const StyledRepeatingView = styled.div`\n position: relative;\n`;\n\nexport const StyledEmptyView = styled.div`\n position: absolute;\n bottom: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1;\n`;\n\nconst RepeatingView: FunctionComponent<RepeatingViewProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<RepeatingViewProps>, ref: RepeatingViewProps['ref']) => {\n const {\n children: renderer,\n offset = -1,\n loadMore,\n loading: isLoading = false,\n rows = [],\n emptyView,\n scrollDirection = 'top-to-bottom',\n ...restProps\n } = props;\n\n const listRef = useConsolidatedRef(ref);\n useItemIntersection(\n listRef,\n offset,\n () => {\n loadMore?.();\n },\n ':scope > li'\n );\n\n return (\n <Flex\n container={{\n alignItems: 'center',\n justify: 'center'\n }}\n tabindex={0}\n as={StyledRepeatingView}\n {...restProps}\n >\n <Flex\n {...restProps}\n container={{\n direction: scrollDirection === 'top-to-bottom' ? 'column' : 'column-reverse'\n }}\n as={StyledRepeatingViewUL}\n ref={listRef}\n >\n {rows.map(row => {\n const { ariaLabel, ...rowRestProps } = row;\n return (\n <StyledRepeatingViewItem aria-label={ariaLabel} tabIndex={0} key={row.id}>\n {renderer(rowRestProps)}\n </StyledRepeatingViewItem>\n );\n })}\n {isLoading && (\n <StyledRepeatingViewItem key='loader'>\n <Progress placement='inline' />\n </StyledRepeatingViewItem>\n )}\n </Flex>\n {!isLoading && rows.length === 0 && emptyView && (\n <StyledEmptyView>{emptyView}</StyledEmptyView>\n )}\n </Flex>\n );\n }\n);\n\nexport default RepeatingView;\n"]}
@@ -73,7 +73,7 @@ const FeedAttachments = forwardRef((props, ref) => {
73
73
  const nonPreviewableFiles = [];
74
74
  attachments.forEach(file => {
75
75
  const type = getKindFromMimeType(getMimeTypeFromFile(file.name) ?? '');
76
- if (type === 'image')
76
+ if (type === 'image' && file.thumbnail)
77
77
  previewableFiles.push(file);
78
78
  else
79
79
  nonPreviewableFiles.push(file);
@@ -1 +1 @@
1
- {"version":3,"file":"FeedAttachments.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedAttachments.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAwB,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,cAAc,EAEd,IAAI,EACJ,KAAK,EACL,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,IAAI,EACJ,UAAU,EACV,WAAW,EACX,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAElF,OA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,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,YAC7C,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE;oBACrE,OAAO,CACL,KAAC,kBAAkB,IAAoB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,YACrE,KAAC,KAAK,IAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,WAAI,IADb,YAAY,CAEhB,CACtB,CAAC;gBACJ,CAAC,CAAC,WACG,CACR,EACD,MAAC,IAAI,IACH,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,qBAAqB,EACzB,SAAS,EAAE;oBACT,IAAI,EAAE,uCAAuC;oBAC7C,GAAG,EAAE,CAAC;iBACP,aAEA,CAAC,QAAQ;wBACR,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE;4BAClE,OAAO,KAAC,cAAc,IAAoB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,KAAM,SAAS,IAAnD,YAAY,CAA2C,CAAC;wBACtF,CAAC,CAAC,EACH,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE;wBACtE,OAAO,KAAC,cAAc,IAAoB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,KAAM,SAAS,IAAnD,YAAY,CAA2C,CAAC;oBACtF,CAAC,CAAC,YACG,YACiB,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { FC, forwardRef, PropsWithoutRef, Ref, useEffect, useContext } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n FileUploadItem,\n FileUploadItemProps,\n Grid,\n Image,\n defaultThemeProp,\n getKindFromMimeType,\n getMimeTypeFromFile,\n Flex,\n StyledFlex,\n usePrevious,\n useI18n\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport { FeedContext } from './Feed.context';\n\nexport type AttachedFiles = FileUploadItemProps & File;\n\ninterface FeedAttachmentsProps {\n attachments?: AttachedFiles[];\n readOnly?: boolean;\n ref?: Ref<HTMLUListElement>;\n}\n\nexport const StyledFeedAttachments = styled.ul(({ theme }) => {\n return css`\n overflow-x: auto;\n\n > li {\n background-color: ${theme.base.palette['primary-background']};\n cursor: initial;\n }\n `;\n});\n\nStyledFeedAttachments.defaultProps = defaultThemeProp;\n\nexport const StyledImagePreview = styled(BareButton)(({ theme }) => {\n return css`\n line-height: 0;\n\n /* stylelint-disable declaration-block-no-duplicate-properties */\n width: -moz-fit-content;\n width: fit-content;\n\n /* stylelint-enable declaration-block-no-duplicate-properties */\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n\n & + & {\n margin: 0;\n }\n\n &:focus {\n box-shadow: ${theme.components.button['focus-shadow']};\n }\n\n img {\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n object-fit: contain;\n max-height: 32rem;\n max-width: 100%;\n }\n `;\n});\n\nStyledImagePreview.defaultProps = defaultThemeProp;\n\nexport const StyledAttachmentsRegion = styled.div(({ theme }) => {\n return css`\n margin: ${theme.base.spacing} 0;\n\n ${StyledFlex} + ${StyledFeedAttachments} {\n margin-block-start: ${theme.base.spacing};\n }\n `;\n});\n\nStyledAttachmentsRegion.defaultProps = defaultThemeProp;\n\nconst FeedAttachments: FC<FeedAttachmentsProps> = forwardRef(\n (props: PropsWithoutRef<FeedAttachmentsProps>, ref: FeedAttachmentsProps['ref']) => {\n const { attachments = [], readOnly } = props;\n const t = useI18n();\n const { announce } = useContext(FeedContext);\n const prevAttachments = usePrevious(attachments) ?? [];\n\n useEffect(() => {\n if (attachments.length !== prevAttachments?.length) {\n const difference = attachments.length - prevAttachments.length;\n const normalizedDifference = difference * (difference > 0 ? 1 : -1);\n announce(\n t(`feed_attachments_${difference > 0 ? 'added' : 'removed'}`, [normalizedDifference], {\n count: normalizedDifference\n })\n );\n }\n }, [attachments]);\n\n if (attachments.length === 0) return null;\n\n const previewableFiles: AttachedFiles[] = [];\n const nonPreviewableFiles: AttachedFiles[] = [];\n\n attachments.forEach(file => {\n const type = getKindFromMimeType(getMimeTypeFromFile(file.name) ?? '');\n\n if (type === 'image') previewableFiles.push(file);\n else nonPreviewableFiles.push(file);\n });\n\n return (\n <StyledAttachmentsRegion>\n {readOnly && !!previewableFiles.length && (\n <Flex container={{ direction: 'column', gap: 1 }}>\n {previewableFiles.map(({ lastModified, name, onPreview, thumbnail }) => {\n return (\n <StyledImagePreview key={lastModified} onClick={() => onPreview?.(name)}>\n <Image alt={name} src={thumbnail} />\n </StyledImagePreview>\n );\n })}\n </Flex>\n )}\n <Grid\n ref={ref}\n as={StyledFeedAttachments}\n container={{\n cols: 'repeat(auto-fill, minmax(15rem, 1fr))',\n gap: 1\n }}\n >\n {!readOnly &&\n previewableFiles.map(({ lastModified, name, size, ...restProps }) => {\n return <FileUploadItem key={lastModified} name={name} size={size} {...restProps} />;\n })}\n {nonPreviewableFiles.map(({ lastModified, name, size, ...restProps }) => {\n return <FileUploadItem key={lastModified} name={name} size={size} {...restProps} />;\n })}\n </Grid>\n </StyledAttachmentsRegion>\n );\n }\n);\n\nexport default FeedAttachments;\n"]}
1
+ {"version":3,"file":"FeedAttachments.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedAttachments.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAwB,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,cAAc,EAEd,IAAI,EACJ,KAAK,EACL,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,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e,CAAC","sourcesContent":["import { FC, forwardRef, PropsWithoutRef, Ref, useEffect, useContext } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n FileUploadItem,\n FileUploadItemProps,\n Grid,\n Image,\n defaultThemeProp,\n getKindFromMimeType,\n getMimeTypeFromFile,\n Flex,\n StyledFlex,\n usePrevious,\n useI18n\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport { FeedContext } from './Feed.context';\n\nexport type AttachedFiles = FileUploadItemProps & File;\n\ninterface FeedAttachmentsProps {\n attachments?: AttachedFiles[];\n readOnly?: boolean;\n ref?: Ref<HTMLUListElement>;\n}\n\nexport const StyledFeedAttachments = styled.ul(({ theme }) => {\n return css`\n overflow-x: auto;\n\n > li {\n background-color: ${theme.base.palette['primary-background']};\n cursor: initial;\n }\n `;\n});\n\nStyledFeedAttachments.defaultProps = defaultThemeProp;\n\nexport const StyledImagePreview = styled(BareButton)(({ theme }) => {\n return css`\n line-height: 0;\n\n /* stylelint-disable declaration-block-no-duplicate-properties */\n width: -moz-fit-content;\n width: fit-content;\n\n /* stylelint-enable declaration-block-no-duplicate-properties */\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n\n & + & {\n margin: 0;\n }\n\n &:focus {\n box-shadow: ${theme.components.button['focus-shadow']};\n }\n\n img {\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n object-fit: contain;\n max-height: 32rem;\n max-width: 100%;\n }\n `;\n});\n\nStyledImagePreview.defaultProps = defaultThemeProp;\n\nexport const StyledAttachmentsRegion = styled.div(({ theme }) => {\n return css`\n margin: ${theme.base.spacing} 0;\n\n ${StyledFlex} + ${StyledFeedAttachments} {\n margin-block-start: ${theme.base.spacing};\n }\n `;\n});\n\nStyledAttachmentsRegion.defaultProps = defaultThemeProp;\n\nconst FeedAttachments: FC<FeedAttachmentsProps> = forwardRef(\n (props: PropsWithoutRef<FeedAttachmentsProps>, ref: FeedAttachmentsProps['ref']) => {\n const { attachments = [], readOnly } = props;\n const t = useI18n();\n const { announce } = useContext(FeedContext);\n const prevAttachments = usePrevious(attachments) ?? [];\n\n useEffect(() => {\n if (attachments.length !== prevAttachments?.length) {\n const difference = attachments.length - prevAttachments.length;\n const normalizedDifference = difference * (difference > 0 ? 1 : -1);\n announce(\n t(`feed_attachments_${difference > 0 ? 'added' : 'removed'}`, [normalizedDifference], {\n count: normalizedDifference\n })\n );\n }\n }, [attachments]);\n\n if (attachments.length === 0) return null;\n\n const previewableFiles: AttachedFiles[] = [];\n const nonPreviewableFiles: AttachedFiles[] = [];\n\n attachments.forEach(file => {\n const type = getKindFromMimeType(getMimeTypeFromFile(file.name) ?? '');\n\n if (type === 'image' && file.thumbnail) previewableFiles.push(file);\n else nonPreviewableFiles.push(file);\n });\n\n return (\n <StyledAttachmentsRegion>\n {readOnly && !!previewableFiles.length && (\n <Flex container={{ direction: 'column', gap: 1 }}>\n {previewableFiles.map(({ lastModified, name, onPreview, thumbnail }) => {\n return (\n <StyledImagePreview key={lastModified} onClick={() => onPreview?.(name)}>\n <Image alt={name} src={thumbnail} />\n </StyledImagePreview>\n );\n })}\n </Flex>\n )}\n <Grid\n ref={ref}\n as={StyledFeedAttachments}\n container={{\n cols: 'repeat(auto-fill, minmax(15rem, 1fr))',\n gap: 1\n }}\n >\n {!readOnly &&\n previewableFiles.map(({ lastModified, name, size, ...restProps }) => {\n return <FileUploadItem key={lastModified} name={name} size={size} {...restProps} />;\n })}\n {nonPreviewableFiles.map(({ lastModified, name, size, ...restProps }) => {\n return <FileUploadItem key={lastModified} name={name} size={size} {...restProps} />;\n })}\n </Grid>\n </StyledAttachmentsRegion>\n );\n }\n);\n\nexport default FeedAttachments;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-social",
3
- "version": "2.0.0-rc.5",
3
+ "version": "2.0.0",
4
4
  "author": "Pegasystems",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -20,9 +20,9 @@
20
20
  "build": "tsc -b"
21
21
  },
22
22
  "dependencies": {
23
- "@pega/cosmos-react-core": "2.0.0-rc.5",
24
- "@pega/cosmos-react-rte": "2.0.0-rc.5",
25
- "@pega/cosmos-react-work": "2.0.0-rc.5",
23
+ "@pega/cosmos-react-core": "2.0.0",
24
+ "@pega/cosmos-react-rte": "2.0.0",
25
+ "@pega/cosmos-react-work": "2.0.0",
26
26
  "polished": "^4.1.0",
27
27
  "react": "^16.14.0 || ^17.0.0",
28
28
  "react-dom": "^16.14.0 || ^17.0.0",