@pega/cosmos-react-core 7.11.6 → 7.11.8

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.
@@ -7,7 +7,7 @@ import { getFormTestIds } from './Form.test-ids';
7
7
  const Form = forwardRef(function Form({ testId, children, actions, progress, heading, description, banners, ...restProps }, ref) {
8
8
  const stepId = useUID();
9
9
  const testIds = useTestIds(testId, getFormTestIds);
10
- return (_jsx(MultiStepForm, { "data-testid": testIds.root, ...restProps, heading: heading, steps: [
10
+ return (_jsx(MultiStepForm, { "data-testid": testIds.root, autoComplete: '_off', ...restProps, heading: heading, steps: [
11
11
  {
12
12
  id: stepId,
13
13
  name: '',
@@ -16,7 +16,7 @@ const Form = forwardRef(function Form({ testId, children, actions, progress, hea
16
16
  description,
17
17
  banners
18
18
  }
19
- ], currentStepId: stepId, progress: progress, ref: ref, autoComplete: 'off' }));
19
+ ], currentStepId: stepId, progress: progress, ref: ref }));
20
20
  });
21
21
  export default withTestIds(Form, getFormTestIds);
22
22
  //# sourceMappingURL=Form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAOjD,MAAM,IAAI,GAAiC,UAAU,CAAC,SAAS,IAAI,CACjE,EACE,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,OAAO,EACP,WAAW,EACX,OAAO,EACP,GAAG,SAAS,EACe,EAC7B,GAAqB;IAErB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,aAAa,mBACC,OAAO,CAAC,IAAI,KACrB,SAAS,EACb,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,EAAE;gBACR,OAAO;gBACP,OAAO,EAAE,QAAQ;gBACjB,WAAW;gBACX,OAAO;aACR;SACF,EACD,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,YAAY,EAAC,KAAK,GAClB,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FC, PropsWithoutRef } from 'react';\n\nimport type { ForwardProps, OmitStrict, TestIdProp } from '../../types';\nimport { useTestIds, useUID } from '../../hooks';\nimport MultiStepForm from '../MultiStepForm';\nimport type { BaseFormProps } from '../MultiStepForm/MultiStepForm.types';\nimport { withTestIds } from '../../utils';\n\nimport { getFormTestIds } from './Form.test-ids';\n\nexport interface FormProps extends OmitStrict<BaseFormProps, 'content'>, TestIdProp {\n /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */\n children: BaseFormProps['content'];\n}\n\nconst Form: FC<FormProps & ForwardProps> = forwardRef(function Form(\n {\n testId,\n children,\n actions,\n progress,\n heading,\n description,\n banners,\n ...restProps\n }: PropsWithoutRef<FormProps>,\n ref: FormProps['ref']\n) {\n const stepId = useUID();\n const testIds = useTestIds(testId, getFormTestIds);\n\n return (\n <MultiStepForm\n data-testid={testIds.root}\n {...restProps}\n heading={heading}\n steps={[\n {\n id: stepId,\n name: '',\n actions,\n content: children,\n description,\n banners\n }\n ]}\n currentStepId={stepId}\n progress={progress}\n ref={ref}\n autoComplete='off'\n />\n );\n});\n\nexport default withTestIds(Form, getFormTestIds);\n"]}
1
+ {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAOjD,MAAM,IAAI,GAAiC,UAAU,CAAC,SAAS,IAAI,CACjE,EACE,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,OAAO,EACP,WAAW,EACX,OAAO,EACP,GAAG,SAAS,EACe,EAC7B,GAAqB;IAErB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,aAAa,mBACC,OAAO,CAAC,IAAI,EACzB,YAAY,EAAC,MAAM,KACf,SAAS,EACb,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,EAAE;gBACR,OAAO;gBACP,OAAO,EAAE,QAAQ;gBACjB,WAAW;gBACX,OAAO;aACR;SACF,EACD,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FC, PropsWithoutRef } from 'react';\n\nimport type { ForwardProps, OmitStrict, TestIdProp } from '../../types';\nimport { useTestIds, useUID } from '../../hooks';\nimport MultiStepForm from '../MultiStepForm';\nimport type { BaseFormProps } from '../MultiStepForm/MultiStepForm.types';\nimport { withTestIds } from '../../utils';\n\nimport { getFormTestIds } from './Form.test-ids';\n\nexport interface FormProps extends OmitStrict<BaseFormProps, 'content'>, TestIdProp {\n /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */\n children: BaseFormProps['content'];\n}\n\nconst Form: FC<FormProps & ForwardProps> = forwardRef(function Form(\n {\n testId,\n children,\n actions,\n progress,\n heading,\n description,\n banners,\n ...restProps\n }: PropsWithoutRef<FormProps>,\n ref: FormProps['ref']\n) {\n const stepId = useUID();\n const testIds = useTestIds(testId, getFormTestIds);\n\n return (\n <MultiStepForm\n data-testid={testIds.root}\n autoComplete='_off'\n {...restProps}\n heading={heading}\n steps={[\n {\n id: stepId,\n name: '',\n actions,\n content: children,\n description,\n banners\n }\n ]}\n currentStepId={stepId}\n progress={progress}\n ref={ref}\n />\n );\n});\n\nexport default withTestIds(Form, getFormTestIds);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAc,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOvD,MAAM,MAAM,UAAU,GAAG,cAAc,CACrC,OAAO,EACP,gBAAgB,GACd,UAAU,GACV,cAAc,GAAG;IACf;;;OAGG;IACH,IAAI,CAAC,EACD,MAAM,GACN,UAAU,GACV,QAAQ,GACR,OAAO,GACP,KAAK,GACL,QAAQ,GACR,KAAK,GACL,MAAM,GACN,gBAAgB,GAChB,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,OAAO,CAAC;IACZ,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CACJ,CAAC;;;;AAEF,wBA0EE"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAc,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOvD,MAAM,MAAM,UAAU,GAAG,cAAc,CACrC,OAAO,EACP,gBAAgB,GACd,UAAU,GACV,cAAc,GAAG;IACf;;;OAGG;IACH,IAAI,CAAC,EACD,MAAM,GACN,UAAU,GACV,QAAQ,GACR,OAAO,GACP,KAAK,GACL,QAAQ,GACR,KAAK,GACL,MAAM,GACN,gBAAgB,GAChB,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,OAAO,CAAC;IACZ,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CACJ,CAAC;;;;AAEF,wBA8EE"}
@@ -18,7 +18,11 @@ export default withTestIds(forwardRef(function Input(props, ref) {
18
18
  else if (hasProp(props, 'defaultValue')) {
19
19
  controlProp.defaultValue = defaultValue ?? '';
20
20
  }
21
- const Comp = (_jsx(StyledFormControl, { "data-testid": testIds.control, ref: ref, id: id, required: required, disabled: disabled, readOnly: readOnly, status: status, hasSuggestion: !!onResolveSuggestion && status === 'pending', ...controlProp, ...restProps, as: StyledInput }));
21
+ const Comp = (_jsx(StyledFormControl, { "data-testid": testIds.control, ref: ref, id: id, required: required, disabled: disabled, readOnly: readOnly, status: status, hasSuggestion: !!onResolveSuggestion && status === 'pending', ...controlProp,
22
+ // Disables browser autocomplete
23
+ // Chrome does not respect autocomplete='off'
24
+ // Current consensus is to workaround via random string
25
+ autoComplete: '_off', ...restProps, as: StyledInput }));
22
26
  return label ? (_jsx(FormField, { testId: testIds, additionalInfo: additionalInfo, label: label, labelHidden: labelHidden, id: id, info: info, readOnly: readOnly, status: status, required: required, disabled: disabled, actions: actions, onResolveSuggestion: onResolveSuggestion, children: Comp })) : (Comp);
23
27
  }), getInputTestIds);
24
28
  //# sourceMappingURL=Input.js.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OAAO,EAC5B,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,CAAC,CAAC,mBAAmB,IAAI,MAAM,KAAK,SAAS,KACxD,WAAW,KACX,SAAS,EACb,EAAE,EAAE,WAAW,GACf,CACH,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,MAAM,EAAE,OAAO,EACf,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,mBAAmB,YAEvC,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CAAC,EACF,eAAe,CAChB,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport type { Action, NoChildrenProp, RefElement, TestIdProp, WithAttributes } from '../../types';\nimport FormField from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport { hasProp, withTestIds } from '../../utils';\nimport { useTestIds, useUID } from '../../hooks';\n\nimport StyledInput from './Input.styles';\nimport { getInputTestIds } from './Input.test-ids';\n\nexport type InputProps = WithAttributes<\n 'input',\n FormControlProps &\n TestIdProp &\n NoChildrenProp & {\n /**\n * Specifies the type of input to be used.\n * @default 'text'\n */\n type?:\n | 'text'\n | 'password'\n | 'number'\n | 'email'\n | 'url'\n | 'search'\n | 'tel'\n | 'date'\n | 'datetime-local'\n | 'time'\n | 'week'\n | 'month'\n | 'hidden'\n | 'color';\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: Action[];\n }\n>;\n\nexport default withTestIds(\n forwardRef<RefElement<InputProps>, PropsWithoutRef<InputProps>>(function Input(props, ref) {\n const uid = useUID();\n\n const {\n testId,\n id = uid,\n value,\n defaultValue,\n required = false,\n disabled = false,\n readOnly = false,\n label,\n additionalInfo,\n labelHidden,\n info,\n status,\n actions,\n onResolveSuggestion,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getInputTestIds);\n\n const controlProp: {\n value?: string;\n defaultValue?: string;\n } = {};\n\n // Conditionally render component as controlled/uncontrolled\n if (hasProp(props, 'value')) {\n controlProp.value = value ?? '';\n } else if (hasProp(props, 'defaultValue')) {\n controlProp.defaultValue = defaultValue ?? '';\n }\n\n const Comp = (\n <StyledFormControl\n data-testid={testIds.control}\n ref={ref}\n id={id}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n hasSuggestion={!!onResolveSuggestion && status === 'pending'}\n {...controlProp}\n {...restProps}\n as={StyledInput}\n />\n );\n\n return label ? (\n <FormField\n testId={testIds}\n additionalInfo={additionalInfo}\n label={label}\n labelHidden={labelHidden}\n id={id}\n info={info}\n readOnly={readOnly}\n status={status}\n required={required}\n disabled={disabled}\n actions={actions}\n onResolveSuggestion={onResolveSuggestion}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }),\n getInputTestIds\n);\n"]}
1
+ {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,WA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,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,MAAM,EAAE,OAAO,EACf,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,mBAAmB,YAEvC,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CAAC,EACF,eAAe,CAChB,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport type { Action, NoChildrenProp, RefElement, TestIdProp, WithAttributes } from '../../types';\nimport FormField from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport { hasProp, withTestIds } from '../../utils';\nimport { useTestIds, useUID } from '../../hooks';\n\nimport StyledInput from './Input.styles';\nimport { getInputTestIds } from './Input.test-ids';\n\nexport type InputProps = WithAttributes<\n 'input',\n FormControlProps &\n TestIdProp &\n NoChildrenProp & {\n /**\n * Specifies the type of input to be used.\n * @default 'text'\n */\n type?:\n | 'text'\n | 'password'\n | 'number'\n | 'email'\n | 'url'\n | 'search'\n | 'tel'\n | 'date'\n | 'datetime-local'\n | 'time'\n | 'week'\n | 'month'\n | 'hidden'\n | 'color';\n /** Pass an array of Action objects to append button(s) inline with the Input. */\n actions?: Action[];\n }\n>;\n\nexport default withTestIds(\n forwardRef<RefElement<InputProps>, PropsWithoutRef<InputProps>>(function Input(props, ref) {\n const uid = useUID();\n\n const {\n testId,\n id = uid,\n value,\n defaultValue,\n required = false,\n disabled = false,\n readOnly = false,\n label,\n additionalInfo,\n labelHidden,\n info,\n status,\n actions,\n onResolveSuggestion,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getInputTestIds);\n\n const controlProp: {\n value?: string;\n defaultValue?: string;\n } = {};\n\n // Conditionally render component as controlled/uncontrolled\n if (hasProp(props, 'value')) {\n controlProp.value = value ?? '';\n } else if (hasProp(props, 'defaultValue')) {\n controlProp.defaultValue = defaultValue ?? '';\n }\n\n const Comp = (\n <StyledFormControl\n data-testid={testIds.control}\n ref={ref}\n id={id}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n hasSuggestion={!!onResolveSuggestion && status === 'pending'}\n {...controlProp}\n // Disables browser autocomplete\n // Chrome does not respect autocomplete='off'\n // Current consensus is to workaround via random string\n autoComplete='_off'\n {...restProps}\n as={StyledInput}\n />\n );\n\n return label ? (\n <FormField\n testId={testIds}\n additionalInfo={additionalInfo}\n label={label}\n labelHidden={labelHidden}\n id={id}\n info={info}\n readOnly={readOnly}\n status={status}\n required={required}\n disabled={disabled}\n actions={actions}\n onResolveSuggestion={onResolveSuggestion}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }),\n getInputTestIds\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MetaList.d.ts","sourceRoot":"","sources":["../../../src/components/MetaList/MetaList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAmB,MAAM,OAAO,CAAC;AAKhF,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMvF,MAAM,WAAW,aAAc,SAAQ,SAAS,EAAE,cAAc,EAAE,UAAU;IAC1E,yDAAyD;IACzD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED,eAAO,MAAM,cAAc;eAA0B,OAAO;SAU1D,CAAC;AAEH,eAAO,MAAM,kBAAkB;eAA0B,OAAO;SAoB9D,CAAC;;;;AAgDH,wBAAyD"}
1
+ {"version":3,"file":"MetaList.d.ts","sourceRoot":"","sources":["../../../src/components/MetaList/MetaList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAmB,MAAM,OAAO,CAAC;AAKhF,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMvF,MAAM,WAAW,aAAc,SAAQ,SAAS,EAAE,cAAc,EAAE,UAAU;IAC1E,yDAAyD;IACzD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED,eAAO,MAAM,cAAc;eAA0B,OAAO;SAU1D,CAAC;AAEH,eAAO,MAAM,kBAAkB;eAA0B,OAAO;SAoB9D,CAAC;;;;AAmDH,wBAAyD"}
@@ -40,9 +40,10 @@ export const StyledMetaListItem = styled.li(({ wrapItems }) => {
40
40
  });
41
41
  const MetaList = forwardRef(function MetaList({ testId, items, wrapItems = true, ...restProps }, ref) {
42
42
  const testIds = useTestIds(testId, getMetaListTestIds);
43
- return (_jsx(Flex, { "data-testid": testIds.root, ...restProps, as: StyledMetaList, container: { colGap: 0.5, alignItems: 'center', wrap: wrapItems ? 'wrap' : 'nowrap' }, wrapItems: wrapItems, ref: ref, children: items.flatMap((item, i, arr) => item
43
+ const roleAttrValue = items.length <= 1 ? 'none' : undefined;
44
+ return (_jsx(Flex, { "data-testid": testIds.root, ...restProps, as: StyledMetaList, role: roleAttrValue, container: { colGap: 0.5, alignItems: 'center', wrap: wrapItems ? 'wrap' : 'nowrap' }, wrapItems: wrapItems, ref: ref, children: items.flatMap((item, i, arr) => item
44
45
  ? [
45
- _jsx(Text, { as: StyledMetaListItem, variant: 'secondary', wrapItems: wrapItems, children: item }, `${i + 0}`)
46
+ _jsx(Text, { as: StyledMetaListItem, variant: 'secondary', role: roleAttrValue, wrapItems: wrapItems, children: item }, `${i + 0}`)
46
47
  ].concat(i !== arr.length - 1
47
48
  ? [
48
49
  _jsx(Text, { as: StyledMetaListItem, "aria-hidden": true, variant: 'secondary', children: "\u2022" }, `${i + 0}-sep`)
@@ -1 +1 @@
1
- {"version":3,"file":"MetaList.js","sourceRoot":"","sources":["../../../src/components/MetaList/MetaList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAczD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CAAyB,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IAChF,OAAO,GAAG,CAAA;;;;MAIN,CAAC,SAAS;QACZ,GAAG,CAAA;;KAEF;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAyB,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IACpF,OAAO,GAAG,CAAA;;;;MAIN,SAAS;QACT,CAAC,CAAC,GAAG,CAAA;;SAEF;QACH,CAAC,CAAC,GAAG,CAAA;;;;SAIF;;;;;;GAMN,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoD,UAAU,CAAC,SAAS,QAAQ,CAC5F,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,SAAS,EAAkC,EACjF,GAAyB;IAEzB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAEvD,OAAO,CACL,KAAC,IAAI,mBACU,OAAO,CAAC,IAAI,KACrB,SAAS,EACb,EAAE,EAAE,cAAc,EAClB,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,EACrF,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,YAEP,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAC9B,IAAI;YACF,CAAC,CAAC;gBACE,KAAC,IAAI,IACH,EAAE,EAAE,kBAAkB,EAEtB,OAAO,EAAC,WAAW,EACnB,SAAS,EAAE,SAAS,YAEnB,IAAI,IAJA,GAAG,CAAC,GAAG,CAAC,EAAE,CAKV;aACR,CAAC,MAAM,CACN,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC;gBAClB,CAAC,CAAC;oBACE,KAAC,IAAI,IACH,EAAE,EAAE,kBAAkB,uBAGtB,OAAO,EAAC,WAAW,wBADd,GAAG,CAAC,GAAG,CAAC,MAAM,CAId;iBACR;gBACH,CAAC,CAAC,EAAE,CACP;YACH,CAAC,CAAC,EAAE,CACP,GACI,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FunctionComponent, ReactNode, Ref, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Text from '../Text';\nimport Flex from '../Flex';\nimport type { BaseProps, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport { useTestIds } from '../../hooks';\nimport { withTestIds } from '../../utils';\n\nimport { getMetaListTestIds } from './MetaList.test-ids';\n\nexport interface MetaListProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** Array of nodes or text to be rendered in the list. */\n items: ReactNode[];\n /**\n * If true, MetaList items that extend past the MetaList's container will wrap to a new line.\n * @default true\n */\n wrapItems?: boolean;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLUListElement>;\n}\n\nexport const StyledMetaList = styled.ul<{ wrapItems: boolean }>(({ wrapItems }) => {\n return css`\n list-style: none;\n overflow: hidden;\n\n ${!wrapItems &&\n css`\n white-space: nowrap;\n `}\n `;\n});\n\nexport const StyledMetaListItem = styled.li<{ wrapItems: boolean }>(({ wrapItems }) => {\n return css`\n min-width: 0;\n display: inline-block;\n\n ${wrapItems\n ? css`\n overflow-wrap: break-word;\n `\n : css`\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n `}\n\n &[role='separator'] {\n -webkit-user-select: none;\n user-select: none;\n }\n `;\n});\n\nconst MetaList: FunctionComponent<MetaListProps & ForwardProps> = forwardRef(function MetaList(\n { testId, items, wrapItems = true, ...restProps }: PropsWithoutRef<MetaListProps>,\n ref: MetaListProps['ref']\n) {\n const testIds = useTestIds(testId, getMetaListTestIds);\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n as={StyledMetaList}\n container={{ colGap: 0.5, alignItems: 'center', wrap: wrapItems ? 'wrap' : 'nowrap' }}\n wrapItems={wrapItems}\n ref={ref}\n >\n {items.flatMap((item, i, arr) =>\n item\n ? [\n <Text\n as={StyledMetaListItem}\n key={`${i + 0}`}\n variant='secondary'\n wrapItems={wrapItems}\n >\n {item}\n </Text>\n ].concat(\n i !== arr.length - 1\n ? [\n <Text\n as={StyledMetaListItem}\n aria-hidden\n key={`${i + 0}-sep`}\n variant='secondary'\n >\n •\n </Text>\n ]\n : []\n )\n : []\n )}\n </Flex>\n );\n});\n\nexport default withTestIds(MetaList, getMetaListTestIds);\n"]}
1
+ {"version":3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,CAAC,IAAI,KACrB,SAAS,EACb,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,EACrF,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,YAEP,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAC9B,IAAI;YACF,CAAC,CAAC;gBACE,KAAC,IAAI,IACH,EAAE,EAAE,kBAAkB,EAEtB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,SAAS,YAEnB,IAAI,IALA,GAAG,CAAC,GAAG,CAAC,EAAE,CAMV;aACR,CAAC,MAAM,CACN,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC;gBAClB,CAAC,CAAC;oBACE,KAAC,IAAI,IACH,EAAE,EAAE,kBAAkB,uBAGtB,OAAO,EAAC,WAAW,wBADd,GAAG,CAAC,GAAG,CAAC,MAAM,CAId;iBACR;gBACH,CAAC,CAAC,EAAE,CACP;YACH,CAAC,CAAC,EAAE,CACP,GACI,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FunctionComponent, ReactNode, Ref, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Text from '../Text';\nimport Flex from '../Flex';\nimport type { BaseProps, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport { useTestIds } from '../../hooks';\nimport { withTestIds } from '../../utils';\n\nimport { getMetaListTestIds } from './MetaList.test-ids';\n\nexport interface MetaListProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** Array of nodes or text to be rendered in the list. */\n items: ReactNode[];\n /**\n * If true, MetaList items that extend past the MetaList's container will wrap to a new line.\n * @default true\n */\n wrapItems?: boolean;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLUListElement>;\n}\n\nexport const StyledMetaList = styled.ul<{ wrapItems: boolean }>(({ wrapItems }) => {\n return css`\n list-style: none;\n overflow: hidden;\n\n ${!wrapItems &&\n css`\n white-space: nowrap;\n `}\n `;\n});\n\nexport const StyledMetaListItem = styled.li<{ wrapItems: boolean }>(({ wrapItems }) => {\n return css`\n min-width: 0;\n display: inline-block;\n\n ${wrapItems\n ? css`\n overflow-wrap: break-word;\n `\n : css`\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n `}\n\n &[role='separator'] {\n -webkit-user-select: none;\n user-select: none;\n }\n `;\n});\n\nconst MetaList: FunctionComponent<MetaListProps & ForwardProps> = forwardRef(function MetaList(\n { testId, items, wrapItems = true, ...restProps }: PropsWithoutRef<MetaListProps>,\n ref: MetaListProps['ref']\n) {\n const testIds = useTestIds(testId, getMetaListTestIds);\n const roleAttrValue = items.length <= 1 ? 'none' : undefined;\n\n return (\n <Flex\n data-testid={testIds.root}\n {...restProps}\n as={StyledMetaList}\n role={roleAttrValue}\n container={{ colGap: 0.5, alignItems: 'center', wrap: wrapItems ? 'wrap' : 'nowrap' }}\n wrapItems={wrapItems}\n ref={ref}\n >\n {items.flatMap((item, i, arr) =>\n item\n ? [\n <Text\n as={StyledMetaListItem}\n key={`${i + 0}`}\n variant='secondary'\n role={roleAttrValue}\n wrapItems={wrapItems}\n >\n {item}\n </Text>\n ].concat(\n i !== arr.length - 1\n ? [\n <Text\n as={StyledMetaListItem}\n aria-hidden\n key={`${i + 0}-sep`}\n variant='secondary'\n >\n •\n </Text>\n ]\n : []\n )\n : []\n )}\n </Flex>\n );\n});\n\nexport default withTestIds(MetaList, getMetaListTestIds);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-core",
3
- "version": "7.11.6",
3
+ "version": "7.11.8",
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
  "repository": {
6
6
  "type": "git",
@@ -58,6 +58,7 @@
58
58
  "@storybook/addon-actions": "~8.2.9",
59
59
  "@storybook/react": "~8.2.9",
60
60
  "@testing-library/react": "^12.1.3",
61
+ "@testing-library/react-hooks": "^8.0.1",
61
62
  "@testing-library/user-event": "^14.5.1",
62
63
  "typescript": "~5.2.2"
63
64
  }