@elliemae/ds-utilities 3.1.0-next.12 → 3.1.0-next.15
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/dist/cjs/props-helpers/propTypes/describe.js +0 -3
- package/dist/cjs/props-helpers/propTypes/describe.js.map +2 -2
- package/dist/cjs/props-helpers/propTypes/describeConversions.js +1 -1
- package/dist/cjs/props-helpers/propTypes/describeConversions.js.map +2 -2
- package/dist/esm/props-helpers/propTypes/describe.js +0 -3
- package/dist/esm/props-helpers/propTypes/describe.js.map +2 -2
- package/dist/esm/props-helpers/propTypes/describeConversions.js +1 -1
- package/dist/esm/props-helpers/propTypes/describeConversions.js.map +2 -2
- package/package.json +2 -2
|
@@ -59,9 +59,6 @@ function describe(ComponentInstance) {
|
|
|
59
59
|
let realPropType;
|
|
60
60
|
documentation.propTypes[name] = propType;
|
|
61
61
|
realPropType = (0, import_describeConversions.convertPropType)(propType);
|
|
62
|
-
if (value[name].reactDesc.required) {
|
|
63
|
-
realPropType = realPropType.isRequired;
|
|
64
|
-
}
|
|
65
62
|
DocumentedComponent.propTypesValue[name] = realPropType;
|
|
66
63
|
return propType;
|
|
67
64
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/props-helpers/propTypes/describe.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react/forbid-foreign-prop-types */\nimport { Requireable, Validator } from 'prop-types';\nimport React from 'react';\nimport { convertPropType } from './describeConversions';\nimport descToTypescript from './toTypescript';\nimport { ReactDescT, Hook, ComponentDocumentation, DocumentedReactComponent } from './types';\n\nexport default function describe<C, R>(ComponentInstance: React.ComponentType<C> | Hook<C, R>) {\n if (!ComponentInstance) {\n throw new Error('react-desc: component is required');\n }\n\n const documentation: ComponentDocumentation = {\n propTypes: {},\n };\n\n const DocumentedComponent = ComponentInstance as DocumentedReactComponent<C>;\n\n const addDocumentationProp = <T extends keyof ComponentDocumentation>(propName: T) => {\n const func = (value: ComponentDocumentation[T]): DocumentedReactComponent<C> => {\n documentation[propName] = value;\n return DocumentedComponent;\n };\n return func;\n };\n\n DocumentedComponent.availableAt = addDocumentationProp('availableAt');\n DocumentedComponent.description = addDocumentationProp('description');\n DocumentedComponent.details = addDocumentationProp('details');\n DocumentedComponent.deprecated = addDocumentationProp('deprecated');\n DocumentedComponent.usage = addDocumentationProp('usage');\n DocumentedComponent.intrinsicElement = addDocumentationProp('intrinsicElement');\n\n DocumentedComponent.toTypescript = () => descToTypescript(ComponentInstance, documentation);\n\n Object.defineProperty(DocumentedComponent, 'propTypes', {\n get: () => DocumentedComponent.propTypesValue,\n set: (value: Record<string, ReactDescT>) => {\n if (!DocumentedComponent.propTypesValue) {\n DocumentedComponent.propTypesValue = {};\n }\n\n Object.keys(value).forEach((name) => {\n const propType: ReactDescT = value[name];\n let realPropType: Requireable<unknown> | Validator<unknown>;\n documentation.propTypes[name] = propType;\n realPropType = convertPropType(propType);\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,iCAAgC;AAChC,0BAA6B;AAGd,kBAAwB,mBAAwD;AAC7F,MAAI,CAAC,mBAAmB;AACtB,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,QAAM,gBAAwC;AAAA,IAC5C,WAAW,CAAC;AAAA,EACd;AAEA,QAAM,sBAAsB;AAE5B,QAAM,uBAAuB,CAAyC,aAAgB;AACpF,UAAM,OAAO,CAAC,UAAkE;AAC9E,oBAAc,YAAY;AAC1B,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAEA,sBAAoB,cAAc,qBAAqB,aAAa;AACpE,sBAAoB,cAAc,qBAAqB,aAAa;AACpE,sBAAoB,UAAU,qBAAqB,SAAS;AAC5D,sBAAoB,aAAa,qBAAqB,YAAY;AAClE,sBAAoB,QAAQ,qBAAqB,OAAO;AACxD,sBAAoB,mBAAmB,qBAAqB,kBAAkB;AAE9E,sBAAoB,eAAe,MAAM,iCAAiB,mBAAmB,aAAa;AAE1F,SAAO,eAAe,qBAAqB,aAAa;AAAA,IACtD,KAAK,MAAM,oBAAoB;AAAA,IAC/B,KAAK,CAAC,UAAsC;AAC1C,UAAI,CAAC,oBAAoB,gBAAgB;AACvC,4BAAoB,iBAAiB,CAAC;AAAA,MACxC;AAEA,aAAO,KAAK,KAAK,EAAE,QAAQ,CAAC,SAAS;AACnC,cAAM,WAAuB,MAAM;AACnC,YAAI;AACJ,sBAAc,UAAU,QAAQ;AAChC,uBAAe,gDAAgB,QAAQ;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/forbid-foreign-prop-types */\nimport { Requireable, Validator } from 'prop-types';\nimport React from 'react';\nimport { convertPropType } from './describeConversions';\nimport descToTypescript from './toTypescript';\nimport { ReactDescT, Hook, ComponentDocumentation, DocumentedReactComponent } from './types';\n\nexport default function describe<C, R>(ComponentInstance: React.ComponentType<C> | Hook<C, R>) {\n if (!ComponentInstance) {\n throw new Error('react-desc: component is required');\n }\n\n const documentation: ComponentDocumentation = {\n propTypes: {},\n };\n\n const DocumentedComponent = ComponentInstance as DocumentedReactComponent<C>;\n\n const addDocumentationProp = <T extends keyof ComponentDocumentation>(propName: T) => {\n const func = (value: ComponentDocumentation[T]): DocumentedReactComponent<C> => {\n documentation[propName] = value;\n return DocumentedComponent;\n };\n return func;\n };\n\n DocumentedComponent.availableAt = addDocumentationProp('availableAt');\n DocumentedComponent.description = addDocumentationProp('description');\n DocumentedComponent.details = addDocumentationProp('details');\n DocumentedComponent.deprecated = addDocumentationProp('deprecated');\n DocumentedComponent.usage = addDocumentationProp('usage');\n DocumentedComponent.intrinsicElement = addDocumentationProp('intrinsicElement');\n\n DocumentedComponent.toTypescript = () => descToTypescript(ComponentInstance, documentation);\n\n Object.defineProperty(DocumentedComponent, 'propTypes', {\n get: () => DocumentedComponent.propTypesValue,\n set: (value: Record<string, ReactDescT>) => {\n if (!DocumentedComponent.propTypesValue) {\n DocumentedComponent.propTypesValue = {};\n }\n\n Object.keys(value).forEach((name) => {\n const propType: ReactDescT = value[name];\n let realPropType: Requireable<unknown> | Validator<unknown>;\n documentation.propTypes[name] = propType;\n realPropType = convertPropType(propType);\n // We don't need to rely on the isRequired from prop-types package\n // So no need to invoke (realPropType).isRequired if our own proptype is required\n // Validation will handle that case for us\n DocumentedComponent.propTypesValue[name] = realPropType as Validator<unknown>;\n return propType;\n });\n },\n enumerable: true,\n configurable: true,\n });\n\n return DocumentedComponent;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,iCAAgC;AAChC,0BAA6B;AAGd,kBAAwB,mBAAwD;AAC7F,MAAI,CAAC,mBAAmB;AACtB,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,QAAM,gBAAwC;AAAA,IAC5C,WAAW,CAAC;AAAA,EACd;AAEA,QAAM,sBAAsB;AAE5B,QAAM,uBAAuB,CAAyC,aAAgB;AACpF,UAAM,OAAO,CAAC,UAAkE;AAC9E,oBAAc,YAAY;AAC1B,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAEA,sBAAoB,cAAc,qBAAqB,aAAa;AACpE,sBAAoB,cAAc,qBAAqB,aAAa;AACpE,sBAAoB,UAAU,qBAAqB,SAAS;AAC5D,sBAAoB,aAAa,qBAAqB,YAAY;AAClE,sBAAoB,QAAQ,qBAAqB,OAAO;AACxD,sBAAoB,mBAAmB,qBAAqB,kBAAkB;AAE9E,sBAAoB,eAAe,MAAM,iCAAiB,mBAAmB,aAAa;AAE1F,SAAO,eAAe,qBAAqB,aAAa;AAAA,IACtD,KAAK,MAAM,oBAAoB;AAAA,IAC/B,KAAK,CAAC,UAAsC;AAC1C,UAAI,CAAC,oBAAoB,gBAAgB;AACvC,4BAAoB,iBAAiB,CAAC;AAAA,MACxC;AAEA,aAAO,KAAK,KAAK,EAAE,QAAQ,CAAC,SAAS;AACnC,cAAM,WAAuB,MAAM;AACnC,YAAI;AACJ,sBAAc,UAAU,QAAQ;AAChC,uBAAe,gDAAgB,QAAQ;AAIvC,4BAAoB,eAAe,QAAQ;AAC3C,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,7 +33,7 @@ const enrichPropType = (propType, reactDesc) => {
|
|
|
33
33
|
const { version = "", message = "" } = reactDesc.deprecated;
|
|
34
34
|
const error = `Warning: "${propName}" property of "${componentName}" will be deprecated in version: ${version}.
|
|
35
35
|
${message}`;
|
|
36
|
-
console.
|
|
36
|
+
console.warn(error);
|
|
37
37
|
reactDesc.warned = true;
|
|
38
38
|
}
|
|
39
39
|
return propType(props, propName, componentName, ...rest);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/props-helpers/propTypes/describeConversions.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-params */\n/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-use-before-define */\nimport PropTypes, { ValidationMap, Requireable } from 'prop-types';\nimport { tupleValidator } from './customPropTypes';\nimport {\n hasArguments,\n isArrayOf,\n isExact,\n isInstanceOf,\n isObjectOf,\n isOneOf,\n isOneOfType,\n isShape,\n} from './describeGuards';\nimport { ReactDescT, ReactDescObjT, InstanceOfT, OneOfT, ObjectOfT, ExactT } from './types';\n\nconst enrichPropType = (propType: Requireable<unknown>, reactDesc: ReactDescObjT): Requireable<unknown> => {\n const func = (props: Record<string, unknown>, propName: string, componentName: string, ...rest: [string, string]) => {\n if (reactDesc && reactDesc.deprecated && propName in props && !reactDesc.warned) {\n const { version = '', message = '' } = reactDesc.deprecated;\n const error = `Warning: \"${propName}\" property of \"${componentName}\" will be deprecated in version: ${version}.\\n${message}`;\n console.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,wBAAsD;AACtD,6BAA+B;AAC/B,4BASO;AAGP,MAAM,iBAAiB,CAAC,UAAgC,cAAmD;AACzG,QAAM,OAAO,CAAC,OAAgC,UAAkB,kBAA0B,SAA2B;AACnH,QAAI,aAAa,UAAU,cAAc,YAAY,SAAS,CAAC,UAAU,QAAQ;AAC/E,YAAM,EAAE,UAAU,IAAI,UAAU,OAAO,UAAU;AACjD,YAAM,QAAQ,aAAa,0BAA0B,iDAAiD;AAAA,EAAa;AACnH,cAAQ,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-params */\n/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-use-before-define */\nimport PropTypes, { ValidationMap, Requireable } from 'prop-types';\nimport { tupleValidator } from './customPropTypes';\nimport {\n hasArguments,\n isArrayOf,\n isExact,\n isInstanceOf,\n isObjectOf,\n isOneOf,\n isOneOfType,\n isShape,\n} from './describeGuards';\nimport { ReactDescT, ReactDescObjT, InstanceOfT, OneOfT, ObjectOfT, ExactT } from './types';\n\nconst enrichPropType = (propType: Requireable<unknown>, reactDesc: ReactDescObjT): Requireable<unknown> => {\n const func = (props: Record<string, unknown>, propName: string, componentName: string, ...rest: [string, string]) => {\n if (reactDesc && reactDesc.deprecated && propName in props && !reactDesc.warned) {\n const { version = '', message = '' } = reactDesc.deprecated;\n const error = `Warning: \"${propName}\" property of \"${componentName}\" will be deprecated in version: ${version}.\\n${message}`;\n console.warn(error);\n reactDesc.warned = true;\n }\n return propType(props, propName, componentName, ...rest);\n };\n Object.defineProperty(\n func,\n 'isRequired',\n Object.getOwnPropertyDescriptor(propType, 'isRequired') as PropertyDescriptor,\n );\n return func as Requireable<unknown>;\n};\n\nconst convertArray = (array: ReactDescT[]): Requireable<unknown>[] => array.map((type) => convertPropType(type));\n\nconst convertShape = (_shape: Record<string, ReactDescT>): ValidationMap<Record<string, unknown>> => {\n const result: ValidationMap<Record<string, unknown>> = {};\n Object.keys(_shape).forEach((key) => {\n result[key] = convertPropType(_shape[key]);\n });\n return result;\n};\n\nexport const convertPropType = (propType: ReactDescT): Requireable<unknown> => {\n if (!propType || !propType.type) {\n throw new Error(`react-desc: unknown error -- proptype is not well defined`);\n }\n\n // DimSum PropTypes conversion\n if (propType.type === 'tuple') {\n return enrichPropType(\n PropTypes.arrayOf(tupleValidator(convertArray(propType.args as ReactDescT[]))),\n propType.reactDesc,\n );\n }\n\n // Default PropType conversion\n const realPropType = PropTypes[propType.type];\n\n if (!realPropType) {\n throw new Error(`react-desc: unknown type ${propType.type}`);\n }\n\n if (hasArguments(propType, realPropType)) {\n if (isOneOfType(propType, realPropType)) {\n return enrichPropType(realPropType(convertArray(propType.args as ReactDescT[])), propType.reactDesc);\n }\n if (isArrayOf(propType, realPropType)) {\n return enrichPropType(realPropType(convertPropType(propType.args as ReactDescT)), propType.reactDesc);\n }\n if (isShape(propType, realPropType)) {\n return enrichPropType(\n realPropType(convertShape(propType.args as Record<string, ReactDescT>)),\n propType.reactDesc,\n );\n }\n if (isInstanceOf(propType, realPropType)) {\n return enrichPropType(realPropType(propType.args as Parameters<InstanceOfT>[0]), propType.reactDesc);\n }\n if (isOneOf(propType, realPropType)) {\n return enrichPropType(realPropType(propType.args as Parameters<OneOfT>[0]), propType.reactDesc);\n }\n if (isObjectOf(propType, realPropType)) {\n return enrichPropType(realPropType(propType.args as Parameters<ObjectOfT>[0]), propType.reactDesc);\n }\n if (isExact(propType, realPropType)) {\n return enrichPropType(realPropType(propType.args as Parameters<ExactT>[0]), propType.reactDesc);\n }\n throw new Error(`react-desc: unknown error -- proptype with args is not matching`);\n }\n\n return enrichPropType(realPropType, propType.reactDesc);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,wBAAsD;AACtD,6BAA+B;AAC/B,4BASO;AAGP,MAAM,iBAAiB,CAAC,UAAgC,cAAmD;AACzG,QAAM,OAAO,CAAC,OAAgC,UAAkB,kBAA0B,SAA2B;AACnH,QAAI,aAAa,UAAU,cAAc,YAAY,SAAS,CAAC,UAAU,QAAQ;AAC/E,YAAM,EAAE,UAAU,IAAI,UAAU,OAAO,UAAU;AACjD,YAAM,QAAQ,aAAa,0BAA0B,iDAAiD;AAAA,EAAa;AACnH,cAAQ,KAAK,KAAK;AAClB,gBAAU,SAAS;AAAA,IACrB;AACA,WAAO,SAAS,OAAO,UAAU,eAAe,GAAG,IAAI;AAAA,EACzD;AACA,SAAO,eACL,MACA,cACA,OAAO,yBAAyB,UAAU,YAAY,CACxD;AACA,SAAO;AACT;AAEA,MAAM,eAAe,CAAC,UAAgD,MAAM,IAAI,CAAC,SAAS,gBAAgB,IAAI,CAAC;AAE/G,MAAM,eAAe,CAAC,WAA+E;AACnG,QAAM,SAAiD,CAAC;AACxD,SAAO,KAAK,MAAM,EAAE,QAAQ,CAAC,QAAQ;AACnC,WAAO,OAAO,gBAAgB,OAAO,IAAI;AAAA,EAC3C,CAAC;AACD,SAAO;AACT;AAEO,MAAM,kBAAkB,CAAC,aAA+C;AAC7E,MAAI,CAAC,YAAY,CAAC,SAAS,MAAM;AAC/B,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AAGA,MAAI,SAAS,SAAS,SAAS;AAC7B,WAAO,eACL,0BAAU,QAAQ,2CAAe,aAAa,SAAS,IAAoB,CAAC,CAAC,GAC7E,SAAS,SACX;AAAA,EACF;AAGA,QAAM,eAAe,0BAAU,SAAS;AAExC,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI,MAAM,4BAA4B,SAAS,MAAM;AAAA,EAC7D;AAEA,MAAI,wCAAa,UAAU,YAAY,GAAG;AACxC,QAAI,uCAAY,UAAU,YAAY,GAAG;AACvC,aAAO,eAAe,aAAa,aAAa,SAAS,IAAoB,CAAC,GAAG,SAAS,SAAS;AAAA,IACrG;AACA,QAAI,qCAAU,UAAU,YAAY,GAAG;AACrC,aAAO,eAAe,aAAa,gBAAgB,SAAS,IAAkB,CAAC,GAAG,SAAS,SAAS;AAAA,IACtG;AACA,QAAI,mCAAQ,UAAU,YAAY,GAAG;AACnC,aAAO,eACL,aAAa,aAAa,SAAS,IAAkC,CAAC,GACtE,SAAS,SACX;AAAA,IACF;AACA,QAAI,wCAAa,UAAU,YAAY,GAAG;AACxC,aAAO,eAAe,aAAa,SAAS,IAAkC,GAAG,SAAS,SAAS;AAAA,IACrG;AACA,QAAI,mCAAQ,UAAU,YAAY,GAAG;AACnC,aAAO,eAAe,aAAa,SAAS,IAA6B,GAAG,SAAS,SAAS;AAAA,IAChG;AACA,QAAI,sCAAW,UAAU,YAAY,GAAG;AACtC,aAAO,eAAe,aAAa,SAAS,IAAgC,GAAG,SAAS,SAAS;AAAA,IACnG;AACA,QAAI,mCAAQ,UAAU,YAAY,GAAG;AACnC,aAAO,eAAe,aAAa,SAAS,IAA6B,GAAG,SAAS,SAAS;AAAA,IAChG;AACA,UAAM,IAAI,MAAM,iEAAiE;AAAA,EACnF;AAEA,SAAO,eAAe,cAAc,SAAS,SAAS;AACxD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,9 +34,6 @@ function describe(ComponentInstance) {
|
|
|
34
34
|
let realPropType;
|
|
35
35
|
documentation.propTypes[name] = propType;
|
|
36
36
|
realPropType = convertPropType(propType);
|
|
37
|
-
if (value[name].reactDesc.required) {
|
|
38
|
-
realPropType = realPropType.isRequired;
|
|
39
|
-
}
|
|
40
37
|
DocumentedComponent.propTypesValue[name] = realPropType;
|
|
41
38
|
return propType;
|
|
42
39
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/propTypes/describe.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/forbid-foreign-prop-types */\nimport { Requireable, Validator } from 'prop-types';\nimport React from 'react';\nimport { convertPropType } from './describeConversions';\nimport descToTypescript from './toTypescript';\nimport { ReactDescT, Hook, ComponentDocumentation, DocumentedReactComponent } from './types';\n\nexport default function describe<C, R>(ComponentInstance: React.ComponentType<C> | Hook<C, R>) {\n if (!ComponentInstance) {\n throw new Error('react-desc: component is required');\n }\n\n const documentation: ComponentDocumentation = {\n propTypes: {},\n };\n\n const DocumentedComponent = ComponentInstance as DocumentedReactComponent<C>;\n\n const addDocumentationProp = <T extends keyof ComponentDocumentation>(propName: T) => {\n const func = (value: ComponentDocumentation[T]): DocumentedReactComponent<C> => {\n documentation[propName] = value;\n return DocumentedComponent;\n };\n return func;\n };\n\n DocumentedComponent.availableAt = addDocumentationProp('availableAt');\n DocumentedComponent.description = addDocumentationProp('description');\n DocumentedComponent.details = addDocumentationProp('details');\n DocumentedComponent.deprecated = addDocumentationProp('deprecated');\n DocumentedComponent.usage = addDocumentationProp('usage');\n DocumentedComponent.intrinsicElement = addDocumentationProp('intrinsicElement');\n\n DocumentedComponent.toTypescript = () => descToTypescript(ComponentInstance, documentation);\n\n Object.defineProperty(DocumentedComponent, 'propTypes', {\n get: () => DocumentedComponent.propTypesValue,\n set: (value: Record<string, ReactDescT>) => {\n if (!DocumentedComponent.propTypesValue) {\n DocumentedComponent.propTypesValue = {};\n }\n\n Object.keys(value).forEach((name) => {\n const propType: ReactDescT = value[name];\n let realPropType: Requireable<unknown> | Validator<unknown>;\n documentation.propTypes[name] = propType;\n realPropType = convertPropType(propType);\n
|
|
5
|
-
"mappings": "AAAA;ACGA;AACA;AAGe,kBAAwB,mBAAwD;AAC7F,MAAI,CAAC,mBAAmB;AACtB,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,QAAM,gBAAwC;AAAA,IAC5C,WAAW,CAAC;AAAA,EACd;AAEA,QAAM,sBAAsB;AAE5B,QAAM,uBAAuB,CAAyC,aAAgB;AACpF,UAAM,OAAO,CAAC,UAAkE;AAC9E,oBAAc,YAAY;AAC1B,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAEA,sBAAoB,cAAc,qBAAqB,aAAa;AACpE,sBAAoB,cAAc,qBAAqB,aAAa;AACpE,sBAAoB,UAAU,qBAAqB,SAAS;AAC5D,sBAAoB,aAAa,qBAAqB,YAAY;AAClE,sBAAoB,QAAQ,qBAAqB,OAAO;AACxD,sBAAoB,mBAAmB,qBAAqB,kBAAkB;AAE9E,sBAAoB,eAAe,MAAM,iBAAiB,mBAAmB,aAAa;AAE1F,SAAO,eAAe,qBAAqB,aAAa;AAAA,IACtD,KAAK,MAAM,oBAAoB;AAAA,IAC/B,KAAK,CAAC,UAAsC;AAC1C,UAAI,CAAC,oBAAoB,gBAAgB;AACvC,4BAAoB,iBAAiB,CAAC;AAAA,MACxC;AAEA,aAAO,KAAK,KAAK,EAAE,QAAQ,CAAC,SAAS;AACnC,cAAM,WAAuB,MAAM;AACnC,YAAI;AACJ,sBAAc,UAAU,QAAQ;AAChC,uBAAe,gBAAgB,QAAQ;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/forbid-foreign-prop-types */\nimport { Requireable, Validator } from 'prop-types';\nimport React from 'react';\nimport { convertPropType } from './describeConversions';\nimport descToTypescript from './toTypescript';\nimport { ReactDescT, Hook, ComponentDocumentation, DocumentedReactComponent } from './types';\n\nexport default function describe<C, R>(ComponentInstance: React.ComponentType<C> | Hook<C, R>) {\n if (!ComponentInstance) {\n throw new Error('react-desc: component is required');\n }\n\n const documentation: ComponentDocumentation = {\n propTypes: {},\n };\n\n const DocumentedComponent = ComponentInstance as DocumentedReactComponent<C>;\n\n const addDocumentationProp = <T extends keyof ComponentDocumentation>(propName: T) => {\n const func = (value: ComponentDocumentation[T]): DocumentedReactComponent<C> => {\n documentation[propName] = value;\n return DocumentedComponent;\n };\n return func;\n };\n\n DocumentedComponent.availableAt = addDocumentationProp('availableAt');\n DocumentedComponent.description = addDocumentationProp('description');\n DocumentedComponent.details = addDocumentationProp('details');\n DocumentedComponent.deprecated = addDocumentationProp('deprecated');\n DocumentedComponent.usage = addDocumentationProp('usage');\n DocumentedComponent.intrinsicElement = addDocumentationProp('intrinsicElement');\n\n DocumentedComponent.toTypescript = () => descToTypescript(ComponentInstance, documentation);\n\n Object.defineProperty(DocumentedComponent, 'propTypes', {\n get: () => DocumentedComponent.propTypesValue,\n set: (value: Record<string, ReactDescT>) => {\n if (!DocumentedComponent.propTypesValue) {\n DocumentedComponent.propTypesValue = {};\n }\n\n Object.keys(value).forEach((name) => {\n const propType: ReactDescT = value[name];\n let realPropType: Requireable<unknown> | Validator<unknown>;\n documentation.propTypes[name] = propType;\n realPropType = convertPropType(propType);\n // We don't need to rely on the isRequired from prop-types package\n // So no need to invoke (realPropType).isRequired if our own proptype is required\n // Validation will handle that case for us\n DocumentedComponent.propTypesValue[name] = realPropType as Validator<unknown>;\n return propType;\n });\n },\n enumerable: true,\n configurable: true,\n });\n\n return DocumentedComponent;\n}\n"],
|
|
5
|
+
"mappings": "AAAA;ACGA;AACA;AAGe,kBAAwB,mBAAwD;AAC7F,MAAI,CAAC,mBAAmB;AACtB,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,QAAM,gBAAwC;AAAA,IAC5C,WAAW,CAAC;AAAA,EACd;AAEA,QAAM,sBAAsB;AAE5B,QAAM,uBAAuB,CAAyC,aAAgB;AACpF,UAAM,OAAO,CAAC,UAAkE;AAC9E,oBAAc,YAAY;AAC1B,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAEA,sBAAoB,cAAc,qBAAqB,aAAa;AACpE,sBAAoB,cAAc,qBAAqB,aAAa;AACpE,sBAAoB,UAAU,qBAAqB,SAAS;AAC5D,sBAAoB,aAAa,qBAAqB,YAAY;AAClE,sBAAoB,QAAQ,qBAAqB,OAAO;AACxD,sBAAoB,mBAAmB,qBAAqB,kBAAkB;AAE9E,sBAAoB,eAAe,MAAM,iBAAiB,mBAAmB,aAAa;AAE1F,SAAO,eAAe,qBAAqB,aAAa;AAAA,IACtD,KAAK,MAAM,oBAAoB;AAAA,IAC/B,KAAK,CAAC,UAAsC;AAC1C,UAAI,CAAC,oBAAoB,gBAAgB;AACvC,4BAAoB,iBAAiB,CAAC;AAAA,MACxC;AAEA,aAAO,KAAK,KAAK,EAAE,QAAQ,CAAC,SAAS;AACnC,cAAM,WAAuB,MAAM;AACnC,YAAI;AACJ,sBAAc,UAAU,QAAQ;AAChC,uBAAe,gBAAgB,QAAQ;AAIvC,4BAAoB,eAAe,QAAQ;AAC3C,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -17,7 +17,7 @@ const enrichPropType = (propType, reactDesc) => {
|
|
|
17
17
|
const { version = "", message = "" } = reactDesc.deprecated;
|
|
18
18
|
const error = `Warning: "${propName}" property of "${componentName}" will be deprecated in version: ${version}.
|
|
19
19
|
${message}`;
|
|
20
|
-
console.
|
|
20
|
+
console.warn(error);
|
|
21
21
|
reactDesc.warned = true;
|
|
22
22
|
}
|
|
23
23
|
return propType(props, propName, componentName, ...rest);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/props-helpers/propTypes/describeConversions.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-params */\n/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-use-before-define */\nimport PropTypes, { ValidationMap, Requireable } from 'prop-types';\nimport { tupleValidator } from './customPropTypes';\nimport {\n hasArguments,\n isArrayOf,\n isExact,\n isInstanceOf,\n isObjectOf,\n isOneOf,\n isOneOfType,\n isShape,\n} from './describeGuards';\nimport { ReactDescT, ReactDescObjT, InstanceOfT, OneOfT, ObjectOfT, ExactT } from './types';\n\nconst enrichPropType = (propType: Requireable<unknown>, reactDesc: ReactDescObjT): Requireable<unknown> => {\n const func = (props: Record<string, unknown>, propName: string, componentName: string, ...rest: [string, string]) => {\n if (reactDesc && reactDesc.deprecated && propName in props && !reactDesc.warned) {\n const { version = '', message = '' } = reactDesc.deprecated;\n const error = `Warning: \"${propName}\" property of \"${componentName}\" will be deprecated in version: ${version}.\\n${message}`;\n console.
|
|
5
|
-
"mappings": "AAAA;ACKA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,MAAM,iBAAiB,CAAC,UAAgC,cAAmD;AACzG,QAAM,OAAO,CAAC,OAAgC,UAAkB,kBAA0B,SAA2B;AACnH,QAAI,aAAa,UAAU,cAAc,YAAY,SAAS,CAAC,UAAU,QAAQ;AAC/E,YAAM,EAAE,UAAU,IAAI,UAAU,OAAO,UAAU;AACjD,YAAM,QAAQ,aAAa,0BAA0B,iDAAiD;AAAA,EAAa;AACnH,cAAQ,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-params */\n/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-use-before-define */\nimport PropTypes, { ValidationMap, Requireable } from 'prop-types';\nimport { tupleValidator } from './customPropTypes';\nimport {\n hasArguments,\n isArrayOf,\n isExact,\n isInstanceOf,\n isObjectOf,\n isOneOf,\n isOneOfType,\n isShape,\n} from './describeGuards';\nimport { ReactDescT, ReactDescObjT, InstanceOfT, OneOfT, ObjectOfT, ExactT } from './types';\n\nconst enrichPropType = (propType: Requireable<unknown>, reactDesc: ReactDescObjT): Requireable<unknown> => {\n const func = (props: Record<string, unknown>, propName: string, componentName: string, ...rest: [string, string]) => {\n if (reactDesc && reactDesc.deprecated && propName in props && !reactDesc.warned) {\n const { version = '', message = '' } = reactDesc.deprecated;\n const error = `Warning: \"${propName}\" property of \"${componentName}\" will be deprecated in version: ${version}.\\n${message}`;\n console.warn(error);\n reactDesc.warned = true;\n }\n return propType(props, propName, componentName, ...rest);\n };\n Object.defineProperty(\n func,\n 'isRequired',\n Object.getOwnPropertyDescriptor(propType, 'isRequired') as PropertyDescriptor,\n );\n return func as Requireable<unknown>;\n};\n\nconst convertArray = (array: ReactDescT[]): Requireable<unknown>[] => array.map((type) => convertPropType(type));\n\nconst convertShape = (_shape: Record<string, ReactDescT>): ValidationMap<Record<string, unknown>> => {\n const result: ValidationMap<Record<string, unknown>> = {};\n Object.keys(_shape).forEach((key) => {\n result[key] = convertPropType(_shape[key]);\n });\n return result;\n};\n\nexport const convertPropType = (propType: ReactDescT): Requireable<unknown> => {\n if (!propType || !propType.type) {\n throw new Error(`react-desc: unknown error -- proptype is not well defined`);\n }\n\n // DimSum PropTypes conversion\n if (propType.type === 'tuple') {\n return enrichPropType(\n PropTypes.arrayOf(tupleValidator(convertArray(propType.args as ReactDescT[]))),\n propType.reactDesc,\n );\n }\n\n // Default PropType conversion\n const realPropType = PropTypes[propType.type];\n\n if (!realPropType) {\n throw new Error(`react-desc: unknown type ${propType.type}`);\n }\n\n if (hasArguments(propType, realPropType)) {\n if (isOneOfType(propType, realPropType)) {\n return enrichPropType(realPropType(convertArray(propType.args as ReactDescT[])), propType.reactDesc);\n }\n if (isArrayOf(propType, realPropType)) {\n return enrichPropType(realPropType(convertPropType(propType.args as ReactDescT)), propType.reactDesc);\n }\n if (isShape(propType, realPropType)) {\n return enrichPropType(\n realPropType(convertShape(propType.args as Record<string, ReactDescT>)),\n propType.reactDesc,\n );\n }\n if (isInstanceOf(propType, realPropType)) {\n return enrichPropType(realPropType(propType.args as Parameters<InstanceOfT>[0]), propType.reactDesc);\n }\n if (isOneOf(propType, realPropType)) {\n return enrichPropType(realPropType(propType.args as Parameters<OneOfT>[0]), propType.reactDesc);\n }\n if (isObjectOf(propType, realPropType)) {\n return enrichPropType(realPropType(propType.args as Parameters<ObjectOfT>[0]), propType.reactDesc);\n }\n if (isExact(propType, realPropType)) {\n return enrichPropType(realPropType(propType.args as Parameters<ExactT>[0]), propType.reactDesc);\n }\n throw new Error(`react-desc: unknown error -- proptype with args is not matching`);\n }\n\n return enrichPropType(realPropType, propType.reactDesc);\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACKA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,MAAM,iBAAiB,CAAC,UAAgC,cAAmD;AACzG,QAAM,OAAO,CAAC,OAAgC,UAAkB,kBAA0B,SAA2B;AACnH,QAAI,aAAa,UAAU,cAAc,YAAY,SAAS,CAAC,UAAU,QAAQ;AAC/E,YAAM,EAAE,UAAU,IAAI,UAAU,OAAO,UAAU;AACjD,YAAM,QAAQ,aAAa,0BAA0B,iDAAiD;AAAA,EAAa;AACnH,cAAQ,KAAK,KAAK;AAClB,gBAAU,SAAS;AAAA,IACrB;AACA,WAAO,SAAS,OAAO,UAAU,eAAe,GAAG,IAAI;AAAA,EACzD;AACA,SAAO,eACL,MACA,cACA,OAAO,yBAAyB,UAAU,YAAY,CACxD;AACA,SAAO;AACT;AAEA,MAAM,eAAe,CAAC,UAAgD,MAAM,IAAI,CAAC,SAAS,gBAAgB,IAAI,CAAC;AAE/G,MAAM,eAAe,CAAC,WAA+E;AACnG,QAAM,SAAiD,CAAC;AACxD,SAAO,KAAK,MAAM,EAAE,QAAQ,CAAC,QAAQ;AACnC,WAAO,OAAO,gBAAgB,OAAO,IAAI;AAAA,EAC3C,CAAC;AACD,SAAO;AACT;AAEO,MAAM,kBAAkB,CAAC,aAA+C;AAC7E,MAAI,CAAC,YAAY,CAAC,SAAS,MAAM;AAC/B,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AAGA,MAAI,SAAS,SAAS,SAAS;AAC7B,WAAO,eACL,UAAU,QAAQ,eAAe,aAAa,SAAS,IAAoB,CAAC,CAAC,GAC7E,SAAS,SACX;AAAA,EACF;AAGA,QAAM,eAAe,UAAU,SAAS;AAExC,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI,MAAM,4BAA4B,SAAS,MAAM;AAAA,EAC7D;AAEA,MAAI,aAAa,UAAU,YAAY,GAAG;AACxC,QAAI,YAAY,UAAU,YAAY,GAAG;AACvC,aAAO,eAAe,aAAa,aAAa,SAAS,IAAoB,CAAC,GAAG,SAAS,SAAS;AAAA,IACrG;AACA,QAAI,UAAU,UAAU,YAAY,GAAG;AACrC,aAAO,eAAe,aAAa,gBAAgB,SAAS,IAAkB,CAAC,GAAG,SAAS,SAAS;AAAA,IACtG;AACA,QAAI,QAAQ,UAAU,YAAY,GAAG;AACnC,aAAO,eACL,aAAa,aAAa,SAAS,IAAkC,CAAC,GACtE,SAAS,SACX;AAAA,IACF;AACA,QAAI,aAAa,UAAU,YAAY,GAAG;AACxC,aAAO,eAAe,aAAa,SAAS,IAAkC,GAAG,SAAS,SAAS;AAAA,IACrG;AACA,QAAI,QAAQ,UAAU,YAAY,GAAG;AACnC,aAAO,eAAe,aAAa,SAAS,IAA6B,GAAG,SAAS,SAAS;AAAA,IAChG;AACA,QAAI,WAAW,UAAU,YAAY,GAAG;AACtC,aAAO,eAAe,aAAa,SAAS,IAAgC,GAAG,SAAS,SAAS;AAAA,IACnG;AACA,QAAI,QAAQ,UAAU,YAAY,GAAG;AACnC,aAAO,eAAe,aAAa,SAAS,IAA6B,GAAG,SAAS,SAAS;AAAA,IAChG;AACA,UAAM,IAAI,MAAM,iEAAiE;AAAA,EACnF;AAEA,SAAO,eAAe,cAAc,SAAS,SAAS;AACxD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-utilities",
|
|
3
|
-
"version": "3.1.0-next.
|
|
3
|
+
"version": "3.1.0-next.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Utilities",
|
|
6
6
|
"files": [
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"typeSafety": true
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|
|
154
|
-
"@elliemae/ds-system": "3.1.0-next.
|
|
154
|
+
"@elliemae/ds-system": "3.1.0-next.15",
|
|
155
155
|
"@elliemae/pui-theme": "~2.6.0",
|
|
156
156
|
"fast-deep-equal": "~3.1.3",
|
|
157
157
|
"hotkeys-js": "~3.8.7",
|