@pega/cosmos-react-build 9.0.0-build.5.4 → 9.0.0-build.5.5
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.
|
@@ -2,7 +2,7 @@ import type { ComboBoxProps, CurrencyInputProps, DateInputProps, DateTimeInputPr
|
|
|
2
2
|
export type FormControlPropsToOmit = keyof Pick<FormControlProps, 'label' | 'labelHidden' | 'additionalInfo' | 'info' | 'required' | 'status' | 'readOnly' | 'disabled'>;
|
|
3
3
|
type ConstantTextConfig = {
|
|
4
4
|
format: 'Text';
|
|
5
|
-
props: OmitStrict<InputProps, FormControlPropsToOmit> & {
|
|
5
|
+
props: OmitStrict<InputProps, FormControlPropsToOmit | 'onChange'> & {
|
|
6
6
|
onChange: (value: string | undefined) => void;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstantControl.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACf,MAAM,yBAAyB,CAAC;AAIjC,MAAM,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAC7C,gBAAgB,EACd,OAAO,GACP,aAAa,GACb,gBAAgB,GAChB,MAAM,GACN,UAAU,GACV,QAAQ,GACR,UAAU,GACV,UAAU,CACb,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,sBAAsB,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"ConstantControl.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,aAA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,mBAAmB,CAAC;AAExB,QAAA,MAAM,eAAe,GAAI,kEAMtB,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,qBAAqB,uBA2GxB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstantControl.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,yBAAyB,CAAC;AAejC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAkG9C,MAAM,eAAe,GAAG,CAAC,EACvB,MAAM,EACN,KAAK,EACL,QAAQ,EACR,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,QAAQ,EAGW,EAAE,EAAE;IAC3B,IAAI,OAAO,GAAuB,IAAI,CAAC;IAEvC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,qDAAqD;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACrD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,CACR,KAAC,KAAK,OACA,KAAK,iBACI,MAAM,EACnB,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,CAAC,CAAgC,EAAE,EAAE;oBAC7C,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACjC,CAAC,EACD,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,KAAK,kBAAkB,EAAE,CAAC;YAClC,OAAO,GAAG,CACR,KAAC,QAAQ,OACH,KAAK,iBACI,MAAM,EACnB,EAAE,EAAE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,CAAC;IACH,CAAC;IAED,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,GAAG,KAAC,cAAc,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;IACjG,CAAC;IAED,qDAAqD;IACrD,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,YAAY,IAAI;QACrB,KAAK,KAAK,SAAS,EACnB,CAAC;QACD,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;YAC1B,OAAO,GAAG,KAAC,aAAa,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAChG,CAAC;QAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,KAAC,SAAS,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAC5F,CAAC;QAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,KAAC,SAAS,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAC5F,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import type { ChangeEvent } from 'react';\n\nimport {\n CurrencyInput,\n DateInput,\n DateTimeInput,\n Input,\n NumberInput,\n PhoneInput,\n TextArea,\n TimeInput\n} from '@pega/cosmos-react-core';\nimport type {\n ComboBoxProps,\n CurrencyInputProps,\n DateInputProps,\n DateTimeInputProps,\n FormControlProps,\n InputProps,\n NumberInputProps,\n OmitStrict,\n PhoneInputProps,\n TextAreaProps,\n TimeInputProps\n} from '@pega/cosmos-react-core';\n\nimport BooleanControl from './BooleanControl';\n\nexport type FormControlPropsToOmit = keyof Pick<\n FormControlProps,\n | 'label'\n | 'labelHidden'\n | 'additionalInfo'\n | 'info'\n | 'required'\n | 'status'\n | 'readOnly'\n | 'disabled'\n>;\n\ntype ConstantTextConfig = {\n format: 'Text';\n props: OmitStrict<InputProps, FormControlPropsToOmit> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDecimalConfig = {\n format: 'Decimal';\n props: OmitStrict<NumberInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantIntegerConfig = {\n format: 'Integer';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'showDecimal'\n >;\n};\n\ntype ConstantPercentageConfig = {\n format: 'Percentage';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'numberOfDecimals' | 'unit'\n >;\n};\n\ntype ConstantTextAreaConfig = {\n format: 'Text (paragraph)';\n props: OmitStrict<TextAreaProps, FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDateConfig = {\n format: 'Date';\n props: OmitStrict<DateInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantDateTimeConfig = {\n format: 'DateTime';\n props: OmitStrict<DateTimeInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantTimeConfig = {\n format: 'Time';\n props: OmitStrict<TimeInputProps, FormControlPropsToOmit>;\n};\n\nexport type BooleanLabels = 'true|false' | 'always|never';\n\nexport type ConstantBooleanConfig = {\n format: 'Boolean';\n props: OmitStrict<ComboBoxProps, FormControlPropsToOmit | 'value' | 'onChange'> & {\n value?: boolean;\n onChange: (value: boolean) => void;\n booleanLabels?: BooleanLabels;\n };\n};\n\ntype ConstantCurrencyConfig = {\n format: 'Currency';\n props: OmitStrict<CurrencyInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantPhoneConfig = {\n format: 'Phone';\n props: OmitStrict<PhoneInputProps, FormControlPropsToOmit | 'showCountryCode'>;\n};\n\nexport type ConstantControlConfig =\n | ConstantTextConfig\n | ConstantDecimalConfig\n | ConstantIntegerConfig\n | ConstantPercentageConfig\n | ConstantTextAreaConfig\n | ConstantDateConfig\n | ConstantDateTimeConfig\n | ConstantTimeConfig\n | ConstantBooleanConfig\n | ConstantCurrencyConfig\n | ConstantPhoneConfig;\n\nconst ConstantControl = ({\n format,\n props,\n required,\n 'data-testid': testId,\n id: inputUid\n}: Pick<FormControlProps, 'id' | 'required'> & {\n 'data-testid'?: string;\n} & ConstantControlConfig) => {\n let control: JSX.Element | null = null;\n\n const { value } = props;\n // Note: This is just a typeguard for the value prop.\n if (typeof value === 'string' || value === undefined) {\n if (format === 'Text') {\n control = (\n <Input\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Text (paragraph)') {\n control = (\n <TextArea\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Currency') {\n control = <CurrencyInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Percentage') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n numberOfDecimals={undefined}\n unit='percent'\n required={required}\n />\n );\n }\n\n if (format === 'Integer') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.\n showDecimal={false}\n required={required}\n />\n );\n }\n\n if (format === 'Decimal') {\n control = <NumberInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Phone') {\n control = (\n <PhoneInput\n {...props}\n data-testid={testId}\n id={inputUid}\n required={required}\n showCountryCode\n />\n );\n }\n }\n\n if (format === 'Boolean') {\n control = <BooleanControl {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n // Note: This is just a typeguard for the value prop.\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value instanceof Date ||\n value === undefined\n ) {\n if (format === 'DateTime') {\n control = <DateTimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Date') {\n control = <DateInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Time') {\n control = <TimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n }\n return control;\n};\n\nexport default ConstantControl;\n"]}
|
|
1
|
+
{"version":3,"file":"ConstantControl.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,KAAK,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,yBAAyB,CAAC;AAejC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAkG9C,MAAM,eAAe,GAAG,CAAC,EACvB,MAAM,EACN,KAAK,EACL,QAAQ,EACR,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,QAAQ,EAGW,EAAE,EAAE;IAC3B,IAAI,OAAO,GAAuB,IAAI,CAAC;IAEvC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,qDAAqD;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACrD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,CACR,KAAC,KAAK,OACA,KAAK,iBACI,MAAM,EACnB,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,CAAC,CAAgC,EAAE,EAAE;oBAC7C,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACjC,CAAC,EACD,QAAQ,EAAE,QAAQ,GAClB,CACH,CA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AAO,GAAG,CACR,KAAC,UAAU,OACL,KAAK,iBACI,MAAM,EACnB,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,QAAQ,EAClB,eAAe,SACf,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,GAAG,KAAC,cAAc,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;IACjG,CAAC;IAED,qDAAqD;IACrD,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,YAAY,IAAI;QACrB,KAAK,KAAK,SAAS,EACnB,CAAC;QACD,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;YAC1B,OAAO,GAAG,KAAC,aAAa,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAChG,CAAC;QAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,KAAC,SAAS,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAC5F,CAAC;QAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,KAAC,SAAS,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAC5F,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import type { ChangeEvent } from 'react';\n\nimport {\n CurrencyInput,\n DateInput,\n DateTimeInput,\n Input,\n NumberInput,\n PhoneInput,\n TextArea,\n TimeInput\n} from '@pega/cosmos-react-core';\nimport type {\n ComboBoxProps,\n CurrencyInputProps,\n DateInputProps,\n DateTimeInputProps,\n FormControlProps,\n InputProps,\n NumberInputProps,\n OmitStrict,\n PhoneInputProps,\n TextAreaProps,\n TimeInputProps\n} from '@pega/cosmos-react-core';\n\nimport BooleanControl from './BooleanControl';\n\nexport type FormControlPropsToOmit = keyof Pick<\n FormControlProps,\n | 'label'\n | 'labelHidden'\n | 'additionalInfo'\n | 'info'\n | 'required'\n | 'status'\n | 'readOnly'\n | 'disabled'\n>;\n\ntype ConstantTextConfig = {\n format: 'Text';\n props: OmitStrict<InputProps, FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDecimalConfig = {\n format: 'Decimal';\n props: OmitStrict<NumberInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantIntegerConfig = {\n format: 'Integer';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'showDecimal'\n >;\n};\n\ntype ConstantPercentageConfig = {\n format: 'Percentage';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'numberOfDecimals' | 'unit'\n >;\n};\n\ntype ConstantTextAreaConfig = {\n format: 'Text (paragraph)';\n props: OmitStrict<TextAreaProps, FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDateConfig = {\n format: 'Date';\n props: OmitStrict<DateInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantDateTimeConfig = {\n format: 'DateTime';\n props: OmitStrict<DateTimeInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantTimeConfig = {\n format: 'Time';\n props: OmitStrict<TimeInputProps, FormControlPropsToOmit>;\n};\n\nexport type BooleanLabels = 'true|false' | 'always|never';\n\nexport type ConstantBooleanConfig = {\n format: 'Boolean';\n props: OmitStrict<ComboBoxProps, FormControlPropsToOmit | 'value' | 'onChange'> & {\n value?: boolean;\n onChange: (value: boolean) => void;\n booleanLabels?: BooleanLabels;\n };\n};\n\ntype ConstantCurrencyConfig = {\n format: 'Currency';\n props: OmitStrict<CurrencyInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantPhoneConfig = {\n format: 'Phone';\n props: OmitStrict<PhoneInputProps, FormControlPropsToOmit | 'showCountryCode'>;\n};\n\nexport type ConstantControlConfig =\n | ConstantTextConfig\n | ConstantDecimalConfig\n | ConstantIntegerConfig\n | ConstantPercentageConfig\n | ConstantTextAreaConfig\n | ConstantDateConfig\n | ConstantDateTimeConfig\n | ConstantTimeConfig\n | ConstantBooleanConfig\n | ConstantCurrencyConfig\n | ConstantPhoneConfig;\n\nconst ConstantControl = ({\n format,\n props,\n required,\n 'data-testid': testId,\n id: inputUid\n}: Pick<FormControlProps, 'id' | 'required'> & {\n 'data-testid'?: string;\n} & ConstantControlConfig) => {\n let control: JSX.Element | null = null;\n\n const { value } = props;\n // Note: This is just a typeguard for the value prop.\n if (typeof value === 'string' || value === undefined) {\n if (format === 'Text') {\n control = (\n <Input\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Text (paragraph)') {\n control = (\n <TextArea\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Currency') {\n control = <CurrencyInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Percentage') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n numberOfDecimals={undefined}\n unit='percent'\n required={required}\n />\n );\n }\n\n if (format === 'Integer') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.\n showDecimal={false}\n required={required}\n />\n );\n }\n\n if (format === 'Decimal') {\n control = <NumberInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Phone') {\n control = (\n <PhoneInput\n {...props}\n data-testid={testId}\n id={inputUid}\n required={required}\n showCountryCode\n />\n );\n }\n }\n\n if (format === 'Boolean') {\n control = <BooleanControl {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n // Note: This is just a typeguard for the value prop.\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value instanceof Date ||\n value === undefined\n ) {\n if (format === 'DateTime') {\n control = <DateTimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Date') {\n control = <DateInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Time') {\n control = <TimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n }\n return control;\n};\n\nexport default ConstantControl;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-build",
|
|
3
|
-
"version": "9.0.0-build.5.
|
|
3
|
+
"version": "9.0.0-build.5.5",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-core": "9.0.0-build.5.
|
|
18
|
-
"@pega/cosmos-react-dnd": "9.0.0-build.5.
|
|
19
|
-
"@pega/cosmos-react-rte": "9.0.0-build.5.
|
|
17
|
+
"@pega/cosmos-react-core": "9.0.0-build.5.5",
|
|
18
|
+
"@pega/cosmos-react-dnd": "9.0.0-build.5.5",
|
|
19
|
+
"@pega/cosmos-react-rte": "9.0.0-build.5.5",
|
|
20
20
|
"@types/codemirror": "^5.60.15",
|
|
21
21
|
"@types/dagre": "^0.7.46",
|
|
22
22
|
"@types/react": "^17.0.62 || ^18.3.3",
|