@elliemae/ds-stepper 3.37.1 → 3.38.0-rc.0
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/Stepper.js +6 -6
- package/dist/cjs/Stepper.js.map +2 -2
- package/dist/cjs/StepperButton.js +8 -6
- package/dist/cjs/StepperButton.js.map +2 -2
- package/dist/cjs/index.js +12 -3
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/{props.js → react-desc-prop-types.js} +29 -27
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/styled.js +4 -4
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-stepper-button-valid.js +112 -0
- package/dist/cjs/typescript-testing/typescript-stepper-button-valid.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-stepper-valid.js +81 -0
- package/dist/cjs/typescript-testing/typescript-stepper-valid.js.map +7 -0
- package/dist/esm/Stepper.js +6 -6
- package/dist/esm/Stepper.js.map +2 -2
- package/dist/esm/StepperButton.js +12 -6
- package/dist/esm/StepperButton.js.map +2 -2
- package/dist/esm/index.js +8 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +46 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/styled.js +4 -4
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-stepper-button-valid.js +89 -0
- package/dist/esm/typescript-testing/typescript-stepper-button-valid.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-stepper-valid.js +58 -0
- package/dist/esm/typescript-testing/typescript-stepper-valid.js.map +7 -0
- package/dist/types/Stepper.d.ts +4 -4
- package/dist/types/StepperButton.d.ts +3 -3
- package/dist/types/index.d.ts +3 -2
- package/dist/types/react-desc-prop-types.d.ts +54 -0
- package/dist/types/styled.d.ts +52 -0
- package/dist/types/typescript-testing/typescript-stepper-button-valid.d.ts +1 -0
- package/dist/types/typescript-testing/typescript-stepper-valid.d.ts +1 -0
- package/package.json +8 -8
- package/dist/cjs/props.js.map +0 -7
- package/dist/esm/props.js +0 -44
- package/dist/esm/props.js.map +0 -7
- package/dist/types/props.d.ts +0 -45
package/dist/cjs/Stepper.js
CHANGED
|
@@ -29,7 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var Stepper_exports = {};
|
|
30
30
|
__export(Stepper_exports, {
|
|
31
31
|
DSStepper: () => DSStepper,
|
|
32
|
-
|
|
32
|
+
DSStepperWithSchema: () => DSStepperWithSchema
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(Stepper_exports);
|
|
35
35
|
var React = __toESM(require("react"));
|
|
@@ -37,12 +37,12 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
37
37
|
var import_react = __toESM(require("react"));
|
|
38
38
|
var import_uid = require("uid");
|
|
39
39
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
40
|
-
var
|
|
40
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
41
41
|
var import_styled = require("./styled.js");
|
|
42
42
|
var import_DSStepperDefinitions = require("./DSStepperDefinitions.js");
|
|
43
43
|
const DSStepper = (props) => {
|
|
44
|
-
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props,
|
|
45
|
-
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefaults,
|
|
44
|
+
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.stepperDefaultProps);
|
|
45
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefaults, import_react_desc_prop_types.DSStepperPropTypes, import_DSStepperDefinitions.DSStepperName);
|
|
46
46
|
const { steps, current, visited } = propsWithDefaults;
|
|
47
47
|
const stepsArray = import_react.default.useMemo(() => new Array(steps).fill(1), [steps]);
|
|
48
48
|
const globalAttributes = (0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefaults);
|
|
@@ -59,6 +59,6 @@ const DSStepper = (props) => {
|
|
|
59
59
|
)) });
|
|
60
60
|
};
|
|
61
61
|
DSStepper.displayName = import_DSStepperDefinitions.DSStepperName;
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const DSStepperWithSchema = (0, import_ds_props_helpers.describe)(DSStepper);
|
|
63
|
+
DSStepperWithSchema.propTypes = import_react_desc_prop_types.DSStepperPropTypesSchema;
|
|
64
64
|
//# sourceMappingURL=Stepper.js.map
|
package/dist/cjs/Stepper.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Stepper.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { uid } from 'uid';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n useGetGlobalAttributes,\n} from '@elliemae/ds-props-helpers';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwBf;AAxBR,mBAAkB;AAClB,iBAAoB;AACpB,8BAKO;AAEP,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { uid } from 'uid';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n useGetGlobalAttributes,\n} from '@elliemae/ds-props-helpers';\nimport type { DSStepperT } from './react-desc-prop-types.js';\nimport { stepperDefaultProps, DSStepperPropTypesSchema, DSStepperPropTypes } from './react-desc-prop-types.js';\nimport { Step, StepperWrapper } from './styled.js';\nimport { DSStepperName } from './DSStepperDefinitions.js';\n\nconst DSStepper = (props: DSStepperT.Props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSStepperT.InternalProps>(props, stepperDefaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, DSStepperPropTypes, DSStepperName);\n\n const { steps, current, visited } = propsWithDefaults;\n const stepsArray = React.useMemo(() => new Array(steps).fill(1) as number[], [steps]);\n const globalAttributes = useGetGlobalAttributes(propsWithDefaults);\n\n return (\n <StepperWrapper steps={steps} current={current} visited={visited} {...globalAttributes}>\n {stepsArray.map((item, index) => (\n <Step\n // eslint-disable-next-line react/no-array-index-key\n key={`${uid(4)}step-key-${index}`}\n active={current === index}\n visited={visited.includes(index)}\n data-testid={props['data-testid'] ? `${props['data-testid']}-step` : undefined}\n data-active={current === index}\n data-visited={visited.includes(index)}\n />\n ))}\n </StepperWrapper>\n );\n};\n\nDSStepper.displayName = DSStepperName;\nconst DSStepperWithSchema = describe(DSStepper);\nDSStepperWithSchema.propTypes = DSStepperPropTypesSchema;\n\nexport { DSStepper, DSStepperWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwBf;AAxBR,mBAAkB;AAClB,iBAAoB;AACpB,8BAKO;AAEP,mCAAkF;AAClF,oBAAqC;AACrC,kCAA8B;AAE9B,MAAM,YAAY,CAAC,UAA4B;AAC7C,QAAM,wBAAoB,sDAAuD,OAAO,gDAAmB;AAC3G,8DAA+B,mBAAmB,iDAAoB,yCAAa;AAEnF,QAAM,EAAE,OAAO,SAAS,QAAQ,IAAI;AACpC,QAAM,aAAa,aAAAA,QAAM,QAAQ,MAAM,IAAI,MAAM,KAAK,EAAE,KAAK,CAAC,GAAe,CAAC,KAAK,CAAC;AACpF,QAAM,uBAAmB,gDAAuB,iBAAiB;AAEjE,SACE,4CAAC,gCAAe,OAAc,SAAkB,SAAmB,GAAG,kBACnE,qBAAW,IAAI,CAAC,MAAM,UACrB;AAAA,IAAC;AAAA;AAAA,MAGC,QAAQ,YAAY;AAAA,MACpB,SAAS,QAAQ,SAAS,KAAK;AAAA,MAC/B,eAAa,MAAM,aAAa,IAAI,GAAG,MAAM,aAAa,CAAC,UAAU;AAAA,MACrE,eAAa,YAAY;AAAA,MACzB,gBAAc,QAAQ,SAAS,KAAK;AAAA;AAAA,IAL/B,OAAG,gBAAI,CAAC,CAAC,YAAY,KAAK;AAAA,EAMjC,CACD,GACH;AAEJ;AAEA,UAAU,cAAc;AACxB,MAAM,0BAAsB,kCAAS,SAAS;AAC9C,oBAAoB,YAAY;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -37,27 +37,29 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
37
37
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
38
|
var import_ds_button_v2 = require("@elliemae/ds-button-v2");
|
|
39
39
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
40
|
-
var
|
|
40
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
41
41
|
var import_styled = require("./styled.js");
|
|
42
42
|
var import_DSStepperDefinitions = require("./DSStepperDefinitions.js");
|
|
43
43
|
const DSStepperButton = (props) => {
|
|
44
44
|
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(
|
|
45
45
|
props,
|
|
46
|
-
|
|
46
|
+
import_react_desc_prop_types.DSStepperButtonDefaultProps
|
|
47
47
|
);
|
|
48
|
-
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefaults,
|
|
48
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefaults, import_react_desc_prop_types.DSStepperButtonPropTypes, import_DSStepperDefinitions.DSStepperButtonName);
|
|
49
49
|
const { chevron, fontSize, label, disabled, onClick, innerRef } = propsWithDefaults;
|
|
50
|
-
const globalAttributes = (0, import_ds_props_helpers.useGetGlobalAttributes)(
|
|
50
|
+
const globalAttributes = (0, import_ds_props_helpers.useGetGlobalAttributes)(
|
|
51
|
+
propsWithDefaults
|
|
52
|
+
);
|
|
51
53
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
52
54
|
import_styled.StyledButton,
|
|
53
55
|
{
|
|
54
56
|
disabled,
|
|
55
|
-
onClick,
|
|
56
57
|
innerRef,
|
|
57
58
|
buttonType: import_ds_button_v2.BUTTON_TYPES.TEXT,
|
|
58
59
|
fontSize,
|
|
59
60
|
"data-testid": "ds-stepper-btn",
|
|
60
61
|
...globalAttributes,
|
|
62
|
+
onClick,
|
|
61
63
|
children: [
|
|
62
64
|
chevron === "left" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronLeft, {}) : null,
|
|
63
65
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.Label, { value: label }),
|
|
@@ -68,5 +70,5 @@ const DSStepperButton = (props) => {
|
|
|
68
70
|
};
|
|
69
71
|
DSStepperButton.displayName = import_DSStepperDefinitions.DSStepperButtonName;
|
|
70
72
|
const DSStepperButtonWithSchema = (0, import_ds_props_helpers.describe)(DSStepperButton);
|
|
71
|
-
DSStepperButtonWithSchema.propTypes =
|
|
73
|
+
DSStepperButtonWithSchema.propTypes = import_react_desc_prop_types.DSStepperButtonPropTypesSchema;
|
|
72
74
|
//# sourceMappingURL=StepperButton.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/StepperButton.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n useGetGlobalAttributes,\n} from '@elliemae/ds-props-helpers';\nimport { BUTTON_TYPES } from '@elliemae/ds-button-v2';\nimport { ChevronLeft, ChevronRight } from '@elliemae/ds-icons';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n useGetGlobalAttributes,\n} from '@elliemae/ds-props-helpers';\nimport { BUTTON_TYPES, type DSButtonV2T } from '@elliemae/ds-button-v2';\nimport { ChevronLeft, ChevronRight } from '@elliemae/ds-icons';\nimport type { DSStepperButtonT } from './react-desc-prop-types.js';\nimport {\n DSStepperButtonDefaultProps,\n DSStepperButtonPropTypes,\n DSStepperButtonPropTypesSchema,\n} from './react-desc-prop-types.js';\nimport { StyledButton, Label } from './styled.js';\nimport { DSStepperButtonName } from './DSStepperDefinitions.js';\n\nconst DSStepperButton = (props: DSStepperButtonT.Props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault(\n props,\n DSStepperButtonDefaultProps,\n ) as DSStepperButtonT.InternalProps;\n useValidateTypescriptPropTypes(propsWithDefaults, DSStepperButtonPropTypes, DSStepperButtonName);\n\n const { chevron, fontSize, label, disabled, onClick, innerRef } = propsWithDefaults;\n const globalAttributes = useGetGlobalAttributes<DSStepperButtonT.InternalProps, HTMLButtonElement, DSButtonV2T.Props>(\n propsWithDefaults,\n );\n\n return (\n <StyledButton\n disabled={disabled}\n innerRef={innerRef}\n buttonType={BUTTON_TYPES.TEXT}\n fontSize={fontSize}\n data-testid=\"ds-stepper-btn\"\n {...globalAttributes}\n onClick={onClick}\n >\n {chevron === 'left' ? <ChevronLeft /> : null}\n <Label value={label} />\n {chevron === 'right' ? <ChevronRight /> : null}\n </StyledButton>\n );\n};\n\nDSStepperButton.displayName = DSStepperButtonName;\nconst DSStepperButtonWithSchema = describe(DSStepperButton);\nDSStepperButtonWithSchema.propTypes = DSStepperButtonPropTypesSchema;\n\nexport { DSStepperButton, DSStepperButtonWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+BnB;AA9BJ,8BAKO;AACP,0BAA+C;AAC/C,sBAA0C;AAE1C,mCAIO;AACP,oBAAoC;AACpC,kCAAoC;AAEpC,MAAM,kBAAkB,CAAC,UAAkC;AACzD,QAAM,wBAAoB;AAAA,IACxB;AAAA,IACA;AAAA,EACF;AACA,8DAA+B,mBAAmB,uDAA0B,+CAAmB;AAE/F,QAAM,EAAE,SAAS,UAAU,OAAO,UAAU,SAAS,SAAS,IAAI;AAClE,QAAM,uBAAmB;AAAA,IACvB;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,YAAY,iCAAa;AAAA,MACzB;AAAA,MACA,eAAY;AAAA,MACX,GAAG;AAAA,MACJ;AAAA,MAEC;AAAA,oBAAY,SAAS,4CAAC,+BAAY,IAAK;AAAA,QACxC,4CAAC,uBAAM,OAAO,OAAO;AAAA,QACpB,YAAY,UAAU,4CAAC,gCAAa,IAAK;AAAA;AAAA;AAAA,EAC5C;AAEJ;AAEA,gBAAgB,cAAc;AAC9B,MAAM,gCAA4B,kCAAS,eAAe;AAC1D,0BAA0B,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -5,6 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
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
|
+
};
|
|
8
12
|
var __copyProps = (to, from, except, desc) => {
|
|
9
13
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
14
|
for (let key of __getOwnPropNames(from))
|
|
@@ -13,7 +17,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
17
|
}
|
|
14
18
|
return to;
|
|
15
19
|
};
|
|
16
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -24,8 +27,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
27
|
));
|
|
25
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
29
|
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
DSStepper: () => import_Stepper.DSStepper,
|
|
32
|
+
DSStepperButton: () => import_StepperButton.DSStepperButton,
|
|
33
|
+
DSStepperButtonWithSchema: () => import_StepperButton.DSStepperButtonWithSchema,
|
|
34
|
+
DSStepperWithSchema: () => import_Stepper.DSStepperWithSchema
|
|
35
|
+
});
|
|
27
36
|
module.exports = __toCommonJS(src_exports);
|
|
28
37
|
var React = __toESM(require("react"));
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
var import_Stepper = require("./Stepper.js");
|
|
39
|
+
var import_StepperButton = require("./StepperButton.js");
|
|
31
40
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { DSStepper, DSStepperWithSchema } from './Stepper.js';\nexport { DSStepperButton, DSStepperButtonWithSchema } from './StepperButton.js';\nexport type { DSStepperT, DSStepperButtonT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,qBAA+C;AAC/C,2BAA2D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,16 +26,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
var react_desc_prop_types_exports = {};
|
|
30
|
+
__export(react_desc_prop_types_exports, {
|
|
31
|
+
DSStepperButtonDefaultProps: () => DSStepperButtonDefaultProps,
|
|
32
|
+
DSStepperButtonPropTypes: () => DSStepperButtonPropTypes,
|
|
33
|
+
DSStepperButtonPropTypesSchema: () => DSStepperButtonPropTypesSchema,
|
|
34
|
+
DSStepperPropTypes: () => DSStepperPropTypes,
|
|
35
|
+
DSStepperPropTypesSchema: () => DSStepperPropTypesSchema,
|
|
36
|
+
stepperDefaultProps: () => stepperDefaultProps
|
|
35
37
|
});
|
|
36
|
-
module.exports = __toCommonJS(
|
|
38
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
37
39
|
var React = __toESM(require("react"));
|
|
38
40
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
41
|
+
const stepperDefaultProps = {};
|
|
42
|
+
const DSStepperPropTypes = {
|
|
43
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
44
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
45
|
+
steps: import_ds_props_helpers.PropTypes.number.description("Number of steps.").isRequired,
|
|
46
|
+
current: import_ds_props_helpers.PropTypes.number.description("Index of active step."),
|
|
47
|
+
visited: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.number).description("Array of visited steps.").isRequired,
|
|
48
|
+
"data-testid": import_ds_props_helpers.PropTypes.string.description("Root element data-testid.")
|
|
49
|
+
};
|
|
50
|
+
const DSStepperPropTypesSchema = DSStepperPropTypes;
|
|
39
51
|
const BUTTON_SIZES = {
|
|
40
52
|
normal: "normal",
|
|
41
53
|
large: "large"
|
|
@@ -44,31 +56,21 @@ const CHEVRON_TYPE = {
|
|
|
44
56
|
left: "left",
|
|
45
57
|
right: "right"
|
|
46
58
|
};
|
|
47
|
-
const
|
|
48
|
-
steps: 5,
|
|
49
|
-
current: void 0,
|
|
50
|
-
visited: []
|
|
51
|
-
};
|
|
52
|
-
const dsStepperProps = {
|
|
53
|
-
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
54
|
-
steps: import_ds_props_helpers.PropTypes.number.description("Number of steps").isRequired,
|
|
55
|
-
current: import_ds_props_helpers.PropTypes.number.description("Index of active step"),
|
|
56
|
-
visited: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.number).description("Array of visited steps").isRequired
|
|
57
|
-
};
|
|
58
|
-
const defaultButtonProps = {
|
|
59
|
-
chevron: void 0,
|
|
59
|
+
const DSStepperButtonDefaultProps = {
|
|
60
60
|
fontSize: BUTTON_SIZES.normal,
|
|
61
|
-
disabled: false,
|
|
62
61
|
onClick: () => {
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
|
-
const
|
|
64
|
+
const DSStepperButtonPropTypes = {
|
|
65
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
66
66
|
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
67
|
-
chevron: import_ds_props_helpers.PropTypes.oneOf(["left", "right", null]).description("Chevron icon position, if null/undefined no chevron will be shown").defaultValue(null),
|
|
68
|
-
fontSize: import_ds_props_helpers.PropTypes.oneOf(["normal", "large"]).description("Label size, used for marking last step").defaultValue("normal"),
|
|
67
|
+
chevron: import_ds_props_helpers.PropTypes.oneOf(["left", "right", null]).description("Chevron icon position, if null/undefined no chevron will be shown.").defaultValue(null),
|
|
68
|
+
fontSize: import_ds_props_helpers.PropTypes.oneOf(["normal", "large"]).description("Label size, used for marking last step.").defaultValue("normal"),
|
|
69
69
|
innerRef: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.object, import_ds_props_helpers.PropTypes.func]).description("Inner ref to button component."),
|
|
70
70
|
disabled: import_ds_props_helpers.PropTypes.bool.description("Adds disabled state."),
|
|
71
|
-
onClick: import_ds_props_helpers.PropTypes.func.description("OnClick callback handler.").defaultValue("()=>{}"),
|
|
72
|
-
label: import_ds_props_helpers.PropTypes.string.description("Text Label
|
|
71
|
+
onClick: import_ds_props_helpers.PropTypes.func.description("OnClick callback handler.").defaultValue("() => {}"),
|
|
72
|
+
label: import_ds_props_helpers.PropTypes.string.description("Text Label. This only accepts text, no custom JSX.").isRequired,
|
|
73
|
+
"data-testid": import_ds_props_helpers.PropTypes.string.description("Root element data-testid")
|
|
73
74
|
};
|
|
74
|
-
|
|
75
|
+
const DSStepperButtonPropTypesSchema = DSStepperButtonPropTypes;
|
|
76
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport type { ValidationMap, GlobalAttributesT, DSPropTypesSchema, XstyledProps } from '@elliemae/ds-props-helpers';\n\n// Stepper\nexport declare namespace DSStepperT {\n export interface RequiredProps {\n steps: number;\n visited: number[] | readonly number[];\n }\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n current?: number;\n 'data-testid'?: string;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof OptionalProps | keyof RequiredProps>,\n OptionalProps,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof OptionalProps | keyof RequiredProps>,\n OptionalProps,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const stepperDefaultProps: DSStepperT.DefaultProps = {};\n\nexport const DSStepperPropTypes: DSPropTypesSchema<DSStepperT.Props> = {\n ...xstyledPropTypes,\n ...globalAttributesPropTypes,\n steps: PropTypes.number.description('Number of steps.').isRequired,\n current: PropTypes.number.description('Index of active step.'),\n visited: PropTypes.arrayOf(PropTypes.number).description('Array of visited steps.').isRequired,\n 'data-testid': PropTypes.string.description('Root element data-testid.'),\n};\n\nexport const DSStepperPropTypesSchema = DSStepperPropTypes as unknown as ValidationMap<DSStepperT.Props>;\n\n// Stepper Button\nconst BUTTON_SIZES = {\n normal: 'normal',\n large: 'large',\n} as const;\n\nexport type ButtonSizesT = (typeof BUTTON_SIZES)[keyof typeof BUTTON_SIZES];\n\nconst CHEVRON_TYPE = {\n left: 'left',\n right: 'right',\n} as const;\n\ntype ChevronT = (typeof CHEVRON_TYPE)[keyof typeof CHEVRON_TYPE];\n\nexport declare namespace DSStepperButtonT {\n export interface RequiredProps {\n label: string;\n }\n\n export interface DefaultProps {\n fontSize: ButtonSizesT;\n onClick: (e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;\n }\n\n export interface OptionalProps {\n chevron?: ChevronT;\n disabled?: boolean;\n innerRef?: React.MutableRefObject<HTMLButtonElement> | ((_ref: HTMLButtonElement) => void);\n 'data-testid'?: string;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n OptionalProps,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n OptionalProps,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const DSStepperButtonDefaultProps: DSStepperButtonT.DefaultProps = {\n fontSize: BUTTON_SIZES.normal,\n onClick: () => {},\n};\n\nexport const DSStepperButtonPropTypes: DSPropTypesSchema<DSStepperButtonT.Props> = {\n ...xstyledPropTypes,\n ...globalAttributesPropTypes,\n chevron: PropTypes.oneOf(['left', 'right', null])\n .description('Chevron icon position, if null/undefined no chevron will be shown.')\n .defaultValue(null),\n fontSize: PropTypes.oneOf(['normal', 'large'])\n .description('Label size, used for marking last step.')\n .defaultValue('normal'),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.'),\n disabled: PropTypes.bool.description('Adds disabled state.'),\n onClick: PropTypes.func.description('OnClick callback handler.').defaultValue('() => {}'),\n label: PropTypes.string.description('Text Label. This only accepts text, no custom JSX.').isRequired,\n 'data-testid': PropTypes.string.description('Root element data-testid'),\n};\n\nexport const DSStepperButtonPropTypesSchema =\n DSStepperButtonPropTypes as unknown as ValidationMap<DSStepperButtonT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAuE;AAgChE,MAAM,sBAA+C,CAAC;AAEtD,MAAM,qBAA0D;AAAA,EACrE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,kCAAU,OAAO,YAAY,kBAAkB,EAAE;AAAA,EACxD,SAAS,kCAAU,OAAO,YAAY,uBAAuB;AAAA,EAC7D,SAAS,kCAAU,QAAQ,kCAAU,MAAM,EAAE,YAAY,yBAAyB,EAAE;AAAA,EACpF,eAAe,kCAAU,OAAO,YAAY,2BAA2B;AACzE;AAEO,MAAM,2BAA2B;AAGxC,MAAM,eAAe;AAAA,EACnB,QAAQ;AAAA,EACR,OAAO;AACT;AAIA,MAAM,eAAe;AAAA,EACnB,MAAM;AAAA,EACN,OAAO;AACT;AAoCO,MAAM,8BAA6D;AAAA,EACxE,UAAU,aAAa;AAAA,EACvB,SAAS,MAAM;AAAA,EAAC;AAClB;AAEO,MAAM,2BAAsE;AAAA,EACjF,GAAG;AAAA,EACH,GAAG;AAAA,EACH,SAAS,kCAAU,MAAM,CAAC,QAAQ,SAAS,IAAI,CAAC,EAC7C,YAAY,oEAAoE,EAChF,aAAa,IAAI;AAAA,EACpB,UAAU,kCAAU,MAAM,CAAC,UAAU,OAAO,CAAC,EAC1C,YAAY,yCAAyC,EACrD,aAAa,QAAQ;AAAA,EACxB,UAAU,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,IAAI,CAAC,EAAE,YAAY,gCAAgC;AAAA,EAC9G,UAAU,kCAAU,KAAK,YAAY,sBAAsB;AAAA,EAC3D,SAAS,kCAAU,KAAK,YAAY,2BAA2B,EAAE,aAAa,UAAU;AAAA,EACxF,OAAO,kCAAU,OAAO,YAAY,oDAAoD,EAAE;AAAA,EAC1F,eAAe,kCAAU,OAAO,YAAY,0BAA0B;AACxE;AAEO,MAAM,iCACX;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/styled.js
CHANGED
|
@@ -39,10 +39,10 @@ var import_ds_system = require("@elliemae/ds-system");
|
|
|
39
39
|
var import_ds_button_v2 = require("@elliemae/ds-button-v2");
|
|
40
40
|
var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
|
|
41
41
|
const StepperWrapper = import_ds_system.styled.div`
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
display: grid;
|
|
43
|
+
align-items: center;
|
|
44
|
+
grid-template-columns: repeat(${(props) => props.steps}, 1fr);
|
|
45
|
+
column-gap: ${(props) => props.steps >= 8 ? props.theme.space.xxxs : props.theme.space.xxs};
|
|
46
46
|
`;
|
|
47
47
|
const Step = import_ds_system.styled.div`
|
|
48
48
|
display: grid;
|
package/dist/cjs/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styled.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,
|
|
4
|
+
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport { DSButtonV2, type DSButtonV2T } from '@elliemae/ds-button-v2';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSStepperT, ButtonSizesT } from './react-desc-prop-types.js';\n\nexport const StepperWrapper = styled.div`\n display: grid;\n align-items: center;\n grid-template-columns: repeat(${(props: DSStepperT.Props) => props.steps}, 1fr);\n column-gap: ${(props) => (props.steps >= 8 ? props.theme.space.xxxs : props.theme.space.xxs)};\n`;\n\ninterface StepProps {\n active: boolean;\n visited: boolean;\n}\n\nexport const Step = styled.div<StepProps>`\n display: grid;\n border-radius: 1px;\n height: ${(props) => (props.active ? '5px' : '3px')};\n background: ${(props) => (props.active || props.visited ? props.theme.colors.brand[700] : '#A9B1BE')};\n`;\n\nexport const Label = styled(SimpleTruncatedTooltipText)`\n position: relative;\n top: 1px;\n`;\n\nexport const StyledButton = styled(DSButtonV2)`\n white-space: nowrap;\n overflow: hidden;\n max-width: 100%;\n padding-left: ${(props) => props.theme.space.xxs};\n padding-right: ${(props) => props.theme.space.xxs};\n color: ${(props) => props.theme.colors.brand[600]};\n & > span:not(.em-ds-icon) {\n position: relative;\n top: ${(props: DSButtonV2T.Props & { fontSize: ButtonSizesT }) => (props.fontSize === 'large' ? '2px' : '1px')};\n font-size: ${(props: DSButtonV2T.Props & { fontSize: ButtonSizesT }) =>\n props.fontSize === 'large' ? '22px' : '18px'};\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,0BAA6C;AAC7C,uCAA2C;AAGpC,MAAM,iBAAiB,wBAAO;AAAA;AAAA;AAAA,kCAGH,CAAC,UAA4B,MAAM,KAAK;AAAA,gBAC1D,CAAC,UAAW,MAAM,SAAS,IAAI,MAAM,MAAM,MAAM,OAAO,MAAM,MAAM,MAAM,GAAI;AAAA;AAQvF,MAAM,OAAO,wBAAO;AAAA;AAAA;AAAA,YAGf,CAAC,UAAW,MAAM,SAAS,QAAQ,KAAM;AAAA,gBACrC,CAAC,UAAW,MAAM,UAAU,MAAM,UAAU,MAAM,MAAM,OAAO,MAAM,GAAG,IAAI,SAAU;AAAA;AAG/F,MAAM,YAAQ,yBAAO,2DAA0B;AAAA;AAAA;AAAA;AAK/C,MAAM,mBAAe,yBAAO,8BAAU;AAAA;AAAA;AAAA;AAAA,kBAI3B,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG;AAAA,mBAC/B,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG;AAAA,WACxC,CAAC,UAAU,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA,WAGxC,CAAC,UAA2D,MAAM,aAAa,UAAU,QAAQ,KAAM;AAAA,iBACjG,CAAC,UACZ,MAAM,aAAa,UAAU,SAAS,MAAM;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 React = __toESM(require("react"));
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import__ = require("../index.js");
|
|
28
|
+
const ref = (0, import_react.createRef)();
|
|
29
|
+
const testRequiredProps = {
|
|
30
|
+
label: ""
|
|
31
|
+
};
|
|
32
|
+
const testOptionalProps = {
|
|
33
|
+
chevron: "left",
|
|
34
|
+
disabled: false,
|
|
35
|
+
innerRef: ref,
|
|
36
|
+
"data-testid": ""
|
|
37
|
+
};
|
|
38
|
+
const testPartialDefaults = {};
|
|
39
|
+
const testProps = {
|
|
40
|
+
...testRequiredProps,
|
|
41
|
+
...testOptionalProps,
|
|
42
|
+
...testPartialDefaults
|
|
43
|
+
};
|
|
44
|
+
const testPropsAsSyntax = {
|
|
45
|
+
...testRequiredProps,
|
|
46
|
+
...testOptionalProps,
|
|
47
|
+
...testPartialDefaults
|
|
48
|
+
};
|
|
49
|
+
const testCompleteDefaults = {
|
|
50
|
+
fontSize: "normal",
|
|
51
|
+
onClick: () => {
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const testInternalProps = {
|
|
55
|
+
...testRequiredProps,
|
|
56
|
+
...testOptionalProps,
|
|
57
|
+
...testCompleteDefaults
|
|
58
|
+
};
|
|
59
|
+
const testInternalPropsAsSyntax = {
|
|
60
|
+
...testRequiredProps,
|
|
61
|
+
...testOptionalProps,
|
|
62
|
+
...testCompleteDefaults
|
|
63
|
+
};
|
|
64
|
+
const testExplicitDefinition = {
|
|
65
|
+
label: "",
|
|
66
|
+
fontSize: "normal",
|
|
67
|
+
onClick: () => {
|
|
68
|
+
},
|
|
69
|
+
chevron: "left",
|
|
70
|
+
disabled: false,
|
|
71
|
+
innerRef: ref,
|
|
72
|
+
"data-testid": ""
|
|
73
|
+
};
|
|
74
|
+
const testInferedTypeCompatibility = {
|
|
75
|
+
label: "",
|
|
76
|
+
fontSize: "normal",
|
|
77
|
+
onClick: () => {
|
|
78
|
+
},
|
|
79
|
+
chevron: "left",
|
|
80
|
+
disabled: false,
|
|
81
|
+
innerRef: ref,
|
|
82
|
+
"data-testid": ""
|
|
83
|
+
};
|
|
84
|
+
const testDefinitionAsConst = {
|
|
85
|
+
label: "",
|
|
86
|
+
fontSize: "normal",
|
|
87
|
+
onClick: () => {
|
|
88
|
+
},
|
|
89
|
+
chevron: "left",
|
|
90
|
+
disabled: false,
|
|
91
|
+
innerRef: ref,
|
|
92
|
+
"data-testid": ""
|
|
93
|
+
};
|
|
94
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSStepperButton, { ...testExplicitDefinition }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSStepperButton, { ...testInferedTypeCompatibility }),
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSStepperButton, { ...testDefinitionAsConst }),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
import__.DSStepperButton,
|
|
100
|
+
{
|
|
101
|
+
label: "",
|
|
102
|
+
fontSize: "normal",
|
|
103
|
+
onClick: () => {
|
|
104
|
+
},
|
|
105
|
+
chevron: "left",
|
|
106
|
+
disabled: false,
|
|
107
|
+
innerRef: ref,
|
|
108
|
+
"data-testid": ""
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] });
|
|
112
|
+
//# sourceMappingURL=typescript-stepper-button-valid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-stepper-button-valid.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { createRef } from 'react';\nimport { DSStepperButton } from '../index.js';\nimport type { DSStepperButtonT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSStepperButtonT.Props;\ntype ComponentPropsInternals = DSStepperButtonT.InternalProps;\ntype ComponentPropsDefaultProps = DSStepperButtonT.DefaultProps;\ntype ComponentPropsOptionalProps = DSStepperButtonT.OptionalProps;\ntype ComponentPropsRequiredProps = DSStepperButtonT.RequiredProps;\n\nconst ref = createRef() as React.MutableRefObject<HTMLButtonElement>;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n label: '',\n};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n chevron: 'left',\n disabled: false,\n innerRef: ref,\n 'data-testid': '',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n fontSize: 'normal',\n onClick: () => {},\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n label: '',\n fontSize: 'normal',\n onClick: () => {},\n chevron: 'left',\n disabled: false,\n innerRef: ref,\n 'data-testid': '',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n label: '',\n fontSize: 'normal',\n onClick: () => {},\n chevron: 'left',\n disabled: false,\n innerRef: ref,\n 'data-testid': '',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n label: '',\n fontSize: 'normal',\n onClick: () => {},\n chevron: 'left',\n disabled: false,\n innerRef: ref,\n 'data-testid': '',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSStepperButton {...testExplicitDefinition} />\n <DSStepperButton {...testInferedTypeCompatibility} />\n <DSStepperButton {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSStepperButton\n label=\"\"\n fontSize=\"normal\"\n onClick={() => {}}\n chevron=\"left\"\n disabled={false}\n innerRef={ref}\n data-testid=\"\"\n ></DSStepperButton>\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;AC4FrB;AA3FF,mBAA0B;AAC1B,eAAgC;AAUhC,MAAM,UAAM,wBAAU;AAEtB,MAAM,oBAAiD;AAAA,EACrD,OAAO;AACT;AAEA,MAAM,oBAAiD;AAAA,EACrD,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,eAAe;AACjB;AAIA,MAAM,sBAA2D,CAAC;AAElE,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,UAAU;AAAA,EACV,SAAS,MAAM;AAAA,EAAC;AAClB;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,eAAe;AACjB;AAGA,MAAM,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,eAAe;AACjB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,eAAe;AACjB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,4BAAiB,GAAG,wBAAwB;AAAA,EAC7C,4CAAC,4BAAiB,GAAG,8BAA8B;AAAA,EACnD,4CAAC,4BAAiB,GAAG,uBAAuB;AAAA,EAE5C;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,UAAS;AAAA,MACT,SAAS,MAAM;AAAA,MAAC;AAAA,MAChB,SAAQ;AAAA,MACR,UAAU;AAAA,MACV,UAAU;AAAA,MACV,eAAY;AAAA;AAAA,EACb;AAAA,GACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 React = __toESM(require("react"));
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import__ = require("../index.js");
|
|
27
|
+
const testRequiredProps = {
|
|
28
|
+
steps: 4,
|
|
29
|
+
visited: [1, 2]
|
|
30
|
+
};
|
|
31
|
+
const testOptionalProps = {
|
|
32
|
+
current: 2,
|
|
33
|
+
"data-testid": ""
|
|
34
|
+
};
|
|
35
|
+
const testPartialDefaults = {};
|
|
36
|
+
const testProps = {
|
|
37
|
+
...testRequiredProps,
|
|
38
|
+
...testOptionalProps,
|
|
39
|
+
...testPartialDefaults
|
|
40
|
+
};
|
|
41
|
+
const testPropsAsSyntax = {
|
|
42
|
+
...testRequiredProps,
|
|
43
|
+
...testOptionalProps,
|
|
44
|
+
...testPartialDefaults
|
|
45
|
+
};
|
|
46
|
+
const testCompleteDefaults = {};
|
|
47
|
+
const testInternalProps = {
|
|
48
|
+
...testRequiredProps,
|
|
49
|
+
...testOptionalProps,
|
|
50
|
+
...testCompleteDefaults
|
|
51
|
+
};
|
|
52
|
+
const testInternalPropsAsSyntax = {
|
|
53
|
+
...testRequiredProps,
|
|
54
|
+
...testOptionalProps,
|
|
55
|
+
...testCompleteDefaults
|
|
56
|
+
};
|
|
57
|
+
const testExplicitDefinition = {
|
|
58
|
+
steps: 4,
|
|
59
|
+
visited: [1, 2],
|
|
60
|
+
current: 2,
|
|
61
|
+
"data-testid": ""
|
|
62
|
+
};
|
|
63
|
+
const testInferedTypeCompatibility = {
|
|
64
|
+
steps: 4,
|
|
65
|
+
visited: [1, 2],
|
|
66
|
+
current: 2,
|
|
67
|
+
"data-testid": ""
|
|
68
|
+
};
|
|
69
|
+
const testDefinitionAsConst = {
|
|
70
|
+
steps: 4,
|
|
71
|
+
visited: [1, 2],
|
|
72
|
+
current: 2,
|
|
73
|
+
"data-testid": ""
|
|
74
|
+
};
|
|
75
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSStepper, { ...testExplicitDefinition }),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSStepper, { ...testInferedTypeCompatibility }),
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSStepper, { ...testDefinitionAsConst }),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSStepper, { steps: 4, visited: [1, 2], current: 2, "data-testid": "" })
|
|
80
|
+
] });
|
|
81
|
+
//# sourceMappingURL=typescript-stepper-valid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-stepper-valid.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSStepper } from '../index.js';\nimport type { DSStepperT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSStepperT.Props;\ntype ComponentPropsInternals = DSStepperT.InternalProps;\ntype ComponentPropsDefaultProps = DSStepperT.DefaultProps;\ntype ComponentPropsOptionalProps = DSStepperT.OptionalProps;\ntype ComponentPropsRequiredProps = DSStepperT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n steps: 4,\n visited: [1, 2],\n};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n current: 2,\n 'data-testid': '',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n steps: 4,\n visited: [1, 2],\n current: 2,\n 'data-testid': '',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n steps: 4,\n visited: [1, 2],\n current: 2,\n 'data-testid': '',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n steps: 4,\n visited: [1, 2],\n current: 2,\n 'data-testid': '',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSStepper {...testExplicitDefinition} />\n <DSStepper {...testInferedTypeCompatibility} />\n <DSStepper {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSStepper steps={4} visited={[1, 2]} current={2} data-testid=\"\"></DSStepper>\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;AC2ErB;AA1EF,eAA0B;AAU1B,MAAM,oBAAiD;AAAA,EACrD,OAAO;AAAA,EACP,SAAS,CAAC,GAAG,CAAC;AAChB;AACA,MAAM,oBAAiD;AAAA,EACrD,SAAS;AAAA,EACT,eAAe;AACjB;AAIA,MAAM,sBAA2D,CAAC;AAElE,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D,CAAC;AAEpE,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,OAAO;AAAA,EACP,SAAS,CAAC,GAAG,CAAC;AAAA,EACd,SAAS;AAAA,EACT,eAAe;AACjB;AAGA,MAAM,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,SAAS,CAAC,GAAG,CAAC;AAAA,EACd,SAAS;AAAA,EACT,eAAe;AACjB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,OAAO;AAAA,EACP,SAAS,CAAC,GAAG,CAAC;AAAA,EACd,SAAS;AAAA,EACT,eAAe;AACjB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,sBAAW,GAAG,wBAAwB;AAAA,EACvC,4CAAC,sBAAW,GAAG,8BAA8B;AAAA,EAC7C,4CAAC,sBAAW,GAAG,uBAAuB;AAAA,EAEtC,4CAAC,sBAAU,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,eAAY,IAAG;AAAA,GACnE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/Stepper.js
CHANGED
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
useValidateTypescriptPropTypes,
|
|
9
9
|
useGetGlobalAttributes
|
|
10
10
|
} from "@elliemae/ds-props-helpers";
|
|
11
|
-
import {
|
|
11
|
+
import { stepperDefaultProps, DSStepperPropTypesSchema, DSStepperPropTypes } from "./react-desc-prop-types.js";
|
|
12
12
|
import { Step, StepperWrapper } from "./styled.js";
|
|
13
13
|
import { DSStepperName } from "./DSStepperDefinitions.js";
|
|
14
14
|
const DSStepper = (props) => {
|
|
15
|
-
const propsWithDefaults = useMemoMergePropsWithDefault(props,
|
|
16
|
-
useValidateTypescriptPropTypes(propsWithDefaults,
|
|
15
|
+
const propsWithDefaults = useMemoMergePropsWithDefault(props, stepperDefaultProps);
|
|
16
|
+
useValidateTypescriptPropTypes(propsWithDefaults, DSStepperPropTypes, DSStepperName);
|
|
17
17
|
const { steps, current, visited } = propsWithDefaults;
|
|
18
18
|
const stepsArray = React2.useMemo(() => new Array(steps).fill(1), [steps]);
|
|
19
19
|
const globalAttributes = useGetGlobalAttributes(propsWithDefaults);
|
|
@@ -30,10 +30,10 @@ const DSStepper = (props) => {
|
|
|
30
30
|
)) });
|
|
31
31
|
};
|
|
32
32
|
DSStepper.displayName = DSStepperName;
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const DSStepperWithSchema = describe(DSStepper);
|
|
34
|
+
DSStepperWithSchema.propTypes = DSStepperPropTypesSchema;
|
|
35
35
|
export {
|
|
36
36
|
DSStepper,
|
|
37
|
-
|
|
37
|
+
DSStepperWithSchema
|
|
38
38
|
};
|
|
39
39
|
//# sourceMappingURL=Stepper.js.map
|
package/dist/esm/Stepper.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/Stepper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { uid } from 'uid';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n useGetGlobalAttributes,\n} from '@elliemae/ds-props-helpers';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACwBf;AAxBR,OAAOA,YAAW;AAClB,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { uid } from 'uid';\nimport {\n describe,\n useMemoMergePropsWithDefault,\n useValidateTypescriptPropTypes,\n useGetGlobalAttributes,\n} from '@elliemae/ds-props-helpers';\nimport type { DSStepperT } from './react-desc-prop-types.js';\nimport { stepperDefaultProps, DSStepperPropTypesSchema, DSStepperPropTypes } from './react-desc-prop-types.js';\nimport { Step, StepperWrapper } from './styled.js';\nimport { DSStepperName } from './DSStepperDefinitions.js';\n\nconst DSStepper = (props: DSStepperT.Props) => {\n const propsWithDefaults = useMemoMergePropsWithDefault<DSStepperT.InternalProps>(props, stepperDefaultProps);\n useValidateTypescriptPropTypes(propsWithDefaults, DSStepperPropTypes, DSStepperName);\n\n const { steps, current, visited } = propsWithDefaults;\n const stepsArray = React.useMemo(() => new Array(steps).fill(1) as number[], [steps]);\n const globalAttributes = useGetGlobalAttributes(propsWithDefaults);\n\n return (\n <StepperWrapper steps={steps} current={current} visited={visited} {...globalAttributes}>\n {stepsArray.map((item, index) => (\n <Step\n // eslint-disable-next-line react/no-array-index-key\n key={`${uid(4)}step-key-${index}`}\n active={current === index}\n visited={visited.includes(index)}\n data-testid={props['data-testid'] ? `${props['data-testid']}-step` : undefined}\n data-active={current === index}\n data-visited={visited.includes(index)}\n />\n ))}\n </StepperWrapper>\n );\n};\n\nDSStepper.displayName = DSStepperName;\nconst DSStepperWithSchema = describe(DSStepper);\nDSStepperWithSchema.propTypes = DSStepperPropTypesSchema;\n\nexport { DSStepper, DSStepperWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACwBf;AAxBR,OAAOA,YAAW;AAClB,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,qBAAqB,0BAA0B,0BAA0B;AAClF,SAAS,MAAM,sBAAsB;AACrC,SAAS,qBAAqB;AAE9B,MAAM,YAAY,CAAC,UAA4B;AAC7C,QAAM,oBAAoB,6BAAuD,OAAO,mBAAmB;AAC3G,iCAA+B,mBAAmB,oBAAoB,aAAa;AAEnF,QAAM,EAAE,OAAO,SAAS,QAAQ,IAAI;AACpC,QAAM,aAAaA,OAAM,QAAQ,MAAM,IAAI,MAAM,KAAK,EAAE,KAAK,CAAC,GAAe,CAAC,KAAK,CAAC;AACpF,QAAM,mBAAmB,uBAAuB,iBAAiB;AAEjE,SACE,oBAAC,kBAAe,OAAc,SAAkB,SAAmB,GAAG,kBACnE,qBAAW,IAAI,CAAC,MAAM,UACrB;AAAA,IAAC;AAAA;AAAA,MAGC,QAAQ,YAAY;AAAA,MACpB,SAAS,QAAQ,SAAS,KAAK;AAAA,MAC/B,eAAa,MAAM,aAAa,IAAI,GAAG,MAAM,aAAa,CAAC,UAAU;AAAA,MACrE,eAAa,YAAY;AAAA,MACzB,gBAAc,QAAQ,SAAS,KAAK;AAAA;AAAA,IAL/B,GAAG,IAAI,CAAC,CAAC,YAAY,KAAK;AAAA,EAMjC,CACD,GACH;AAEJ;AAEA,UAAU,cAAc;AACxB,MAAM,sBAAsB,SAAS,SAAS;AAC9C,oBAAoB,YAAY;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|