@pega/cosmos-react-core 3.0.0-dev.6.0 → 3.0.0-dev.7.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":"FieldValueList.d.ts","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQtE,MAAM,WAAW,mBAAoB,SAAQ,SAAS,EAAE,cAAc;IACpE,qDAAqD;IACrD,MAAM,EAAE;QACN,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,SAAS,CAAC;KACnB,EAAE,CAAC;IACJ;;;OAGG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,wGAE3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,wGAE5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,wGAEhC,CAAC;AA6DF,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CA+BzE,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"FieldValueList.d.ts","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQtE,MAAM,WAAW,mBAAoB,SAAQ,SAAS,EAAE,cAAc;IACpE,qDAAqD;IACrD,MAAM,EAAE;QACN,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,SAAS,CAAC;KACnB,EAAE,CAAC;IACJ;;;OAGG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,wGAE3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,wGAG5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,wGAEhC,CAAC;AA6DF,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CA+BzE,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -13,6 +13,7 @@ export const StyledFieldName = styled.dt `
13
13
  `;
14
14
  export const StyledFieldValue = styled.dd `
15
15
  word-break: break-word;
16
+ overflow: auto;
16
17
  `;
17
18
  export const StyledFieldValueList = styled.dl `
18
19
  width: 100%;
@@ -50,7 +51,7 @@ const DynamicHeightValue = ({ children }) => {
50
51
  const FieldValueList = ({ fields, variant = 'inline', ...restProps }) => {
51
52
  const Wrapper = variant === 'inline' ? Fragment : 'div';
52
53
  return (_jsx(Grid, { ...restProps, container: {
53
- cols: variant === 'inline' ? '16ch auto' : 'minmax(0, 1fr)',
54
+ cols: variant === 'inline' ? '16ch minmax(0, 1fr)' : 'minmax(0, 1fr)',
54
55
  colGap: 2,
55
56
  rowGap: 1
56
57
  }, as: StyledFieldValueList, children: fields.map(({ id, name, value }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"FieldValueList.js","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,QAAQ,EAER,QAAQ,EACR,eAAe,EACf,MAAM,EACN,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OA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Q,CAAC,CAAC,CAAC,KAAK,CAAC;IAExD,OAAO,CACL,KAAC,IAAI,OACC,SAAS,EACb,SAAS,EAAE;YACT,IAAI,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB;YAC3D,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;SACV,EACD,EAAE,EAAE,oBAAoB,YAEvB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;YAClC,MAAM,WAAW,GACf,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAC,kBAAkB,cAAE,KAAK,GAAsB,CAAC,CAAC,CAAC,KAAK,CAAC;YACvF,OAAO,CACL,MAAC,OAAO,eACN,KAAC,WAAW,IAAC,EAAE,EAAE,eAAe,YAAG,IAAI,GAAe,EACtD,KAAC,gBAAgB,cACd,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,8BAAkB,MAAM,6BAAsB,GACpD,KAJP,EAAE,IAAI,IAAI,CAKd,CACX,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n ReactNode,\n Fragment,\n FunctionComponent,\n useState,\n useLayoutEffect,\n useRef,\n useMemo\n} from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport Button from '../Button';\nimport ExpandCollapse from '../ExpandCollapse';\nimport Grid from '../Grid';\nimport { StyledLabel } from '../Label';\nimport { useI18n } from '../../hooks';\nimport { windowIsAvailable } from '../../utils';\n\nexport interface FieldValueListProps extends BaseProps, NoChildrenProp {\n /** The set of field values to render in the list. */\n fields: {\n id?: string;\n name: string;\n value?: ReactNode;\n }[];\n /**\n * Determines if the field and values should be displayed on the same line, or stacked with the field above the value.\n * @default \"inline\"\n */\n variant?: 'inline' | 'stacked';\n}\n\nexport const StyledFieldName = styled.dt`\n word-break: break-word;\n`;\n\nexport const StyledFieldValue = styled.dd`\n word-break: break-word;\n`;\n\nexport const StyledFieldValueList = styled.dl`\n width: 100%;\n`;\n\nStyledFieldValueList.defaultProps = defaultThemeProp;\n\nconst DynamicHeightValue = ({ children }: { children: ReactNode }): JSX.Element => {\n const [collapsed, setCollapsed] = useState(true);\n const [exceedsMaxHeight, setExceedsMaxHeight] = useState(false);\n const textRef = useRef<HTMLSpanElement>(null);\n const t = useI18n();\n\n const maxTextHeight = useMemo(() => {\n if (!windowIsAvailable) return Infinity;\n\n const computedLineHeight =\n Number.parseInt(\n window.getComputedStyle(document.documentElement).getPropertyValue('font-size'),\n 10\n ) * 1.25;\n\n return 3 * computedLineHeight;\n }, []);\n\n useLayoutEffect(() => {\n if (!textRef.current) return;\n\n const observer = new ResizeObserver(entries => {\n const exceedsHeight = entries.some(({ target, contentRect }) => {\n if (target !== textRef.current) return;\n\n return contentRect.height > maxTextHeight;\n });\n\n setExceedsMaxHeight(exceedsHeight);\n });\n\n observer.observe(textRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [textRef.current, maxTextHeight]);\n\n return (\n <>\n <ExpandCollapse\n collapsed={collapsed}\n min={exceedsMaxHeight ? `${maxTextHeight}px` : 'max-content'}\n >\n <Grid ref={textRef}>\n <span>{children}</span>\n </Grid>\n </ExpandCollapse>\n {exceedsMaxHeight && (\n <Button variant='link' onClick={() => setCollapsed(current => !current)}>\n {collapsed ? t('show_more') : t('show_less')}\n </Button>\n )}\n </>\n );\n};\n\nconst FieldValueList: FunctionComponent<FieldValueListProps & ForwardProps> = ({\n fields,\n variant = 'inline',\n ...restProps\n}: FieldValueListProps) => {\n const Wrapper = variant === 'inline' ? Fragment : 'div';\n\n return (\n <Grid\n {...restProps}\n container={{\n cols: variant === 'inline' ? '16ch auto' : 'minmax(0, 1fr)',\n colGap: 2,\n rowGap: 1\n }}\n as={StyledFieldValueList}\n >\n {fields.map(({ id, name, value }) => {\n const diplayValue =\n typeof value === 'string' ? <DynamicHeightValue>{value}</DynamicHeightValue> : value;\n return (\n <Wrapper key={id ?? name}>\n <StyledLabel as={StyledFieldName}>{name}</StyledLabel>\n <StyledFieldValue>\n {value ? diplayValue : <span aria-hidden='true'>&ndash;&ndash;</span>}\n </StyledFieldValue>\n </Wrapper>\n );\n })}\n </Grid>\n );\n};\n\nexport default FieldValueList;\n"]}
1
+ {"version":3,"file":"FieldValueList.js","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,QAAQ,EAER,QAAQ,EACR,eAAe,EACf,MAAM,EACN,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAgBhD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAA;;CAEvC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAAA;;;CAGxC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,EAAE,CAAA;;CAE5C,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAe,EAAE;IAChF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,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BAAgB,cACd,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,8BAAkB,MAAM,6BAAsB,GACpD,KAJP,EAAE,IAAI,IAAI,CAKd,CACX,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n ReactNode,\n Fragment,\n FunctionComponent,\n useState,\n useLayoutEffect,\n useRef,\n useMemo\n} from 'react';\nimport styled from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport Button from '../Button';\nimport ExpandCollapse from '../ExpandCollapse';\nimport Grid from '../Grid';\nimport { StyledLabel } from '../Label';\nimport { useI18n } from '../../hooks';\nimport { windowIsAvailable } from '../../utils';\n\nexport interface FieldValueListProps extends BaseProps, NoChildrenProp {\n /** The set of field values to render in the list. */\n fields: {\n id?: string;\n name: string;\n value?: ReactNode;\n }[];\n /**\n * Determines if the field and values should be displayed on the same line, or stacked with the field above the value.\n * @default \"inline\"\n */\n variant?: 'inline' | 'stacked';\n}\n\nexport const StyledFieldName = styled.dt`\n word-break: break-word;\n`;\n\nexport const StyledFieldValue = styled.dd`\n word-break: break-word;\n overflow: auto;\n`;\n\nexport const StyledFieldValueList = styled.dl`\n width: 100%;\n`;\n\nStyledFieldValueList.defaultProps = defaultThemeProp;\n\nconst DynamicHeightValue = ({ children }: { children: ReactNode }): JSX.Element => {\n const [collapsed, setCollapsed] = useState(true);\n const [exceedsMaxHeight, setExceedsMaxHeight] = useState(false);\n const textRef = useRef<HTMLSpanElement>(null);\n const t = useI18n();\n\n const maxTextHeight = useMemo(() => {\n if (!windowIsAvailable) return Infinity;\n\n const computedLineHeight =\n Number.parseInt(\n window.getComputedStyle(document.documentElement).getPropertyValue('font-size'),\n 10\n ) * 1.25;\n\n return 3 * computedLineHeight;\n }, []);\n\n useLayoutEffect(() => {\n if (!textRef.current) return;\n\n const observer = new ResizeObserver(entries => {\n const exceedsHeight = entries.some(({ target, contentRect }) => {\n if (target !== textRef.current) return;\n\n return contentRect.height > maxTextHeight;\n });\n\n setExceedsMaxHeight(exceedsHeight);\n });\n\n observer.observe(textRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [textRef.current, maxTextHeight]);\n\n return (\n <>\n <ExpandCollapse\n collapsed={collapsed}\n min={exceedsMaxHeight ? `${maxTextHeight}px` : 'max-content'}\n >\n <Grid ref={textRef}>\n <span>{children}</span>\n </Grid>\n </ExpandCollapse>\n {exceedsMaxHeight && (\n <Button variant='link' onClick={() => setCollapsed(current => !current)}>\n {collapsed ? t('show_more') : t('show_less')}\n </Button>\n )}\n </>\n );\n};\n\nconst FieldValueList: FunctionComponent<FieldValueListProps & ForwardProps> = ({\n fields,\n variant = 'inline',\n ...restProps\n}: FieldValueListProps) => {\n const Wrapper = variant === 'inline' ? Fragment : 'div';\n\n return (\n <Grid\n {...restProps}\n container={{\n cols: variant === 'inline' ? '16ch minmax(0, 1fr)' : 'minmax(0, 1fr)',\n colGap: 2,\n rowGap: 1\n }}\n as={StyledFieldValueList}\n >\n {fields.map(({ id, name, value }) => {\n const diplayValue =\n typeof value === 'string' ? <DynamicHeightValue>{value}</DynamicHeightValue> : value;\n return (\n <Wrapper key={id ?? name}>\n <StyledLabel as={StyledFieldName}>{name}</StyledLabel>\n <StyledFieldValue>\n {value ? diplayValue : <span aria-hidden='true'>&ndash;&ndash;</span>}\n </StyledFieldValue>\n </Wrapper>\n );\n })}\n </Grid>\n );\n};\n\nexport default FieldValueList;\n"]}
@@ -5,6 +5,6 @@ import { hideVisually } from 'polished';
5
5
  export const StyledVisuallyHiddenText = styled.span `
6
6
  ${hideVisually}
7
7
  `;
8
- const VisuallyHiddenText = forwardRef((props, ref) => (_jsx(StyledVisuallyHiddenText, { ...props, ref: ref })));
8
+ const VisuallyHiddenText = forwardRef((props, ref) => (_jsx(StyledVisuallyHiddenText, { ...props, ref: ref, hidden: true })));
9
9
  export default VisuallyHiddenText;
10
10
  //# sourceMappingURL=VisuallyHiddenText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VisuallyHiddenText.js","sourceRoot":"","sources":["../../../src/components/VisuallyHiddenText/VisuallyHiddenText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AASxC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAA;IAC/C,YAAY;CACf,CAAC;AAEF,MAAM,kBAAkB,GAA8D,UAAU,CAC9F,CAAC,KAA+C,EAAE,GAAmC,EAAE,EAAE,CAAC,CACxF,KAAC,wBAAwB,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,CAClD,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, Ref, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport { ForwardProps } from '../../types';\n\ninterface VisuallyHiddenTextProps {\n children: string;\n ref?: Ref<HTMLSpanElement>;\n}\n\nexport const StyledVisuallyHiddenText = styled.span`\n ${hideVisually}\n`;\n\nconst VisuallyHiddenText: FunctionComponent<VisuallyHiddenTextProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<VisuallyHiddenTextProps>, ref: VisuallyHiddenTextProps['ref']) => (\n <StyledVisuallyHiddenText {...props} ref={ref} />\n )\n);\n\nexport default VisuallyHiddenText;\n"]}
1
+ {"version":3,"file":"VisuallyHiddenText.js","sourceRoot":"","sources":["../../../src/components/VisuallyHiddenText/VisuallyHiddenText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AASxC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAA;IAC/C,YAAY;CACf,CAAC;AAEF,MAAM,kBAAkB,GAA8D,UAAU,CAC9F,CAAC,KAA+C,EAAE,GAAmC,EAAE,EAAE,CAAC,CACxF,KAAC,wBAAwB,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,SAAG,CACzD,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, Ref, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport { ForwardProps } from '../../types';\n\ninterface VisuallyHiddenTextProps {\n children: string;\n ref?: Ref<HTMLSpanElement>;\n}\n\nexport const StyledVisuallyHiddenText = styled.span`\n ${hideVisually}\n`;\n\nconst VisuallyHiddenText: FunctionComponent<VisuallyHiddenTextProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<VisuallyHiddenTextProps>, ref: VisuallyHiddenTextProps['ref']) => (\n <StyledVisuallyHiddenText {...props} ref={ref} hidden />\n )\n);\n\nexport default VisuallyHiddenText;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-core",
3
- "version": "3.0.0-dev.6.0",
3
+ "version": "3.0.0-dev.7.0",
4
4
  "description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
5
5
  "author": "Pegasystems",
6
6
  "license": "SEE LICENSE IN LICENSE",