@elliemae/ds-progress-indicator 3.32.0-rc.2 → 3.32.0-rc.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/DSProgressIndicator.js +4 -4
- package/dist/cjs/DSProgressIndicator.js.map +2 -2
- package/dist/cjs/ProgressBar.js +1 -1
- package/dist/cjs/ProgressBar.js.map +2 -2
- package/dist/cjs/ProgressCounter.js +6 -1
- package/dist/cjs/ProgressCounter.js.map +2 -2
- package/dist/cjs/classedComponents.js +3 -1
- package/dist/cjs/classedComponents.js.map +2 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +28 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/typescript-testing/typescript-progress-indicator-valid.js +120 -0
- package/dist/cjs/typescript-testing/typescript-progress-indicator-valid.js.map +7 -0
- package/dist/cjs/utils.js.map +2 -2
- package/dist/esm/DSProgressIndicator.js +4 -4
- package/dist/esm/DSProgressIndicator.js.map +2 -2
- package/dist/esm/ProgressBar.js +1 -1
- package/dist/esm/ProgressBar.js.map +2 -2
- package/dist/esm/ProgressCounter.js +6 -1
- package/dist/esm/ProgressCounter.js.map +2 -2
- package/dist/esm/classedComponents.js +3 -1
- package/dist/esm/classedComponents.js.map +2 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +2 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/typescript-testing/typescript-progress-indicator-valid.js +97 -0
- package/dist/esm/typescript-testing/typescript-progress-indicator-valid.js.map +7 -0
- package/dist/esm/utils.js.map +2 -2
- package/dist/types/DSProgressIndicator.d.ts +15 -42
- package/dist/types/ProgressBar.d.ts +11 -5
- package/dist/types/ProgressCounter.d.ts +3 -9
- package/dist/types/classedComponents.d.ts +14 -4
- package/dist/types/index.d.ts +1 -0
- package/dist/types/react-desc-prop-types.d.ts +37 -0
- package/dist/types/typescript-testing/typescript-progress-indicator-valid.d.ts +1 -0
- package/dist/types/utils.d.ts +1 -1
- package/package.json +6 -8
@@ -43,12 +43,12 @@ var import_ProgressBar = __toESM(require("./ProgressBar.js"));
|
|
43
43
|
var import_classedComponents = require("./classedComponents.js");
|
44
44
|
const DSProgressIndicator = ({
|
45
45
|
containerProps = {},
|
46
|
-
innerRef
|
46
|
+
innerRef,
|
47
47
|
title = "",
|
48
|
-
counterRenderer
|
49
|
-
now =
|
48
|
+
counterRenderer,
|
49
|
+
now = 0,
|
50
50
|
min = 0,
|
51
|
-
max =
|
51
|
+
max = 0,
|
52
52
|
disabled = false,
|
53
53
|
segments = [],
|
54
54
|
style = {}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/DSProgressIndicator.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["/* eslint-disable react/no-array-index-key */\nimport React, { useMemo } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport { DSTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport Counter from './ProgressCounter.js';\nimport ProgressBar from './ProgressBar.js';\nimport { Title, Wrapper } from './classedComponents.js';\n\nconst DSProgressIndicator = ({\n containerProps = {},\n innerRef
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
4
|
+
"sourcesContent": ["/* eslint-disable react/no-array-index-key */\nimport React, { useMemo, type WeakValidationMap } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport { DSTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport Counter from './ProgressCounter.js';\nimport ProgressBar from './ProgressBar.js';\nimport { Title, Wrapper } from './classedComponents.js';\nimport type { DSProgressIndicatorT } from './react-desc-prop-types.js';\n\nconst DSProgressIndicator = ({\n containerProps = {},\n innerRef,\n title = '',\n counterRenderer,\n now = 0,\n min = 0,\n max = 0,\n disabled = false,\n segments = [],\n style = {},\n}: DSProgressIndicatorT.Props) => {\n const renderProgressBar = useMemo(\n () =>\n segments.length ? (\n <ProgressBar>\n {segments.map(\n (segmentProps, i) =>\n !(segmentProps.now < segmentProps.min) && <ProgressBar.Segment key={i} {...segmentProps} />,\n )}\n </ProgressBar>\n ) : (\n <ProgressBar max={max} min={min} now={now} />\n ),\n [segments, min, max, now],\n );\n\n return (\n <Wrapper ref={innerRef} aria-disabled={disabled} classProps={{ disabled }} {...containerProps} style={style}>\n <DSTruncatedTooltipText containerComponent={Title} value={title} />\n <Counter max={max} min={min} now={now} renderer={counterRenderer} />\n {renderProgressBar}\n </Wrapper>\n );\n};\n\nconst variants = ['default', 'success', 'warning', 'info', 'error'];\n\nconst progressIndicatorProps = {\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n innerRef: PropTypes.object.description('ref to the components container'),\n title: PropTypes.string.description('components title'),\n variant: PropTypes.oneOf(variants).description('Progress intent variation'),\n now: PropTypes.number.description('Total current value'),\n min: PropTypes.number.description('min value'),\n max: PropTypes.number.description('max value'),\n disabled: PropTypes.bool.description('Whether the progress indicator disabled or not').defaultValue(false),\n counterRenderer: PropTypes.func.description('Render a custom counter'),\n segments: PropTypes.array.description('An array of multiple progress objects'),\n style: PropTypes.object.description('css inline style'),\n} as WeakValidationMap<unknown>;\n\nDSProgressIndicator.propTypes = progressIndicatorProps;\nDSProgressIndicator.displayName = 'DSProgressIndicator';\nconst ProgressIndicatorWithSchema = describe(DSProgressIndicator);\nProgressIndicatorWithSchema.propTypes = progressIndicatorProps;\n\nDSProgressIndicator.ProgressBar = ProgressBar;\n\nexport { DSProgressIndicator, ProgressIndicatorWithSchema };\nexport default DSProgressIndicator;\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2BiC;AA1BxD,mBAAuD;AACvD,8BAAoC;AACpC,uCAAuC;AACvC,6BAAoB;AACpB,yBAAwB;AACxB,+BAA+B;AAG/B,MAAM,sBAAsB,CAAC;AAAA,EAC3B,iBAAiB,CAAC;AAAA,EAClB;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW,CAAC;AAAA,EACZ,QAAQ,CAAC;AACX,MAAkC;AAChC,QAAM,wBAAoB;AAAA,IACxB,MACE,SAAS,SACP,4CAAC,mBAAAA,SAAA,EACE,mBAAS;AAAA,MACR,CAAC,cAAc,MACb,EAAE,aAAa,MAAM,aAAa,QAAQ,4CAAC,mBAAAA,QAAY,SAAZ,EAA6B,GAAG,gBAAP,CAAqB;AAAA,IAC7F,GACF,IAEA,4CAAC,mBAAAA,SAAA,EAAY,KAAU,KAAU,KAAU;AAAA,IAE/C,CAAC,UAAU,KAAK,KAAK,GAAG;AAAA,EAC1B;AAEA,SACE,6CAAC,oCAAQ,KAAK,UAAU,iBAAe,UAAU,YAAY,EAAE,SAAS,GAAI,GAAG,gBAAgB,OAC7F;AAAA,gDAAC,2DAAuB,oBAAoB,gCAAO,OAAO,OAAO;AAAA,IACjE,4CAAC,uBAAAC,SAAA,EAAQ,KAAU,KAAU,KAAU,UAAU,iBAAiB;AAAA,IACjE;AAAA,KACH;AAEJ;AAEA,MAAM,WAAW,CAAC,WAAW,WAAW,WAAW,QAAQ,OAAO;AAElE,MAAM,yBAAyB;AAAA,EAC7B,gBAAgB,kCAAU,OAAO,YAAY,kDAAkD;AAAA,EAC/F,UAAU,kCAAU,OAAO,YAAY,iCAAiC;AAAA,EACxE,OAAO,kCAAU,OAAO,YAAY,kBAAkB;AAAA,EACtD,SAAS,kCAAU,MAAM,QAAQ,EAAE,YAAY,2BAA2B;AAAA,EAC1E,KAAK,kCAAU,OAAO,YAAY,qBAAqB;AAAA,EACvD,KAAK,kCAAU,OAAO,YAAY,WAAW;AAAA,EAC7C,KAAK,kCAAU,OAAO,YAAY,WAAW;AAAA,EAC7C,UAAU,kCAAU,KAAK,YAAY,gDAAgD,EAAE,aAAa,KAAK;AAAA,EACzG,iBAAiB,kCAAU,KAAK,YAAY,yBAAyB;AAAA,EACrE,UAAU,kCAAU,MAAM,YAAY,uCAAuC;AAAA,EAC7E,OAAO,kCAAU,OAAO,YAAY,kBAAkB;AACxD;AAEA,oBAAoB,YAAY;AAChC,oBAAoB,cAAc;AAClC,MAAM,kCAA8B,kCAAS,mBAAmB;AAChE,4BAA4B,YAAY;AAExC,oBAAoB,cAAc,mBAAAD;AAGlC,IAAO,8BAAQ;",
|
6
6
|
"names": ["ProgressBar", "Counter"]
|
7
7
|
}
|
package/dist/cjs/ProgressBar.js
CHANGED
@@ -36,7 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_prop_types = __toESM(require("prop-types"));
|
37
37
|
var import_utils = require("./utils.js");
|
38
38
|
var import_classedComponents = require("./classedComponents.js");
|
39
|
-
function useProgressTrait({ now =
|
39
|
+
function useProgressTrait({ now = 0, min = 0, max = 0 }) {
|
40
40
|
const percentage = (0, import_utils.getPercentage)(now, min, max);
|
41
41
|
return {
|
42
42
|
role: "progressbar",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/ProgressBar.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { getPercentage } from './utils.js';\nimport { ProgressBarProgress, ProgressBarStatusBar } from './classedComponents.js';\n\nfunction useProgressTrait({ now =
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwBd;AAvBT,wBAAsB;AACtB,mBAA8B;AAC9B,+BAA0D;AAE1D,SAAS,iBAAiB,EAAE,MAAM,
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { getPercentage } from './utils.js';\nimport { ProgressBarProgress, ProgressBarStatusBar } from './classedComponents.js';\n\nfunction useProgressTrait({ now = 0, min = 0, max = 0 }: { now?: number; min?: number; max?: number }) {\n const percentage = getPercentage(now, min, max);\n return {\n role: 'progressbar',\n 'aria-valuenow': now,\n 'aria-valuemin': min,\n 'aria-valuemax': max,\n 'aria-label': 'progress bar',\n style: {\n width: `${percentage}%`,\n },\n };\n}\n\nconst Progress = (props: { variant: string; now?: number; min?: number; max?: number }) => {\n const { variant = 'default' } = props;\n\n const progressTraitProps = useProgressTrait(props);\n\n return <ProgressBarProgress classProps={{ variant }} {...progressTraitProps} />;\n};\n\nconst ProgressBar = ({\n variant = 'default',\n now = undefined,\n min = undefined,\n max = undefined,\n children: progressSegments,\n}: {\n variant?: string;\n now?: number;\n min?: number;\n max?: number;\n children?: React.ReactNode;\n}) => (\n <ProgressBarStatusBar>\n {progressSegments || <Progress max={max} min={min} now={now} variant={variant} />}\n </ProgressBarStatusBar>\n);\n\nProgressBar.Segment = Progress;\n\nProgressBar.propTypes = {\n /** Progress intent variation */\n variant: PropTypes.oneOf(['default', 'success', 'warning', 'info', 'error']),\n /** Total current value */\n now: PropTypes.number,\n /** Min value */\n min: PropTypes.number,\n /** Total max */\n max: PropTypes.number,\n};\n\nexport default ProgressBar;\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwBd;AAvBT,wBAAsB;AACtB,mBAA8B;AAC9B,+BAA0D;AAE1D,SAAS,iBAAiB,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAiD;AACrG,QAAM,iBAAa,4BAAc,KAAK,KAAK,GAAG;AAC9C,SAAO;AAAA,IACL,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,OAAO;AAAA,MACL,OAAO,GAAG;AAAA,IACZ;AAAA,EACF;AACF;AAEA,MAAM,WAAW,CAAC,UAAyE;AACzF,QAAM,EAAE,UAAU,UAAU,IAAI;AAEhC,QAAM,qBAAqB,iBAAiB,KAAK;AAEjD,SAAO,4CAAC,gDAAoB,YAAY,EAAE,QAAQ,GAAI,GAAG,oBAAoB;AAC/E;AAEA,MAAM,cAAc,CAAC;AAAA,EACnB,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU;AACZ,MAOE,4CAAC,iDACE,8BAAoB,4CAAC,YAAS,KAAU,KAAU,KAAU,SAAkB,GACjF;AAGF,YAAY,UAAU;AAEtB,YAAY,YAAY;AAAA;AAAA,EAEtB,SAAS,kBAAAA,QAAU,MAAM,CAAC,WAAW,WAAW,WAAW,QAAQ,OAAO,CAAC;AAAA;AAAA,EAE3E,KAAK,kBAAAA,QAAU;AAAA;AAAA,EAEf,KAAK,kBAAAA,QAAU;AAAA;AAAA,EAEf,KAAK,kBAAAA,QAAU;AACjB;AAEA,IAAO,sBAAQ;",
|
6
6
|
"names": ["PropTypes"]
|
7
7
|
}
|
@@ -44,6 +44,11 @@ const renderers = {
|
|
44
44
|
default: defaultRenderer,
|
45
45
|
percentage: percentageRenderer
|
46
46
|
};
|
47
|
-
const ProgressCounter = ({
|
47
|
+
const ProgressCounter = ({
|
48
|
+
now,
|
49
|
+
max,
|
50
|
+
min,
|
51
|
+
renderer = renderers.default
|
52
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_classedComponents.ProgressIndicatorCounter, { children: renderer({ now, max, min }) });
|
48
53
|
var ProgressCounter_default = ProgressCounter;
|
49
54
|
//# sourceMappingURL=ProgressCounter.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/ProgressCounter.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { getPercentage } from './utils.js';\nimport { ProgressIndicatorCounter } from './classedComponents.js';\n\nconst defaultRenderer = ({ now, max, min }) => `${min || now} of ${max}`;\nconst percentageRenderer = ({ now, max, min }) => {\n const percentage = getPercentage(now, min, max);\n return `${percentage}%`;\n};\n\nconst renderers = {\n default: defaultRenderer,\n percentage: percentageRenderer,\n};\n\nconst ProgressCounter = ({
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { getPercentage } from './utils.js';\nimport { ProgressIndicatorCounter } from './classedComponents.js';\nimport type { DSProgressIndicatorT } from './react-desc-prop-types.js';\n\nconst defaultRenderer: DSProgressIndicatorT.DefaultRendererT = ({ now, max, min }) => `${min || now} of ${max}`;\n\nconst percentageRenderer = ({ now, max, min }: DSProgressIndicatorT.PercentageT) => {\n const percentage = getPercentage(now, min, max);\n return `${percentage}%`;\n};\n\nconst renderers = {\n default: defaultRenderer,\n percentage: percentageRenderer,\n};\n\nconst ProgressCounter = ({\n now,\n max,\n min,\n renderer = renderers.default,\n}: DSProgressIndicatorT.PercentageT & { renderer?: DSProgressIndicatorT.DefaultRendererT }) => (\n <ProgressIndicatorCounter>{renderer({ now, max, min })}</ProgressIndicatorCounter>\n);\n\nexport default ProgressCounter;\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADuBrB;AAtBF,mBAA8B;AAC9B,+BAAyC;AAGzC,MAAM,kBAAyD,CAAC,EAAE,KAAK,KAAK,IAAI,MAAM,GAAG,OAAO,UAAU;AAE1G,MAAM,qBAAqB,CAAC,EAAE,KAAK,KAAK,IAAI,MAAwC;AAClF,QAAM,iBAAa,4BAAc,KAAK,KAAK,GAAG;AAC9C,SAAO,GAAG;AACZ;AAEA,MAAM,YAAY;AAAA,EAChB,SAAS;AAAA,EACT,YAAY;AACd;AAEA,MAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW,UAAU;AACvB,MACE,4CAAC,qDAA0B,mBAAS,EAAE,KAAK,KAAK,IAAI,CAAC,GAAE;AAGzD,IAAO,0BAAQ;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -40,7 +40,9 @@ var React = __toESM(require("react"));
|
|
40
40
|
var import_ds_classnames = require("@elliemae/ds-classnames");
|
41
41
|
const blockName = "determinate-progress-indicator";
|
42
42
|
const progressBlockName = "progress-bar";
|
43
|
-
const Wrapper = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, null, ({ disabled }) => ({
|
43
|
+
const Wrapper = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, null, ({ disabled }) => ({
|
44
|
+
disabled
|
45
|
+
}));
|
44
46
|
const Title = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, "title");
|
45
47
|
const ProgressIndicatorCounter = (0, import_ds_classnames.aggregatedClasses)("span")(blockName, "counter");
|
46
48
|
const ProgressBarStatusBar = (0, import_ds_classnames.aggregatedClasses)("div")(progressBlockName);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/classedComponents.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nexport const blockName = 'determinate-progress-indicator';\nconst progressBlockName = 'progress-bar';\n\nexport const Wrapper = aggregatedClasses('div')(blockName, null, ({ disabled }) => ({
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,2BAAkC;AAE3B,MAAM,YAAY;AACzB,MAAM,oBAAoB;AAEnB,MAAM,
|
4
|
+
"sourcesContent": ["import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nexport const blockName = 'determinate-progress-indicator';\nconst progressBlockName = 'progress-bar';\n\nexport const Wrapper: React.ForwardRefExoticComponent<\n React.RefAttributes<unknown> & { children: React.ReactNode; style: object; classProps: object }\n> = aggregatedClasses('div')(blockName, null, ({ disabled }: { disabled: boolean }) => ({\n disabled,\n}));\n\nexport const Title = aggregatedClasses('div')(blockName, 'title');\n\nexport const ProgressIndicatorCounter: React.ForwardRefExoticComponent<\n React.RefAttributes<unknown> & { children: React.ReactNode }\n> = aggregatedClasses('span')(blockName, 'counter');\n\nexport const ProgressBarStatusBar: React.ForwardRefExoticComponent<\n React.RefAttributes<unknown> & { children: React.ReactNode }\n> = aggregatedClasses('div')(progressBlockName);\n\nexport const ProgressBarProgress: React.ForwardRefExoticComponent<\n React.RefAttributes<unknown> & { classProps: object }\n> = aggregatedClasses('div')(progressBlockName, 'progress', ({ variant }) => ({\n [variant]: true,\n}));\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,2BAAkC;AAE3B,MAAM,YAAY;AACzB,MAAM,oBAAoB;AAEnB,MAAM,cAET,wCAAkB,KAAK,EAAE,WAAW,MAAM,CAAC,EAAE,SAAS,OAA8B;AAAA,EACtF;AACF,EAAE;AAEK,MAAM,YAAQ,wCAAkB,KAAK,EAAE,WAAW,OAAO;AAEzD,MAAM,+BAET,wCAAkB,MAAM,EAAE,WAAW,SAAS;AAE3C,MAAM,2BAET,wCAAkB,KAAK,EAAE,iBAAiB;AAEvC,MAAM,0BAET,wCAAkB,KAAK,EAAE,mBAAmB,YAAY,CAAC,EAAE,QAAQ,OAAO;AAAA,EAC5E,CAAC,OAAO,GAAG;AACb,EAAE;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
@@ -34,5 +34,6 @@ __export(src_exports, {
|
|
34
34
|
module.exports = __toCommonJS(src_exports);
|
35
35
|
var React = __toESM(require("react"));
|
36
36
|
__reExport(src_exports, require("./DSProgressIndicator.js"), module.exports);
|
37
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
37
38
|
var import_DSProgressIndicator = __toESM(require("./DSProgressIndicator.js"));
|
38
39
|
//# 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": ["export * from './DSProgressIndicator.js';\nexport { default } from './DSProgressIndicator.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,qCAAd;AACA,iCAAwB;",
|
4
|
+
"sourcesContent": ["export * from './DSProgressIndicator.js';\nexport { type DSProgressIndicatorT } from './react-desc-prop-types.js';\nexport { default } from './DSProgressIndicator.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,qCAAd;AACA,mCAA0C;AAC1C,iCAAwB;",
|
6
6
|
"names": []
|
7
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 react_desc_prop_types_exports = {};
|
26
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
27
|
+
var React = __toESM(require("react"));
|
28
|
+
//# 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": ["export declare namespace DSProgressIndicatorT {\n export type PercentageT = {\n min: number;\n max: number;\n now: number;\n };\n\n export type DefaultRendererT = ({ now, max, min }: DSProgressIndicatorT.PercentageT) => string;\n\n export type VariantT = 'default' | 'success' | 'warning' | 'info' | 'error';\n\n export type SegmentsT = {\n length?: number;\n min: number;\n max: number;\n now: number;\n variant: VariantT;\n };\n\n export interface DefaultProps {\n title: string;\n innerRef: React.MutableRefObject<unknown>;\n counterRenderer: DefaultRendererT;\n min: number;\n disabled: boolean;\n segments: SegmentsT[] | readonly SegmentsT[];\n style: object;\n }\n\n export interface OptionalProps {\n containerProps?: { [key: string]: string };\n now?: number;\n max?: number;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps {}\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
6
|
+
"names": []
|
7
|
+
}
|
@@ -0,0 +1,120 @@
|
|
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 = __toESM(require("react"));
|
27
|
+
var import__ = require("../index.js");
|
28
|
+
const testOptionalProps = {
|
29
|
+
containerProps: { "data-testid": "" },
|
30
|
+
max: 100,
|
31
|
+
now: 10
|
32
|
+
};
|
33
|
+
const ref = import_react.default.createRef();
|
34
|
+
const testPartialDefaults = {
|
35
|
+
disabled: false,
|
36
|
+
min: 0,
|
37
|
+
style: { border: "1px solid red" }
|
38
|
+
};
|
39
|
+
const testProps = {
|
40
|
+
...testOptionalProps,
|
41
|
+
...testPartialDefaults
|
42
|
+
};
|
43
|
+
const testPropsAsSyntax = {
|
44
|
+
...testOptionalProps,
|
45
|
+
...testPartialDefaults
|
46
|
+
};
|
47
|
+
const testCompleteDefaults = {
|
48
|
+
counterRenderer: () => "",
|
49
|
+
disabled: false,
|
50
|
+
innerRef: ref,
|
51
|
+
min: 0,
|
52
|
+
segments: [],
|
53
|
+
style: {},
|
54
|
+
title: ""
|
55
|
+
};
|
56
|
+
const testInternalProps = {
|
57
|
+
...testOptionalProps,
|
58
|
+
...testCompleteDefaults
|
59
|
+
};
|
60
|
+
const testInternalPropsAsSyntax = {
|
61
|
+
...testOptionalProps,
|
62
|
+
...testCompleteDefaults
|
63
|
+
};
|
64
|
+
const testExplicitDefinition = {
|
65
|
+
counterRenderer: () => "",
|
66
|
+
disabled: false,
|
67
|
+
innerRef: ref,
|
68
|
+
min: 0,
|
69
|
+
segments: [],
|
70
|
+
style: {},
|
71
|
+
title: "",
|
72
|
+
containerProps: {},
|
73
|
+
max: 100,
|
74
|
+
now: 20
|
75
|
+
};
|
76
|
+
const testInferedTypeCompatibility = {
|
77
|
+
counterRenderer: () => "",
|
78
|
+
disabled: false,
|
79
|
+
innerRef: ref,
|
80
|
+
min: 0,
|
81
|
+
segments: [],
|
82
|
+
style: {},
|
83
|
+
title: "",
|
84
|
+
containerProps: {},
|
85
|
+
max: 100,
|
86
|
+
now: 20
|
87
|
+
};
|
88
|
+
const testDefinitionAsConst = {
|
89
|
+
counterRenderer: () => "",
|
90
|
+
disabled: false,
|
91
|
+
innerRef: ref,
|
92
|
+
min: 0,
|
93
|
+
segments: [],
|
94
|
+
style: {},
|
95
|
+
title: "",
|
96
|
+
containerProps: {},
|
97
|
+
max: 100,
|
98
|
+
now: 20
|
99
|
+
};
|
100
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSProgressIndicator, { ...testExplicitDefinition }),
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSProgressIndicator, { ...testInferedTypeCompatibility }),
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.DSProgressIndicator, { ...testDefinitionAsConst }),
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
105
|
+
import__.DSProgressIndicator,
|
106
|
+
{
|
107
|
+
counterRenderer: () => "",
|
108
|
+
disabled: true,
|
109
|
+
innerRef: ref,
|
110
|
+
min: 0,
|
111
|
+
segments: [],
|
112
|
+
style: {},
|
113
|
+
title: "",
|
114
|
+
containerProps: {},
|
115
|
+
max: 100,
|
116
|
+
now: 20
|
117
|
+
}
|
118
|
+
)
|
119
|
+
] });
|
120
|
+
//# sourceMappingURL=typescript-progress-indicator-valid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-progress-indicator-valid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport React from 'react';\nimport { DSProgressIndicator } from '../index.js';\nimport type { DSProgressIndicatorT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSProgressIndicatorT.Props;\ntype ComponentPropsInternals = DSProgressIndicatorT.InternalProps;\ntype ComponentPropsDefaultProps = DSProgressIndicatorT.DefaultProps;\ntype ComponentPropsOptionalProps = DSProgressIndicatorT.OptionalProps;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n containerProps: { 'data-testid': '' },\n max: 100,\n now: 10,\n};\n\nconst ref = React.createRef();\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 disabled: false,\n min: 0,\n style: { border: '1px solid red' },\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n counterRenderer: () => '',\n disabled: false,\n innerRef: ref,\n min: 0,\n segments: [],\n style: {},\n title: '',\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\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 counterRenderer: () => '',\n disabled: false,\n innerRef: ref,\n min: 0,\n segments: [],\n style: {},\n title: '',\n containerProps: {},\n max: 100,\n now: 20,\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 counterRenderer: () => '',\n disabled: false,\n innerRef: ref,\n min: 0,\n segments: [],\n style: {},\n title: '',\n containerProps: {},\n max: 100,\n now: 20,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n counterRenderer: () => '',\n disabled: false,\n innerRef: ref,\n min: 0,\n segments: [],\n style: {},\n title: '',\n containerProps: {},\n max: 100,\n now: 20,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSProgressIndicator {...testExplicitDefinition} />\n <DSProgressIndicator {...testInferedTypeCompatibility} />\n <DSProgressIndicator {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSProgressIndicator\n counterRenderer={() => ''}\n disabled\n innerRef={ref}\n min={0}\n segments={[]}\n style={{}}\n title=\"\"\n containerProps={{}}\n max={100}\n now={20}\n />\n </>\n);\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACoGrB;AAnGF,mBAAkB;AAClB,eAAoC;AASpC,MAAM,oBAAiD;AAAA,EACrD,gBAAgB,EAAE,eAAe,GAAG;AAAA,EACpC,KAAK;AAAA,EACL,KAAK;AACP;AAEA,MAAM,MAAM,aAAAA,QAAM,UAAU;AAI5B,MAAM,sBAA2D;AAAA,EAC/D,UAAU;AAAA,EACV,KAAK;AAAA,EACL,OAAO,EAAE,QAAQ,gBAAgB;AACnC;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,iBAAiB,MAAM;AAAA,EACvB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AAAA,EACR,OAAO;AACT;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,iBAAiB,MAAM;AAAA,EACvB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,CAAC;AAAA,EACjB,KAAK;AAAA,EACL,KAAK;AACP;AAGA,MAAM,+BAA+B;AAAA,EACnC,iBAAiB,MAAM;AAAA,EACvB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,CAAC;AAAA,EACjB,KAAK;AAAA,EACL,KAAK;AACP;AAEA,MAAM,wBAAwB;AAAA,EAC5B,iBAAiB,MAAM;AAAA,EACvB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,CAAC;AAAA,EACjB,KAAK;AAAA,EACL,KAAK;AACP;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,gCAAqB,GAAG,wBAAwB;AAAA,EACjD,4CAAC,gCAAqB,GAAG,8BAA8B;AAAA,EACvD,4CAAC,gCAAqB,GAAG,uBAAuB;AAAA,EAEhD;AAAA,IAAC;AAAA;AAAA,MACC,iBAAiB,MAAM;AAAA,MACvB,UAAQ;AAAA,MACR,UAAU;AAAA,MACV,KAAK;AAAA,MACL,UAAU,CAAC;AAAA,MACX,OAAO,CAAC;AAAA,MACR,OAAM;AAAA,MACN,gBAAgB,CAAC;AAAA,MACjB,KAAK;AAAA,MACL,KAAK;AAAA;AAAA,EACP;AAAA,GACF;",
|
6
|
+
"names": ["React"]
|
7
|
+
}
|
package/dist/cjs/utils.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/utils.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["export function getPercentage(now, min, max) {\n return ((now || min) / max) * 100;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,SAAS,cAAc,
|
4
|
+
"sourcesContent": ["export function getPercentage(now: number, min: number, max: number): number {\n return ((now || min) / max) * 100;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,SAAS,cAAc,KAAa,KAAa,KAAqB;AAC3E,UAAS,OAAO,OAAO,MAAO;AAChC;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -8,12 +8,12 @@ import ProgressBar from "./ProgressBar.js";
|
|
8
8
|
import { Title, Wrapper } from "./classedComponents.js";
|
9
9
|
const DSProgressIndicator = ({
|
10
10
|
containerProps = {},
|
11
|
-
innerRef
|
11
|
+
innerRef,
|
12
12
|
title = "",
|
13
|
-
counterRenderer
|
14
|
-
now =
|
13
|
+
counterRenderer,
|
14
|
+
now = 0,
|
15
15
|
min = 0,
|
16
|
-
max =
|
16
|
+
max = 0,
|
17
17
|
disabled = false,
|
18
18
|
segments = [],
|
19
19
|
style = {}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSProgressIndicator.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/no-array-index-key */\nimport React, { useMemo } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport { DSTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport Counter from './ProgressCounter.js';\nimport ProgressBar from './ProgressBar.js';\nimport { Title, Wrapper } from './classedComponents.js';\n\nconst DSProgressIndicator = ({\n containerProps = {},\n innerRef
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/no-array-index-key */\nimport React, { useMemo, type WeakValidationMap } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport { DSTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport Counter from './ProgressCounter.js';\nimport ProgressBar from './ProgressBar.js';\nimport { Title, Wrapper } from './classedComponents.js';\nimport type { DSProgressIndicatorT } from './react-desc-prop-types.js';\n\nconst DSProgressIndicator = ({\n containerProps = {},\n innerRef,\n title = '',\n counterRenderer,\n now = 0,\n min = 0,\n max = 0,\n disabled = false,\n segments = [],\n style = {},\n}: DSProgressIndicatorT.Props) => {\n const renderProgressBar = useMemo(\n () =>\n segments.length ? (\n <ProgressBar>\n {segments.map(\n (segmentProps, i) =>\n !(segmentProps.now < segmentProps.min) && <ProgressBar.Segment key={i} {...segmentProps} />,\n )}\n </ProgressBar>\n ) : (\n <ProgressBar max={max} min={min} now={now} />\n ),\n [segments, min, max, now],\n );\n\n return (\n <Wrapper ref={innerRef} aria-disabled={disabled} classProps={{ disabled }} {...containerProps} style={style}>\n <DSTruncatedTooltipText containerComponent={Title} value={title} />\n <Counter max={max} min={min} now={now} renderer={counterRenderer} />\n {renderProgressBar}\n </Wrapper>\n );\n};\n\nconst variants = ['default', 'success', 'warning', 'info', 'error'];\n\nconst progressIndicatorProps = {\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n innerRef: PropTypes.object.description('ref to the components container'),\n title: PropTypes.string.description('components title'),\n variant: PropTypes.oneOf(variants).description('Progress intent variation'),\n now: PropTypes.number.description('Total current value'),\n min: PropTypes.number.description('min value'),\n max: PropTypes.number.description('max value'),\n disabled: PropTypes.bool.description('Whether the progress indicator disabled or not').defaultValue(false),\n counterRenderer: PropTypes.func.description('Render a custom counter'),\n segments: PropTypes.array.description('An array of multiple progress objects'),\n style: PropTypes.object.description('css inline style'),\n} as WeakValidationMap<unknown>;\n\nDSProgressIndicator.propTypes = progressIndicatorProps;\nDSProgressIndicator.displayName = 'DSProgressIndicator';\nconst ProgressIndicatorWithSchema = describe(DSProgressIndicator);\nProgressIndicatorWithSchema.propTypes = progressIndicatorProps;\n\nDSProgressIndicator.ProgressBar = ProgressBar;\n\nexport { DSProgressIndicator, ProgressIndicatorWithSchema };\nexport default DSProgressIndicator;\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC2BiC,cAUpD,YAVoD;AA1BxD,SAAgB,eAAuC;AACvD,SAAS,UAAU,iBAAiB;AACpC,SAAS,8BAA8B;AACvC,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,SAAS,OAAO,eAAe;AAG/B,MAAM,sBAAsB,CAAC;AAAA,EAC3B,iBAAiB,CAAC;AAAA,EAClB;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,WAAW;AAAA,EACX,WAAW,CAAC;AAAA,EACZ,QAAQ,CAAC;AACX,MAAkC;AAChC,QAAM,oBAAoB;AAAA,IACxB,MACE,SAAS,SACP,oBAAC,eACE,mBAAS;AAAA,MACR,CAAC,cAAc,MACb,EAAE,aAAa,MAAM,aAAa,QAAQ,oBAAC,YAAY,SAAZ,EAA6B,GAAG,gBAAP,CAAqB;AAAA,IAC7F,GACF,IAEA,oBAAC,eAAY,KAAU,KAAU,KAAU;AAAA,IAE/C,CAAC,UAAU,KAAK,KAAK,GAAG;AAAA,EAC1B;AAEA,SACE,qBAAC,WAAQ,KAAK,UAAU,iBAAe,UAAU,YAAY,EAAE,SAAS,GAAI,GAAG,gBAAgB,OAC7F;AAAA,wBAAC,0BAAuB,oBAAoB,OAAO,OAAO,OAAO;AAAA,IACjE,oBAAC,WAAQ,KAAU,KAAU,KAAU,UAAU,iBAAiB;AAAA,IACjE;AAAA,KACH;AAEJ;AAEA,MAAM,WAAW,CAAC,WAAW,WAAW,WAAW,QAAQ,OAAO;AAElE,MAAM,yBAAyB;AAAA,EAC7B,gBAAgB,UAAU,OAAO,YAAY,kDAAkD;AAAA,EAC/F,UAAU,UAAU,OAAO,YAAY,iCAAiC;AAAA,EACxE,OAAO,UAAU,OAAO,YAAY,kBAAkB;AAAA,EACtD,SAAS,UAAU,MAAM,QAAQ,EAAE,YAAY,2BAA2B;AAAA,EAC1E,KAAK,UAAU,OAAO,YAAY,qBAAqB;AAAA,EACvD,KAAK,UAAU,OAAO,YAAY,WAAW;AAAA,EAC7C,KAAK,UAAU,OAAO,YAAY,WAAW;AAAA,EAC7C,UAAU,UAAU,KAAK,YAAY,gDAAgD,EAAE,aAAa,KAAK;AAAA,EACzG,iBAAiB,UAAU,KAAK,YAAY,yBAAyB;AAAA,EACrE,UAAU,UAAU,MAAM,YAAY,uCAAuC;AAAA,EAC7E,OAAO,UAAU,OAAO,YAAY,kBAAkB;AACxD;AAEA,oBAAoB,YAAY;AAChC,oBAAoB,cAAc;AAClC,MAAM,8BAA8B,SAAS,mBAAmB;AAChE,4BAA4B,YAAY;AAExC,oBAAoB,cAAc;AAGlC,IAAO,8BAAQ;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/dist/esm/ProgressBar.js
CHANGED
@@ -3,7 +3,7 @@ import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import PropTypes from "prop-types";
|
4
4
|
import { getPercentage } from "./utils.js";
|
5
5
|
import { ProgressBarProgress, ProgressBarStatusBar } from "./classedComponents.js";
|
6
|
-
function useProgressTrait({ now =
|
6
|
+
function useProgressTrait({ now = 0, min = 0, max = 0 }) {
|
7
7
|
const percentage = getPercentage(now, min, max);
|
8
8
|
return {
|
9
9
|
role: "progressbar",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/ProgressBar.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { getPercentage } from './utils.js';\nimport { ProgressBarProgress, ProgressBarStatusBar } from './classedComponents.js';\n\nfunction useProgressTrait({ now =
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACwBd;AAvBT,OAAO,eAAe;AACtB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB,4BAA4B;AAE1D,SAAS,iBAAiB,EAAE,MAAM,
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { getPercentage } from './utils.js';\nimport { ProgressBarProgress, ProgressBarStatusBar } from './classedComponents.js';\n\nfunction useProgressTrait({ now = 0, min = 0, max = 0 }: { now?: number; min?: number; max?: number }) {\n const percentage = getPercentage(now, min, max);\n return {\n role: 'progressbar',\n 'aria-valuenow': now,\n 'aria-valuemin': min,\n 'aria-valuemax': max,\n 'aria-label': 'progress bar',\n style: {\n width: `${percentage}%`,\n },\n };\n}\n\nconst Progress = (props: { variant: string; now?: number; min?: number; max?: number }) => {\n const { variant = 'default' } = props;\n\n const progressTraitProps = useProgressTrait(props);\n\n return <ProgressBarProgress classProps={{ variant }} {...progressTraitProps} />;\n};\n\nconst ProgressBar = ({\n variant = 'default',\n now = undefined,\n min = undefined,\n max = undefined,\n children: progressSegments,\n}: {\n variant?: string;\n now?: number;\n min?: number;\n max?: number;\n children?: React.ReactNode;\n}) => (\n <ProgressBarStatusBar>\n {progressSegments || <Progress max={max} min={min} now={now} variant={variant} />}\n </ProgressBarStatusBar>\n);\n\nProgressBar.Segment = Progress;\n\nProgressBar.propTypes = {\n /** Progress intent variation */\n variant: PropTypes.oneOf(['default', 'success', 'warning', 'info', 'error']),\n /** Total current value */\n now: PropTypes.number,\n /** Min value */\n min: PropTypes.number,\n /** Total max */\n max: PropTypes.number,\n};\n\nexport default ProgressBar;\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACwBd;AAvBT,OAAO,eAAe;AACtB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB,4BAA4B;AAE1D,SAAS,iBAAiB,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAiD;AACrG,QAAM,aAAa,cAAc,KAAK,KAAK,GAAG;AAC9C,SAAO;AAAA,IACL,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,OAAO;AAAA,MACL,OAAO,GAAG;AAAA,IACZ;AAAA,EACF;AACF;AAEA,MAAM,WAAW,CAAC,UAAyE;AACzF,QAAM,EAAE,UAAU,UAAU,IAAI;AAEhC,QAAM,qBAAqB,iBAAiB,KAAK;AAEjD,SAAO,oBAAC,uBAAoB,YAAY,EAAE,QAAQ,GAAI,GAAG,oBAAoB;AAC/E;AAEA,MAAM,cAAc,CAAC;AAAA,EACnB,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,UAAU;AACZ,MAOE,oBAAC,wBACE,8BAAoB,oBAAC,YAAS,KAAU,KAAU,KAAU,SAAkB,GACjF;AAGF,YAAY,UAAU;AAEtB,YAAY,YAAY;AAAA;AAAA,EAEtB,SAAS,UAAU,MAAM,CAAC,WAAW,WAAW,WAAW,QAAQ,OAAO,CAAC;AAAA;AAAA,EAE3E,KAAK,UAAU;AAAA;AAAA,EAEf,KAAK,UAAU;AAAA;AAAA,EAEf,KAAK,UAAU;AACjB;AAEA,IAAO,sBAAQ;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -11,7 +11,12 @@ const renderers = {
|
|
11
11
|
default: defaultRenderer,
|
12
12
|
percentage: percentageRenderer
|
13
13
|
};
|
14
|
-
const ProgressCounter = ({
|
14
|
+
const ProgressCounter = ({
|
15
|
+
now,
|
16
|
+
max,
|
17
|
+
min,
|
18
|
+
renderer = renderers.default
|
19
|
+
}) => /* @__PURE__ */ jsx(ProgressIndicatorCounter, { children: renderer({ now, max, min }) });
|
15
20
|
var ProgressCounter_default = ProgressCounter;
|
16
21
|
export {
|
17
22
|
ProgressCounter_default as default
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/ProgressCounter.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { getPercentage } from './utils.js';\nimport { ProgressIndicatorCounter } from './classedComponents.js';\n\nconst defaultRenderer = ({ now, max, min }) => `${min || now} of ${max}`;\nconst percentageRenderer = ({ now, max, min }) => {\n const percentage = getPercentage(now, min, max);\n return `${percentage}%`;\n};\n\nconst renderers = {\n default: defaultRenderer,\n percentage: percentageRenderer,\n};\n\nconst ProgressCounter = ({
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { getPercentage } from './utils.js';\nimport { ProgressIndicatorCounter } from './classedComponents.js';\nimport type { DSProgressIndicatorT } from './react-desc-prop-types.js';\n\nconst defaultRenderer: DSProgressIndicatorT.DefaultRendererT = ({ now, max, min }) => `${min || now} of ${max}`;\n\nconst percentageRenderer = ({ now, max, min }: DSProgressIndicatorT.PercentageT) => {\n const percentage = getPercentage(now, min, max);\n return `${percentage}%`;\n};\n\nconst renderers = {\n default: defaultRenderer,\n percentage: percentageRenderer,\n};\n\nconst ProgressCounter = ({\n now,\n max,\n min,\n renderer = renderers.default,\n}: DSProgressIndicatorT.PercentageT & { renderer?: DSProgressIndicatorT.DefaultRendererT }) => (\n <ProgressIndicatorCounter>{renderer({ now, max, min })}</ProgressIndicatorCounter>\n);\n\nexport default ProgressCounter;\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACuBrB;AAtBF,SAAS,qBAAqB;AAC9B,SAAS,gCAAgC;AAGzC,MAAM,kBAAyD,CAAC,EAAE,KAAK,KAAK,IAAI,MAAM,GAAG,OAAO,UAAU;AAE1G,MAAM,qBAAqB,CAAC,EAAE,KAAK,KAAK,IAAI,MAAwC;AAClF,QAAM,aAAa,cAAc,KAAK,KAAK,GAAG;AAC9C,SAAO,GAAG;AACZ;AAEA,MAAM,YAAY;AAAA,EAChB,SAAS;AAAA,EACT,YAAY;AACd;AAEA,MAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW,UAAU;AACvB,MACE,oBAAC,4BAA0B,mBAAS,EAAE,KAAK,KAAK,IAAI,CAAC,GAAE;AAGzD,IAAO,0BAAQ;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -2,7 +2,9 @@ import * as React from "react";
|
|
2
2
|
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
3
3
|
const blockName = "determinate-progress-indicator";
|
4
4
|
const progressBlockName = "progress-bar";
|
5
|
-
const Wrapper = aggregatedClasses("div")(blockName, null, ({ disabled }) => ({
|
5
|
+
const Wrapper = aggregatedClasses("div")(blockName, null, ({ disabled }) => ({
|
6
|
+
disabled
|
7
|
+
}));
|
6
8
|
const Title = aggregatedClasses("div")(blockName, "title");
|
7
9
|
const ProgressIndicatorCounter = aggregatedClasses("span")(blockName, "counter");
|
8
10
|
const ProgressBarStatusBar = aggregatedClasses("div")(progressBlockName);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/classedComponents.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nexport const blockName = 'determinate-progress-indicator';\nconst progressBlockName = 'progress-bar';\n\nexport const Wrapper = aggregatedClasses('div')(blockName, null, ({ disabled }) => ({
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,yBAAyB;AAE3B,MAAM,YAAY;AACzB,MAAM,oBAAoB;AAEnB,MAAM,
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { aggregatedClasses } from '@elliemae/ds-classnames';\n\nexport const blockName = 'determinate-progress-indicator';\nconst progressBlockName = 'progress-bar';\n\nexport const Wrapper: React.ForwardRefExoticComponent<\n React.RefAttributes<unknown> & { children: React.ReactNode; style: object; classProps: object }\n> = aggregatedClasses('div')(blockName, null, ({ disabled }: { disabled: boolean }) => ({\n disabled,\n}));\n\nexport const Title = aggregatedClasses('div')(blockName, 'title');\n\nexport const ProgressIndicatorCounter: React.ForwardRefExoticComponent<\n React.RefAttributes<unknown> & { children: React.ReactNode }\n> = aggregatedClasses('span')(blockName, 'counter');\n\nexport const ProgressBarStatusBar: React.ForwardRefExoticComponent<\n React.RefAttributes<unknown> & { children: React.ReactNode }\n> = aggregatedClasses('div')(progressBlockName);\n\nexport const ProgressBarProgress: React.ForwardRefExoticComponent<\n React.RefAttributes<unknown> & { classProps: object }\n> = aggregatedClasses('div')(progressBlockName, 'progress', ({ variant }) => ({\n [variant]: true,\n}));\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,yBAAyB;AAE3B,MAAM,YAAY;AACzB,MAAM,oBAAoB;AAEnB,MAAM,UAET,kBAAkB,KAAK,EAAE,WAAW,MAAM,CAAC,EAAE,SAAS,OAA8B;AAAA,EACtF;AACF,EAAE;AAEK,MAAM,QAAQ,kBAAkB,KAAK,EAAE,WAAW,OAAO;AAEzD,MAAM,2BAET,kBAAkB,MAAM,EAAE,WAAW,SAAS;AAE3C,MAAM,uBAET,kBAAkB,KAAK,EAAE,iBAAiB;AAEvC,MAAM,sBAET,kBAAkB,KAAK,EAAE,mBAAmB,YAAY,CAAC,EAAE,QAAQ,OAAO;AAAA,EAC5E,CAAC,OAAO,GAAG;AACb,EAAE;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSProgressIndicator.js';\nexport { default } from './DSProgressIndicator.js';\n"],
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,SAAS,WAAAA,gBAAe;",
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSProgressIndicator.js';\nexport { type DSProgressIndicatorT } from './react-desc-prop-types.js';\nexport { default } from './DSProgressIndicator.js';\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,eAA0C;AAC1C,SAAS,WAAAA,gBAAe;",
|
6
6
|
"names": ["default"]
|
7
7
|
}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
3
|
+
import React2 from "react";
|
4
|
+
import { DSProgressIndicator } from "../index.js";
|
5
|
+
const testOptionalProps = {
|
6
|
+
containerProps: { "data-testid": "" },
|
7
|
+
max: 100,
|
8
|
+
now: 10
|
9
|
+
};
|
10
|
+
const ref = React2.createRef();
|
11
|
+
const testPartialDefaults = {
|
12
|
+
disabled: false,
|
13
|
+
min: 0,
|
14
|
+
style: { border: "1px solid red" }
|
15
|
+
};
|
16
|
+
const testProps = {
|
17
|
+
...testOptionalProps,
|
18
|
+
...testPartialDefaults
|
19
|
+
};
|
20
|
+
const testPropsAsSyntax = {
|
21
|
+
...testOptionalProps,
|
22
|
+
...testPartialDefaults
|
23
|
+
};
|
24
|
+
const testCompleteDefaults = {
|
25
|
+
counterRenderer: () => "",
|
26
|
+
disabled: false,
|
27
|
+
innerRef: ref,
|
28
|
+
min: 0,
|
29
|
+
segments: [],
|
30
|
+
style: {},
|
31
|
+
title: ""
|
32
|
+
};
|
33
|
+
const testInternalProps = {
|
34
|
+
...testOptionalProps,
|
35
|
+
...testCompleteDefaults
|
36
|
+
};
|
37
|
+
const testInternalPropsAsSyntax = {
|
38
|
+
...testOptionalProps,
|
39
|
+
...testCompleteDefaults
|
40
|
+
};
|
41
|
+
const testExplicitDefinition = {
|
42
|
+
counterRenderer: () => "",
|
43
|
+
disabled: false,
|
44
|
+
innerRef: ref,
|
45
|
+
min: 0,
|
46
|
+
segments: [],
|
47
|
+
style: {},
|
48
|
+
title: "",
|
49
|
+
containerProps: {},
|
50
|
+
max: 100,
|
51
|
+
now: 20
|
52
|
+
};
|
53
|
+
const testInferedTypeCompatibility = {
|
54
|
+
counterRenderer: () => "",
|
55
|
+
disabled: false,
|
56
|
+
innerRef: ref,
|
57
|
+
min: 0,
|
58
|
+
segments: [],
|
59
|
+
style: {},
|
60
|
+
title: "",
|
61
|
+
containerProps: {},
|
62
|
+
max: 100,
|
63
|
+
now: 20
|
64
|
+
};
|
65
|
+
const testDefinitionAsConst = {
|
66
|
+
counterRenderer: () => "",
|
67
|
+
disabled: false,
|
68
|
+
innerRef: ref,
|
69
|
+
min: 0,
|
70
|
+
segments: [],
|
71
|
+
style: {},
|
72
|
+
title: "",
|
73
|
+
containerProps: {},
|
74
|
+
max: 100,
|
75
|
+
now: 20
|
76
|
+
};
|
77
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
78
|
+
/* @__PURE__ */ jsx(DSProgressIndicator, { ...testExplicitDefinition }),
|
79
|
+
/* @__PURE__ */ jsx(DSProgressIndicator, { ...testInferedTypeCompatibility }),
|
80
|
+
/* @__PURE__ */ jsx(DSProgressIndicator, { ...testDefinitionAsConst }),
|
81
|
+
/* @__PURE__ */ jsx(
|
82
|
+
DSProgressIndicator,
|
83
|
+
{
|
84
|
+
counterRenderer: () => "",
|
85
|
+
disabled: true,
|
86
|
+
innerRef: ref,
|
87
|
+
min: 0,
|
88
|
+
segments: [],
|
89
|
+
style: {},
|
90
|
+
title: "",
|
91
|
+
containerProps: {},
|
92
|
+
max: 100,
|
93
|
+
now: 20
|
94
|
+
}
|
95
|
+
)
|
96
|
+
] });
|
97
|
+
//# sourceMappingURL=typescript-progress-indicator-valid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-progress-indicator-valid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport React from 'react';\nimport { DSProgressIndicator } from '../index.js';\nimport type { DSProgressIndicatorT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSProgressIndicatorT.Props;\ntype ComponentPropsInternals = DSProgressIndicatorT.InternalProps;\ntype ComponentPropsDefaultProps = DSProgressIndicatorT.DefaultProps;\ntype ComponentPropsOptionalProps = DSProgressIndicatorT.OptionalProps;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n containerProps: { 'data-testid': '' },\n max: 100,\n now: 10,\n};\n\nconst ref = React.createRef();\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 disabled: false,\n min: 0,\n style: { border: '1px solid red' },\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n counterRenderer: () => '',\n disabled: false,\n innerRef: ref,\n min: 0,\n segments: [],\n style: {},\n title: '',\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\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 counterRenderer: () => '',\n disabled: false,\n innerRef: ref,\n min: 0,\n segments: [],\n style: {},\n title: '',\n containerProps: {},\n max: 100,\n now: 20,\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 counterRenderer: () => '',\n disabled: false,\n innerRef: ref,\n min: 0,\n segments: [],\n style: {},\n title: '',\n containerProps: {},\n max: 100,\n now: 20,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n counterRenderer: () => '',\n disabled: false,\n innerRef: ref,\n min: 0,\n segments: [],\n style: {},\n title: '',\n containerProps: {},\n max: 100,\n now: 20,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSProgressIndicator {...testExplicitDefinition} />\n <DSProgressIndicator {...testInferedTypeCompatibility} />\n <DSProgressIndicator {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSProgressIndicator\n counterRenderer={() => ''}\n disabled\n innerRef={ref}\n min={0}\n segments={[]}\n style={{}}\n title=\"\"\n containerProps={{}}\n max={100}\n now={20}\n />\n </>\n);\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoGrB,mBAEE,KAFF;AAnGF,OAAOA,YAAW;AAClB,SAAS,2BAA2B;AASpC,MAAM,oBAAiD;AAAA,EACrD,gBAAgB,EAAE,eAAe,GAAG;AAAA,EACpC,KAAK;AAAA,EACL,KAAK;AACP;AAEA,MAAM,MAAMA,OAAM,UAAU;AAI5B,MAAM,sBAA2D;AAAA,EAC/D,UAAU;AAAA,EACV,KAAK;AAAA,EACL,OAAO,EAAE,QAAQ,gBAAgB;AACnC;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,iBAAiB,MAAM;AAAA,EACvB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AAAA,EACR,OAAO;AACT;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,iBAAiB,MAAM;AAAA,EACvB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,CAAC;AAAA,EACjB,KAAK;AAAA,EACL,KAAK;AACP;AAGA,MAAM,+BAA+B;AAAA,EACnC,iBAAiB,MAAM;AAAA,EACvB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,CAAC;AAAA,EACjB,KAAK;AAAA,EACL,KAAK;AACP;AAEA,MAAM,wBAAwB;AAAA,EAC5B,iBAAiB,MAAM;AAAA,EACvB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AAAA,EACR,OAAO;AAAA,EACP,gBAAgB,CAAC;AAAA,EACjB,KAAK;AAAA,EACL,KAAK;AACP;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,uBAAqB,GAAG,wBAAwB;AAAA,EACjD,oBAAC,uBAAqB,GAAG,8BAA8B;AAAA,EACvD,oBAAC,uBAAqB,GAAG,uBAAuB;AAAA,EAEhD;AAAA,IAAC;AAAA;AAAA,MACC,iBAAiB,MAAM;AAAA,MACvB,UAAQ;AAAA,MACR,UAAU;AAAA,MACV,KAAK;AAAA,MACL,UAAU,CAAC;AAAA,MACX,OAAO,CAAC;AAAA,MACR,OAAM;AAAA,MACN,gBAAgB,CAAC;AAAA,MACjB,KAAK;AAAA,MACL,KAAK;AAAA;AAAA,EACP;AAAA,GACF;",
|
6
|
+
"names": ["React"]
|
7
|
+
}
|
package/dist/esm/utils.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/utils.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export function getPercentage(now, min, max) {\n return ((now || min) / max) * 100;\n}\n"],
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAhB,SAAS,cAAc,
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export function getPercentage(now: number, min: number, max: number): number {\n return ((now || min) / max) * 100;\n}\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,SAAS,cAAc,KAAa,KAAa,KAAqB;AAC3E,UAAS,OAAO,OAAO,MAAO;AAChC;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -1,39 +1,23 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import type { DSProgressIndicatorT } from './react-desc-prop-types.js';
|
1
3
|
declare const DSProgressIndicator: {
|
2
|
-
({ containerProps, innerRef, title, counterRenderer, now, min, max, disabled, segments, style, }:
|
3
|
-
|
4
|
-
innerRef?: (() => null) | undefined;
|
5
|
-
title?: string | undefined;
|
6
|
-
counterRenderer?: undefined;
|
7
|
-
now?: undefined;
|
8
|
-
min?: number | undefined;
|
9
|
-
max?: undefined;
|
10
|
-
disabled?: boolean | undefined;
|
11
|
-
segments?: never[] | undefined;
|
12
|
-
style?: {} | undefined;
|
13
|
-
}): import("react/jsx-runtime.js").JSX.Element;
|
14
|
-
propTypes: {
|
15
|
-
containerProps: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
16
|
-
innerRef: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
17
|
-
title: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
18
|
-
variant: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
19
|
-
now: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
20
|
-
min: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
21
|
-
max: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
22
|
-
disabled: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
23
|
-
counterRenderer: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
24
|
-
segments: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
25
|
-
style: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").ReactDescT;
|
26
|
-
};
|
4
|
+
({ containerProps, innerRef, title, counterRenderer, now, min, max, disabled, segments, style, }: DSProgressIndicatorT.Props): import("react/jsx-runtime.js").JSX.Element;
|
5
|
+
propTypes: React.WeakValidationMap<unknown>;
|
27
6
|
displayName: string;
|
28
7
|
ProgressBar: {
|
29
8
|
({ variant, now, min, max, children: progressSegments, }: {
|
30
9
|
variant?: string | undefined;
|
31
|
-
now?: undefined;
|
32
|
-
min?: undefined;
|
33
|
-
max?: undefined;
|
34
|
-
children
|
10
|
+
now?: number | undefined;
|
11
|
+
min?: number | undefined;
|
12
|
+
max?: number | undefined;
|
13
|
+
children?: React.ReactNode;
|
35
14
|
}): import("react/jsx-runtime.js").JSX.Element;
|
36
|
-
Segment: (props:
|
15
|
+
Segment: (props: {
|
16
|
+
variant: string;
|
17
|
+
now?: number | undefined;
|
18
|
+
min?: number | undefined;
|
19
|
+
max?: number | undefined;
|
20
|
+
}) => import("react/jsx-runtime.js").JSX.Element;
|
37
21
|
propTypes: {
|
38
22
|
variant: import("prop-types").Requireable<string>;
|
39
23
|
now: import("prop-types").Requireable<number>;
|
@@ -42,17 +26,6 @@ declare const DSProgressIndicator: {
|
|
42
26
|
};
|
43
27
|
};
|
44
28
|
};
|
45
|
-
declare const ProgressIndicatorWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<
|
46
|
-
containerProps?: {} | undefined;
|
47
|
-
innerRef?: (() => null) | undefined;
|
48
|
-
title?: string | undefined;
|
49
|
-
counterRenderer?: undefined;
|
50
|
-
now?: undefined;
|
51
|
-
min?: number | undefined;
|
52
|
-
max?: undefined;
|
53
|
-
disabled?: boolean | undefined;
|
54
|
-
segments?: never[] | undefined;
|
55
|
-
style?: {} | undefined;
|
56
|
-
}>;
|
29
|
+
declare const ProgressIndicatorWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSProgressIndicatorT.Props>;
|
57
30
|
export { DSProgressIndicator, ProgressIndicatorWithSchema };
|
58
31
|
export default DSProgressIndicator;
|
@@ -1,13 +1,19 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
import PropTypes from 'prop-types';
|
2
3
|
declare const ProgressBar: {
|
3
4
|
({ variant, now, min, max, children: progressSegments, }: {
|
4
5
|
variant?: string | undefined;
|
5
|
-
now?: undefined;
|
6
|
-
min?: undefined;
|
7
|
-
max?: undefined;
|
8
|
-
children
|
6
|
+
now?: number | undefined;
|
7
|
+
min?: number | undefined;
|
8
|
+
max?: number | undefined;
|
9
|
+
children?: React.ReactNode;
|
9
10
|
}): import("react/jsx-runtime.js").JSX.Element;
|
10
|
-
Segment: (props:
|
11
|
+
Segment: (props: {
|
12
|
+
variant: string;
|
13
|
+
now?: number;
|
14
|
+
min?: number;
|
15
|
+
max?: number;
|
16
|
+
}) => import("react/jsx-runtime.js").JSX.Element;
|
11
17
|
propTypes: {
|
12
18
|
/** Progress intent variation */
|
13
19
|
variant: PropTypes.Requireable<string>;
|
@@ -1,11 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
min: any;
|
5
|
-
renderer?: (({ now, max, min }: {
|
6
|
-
now: any;
|
7
|
-
max: any;
|
8
|
-
min: any;
|
9
|
-
}) => string) | undefined;
|
1
|
+
import type { DSProgressIndicatorT } from './react-desc-prop-types.js';
|
2
|
+
declare const ProgressCounter: ({ now, max, min, renderer, }: DSProgressIndicatorT.PercentageT & {
|
3
|
+
renderer?: DSProgressIndicatorT.DefaultRendererT | undefined;
|
10
4
|
}) => import("react/jsx-runtime.js").JSX.Element;
|
11
5
|
export default ProgressCounter;
|
@@ -1,7 +1,17 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
export declare const blockName = "determinate-progress-indicator";
|
3
|
-
export declare const Wrapper:
|
3
|
+
export declare const Wrapper: React.ForwardRefExoticComponent<React.RefAttributes<unknown> & {
|
4
|
+
children: React.ReactNode;
|
5
|
+
style: object;
|
6
|
+
classProps: object;
|
7
|
+
}>;
|
4
8
|
export declare const Title: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
|
5
|
-
export declare const ProgressIndicatorCounter:
|
6
|
-
|
7
|
-
|
9
|
+
export declare const ProgressIndicatorCounter: React.ForwardRefExoticComponent<React.RefAttributes<unknown> & {
|
10
|
+
children: React.ReactNode;
|
11
|
+
}>;
|
12
|
+
export declare const ProgressBarStatusBar: React.ForwardRefExoticComponent<React.RefAttributes<unknown> & {
|
13
|
+
children: React.ReactNode;
|
14
|
+
}>;
|
15
|
+
export declare const ProgressBarProgress: React.ForwardRefExoticComponent<React.RefAttributes<unknown> & {
|
16
|
+
classProps: object;
|
17
|
+
}>;
|
package/dist/types/index.d.ts
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare namespace DSProgressIndicatorT {
|
3
|
+
type PercentageT = {
|
4
|
+
min: number;
|
5
|
+
max: number;
|
6
|
+
now: number;
|
7
|
+
};
|
8
|
+
type DefaultRendererT = ({ now, max, min }: DSProgressIndicatorT.PercentageT) => string;
|
9
|
+
type VariantT = 'default' | 'success' | 'warning' | 'info' | 'error';
|
10
|
+
type SegmentsT = {
|
11
|
+
length?: number;
|
12
|
+
min: number;
|
13
|
+
max: number;
|
14
|
+
now: number;
|
15
|
+
variant: VariantT;
|
16
|
+
};
|
17
|
+
interface DefaultProps {
|
18
|
+
title: string;
|
19
|
+
innerRef: React.MutableRefObject<unknown>;
|
20
|
+
counterRenderer: DefaultRendererT;
|
21
|
+
min: number;
|
22
|
+
disabled: boolean;
|
23
|
+
segments: SegmentsT[] | readonly SegmentsT[];
|
24
|
+
style: object;
|
25
|
+
}
|
26
|
+
interface OptionalProps {
|
27
|
+
containerProps?: {
|
28
|
+
[key: string]: string;
|
29
|
+
};
|
30
|
+
now?: number;
|
31
|
+
max?: number;
|
32
|
+
}
|
33
|
+
interface Props extends Partial<DefaultProps>, OptionalProps {
|
34
|
+
}
|
35
|
+
interface InternalProps extends DefaultProps, OptionalProps {
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/dist/types/utils.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare function getPercentage(now:
|
1
|
+
export declare function getPercentage(now: number, min: number, max: number): number;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@elliemae/ds-progress-indicator",
|
3
|
-
"version": "3.32.0-rc.
|
3
|
+
"version": "3.32.0-rc.4",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ICE MT - Dimsum - Progress Indicator",
|
6
6
|
"files": [
|
@@ -56,14 +56,14 @@
|
|
56
56
|
},
|
57
57
|
"dependencies": {
|
58
58
|
"prop-types": "~15.8.1",
|
59
|
-
"@elliemae/ds-classnames": "3.32.0-rc.
|
60
|
-
"@elliemae/ds-props-helpers": "3.32.0-rc.
|
61
|
-
"@elliemae/ds-truncated-tooltip-text": "3.32.0-rc.
|
59
|
+
"@elliemae/ds-classnames": "3.32.0-rc.4",
|
60
|
+
"@elliemae/ds-props-helpers": "3.32.0-rc.4",
|
61
|
+
"@elliemae/ds-truncated-tooltip-text": "3.32.0-rc.4"
|
62
62
|
},
|
63
63
|
"devDependencies": {
|
64
64
|
"@elliemae/pui-cli": "~9.0.0-next.31",
|
65
65
|
"styled-components": "~5.3.9",
|
66
|
-
"@elliemae/ds-monorepo-devops": "3.32.0-rc.
|
66
|
+
"@elliemae/ds-monorepo-devops": "3.32.0-rc.4"
|
67
67
|
},
|
68
68
|
"peerDependencies": {
|
69
69
|
"react": "^17.0.2",
|
@@ -71,7 +71,7 @@
|
|
71
71
|
},
|
72
72
|
"publishConfig": {
|
73
73
|
"access": "public",
|
74
|
-
"typeSafety":
|
74
|
+
"typeSafety": true
|
75
75
|
},
|
76
76
|
"scripts": {
|
77
77
|
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
@@ -80,8 +80,6 @@
|
|
80
80
|
"eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../../.eslintrc.js' src/",
|
81
81
|
"dts": "node ../../../scripts/dts.mjs",
|
82
82
|
"build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
|
83
|
-
"dev:build": "pnpm --filter {.}... build",
|
84
|
-
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
85
83
|
"checkDeps": "npm exec ../../util/ds-codemods -- check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
86
84
|
}
|
87
85
|
}
|