@elliemae/ds-props-helpers 2.3.2 → 2.4.0-rc.1
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/cjs/index.js +2 -0
- package/cjs/propTypes/PropTypes.js +1 -1
- package/cjs/propTypes/describeConversions.js +2 -2
- package/cjs/useDeprecateComponent/index.js +18 -0
- package/esm/index.js +1 -0
- package/esm/propTypes/PropTypes.js +1 -1
- package/esm/propTypes/describeConversions.js +2 -2
- package/esm/useDeprecateComponent/index.js +14 -0
- package/package.json +9 -1
- package/types/index.d.ts +1 -0
- package/types/propTypes/describe.d.ts +2 -2
- package/types/propTypes/toTypescript.d.ts +2 -2
- package/types/propTypes/types.d.ts +4 -0
- package/types/tests/xstyledProps/TestComponent.d.ts +1 -0
- package/types/tests/xstyledProps/xstyledProps.test.d.ts +1 -0
- package/types/useDeprecateComponent/index.d.ts +6 -0
- package/types/xstyledProps/useGetXstyledProps.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var errorTemplates = require('./validation/errorTemplates.js');
|
|
|
13
13
|
var typescriptValidator = require('./validation/typescriptValidator.js');
|
|
14
14
|
var useGetXstyledProps = require('./xstyledProps/useGetXstyledProps.js');
|
|
15
15
|
var xstyledPropTypes = require('./xstyledProps/xstyledPropTypes.js');
|
|
16
|
+
var index$1 = require('./useDeprecateComponent/index.js');
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
|
|
@@ -30,3 +31,4 @@ exports.useValidateTypescriptPropTypes = typescriptValidator.useValidateTypescri
|
|
|
30
31
|
exports.validateTypescriptPropTypesImplementation = typescriptValidator.validateTypescriptPropTypesImplementation;
|
|
31
32
|
exports.useGetXstyledProps = useGetXstyledProps.useGetXstyledProps;
|
|
32
33
|
exports.xstyledPropTypes = xstyledPropTypes.xstyledPropTypes;
|
|
34
|
+
exports.useDeprecateComponent = index$1.useDeprecateComponent;
|
|
@@ -33,7 +33,7 @@ const documentedPropType = {
|
|
|
33
33
|
format: addPropTypeDocumentationField('format'),
|
|
34
34
|
global: addPropTypeDocumentationField('global'),
|
|
35
35
|
hidden: addPropTypeDocumentationField('hidden'),
|
|
36
|
-
xstyled: addPropTypeDocumentationField('
|
|
36
|
+
xstyled: addPropTypeDocumentationField('xstyled')
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
const createPropType = type => {
|
|
@@ -23,8 +23,8 @@ const enrichPropType = (propType, reactDesc) => {
|
|
|
23
23
|
version = '',
|
|
24
24
|
message = ''
|
|
25
25
|
} = reactDesc.deprecated;
|
|
26
|
-
const
|
|
27
|
-
console.
|
|
26
|
+
const error = "Warning: \"".concat(propName, "\" property of \"").concat(componentName, "\" will be deprecated in version: ").concat(version, ".\n").concat(message);
|
|
27
|
+
console.error(error);
|
|
28
28
|
reactDesc.warned = true;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('react');
|
|
6
|
+
|
|
7
|
+
/* eslint-disable no-console */
|
|
8
|
+
const useDeprecateComponent = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
componentName,
|
|
11
|
+
version
|
|
12
|
+
} = _ref;
|
|
13
|
+
react.useEffect(() => {
|
|
14
|
+
console.error("Warning: ".concat(componentName, ":: this component will be deprecated in version: ").concat(version, "."));
|
|
15
|
+
}, [componentName, version]);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.useDeprecateComponent = useDeprecateComponent;
|
package/esm/index.js
CHANGED
|
@@ -9,3 +9,4 @@ export { throwRequiredError, throwTypeError } from './validation/errorTemplates.
|
|
|
9
9
|
export { useValidateTypescriptPropTypes, validateTypescriptPropTypesImplementation } from './validation/typescriptValidator.js';
|
|
10
10
|
export { useGetXstyledProps } from './xstyledProps/useGetXstyledProps.js';
|
|
11
11
|
export { xstyledPropTypes } from './xstyledProps/xstyledPropTypes.js';
|
|
12
|
+
export { useDeprecateComponent } from './useDeprecateComponent/index.js';
|
|
@@ -27,7 +27,7 @@ const documentedPropType = {
|
|
|
27
27
|
format: addPropTypeDocumentationField('format'),
|
|
28
28
|
global: addPropTypeDocumentationField('global'),
|
|
29
29
|
hidden: addPropTypeDocumentationField('hidden'),
|
|
30
|
-
xstyled: addPropTypeDocumentationField('
|
|
30
|
+
xstyled: addPropTypeDocumentationField('xstyled')
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const createPropType = type => {
|
|
@@ -15,8 +15,8 @@ const enrichPropType = (propType, reactDesc) => {
|
|
|
15
15
|
version = '',
|
|
16
16
|
message = ''
|
|
17
17
|
} = reactDesc.deprecated;
|
|
18
|
-
const
|
|
19
|
-
console.
|
|
18
|
+
const error = "Warning: \"".concat(propName, "\" property of \"").concat(componentName, "\" will be deprecated in version: ").concat(version, ".\n").concat(message);
|
|
19
|
+
console.error(error);
|
|
20
20
|
reactDesc.warned = true;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
const useDeprecateComponent = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
componentName,
|
|
7
|
+
version
|
|
8
|
+
} = _ref;
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
console.error("Warning: ".concat(componentName, ":: this component will be deprecated in version: ").concat(version, "."));
|
|
11
|
+
}, [componentName, version]);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { useDeprecateComponent };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-props-helpers",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Props Helpers",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -51,6 +51,14 @@
|
|
|
51
51
|
"import": "./esm/validation/errorTemplates.js",
|
|
52
52
|
"require": "./cjs/validation/errorTemplates.js"
|
|
53
53
|
},
|
|
54
|
+
"./useDeprecateComponent": {
|
|
55
|
+
"import": "./esm/useDeprecateComponent/index.js",
|
|
56
|
+
"require": "./cjs/useDeprecateComponent/index.js"
|
|
57
|
+
},
|
|
58
|
+
"./tests/xstyledProps/TestComponent": {
|
|
59
|
+
"import": "./esm/tests/xstyledProps/TestComponent.js",
|
|
60
|
+
"require": "./cjs/tests/xstyledProps/TestComponent.js"
|
|
61
|
+
},
|
|
54
62
|
"./tests/validation/test.schema": {
|
|
55
63
|
"import": "./esm/tests/validation/test.schema.js",
|
|
56
64
|
"require": "./cjs/tests/validation/test.schema.js"
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DocumentedReactComponent } from './types';
|
|
3
|
-
export default function describe<C>(ComponentInstance: React.ComponentType<C>): DocumentedReactComponent<C>;
|
|
2
|
+
import { Hook, DocumentedReactComponent } from './types';
|
|
3
|
+
export default function describe<C, R>(ComponentInstance: React.ComponentType<C> | Hook<C, R>): DocumentedReactComponent<C>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ComponentDocumentation, TypescriptDocumentation } from './types';
|
|
3
|
-
export default function descToTypescript<C>(component: React.ComponentType<C>, reactDesc: ComponentDocumentation): TypescriptDocumentation;
|
|
2
|
+
import { ComponentDocumentation, Hook, TypescriptDocumentation } from './types';
|
|
3
|
+
export default function descToTypescript<C, R>(component: React.ComponentType<C> | Hook<C, R>, reactDesc: ComponentDocumentation): TypescriptDocumentation;
|
|
@@ -75,6 +75,10 @@ export declare type DocumentedReactComponent<T> = React.ComponentType<T> & {
|
|
|
75
75
|
toTypescript: unknown;
|
|
76
76
|
propTypesValue: ValidationMap<Record<string, unknown>>;
|
|
77
77
|
};
|
|
78
|
+
export declare type Hook<T = unknown, S = unknown> = ((props: T) => S) & {
|
|
79
|
+
displayName?: string;
|
|
80
|
+
name?: string;
|
|
81
|
+
};
|
|
78
82
|
export declare type DocumentedPropType = ReactDescT;
|
|
79
83
|
export declare type PropTypesObj = {
|
|
80
84
|
any: DocumentedPropType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function TestComponent(props: any): JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SizingProps, SpaceProps, LayoutProps } from '@xstyled/styled-components';
|
|
2
|
-
declare type XstyledProps = SpaceProps & SizingProps & LayoutProps;
|
|
2
|
+
export declare type XstyledProps = SpaceProps & SizingProps & LayoutProps;
|
|
3
3
|
declare type PropsWithXstyled<T> = T & XstyledProps;
|
|
4
4
|
export declare const useGetXstyledProps: <T>(props: PropsWithXstyled<T>) => XstyledProps;
|
|
5
5
|
export {};
|