@elliemae/ds-progress-indicator 3.80.0-next.5 → 3.80.0-next.8
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/DSProgressIndicator.js +71 -37
- package/dist/cjs/DSProgressIndicator.js.map +2 -2
- package/dist/cjs/ProgressBar.js +62 -10
- package/dist/cjs/ProgressBar.js.map +2 -2
- package/dist/cjs/ProgressCounter.js +17 -8
- package/dist/cjs/ProgressCounter.js.map +2 -2
- package/dist/cjs/config/useProgressIndicator.js +67 -0
- package/dist/cjs/config/useProgressIndicator.js.map +7 -0
- package/dist/cjs/{classedComponents.js → config/useValidateProps.js} +10 -20
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants/index.js +50 -0
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/index.js +13 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +50 -0
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/styled.js +47 -2
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/typescript-testing/slot-props.js +40 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +7 -0
- package/dist/cjs/utils.js +14 -2
- package/dist/cjs/utils.js.map +2 -2
- package/dist/esm/DSProgressIndicator.js +73 -39
- package/dist/esm/DSProgressIndicator.js.map +2 -2
- package/dist/esm/ProgressBar.js +63 -11
- package/dist/esm/ProgressBar.js.map +2 -2
- package/dist/esm/ProgressCounter.js +18 -9
- package/dist/esm/ProgressCounter.js.map +2 -2
- package/dist/esm/config/useProgressIndicator.js +37 -0
- package/dist/esm/config/useProgressIndicator.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +10 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants/index.js +20 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/index.js +13 -1
- 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 +3 -3
- package/dist/esm/styled.js +47 -2
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/typescript-testing/slot-props.js +17 -0
- package/dist/esm/typescript-testing/slot-props.js.map +7 -0
- package/dist/esm/utils.js +14 -2
- package/dist/esm/utils.js.map +2 -2
- package/dist/types/DSProgressIndicator.d.ts +14 -3
- package/dist/types/ProgressBar.d.ts +13 -3
- package/dist/types/ProgressCounter.d.ts +3 -1
- package/dist/types/config/useProgressIndicator.d.ts +8 -0
- package/dist/types/config/useValidateProps.d.ts +3 -0
- package/dist/types/constants/index.d.ts +15 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/react-desc-prop-types.d.ts +34 -3
- package/dist/types/styled.d.ts +8 -0
- package/dist/types/utils.d.ts +10 -0
- package/package.json +6 -6
- package/dist/cjs/classedComponents.js.map +0 -7
- package/dist/esm/classedComponents.js +0 -20
- package/dist/esm/classedComponents.js.map +0 -7
- package/dist/types/classedComponents.d.ts +0 -15
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { useGetGlobalAttributes, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
|
|
4
|
+
import { DSProgressIndicatorPropTypes, defaultProps } from "../react-desc-prop-types.js";
|
|
5
|
+
import { useValidateProps } from "./useValidateProps.js";
|
|
6
|
+
import { hasValidRange } from "../utils.js";
|
|
7
|
+
import { DSProgressIndicatorName } from "../constants/index.js";
|
|
8
|
+
const useProgressIndicator = (propsFromUser) => {
|
|
9
|
+
const propsWithDefault = useMemoMergePropsWithDefault(
|
|
10
|
+
propsFromUser,
|
|
11
|
+
defaultProps
|
|
12
|
+
);
|
|
13
|
+
useValidateProps(propsWithDefault, DSProgressIndicatorPropTypes);
|
|
14
|
+
const { title, style, min, max, disabled, ...globalPropsWithoutConsumedKeywords } = propsWithDefault;
|
|
15
|
+
const globalProps = useGetGlobalAttributes(globalPropsWithoutConsumedKeywords);
|
|
16
|
+
const reactId = React2.useId();
|
|
17
|
+
const titleId = `ds-progress-indicator-title-${reactId}`;
|
|
18
|
+
React2.useEffect(() => {
|
|
19
|
+
if (!hasValidRange(min, max)) {
|
|
20
|
+
console.warn(
|
|
21
|
+
`Warning: ${DSProgressIndicatorName}:: "max" must be a finite number greater than "min" (received min=${String(min)}, max=${String(max)}). A determinate progress cannot be computed, so the progressbar is rendered as indeterminate.`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}, [min, max]);
|
|
25
|
+
return React2.useMemo(
|
|
26
|
+
() => ({
|
|
27
|
+
propsWithDefault,
|
|
28
|
+
globalProps,
|
|
29
|
+
titleId
|
|
30
|
+
}),
|
|
31
|
+
[propsWithDefault, globalProps, titleId]
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
useProgressIndicator
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=useProgressIndicator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useProgressIndicator.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useGetGlobalAttributes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport type { ValidationMap } from '@elliemae/ds-props-helpers';\nimport { type DSProgressIndicatorT, DSProgressIndicatorPropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\nimport { hasValidRange } from '../utils.js';\nimport { DSProgressIndicatorName } from '../constants/index.js';\n\nexport interface ProgressIndicatorCTX {\n propsWithDefault: DSProgressIndicatorT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n titleId: string;\n}\n\nexport const useProgressIndicator = (propsFromUser: DSProgressIndicatorT.Props): ProgressIndicatorCTX => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSProgressIndicatorT.InternalProps>(\n propsFromUser,\n defaultProps as unknown as Partial<DSProgressIndicatorT.InternalProps>,\n );\n useValidateProps(propsWithDefault, DSProgressIndicatorPropTypes as unknown as ValidationMap<unknown>);\n // =============================================================================\n // GLOBAL ATTRIBUTES\n // =============================================================================\n // These five props are consumed by this component but are also HTML global attributes, so spreading them\n // onto the root would emit attributes the component has never rendered: `title` would add a native browser\n // tooltip, `min`/`max`/`disabled` are not even valid on a div, and `style` is forwarded explicitly further\n // down. Everything else still flows through so consumers can reach the root with id/className/data-*/aria-*.\n const { title, style, min, max, disabled, ...globalPropsWithoutConsumedKeywords } = propsWithDefault;\n const globalProps = useGetGlobalAttributes(globalPropsWithoutConsumedKeywords);\n // =============================================================================\n // AD HOC PER COMPONENT LOGIC\n // =============================================================================\n // The progressbar takes its accessible name from the visible title via aria-labelledby, which needs a\n // stable unique id per instance. See the Accessibility Expert Validation doc for this component.\n const reactId = React.useId();\n const titleId = `ds-progress-indicator-title-${reactId}`;\n\n // `max` is functionally required for a determinate progress but stays optional in the public contract \u2014 making\n // it required would break every consumer that omits it today, at compile time for TS users and at render time\n // for JS users (PropTypes `isRequired` throws). So an invalid range renders safely as an indeterminate\n // progressbar, and this is the signal the consumer gets instead: a dev-only warning, once per range. It is\n // step 1 of the breaking-change protocol should `max` ever become required. PUI-18672.\n React.useEffect(() => {\n if (process.env.NODE_ENV !== 'production' && !hasValidRange(min, max)) {\n // eslint-disable-next-line no-console\n console.warn(\n `Warning: ${DSProgressIndicatorName}:: \"max\" must be a finite number greater than \"min\" (received min=${String(min)}, max=${String(max)}). A determinate progress cannot be computed, so the progressbar is rendered as indeterminate.`,\n );\n }\n }, [min, max]);\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n titleId,\n }),\n [propsWithDefault, globalProps, titleId],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,wBAAwB,oCAAoC;AAErE,SAAoC,8BAA8B,oBAAoB;AACtF,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,+BAA+B;AAQjC,MAAM,uBAAuB,CAAC,kBAAoE;AAIvG,QAAM,mBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AACA,mBAAiB,kBAAkB,4BAAiE;AAQpG,QAAM,EAAE,OAAO,OAAO,KAAK,KAAK,UAAU,GAAG,mCAAmC,IAAI;AACpF,QAAM,cAAc,uBAAuB,kCAAkC;AAM7E,QAAM,UAAUA,OAAM,MAAM;AAC5B,QAAM,UAAU,+BAA+B,OAAO;AAOtD,EAAAA,OAAM,UAAU,MAAM;AACpB,QAA6C,CAAC,cAAc,KAAK,GAAG,GAAG;AAErE,cAAQ;AAAA,QACN,YAAY,uBAAuB,qEAAqE,OAAO,GAAG,CAAC,SAAS,OAAO,GAAG,CAAC;AAAA,MACzI;AAAA,IACF;AAAA,EACF,GAAG,CAAC,KAAK,GAAG,CAAC;AAEb,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,aAAa,OAAO;AAAA,EACzC;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
|
|
3
|
+
import { DSProgressIndicatorName } from "../constants/index.js";
|
|
4
|
+
const useValidateProps = (props, propTypes) => {
|
|
5
|
+
useValidateTypescriptPropTypes(props, propTypes, DSProgressIndicatorName);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
useValidateProps
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useValidateProps.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport type { ValidationMap } from '@elliemae/ds-props-helpers';\nimport { type DSProgressIndicatorT } from '../react-desc-prop-types.js';\nimport { DSProgressIndicatorName } from '../constants/index.js';\n\nexport const useValidateProps = (\n props: DSProgressIndicatorT.InternalProps,\n propTypes: ValidationMap<unknown>,\n): void => {\n useValidateTypescriptPropTypes(props, propTypes, DSProgressIndicatorName);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,sCAAsC;AAG/C,SAAS,+BAA+B;AAEjC,MAAM,mBAAmB,CAC9B,OACA,cACS;AACT,iCAA+B,OAAO,WAAW,uBAAuB;AAC1E;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { slotObjectToDataTestIds } from "@elliemae/ds-system";
|
|
3
|
+
const DSProgressIndicatorName = "DSProgressindicator";
|
|
4
|
+
const PROGRESS_INDICATOR_SLOTS = {
|
|
5
|
+
ROOT: "root",
|
|
6
|
+
TITLE: "title",
|
|
7
|
+
COUNTER: "counter",
|
|
8
|
+
PROGRESS_BAR: "progress-bar",
|
|
9
|
+
PROGRESS: "progress"
|
|
10
|
+
};
|
|
11
|
+
const PROGRESS_INDICATOR_DATA_TESTID = slotObjectToDataTestIds(
|
|
12
|
+
DSProgressIndicatorName,
|
|
13
|
+
PROGRESS_INDICATOR_SLOTS
|
|
14
|
+
);
|
|
15
|
+
export {
|
|
16
|
+
DSProgressIndicatorName,
|
|
17
|
+
PROGRESS_INDICATOR_DATA_TESTID,
|
|
18
|
+
PROGRESS_INDICATOR_SLOTS
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSProgressIndicatorName = 'DSProgressindicator';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const PROGRESS_INDICATOR_SLOTS = {\n ROOT: 'root',\n TITLE: 'title',\n COUNTER: 'counter',\n PROGRESS_BAR: 'progress-bar',\n PROGRESS: 'progress',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const PROGRESS_INDICATOR_DATA_TESTID = slotObjectToDataTestIds(\n DSProgressIndicatorName,\n PROGRESS_INDICATOR_SLOTS,\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,0BAA0B;AAGhC,MAAM,2BAA2B;AAAA,EACtC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,cAAc;AAAA,EACd,UAAU;AACZ;AAGO,MAAM,iCAAiC;AAAA,EAC5C;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
import { DSProgressIndicator, ProgressIndicatorWithSchema } from "./DSProgressIndicator.js";
|
|
3
|
+
import {
|
|
4
|
+
DSProgressIndicatorName,
|
|
5
|
+
PROGRESS_INDICATOR_SLOTS,
|
|
6
|
+
PROGRESS_INDICATOR_DATA_TESTID
|
|
7
|
+
} from "./constants/index.js";
|
|
8
|
+
export {
|
|
9
|
+
DSProgressIndicator,
|
|
10
|
+
DSProgressIndicatorName,
|
|
11
|
+
PROGRESS_INDICATOR_DATA_TESTID,
|
|
12
|
+
PROGRESS_INDICATOR_SLOTS,
|
|
13
|
+
ProgressIndicatorWithSchema
|
|
14
|
+
};
|
|
3
15
|
//# sourceMappingURL=index.js.map
|
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
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSProgressIndicator, ProgressIndicatorWithSchema } from './DSProgressIndicator.js';\nexport { type DSProgressIndicatorT } from './react-desc-prop-types.js';\nexport {\n DSProgressIndicatorName,\n PROGRESS_INDICATOR_SLOTS,\n PROGRESS_INDICATOR_DATA_TESTID,\n} from './constants/index.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB,mCAAmC;AAEjE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,48 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PropTypes, getPropsPerSlotPropTypes, globalAttributesPropTypes } from "@elliemae/ds-props-helpers";
|
|
3
|
+
import { DSProgressIndicatorName, PROGRESS_INDICATOR_SLOTS } from "./constants/index.js";
|
|
4
|
+
const defaultProps = {
|
|
5
|
+
containerProps: {},
|
|
6
|
+
title: "",
|
|
7
|
+
now: 0,
|
|
8
|
+
min: 0,
|
|
9
|
+
max: 0,
|
|
10
|
+
disabled: false,
|
|
11
|
+
segments: [],
|
|
12
|
+
style: {}
|
|
13
|
+
};
|
|
14
|
+
const variants = ["default", "success", "warning", "info", "error"];
|
|
15
|
+
const DSProgressIndicatorPropTypes = {
|
|
16
|
+
...getPropsPerSlotPropTypes(DSProgressIndicatorName, PROGRESS_INDICATOR_SLOTS),
|
|
17
|
+
...globalAttributesPropTypes,
|
|
18
|
+
containerProps: PropTypes.object.description("Set of Properties attached to the main container"),
|
|
19
|
+
innerRef: PropTypes.object.description("ref to the components container"),
|
|
20
|
+
title: PropTypes.string.description("components title"),
|
|
21
|
+
variant: PropTypes.oneOf(variants).description("Progress intent variation"),
|
|
22
|
+
now: PropTypes.number.description("Total current value"),
|
|
23
|
+
min: PropTypes.number.description("min value"),
|
|
24
|
+
max: PropTypes.number.description(
|
|
25
|
+
'max value. Functionally required for a determinate progress: it must be a finite number greater than "min". Without it the progressbar renders as indeterminate and a dev-only warning is logged.'
|
|
26
|
+
),
|
|
27
|
+
disabled: PropTypes.bool.description("Whether the progress indicator disabled or not").defaultValue(false),
|
|
28
|
+
counterRenderer: PropTypes.func.description("Render a custom counter"),
|
|
29
|
+
segments: PropTypes.arrayOf(
|
|
30
|
+
PropTypes.shape({
|
|
31
|
+
min: PropTypes.number,
|
|
32
|
+
max: PropTypes.number,
|
|
33
|
+
now: PropTypes.number,
|
|
34
|
+
variant: PropTypes.oneOf(variants),
|
|
35
|
+
label: PropTypes.string
|
|
36
|
+
})
|
|
37
|
+
).description(
|
|
38
|
+
'An array of multiple progress objects. Give each segment a "label" when its "variant" colour carries meaning \u2014 without one every segment reports the same accessible name and can only be told apart by colour.'
|
|
39
|
+
),
|
|
40
|
+
style: PropTypes.object.description("css inline style")
|
|
41
|
+
};
|
|
42
|
+
const DSProgressIndicatorPropTypesSchema = DSProgressIndicatorPropTypes;
|
|
43
|
+
export {
|
|
44
|
+
DSProgressIndicatorPropTypes,
|
|
45
|
+
DSProgressIndicatorPropTypesSchema,
|
|
46
|
+
defaultProps
|
|
47
|
+
};
|
|
2
48
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;",
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSPropTypesSchema, GlobalAttributesT, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes, getPropsPerSlotPropTypes, globalAttributesPropTypes } from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSProgressIndicatorName, PROGRESS_INDICATOR_SLOTS } from './constants/index.js';\n\nexport 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 * Accessible name for this specific segment. Without it every segment inherits the same name from the\n * indicator title, so segments are told apart only by their variant colour. See PUI-18942.\n */\n label?: string;\n };\n\n export type SlotFunctionArguments = {\n dsProgressindicatorRoot: () => object;\n dsProgressindicatorTitle: () => object;\n dsProgressindicatorCounter: () => object;\n dsProgressindicatorProgressBar: () => object;\n dsProgressindicatorProgress: () => object;\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 extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSProgressIndicatorName,\n typeof PROGRESS_INDICATOR_SLOTS\n > {\n // deliberately wide: this has accepted arbitrary keys since PUI-12598 and consumers pass data-* through\n // it. Narrowing it to React.HTMLAttributes rejects data-* in object position \u2014 a breaking type change.\n containerProps?: { [key: string]: string };\n now?: number;\n max?: number;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof OptionalProps> {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof OptionalProps> {}\n}\n\nexport const defaultProps = {\n containerProps: {},\n title: '',\n now: 0,\n min: 0,\n max: 0,\n disabled: false,\n segments: [],\n style: {},\n};\n\nconst variants: DSProgressIndicatorT.VariantT[] = ['default', 'success', 'warning', 'info', 'error'];\n\n// `variant` is documented in the props table but the component neither accepts nor forwards it \u2014 it is absent\n// from `Props` on purpose so the TypeScript surface stays exactly as published. Removing it from the schema\n// would drop a documented prop from the portal; implementing it would change bar colours for anyone already\n// passing it. Both are out of scope here \u2014 tracked in KNOWN_INTENTIONAL_DEVIATIONS.md.\ntype DocumentedPropsSurface = DSProgressIndicatorT.Props & { variant?: DSProgressIndicatorT.VariantT };\n\nexport const DSProgressIndicatorPropTypes: DSPropTypesSchema<DocumentedPropsSurface> = {\n ...getPropsPerSlotPropTypes(DSProgressIndicatorName, PROGRESS_INDICATOR_SLOTS),\n ...globalAttributesPropTypes,\n\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(\n 'max value. Functionally required for a determinate progress: it must be a finite number greater than \"min\". Without it the progressbar renders as indeterminate and a dev-only warning is logged.',\n ),\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.arrayOf(\n PropTypes.shape({\n min: PropTypes.number,\n max: PropTypes.number,\n now: PropTypes.number,\n variant: PropTypes.oneOf(variants),\n label: PropTypes.string,\n }),\n ).description(\n 'An array of multiple progress objects. Give each segment a \"label\" when its \"variant\" colour carries meaning \u2014 without one every segment reports the same accessible name and can only be told apart by colour.',\n ),\n style: PropTypes.object.description('css inline style'),\n};\n\nexport const DSProgressIndicatorPropTypesSchema =\n DSProgressIndicatorPropTypes as unknown as ValidationMap<DSProgressIndicatorT.Props>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,WAAW,0BAA0B,iCAAiC;AAE/E,SAAS,yBAAyB,gCAAgC;AAoE3D,MAAM,eAAe;AAAA,EAC1B,gBAAgB,CAAC;AAAA,EACjB,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,UAAU;AAAA,EACV,UAAU,CAAC;AAAA,EACX,OAAO,CAAC;AACV;AAEA,MAAM,WAA4C,CAAC,WAAW,WAAW,WAAW,QAAQ,OAAO;AAQ5F,MAAM,+BAA0E;AAAA,EACrF,GAAG,yBAAyB,yBAAyB,wBAAwB;AAAA,EAC7E,GAAG;AAAA,EAEH,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;AAAA,IACpB;AAAA,EACF;AAAA,EACA,UAAU,UAAU,KAAK,YAAY,gDAAgD,EAAE,aAAa,KAAK;AAAA,EACzG,iBAAiB,UAAU,KAAK,YAAY,yBAAyB;AAAA,EACrE,UAAU,UAAU;AAAA,IAClB,UAAU,MAAM;AAAA,MACd,KAAK,UAAU;AAAA,MACf,KAAK,UAAU;AAAA,MACf,KAAK,UAAU;AAAA,MACf,SAAS,UAAU,MAAM,QAAQ;AAAA,MACjC,OAAO,UAAU;AAAA,IACnB,CAAC;AAAA,EACH,EAAE;AAAA,IACA;AAAA,EACF;AAAA,EACA,OAAO,UAAU,OAAO,YAAY,kBAAkB;AACxD;AAEO,MAAM,qCACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styled.js
CHANGED
|
@@ -1,9 +1,54 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { styled } from "@elliemae/ds-system";
|
|
3
|
-
|
|
3
|
+
import { DSProgressIndicatorName, PROGRESS_INDICATOR_SLOTS } from "./constants/index.js";
|
|
4
|
+
const LEGACY_ROOT_BLOCK = "em-ds-determinate-progress-indicator";
|
|
5
|
+
const LEGACY_BAR_BLOCK = "em-ds-progress-bar";
|
|
6
|
+
const joinClasses = (...classes) => [...new Set(classes.filter(Boolean))].join(" ");
|
|
7
|
+
const legacyRootClassName = (disabled, ...consumerClasses) => joinClasses(
|
|
8
|
+
LEGACY_ROOT_BLOCK,
|
|
9
|
+
`${LEGACY_ROOT_BLOCK}--default`,
|
|
10
|
+
disabled && `${LEGACY_ROOT_BLOCK}--disabled`,
|
|
11
|
+
...consumerClasses
|
|
12
|
+
);
|
|
13
|
+
const legacyCounterClassName = (...consumerClasses) => joinClasses(`${LEGACY_ROOT_BLOCK}__counter`, ...consumerClasses);
|
|
14
|
+
const legacyBarClassName = (...consumerClasses) => joinClasses(LEGACY_BAR_BLOCK, ...consumerClasses);
|
|
15
|
+
const legacyProgressClassName = (variant, ...consumerClasses) => joinClasses(
|
|
16
|
+
`${LEGACY_BAR_BLOCK}__progress`,
|
|
17
|
+
`${LEGACY_BAR_BLOCK}__progress--default`,
|
|
18
|
+
variant && `${LEGACY_BAR_BLOCK}__progress--${variant}`,
|
|
19
|
+
...consumerClasses
|
|
20
|
+
);
|
|
21
|
+
const StyledProgressIndicatorRoot = styled("div", {
|
|
22
|
+
name: DSProgressIndicatorName,
|
|
23
|
+
slot: PROGRESS_INDICATOR_SLOTS.ROOT
|
|
24
|
+
})``;
|
|
25
|
+
const Title = styled("span", {
|
|
26
|
+
name: DSProgressIndicatorName,
|
|
27
|
+
slot: PROGRESS_INDICATOR_SLOTS.TITLE
|
|
28
|
+
})`
|
|
4
29
|
grid-area: title;
|
|
5
30
|
`;
|
|
31
|
+
const StyledProgressIndicatorCounter = styled("span", {
|
|
32
|
+
name: DSProgressIndicatorName,
|
|
33
|
+
slot: PROGRESS_INDICATOR_SLOTS.COUNTER
|
|
34
|
+
})``;
|
|
35
|
+
const StyledProgressBar = styled("div", {
|
|
36
|
+
name: DSProgressIndicatorName,
|
|
37
|
+
slot: PROGRESS_INDICATOR_SLOTS.PROGRESS_BAR
|
|
38
|
+
})``;
|
|
39
|
+
const StyledProgress = styled("div", {
|
|
40
|
+
name: DSProgressIndicatorName,
|
|
41
|
+
slot: PROGRESS_INDICATOR_SLOTS.PROGRESS
|
|
42
|
+
})``;
|
|
6
43
|
export {
|
|
7
|
-
|
|
44
|
+
StyledProgress,
|
|
45
|
+
StyledProgressBar,
|
|
46
|
+
StyledProgressIndicatorCounter,
|
|
47
|
+
StyledProgressIndicatorRoot,
|
|
48
|
+
Title,
|
|
49
|
+
legacyBarClassName,
|
|
50
|
+
legacyCounterClassName,
|
|
51
|
+
legacyProgressClassName,
|
|
52
|
+
legacyRootClassName
|
|
8
53
|
};
|
|
9
54
|
//# sourceMappingURL=styled.js.map
|
package/dist/esm/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\n\nexport const Title = styled.
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { DSProgressIndicatorName, PROGRESS_INDICATOR_SLOTS } from './constants/index.js';\n\n// ============================================================================================================\n// Legacy BEM class contract\n// ============================================================================================================\n// This component carries no CSS of its own: its entire visual layer is the\n// `em-ds-determinate-progress-indicator` / `em-ds-progress-bar` SCSS compiled into `@elliemae/ds-basic`'s\n// dimsum.css, which is frozen. Consumers may also hold stylesheet overrides and QA selectors against these\n// exact names, so the class strings are a compatibility contract, not an implementation detail.\n//\n// They used to be produced by `aggregatedClasses` from the sunsetted `@elliemae/ds-classnames`. They are\n// reproduced verbatim here so that dependency could be dropped and the slot system put in its place without\n// a visual or breaking change. `DSProgressIndicator.api.test.js` locks the resulting class set per state.\n//\n// `--default` is reproduced deliberately and is not a typo: the legacy layout modifier pipeline emitted a\n// `--default` modifier unconditionally on every element that received `classProps`, which is why the root and\n// the progress fill carry it while the counter and the bar (which received none) do not.\n//\n// These are applied as an explicit `className` prop rather than through `.attrs()`, because `.attrs()` on\n// ds-system's `styled` is silently a no-op \u2014 it calls styled-components' immutable `.attrs()` and discards\n// the new resolver it returns (`styledFunction.tsx:173`). Do not \"simplify\" this back to `.attrs()`.\nconst LEGACY_ROOT_BLOCK = 'em-ds-determinate-progress-indicator';\nconst LEGACY_BAR_BLOCK = 'em-ds-progress-bar';\n\n// `aggregatedClasses` appended any consumer-supplied className after its own, so a className arriving through\n// containerProps adds to the contract rather than replacing it. That ordering is preserved.\nconst joinClasses = (...classes: (string | false | undefined)[]) =>\n [...new Set(classes.filter(Boolean) as string[])].join(' ');\n\nexport const legacyRootClassName = (disabled?: boolean, ...consumerClasses: (string | undefined)[]) =>\n joinClasses(\n LEGACY_ROOT_BLOCK,\n `${LEGACY_ROOT_BLOCK}--default`,\n disabled && `${LEGACY_ROOT_BLOCK}--disabled`,\n ...consumerClasses,\n );\n\nexport const legacyCounterClassName = (...consumerClasses: (string | undefined)[]) =>\n joinClasses(`${LEGACY_ROOT_BLOCK}__counter`, ...consumerClasses);\n\nexport const legacyBarClassName = (...consumerClasses: (string | undefined)[]) =>\n joinClasses(LEGACY_BAR_BLOCK, ...consumerClasses);\n\nexport const legacyProgressClassName = (variant?: string, ...consumerClasses: (string | undefined)[]) =>\n joinClasses(\n `${LEGACY_BAR_BLOCK}__progress`,\n `${LEGACY_BAR_BLOCK}__progress--default`,\n variant && `${LEGACY_BAR_BLOCK}__progress--${variant}`,\n ...consumerClasses,\n );\n\n// ============================================================================================================\n// Slots\n// ============================================================================================================\n\nexport const StyledProgressIndicatorRoot = styled('div', {\n name: DSProgressIndicatorName,\n slot: PROGRESS_INDICATOR_SLOTS.ROOT,\n})``;\n\nexport const Title = styled('span', {\n name: DSProgressIndicatorName,\n slot: PROGRESS_INDICATOR_SLOTS.TITLE,\n})`\n grid-area: title;\n`;\n\nexport const StyledProgressIndicatorCounter = styled('span', {\n name: DSProgressIndicatorName,\n slot: PROGRESS_INDICATOR_SLOTS.COUNTER,\n})``;\n\nexport const StyledProgressBar = styled('div', {\n name: DSProgressIndicatorName,\n slot: PROGRESS_INDICATOR_SLOTS.PROGRESS_BAR,\n})``;\n\nexport const StyledProgress = styled('div', {\n name: DSProgressIndicatorName,\n slot: PROGRESS_INDICATOR_SLOTS.PROGRESS,\n})``;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,yBAAyB,gCAAgC;AAqBlE,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AAIzB,MAAM,cAAc,IAAI,YACtB,CAAC,GAAG,IAAI,IAAI,QAAQ,OAAO,OAAO,CAAa,CAAC,EAAE,KAAK,GAAG;AAErD,MAAM,sBAAsB,CAAC,aAAuB,oBACzD;AAAA,EACE;AAAA,EACA,GAAG,iBAAiB;AAAA,EACpB,YAAY,GAAG,iBAAiB;AAAA,EAChC,GAAG;AACL;AAEK,MAAM,yBAAyB,IAAI,oBACxC,YAAY,GAAG,iBAAiB,aAAa,GAAG,eAAe;AAE1D,MAAM,qBAAqB,IAAI,oBACpC,YAAY,kBAAkB,GAAG,eAAe;AAE3C,MAAM,0BAA0B,CAAC,YAAqB,oBAC3D;AAAA,EACE,GAAG,gBAAgB;AAAA,EACnB,GAAG,gBAAgB;AAAA,EACnB,WAAW,GAAG,gBAAgB,eAAe,OAAO;AAAA,EACpD,GAAG;AACL;AAMK,MAAM,8BAA8B,OAAO,OAAO;AAAA,EACvD,MAAM;AAAA,EACN,MAAM,yBAAyB;AACjC,CAAC;AAEM,MAAM,QAAQ,OAAO,QAAQ;AAAA,EAClC,MAAM;AAAA,EACN,MAAM,yBAAyB;AACjC,CAAC;AAAA;AAAA;AAIM,MAAM,iCAAiC,OAAO,QAAQ;AAAA,EAC3D,MAAM;AAAA,EACN,MAAM,yBAAyB;AACjC,CAAC;AAEM,MAAM,oBAAoB,OAAO,OAAO;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,yBAAyB;AACjC,CAAC;AAEM,MAAM,iBAAiB,OAAO,OAAO;AAAA,EAC1C,MAAM;AAAA,EACN,MAAM,yBAAyB;AACjC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SlotPropsAsObject = {
|
|
3
|
+
dsProgressindicatorRoot: { "aria-label": "just a typescript test" },
|
|
4
|
+
dsProgressindicatorTitle: { "aria-label": "just a typescript test" },
|
|
5
|
+
dsProgressindicatorCounter: { "aria-label": "just a typescript test" },
|
|
6
|
+
dsProgressindicatorProgressBar: { "aria-label": "just a typescript test" },
|
|
7
|
+
dsProgressindicatorProgress: { "aria-label": "just a typescript test" }
|
|
8
|
+
};
|
|
9
|
+
const SlotPropsAsFunctions = {
|
|
10
|
+
dsProgressindicatorRoot: () => ({ "aria-label": "just a typescript test" }),
|
|
11
|
+
dsProgressindicatorTitle: () => ({ "aria-label": "just a typescript test" }),
|
|
12
|
+
dsProgressindicatorCounter: () => ({ "aria-label": "just a typescript test" }),
|
|
13
|
+
dsProgressindicatorProgressBar: () => ({ "aria-label": "just a typescript test" }),
|
|
14
|
+
dsProgressindicatorProgress: () => ({ "aria-label": "just a typescript test" })
|
|
15
|
+
};
|
|
16
|
+
const EnsureAllSlotsExistInSlotFunctionArguments = SlotPropsAsFunctions;
|
|
17
|
+
//# sourceMappingURL=slot-props.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/slot-props.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSProgressIndicatorName, PROGRESS_INDICATOR_SLOTS } from '../constants/index.js';\nimport type { DSProgressIndicatorT } from '../react-desc-prop-types.js';\n\nconst SlotPropsAsObject: Partial<DSProgressIndicatorT.Props> = {\n dsProgressindicatorRoot: { 'aria-label': 'just a typescript test' },\n dsProgressindicatorTitle: { 'aria-label': 'just a typescript test' },\n dsProgressindicatorCounter: { 'aria-label': 'just a typescript test' },\n dsProgressindicatorProgressBar: { 'aria-label': 'just a typescript test' },\n dsProgressindicatorProgress: { 'aria-label': 'just a typescript test' },\n};\n\nconst SlotPropsAsFunctions: DSProgressIndicatorT.SlotFunctionArguments = {\n dsProgressindicatorRoot: () => ({ 'aria-label': 'just a typescript test' }),\n dsProgressindicatorTitle: () => ({ 'aria-label': 'just a typescript test' }),\n dsProgressindicatorCounter: () => ({ 'aria-label': 'just a typescript test' }),\n dsProgressindicatorProgressBar: () => ({ 'aria-label': 'just a typescript test' }),\n dsProgressindicatorProgress: () => ({ 'aria-label': 'just a typescript test' }),\n};\n\n// Exhaustiveness check \u2014 fails compilation if a slot is missing from SlotFunctionArguments\nconst EnsureAllSlotsExistInSlotFunctionArguments: Required<\n TypescriptHelpersT.PropsForSlots<typeof DSProgressIndicatorName, typeof PROGRESS_INDICATOR_SLOTS>\n> = SlotPropsAsFunctions;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACKvB,MAAM,oBAAyD;AAAA,EAC7D,yBAAyB,EAAE,cAAc,yBAAyB;AAAA,EAClE,0BAA0B,EAAE,cAAc,yBAAyB;AAAA,EACnE,4BAA4B,EAAE,cAAc,yBAAyB;AAAA,EACrE,gCAAgC,EAAE,cAAc,yBAAyB;AAAA,EACzE,6BAA6B,EAAE,cAAc,yBAAyB;AACxE;AAEA,MAAM,uBAAmE;AAAA,EACvE,yBAAyB,OAAO,EAAE,cAAc,yBAAyB;AAAA,EACzE,0BAA0B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC1E,4BAA4B,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAC5E,gCAAgC,OAAO,EAAE,cAAc,yBAAyB;AAAA,EAChF,6BAA6B,OAAO,EAAE,cAAc,yBAAyB;AAC/E;AAGA,MAAM,6CAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
function hasValidRange(min, max) {
|
|
3
|
+
return typeof min === "number" && typeof max === "number" && Number.isFinite(min) && Number.isFinite(max) && max > min;
|
|
4
|
+
}
|
|
5
|
+
function clamp(value, lower, upper) {
|
|
6
|
+
if (!Number.isFinite(value)) return lower;
|
|
7
|
+
return Math.min(upper, Math.max(lower, value));
|
|
8
|
+
}
|
|
2
9
|
function getPercentage(now, min, max) {
|
|
3
|
-
|
|
10
|
+
if (!hasValidRange(min, max)) return 0;
|
|
11
|
+
return clamp((now || min) / max * 100, 0, 100);
|
|
4
12
|
}
|
|
13
|
+
const defaultCounterRenderer = ({ now, max, min }) => `${min || now} of ${max}`;
|
|
5
14
|
export {
|
|
6
|
-
|
|
15
|
+
clamp,
|
|
16
|
+
defaultCounterRenderer,
|
|
17
|
+
getPercentage,
|
|
18
|
+
hasValidRange
|
|
7
19
|
};
|
|
8
20
|
//# sourceMappingURL=utils.js.map
|
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", "
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSProgressIndicatorT } from './react-desc-prop-types.js';\n\n/**\n * A determinate progress is only meaningful over a real range: `max` must be finite and greater than `min`.\n * The default `max` is `0`, so a consumer who omits it lands here \u2014 as does a legitimately dynamic `max` that\n * starts at zero while data loads. Both used to produce `width: NaN%` and an invalid ARIA range\n * (aria-valuemax equal to aria-valuemin). Callers treat an invalid range as an indeterminate progress. PUI-18672.\n */\nexport function hasValidRange(min: unknown, max: unknown): boolean {\n // `unknown` on purpose: `max` is optional in the public contract, and a JS consumer can pass anything.\n return (\n typeof min === 'number' && typeof max === 'number' && Number.isFinite(min) && Number.isFinite(max) && max > min\n );\n}\n\nexport function clamp(value: number, lower: number, upper: number): number {\n if (!Number.isFinite(value)) return lower;\n return Math.min(upper, Math.max(lower, value));\n}\n\n// The `(now || min) / max` formula is legacy and deliberately untouched: it renders exactly what a valid range\n// always rendered, `min` offsets included. Only two things are new \u2014 an invalid range yields 0 instead of NaN,\n// and the result is clamped so `now > max` can no longer push the fill past 100% of its track.\nexport function getPercentage(now: number, min: number, max: number): number {\n if (!hasValidRange(min, max)) return 0;\n return clamp(((now || min) / max) * 100, 0, 100);\n}\n\n// Single source of truth for the counter text. The visible counter renders it, and every progressbar mirrors\n// it through aria-valuetext, so the two can never drift apart. Note `min || now` reads min where it should\n// read now \u2014 a pre-existing defect tracked in KNOWN_INTENTIONAL_DEVIATIONS.md (deviation 4). It is kept here\n// deliberately: aria-valuetext must match what sighted users see, so when the renderer is fixed both update.\nexport const defaultCounterRenderer: DSProgressIndicatorT.DefaultRendererT = ({ now, max, min }) =>\n `${min || now} of ${max}`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACQhB,SAAS,cAAc,KAAc,KAAuB;AAEjE,SACE,OAAO,QAAQ,YAAY,OAAO,QAAQ,YAAY,OAAO,SAAS,GAAG,KAAK,OAAO,SAAS,GAAG,KAAK,MAAM;AAEhH;AAEO,SAAS,MAAM,OAAe,OAAe,OAAuB;AACzE,MAAI,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACpC,SAAO,KAAK,IAAI,OAAO,KAAK,IAAI,OAAO,KAAK,CAAC;AAC/C;AAKO,SAAS,cAAc,KAAa,KAAa,KAAqB;AAC3E,MAAI,CAAC,cAAc,KAAK,GAAG,EAAG,QAAO;AACrC,SAAO,OAAQ,OAAO,OAAO,MAAO,KAAK,GAAG,GAAG;AACjD;AAMO,MAAM,yBAAgE,CAAC,EAAE,KAAK,KAAK,IAAI,MAC5F,GAAG,OAAO,GAAG,OAAO,GAAG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type DSProgressIndicatorT } from './react-desc-prop-types.js';
|
|
3
3
|
declare const DSProgressIndicator: {
|
|
4
|
-
(
|
|
4
|
+
(props: DSProgressIndicatorT.Props): React.JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
ProgressBar: {
|
|
7
|
-
({ variant, now, min, max, children: progressSegments, }: {
|
|
7
|
+
({ variant, now, min, max, labelledBy, valueTextRenderer, children: progressSegments, getOwnerProps, getOwnerPropsArguments, }: {
|
|
8
8
|
variant?: string;
|
|
9
9
|
now?: number;
|
|
10
10
|
min?: number;
|
|
11
11
|
max?: number;
|
|
12
|
+
labelledBy?: string;
|
|
12
13
|
children?: React.ReactNode;
|
|
14
|
+
valueTextRenderer?: DSProgressIndicatorT.DefaultRendererT;
|
|
15
|
+
} & {
|
|
16
|
+
getOwnerProps?: () => object;
|
|
17
|
+
getOwnerPropsArguments?: () => object;
|
|
13
18
|
}): React.JSX.Element;
|
|
14
19
|
Segment: (props: {
|
|
15
20
|
variant: string;
|
|
16
21
|
now?: number;
|
|
17
22
|
min?: number;
|
|
18
23
|
max?: number;
|
|
24
|
+
labelledBy?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
valueTextRenderer?: DSProgressIndicatorT.DefaultRendererT;
|
|
27
|
+
} & {
|
|
28
|
+
getOwnerProps?: () => object;
|
|
29
|
+
getOwnerPropsArguments?: () => object;
|
|
19
30
|
}) => React.JSX.Element;
|
|
20
31
|
};
|
|
21
32
|
};
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { DSProgressIndicatorT } from './react-desc-prop-types.js';
|
|
3
|
+
type OwnerPropsPassthrough = {
|
|
4
|
+
getOwnerProps?: () => object;
|
|
5
|
+
getOwnerPropsArguments?: () => object;
|
|
6
|
+
};
|
|
2
7
|
declare const ProgressBar: {
|
|
3
|
-
({ variant, now, min, max, children: progressSegments, }: {
|
|
8
|
+
({ variant, now, min, max, labelledBy, valueTextRenderer, children: progressSegments, getOwnerProps, getOwnerPropsArguments, }: {
|
|
4
9
|
variant?: string;
|
|
5
10
|
now?: number;
|
|
6
11
|
min?: number;
|
|
7
12
|
max?: number;
|
|
13
|
+
labelledBy?: string;
|
|
8
14
|
children?: React.ReactNode;
|
|
9
|
-
|
|
15
|
+
valueTextRenderer?: DSProgressIndicatorT.DefaultRendererT;
|
|
16
|
+
} & OwnerPropsPassthrough): React.JSX.Element;
|
|
10
17
|
Segment: (props: {
|
|
11
18
|
variant: string;
|
|
12
19
|
now?: number;
|
|
13
20
|
min?: number;
|
|
14
21
|
max?: number;
|
|
15
|
-
|
|
22
|
+
labelledBy?: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
valueTextRenderer?: DSProgressIndicatorT.DefaultRendererT;
|
|
25
|
+
} & OwnerPropsPassthrough) => React.JSX.Element;
|
|
16
26
|
};
|
|
17
27
|
export default ProgressBar;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { DSProgressIndicatorT } from './react-desc-prop-types.js';
|
|
3
|
-
declare const ProgressCounter: ({ now, max, min, renderer, }: DSProgressIndicatorT.PercentageT & {
|
|
3
|
+
declare const ProgressCounter: ({ now, max, min, renderer, getOwnerProps, getOwnerPropsArguments, }: Partial<DSProgressIndicatorT.PercentageT> & {
|
|
4
4
|
renderer?: DSProgressIndicatorT.DefaultRendererT;
|
|
5
|
+
getOwnerProps?: () => object;
|
|
6
|
+
getOwnerPropsArguments?: () => object;
|
|
5
7
|
}) => React.JSX.Element;
|
|
6
8
|
export default ProgressCounter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
|
|
2
|
+
import { type DSProgressIndicatorT } from '../react-desc-prop-types.js';
|
|
3
|
+
export interface ProgressIndicatorCTX {
|
|
4
|
+
propsWithDefault: DSProgressIndicatorT.InternalProps;
|
|
5
|
+
globalProps: ReturnType<typeof useGetGlobalAttributes>;
|
|
6
|
+
titleId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const useProgressIndicator: (propsFromUser: DSProgressIndicatorT.Props) => ProgressIndicatorCTX;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DSProgressIndicatorName = "DSProgressindicator";
|
|
2
|
+
export declare const PROGRESS_INDICATOR_SLOTS: {
|
|
3
|
+
readonly ROOT: "root";
|
|
4
|
+
readonly TITLE: "title";
|
|
5
|
+
readonly COUNTER: "counter";
|
|
6
|
+
readonly PROGRESS_BAR: "progress-bar";
|
|
7
|
+
readonly PROGRESS: "progress";
|
|
8
|
+
};
|
|
9
|
+
export declare const PROGRESS_INDICATOR_DATA_TESTID: {
|
|
10
|
+
readonly ROOT: "ds-progressindicator-root";
|
|
11
|
+
readonly TITLE: "ds-progressindicator-title";
|
|
12
|
+
readonly COUNTER: "ds-progressindicator-counter";
|
|
13
|
+
readonly PROGRESS_BAR: "ds-progressindicator-progress-bar";
|
|
14
|
+
readonly PROGRESS: "ds-progressindicator-progress";
|
|
15
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { DSProgressIndicator, ProgressIndicatorWithSchema } from './DSProgressIndicator.js';
|
|
2
2
|
export { type DSProgressIndicatorT } from './react-desc-prop-types.js';
|
|
3
|
+
export { DSProgressIndicatorName, PROGRESS_INDICATOR_SLOTS, PROGRESS_INDICATOR_DATA_TESTID, } from './constants/index.js';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { DSPropTypesSchema, GlobalAttributesT, ValidationMap } from '@elliemae/ds-props-helpers';
|
|
2
|
+
import { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';
|
|
3
|
+
import { DSProgressIndicatorName, PROGRESS_INDICATOR_SLOTS } from './constants/index.js';
|
|
1
4
|
export declare namespace DSProgressIndicatorT {
|
|
2
5
|
type PercentageT = {
|
|
3
6
|
min: number;
|
|
@@ -12,6 +15,18 @@ export declare namespace DSProgressIndicatorT {
|
|
|
12
15
|
max: number;
|
|
13
16
|
now: number;
|
|
14
17
|
variant: VariantT;
|
|
18
|
+
/**
|
|
19
|
+
* Accessible name for this specific segment. Without it every segment inherits the same name from the
|
|
20
|
+
* indicator title, so segments are told apart only by their variant colour. See PUI-18942.
|
|
21
|
+
*/
|
|
22
|
+
label?: string;
|
|
23
|
+
};
|
|
24
|
+
type SlotFunctionArguments = {
|
|
25
|
+
dsProgressindicatorRoot: () => object;
|
|
26
|
+
dsProgressindicatorTitle: () => object;
|
|
27
|
+
dsProgressindicatorCounter: () => object;
|
|
28
|
+
dsProgressindicatorProgressBar: () => object;
|
|
29
|
+
dsProgressindicatorProgress: () => object;
|
|
15
30
|
};
|
|
16
31
|
interface DefaultProps {
|
|
17
32
|
title: string;
|
|
@@ -22,15 +37,31 @@ export declare namespace DSProgressIndicatorT {
|
|
|
22
37
|
segments: SegmentsT[] | readonly SegmentsT[];
|
|
23
38
|
style: object;
|
|
24
39
|
}
|
|
25
|
-
interface OptionalProps {
|
|
40
|
+
interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSProgressIndicatorName, typeof PROGRESS_INDICATOR_SLOTS> {
|
|
26
41
|
containerProps?: {
|
|
27
42
|
[key: string]: string;
|
|
28
43
|
};
|
|
29
44
|
now?: number;
|
|
30
45
|
max?: number;
|
|
31
46
|
}
|
|
32
|
-
interface Props extends Partial<DefaultProps>, OptionalProps {
|
|
47
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof OptionalProps> {
|
|
33
48
|
}
|
|
34
|
-
interface InternalProps extends DefaultProps, OptionalProps {
|
|
49
|
+
interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof OptionalProps> {
|
|
35
50
|
}
|
|
36
51
|
}
|
|
52
|
+
export declare const defaultProps: {
|
|
53
|
+
containerProps: {};
|
|
54
|
+
title: string;
|
|
55
|
+
now: number;
|
|
56
|
+
min: number;
|
|
57
|
+
max: number;
|
|
58
|
+
disabled: boolean;
|
|
59
|
+
segments: never[];
|
|
60
|
+
style: {};
|
|
61
|
+
};
|
|
62
|
+
type DocumentedPropsSurface = DSProgressIndicatorT.Props & {
|
|
63
|
+
variant?: DSProgressIndicatorT.VariantT;
|
|
64
|
+
};
|
|
65
|
+
export declare const DSProgressIndicatorPropTypes: DSPropTypesSchema<DocumentedPropsSurface>;
|
|
66
|
+
export declare const DSProgressIndicatorPropTypesSchema: ValidationMap<DSProgressIndicatorT.Props>;
|
|
67
|
+
export {};
|
package/dist/types/styled.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
export declare const legacyRootClassName: (disabled?: boolean, ...consumerClasses: (string | undefined)[]) => string;
|
|
2
|
+
export declare const legacyCounterClassName: (...consumerClasses: (string | undefined)[]) => string;
|
|
3
|
+
export declare const legacyBarClassName: (...consumerClasses: (string | undefined)[]) => string;
|
|
4
|
+
export declare const legacyProgressClassName: (variant?: string, ...consumerClasses: (string | undefined)[]) => string;
|
|
5
|
+
export declare const StyledProgressIndicatorRoot: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
|
|
1
6
|
export declare const Title: import("styled-components").StyledComponent<"span", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"span">, never>;
|
|
7
|
+
export declare const StyledProgressIndicatorCounter: import("styled-components").StyledComponent<"span", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"span">, never>;
|
|
8
|
+
export declare const StyledProgressBar: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
|
|
9
|
+
export declare const StyledProgress: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"div">, never>;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import type { DSProgressIndicatorT } from './react-desc-prop-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A determinate progress is only meaningful over a real range: `max` must be finite and greater than `min`.
|
|
4
|
+
* The default `max` is `0`, so a consumer who omits it lands here — as does a legitimately dynamic `max` that
|
|
5
|
+
* starts at zero while data loads. Both used to produce `width: NaN%` and an invalid ARIA range
|
|
6
|
+
* (aria-valuemax equal to aria-valuemin). Callers treat an invalid range as an indeterminate progress. PUI-18672.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hasValidRange(min: unknown, max: unknown): boolean;
|
|
9
|
+
export declare function clamp(value: number, lower: number, upper: number): number;
|
|
1
10
|
export declare function getPercentage(now: number, min: number, max: number): number;
|
|
11
|
+
export declare const defaultCounterRenderer: DSProgressIndicatorT.DefaultRendererT;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-progress-indicator",
|
|
3
|
-
"version": "3.80.0-next.
|
|
3
|
+
"version": "3.80.0-next.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Progress Indicator",
|
|
6
6
|
"files": [
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@elliemae/ds-
|
|
40
|
-
"@elliemae/ds-props-helpers": "3.80.0-next.
|
|
41
|
-
"@elliemae/ds-system": "3.80.0-next.5"
|
|
39
|
+
"@elliemae/ds-system": "3.80.0-next.8",
|
|
40
|
+
"@elliemae/ds-props-helpers": "3.80.0-next.8"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
43
|
"jest": "^30.0.0",
|
|
45
44
|
"styled-components": "~5.3.11",
|
|
46
|
-
"@elliemae/ds-monorepo-devops": "3.80.0-next.
|
|
45
|
+
"@elliemae/ds-monorepo-devops": "3.80.0-next.8",
|
|
46
|
+
"@elliemae/ds-typescript-helpers": "3.80.0-next.8"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "^18.3.1",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public",
|
|
54
|
-
"typeSafety":
|
|
54
|
+
"typeSafety": true
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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: 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 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;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,+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
|
-
"names": []
|
|
7
|
-
}
|