@elliemae/ds-legacy-props-helpers 1.0.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/dist/cjs/defaultProps/index.js +36 -0
- package/dist/cjs/defaultProps/index.js.map +7 -0
- package/dist/cjs/defaultProps/useMemoMergePropsWithDefault.js +49 -0
- package/dist/cjs/defaultProps/useMemoMergePropsWithDefault.js.map +7 -0
- package/dist/cjs/getProps/index.js +42 -0
- package/dist/cjs/getProps/index.js.map +7 -0
- package/dist/cjs/globalProps/constants.js +401 -0
- package/dist/cjs/globalProps/constants.js.map +7 -0
- package/dist/cjs/globalProps/getGlobalAttributes.js +53 -0
- package/dist/cjs/globalProps/getGlobalAttributes.js.map +7 -0
- package/dist/cjs/globalProps/globalAttributesPropTypes.js +408 -0
- package/dist/cjs/globalProps/globalAttributesPropTypes.js.map +7 -0
- package/dist/cjs/globalProps/index.js +40 -0
- package/dist/cjs/globalProps/index.js.map +7 -0
- package/dist/cjs/globalProps/useGetGlobalAttributes.js +44 -0
- package/dist/cjs/globalProps/useGetGlobalAttributes.js.map +7 -0
- package/dist/cjs/index.js +59 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +4 -0
- package/dist/cjs/propTypes/PropTypes.js +142 -0
- package/dist/cjs/propTypes/PropTypes.js.map +7 -0
- package/dist/cjs/propTypes/customPropTypes.js +39 -0
- package/dist/cjs/propTypes/customPropTypes.js.map +7 -0
- package/dist/cjs/propTypes/describe.js +79 -0
- package/dist/cjs/propTypes/describe.js.map +7 -0
- package/dist/cjs/propTypes/describeConversions.js +107 -0
- package/dist/cjs/propTypes/describeConversions.js.map +7 -0
- package/dist/cjs/propTypes/describeGuards.js +50 -0
- package/dist/cjs/propTypes/describeGuards.js.map +7 -0
- package/dist/cjs/propTypes/index.js +38 -0
- package/dist/cjs/propTypes/index.js.map +7 -0
- package/dist/cjs/propTypes/toTypescript.js +151 -0
- package/dist/cjs/propTypes/toTypescript.js.map +7 -0
- package/dist/cjs/propTypes/types.js +28 -0
- package/dist/cjs/propTypes/types.js.map +7 -0
- package/dist/cjs/propsPerDataTestId/getPropsPerDatatestIdPropTypes.js +66 -0
- package/dist/cjs/propsPerDataTestId/getPropsPerDatatestIdPropTypes.js.map +7 -0
- package/dist/cjs/propsPerDataTestId/getPropsPerDatatestid.js +45 -0
- package/dist/cjs/propsPerDataTestId/getPropsPerDatatestid.js.map +7 -0
- package/dist/cjs/propsPerDataTestId/index.js +38 -0
- package/dist/cjs/propsPerDataTestId/index.js.map +7 -0
- package/dist/cjs/tests/globalProps/TestComponent.js +42 -0
- package/dist/cjs/tests/globalProps/TestComponent.js.map +7 -0
- package/dist/cjs/tests/validation/test.schema.js +72 -0
- package/dist/cjs/tests/validation/test.schema.js.map +7 -0
- package/dist/cjs/tests/xstyledProps/TestComponent.js +43 -0
- package/dist/cjs/tests/xstyledProps/TestComponent.js.map +7 -0
- package/dist/cjs/useDeprecateComponent/index.js +42 -0
- package/dist/cjs/useDeprecateComponent/index.js.map +7 -0
- package/dist/cjs/validation/errorTemplates.js +53 -0
- package/dist/cjs/validation/errorTemplates.js.map +7 -0
- package/dist/cjs/validation/index.js +40 -0
- package/dist/cjs/validation/index.js.map +7 -0
- package/dist/cjs/validation/typescriptGuards.js +86 -0
- package/dist/cjs/validation/typescriptGuards.js.map +7 -0
- package/dist/cjs/validation/typescriptParsers.js +77 -0
- package/dist/cjs/validation/typescriptParsers.js.map +7 -0
- package/dist/cjs/validation/typescriptValidator.js +220 -0
- package/dist/cjs/validation/typescriptValidator.js.map +7 -0
- package/dist/cjs/xstyledProps/constants.js +132 -0
- package/dist/cjs/xstyledProps/constants.js.map +7 -0
- package/dist/cjs/xstyledProps/index.js +38 -0
- package/dist/cjs/xstyledProps/index.js.map +7 -0
- package/dist/cjs/xstyledProps/useGetXstyledProps.js +49 -0
- package/dist/cjs/xstyledProps/useGetXstyledProps.js.map +7 -0
- package/dist/cjs/xstyledProps/xstyledPropTypes.js +127 -0
- package/dist/cjs/xstyledProps/xstyledPropTypes.js.map +7 -0
- package/dist/esm/defaultProps/index.js +6 -0
- package/dist/esm/defaultProps/index.js.map +7 -0
- package/dist/esm/defaultProps/useMemoMergePropsWithDefault.js +19 -0
- package/dist/esm/defaultProps/useMemoMergePropsWithDefault.js.map +7 -0
- package/dist/esm/getProps/index.js +12 -0
- package/dist/esm/getProps/index.js.map +7 -0
- package/dist/esm/globalProps/constants.js +371 -0
- package/dist/esm/globalProps/constants.js.map +7 -0
- package/dist/esm/globalProps/getGlobalAttributes.js +23 -0
- package/dist/esm/globalProps/getGlobalAttributes.js.map +7 -0
- package/dist/esm/globalProps/globalAttributesPropTypes.js +378 -0
- package/dist/esm/globalProps/globalAttributesPropTypes.js.map +7 -0
- package/dist/esm/globalProps/index.js +10 -0
- package/dist/esm/globalProps/index.js.map +7 -0
- package/dist/esm/globalProps/useGetGlobalAttributes.js +14 -0
- package/dist/esm/globalProps/useGetGlobalAttributes.js.map +7 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +4 -0
- package/dist/esm/propTypes/PropTypes.js +112 -0
- package/dist/esm/propTypes/PropTypes.js.map +7 -0
- package/dist/esm/propTypes/customPropTypes.js +9 -0
- package/dist/esm/propTypes/customPropTypes.js.map +7 -0
- package/dist/esm/propTypes/describe.js +49 -0
- package/dist/esm/propTypes/describe.js.map +7 -0
- package/dist/esm/propTypes/describeConversions.js +86 -0
- package/dist/esm/propTypes/describeConversions.js.map +7 -0
- package/dist/esm/propTypes/describeGuards.js +20 -0
- package/dist/esm/propTypes/describeGuards.js.map +7 -0
- package/dist/esm/propTypes/index.js +8 -0
- package/dist/esm/propTypes/index.js.map +7 -0
- package/dist/esm/propTypes/toTypescript.js +121 -0
- package/dist/esm/propTypes/toTypescript.js.map +7 -0
- package/dist/esm/propTypes/types.js +2 -0
- package/dist/esm/propTypes/types.js.map +7 -0
- package/dist/esm/propsPerDataTestId/getPropsPerDatatestIdPropTypes.js +36 -0
- package/dist/esm/propsPerDataTestId/getPropsPerDatatestIdPropTypes.js.map +7 -0
- package/dist/esm/propsPerDataTestId/getPropsPerDatatestid.js +15 -0
- package/dist/esm/propsPerDataTestId/getPropsPerDatatestid.js.map +7 -0
- package/dist/esm/propsPerDataTestId/index.js +8 -0
- package/dist/esm/propsPerDataTestId/index.js.map +7 -0
- package/dist/esm/tests/globalProps/TestComponent.js +12 -0
- package/dist/esm/tests/globalProps/TestComponent.js.map +7 -0
- package/dist/esm/tests/validation/test.schema.js +42 -0
- package/dist/esm/tests/validation/test.schema.js.map +7 -0
- package/dist/esm/tests/xstyledProps/TestComponent.js +13 -0
- package/dist/esm/tests/xstyledProps/TestComponent.js.map +7 -0
- package/dist/esm/useDeprecateComponent/index.js +12 -0
- package/dist/esm/useDeprecateComponent/index.js.map +7 -0
- package/dist/esm/validation/errorTemplates.js +23 -0
- package/dist/esm/validation/errorTemplates.js.map +7 -0
- package/dist/esm/validation/index.js +10 -0
- package/dist/esm/validation/index.js.map +7 -0
- package/dist/esm/validation/typescriptGuards.js +56 -0
- package/dist/esm/validation/typescriptGuards.js.map +7 -0
- package/dist/esm/validation/typescriptParsers.js +47 -0
- package/dist/esm/validation/typescriptParsers.js.map +7 -0
- package/dist/esm/validation/typescriptValidator.js +202 -0
- package/dist/esm/validation/typescriptValidator.js.map +7 -0
- package/dist/esm/xstyledProps/constants.js +102 -0
- package/dist/esm/xstyledProps/constants.js.map +7 -0
- package/dist/esm/xstyledProps/index.js +8 -0
- package/dist/esm/xstyledProps/index.js.map +7 -0
- package/dist/esm/xstyledProps/useGetXstyledProps.js +19 -0
- package/dist/esm/xstyledProps/useGetXstyledProps.js.map +7 -0
- package/dist/esm/xstyledProps/xstyledPropTypes.js +97 -0
- package/dist/esm/xstyledProps/xstyledPropTypes.js.map +7 -0
- package/dist/types/defaultProps/index.d.ts +1 -0
- package/dist/types/defaultProps/useMemoMergePropsWithDefault.d.ts +1 -0
- package/dist/types/getProps/index.d.ts +3 -0
- package/dist/types/globalProps/constants.d.ts +3 -0
- package/dist/types/globalProps/getGlobalAttributes.d.ts +6 -0
- package/dist/types/globalProps/globalAttributesPropTypes.d.ts +372 -0
- package/dist/types/globalProps/index.d.ts +3 -0
- package/dist/types/globalProps/useGetGlobalAttributes.d.ts +3 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/propTypes/PropTypes.d.ts +3 -0
- package/dist/types/propTypes/customPropTypes.d.ts +2 -0
- package/dist/types/propTypes/describe.d.ts +3 -0
- package/dist/types/propTypes/describeConversions.d.ts +3 -0
- package/dist/types/propTypes/describeGuards.d.ts +9 -0
- package/dist/types/propTypes/index.d.ts +4 -0
- package/dist/types/propTypes/toTypescript.d.ts +3 -0
- package/dist/types/propTypes/types.d.ts +118 -0
- package/dist/types/propsPerDataTestId/getPropsPerDatatestIdPropTypes.d.ts +39 -0
- package/dist/types/propsPerDataTestId/getPropsPerDatatestid.d.ts +43 -0
- package/dist/types/propsPerDataTestId/index.d.ts +2 -0
- package/dist/types/tests/globalProps/TestComponent.d.ts +1 -0
- package/dist/types/tests/globalProps/globalAttributes.test.d.ts +1 -0
- package/dist/types/tests/propsPerDataTestId/getPropsPerDatatestIdPropTypes.test.d.ts +1 -0
- package/dist/types/tests/propsPerDataTestId/getPropsPerDatatestid.test.d.ts +1 -0
- package/dist/types/tests/validation/any.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/array.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/boolean.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/function.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/isRequiredIf.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/number.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/object.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/objectOf.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/schema.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/string.validation.test.d.ts +1 -0
- package/dist/types/tests/validation/test.schema.d.ts +1 -0
- package/dist/types/tests/validation/union.validation.test.d.ts +1 -0
- package/dist/types/tests/xstyledProps/TestComponent.d.ts +1 -0
- package/dist/types/tests/xstyledProps/xstyledProps.test.d.ts +1 -0
- package/dist/types/useDeprecateComponent/index.d.ts +6 -0
- package/dist/types/validation/errorTemplates.d.ts +2 -0
- package/dist/types/validation/index.d.ts +2 -0
- package/dist/types/validation/typescriptGuards.d.ts +13 -0
- package/dist/types/validation/typescriptParsers.d.ts +1 -0
- package/dist/types/validation/typescriptValidator.d.ts +4 -0
- package/dist/types/xstyledProps/constants.d.ts +7 -0
- package/dist/types/xstyledProps/index.d.ts +2 -0
- package/dist/types/xstyledProps/useGetXstyledProps.d.ts +6 -0
- package/dist/types/xstyledProps/xstyledPropTypes.d.ts +84 -0
- package/package.json +64 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var toTypescript_exports = {};
|
|
30
|
+
__export(toTypescript_exports, {
|
|
31
|
+
default: () => descToTypescript
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(toTypescript_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
const arrayFormat = (array) => array.map((propType) => propTypeFormat(propType));
|
|
36
|
+
const shapeFormat = (shape) => {
|
|
37
|
+
const props = Object.keys(shape).map((key) => {
|
|
38
|
+
const value = shape[key];
|
|
39
|
+
let valueFormat;
|
|
40
|
+
if (value.type && (value.type === "arrayOf" || value.type === "oneOfType" || value.type === "oneOf") && Array.isArray(value.args)) {
|
|
41
|
+
valueFormat = `${propTypeFormat(value)}`;
|
|
42
|
+
} else if (value.type === "shape") {
|
|
43
|
+
valueFormat = `${propTypeFormat(value)}`;
|
|
44
|
+
} else {
|
|
45
|
+
valueFormat = propTypeFormat(value);
|
|
46
|
+
}
|
|
47
|
+
return `${key}${value.reactDesc && value.reactDesc.required ? "" : "?"}: ${valueFormat}`;
|
|
48
|
+
});
|
|
49
|
+
return `{${props.join(",")}}`;
|
|
50
|
+
};
|
|
51
|
+
const propTypeFormat = (propType, joinWith = "") => {
|
|
52
|
+
let result;
|
|
53
|
+
if (Array.isArray(propType)) {
|
|
54
|
+
result = arrayFormat(propType).join(joinWith);
|
|
55
|
+
} else if (typeof propType !== "function" && propType.type) {
|
|
56
|
+
switch (propType.type) {
|
|
57
|
+
case "array":
|
|
58
|
+
result = "any[]";
|
|
59
|
+
break;
|
|
60
|
+
case "arrayOf":
|
|
61
|
+
if (propType.args.type === "oneOfType") {
|
|
62
|
+
result = `(${propTypeFormat(propType.args, " | ")})[]`;
|
|
63
|
+
} else {
|
|
64
|
+
result = `${propTypeFormat(propType.args, "\n")}[]`;
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
case "tuple":
|
|
68
|
+
result = `[${propTypeFormat(propType.args, ", ")}]`;
|
|
69
|
+
break;
|
|
70
|
+
case "bool":
|
|
71
|
+
result = "boolean";
|
|
72
|
+
break;
|
|
73
|
+
case "func":
|
|
74
|
+
result = propType?.reactDesc?.signature ?? "((...args: any[]) => any)";
|
|
75
|
+
break;
|
|
76
|
+
case "node":
|
|
77
|
+
result = "React.ReactNode";
|
|
78
|
+
break;
|
|
79
|
+
case "element":
|
|
80
|
+
result = "JSX.Element";
|
|
81
|
+
break;
|
|
82
|
+
case "instanceOf":
|
|
83
|
+
result = "any";
|
|
84
|
+
break;
|
|
85
|
+
case "symbol":
|
|
86
|
+
result = "any";
|
|
87
|
+
break;
|
|
88
|
+
case "objectOf":
|
|
89
|
+
result = `{ [key: string]: ${propTypeFormat(propType.args)} }`;
|
|
90
|
+
break;
|
|
91
|
+
case "oneOf":
|
|
92
|
+
result = propType.args.map((a) => `"${a}"`).join(" | ");
|
|
93
|
+
break;
|
|
94
|
+
case "oneOfType":
|
|
95
|
+
result = `${propTypeFormat(propType.args, " | ")}`;
|
|
96
|
+
break;
|
|
97
|
+
case "shape":
|
|
98
|
+
result = `${shapeFormat(propType.args)}`;
|
|
99
|
+
break;
|
|
100
|
+
default:
|
|
101
|
+
result = `${propType.type}`;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
result = "any";
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
};
|
|
109
|
+
const propTypeAsTypescript = (propType, propName) => {
|
|
110
|
+
const documentation = {
|
|
111
|
+
...propType.reactDesc,
|
|
112
|
+
name: propName
|
|
113
|
+
};
|
|
114
|
+
documentation.format = propTypeFormat(propType);
|
|
115
|
+
return documentation;
|
|
116
|
+
};
|
|
117
|
+
function descToTypescript(component, reactDesc) {
|
|
118
|
+
if (!component) {
|
|
119
|
+
throw new Error("react-desc: component is required");
|
|
120
|
+
}
|
|
121
|
+
const documentation = {
|
|
122
|
+
name: component.displayName || component.name,
|
|
123
|
+
...reactDesc
|
|
124
|
+
};
|
|
125
|
+
if (reactDesc) {
|
|
126
|
+
delete documentation.propTypes;
|
|
127
|
+
if (reactDesc.propTypes) {
|
|
128
|
+
const propTypes = [];
|
|
129
|
+
Object.keys(reactDesc.propTypes).forEach((propName) => {
|
|
130
|
+
const propType = reactDesc.propTypes[propName];
|
|
131
|
+
if (propType.type === "shape") {
|
|
132
|
+
propType.reactDesc.group = {};
|
|
133
|
+
Object.keys(propType.args).forEach((prop) => {
|
|
134
|
+
if (!propType.reactDesc.group)
|
|
135
|
+
return;
|
|
136
|
+
propType.reactDesc.group[prop] = propTypeAsTypescript(
|
|
137
|
+
propType.args[prop],
|
|
138
|
+
prop
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
propTypes.push(propTypeAsTypescript(propType, propName));
|
|
143
|
+
});
|
|
144
|
+
if (propTypes.length > 0) {
|
|
145
|
+
documentation.properties = propTypes;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return documentation;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=toTypescript.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/propTypes/toTypescript.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/restrict-template-expressions */\n/* eslint-disable @typescript-eslint/no-use-before-define */\n/* eslint-disable complexity */\n/* eslint-disable react/forbid-foreign-prop-types */\nimport type React from 'react';\nimport type { ComponentDocumentation, Hook, ReactDescT, TypescriptDocumentation } from './types.js';\n\nconst arrayFormat = (array: ReactDescT[]) => array.map((propType) => propTypeFormat(propType));\n\nconst shapeFormat = (shape: Record<string, ReactDescT>) => {\n const props = Object.keys(shape).map((key) => {\n const value = shape[key];\n let valueFormat;\n if (\n value.type &&\n (value.type === 'arrayOf' || value.type === 'oneOfType' || value.type === 'oneOf') &&\n Array.isArray(value.args)\n ) {\n valueFormat = `${propTypeFormat(value)}`;\n } else if (value.type === 'shape') {\n valueFormat = `${propTypeFormat(value)}`;\n } else {\n valueFormat = propTypeFormat(value);\n }\n return `${key}${value.reactDesc && value.reactDesc.required ? '' : '?'}: ${valueFormat}`;\n });\n return `{${props.join(',')}}`;\n};\n\nconst propTypeFormat = (propType: ReactDescT | ReactDescT[], joinWith = ''): string => {\n let result;\n if (Array.isArray(propType)) {\n result = arrayFormat(propType).join(joinWith);\n } else if (typeof propType !== 'function' && propType.type) {\n switch (propType.type) {\n case 'array':\n result = 'any[]';\n break;\n case 'arrayOf':\n if ((propType.args as ReactDescT).type === 'oneOfType') {\n result = `(${propTypeFormat(propType.args as ReactDescT, ' | ')})[]`;\n } else {\n result = `${propTypeFormat(propType.args as ReactDescT, '\\n')}[]`;\n }\n break;\n case 'tuple':\n result = `[${propTypeFormat(propType.args as ReactDescT, ', ')}]`;\n break;\n case 'bool':\n result = 'boolean';\n break;\n case 'func':\n result = propType?.reactDesc?.signature ?? '((...args: any[]) => any)';\n break;\n case 'node':\n result = 'React.ReactNode';\n break;\n case 'element':\n result = 'JSX.Element';\n break;\n case 'instanceOf':\n result = 'any';\n break;\n case 'symbol':\n result = 'any';\n break;\n case 'objectOf':\n result = `{ [key: string]: ${propTypeFormat(propType.args as ReactDescT)} }`;\n break;\n case 'oneOf':\n result = (propType.args as unknown[]).map((a) => `\"${a}\"`).join(' | ');\n break;\n case 'oneOfType':\n result = `${propTypeFormat(propType.args as ReactDescT[], ' | ')}`;\n break;\n case 'shape':\n result = `${shapeFormat(propType.args as Record<string, ReactDescT>)}`;\n break;\n default:\n result = `${propType.type}`;\n break;\n }\n } else {\n result = 'any';\n }\n return result;\n};\n\nconst propTypeAsTypescript = (propType: ReactDescT, propName: string) => {\n const documentation = {\n ...propType.reactDesc,\n name: propName,\n };\n\n documentation.format = propTypeFormat(propType);\n\n return documentation;\n};\n\nexport default function descToTypescript<C, R>(\n component: React.ComponentType<C> | Hook<C, R>,\n reactDesc: ComponentDocumentation,\n) {\n if (!component) {\n throw new Error('react-desc: component is required');\n }\n\n const documentation: Partial<TypescriptDocumentation> = {\n name: component.displayName || component.name,\n ...reactDesc,\n };\n if (reactDesc) {\n delete documentation.propTypes;\n\n if (reactDesc.propTypes) {\n const propTypes: TypescriptDocumentation['properties'] = [];\n Object.keys(reactDesc.propTypes).forEach((propName) => {\n const propType = reactDesc.propTypes[propName];\n if (propType.type === 'shape') {\n propType.reactDesc.group = {};\n\n Object.keys(propType.args as Record<string, ReactDescT>).forEach((prop) => {\n if (!propType.reactDesc.group) return;\n propType.reactDesc.group[prop] = propTypeAsTypescript(\n (propType.args as Record<string, ReactDescT>)[prop],\n prop,\n );\n });\n }\n propTypes.push(propTypeAsTypescript(propType, propName));\n });\n if (propTypes.length > 0) {\n documentation.properties = propTypes;\n }\n }\n }\n return documentation as TypescriptDocumentation;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADOvB,MAAM,cAAc,CAAC,UAAwB,MAAM,IAAI,CAAC,aAAa,eAAe,QAAQ,CAAC;AAE7F,MAAM,cAAc,CAAC,UAAsC;AACzD,QAAM,QAAQ,OAAO,KAAK,KAAK,EAAE,IAAI,CAAC,QAAQ;AAC5C,UAAM,QAAQ,MAAM,GAAG;AACvB,QAAI;AACJ,QACE,MAAM,SACL,MAAM,SAAS,aAAa,MAAM,SAAS,eAAe,MAAM,SAAS,YAC1E,MAAM,QAAQ,MAAM,IAAI,GACxB;AACA,oBAAc,GAAG,eAAe,KAAK;AAAA,IACvC,WAAW,MAAM,SAAS,SAAS;AACjC,oBAAc,GAAG,eAAe,KAAK;AAAA,IACvC,OAAO;AACL,oBAAc,eAAe,KAAK;AAAA,IACpC;AACA,WAAO,GAAG,MAAM,MAAM,aAAa,MAAM,UAAU,WAAW,KAAK,QAAQ;AAAA,EAC7E,CAAC;AACD,SAAO,IAAI,MAAM,KAAK,GAAG;AAC3B;AAEA,MAAM,iBAAiB,CAAC,UAAqC,WAAW,OAAe;AACrF,MAAI;AACJ,MAAI,MAAM,QAAQ,QAAQ,GAAG;AAC3B,aAAS,YAAY,QAAQ,EAAE,KAAK,QAAQ;AAAA,EAC9C,WAAW,OAAO,aAAa,cAAc,SAAS,MAAM;AAC1D,YAAQ,SAAS,MAAM;AAAA,MACrB,KAAK;AACH,iBAAS;AACT;AAAA,MACF,KAAK;AACH,YAAK,SAAS,KAAoB,SAAS,aAAa;AACtD,mBAAS,IAAI,eAAe,SAAS,MAAoB,KAAK;AAAA,QAChE,OAAO;AACL,mBAAS,GAAG,eAAe,SAAS,MAAoB,IAAI;AAAA,QAC9D;AACA;AAAA,MACF,KAAK;AACH,iBAAS,IAAI,eAAe,SAAS,MAAoB,IAAI;AAC7D;AAAA,MACF,KAAK;AACH,iBAAS;AACT;AAAA,MACF,KAAK;AACH,iBAAS,UAAU,WAAW,aAAa;AAC3C;AAAA,MACF,KAAK;AACH,iBAAS;AACT;AAAA,MACF,KAAK;AACH,iBAAS;AACT;AAAA,MACF,KAAK;AACH,iBAAS;AACT;AAAA,MACF,KAAK;AACH,iBAAS;AACT;AAAA,MACF,KAAK;AACH,iBAAS,oBAAoB,eAAe,SAAS,IAAkB;AACvE;AAAA,MACF,KAAK;AACH,iBAAU,SAAS,KAAmB,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK;AACrE;AAAA,MACF,KAAK;AACH,iBAAS,GAAG,eAAe,SAAS,MAAsB,KAAK;AAC/D;AAAA,MACF,KAAK;AACH,iBAAS,GAAG,YAAY,SAAS,IAAkC;AACnE;AAAA,MACF;AACE,iBAAS,GAAG,SAAS;AACrB;AAAA,IACJ;AAAA,EACF,OAAO;AACL,aAAS;AAAA,EACX;AACA,SAAO;AACT;AAEA,MAAM,uBAAuB,CAAC,UAAsB,aAAqB;AACvE,QAAM,gBAAgB;AAAA,IACpB,GAAG,SAAS;AAAA,IACZ,MAAM;AAAA,EACR;AAEA,gBAAc,SAAS,eAAe,QAAQ;AAE9C,SAAO;AACT;AAEe,SAAR,iBACL,WACA,WACA;AACA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,QAAM,gBAAkD;AAAA,IACtD,MAAM,UAAU,eAAe,UAAU;AAAA,IACzC,GAAG;AAAA,EACL;AACA,MAAI,WAAW;AACb,WAAO,cAAc;AAErB,QAAI,UAAU,WAAW;AACvB,YAAM,YAAmD,CAAC;AAC1D,aAAO,KAAK,UAAU,SAAS,EAAE,QAAQ,CAAC,aAAa;AACrD,cAAM,WAAW,UAAU,UAAU,QAAQ;AAC7C,YAAI,SAAS,SAAS,SAAS;AAC7B,mBAAS,UAAU,QAAQ,CAAC;AAE5B,iBAAO,KAAK,SAAS,IAAkC,EAAE,QAAQ,CAAC,SAAS;AACzE,gBAAI,CAAC,SAAS,UAAU;AAAO;AAC/B,qBAAS,UAAU,MAAM,IAAI,IAAI;AAAA,cAC9B,SAAS,KAAoC,IAAI;AAAA,cAClD;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AACA,kBAAU,KAAK,qBAAqB,UAAU,QAAQ,CAAC;AAAA,MACzD,CAAC;AACD,UAAI,UAAU,SAAS,GAAG;AACxB,sBAAc,aAAa;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var types_exports = {};
|
|
26
|
+
module.exports = __toCommonJS(types_exports);
|
|
27
|
+
var React = __toESM(require("react"));
|
|
28
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/propTypes/types.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type {\n any,\n array,\n bool,\n func,\n number,\n object,\n string,\n node,\n element,\n symbol,\n elementType,\n instanceOf,\n oneOf,\n oneOfType,\n arrayOf,\n objectOf,\n shape,\n exact,\n ValidationMap,\n} from 'prop-types';\nimport type React from 'react';\n\nexport interface ReactDescObjT {\n [key: string]: unknown;\n required?: boolean;\n deprecated?: Record<string, string>;\n description?: string;\n defaultValue?: unknown;\n format?: string;\n signature?: string;\n warned?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n isRequiredIf?: (props: any) => boolean;\n group?: Record<string, unknown>;\n}\n\nexport type InstanceOfT = typeof instanceOf;\nexport type OneOfT = typeof oneOf;\nexport type ObjectOfT = typeof objectOf;\nexport type ExactT = typeof exact;\nexport type OneOfTypeT = typeof oneOfType;\nexport type ArrayOfT = typeof arrayOf;\nexport type ShapeT = typeof shape;\nexport type AnyT = typeof any;\nexport type ArrayT = typeof array;\nexport type BoolT = typeof bool;\nexport type FuncT = typeof func;\nexport type NumberT = typeof number;\nexport type ObjectT = typeof object;\nexport type StringT = typeof string;\nexport type NodeT = typeof node;\nexport type ElementT = typeof element;\nexport type SymbolT = typeof symbol;\nexport type ElementTypeT = typeof elementType;\n\nexport type ParametizedPropTypes = InstanceOfT | OneOfT | ObjectOfT | ExactT | OneOfTypeT | ArrayOfT | ShapeT;\n\nexport type AllPropTypes =\n | AnyT\n | ArrayT\n | BoolT\n | FuncT\n | NumberT\n | ObjectT\n | StringT\n | NodeT\n | ElementT\n | SymbolT\n | ElementTypeT\n | ParametizedPropTypes;\n\nexport type PropTypesTypes =\n | 'any'\n | 'array'\n | 'bool'\n | 'func'\n | 'number'\n | 'object'\n | 'string'\n | 'node'\n | 'element'\n | 'symbol'\n | 'elementType'\n | 'instanceOf'\n | 'oneOf'\n | 'oneOfType'\n | 'arrayOf'\n | 'objectOf'\n | 'shape'\n | 'exact'\n | 'tuple';\n\nexport interface ReactDescT {\n [key: string]: unknown;\n type: PropTypesTypes;\n defaultValue: (this: ReactDescT, dfault: unknown) => ReactDescT;\n deprecated: (this: ReactDescT, info: Record<string, string>) => ReactDescT;\n description: (this: ReactDescT, descr: string) => ReactDescT;\n format: (this: ReactDescT, format: string) => ReactDescT;\n signature: (this: ReactDescT, format: string) => ReactDescT;\n hidden: (this: ReactDescT) => ReactDescT;\n dataTestId: (this: ReactDescT) => ReactDescT;\n global: (this: ReactDescT) => ReactDescT;\n xstyled: (this: ReactDescT) => ReactDescT;\n omitValidation: (this: ReactDescT) => ReactDescT;\n isRequired: ReactDescT;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n isRequiredIf: (this: ReactDescT, isRequiredIf: (props: any) => boolean) => ReactDescT;\n reactDesc: ReactDescObjT;\n args?:\n | ReactDescT\n | ReactDescT[]\n | Record<string, ReactDescT>\n | unknown[]\n | Parameters<InstanceOfT>[0]\n | Parameters<OneOfT>[0]\n | Parameters<ObjectOfT>[0]\n | Parameters<ExactT>[0];\n}\n\nexport interface ComponentDocumentation {\n propTypes: Record<string, ReactDescT>;\n availableAt?: unknown;\n description?: string;\n details?: unknown;\n deprecated?: unknown;\n usage?: unknown;\n intrinsicElement?: unknown;\n toTypescript?: unknown;\n}\n\nexport interface TypescriptDocumentation extends Partial<ComponentDocumentation> {\n name: string;\n description: string;\n properties: {\n name: string;\n required?: boolean | undefined;\n deprecated?: Record<string, string> | undefined;\n description?: string;\n format?: string;\n signature?: string;\n warned?: boolean;\n defaultValue?: unknown;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n isRequiredIf?: (props: any) => boolean;\n omitValidation?: boolean;\n }[];\n}\n\nexport type DocumentedReactComponent<T> = React.ComponentType<T> & {\n availableAt: unknown;\n description: (descr: string) => DocumentedReactComponent<T>;\n details: unknown;\n deprecated: unknown;\n usage: unknown;\n intrinsicElement: unknown;\n toTypescript: () => TypescriptDocumentation;\n propTypesValue: ValidationMap<Record<string, unknown>>;\n};\n\nexport type Hook<T = unknown, S = unknown> = ((props: T) => S) & { displayName?: string; name?: string };\n\nexport type DocumentedPropType = ReactDescT;\n\nexport type PropTypesObj = {\n any: DocumentedPropType;\n array: DocumentedPropType;\n bool: DocumentedPropType;\n func: DocumentedPropType;\n number: DocumentedPropType;\n object: DocumentedPropType;\n string: DocumentedPropType;\n node: DocumentedPropType;\n element: DocumentedPropType;\n symbol: DocumentedPropType;\n elementType: DocumentedPropType;\n instanceOf: (cls: unknown) => DocumentedPropType;\n oneOf: (arr: unknown[]) => DocumentedPropType;\n oneOfType: (arr: DocumentedPropType[]) => DocumentedPropType;\n arrayOf: (smth: DocumentedPropType) => DocumentedPropType;\n objectOf: (smth: DocumentedPropType) => DocumentedPropType;\n shape: (obj: Record<string, DocumentedPropType>) => DocumentedPropType;\n exact: (obj: Record<string, DocumentedPropType>) => DocumentedPropType;\n tuple: (arr: DocumentedPropType[]) => DocumentedPropType;\n};\n\nexport type DSPropTypesSchema<T> = Required<{ [key in keyof T]: ReactDescT }>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getPropsPerDatatestIdPropTypes_exports = {};
|
|
30
|
+
__export(getPropsPerDatatestIdPropTypes_exports, {
|
|
31
|
+
getPropsPerDatatestIdPropTypes: () => getPropsPerDatatestIdPropTypes
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getPropsPerDatatestIdPropTypes_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_propTypes = require("../propTypes/index.js");
|
|
36
|
+
const isString = (value) => typeof value === "string";
|
|
37
|
+
const isDataTestId = (value) => typeof value === "object";
|
|
38
|
+
const getLeafValues = (obj) => {
|
|
39
|
+
const keys = Object.keys(obj);
|
|
40
|
+
const leafValues = keys.reduce((acc, key) => {
|
|
41
|
+
const value = obj[key];
|
|
42
|
+
if (isString(value)) {
|
|
43
|
+
acc.push(`${value}`);
|
|
44
|
+
} else if (isDataTestId(value)) {
|
|
45
|
+
acc.push(...getLeafValues(value));
|
|
46
|
+
}
|
|
47
|
+
return acc;
|
|
48
|
+
}, []);
|
|
49
|
+
return leafValues;
|
|
50
|
+
};
|
|
51
|
+
const getPropsPerDatatestIdPropTypes = (dataTestIdObj) => {
|
|
52
|
+
const leafValues = getLeafValues(dataTestIdObj);
|
|
53
|
+
const propsPerDataTestIdPropTypes = {};
|
|
54
|
+
leafValues.forEach((leafValue) => {
|
|
55
|
+
propsPerDataTestIdPropTypes[leafValue] = import_propTypes.PropTypes.shape({
|
|
56
|
+
"aria-*": import_propTypes.PropTypes.string.description("Aria related properties"),
|
|
57
|
+
"data-*": import_propTypes.PropTypes.string.description("Any data property to attach to the root container"),
|
|
58
|
+
"on-*": import_propTypes.PropTypes.func.description("Any supported React event"),
|
|
59
|
+
"all HTML attributes": import_propTypes.PropTypes.any.description(
|
|
60
|
+
"HTML attributes such as id, className, autoComplete, href and so on"
|
|
61
|
+
)
|
|
62
|
+
}).description(`an object containing the definitions for ${leafValue} aria and data props`).dataTestId();
|
|
63
|
+
});
|
|
64
|
+
return propsPerDataTestIdPropTypes;
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=getPropsPerDatatestIdPropTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/propsPerDataTestId/getPropsPerDatatestIdPropTypes.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable indent */\nimport { PropTypes } from '../propTypes/index.js';\nimport type { ReactDescT } from '../propTypes/types.js';\n\n// recursive type where the key is a string and the value it's the either a string or a recursive type\ntype DataTestId = {\n [key: string]: string | DataTestId;\n};\n// typescript typeguard to check if the value is a string\nconst isString = (value: string | DataTestId): value is string => typeof value === 'string';\n// typescript typeguard to check if the value is a DataTestId\nconst isDataTestId = (value: string | DataTestId): value is DataTestId => typeof value === 'object';\n\ntype PropsPerDataTestIdPropTypes = {\n [key: string]: ReactDescT['shape'];\n};\n// implementation of a helper function that retrieves the nested values of the input object\n// and returns an array of strings, each string is the value of a leaf of the input object\n/**\n *\n * @param {object} obj - object in which the values rapresent the keys of the output object\n * @returns {string[]} an array of strings, each string is the value of a leaf of the input object\n * @example\n * const obj = {\n * WHATEVER: 'data-testid',\n * NESTED:{\n * WHATEVER2: 'data-testid-2',\n * WHATEVER3: 'data-testid-3',\n * }\n * }\n * const leafValues = getLeafValues(obj);\n * leafValues === ['data-testid', 'data-testid-2', 'data-testid-3']\n */\nconst getLeafValues = (obj: DataTestId): string[] => {\n const keys = Object.keys(obj);\n const leafValues = keys.reduce((acc, key) => {\n const value = obj[key];\n if (isString(value)) {\n acc.push(`${value}`);\n } else if (isDataTestId(value)) {\n acc.push(...getLeafValues(value));\n }\n return acc;\n }, [] as string[]);\n return leafValues;\n};\n\n/**\n * @param {object} dataTestIdObj - object in which the values rapresent the keys of the output object\n * @returns {object} output - an object in which for each leaf value of the input object there is a key with aria-* and data-* props.shape definition\n * @example\n * const dataTestIdObj = {\n * WHATEVER: 'data-testid',\n * NESTED:{\n * WHATEVER2: 'data-testid-2',\n * WHATEVER3: 'data-testid-3',\n * }\n * }\n *\n * const propsPerDataTestIdPropTypes = getPropsPerDatatestIdPropTypes(dataTestIdObj);\n * // propsPerDataTestIdPropTypes will be\n * {\n * 'data-testid': PropTypes.shape({\n * 'aria-*': PropTypes.string,\n * 'data-*': PropTypes.string,\n * }),\n * 'data-testid-2': PropTypes.shape({\n * 'aria-*': PropTypes.string,\n * 'data-*': PropTypes.string,\n * })\n * 'data-testid-3': PropTypes.shape({\n * 'aria-*': PropTypes.string,\n * 'data-*': PropTypes.string,\n * })\n * }\n * @fires getLeafValues\n */\nexport const getPropsPerDatatestIdPropTypes = (dataTestIdObj: DataTestId): PropsPerDataTestIdPropTypes => {\n const leafValues = getLeafValues(dataTestIdObj);\n const propsPerDataTestIdPropTypes = {} as PropsPerDataTestIdPropTypes;\n leafValues.forEach((leafValue) => {\n propsPerDataTestIdPropTypes[leafValue] = PropTypes.shape({\n 'aria-*': PropTypes.string.description('Aria related properties'),\n 'data-*': PropTypes.string.description('Any data property to attach to the root container'),\n 'on-*': PropTypes.func.description('Any supported React event'),\n 'all HTML attributes': PropTypes.any.description(\n 'HTML attributes such as id, className, autoComplete, href and so on',\n ),\n })\n .description(`an object containing the definitions for ${leafValue} aria and data props`)\n .dataTestId();\n });\n return propsPerDataTestIdPropTypes;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAA0B;AAQ1B,MAAM,WAAW,CAAC,UAAgD,OAAO,UAAU;AAEnF,MAAM,eAAe,CAAC,UAAoD,OAAO,UAAU;AAsB3F,MAAM,gBAAgB,CAAC,QAA8B;AACnD,QAAM,OAAO,OAAO,KAAK,GAAG;AAC5B,QAAM,aAAa,KAAK,OAAO,CAAC,KAAK,QAAQ;AAC3C,UAAM,QAAQ,IAAI,GAAG;AACrB,QAAI,SAAS,KAAK,GAAG;AACnB,UAAI,KAAK,GAAG,OAAO;AAAA,IACrB,WAAW,aAAa,KAAK,GAAG;AAC9B,UAAI,KAAK,GAAG,cAAc,KAAK,CAAC;AAAA,IAClC;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAa;AACjB,SAAO;AACT;AAgCO,MAAM,iCAAiC,CAAC,kBAA2D;AACxG,QAAM,aAAa,cAAc,aAAa;AAC9C,QAAM,8BAA8B,CAAC;AACrC,aAAW,QAAQ,CAAC,cAAc;AAChC,gCAA4B,SAAS,IAAI,2BAAU,MAAM;AAAA,MACvD,UAAU,2BAAU,OAAO,YAAY,yBAAyB;AAAA,MAChE,UAAU,2BAAU,OAAO,YAAY,mDAAmD;AAAA,MAC1F,QAAQ,2BAAU,KAAK,YAAY,2BAA2B;AAAA,MAC9D,uBAAuB,2BAAU,IAAI;AAAA,QACnC;AAAA,MACF;AAAA,IACF,CAAC,EACE,YAAY,4CAA4C,+BAA+B,EACvF,WAAW;AAAA,EAChB,CAAC;AACD,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getPropsPerDatatestid_exports = {};
|
|
30
|
+
__export(getPropsPerDatatestid_exports, {
|
|
31
|
+
getPropsPerDatatestid: () => getPropsPerDatatestid
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getPropsPerDatatestid_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_getProps = require("../getProps/index.js");
|
|
36
|
+
const getPropsPerDatatestid = (userProps) => {
|
|
37
|
+
if (userProps === void 0 || userProps === null || typeof userProps !== "object" && typeof userProps !== "function")
|
|
38
|
+
return {};
|
|
39
|
+
if (typeof userProps === "function") {
|
|
40
|
+
const values = (0, import_getProps.getAriaOrDataProps)(userProps());
|
|
41
|
+
return values;
|
|
42
|
+
}
|
|
43
|
+
return (0, import_getProps.getAriaOrDataProps)(userProps);
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=getPropsPerDatatestid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/propsPerDataTestId/getPropsPerDatatestid.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable indent */\n/* eslint-disable complexity */\nimport { getAriaOrDataProps } from '../getProps/index.js';\n\n/**\n * Returns the props for a given dataTestId.\n * props are going to be filtered so only aria related and data-* props are going to be returned.\n * @param {Record<string, string> | (() => Record<string, string>)} userProps - The props passed by the user.\n * @returns The props for the given dataTestId.\n * @example\n * const userProps = {\n * 'ds-controlled-date-time-picker-month-input': {\n * 'aria-label': 'month-input-aria-label',\n * 'data-test': 'month-input-data-test',\n * somethingElse: 'this will not be returned',\n * },\n * 'ds-controlled-date-time-picker-day-input': {\n * 'aria-label': 'day-aria-label',\n * 'data-test': 'day-data-test',\n * },\n * };\n * const dataTestIdProps = getDataTestIdProps(userProps['ds-controlled-date-time-picker-day-input']);\n * // dataTestIdProps = {\n * // 'aria-label': 'day-aria-label',\n * // 'data-test': 'day-data-test',\n * // }\n * @example\n * const userProps = {\n * 'ds-controlled-date-time-picker-month-input': {\n * 'aria-label': 'month-input-aria-label',\n * 'data-test': 'month-input-data-test',\n * },\n * 'ds-controlled-date-time-picker-day-input': (props) => ({ // notice that this is a function that returns an object\n * 'aria-label': 'day-aria-label',\n * 'data-test': 'day-data-test',\n * somethingElse: 'this will not be returned',\n * }),\n * };\n * const dataTestIdProps = getDataTestIdProps(userProps['ds-controlled-date-time-picker-day-input']);\n * // dataTestIdProps = {\n * // 'aria-label': 'day-aria-label',\n * // 'data-test': 'day-data-test',\n * // }\n * @fires getAriaOrDataProps\n */\nconst getPropsPerDatatestid = (userProps: AriaAndDataPropsOrPropsGetter | undefined) => {\n if (\n userProps === undefined ||\n userProps === null ||\n (typeof userProps !== 'object' && typeof userProps !== 'function')\n )\n return {};\n\n if (typeof userProps === 'function') {\n const values = getAriaOrDataProps(userProps());\n return values;\n }\n return getAriaOrDataProps(userProps);\n};\n\nexport { getPropsPerDatatestid };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,sBAAmC;AA2CnC,MAAM,wBAAwB,CAAC,cAAyD;AACtF,MACE,cAAc,UACd,cAAc,QACb,OAAO,cAAc,YAAY,OAAO,cAAc;AAEvD,WAAO,CAAC;AAEV,MAAI,OAAO,cAAc,YAAY;AACnC,UAAM,aAAS,oCAAmB,UAAU,CAAC;AAC7C,WAAO;AAAA,EACT;AACA,aAAO,oCAAmB,SAAS;AACrC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var propsPerDataTestId_exports = {};
|
|
30
|
+
__export(propsPerDataTestId_exports, {
|
|
31
|
+
getPropsPerDatatestIdPropTypes: () => import_getPropsPerDatatestIdPropTypes.getPropsPerDatatestIdPropTypes,
|
|
32
|
+
getPropsPerDatatestid: () => import_getPropsPerDatatestid.getPropsPerDatatestid
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(propsPerDataTestId_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_getPropsPerDatatestid = require("./getPropsPerDatatestid.js");
|
|
37
|
+
var import_getPropsPerDatatestIdPropTypes = require("./getPropsPerDatatestIdPropTypes.js");
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/propsPerDataTestId/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { getPropsPerDatatestid } from './getPropsPerDatatestid.js';\nexport { getPropsPerDatatestIdPropTypes } from './getPropsPerDatatestIdPropTypes.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mCAAsC;AACtC,4CAA+C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var TestComponent_exports = {};
|
|
30
|
+
__export(TestComponent_exports, {
|
|
31
|
+
TestComponent: () => TestComponent
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(TestComponent_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_globalProps = require("../../globalProps");
|
|
38
|
+
const TestComponent = (props) => {
|
|
39
|
+
const globalAttributes = (0, import_globalProps.useGetGlobalAttributes)(props);
|
|
40
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...globalAttributes, children: "Some random div" });
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=TestComponent.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/tests/globalProps/TestComponent.js", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useGetGlobalAttributes } from '../../globalProps';\n\nexport const TestComponent = (props) => {\n const globalAttributes = useGetGlobalAttributes(props);\n\n return <div {...globalAttributes}>Some random div</div>;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADMd;AANT,mBAAkB;AAClB,yBAAuC;AAEhC,MAAM,gBAAgB,CAAC,UAAU;AACtC,QAAM,uBAAmB,2CAAuB,KAAK;AAErD,SAAO,4CAAC,SAAK,GAAG,kBAAkB,6BAAe;AACnD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var test_schema_exports = {};
|
|
30
|
+
__export(test_schema_exports, {
|
|
31
|
+
TypescriptSchema: () => TypescriptSchema
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(test_schema_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_propTypes = require("../../propTypes/index.ts");
|
|
36
|
+
const TestSchema = {
|
|
37
|
+
string: import_propTypes.PropTypes.string.description("String"),
|
|
38
|
+
number: import_propTypes.PropTypes.number.description("Number"),
|
|
39
|
+
boolean: import_propTypes.PropTypes.bool.description("Boolean"),
|
|
40
|
+
any: import_propTypes.PropTypes.any.description("Any"),
|
|
41
|
+
union: import_propTypes.PropTypes.oneOfType([import_propTypes.PropTypes.string, import_propTypes.PropTypes.number]).description("Union"),
|
|
42
|
+
union2: import_propTypes.PropTypes.oneOf(["A", "B"]).description("Union 2"),
|
|
43
|
+
union3: import_propTypes.PropTypes.oneOfType([
|
|
44
|
+
import_propTypes.PropTypes.string,
|
|
45
|
+
import_propTypes.PropTypes.arrayOf(import_propTypes.PropTypes.string),
|
|
46
|
+
import_propTypes.PropTypes.shape({ string: import_propTypes.PropTypes.string })
|
|
47
|
+
]).description("Union 3"),
|
|
48
|
+
array: import_propTypes.PropTypes.arrayOf(import_propTypes.PropTypes.string).description("Array"),
|
|
49
|
+
object: import_propTypes.PropTypes.object.description("Object"),
|
|
50
|
+
shape: import_propTypes.PropTypes.shape({
|
|
51
|
+
string: import_propTypes.PropTypes.string.description("String").isRequired,
|
|
52
|
+
number: import_propTypes.PropTypes.number.description("Number"),
|
|
53
|
+
boolean: import_propTypes.PropTypes.bool.description("Boolean"),
|
|
54
|
+
anotherShape: import_propTypes.PropTypes.shape({
|
|
55
|
+
string: import_propTypes.PropTypes.string.description("String").isRequired,
|
|
56
|
+
number: import_propTypes.PropTypes.number.description("Number"),
|
|
57
|
+
boolean: import_propTypes.PropTypes.bool.description("Boolean")
|
|
58
|
+
}).description("Another shape")
|
|
59
|
+
}).description("Shape"),
|
|
60
|
+
function: import_propTypes.PropTypes.func.description("Function"),
|
|
61
|
+
jsx: import_propTypes.PropTypes.element.description("JSX"),
|
|
62
|
+
node: import_propTypes.PropTypes.node.description("Node"),
|
|
63
|
+
something: import_propTypes.PropTypes.oneOf(["thing", "object"]).description("something"),
|
|
64
|
+
isRequiredIf: import_propTypes.PropTypes.string.description("isRequiredIf").isRequiredIf((props) => props.something === "thing"),
|
|
65
|
+
objectOf: import_propTypes.PropTypes.objectOf(import_propTypes.PropTypes.string).description("Object of"),
|
|
66
|
+
objectOfArray: import_propTypes.PropTypes.objectOf(import_propTypes.PropTypes.arrayOf(import_propTypes.PropTypes.string)).description("Object of array")
|
|
67
|
+
};
|
|
68
|
+
const TestComponent = () => null;
|
|
69
|
+
const TestComponentWithSchema = (0, import_propTypes.describe)(TestComponent).description("Test Component");
|
|
70
|
+
TestComponentWithSchema.propTypes = TestSchema;
|
|
71
|
+
const TypescriptSchema = TestComponentWithSchema.toTypescript();
|
|
72
|
+
//# sourceMappingURL=test.schema.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/tests/validation/test.schema.js", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { PropTypes, describe } from '../../propTypes/index.ts';\n\nconst TestSchema = {\n string: PropTypes.string.description('String'),\n number: PropTypes.number.description('Number'),\n boolean: PropTypes.bool.description('Boolean'),\n any: PropTypes.any.description('Any'),\n union: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('Union'),\n union2: PropTypes.oneOf(['A', 'B']).description('Union 2'),\n union3: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.arrayOf(PropTypes.string),\n PropTypes.shape({ string: PropTypes.string }),\n ]).description('Union 3'),\n array: PropTypes.arrayOf(PropTypes.string).description('Array'),\n object: PropTypes.object.description('Object'),\n shape: PropTypes.shape({\n string: PropTypes.string.description('String').isRequired,\n number: PropTypes.number.description('Number'),\n boolean: PropTypes.bool.description('Boolean'),\n anotherShape: PropTypes.shape({\n string: PropTypes.string.description('String').isRequired,\n number: PropTypes.number.description('Number'),\n boolean: PropTypes.bool.description('Boolean'),\n }).description('Another shape'),\n }).description('Shape'),\n function: PropTypes.func.description('Function'),\n jsx: PropTypes.element.description('JSX'),\n node: PropTypes.node.description('Node'),\n something: PropTypes.oneOf(['thing', 'object']).description('something'),\n isRequiredIf: PropTypes.string.description('isRequiredIf').isRequiredIf((props) => props.something === 'thing'),\n objectOf: PropTypes.objectOf(PropTypes.string).description('Object of'),\n objectOfArray: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)).description('Object of array'),\n};\n\nconst TestComponent = () => null;\n\nconst TestComponentWithSchema = describe(TestComponent).description('Test Component');\n\nTestComponentWithSchema.propTypes = TestSchema;\n\nexport const TypescriptSchema = TestComponentWithSchema.toTypescript();\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAoC;AAEpC,MAAM,aAAa;AAAA,EACjB,QAAQ,2BAAU,OAAO,YAAY,QAAQ;AAAA,EAC7C,QAAQ,2BAAU,OAAO,YAAY,QAAQ;AAAA,EAC7C,SAAS,2BAAU,KAAK,YAAY,SAAS;AAAA,EAC7C,KAAK,2BAAU,IAAI,YAAY,KAAK;AAAA,EACpC,OAAO,2BAAU,UAAU,CAAC,2BAAU,QAAQ,2BAAU,MAAM,CAAC,EAAE,YAAY,OAAO;AAAA,EACpF,QAAQ,2BAAU,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,YAAY,SAAS;AAAA,EACzD,QAAQ,2BAAU,UAAU;AAAA,IAC1B,2BAAU;AAAA,IACV,2BAAU,QAAQ,2BAAU,MAAM;AAAA,IAClC,2BAAU,MAAM,EAAE,QAAQ,2BAAU,OAAO,CAAC;AAAA,EAC9C,CAAC,EAAE,YAAY,SAAS;AAAA,EACxB,OAAO,2BAAU,QAAQ,2BAAU,MAAM,EAAE,YAAY,OAAO;AAAA,EAC9D,QAAQ,2BAAU,OAAO,YAAY,QAAQ;AAAA,EAC7C,OAAO,2BAAU,MAAM;AAAA,IACrB,QAAQ,2BAAU,OAAO,YAAY,QAAQ,EAAE;AAAA,IAC/C,QAAQ,2BAAU,OAAO,YAAY,QAAQ;AAAA,IAC7C,SAAS,2BAAU,KAAK,YAAY,SAAS;AAAA,IAC7C,cAAc,2BAAU,MAAM;AAAA,MAC5B,QAAQ,2BAAU,OAAO,YAAY,QAAQ,EAAE;AAAA,MAC/C,QAAQ,2BAAU,OAAO,YAAY,QAAQ;AAAA,MAC7C,SAAS,2BAAU,KAAK,YAAY,SAAS;AAAA,IAC/C,CAAC,EAAE,YAAY,eAAe;AAAA,EAChC,CAAC,EAAE,YAAY,OAAO;AAAA,EACtB,UAAU,2BAAU,KAAK,YAAY,UAAU;AAAA,EAC/C,KAAK,2BAAU,QAAQ,YAAY,KAAK;AAAA,EACxC,MAAM,2BAAU,KAAK,YAAY,MAAM;AAAA,EACvC,WAAW,2BAAU,MAAM,CAAC,SAAS,QAAQ,CAAC,EAAE,YAAY,WAAW;AAAA,EACvE,cAAc,2BAAU,OAAO,YAAY,cAAc,EAAE,aAAa,CAAC,UAAU,MAAM,cAAc,OAAO;AAAA,EAC9G,UAAU,2BAAU,SAAS,2BAAU,MAAM,EAAE,YAAY,WAAW;AAAA,EACtE,eAAe,2BAAU,SAAS,2BAAU,QAAQ,2BAAU,MAAM,CAAC,EAAE,YAAY,iBAAiB;AACtG;AAEA,MAAM,gBAAgB,MAAM;AAE5B,MAAM,8BAA0B,2BAAS,aAAa,EAAE,YAAY,gBAAgB;AAEpF,wBAAwB,YAAY;AAE7B,MAAM,mBAAmB,wBAAwB,aAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var TestComponent_exports = {};
|
|
30
|
+
__export(TestComponent_exports, {
|
|
31
|
+
TestComponent: () => TestComponent
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(TestComponent_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_xstyledProps = require("../../xstyledProps");
|
|
38
|
+
const TestComponent = (props) => {
|
|
39
|
+
const xstyledProps = (0, import_xstyledProps.useGetXstyledProps)(props);
|
|
40
|
+
props.signal(xstyledProps);
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...xstyledProps, "data-testid": "xstyled-div", children: "Some random div" });
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=TestComponent.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/tests/xstyledProps/TestComponent.js", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { useGetXstyledProps } from '../../xstyledProps';\n\nexport const TestComponent = (props) => {\n const xstyledProps = useGetXstyledProps(props);\n\n props.signal(xstyledProps);\n\n return (\n <div {...xstyledProps} data-testid=\"xstyled-div\">\n Some random div\n </div>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADUnB;AATJ,mBAAkB;AAClB,0BAAmC;AAE5B,MAAM,gBAAgB,CAAC,UAAU;AACtC,QAAM,mBAAe,wCAAmB,KAAK;AAE7C,QAAM,OAAO,YAAY;AAEzB,SACE,4CAAC,SAAK,GAAG,cAAc,eAAY,eAAc,6BAEjD;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|