@hitachivantara/uikit-react-lab 3.54.0 → 3.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/StepNavigation/DefaultNavigation/Step/Step.d.ts +5 -0
- package/dist/StepNavigation/DefaultNavigation/Step/Step.js +9 -2
- package/dist/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
- package/dist/StepNavigation/SimpleNavigation/Dot/Dot.d.ts +1 -1
- package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js +11 -4
- package/dist/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
- package/dist/StepNavigation/StepNavigation.d.ts +6 -5
- package/dist/StepNavigation/StepNavigation.js +17 -5
- package/dist/StepNavigation/StepNavigation.js.map +1 -1
- package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.d.ts +5 -0
- package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js +9 -2
- package/dist/legacy/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
- package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.d.ts +1 -1
- package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js +11 -4
- package/dist/legacy/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
- package/dist/legacy/StepNavigation/StepNavigation.d.ts +6 -5
- package/dist/legacy/StepNavigation/StepNavigation.js +17 -5
- package/dist/legacy/StepNavigation/StepNavigation.js.map +1 -1
- package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.d.ts +5 -0
- package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js +9 -2
- package/dist/modern/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
- package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.d.ts +1 -1
- package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js +11 -4
- package/dist/modern/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
- package/dist/modern/StepNavigation/StepNavigation.d.ts +6 -5
- package/dist/modern/StepNavigation/StepNavigation.js +17 -5
- package/dist/modern/StepNavigation/StepNavigation.js.map +1 -1
- package/package.json +2 -2
|
@@ -22,6 +22,11 @@ export type HvStepProps = StandardProps<React.HTMLAttributes<HTMLDivElement>, Hv
|
|
|
22
22
|
* Number of the step.
|
|
23
23
|
*/
|
|
24
24
|
number?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Define if a step is disabled/enabled.
|
|
27
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean;
|
|
25
30
|
};
|
|
26
31
|
|
|
27
32
|
export default function HvStep(props: HvStepProps): JSX.Element | null;
|
|
@@ -34,6 +34,7 @@ var HvStep = function HvStep(_ref) {
|
|
|
34
34
|
state = _ref.state,
|
|
35
35
|
title = _ref.title,
|
|
36
36
|
onClick = _ref.onClick,
|
|
37
|
+
disabled = _ref.disabled,
|
|
37
38
|
_ref$size = _ref.size,
|
|
38
39
|
size = _ref$size === void 0 ? "SM" : _ref$size,
|
|
39
40
|
_ref$number = _ref.number,
|
|
@@ -73,7 +74,7 @@ var HvStep = function HvStep(_ref) {
|
|
|
73
74
|
"aria-label": "step-".concat(title),
|
|
74
75
|
icon: true,
|
|
75
76
|
overrideIconColors: false,
|
|
76
|
-
disabled: ["Current", "Disabled"].includes(state),
|
|
77
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : ["Current", "Disabled"].includes(state),
|
|
77
78
|
onClick: onClick
|
|
78
79
|
}, /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvAvatar, {
|
|
79
80
|
className: (0, _clsx.default)(classes.avatar, classes[size]),
|
|
@@ -178,7 +179,13 @@ process.env.NODE_ENV !== "production" ? HvStep.propTypes = {
|
|
|
178
179
|
/**
|
|
179
180
|
* Event onClick of the step.
|
|
180
181
|
*/
|
|
181
|
-
onClick: _propTypes.default.func
|
|
182
|
+
onClick: _propTypes.default.func,
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Define if a step is disabled/enabled.
|
|
186
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
187
|
+
*/
|
|
188
|
+
disabled: _propTypes.default.bool
|
|
182
189
|
} : void 0;
|
|
183
190
|
|
|
184
191
|
var _default = (0, _core.withStyles)(_styles.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.js","names":["HvStep","className","classes","state","title","onClick","size","number","iconSize","XS","SM","MD","LG","XL","squareL","Pending","Failed","Completed","svgSize","backgroundColor","getColor","color","undefined","semantic","status","IconComponent","HourGlass","Level3Bad","Level0Good","clsx","root","ghost","ghostDisabled","includes","avatar","propTypes","PropTypes","string","shape","stepTitle","isRequired","oneOf","func","withStyles","styles","name"],"sources":["../../../../src/StepNavigation/DefaultNavigation/Step/Step.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles } from \"@material-ui/core\";\n\nimport { Level0Good, Level3Bad, HourGlass } from \"@hitachivantara/uikit-react-icons\";\nimport { HvAvatar, HvButton } from \"@hitachivantara/uikit-react-core\";\n\nimport { getColor } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Default\" Step Navigation root component\n */\nconst HvStep = ({
|
|
1
|
+
{"version":3,"file":"Step.js","names":["HvStep","className","classes","state","title","onClick","disabled","size","number","iconSize","XS","SM","MD","LG","XL","squareL","Pending","Failed","Completed","svgSize","backgroundColor","getColor","color","undefined","semantic","status","IconComponent","HourGlass","Level3Bad","Level0Good","clsx","root","ghost","ghostDisabled","includes","avatar","propTypes","PropTypes","string","shape","stepTitle","isRequired","oneOf","func","bool","withStyles","styles","name"],"sources":["../../../../src/StepNavigation/DefaultNavigation/Step/Step.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles } from \"@material-ui/core\";\n\nimport { Level0Good, Level3Bad, HourGlass } from \"@hitachivantara/uikit-react-icons\";\nimport { HvAvatar, HvButton } from \"@hitachivantara/uikit-react-core\";\n\nimport { getColor } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Default\" Step Navigation root component\n */\nconst HvStep = ({\n className,\n classes,\n state,\n title,\n onClick,\n disabled,\n size = \"SM\",\n number = 1,\n}) => {\n const iconSize = {\n XS: \"XS\",\n SM: \"XS\",\n MD: \"S\",\n LG: \"M\",\n XL: \"M\",\n }[size];\n\n const squareL = {\n Pending: 16,\n Failed: 24,\n Completed: 24,\n }[state];\n\n const svgSize = {\n XS: squareL - 8,\n SM: squareL,\n MD: squareL + 8,\n LG: squareL + 16,\n XL: squareL + 24,\n }[size];\n\n const backgroundColor = getColor(state);\n\n const color = state === \"Pending\" ? \"atmo2\" : undefined;\n\n const semantic = state !== \"Pending\" ? backgroundColor : undefined;\n\n const status = state === \"Current\" ? \"atmo5\" : undefined;\n\n const IconComponent = {\n Pending: HourGlass,\n Failed: Level3Bad,\n Completed: Level0Good,\n }[state];\n\n return (\n <div\n className={clsx(className, classes.root, { [classes[\"not-current\"]]: state !== \"Current\" })}\n >\n <HvButton\n className={clsx(classes.ghost, { [classes.ghostDisabled]: state === \"Current\" })}\n aria-label={`step-${title}`}\n icon\n overrideIconColors={false}\n disabled={disabled ?? [\"Current\", \"Disabled\"].includes(state)}\n onClick={onClick}\n >\n <HvAvatar\n className={clsx(classes.avatar, classes[size])}\n backgroundColor={backgroundColor}\n status={status}\n size={size}\n >\n {IconComponent ? (\n <IconComponent\n color={color}\n semantic={semantic}\n width={svgSize}\n height={svgSize}\n iconSize={iconSize}\n />\n ) : (\n number\n )}\n </HvAvatar>\n </HvButton>\n </div>\n );\n};\n\nHvStep.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the ghost class.\n */\n ghost: PropTypes.string,\n /**\n * Styles applied to the ghostDisabled class.\n */\n ghostDisabled: PropTypes.string,\n /**\n * Styles applied to the root element when step is not in \"current\" state.\n */\n \"not-current\": PropTypes.string,\n /**\n * Styles applied to the root element when size is XS.\n */\n XS: PropTypes.string,\n /**\n * Styles applied to the root element when size is SM.\n */\n SM: PropTypes.string,\n /**\n * Styles applied to the root element when size is MD.\n */\n MD: PropTypes.string,\n /**\n * Styles applied to the root element when size is LG.\n */\n LG: PropTypes.string,\n /**\n * Styles applied to the root element when size is XL.\n */\n XL: PropTypes.string,\n /**\n * Styles applied to the avatar element.\n */\n avatar: PropTypes.string,\n /**\n * Styles applied to the title of a step element.\n */\n stepTitle: PropTypes.string,\n }).isRequired,\n /**\n * Sets one of the standard sizes of the step\n */\n size: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * Number of the step.\n */\n number: PropTypes.number,\n /**\n * Event onClick of the step.\n */\n onClick: PropTypes.func,\n /**\n * Define if a step is disabled/enabled.\n * If this property is not defined and the step is on state \"Disabled\", the step component will be disabled\n */\n disabled: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvStep\" })(HvStep);\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA,IAAMA,MAAM,GAAG,SAATA,MAAS,OAST;EAAA,IARJC,SAQI,QARJA,SAQI;EAAA,IAPJC,OAOI,QAPJA,OAOI;EAAA,IANJC,KAMI,QANJA,KAMI;EAAA,IALJC,KAKI,QALJA,KAKI;EAAA,IAJJC,OAII,QAJJA,OAII;EAAA,IAHJC,QAGI,QAHJA,Q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E0B,kBAAA,CAAUC,MAxBS;;IAyBvB;AACJ;AACA;IACI1B,EAAE,EAAEyB,kBAAA,CAAUC,MA5BS;;IA6BvB;AACJ;AACA;IACIzB,EAAE,EAAEwB,kBAAA,CAAUC,MAhCS;;IAiCvB;AACJ;AACA;IACIxB,EAAE,EAAEuB,kBAAA,CAAUC,MApCS;;IAqCvB;AACJ;AACA;IACIH,MAAM,EAAEE,kBAAA,CAAUC,MAxCK;;IAyCvB;AACJ;AACA;IACIE,SAAS,EAAEH,kBAAA,CAAUC;EA5CE,CAAhB,EA6CNG,UArDc;;EAsDjB;AACF;AACA;EACElC,IAAI,EAAE8B,kBAAA,CAAUK,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,EAAyB,IAAzB,CAAhB,CAzDW;;EA0DjB;AACF;AACA;EACEvC,KAAK,EAAEkC,kBAAA,CAAUK,KAAV,CAAgB,CAAC,SAAD,EAAY,QAAZ,EAAsB,WAAtB,EAAmC,SAAnC,EAA8C,UAA9C,CAAhB,EAA2ED,UA7DjE;;EA8DjB;AACF;AACA;EACErC,KAAK,EAAEiC,kBAAA,CAAUC,MAAV,CAAiBG,UAjEP;;EAkEjB;AACF;AACA;EACEjC,MAAM,EAAE6B,kBAAA,CAAU7B,MArED;;EAsEjB;AACF;AACA;EACEH,OAAO,EAAEgC,kBAAA,CAAUM,IAzEF;;EA0EjB;AACF;AACA;AACA;EACErC,QAAQ,EAAE+B,kBAAA,CAAUO;AA9EH,CAAnB;;eAiFe,IAAAC,gBAAA,EAAWC,eAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAAuC/C,MAAvC,C"}
|
|
@@ -5,6 +5,6 @@ import { HvStepProps } from "../../DefaultNavigation/Step";
|
|
|
5
5
|
export type HvDotClassKey = "root";
|
|
6
6
|
|
|
7
7
|
export type HvDotProps = StandardProps<React.HTMLAttributes<HTMLDivElement>, HvDotClassKey> &
|
|
8
|
-
Pick<HvStepProps, "size" | "title" | "state" | "onClick">;
|
|
8
|
+
Pick<HvStepProps, "size" | "title" | "state" | "onClick" | "disabled">;
|
|
9
9
|
|
|
10
10
|
export default function HvDot(props: HvDotProps): JSX.Element | null;
|
|
@@ -68,7 +68,8 @@ var HvDot = function HvDot(_ref) {
|
|
|
68
68
|
state = _ref.state,
|
|
69
69
|
title = _ref.title,
|
|
70
70
|
size = _ref.size,
|
|
71
|
-
onClick = _ref.onClick
|
|
71
|
+
onClick = _ref.onClick,
|
|
72
|
+
disabled = _ref.disabled;
|
|
72
73
|
var dotSize = _utils.dotSizes[size] * (state === "Current" ? 1.5 : 1);
|
|
73
74
|
var getBackgroundColor = (0, _react.useCallback)(function (theme) {
|
|
74
75
|
return state === "Disabled" ? (0, _utils.disabledColor)(theme) : (0, _utils.defaultColor)(theme);
|
|
@@ -97,11 +98,11 @@ var HvDot = function HvDot(_ref) {
|
|
|
97
98
|
});
|
|
98
99
|
}, [dotSize, getBackgroundColor])();
|
|
99
100
|
return /*#__PURE__*/_react.default.createElement(_uikitReactCore.HvButton, {
|
|
100
|
-
className: (0, _clsx.default)(classes.root, customClasses.ghost,
|
|
101
|
+
className: (0, _clsx.default)(classes.root, customClasses.ghost, (disabled !== null && disabled !== void 0 ? disabled : "Current Disabled".includes(state)) && customClasses.ghostDisabled, className, state === "Current" && customClasses.active),
|
|
101
102
|
"aria-label": "step-".concat(title),
|
|
102
103
|
icon: true,
|
|
103
104
|
overrideIconColors: false,
|
|
104
|
-
disabled: ["Current", "Disabled"].includes(state),
|
|
105
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : ["Current", "Disabled"].includes(state),
|
|
105
106
|
onClick: onClick
|
|
106
107
|
}, []);
|
|
107
108
|
};
|
|
@@ -155,7 +156,13 @@ process.env.NODE_ENV !== "production" ? HvDot.propTypes = {
|
|
|
155
156
|
/**
|
|
156
157
|
* Event onClick of the step.
|
|
157
158
|
*/
|
|
158
|
-
onClick: _propTypes.default.func
|
|
159
|
+
onClick: _propTypes.default.func,
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Define if a step is disabled/enabled.
|
|
163
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
164
|
+
*/
|
|
165
|
+
disabled: _propTypes.default.bool
|
|
159
166
|
} : void 0;
|
|
160
167
|
|
|
161
168
|
var _default = (0, _core.withStyles)(_styles.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dot.js","names":["HvDot","classes","className","state","title","size","onClick","dotSize","dotSizes","getBackgroundColor","useCallback","theme","disabledColor","defaultColor","customClasses","useMemo","makeStyles","backgroundColor","ghostDisabled","active","ghost","styles","width","height","clsx","root","includes","propTypes","PropTypes","string","shape","isRequired","oneOf","func","withStyles","name"],"sources":["../../../../src/StepNavigation/SimpleNavigation/Dot/Dot.js"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { HvButton } from \"@hitachivantara/uikit-react-core\";\nimport { makeStyles, withStyles } from \"@material-ui/core\";\n\nimport { defaultColor, disabledColor, dotSizes } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Simple\" Step Navigation root component\n */\nconst HvDot = ({ classes, className, state, title, size, onClick }) => {\n const dotSize = dotSizes[size] * (state === \"Current\" ? 1.5 : 1);\n const getBackgroundColor = useCallback(\n (theme) => (state === \"Disabled\" ? disabledColor(theme) : defaultColor(theme)),\n [state]\n );\n const customClasses = useMemo(\n () =>\n makeStyles((theme) => {\n const backgroundColor = getBackgroundColor(theme);\n return {\n ghostDisabled: {},\n active: {},\n ghost: {\n ...styles.ghost,\n width: dotSize,\n height: dotSize,\n backgroundColor,\n \"&:hover\": {\n backgroundColor,\n },\n \"&$ghostDisabled\": {\n ...styles.ghost[\"&$ghostDisabled\"],\n backgroundColor,\n },\n \"&$ghostDisabled&:hover\": {\n ...styles.ghost[\"&$ghostDisabled&:hover\"],\n backgroundColor,\n },\n },\n };\n }),\n [dotSize, getBackgroundColor]\n )();\n return (\n <HvButton\n className={clsx(\n classes.root,\n customClasses.ghost,\n {\n [customClasses.active]: state === \"Current\",\n [customClasses.ghostDisabled]: [\"Current\", \"Disabled\"].includes(state),\n },\n className\n )}\n aria-label={`step-${title}`}\n icon\n overrideIconColors={false}\n disabled={[\"Current\", \"Disabled\"].includes(state)}\n onClick={onClick}\n >\n {[]}\n </HvButton>\n );\n};\n\nHvDot.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the active class.\n */\n active: PropTypes.string,\n /**\n * Styles applied to the ghost class.\n */\n ghost: PropTypes.string,\n /**\n * Styles applied to the ghostDisabled class.\n */\n ghostDisabled: PropTypes.string,\n }).isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * Sets one of the standard sizes of the steps\n */\n size: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]).isRequired,\n /**\n * Event onClick of the step.\n */\n onClick: PropTypes.func,\n};\n\nexport default withStyles(styles, { name: \"HvDot\" })(HvDot);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA;AACA;AACA;AACA,IAAMA,KAAK,GAAG,SAARA,KAAQ,
|
|
1
|
+
{"version":3,"file":"Dot.js","names":["HvDot","classes","className","state","title","size","onClick","disabled","dotSize","dotSizes","getBackgroundColor","useCallback","theme","disabledColor","defaultColor","customClasses","useMemo","makeStyles","backgroundColor","ghostDisabled","active","ghost","styles","width","height","clsx","root","includes","propTypes","PropTypes","string","shape","isRequired","oneOf","func","bool","withStyles","name"],"sources":["../../../../src/StepNavigation/SimpleNavigation/Dot/Dot.js"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { HvButton } from \"@hitachivantara/uikit-react-core\";\nimport { makeStyles, withStyles } from \"@material-ui/core\";\n\nimport { defaultColor, disabledColor, dotSizes } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Simple\" Step Navigation root component\n */\nconst HvDot = ({ classes, className, state, title, size, onClick, disabled }) => {\n const dotSize = dotSizes[size] * (state === \"Current\" ? 1.5 : 1);\n const getBackgroundColor = useCallback(\n (theme) => (state === \"Disabled\" ? disabledColor(theme) : defaultColor(theme)),\n [state]\n );\n const customClasses = useMemo(\n () =>\n makeStyles((theme) => {\n const backgroundColor = getBackgroundColor(theme);\n return {\n ghostDisabled: {},\n active: {},\n ghost: {\n ...styles.ghost,\n width: dotSize,\n height: dotSize,\n backgroundColor,\n \"&:hover\": {\n backgroundColor,\n },\n \"&$ghostDisabled\": {\n ...styles.ghost[\"&$ghostDisabled\"],\n backgroundColor,\n },\n \"&$ghostDisabled&:hover\": {\n ...styles.ghost[\"&$ghostDisabled&:hover\"],\n backgroundColor,\n },\n },\n };\n }),\n [dotSize, getBackgroundColor]\n )();\n return (\n <HvButton\n className={clsx(\n classes.root,\n customClasses.ghost,\n {\n [customClasses.active]: state === \"Current\",\n [customClasses.ghostDisabled]: disabled ?? [\"Current\", \"Disabled\"].includes(state),\n },\n className\n )}\n aria-label={`step-${title}`}\n icon\n overrideIconColors={false}\n disabled={disabled ?? [\"Current\", \"Disabled\"].includes(state)}\n onClick={onClick}\n >\n {[]}\n </HvButton>\n );\n};\n\nHvDot.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the active class.\n */\n active: PropTypes.string,\n /**\n * Styles applied to the ghost class.\n */\n ghost: PropTypes.string,\n /**\n * Styles applied to the ghostDisabled class.\n */\n ghostDisabled: PropTypes.string,\n }).isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * Sets one of the standard sizes of the steps\n */\n size: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]).isRequired,\n /**\n * Event onClick of the step.\n */\n onClick: PropTypes.func,\n /**\n * Define if a step is disabled/enabled.\n * If this property is not defined and the step is on state \"Disabled\", the step component will be disabled\n */\n disabled: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvDot\" })(HvDot);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA;AACA;AACA;AACA,IAAMA,KAAK,GAAG,SAARA,KAAQ,OAAmE;EAAA,IAAhEC,OAAgE,QAAhEA,OAAgE;EAAA,IAAvDC,SAAuD,QAAvDA,SAAuD;EAAA,IAA5CC,KAA4C,QAA5CA,KAA4C;EAAA,IAArCC,KAAqC,QAArCA,KAAqC;EAAA,IAA9BC,IAA8B,QAA9BA,IAA8B;EAAA,IAAxBC,OAAwB,QAAxBA,OAAwB;EAAA,IAAfC,QAAe,QAAfA,QAAe;EAC/E,IAAMC,OAAO,GAAGC,eAAA,CAASJ,IAAT,KAAkBF,KAAK,KAAK,SAAV,GAAsB,GAAtB,GAA4B,CAA9C,CAAhB;EACA,IAAMO,kBAAkB,GAAG,IAAAC,kBAAA,EACzB,UAACC,KAAD;IAAA,OAAYT,KAAK,KAA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
+
import { Breakpoint } from "@material-ui/core/styles/createBreakpoints";
|
|
3
4
|
import { HvStepProps } from "./DefaultNavigation/Step/Step";
|
|
4
5
|
|
|
5
6
|
export type HvStepNavigationClassKey = "root";
|
|
@@ -15,7 +16,7 @@ export type HvStepNavigationProps = StandardProps<
|
|
|
15
16
|
/**
|
|
16
17
|
* Steps to show on the component.
|
|
17
18
|
*/
|
|
18
|
-
steps: Array<Pick<HvStepProps, "state" | "title" | "onClick" | "className">> & {
|
|
19
|
+
steps: Array<Pick<HvStepProps, "state" | "title" | "onClick" | "className" | "disabled">> & {
|
|
19
20
|
/**
|
|
20
21
|
* Class names to override styles on the separator component after the step.
|
|
21
22
|
*/
|
|
@@ -26,15 +27,15 @@ export type HvStepNavigationProps = StandardProps<
|
|
|
26
27
|
titleClassName: string;
|
|
27
28
|
};
|
|
28
29
|
/**
|
|
29
|
-
* Sets one of the standard sizes of the steps
|
|
30
|
+
* Sets one of the standard sizes of the steps.
|
|
30
31
|
*/
|
|
31
32
|
stepSize?: "XS" | "SM" | "MD" | "LG" | "XL";
|
|
32
33
|
/**
|
|
33
|
-
* Width of the component element.
|
|
34
|
+
* Width of the component element on each breakpoint screen resolution.
|
|
34
35
|
*/
|
|
35
|
-
width?: number;
|
|
36
|
+
width?: { [breakpoint in Breakpoint]?: number };
|
|
36
37
|
/**
|
|
37
|
-
* Defines either show a title or only a tooltip on each step component
|
|
38
|
+
* Defines either show a title or only a tooltip on each step component.
|
|
38
39
|
*/
|
|
39
40
|
showTitles?: boolean;
|
|
40
41
|
};
|
|
@@ -199,9 +199,9 @@ var HvStepNavigation = function HvStepNavigation(_ref) {
|
|
|
199
199
|
};
|
|
200
200
|
|
|
201
201
|
var getDynamicValues = function getDynamicValues(stepsWidth) {
|
|
202
|
-
var _theme$breakpoints$va, _theme$breakpoints$va2;
|
|
202
|
+
var _width$breakpoint, _theme$breakpoints$va, _theme$breakpoints$va2;
|
|
203
203
|
|
|
204
|
-
var maxWidth = width !== null &&
|
|
204
|
+
var maxWidth = (_width$breakpoint = width === null || width === void 0 ? void 0 : width[breakpoint]) !== null && _width$breakpoint !== void 0 ? _width$breakpoint : Math.max(Number(hasTitles) * (_utils.TITLE_WIDTH + _utils.TITLE_MARGIN) * steps.length - _utils.TITLE_MARGIN, _utils.SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth);
|
|
205
205
|
var next = theme.breakpoints.keys.find(function (_, index, self) {
|
|
206
206
|
return index - 1 >= 0 ? self[index - 1] === breakpoint : false;
|
|
207
207
|
});
|
|
@@ -350,7 +350,13 @@ process.env.NODE_ENV !== "production" ? HvStepNavigation.propTypes = {
|
|
|
350
350
|
/**
|
|
351
351
|
* State of the step. Values = {"Pending", "Failed", "Completed", "Current", "Disabled"}.
|
|
352
352
|
*/
|
|
353
|
-
state: _propTypes.default.oneOf(["Pending", "Failed", "Completed", "Current", "Disabled"]).isRequired
|
|
353
|
+
state: _propTypes.default.oneOf(["Pending", "Failed", "Completed", "Current", "Disabled"]).isRequired,
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Define if a step is disabled/enabled.
|
|
357
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
358
|
+
*/
|
|
359
|
+
disabled: _propTypes.default.bool
|
|
354
360
|
})).isRequired,
|
|
355
361
|
|
|
356
362
|
/**
|
|
@@ -359,9 +365,15 @@ process.env.NODE_ENV !== "production" ? HvStepNavigation.propTypes = {
|
|
|
359
365
|
stepSize: _propTypes.default.oneOf(["XS", "SM", "MD", "LG", "XL"]),
|
|
360
366
|
|
|
361
367
|
/**
|
|
362
|
-
* Width of the component.
|
|
368
|
+
* Width of the component element on each breakpoint screen resolution.
|
|
363
369
|
*/
|
|
364
|
-
width: _propTypes.default.
|
|
370
|
+
width: _propTypes.default.shape({
|
|
371
|
+
xs: _propTypes.default.number,
|
|
372
|
+
sm: _propTypes.default.number,
|
|
373
|
+
md: _propTypes.default.number,
|
|
374
|
+
lg: _propTypes.default.number,
|
|
375
|
+
xl: _propTypes.default.number
|
|
376
|
+
}),
|
|
365
377
|
|
|
366
378
|
/**
|
|
367
379
|
* Defines either show a title or only a tooltip on each step component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepNavigation.js","names":["HvStepNavigation","className","classes","width","steps","stepSize","showTitles","type","others","theme","useTheme","breakpoint","useWidth","stepSizeKey","includes","hasTitles","styledLi","containerSize","styled","height","styledDiv","styledSeparatorElement","title","separatorClassName","separatorHeight","separatorWidth","backgroundColor","Separator","withStyles","separatorElement","clsx","separator","drawItems","separatorValues","minWidth","maxWidth","getColor","stepValues","minSize","maxSize","StepComponent","items","reduce","acc","index","state","props","StepContainer","Step","Math","max","stepProps","size","number","stepElement","li","length","ol","getDynamicValues","stepsWidth","Number","TITLE_WIDTH","TITLE_MARGIN","SEPARATOR_WIDTH","next","breakpoints","keys","find","_","self","navWidth","min","values","titleWidth","ceil","styledTitle","titleClassName","variant","stepTitle","textAlign","marginRight","getTitles","getTitleProps","titles","map","rawTitle","Title","StepNavigation","Default","HvDefaultNavigation","Simple","HvSimpleNavigation","numSteps","root","itemsProps","margin","propTypes","PropTypes","string","shape","isRequired","oneOf","arrayOf","bool","styles","name"],"sources":["../../src/StepNavigation/StepNavigation.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles, Typography, styled, useTheme } from \"@material-ui/core\";\nimport { HvTooltip, HvTypography, useWidth } from \"@hitachivantara/uikit-react-core\";\n\nimport HvDefaultNavigation from \"./DefaultNavigation\";\nimport HvSimpleNavigation from \"./SimpleNavigation\";\nimport { SEPARATOR_WIDTH, TITLE_MARGIN, TITLE_WIDTH } from \"./utils\";\nimport styles from \"./styles\";\n\n/**\n * Navigation page with steps.\n *\n * You need to define the <b>steps<b/> displayed on the component so that itself can be drawn on the UI.\n * On each step, you need to define a <b>state</b> - 'Pending', 'Failed', 'Completed', 'Current', 'Disabled' -\n * and a <b>title</b> to be shown as a tooltip or a text above of the step. You can also:\n * * Define a <b>className</b> on each step element;\n * * Define a <b>separatorClassName</b> to specify a className for the separator element. The default height\n * values of the separator element are 2px/3px on 'Simple'/'Default' layouts respectively;\n * * Define a <b>titleClassName</b> to specify a className for the title above each step element.\n *\n * For the root element, you can:\n * * Define a <b>className</b>;\n * * Choose a <b>type</b> of layout: 'Simple' or 'Default';\n * * Choose the <b>stepSize</b> of the step component: \"XS\", \"SM\", \"MD\", \"LG\", \"XL\". The default size will be\n * correspondent to the current media breakpoint;\n * * Choose either you want to <b>showTitles</b> near to each step component or a tootlip on hover;\n * * Define a <b>width</b> of the component. If you don't define any value and the step component has no title\n * displayed above, the width of the separator element;\n * will be 100px. If the step component has titles, each one will have 215px of width by default.\n */\nconst HvStepNavigation = ({\n className,\n classes,\n width,\n steps,\n stepSize,\n showTitles,\n type = \"Default\",\n ...others\n}) => {\n const theme = useTheme();\n // current breakpoint 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n const breakpoint = useWidth();\n // step configurations\n const stepSizeKey = stepSize ?? ([\"xs\", \"sm\"].includes(breakpoint) ? \"SM\" : \"MD\");\n const hasTitles = showTitles ?? ![\"xs\", \"sm\"].includes(breakpoint);\n\n const styledLi = (containerSize) =>\n styled(\"li\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledDiv = (containerSize) =>\n styled(\"div\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledSeparatorElement = (\n title,\n separatorClassName,\n separatorHeight,\n separatorWidth,\n backgroundColor\n ) => {\n const Separator = withStyles({\n separatorElement: {\n height: separatorHeight,\n width: separatorWidth,\n backgroundColor,\n },\n })(({ classes: { separatorElement } }) => (\n <div\n aria-label={`separator-${title}`}\n className={clsx(separatorElement, separatorClassName)}\n />\n ));\n return (\n <li aria-hidden key={`separator-${title}`} className={classes.separator}>\n <Separator />\n </li>\n );\n };\n\n const drawItems = ({\n separatorValues: { minWidth, maxWidth, getColor, height },\n stepValues: { minSize, maxSize, StepComponent },\n }) => {\n const items = steps.reduce((acc, { state, title, separatorClassName, ...props }, index) => {\n const containerSize = state === \"Current\" ? maxSize : minSize;\n const StepContainer = styledLi(containerSize);\n const Step = styledDiv(Math.max(containerSize, 30), Math.max(containerSize, 30));\n const stepProps = {\n ...{\n size: stepSizeKey,\n state,\n title,\n number: index + 1,\n ...props,\n },\n };\n const stepElement = (\n <StepContainer key={`step-${title}`} className={classes.li}>\n {hasTitles ? (\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n ) : (\n <HvTooltip\n placement=\"bottom\"\n title={<HvTypography>{`${index + 1}. ${title}`}</HvTypography>}\n >\n <div aria-label={`step-container-${title}`}>\n <Step className={classes.li}>\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n </Step>\n </div>\n </HvTooltip>\n )}\n </StepContainer>\n );\n if (index < steps.length - 1) {\n const separatorElement = styledSeparatorElement(\n title,\n separatorClassName,\n height,\n [steps[index + 1].state, state].includes(\"Current\") ? minWidth : maxWidth,\n getColor(state)\n );\n return [...acc, stepElement, separatorElement];\n }\n return [...acc, stepElement];\n }, []);\n\n return <ol className={classes.ol}>{items}</ol>;\n };\n\n const getDynamicValues = (stepsWidth) => {\n const maxWidth =\n width ??\n Math.max(\n Number(hasTitles) * (TITLE_WIDTH + TITLE_MARGIN) * steps.length - TITLE_MARGIN,\n SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth\n );\n const next = theme.breakpoints.keys.find((_, index, self) =>\n index - 1 >= 0 ? self[index - 1] === breakpoint : false\n );\n const navWidth = Math.min(maxWidth, theme.breakpoints.values?.[next] ?? maxWidth);\n const titleWidth = Number(hasTitles) * Math.ceil((navWidth + TITLE_MARGIN) / steps.length);\n const separatorWidth =\n Number(!hasTitles) * Math.ceil((navWidth - stepsWidth) / (steps.length - 1));\n return { width: navWidth, titleWidth, separatorWidth };\n };\n\n const styledTitle = (titleClassName, variant, title, titleWidth) =>\n withStyles({\n stepTitle: {\n textAlign: \"center\",\n width: titleWidth - TITLE_MARGIN,\n marginRight: TITLE_MARGIN,\n },\n })(({ classes: { stepTitle } }) =>\n title ? (\n <HvTypography variant={variant} className={clsx(stepTitle, titleClassName)}>\n {title}\n </HvTypography>\n ) : null\n );\n\n const getTitles = (getTitleProps) =>\n hasTitles ? (\n <div className={classes.titles}>\n {steps.map(({ title: rawTitle, state, titleClassName }, index) => {\n const {\n variant = \"highlightText\",\n title = rawTitle,\n titleWidth = 0,\n } = getTitleProps({\n state,\n rawTitle,\n number: index + 1,\n });\n const Title = styledTitle(titleClassName, variant, title, titleWidth);\n return <Title key={`step-title-${rawTitle}`} />;\n })}\n </div>\n ) : null;\n\n const StepNavigation = {\n Default: HvDefaultNavigation,\n Simple: HvSimpleNavigation,\n }[type];\n\n return (\n <StepNavigation\n {...{\n stepSize: stepSizeKey,\n numSteps: steps.length,\n getTitles,\n getDynamicValues,\n className: clsx(className, classes.root),\n ...others,\n }}\n >\n {({ stepsWidth, navWidth, ...itemsProps }) => (\n <Typography\n component=\"nav\"\n style={{\n width: `${navWidth}px`,\n margin: 0,\n }}\n >\n {drawItems(itemsProps)}\n </Typography>\n )}\n </StepNavigation>\n );\n};\n\nHvStepNavigation.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the li element.\n */\n li: PropTypes.string,\n /**\n * Styles applied to the ol element.\n */\n ol: PropTypes.string,\n /**\n * Styles applied to the separator element.\n */\n separator: PropTypes.string,\n /**\n * Styles applied to the titles container element.\n */\n titles: PropTypes.string,\n }).isRequired,\n /**\n * Type of step navigation. Values = {\"Simple\", \"Default\"}.\n */\n type: PropTypes.oneOf([\"Simple\", \"Default\"]),\n /**\n * Steps to show on the component.\n */\n steps: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * Class names to override styles on the step component.\n */\n className: PropTypes.string,\n /**\n * Class names to override styles on the separator component after the step.\n */\n separatorClassName: PropTypes.string,\n /**\n * Class names to override styles on the title component above the step.\n */\n titleClassName: PropTypes.string,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}.\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n })\n ).isRequired,\n /**\n * Sets one of the standard sizes of the steps. Values = {\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"}\n */\n stepSize: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * Width of the component.\n */\n width: PropTypes.number,\n /**\n * Defines either show a title or only a tooltip on each step component\n */\n showTitles: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvStepNavigation\" })(HvStepNavigation);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,OASnB;EAAA,IARJC,SAQI,QARJA,SAQI;EAAA,IAPJC,OAOI,QAPJA,OAOI;EAAA,IANJC,KAMI,QANJA,KAMI;EAAA,IALJC,KAKI,QALJA,KAKI;EAAA,IAJJC,QAII,QAJJA,QAII;EAAA,IAHJC,UAGI,QAHJA,UAGI;EAAA,qBAFJC,IAEI;EAAA,IAFJA,IAEI,0BAFG,SAEH;EAAA,IADDC,MACC;EACJ,IAAMC,KAAK,GAAG,IAAAC,cAAA,GAAd,CADI,CAEJ;;EACA,IAAMC,UAAU,GAAG,IAAAC,wBAAA,GAAnB,CAHI,CAIJ;;EACA,IAAMC,WAAW,GAAGR,QAAH,aAAGA,QAAH,c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;IACM5E,KAAK,EAAE2E,kBAAA,CAAUC,MAAV,CAAiBE,UAhBV;;IAiBd;AACN;AACA;IACMvD,KAAK,EAAEoD,kBAAA,CAAUI,KAAV,CAAgB,CAAC,SAAD,EAAY,QAAZ,EAAsB,WAAtB,EAAmC,SAAnC,EAA8C,UAA9C,CAAhB,EAA2ED;EApBpE,CAAhB,CADK,EAuBLA,UA5DyB;;EA6D3B;AACF;AACA;EACE/F,QAAQ,EAAE4F,kBAAA,CAAUI,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,EAAyB,IAAzB,CAAhB,CAhEiB;;EAiE3B;AACF;AACA;EACElG,KAAK,EAAE8F,kBAAA,CAAU5C,MApEU;;EAqE3B;AACF;AACA;EACE/C,UAAU,EAAE2F,kBAAA,CAAUM;AAxEK,CAA7B;;eA2Ee,IAAA3E,gBAAA,EAAW4E,eAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAAiDzG,gBAAjD,C"}
|
|
1
|
+
{"version":3,"file":"StepNavigation.js","names":["HvStepNavigation","className","classes","width","steps","stepSize","showTitles","type","others","theme","useTheme","breakpoint","useWidth","stepSizeKey","includes","hasTitles","styledLi","containerSize","styled","height","styledDiv","styledSeparatorElement","title","separatorClassName","separatorHeight","separatorWidth","backgroundColor","Separator","withStyles","separatorElement","clsx","separator","drawItems","separatorValues","minWidth","maxWidth","getColor","stepValues","minSize","maxSize","StepComponent","items","reduce","acc","index","state","props","StepContainer","Step","Math","max","stepProps","size","number","stepElement","li","length","ol","getDynamicValues","stepsWidth","Number","TITLE_WIDTH","TITLE_MARGIN","SEPARATOR_WIDTH","next","breakpoints","keys","find","_","self","navWidth","min","values","titleWidth","ceil","styledTitle","titleClassName","variant","stepTitle","textAlign","marginRight","getTitles","getTitleProps","titles","map","rawTitle","Title","StepNavigation","Default","HvDefaultNavigation","Simple","HvSimpleNavigation","numSteps","root","itemsProps","margin","propTypes","PropTypes","string","shape","isRequired","oneOf","arrayOf","disabled","bool","xs","sm","md","lg","xl","styles","name"],"sources":["../../src/StepNavigation/StepNavigation.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles, Typography, styled, useTheme } from \"@material-ui/core\";\nimport { HvTooltip, HvTypography, useWidth } from \"@hitachivantara/uikit-react-core\";\n\nimport HvDefaultNavigation from \"./DefaultNavigation\";\nimport HvSimpleNavigation from \"./SimpleNavigation\";\nimport { SEPARATOR_WIDTH, TITLE_MARGIN, TITLE_WIDTH } from \"./utils\";\nimport styles from \"./styles\";\n\n/**\n * Navigation page with steps.\n *\n * You need to define the <b>steps<b/> displayed on the component so that itself can be drawn on the UI.\n * On each step, you need to define a <b>state</b> - 'Pending', 'Failed', 'Completed', 'Current', 'Disabled' -\n * and a <b>title</b> to be shown as a tooltip or a text above of the step. You can also:\n * * Define a <b>className</b> on each step element;\n * * Define a <b>separatorClassName</b> to specify a className for the separator element. The default height\n * values of the separator element are 2px/3px on 'Simple'/'Default' layouts respectively;\n * * Define a <b>titleClassName</b> to specify a className for the title above each step element.\n *\n * For the root element, you can:\n * * Define a <b>className</b>;\n * * Choose a <b>type</b> of layout: 'Simple' or 'Default';\n * * Choose the <b>stepSize</b> of the step component: \"XS\", \"SM\", \"MD\", \"LG\", \"XL\". The default size will be\n * correspondent to the current media breakpoint;\n * * Choose either you want to <b>showTitles</b> near to each step component or a tootlip on hover;\n * * Define a <b>width</b> of the component. If you don't define any value and the step component has no title\n * displayed above, the width of the separator element;\n * will be 100px. If the step component has titles, each one will have 215px of width by default.\n */\nconst HvStepNavigation = ({\n className,\n classes,\n width,\n steps,\n stepSize,\n showTitles,\n type = \"Default\",\n ...others\n}) => {\n const theme = useTheme();\n // current breakpoint 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n const breakpoint = useWidth();\n // step configurations\n const stepSizeKey = stepSize ?? ([\"xs\", \"sm\"].includes(breakpoint) ? \"SM\" : \"MD\");\n const hasTitles = showTitles ?? ![\"xs\", \"sm\"].includes(breakpoint);\n\n const styledLi = (containerSize) =>\n styled(\"li\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledDiv = (containerSize) =>\n styled(\"div\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledSeparatorElement = (\n title,\n separatorClassName,\n separatorHeight,\n separatorWidth,\n backgroundColor\n ) => {\n const Separator = withStyles({\n separatorElement: {\n height: separatorHeight,\n width: separatorWidth,\n backgroundColor,\n },\n })(({ classes: { separatorElement } }) => (\n <div\n aria-label={`separator-${title}`}\n className={clsx(separatorElement, separatorClassName)}\n />\n ));\n return (\n <li aria-hidden key={`separator-${title}`} className={classes.separator}>\n <Separator />\n </li>\n );\n };\n\n const drawItems = ({\n separatorValues: { minWidth, maxWidth, getColor, height },\n stepValues: { minSize, maxSize, StepComponent },\n }) => {\n const items = steps.reduce((acc, { state, title, separatorClassName, ...props }, index) => {\n const containerSize = state === \"Current\" ? maxSize : minSize;\n const StepContainer = styledLi(containerSize);\n const Step = styledDiv(Math.max(containerSize, 30), Math.max(containerSize, 30));\n const stepProps = {\n ...{\n size: stepSizeKey,\n state,\n title,\n number: index + 1,\n ...props,\n },\n };\n const stepElement = (\n <StepContainer key={`step-${title}`} className={classes.li}>\n {hasTitles ? (\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n ) : (\n <HvTooltip\n placement=\"bottom\"\n title={<HvTypography>{`${index + 1}. ${title}`}</HvTypography>}\n >\n <div aria-label={`step-container-${title}`}>\n <Step className={classes.li}>\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n </Step>\n </div>\n </HvTooltip>\n )}\n </StepContainer>\n );\n if (index < steps.length - 1) {\n const separatorElement = styledSeparatorElement(\n title,\n separatorClassName,\n height,\n [steps[index + 1].state, state].includes(\"Current\") ? minWidth : maxWidth,\n getColor(state)\n );\n return [...acc, stepElement, separatorElement];\n }\n return [...acc, stepElement];\n }, []);\n\n return <ol className={classes.ol}>{items}</ol>;\n };\n\n const getDynamicValues = (stepsWidth) => {\n const maxWidth =\n width?.[breakpoint] ??\n Math.max(\n Number(hasTitles) * (TITLE_WIDTH + TITLE_MARGIN) * steps.length - TITLE_MARGIN,\n SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth\n );\n const next = theme.breakpoints.keys.find((_, index, self) =>\n index - 1 >= 0 ? self[index - 1] === breakpoint : false\n );\n const navWidth = Math.min(maxWidth, theme.breakpoints.values?.[next] ?? maxWidth);\n const titleWidth = Number(hasTitles) * Math.ceil((navWidth + TITLE_MARGIN) / steps.length);\n const separatorWidth =\n Number(!hasTitles) * Math.ceil((navWidth - stepsWidth) / (steps.length - 1));\n return { width: navWidth, titleWidth, separatorWidth };\n };\n\n const styledTitle = (titleClassName, variant, title, titleWidth) =>\n withStyles({\n stepTitle: {\n textAlign: \"center\",\n width: titleWidth - TITLE_MARGIN,\n marginRight: TITLE_MARGIN,\n },\n })(({ classes: { stepTitle } }) =>\n title ? (\n <HvTypography variant={variant} className={clsx(stepTitle, titleClassName)}>\n {title}\n </HvTypography>\n ) : null\n );\n\n const getTitles = (getTitleProps) =>\n hasTitles ? (\n <div className={classes.titles}>\n {steps.map(({ title: rawTitle, state, titleClassName }, index) => {\n const {\n variant = \"highlightText\",\n title = rawTitle,\n titleWidth = 0,\n } = getTitleProps({\n state,\n rawTitle,\n number: index + 1,\n });\n const Title = styledTitle(titleClassName, variant, title, titleWidth);\n return <Title key={`step-title-${rawTitle}`} />;\n })}\n </div>\n ) : null;\n\n const StepNavigation = {\n Default: HvDefaultNavigation,\n Simple: HvSimpleNavigation,\n }[type];\n\n return (\n <StepNavigation\n {...{\n stepSize: stepSizeKey,\n numSteps: steps.length,\n getTitles,\n getDynamicValues,\n className: clsx(className, classes.root),\n ...others,\n }}\n >\n {({ stepsWidth, navWidth, ...itemsProps }) => (\n <Typography\n component=\"nav\"\n style={{\n width: `${navWidth}px`,\n margin: 0,\n }}\n >\n {drawItems(itemsProps)}\n </Typography>\n )}\n </StepNavigation>\n );\n};\n\nHvStepNavigation.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the li element.\n */\n li: PropTypes.string,\n /**\n * Styles applied to the ol element.\n */\n ol: PropTypes.string,\n /**\n * Styles applied to the separator element.\n */\n separator: PropTypes.string,\n /**\n * Styles applied to the titles container element.\n */\n titles: PropTypes.string,\n }).isRequired,\n /**\n * Type of step navigation. Values = {\"Simple\", \"Default\"}.\n */\n type: PropTypes.oneOf([\"Simple\", \"Default\"]),\n /**\n * Steps to show on the component.\n */\n steps: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * Class names to override styles on the step component.\n */\n className: PropTypes.string,\n /**\n * Class names to override styles on the separator component after the step.\n */\n separatorClassName: PropTypes.string,\n /**\n * Class names to override styles on the title component above the step.\n */\n titleClassName: PropTypes.string,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}.\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Define if a step is disabled/enabled.\n * If this property is not defined and the step is on state \"Disabled\", the step component will be disabled\n */\n disabled: PropTypes.bool,\n })\n ).isRequired,\n /**\n * Sets one of the standard sizes of the steps. Values = {\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"}\n */\n stepSize: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * Width of the component element on each breakpoint screen resolution.\n */\n width: PropTypes.shape({\n xs: PropTypes.number,\n sm: PropTypes.number,\n md: PropTypes.number,\n lg: PropTypes.number,\n xl: PropTypes.number,\n }),\n /**\n * Defines either show a title or only a tooltip on each step component\n */\n showTitles: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"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A;EACElG,KAAK,EAAE8F,kBAAA,CAAUE,KAAV,CAAgB;IACrBM,EAAE,EAAER,kBAAA,CAAU5C,MADO;IAErBqD,EAAE,EAAET,kBAAA,CAAU5C,MAFO;IAGrBsD,EAAE,EAAEV,kBAAA,CAAU5C,MAHO;IAIrBuD,EAAE,EAAEX,kBAAA,CAAU5C,MAJO;IAKrBwD,EAAE,EAAEZ,kBAAA,CAAU5C;EALO,CAAhB,CAzEoB;;EAgF3B;AACF;AACA;EACE/C,UAAU,EAAE2F,kBAAA,CAAUO;AAnFK,CAA7B;;eAsFe,IAAA5E,gBAAA,EAAWkF,eAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAAiD/G,gBAAjD,C"}
|
|
@@ -22,6 +22,11 @@ export type HvStepProps = StandardProps<React.HTMLAttributes<HTMLDivElement>, Hv
|
|
|
22
22
|
* Number of the step.
|
|
23
23
|
*/
|
|
24
24
|
number?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Define if a step is disabled/enabled.
|
|
27
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean;
|
|
25
30
|
};
|
|
26
31
|
|
|
27
32
|
export default function HvStep(props: HvStepProps): JSX.Element | null;
|
|
@@ -17,6 +17,7 @@ var HvStep = function HvStep(_ref) {
|
|
|
17
17
|
state = _ref.state,
|
|
18
18
|
title = _ref.title,
|
|
19
19
|
onClick = _ref.onClick,
|
|
20
|
+
disabled = _ref.disabled,
|
|
20
21
|
_ref$size = _ref.size,
|
|
21
22
|
size = _ref$size === void 0 ? "SM" : _ref$size,
|
|
22
23
|
_ref$number = _ref.number,
|
|
@@ -56,7 +57,7 @@ var HvStep = function HvStep(_ref) {
|
|
|
56
57
|
"aria-label": "step-".concat(title),
|
|
57
58
|
icon: true,
|
|
58
59
|
overrideIconColors: false,
|
|
59
|
-
disabled: ["Current", "Disabled"].includes(state),
|
|
60
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : ["Current", "Disabled"].includes(state),
|
|
60
61
|
onClick: onClick
|
|
61
62
|
}, /*#__PURE__*/React.createElement(HvAvatar, {
|
|
62
63
|
className: clsx(classes.avatar, classes[size]),
|
|
@@ -161,7 +162,13 @@ process.env.NODE_ENV !== "production" ? HvStep.propTypes = {
|
|
|
161
162
|
/**
|
|
162
163
|
* Event onClick of the step.
|
|
163
164
|
*/
|
|
164
|
-
onClick: PropTypes.func
|
|
165
|
+
onClick: PropTypes.func,
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Define if a step is disabled/enabled.
|
|
169
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
170
|
+
*/
|
|
171
|
+
disabled: PropTypes.bool
|
|
165
172
|
} : void 0;
|
|
166
173
|
export default withStyles(styles, {
|
|
167
174
|
name: "HvStep"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.js","names":["React","PropTypes","clsx","withStyles","Level0Good","Level3Bad","HourGlass","HvAvatar","HvButton","getColor","styles","HvStep","className","classes","state","title","onClick","size","number","iconSize","XS","SM","MD","LG","XL","squareL","Pending","Failed","Completed","svgSize","backgroundColor","color","undefined","semantic","status","IconComponent","root","ghost","ghostDisabled","includes","avatar","propTypes","string","shape","stepTitle","isRequired","oneOf","func","name"],"sources":["../../../../../src/StepNavigation/DefaultNavigation/Step/Step.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles } from \"@material-ui/core\";\n\nimport { Level0Good, Level3Bad, HourGlass } from \"@hitachivantara/uikit-react-icons\";\nimport { HvAvatar, HvButton } from \"@hitachivantara/uikit-react-core\";\n\nimport { getColor } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Default\" Step Navigation root component\n */\nconst HvStep = ({
|
|
1
|
+
{"version":3,"file":"Step.js","names":["React","PropTypes","clsx","withStyles","Level0Good","Level3Bad","HourGlass","HvAvatar","HvButton","getColor","styles","HvStep","className","classes","state","title","onClick","disabled","size","number","iconSize","XS","SM","MD","LG","XL","squareL","Pending","Failed","Completed","svgSize","backgroundColor","color","undefined","semantic","status","IconComponent","root","ghost","ghostDisabled","includes","avatar","propTypes","string","shape","stepTitle","isRequired","oneOf","func","bool","name"],"sources":["../../../../../src/StepNavigation/DefaultNavigation/Step/Step.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles } from \"@material-ui/core\";\n\nimport { Level0Good, Level3Bad, HourGlass } from \"@hitachivantara/uikit-react-icons\";\nimport { HvAvatar, HvButton } from \"@hitachivantara/uikit-react-core\";\n\nimport { getColor } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Default\" Step Navigation root component\n */\nconst HvStep = ({\n className,\n classes,\n state,\n title,\n onClick,\n disabled,\n size = \"SM\",\n number = 1,\n}) => {\n const iconSize = {\n XS: \"XS\",\n SM: \"XS\",\n MD: \"S\",\n LG: \"M\",\n XL: \"M\",\n }[size];\n\n const squareL = {\n Pending: 16,\n Failed: 24,\n Completed: 24,\n }[state];\n\n const svgSize = {\n XS: squareL - 8,\n SM: squareL,\n MD: squareL + 8,\n LG: squareL + 16,\n XL: squareL + 24,\n }[size];\n\n const backgroundColor = getColor(state);\n\n const color = state === \"Pending\" ? \"atmo2\" : undefined;\n\n const semantic = state !== \"Pending\" ? backgroundColor : undefined;\n\n const status = state === \"Current\" ? \"atmo5\" : undefined;\n\n const IconComponent = {\n Pending: HourGlass,\n Failed: Level3Bad,\n Completed: Level0Good,\n }[state];\n\n return (\n <div\n className={clsx(className, classes.root, { [classes[\"not-current\"]]: state !== \"Current\" })}\n >\n <HvButton\n className={clsx(classes.ghost, { [classes.ghostDisabled]: state === \"Current\" })}\n aria-label={`step-${title}`}\n icon\n overrideIconColors={false}\n disabled={disabled ?? [\"Current\", \"Disabled\"].includes(state)}\n onClick={onClick}\n >\n <HvAvatar\n className={clsx(classes.avatar, classes[size])}\n backgroundColor={backgroundColor}\n status={status}\n size={size}\n >\n {IconComponent ? (\n <IconComponent\n color={color}\n semantic={semantic}\n width={svgSize}\n height={svgSize}\n iconSize={iconSize}\n />\n ) : (\n number\n )}\n </HvAvatar>\n </HvButton>\n </div>\n );\n};\n\nHvStep.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the ghost class.\n */\n ghost: PropTypes.string,\n /**\n * Styles applied to the ghostDisabled class.\n */\n ghostDisabled: PropTypes.string,\n /**\n * Styles applied to the root element when step is not in \"current\" state.\n */\n \"not-current\": PropTypes.string,\n /**\n * Styles applied to the root element when size is XS.\n */\n XS: PropTypes.string,\n /**\n * Styles applied to the root element when size is SM.\n */\n SM: PropTypes.string,\n /**\n * Styles applied to the root element when size is MD.\n */\n MD: PropTypes.string,\n /**\n * Styles applied to the root element when size is LG.\n */\n LG: PropTypes.string,\n /**\n * Styles applied to the root element when size is XL.\n */\n XL: PropTypes.string,\n /**\n * Styles applied to the avatar element.\n */\n avatar: PropTypes.string,\n /**\n * Styles applied to the title of a step element.\n */\n stepTitle: PropTypes.string,\n }).isRequired,\n /**\n * Sets one of the standard sizes of the step\n */\n size: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * Number of the step.\n */\n number: PropTypes.number,\n /**\n * Event onClick of the step.\n */\n onClick: PropTypes.func,\n /**\n * Define if a step is disabled/enabled.\n * If this property is not defined and the step is on state \"Disabled\", the step component will be disabled\n */\n disabled: PropTypes.bool,\n};\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jE;;EA8DjB;AACF;AACA;EACE/B,KAAK,EAAEd,SAAS,CAAC0C,MAAV,CAAiBG,UAjEP;;EAkEjB;AACF;AACA;EACE3B,MAAM,EAAElB,SAAS,CAACkB,MArED;;EAsEjB;AACF;AACA;EACEH,OAAO,EAAEf,SAAS,CAAC+C,IAzEF;;EA0EjB;AACF;AACA;AACA;EACE/B,QAAQ,EAAEhB,SAAS,CAACgD;AA9EH,CAAnB;AAiFA,eAAe9C,UAAU,CAACO,MAAD,EAAS;EAAEwC,IAAI,EAAE;AAAR,CAAT,CAAV,CAAuCvC,MAAvC,CAAf"}
|
|
@@ -5,6 +5,6 @@ import { HvStepProps } from "../../DefaultNavigation/Step";
|
|
|
5
5
|
export type HvDotClassKey = "root";
|
|
6
6
|
|
|
7
7
|
export type HvDotProps = StandardProps<React.HTMLAttributes<HTMLDivElement>, HvDotClassKey> &
|
|
8
|
-
Pick<HvStepProps, "size" | "title" | "state" | "onClick">;
|
|
8
|
+
Pick<HvStepProps, "size" | "title" | "state" | "onClick" | "disabled">;
|
|
9
9
|
|
|
10
10
|
export default function HvDot(props: HvDotProps): JSX.Element | null;
|
|
@@ -30,7 +30,8 @@ var HvDot = function HvDot(_ref) {
|
|
|
30
30
|
state = _ref.state,
|
|
31
31
|
title = _ref.title,
|
|
32
32
|
size = _ref.size,
|
|
33
|
-
onClick = _ref.onClick
|
|
33
|
+
onClick = _ref.onClick,
|
|
34
|
+
disabled = _ref.disabled;
|
|
34
35
|
var dotSize = dotSizes[size] * (state === "Current" ? 1.5 : 1);
|
|
35
36
|
var getBackgroundColor = useCallback(function (theme) {
|
|
36
37
|
return state === "Disabled" ? disabledColor(theme) : defaultColor(theme);
|
|
@@ -59,11 +60,11 @@ var HvDot = function HvDot(_ref) {
|
|
|
59
60
|
});
|
|
60
61
|
}, [dotSize, getBackgroundColor])();
|
|
61
62
|
return /*#__PURE__*/React.createElement(HvButton, {
|
|
62
|
-
className: clsx(classes.root, customClasses.ghost,
|
|
63
|
+
className: clsx(classes.root, customClasses.ghost, (disabled !== null && disabled !== void 0 ? disabled : "Current Disabled".includes(state)) && customClasses.ghostDisabled, className, state === "Current" && customClasses.active),
|
|
63
64
|
"aria-label": "step-".concat(title),
|
|
64
65
|
icon: true,
|
|
65
66
|
overrideIconColors: false,
|
|
66
|
-
disabled: ["Current", "Disabled"].includes(state),
|
|
67
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : ["Current", "Disabled"].includes(state),
|
|
67
68
|
onClick: onClick
|
|
68
69
|
}, []);
|
|
69
70
|
};
|
|
@@ -117,7 +118,13 @@ process.env.NODE_ENV !== "production" ? HvDot.propTypes = {
|
|
|
117
118
|
/**
|
|
118
119
|
* Event onClick of the step.
|
|
119
120
|
*/
|
|
120
|
-
onClick: PropTypes.func
|
|
121
|
+
onClick: PropTypes.func,
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Define if a step is disabled/enabled.
|
|
125
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
126
|
+
*/
|
|
127
|
+
disabled: PropTypes.bool
|
|
121
128
|
} : void 0;
|
|
122
129
|
export default withStyles(styles, {
|
|
123
130
|
name: "HvDot"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dot.js","names":["React","useCallback","useMemo","PropTypes","clsx","HvButton","makeStyles","withStyles","defaultColor","disabledColor","dotSizes","styles","HvDot","classes","className","state","title","size","onClick","dotSize","getBackgroundColor","theme","customClasses","backgroundColor","ghostDisabled","active","ghost","width","height","root","includes","propTypes","string","shape","isRequired","oneOf","func","name"],"sources":["../../../../../src/StepNavigation/SimpleNavigation/Dot/Dot.js"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { HvButton } from \"@hitachivantara/uikit-react-core\";\nimport { makeStyles, withStyles } from \"@material-ui/core\";\n\nimport { defaultColor, disabledColor, dotSizes } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Simple\" Step Navigation root component\n */\nconst HvDot = ({ classes, className, state, title, size, onClick }) => {\n const dotSize = dotSizes[size] * (state === \"Current\" ? 1.5 : 1);\n const getBackgroundColor = useCallback(\n (theme) => (state === \"Disabled\" ? disabledColor(theme) : defaultColor(theme)),\n [state]\n );\n const customClasses = useMemo(\n () =>\n makeStyles((theme) => {\n const backgroundColor = getBackgroundColor(theme);\n return {\n ghostDisabled: {},\n active: {},\n ghost: {\n ...styles.ghost,\n width: dotSize,\n height: dotSize,\n backgroundColor,\n \"&:hover\": {\n backgroundColor,\n },\n \"&$ghostDisabled\": {\n ...styles.ghost[\"&$ghostDisabled\"],\n backgroundColor,\n },\n \"&$ghostDisabled&:hover\": {\n ...styles.ghost[\"&$ghostDisabled&:hover\"],\n backgroundColor,\n },\n },\n };\n }),\n [dotSize, getBackgroundColor]\n )();\n return (\n <HvButton\n className={clsx(\n classes.root,\n customClasses.ghost,\n {\n [customClasses.active]: state === \"Current\",\n [customClasses.ghostDisabled]: [\"Current\", \"Disabled\"].includes(state),\n },\n className\n )}\n aria-label={`step-${title}`}\n icon\n overrideIconColors={false}\n disabled={[\"Current\", \"Disabled\"].includes(state)}\n onClick={onClick}\n >\n {[]}\n </HvButton>\n );\n};\n\nHvDot.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the active class.\n */\n active: PropTypes.string,\n /**\n * Styles applied to the ghost class.\n */\n ghost: PropTypes.string,\n /**\n * Styles applied to the ghostDisabled class.\n */\n ghostDisabled: PropTypes.string,\n }).isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * Sets one of the standard sizes of the steps\n */\n size: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]).isRequired,\n /**\n * Event onClick of the step.\n */\n onClick: PropTypes.func,\n};\n\nexport default withStyles(styles, { name: \"HvDot\" })(HvDot);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,OAA7B,QAA4C,OAA5C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AAEA,SAASC,QAAT,QAAyB,kCAAzB;AACA,SAASC,UAAT,EAAqBC,UAArB,QAAuC,mBAAvC;AAEA,SAASC,YAAT,EAAuBC,aAAvB,EAAsCC,QAAtC,QAAsD,UAAtD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;;AACA,IAAMC,KAAK,GAAG,SAARA,KAAQ,
|
|
1
|
+
{"version":3,"file":"Dot.js","names":["React","useCallback","useMemo","PropTypes","clsx","HvButton","makeStyles","withStyles","defaultColor","disabledColor","dotSizes","styles","HvDot","classes","className","state","title","size","onClick","disabled","dotSize","getBackgroundColor","theme","customClasses","backgroundColor","ghostDisabled","active","ghost","width","height","root","includes","propTypes","string","shape","isRequired","oneOf","func","bool","name"],"sources":["../../../../../src/StepNavigation/SimpleNavigation/Dot/Dot.js"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { HvButton } from \"@hitachivantara/uikit-react-core\";\nimport { makeStyles, withStyles } from \"@material-ui/core\";\n\nimport { defaultColor, disabledColor, dotSizes } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Simple\" Step Navigation root component\n */\nconst HvDot = ({ classes, className, state, title, size, onClick, disabled }) => {\n const dotSize = dotSizes[size] * (state === \"Current\" ? 1.5 : 1);\n const getBackgroundColor = useCallback(\n (theme) => (state === \"Disabled\" ? disabledColor(theme) : defaultColor(theme)),\n [state]\n );\n const customClasses = useMemo(\n () =>\n makeStyles((theme) => {\n const backgroundColor = getBackgroundColor(theme);\n return {\n ghostDisabled: {},\n active: {},\n ghost: {\n ...styles.ghost,\n width: dotSize,\n height: dotSize,\n backgroundColor,\n \"&:hover\": {\n backgroundColor,\n },\n \"&$ghostDisabled\": {\n ...styles.ghost[\"&$ghostDisabled\"],\n backgroundColor,\n },\n \"&$ghostDisabled&:hover\": {\n ...styles.ghost[\"&$ghostDisabled&:hover\"],\n backgroundColor,\n },\n },\n };\n }),\n [dotSize, getBackgroundColor]\n )();\n return (\n <HvButton\n className={clsx(\n classes.root,\n customClasses.ghost,\n {\n [customClasses.active]: state === \"Current\",\n [customClasses.ghostDisabled]: disabled ?? [\"Current\", \"Disabled\"].includes(state),\n },\n className\n )}\n aria-label={`step-${title}`}\n icon\n overrideIconColors={false}\n disabled={disabled ?? [\"Current\", \"Disabled\"].includes(state)}\n onClick={onClick}\n >\n {[]}\n </HvButton>\n );\n};\n\nHvDot.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the active class.\n */\n active: PropTypes.string,\n /**\n * Styles applied to the ghost class.\n */\n ghost: PropTypes.string,\n /**\n * Styles applied to the ghostDisabled class.\n */\n ghostDisabled: PropTypes.string,\n }).isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * Sets one of the standard sizes of the steps\n */\n size: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]).isRequired,\n /**\n * Event onClick of the step.\n */\n onClick: PropTypes.func,\n /**\n * Define if a step is disabled/enabled.\n * If this property is not defined and the step is on state \"Disabled\", the step component will be disabled\n */\n disabled: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvDot\" })(HvDot);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,OAA7B,QAA4C,OAA5C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AAEA,SAASC,QAAT,QAAyB,kCAAzB;AACA,SAASC,UAAT,EAAqBC,UAArB,QAAuC,mBAAvC;AAEA,SAASC,YAAT,EAAuBC,aAAvB,EAAsCC,QAAtC,QAAsD,UAAtD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;;AACA,IAAMC,KAAK,GAAG,SAARA,KAAQ,OAAmE;EAAA,IAAhEC,OAAgE,QAAhEA,OAAgE;EAAA,IAAvDC,SAAuD,QAAvDA,SAAuD;EAAA,IAA5CC,KAA4C,QAA5CA,KAA4C;EAAA,IAArCC,KAAqC,QAArCA,KAAqC;EAAA,IAA9BC,IAA8B,QAA9BA,IAA8B;EAAA,IAAxBC,OAAwB,QAAxBA,OAAwB;EAAA,IAAfC,QAAe,QAAfA,QAAe;EAC/E,IAAMC,OAAO,GAAGV,QAAQ,CAACO,IAAD,CAAR,IAAkBF,KAAK,KAAK,SAAV,GAAsB,GAAtB,GAA4B,CAA9C,CAAhB;EACA,IAAMM,kBAAkB,GAAGpB,WAAW,CACpC,UAACqB,KAAD;IAAA,OAAYP,KAAK,KAAK,UAAV,GAAuBN,aAAa,CAACa,KAAD,CAApC,GAA8Cd,YAAY,CAACc,KAAD,CAAtE;EAAA,CADoC,EAEpC,CAACP,KAAD,CAFoC,CAAtC;EAIA,IAAMQ,aAAa,GAAGrB,OAAO,CAC3B;IAAA,OACEI,UAAU,CAAC,UAACgB,KAAD,EAAW;MACpB,IAAME,eAAe,GAAGH,kBAAkB,CAACC,KAAD,CAA1C;MACA,OAAO;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8B,MAJO;;IAKvB;AACJ;AACA;IACIP,MAAM,EAAEvB,SAAS,CAAC8B,MARK;;IASvB;AACJ;AACA;IACIN,KAAK,EAAExB,SAAS,CAAC8B,MAZM;;IAavB;AACJ;AACA;IACIR,aAAa,EAAEtB,SAAS,CAAC8B;EAhBF,CAAhB,EAiBNE,UAzBa;;EA0BhB;AACF;AACA;EACEpB,KAAK,EAAEZ,SAAS,CAACiC,KAAV,CAAgB,CAAC,SAAD,EAAY,QAAZ,EAAsB,WAAtB,EAAmC,SAAnC,EAA8C,UAA9C,CAAhB,EAA2ED,UA7BlE;;EA8BhB;AACF;AACA;EACEnB,KAAK,EAAEb,SAAS,CAAC8B,MAAV,CAAiBE,UAjCR;;EAkChB;AACF;AACA;EACElB,IAAI,EAAEd,SAAS,CAACiC,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,EAAyB,IAAzB,CAAhB,EAAgDD,UArCtC;;EAsChB;AACF;AACA;EACEjB,OAAO,EAAEf,SAAS,CAACkC,IAzCH;;EA0ChB;AACF;AACA;AACA;EACElB,QAAQ,EAAEhB,SAAS,CAACmC;AA9CJ,CAAlB;AAiDA,eAAe/B,UAAU,CAACI,MAAD,EAAS;EAAE4B,IAAI,EAAE;AAAR,CAAT,CAAV,CAAsC3B,KAAtC,CAAf"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { StandardProps } from "@material-ui/core";
|
|
3
|
+
import { Breakpoint } from "@material-ui/core/styles/createBreakpoints";
|
|
3
4
|
import { HvStepProps } from "./DefaultNavigation/Step/Step";
|
|
4
5
|
|
|
5
6
|
export type HvStepNavigationClassKey = "root";
|
|
@@ -15,7 +16,7 @@ export type HvStepNavigationProps = StandardProps<
|
|
|
15
16
|
/**
|
|
16
17
|
* Steps to show on the component.
|
|
17
18
|
*/
|
|
18
|
-
steps: Array<Pick<HvStepProps, "state" | "title" | "onClick" | "className">> & {
|
|
19
|
+
steps: Array<Pick<HvStepProps, "state" | "title" | "onClick" | "className" | "disabled">> & {
|
|
19
20
|
/**
|
|
20
21
|
* Class names to override styles on the separator component after the step.
|
|
21
22
|
*/
|
|
@@ -26,15 +27,15 @@ export type HvStepNavigationProps = StandardProps<
|
|
|
26
27
|
titleClassName: string;
|
|
27
28
|
};
|
|
28
29
|
/**
|
|
29
|
-
* Sets one of the standard sizes of the steps
|
|
30
|
+
* Sets one of the standard sizes of the steps.
|
|
30
31
|
*/
|
|
31
32
|
stepSize?: "XS" | "SM" | "MD" | "LG" | "XL";
|
|
32
33
|
/**
|
|
33
|
-
* Width of the component element.
|
|
34
|
+
* Width of the component element on each breakpoint screen resolution.
|
|
34
35
|
*/
|
|
35
|
-
width?: number;
|
|
36
|
+
width?: { [breakpoint in Breakpoint]?: number };
|
|
36
37
|
/**
|
|
37
|
-
* Defines either show a title or only a tooltip on each step component
|
|
38
|
+
* Defines either show a title or only a tooltip on each step component.
|
|
38
39
|
*/
|
|
39
40
|
showTitles?: boolean;
|
|
40
41
|
};
|
|
@@ -165,9 +165,9 @@ var HvStepNavigation = function HvStepNavigation(_ref) {
|
|
|
165
165
|
};
|
|
166
166
|
|
|
167
167
|
var getDynamicValues = function getDynamicValues(stepsWidth) {
|
|
168
|
-
var _theme$breakpoints$va, _theme$breakpoints$va2;
|
|
168
|
+
var _width$breakpoint, _theme$breakpoints$va, _theme$breakpoints$va2;
|
|
169
169
|
|
|
170
|
-
var maxWidth = width !== null &&
|
|
170
|
+
var maxWidth = (_width$breakpoint = width === null || width === void 0 ? void 0 : width[breakpoint]) !== null && _width$breakpoint !== void 0 ? _width$breakpoint : Math.max(Number(hasTitles) * (TITLE_WIDTH + TITLE_MARGIN) * steps.length - TITLE_MARGIN, SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth);
|
|
171
171
|
var next = theme.breakpoints.keys.find(function (_, index, self) {
|
|
172
172
|
return index - 1 >= 0 ? self[index - 1] === breakpoint : false;
|
|
173
173
|
});
|
|
@@ -317,7 +317,13 @@ process.env.NODE_ENV !== "production" ? HvStepNavigation.propTypes = {
|
|
|
317
317
|
/**
|
|
318
318
|
* State of the step. Values = {"Pending", "Failed", "Completed", "Current", "Disabled"}.
|
|
319
319
|
*/
|
|
320
|
-
state: PropTypes.oneOf(["Pending", "Failed", "Completed", "Current", "Disabled"]).isRequired
|
|
320
|
+
state: PropTypes.oneOf(["Pending", "Failed", "Completed", "Current", "Disabled"]).isRequired,
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Define if a step is disabled/enabled.
|
|
324
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
325
|
+
*/
|
|
326
|
+
disabled: PropTypes.bool
|
|
321
327
|
})).isRequired,
|
|
322
328
|
|
|
323
329
|
/**
|
|
@@ -326,9 +332,15 @@ process.env.NODE_ENV !== "production" ? HvStepNavigation.propTypes = {
|
|
|
326
332
|
stepSize: PropTypes.oneOf(["XS", "SM", "MD", "LG", "XL"]),
|
|
327
333
|
|
|
328
334
|
/**
|
|
329
|
-
* Width of the component.
|
|
335
|
+
* Width of the component element on each breakpoint screen resolution.
|
|
330
336
|
*/
|
|
331
|
-
width: PropTypes.
|
|
337
|
+
width: PropTypes.shape({
|
|
338
|
+
xs: PropTypes.number,
|
|
339
|
+
sm: PropTypes.number,
|
|
340
|
+
md: PropTypes.number,
|
|
341
|
+
lg: PropTypes.number,
|
|
342
|
+
xl: PropTypes.number
|
|
343
|
+
}),
|
|
332
344
|
|
|
333
345
|
/**
|
|
334
346
|
* Defines either show a title or only a tooltip on each step component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepNavigation.js","names":["React","PropTypes","clsx","withStyles","Typography","styled","useTheme","HvTooltip","HvTypography","useWidth","HvDefaultNavigation","HvSimpleNavigation","SEPARATOR_WIDTH","TITLE_MARGIN","TITLE_WIDTH","styles","HvStepNavigation","className","classes","width","steps","stepSize","showTitles","type","others","theme","breakpoint","stepSizeKey","includes","hasTitles","styledLi","containerSize","height","styledDiv","styledSeparatorElement","title","separatorClassName","separatorHeight","separatorWidth","backgroundColor","Separator","separatorElement","separator","drawItems","separatorValues","minWidth","maxWidth","getColor","stepValues","minSize","maxSize","StepComponent","items","reduce","acc","index","state","props","StepContainer","Step","Math","max","stepProps","size","number","stepElement","li","length","ol","getDynamicValues","stepsWidth","Number","next","breakpoints","keys","find","_","self","navWidth","min","values","titleWidth","ceil","styledTitle","titleClassName","variant","stepTitle","textAlign","marginRight","getTitles","getTitleProps","titles","map","rawTitle","Title","StepNavigation","Default","Simple","numSteps","root","itemsProps","margin","propTypes","string","shape","isRequired","oneOf","arrayOf","bool","name"],"sources":["../../../src/StepNavigation/StepNavigation.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles, Typography, styled, useTheme } from \"@material-ui/core\";\nimport { HvTooltip, HvTypography, useWidth } from \"@hitachivantara/uikit-react-core\";\n\nimport HvDefaultNavigation from \"./DefaultNavigation\";\nimport HvSimpleNavigation from \"./SimpleNavigation\";\nimport { SEPARATOR_WIDTH, TITLE_MARGIN, TITLE_WIDTH } from \"./utils\";\nimport styles from \"./styles\";\n\n/**\n * Navigation page with steps.\n *\n * You need to define the <b>steps<b/> displayed on the component so that itself can be drawn on the UI.\n * On each step, you need to define a <b>state</b> - 'Pending', 'Failed', 'Completed', 'Current', 'Disabled' -\n * and a <b>title</b> to be shown as a tooltip or a text above of the step. You can also:\n * * Define a <b>className</b> on each step element;\n * * Define a <b>separatorClassName</b> to specify a className for the separator element. The default height\n * values of the separator element are 2px/3px on 'Simple'/'Default' layouts respectively;\n * * Define a <b>titleClassName</b> to specify a className for the title above each step element.\n *\n * For the root element, you can:\n * * Define a <b>className</b>;\n * * Choose a <b>type</b> of layout: 'Simple' or 'Default';\n * * Choose the <b>stepSize</b> of the step component: \"XS\", \"SM\", \"MD\", \"LG\", \"XL\". The default size will be\n * correspondent to the current media breakpoint;\n * * Choose either you want to <b>showTitles</b> near to each step component or a tootlip on hover;\n * * Define a <b>width</b> of the component. If you don't define any value and the step component has no title\n * displayed above, the width of the separator element;\n * will be 100px. If the step component has titles, each one will have 215px of width by default.\n */\nconst HvStepNavigation = ({\n className,\n classes,\n width,\n steps,\n stepSize,\n showTitles,\n type = \"Default\",\n ...others\n}) => {\n const theme = useTheme();\n // current breakpoint 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n const breakpoint = useWidth();\n // step configurations\n const stepSizeKey = stepSize ?? ([\"xs\", \"sm\"].includes(breakpoint) ? \"SM\" : \"MD\");\n const hasTitles = showTitles ?? ![\"xs\", \"sm\"].includes(breakpoint);\n\n const styledLi = (containerSize) =>\n styled(\"li\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledDiv = (containerSize) =>\n styled(\"div\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledSeparatorElement = (\n title,\n separatorClassName,\n separatorHeight,\n separatorWidth,\n backgroundColor\n ) => {\n const Separator = withStyles({\n separatorElement: {\n height: separatorHeight,\n width: separatorWidth,\n backgroundColor,\n },\n })(({ classes: { separatorElement } }) => (\n <div\n aria-label={`separator-${title}`}\n className={clsx(separatorElement, separatorClassName)}\n />\n ));\n return (\n <li aria-hidden key={`separator-${title}`} className={classes.separator}>\n <Separator />\n </li>\n );\n };\n\n const drawItems = ({\n separatorValues: { minWidth, maxWidth, getColor, height },\n stepValues: { minSize, maxSize, StepComponent },\n }) => {\n const items = steps.reduce((acc, { state, title, separatorClassName, ...props }, index) => {\n const containerSize = state === \"Current\" ? maxSize : minSize;\n const StepContainer = styledLi(containerSize);\n const Step = styledDiv(Math.max(containerSize, 30), Math.max(containerSize, 30));\n const stepProps = {\n ...{\n size: stepSizeKey,\n state,\n title,\n number: index + 1,\n ...props,\n },\n };\n const stepElement = (\n <StepContainer key={`step-${title}`} className={classes.li}>\n {hasTitles ? (\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n ) : (\n <HvTooltip\n placement=\"bottom\"\n title={<HvTypography>{`${index + 1}. ${title}`}</HvTypography>}\n >\n <div aria-label={`step-container-${title}`}>\n <Step className={classes.li}>\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n </Step>\n </div>\n </HvTooltip>\n )}\n </StepContainer>\n );\n if (index < steps.length - 1) {\n const separatorElement = styledSeparatorElement(\n title,\n separatorClassName,\n height,\n [steps[index + 1].state, state].includes(\"Current\") ? minWidth : maxWidth,\n getColor(state)\n );\n return [...acc, stepElement, separatorElement];\n }\n return [...acc, stepElement];\n }, []);\n\n return <ol className={classes.ol}>{items}</ol>;\n };\n\n const getDynamicValues = (stepsWidth) => {\n const maxWidth =\n width ??\n Math.max(\n Number(hasTitles) * (TITLE_WIDTH + TITLE_MARGIN) * steps.length - TITLE_MARGIN,\n SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth\n );\n const next = theme.breakpoints.keys.find((_, index, self) =>\n index - 1 >= 0 ? self[index - 1] === breakpoint : false\n );\n const navWidth = Math.min(maxWidth, theme.breakpoints.values?.[next] ?? maxWidth);\n const titleWidth = Number(hasTitles) * Math.ceil((navWidth + TITLE_MARGIN) / steps.length);\n const separatorWidth =\n Number(!hasTitles) * Math.ceil((navWidth - stepsWidth) / (steps.length - 1));\n return { width: navWidth, titleWidth, separatorWidth };\n };\n\n const styledTitle = (titleClassName, variant, title, titleWidth) =>\n withStyles({\n stepTitle: {\n textAlign: \"center\",\n width: titleWidth - TITLE_MARGIN,\n marginRight: TITLE_MARGIN,\n },\n })(({ classes: { stepTitle } }) =>\n title ? (\n <HvTypography variant={variant} className={clsx(stepTitle, titleClassName)}>\n {title}\n </HvTypography>\n ) : null\n );\n\n const getTitles = (getTitleProps) =>\n hasTitles ? (\n <div className={classes.titles}>\n {steps.map(({ title: rawTitle, state, titleClassName }, index) => {\n const {\n variant = \"highlightText\",\n title = rawTitle,\n titleWidth = 0,\n } = getTitleProps({\n state,\n rawTitle,\n number: index + 1,\n });\n const Title = styledTitle(titleClassName, variant, title, titleWidth);\n return <Title key={`step-title-${rawTitle}`} />;\n })}\n </div>\n ) : null;\n\n const StepNavigation = {\n Default: HvDefaultNavigation,\n Simple: HvSimpleNavigation,\n }[type];\n\n return (\n <StepNavigation\n {...{\n stepSize: stepSizeKey,\n numSteps: steps.length,\n getTitles,\n getDynamicValues,\n className: clsx(className, classes.root),\n ...others,\n }}\n >\n {({ stepsWidth, navWidth, ...itemsProps }) => (\n <Typography\n component=\"nav\"\n style={{\n width: `${navWidth}px`,\n margin: 0,\n }}\n >\n {drawItems(itemsProps)}\n </Typography>\n )}\n </StepNavigation>\n );\n};\n\nHvStepNavigation.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the li element.\n */\n li: PropTypes.string,\n /**\n * Styles applied to the ol element.\n */\n ol: PropTypes.string,\n /**\n * Styles applied to the separator element.\n */\n separator: PropTypes.string,\n /**\n * Styles applied to the titles container element.\n */\n titles: PropTypes.string,\n }).isRequired,\n /**\n * Type of step navigation. Values = {\"Simple\", \"Default\"}.\n */\n type: PropTypes.oneOf([\"Simple\", \"Default\"]),\n /**\n * Steps to show on the component.\n */\n steps: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * Class names to override styles on the step component.\n */\n className: PropTypes.string,\n /**\n * Class names to override styles on the separator component after the step.\n */\n separatorClassName: PropTypes.string,\n /**\n * Class names to override styles on the title component above the step.\n */\n titleClassName: PropTypes.string,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}.\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n })\n ).isRequired,\n /**\n * Sets one of the standard sizes of the steps. Values = {\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"}\n */\n stepSize: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * Width of the component.\n */\n width: PropTypes.number,\n /**\n * Defines either show a title or only a tooltip on each step component\n */\n showTitles: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvStepNavigation\" })(HvStepNavigation);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AAEA,SAASC,UAAT,EAAqBC,UAArB,EAAiCC,MAAjC,EAAyCC,QAAzC,QAAyD,mBAAzD;AACA,SAASC,SAAT,EAAoBC,YAApB,EAAkCC,QAAlC,QAAkD,kCAAlD;AAEA,OAAOC,mBAAP,MAAgC,qBAAhC;AACA,OAAOC,kBAAP,MAA+B,oBAA/B;AACA,SAASC,eAAT,EAA0BC,YAA1B,EAAwCC,WAAxC,QAA2D,SAA3D;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,OASnB;EAAA,IARJC,SAQI,QARJA,SAQI;EAAA,IAPJC,OAOI,QAPJA,OAOI;EAAA,IANJC,KAMI,QANJA,KAMI;EAAA,IALJC,KAKI,QALJA,KAKI;EAAA,IAJJC,QAII,QAJJA,QAII;EAAA,IAHJC,UAGI,QAHJA,UAGI;EAAA,qBAFJC,IAEI;EAAA,IAFJA,IAEI,0BAFG,SAEH;EAAA,IADDC,MACC;;EACJ,IAAMC,KAAK,GAAGnB,QAAQ,EAAtB,CADI,CAEJ;;EACA,IAAMoB,UAAU,GAAGjB,QAAQ,EAA3B,CAHI,CAIJ;;EACA,IAAMkB,WAAW,GAAGN,QAAH,aAAGA,QAAH,cAAGA,QAAH,GA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AhBV;;IAiBd;AACN;AACA;IACMjD,KAAK,EAAEvD,SAAS,CAACyG,KAAV,CAAgB,CAAC,SAAD,EAAY,QAAZ,EAAsB,WAAtB,EAAmC,SAAnC,EAA8C,UAA9C,CAAhB,EAA2ED;EApBpE,CAAhB,CADK,EAuBLA,UA5DyB;;EA6D3B;AACF;AACA;EACEpF,QAAQ,EAAEpB,SAAS,CAACyG,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,EAAyB,IAAzB,CAAhB,CAhEiB;;EAiE3B;AACF;AACA;EACEvF,KAAK,EAAElB,SAAS,CAAC+D,MApEU;;EAqE3B;AACF;AACA;EACE1C,UAAU,EAAErB,SAAS,CAAC2G;AAxEK,CAA7B;AA2EA,eAAezG,UAAU,CAACY,MAAD,EAAS;EAAE8F,IAAI,EAAE;AAAR,CAAT,CAAV,CAAiD7F,gBAAjD,CAAf"}
|
|
1
|
+
{"version":3,"file":"StepNavigation.js","names":["React","PropTypes","clsx","withStyles","Typography","styled","useTheme","HvTooltip","HvTypography","useWidth","HvDefaultNavigation","HvSimpleNavigation","SEPARATOR_WIDTH","TITLE_MARGIN","TITLE_WIDTH","styles","HvStepNavigation","className","classes","width","steps","stepSize","showTitles","type","others","theme","breakpoint","stepSizeKey","includes","hasTitles","styledLi","containerSize","height","styledDiv","styledSeparatorElement","title","separatorClassName","separatorHeight","separatorWidth","backgroundColor","Separator","separatorElement","separator","drawItems","separatorValues","minWidth","maxWidth","getColor","stepValues","minSize","maxSize","StepComponent","items","reduce","acc","index","state","props","StepContainer","Step","Math","max","stepProps","size","number","stepElement","li","length","ol","getDynamicValues","stepsWidth","Number","next","breakpoints","keys","find","_","self","navWidth","min","values","titleWidth","ceil","styledTitle","titleClassName","variant","stepTitle","textAlign","marginRight","getTitles","getTitleProps","titles","map","rawTitle","Title","StepNavigation","Default","Simple","numSteps","root","itemsProps","margin","propTypes","string","shape","isRequired","oneOf","arrayOf","disabled","bool","xs","sm","md","lg","xl","name"],"sources":["../../../src/StepNavigation/StepNavigation.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles, Typography, styled, useTheme } from \"@material-ui/core\";\nimport { HvTooltip, HvTypography, useWidth } from \"@hitachivantara/uikit-react-core\";\n\nimport HvDefaultNavigation from \"./DefaultNavigation\";\nimport HvSimpleNavigation from \"./SimpleNavigation\";\nimport { SEPARATOR_WIDTH, TITLE_MARGIN, TITLE_WIDTH } from \"./utils\";\nimport styles from \"./styles\";\n\n/**\n * Navigation page with steps.\n *\n * You need to define the <b>steps<b/> displayed on the component so that itself can be drawn on the UI.\n * On each step, you need to define a <b>state</b> - 'Pending', 'Failed', 'Completed', 'Current', 'Disabled' -\n * and a <b>title</b> to be shown as a tooltip or a text above of the step. You can also:\n * * Define a <b>className</b> on each step element;\n * * Define a <b>separatorClassName</b> to specify a className for the separator element. The default height\n * values of the separator element are 2px/3px on 'Simple'/'Default' layouts respectively;\n * * Define a <b>titleClassName</b> to specify a className for the title above each step element.\n *\n * For the root element, you can:\n * * Define a <b>className</b>;\n * * Choose a <b>type</b> of layout: 'Simple' or 'Default';\n * * Choose the <b>stepSize</b> of the step component: \"XS\", \"SM\", \"MD\", \"LG\", \"XL\". The default size will be\n * correspondent to the current media breakpoint;\n * * Choose either you want to <b>showTitles</b> near to each step component or a tootlip on hover;\n * * Define a <b>width</b> of the component. If you don't define any value and the step component has no title\n * displayed above, the width of the separator element;\n * will be 100px. If the step component has titles, each one will have 215px of width by default.\n */\nconst HvStepNavigation = ({\n className,\n classes,\n width,\n steps,\n stepSize,\n showTitles,\n type = \"Default\",\n ...others\n}) => {\n const theme = useTheme();\n // current breakpoint 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n const breakpoint = useWidth();\n // step configurations\n const stepSizeKey = stepSize ?? ([\"xs\", \"sm\"].includes(breakpoint) ? \"SM\" : \"MD\");\n const hasTitles = showTitles ?? ![\"xs\", \"sm\"].includes(breakpoint);\n\n const styledLi = (containerSize) =>\n styled(\"li\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledDiv = (containerSize) =>\n styled(\"div\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledSeparatorElement = (\n title,\n separatorClassName,\n separatorHeight,\n separatorWidth,\n backgroundColor\n ) => {\n const Separator = withStyles({\n separatorElement: {\n height: separatorHeight,\n width: separatorWidth,\n backgroundColor,\n },\n })(({ classes: { separatorElement } }) => (\n <div\n aria-label={`separator-${title}`}\n className={clsx(separatorElement, separatorClassName)}\n />\n ));\n return (\n <li aria-hidden key={`separator-${title}`} className={classes.separator}>\n <Separator />\n </li>\n );\n };\n\n const drawItems = ({\n separatorValues: { minWidth, maxWidth, getColor, height },\n stepValues: { minSize, maxSize, StepComponent },\n }) => {\n const items = steps.reduce((acc, { state, title, separatorClassName, ...props }, index) => {\n const containerSize = state === \"Current\" ? maxSize : minSize;\n const StepContainer = styledLi(containerSize);\n const Step = styledDiv(Math.max(containerSize, 30), Math.max(containerSize, 30));\n const stepProps = {\n ...{\n size: stepSizeKey,\n state,\n title,\n number: index + 1,\n ...props,\n },\n };\n const stepElement = (\n <StepContainer key={`step-${title}`} className={classes.li}>\n {hasTitles ? (\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n ) : (\n <HvTooltip\n placement=\"bottom\"\n title={<HvTypography>{`${index + 1}. ${title}`}</HvTypography>}\n >\n <div aria-label={`step-container-${title}`}>\n <Step className={classes.li}>\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n </Step>\n </div>\n </HvTooltip>\n )}\n </StepContainer>\n );\n if (index < steps.length - 1) {\n const separatorElement = styledSeparatorElement(\n title,\n separatorClassName,\n height,\n [steps[index + 1].state, state].includes(\"Current\") ? minWidth : maxWidth,\n getColor(state)\n );\n return [...acc, stepElement, separatorElement];\n }\n return [...acc, stepElement];\n }, []);\n\n return <ol className={classes.ol}>{items}</ol>;\n };\n\n const getDynamicValues = (stepsWidth) => {\n const maxWidth =\n width?.[breakpoint] ??\n Math.max(\n Number(hasTitles) * (TITLE_WIDTH + TITLE_MARGIN) * steps.length - TITLE_MARGIN,\n SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth\n );\n const next = theme.breakpoints.keys.find((_, index, self) =>\n index - 1 >= 0 ? self[index - 1] === breakpoint : false\n );\n const navWidth = Math.min(maxWidth, theme.breakpoints.values?.[next] ?? maxWidth);\n const titleWidth = Number(hasTitles) * Math.ceil((navWidth + TITLE_MARGIN) / steps.length);\n const separatorWidth =\n Number(!hasTitles) * Math.ceil((navWidth - stepsWidth) / (steps.length - 1));\n return { width: navWidth, titleWidth, separatorWidth };\n };\n\n const styledTitle = (titleClassName, variant, title, titleWidth) =>\n withStyles({\n stepTitle: {\n textAlign: \"center\",\n width: titleWidth - TITLE_MARGIN,\n marginRight: TITLE_MARGIN,\n },\n })(({ classes: { stepTitle } }) =>\n title ? (\n <HvTypography variant={variant} className={clsx(stepTitle, titleClassName)}>\n {title}\n </HvTypography>\n ) : null\n );\n\n const getTitles = (getTitleProps) =>\n hasTitles ? (\n <div className={classes.titles}>\n {steps.map(({ title: rawTitle, state, titleClassName }, index) => {\n const {\n variant = \"highlightText\",\n title = rawTitle,\n titleWidth = 0,\n } = getTitleProps({\n state,\n rawTitle,\n number: index + 1,\n });\n const Title = styledTitle(titleClassName, variant, title, titleWidth);\n return <Title key={`step-title-${rawTitle}`} />;\n })}\n </div>\n ) : null;\n\n const StepNavigation = {\n Default: HvDefaultNavigation,\n Simple: HvSimpleNavigation,\n }[type];\n\n return (\n <StepNavigation\n {...{\n stepSize: stepSizeKey,\n numSteps: steps.length,\n getTitles,\n getDynamicValues,\n className: clsx(className, classes.root),\n ...others,\n }}\n >\n {({ stepsWidth, navWidth, ...itemsProps }) => (\n <Typography\n component=\"nav\"\n style={{\n width: `${navWidth}px`,\n margin: 0,\n }}\n >\n {drawItems(itemsProps)}\n </Typography>\n )}\n </StepNavigation>\n );\n};\n\nHvStepNavigation.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the li element.\n */\n li: PropTypes.string,\n /**\n * Styles applied to the ol element.\n */\n ol: PropTypes.string,\n /**\n * Styles applied to the separator element.\n */\n separator: PropTypes.string,\n /**\n * Styles applied to the titles container element.\n */\n titles: PropTypes.string,\n }).isRequired,\n /**\n * Type of step navigation. Values = {\"Simple\", \"Default\"}.\n */\n type: PropTypes.oneOf([\"Simple\", \"Default\"]),\n /**\n * Steps to show on the component.\n */\n steps: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * Class names to override styles on the step component.\n */\n className: PropTypes.string,\n /**\n * Class names to override styles on the separator component after the step.\n */\n separatorClassName: PropTypes.string,\n /**\n * Class names to override styles on the title component above the step.\n */\n titleClassName: PropTypes.string,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}.\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Define if a step is disabled/enabled.\n * If this property is not defined and the step is on state \"Disabled\", the step component will be disabled\n */\n disabled: PropTypes.bool,\n })\n ).isRequired,\n /**\n * Sets one of the standard sizes of the steps. Values = {\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"}\n */\n stepSize: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * Width of the component element on each breakpoint screen resolution.\n */\n width: PropTypes.shape({\n xs: PropTypes.number,\n sm: PropTypes.number,\n md: PropTypes.number,\n lg: PropTypes.number,\n xl: PropTypes.number,\n }),\n /**\n * Defines either show a title or only a tooltip on each step component\n */\n showTitles: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvStepNavigation\" })(HvStepNavigation);\n"],"m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A;IACMG,QAAQ,EAAE3G,SAAS,CAAC4G;EAzBN,CAAhB,CADK,EA4BLJ,UAjEyB;;EAkE3B;AACF;AACA;EACEpF,QAAQ,EAAEpB,SAAS,CAACyG,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,EAAyB,IAAzB,CAAhB,CArEiB;;EAsE3B;AACF;AACA;EACEvF,KAAK,EAAElB,SAAS,CAACuG,KAAV,CAAgB;IACrBM,EAAE,EAAE7G,SAAS,CAAC+D,MADO;IAErB+C,EAAE,EAAE9G,SAAS,CAAC+D,MAFO;IAGrBgD,EAAE,EAAE/G,SAAS,CAAC+D,MAHO;IAIrBiD,EAAE,EAAEhH,SAAS,CAAC+D,MAJO;IAKrBkD,EAAE,EAAEjH,SAAS,CAAC+D;EALO,CAAhB,CAzEoB;;EAgF3B;AACF;AACA;EACE1C,UAAU,EAAErB,SAAS,CAAC4G;AAnFK,CAA7B;AAsFA,eAAe1G,UAAU,CAACY,MAAD,EAAS;EAAEoG,IAAI,EAAE;AAAR,CAAT,CAAV,CAAiDnG,gBAAjD,CAAf"}
|
|
@@ -22,6 +22,11 @@ export type HvStepProps = StandardProps<React.HTMLAttributes<HTMLDivElement>, Hv
|
|
|
22
22
|
* Number of the step.
|
|
23
23
|
*/
|
|
24
24
|
number?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Define if a step is disabled/enabled.
|
|
27
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean;
|
|
25
30
|
};
|
|
26
31
|
|
|
27
32
|
export default function HvStep(props: HvStepProps): JSX.Element | null;
|
|
@@ -17,6 +17,7 @@ const HvStep = ({
|
|
|
17
17
|
state,
|
|
18
18
|
title,
|
|
19
19
|
onClick,
|
|
20
|
+
disabled,
|
|
20
21
|
size = "SM",
|
|
21
22
|
number = 1
|
|
22
23
|
}) => {
|
|
@@ -55,7 +56,7 @@ const HvStep = ({
|
|
|
55
56
|
"aria-label": `step-${title}`,
|
|
56
57
|
icon: true,
|
|
57
58
|
overrideIconColors: false,
|
|
58
|
-
disabled: ["Current", "Disabled"].includes(state),
|
|
59
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : ["Current", "Disabled"].includes(state),
|
|
59
60
|
onClick: onClick
|
|
60
61
|
}, /*#__PURE__*/React.createElement(HvAvatar, {
|
|
61
62
|
className: clsx(classes.avatar, classes[size]),
|
|
@@ -160,7 +161,13 @@ process.env.NODE_ENV !== "production" ? HvStep.propTypes = {
|
|
|
160
161
|
/**
|
|
161
162
|
* Event onClick of the step.
|
|
162
163
|
*/
|
|
163
|
-
onClick: PropTypes.func
|
|
164
|
+
onClick: PropTypes.func,
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Define if a step is disabled/enabled.
|
|
168
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
169
|
+
*/
|
|
170
|
+
disabled: PropTypes.bool
|
|
164
171
|
} : void 0;
|
|
165
172
|
export default withStyles(styles, {
|
|
166
173
|
name: "HvStep"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step.js","names":["React","PropTypes","clsx","withStyles","Level0Good","Level3Bad","HourGlass","HvAvatar","HvButton","getColor","styles","HvStep","className","classes","state","title","onClick","size","number","iconSize","XS","SM","MD","LG","XL","squareL","Pending","Failed","Completed","svgSize","backgroundColor","color","undefined","semantic","status","IconComponent","root","ghost","ghostDisabled","includes","avatar","propTypes","string","shape","stepTitle","isRequired","oneOf","func","name"],"sources":["../../../../../src/StepNavigation/DefaultNavigation/Step/Step.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles } from \"@material-ui/core\";\n\nimport { Level0Good, Level3Bad, HourGlass } from \"@hitachivantara/uikit-react-icons\";\nimport { HvAvatar, HvButton } from \"@hitachivantara/uikit-react-core\";\n\nimport { getColor } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Default\" Step Navigation root component\n */\nconst HvStep = ({
|
|
1
|
+
{"version":3,"file":"Step.js","names":["React","PropTypes","clsx","withStyles","Level0Good","Level3Bad","HourGlass","HvAvatar","HvButton","getColor","styles","HvStep","className","classes","state","title","onClick","disabled","size","number","iconSize","XS","SM","MD","LG","XL","squareL","Pending","Failed","Completed","svgSize","backgroundColor","color","undefined","semantic","status","IconComponent","root","ghost","ghostDisabled","includes","avatar","propTypes","string","shape","stepTitle","isRequired","oneOf","func","bool","name"],"sources":["../../../../../src/StepNavigation/DefaultNavigation/Step/Step.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles } from \"@material-ui/core\";\n\nimport { Level0Good, Level3Bad, HourGlass } from \"@hitachivantara/uikit-react-icons\";\nimport { HvAvatar, HvButton } from \"@hitachivantara/uikit-react-core\";\n\nimport { getColor } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Default\" Step Navigation root component\n */\nconst HvStep = ({\n className,\n classes,\n state,\n title,\n onClick,\n disabled,\n size = \"SM\",\n number = 1,\n}) => {\n const iconSize = {\n XS: \"XS\",\n SM: \"XS\",\n MD: \"S\",\n LG: \"M\",\n XL: \"M\",\n }[size];\n\n const squareL = {\n Pending: 16,\n Failed: 24,\n Completed: 24,\n }[state];\n\n const svgSize = {\n XS: squareL - 8,\n SM: squareL,\n MD: squareL + 8,\n LG: squareL + 16,\n XL: squareL + 24,\n }[size];\n\n const backgroundColor = getColor(state);\n\n const color = state === \"Pending\" ? \"atmo2\" : undefined;\n\n const semantic = state !== \"Pending\" ? backgroundColor : undefined;\n\n const status = state === \"Current\" ? \"atmo5\" : undefined;\n\n const IconComponent = {\n Pending: HourGlass,\n Failed: Level3Bad,\n Completed: Level0Good,\n }[state];\n\n return (\n <div\n className={clsx(className, classes.root, { [classes[\"not-current\"]]: state !== \"Current\" })}\n >\n <HvButton\n className={clsx(classes.ghost, { [classes.ghostDisabled]: state === \"Current\" })}\n aria-label={`step-${title}`}\n icon\n overrideIconColors={false}\n disabled={disabled ?? [\"Current\", \"Disabled\"].includes(state)}\n onClick={onClick}\n >\n <HvAvatar\n className={clsx(classes.avatar, classes[size])}\n backgroundColor={backgroundColor}\n status={status}\n size={size}\n >\n {IconComponent ? (\n <IconComponent\n color={color}\n semantic={semantic}\n width={svgSize}\n height={svgSize}\n iconSize={iconSize}\n />\n ) : (\n number\n )}\n </HvAvatar>\n </HvButton>\n </div>\n );\n};\n\nHvStep.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the ghost class.\n */\n ghost: PropTypes.string,\n /**\n * Styles applied to the ghostDisabled class.\n */\n ghostDisabled: PropTypes.string,\n /**\n * Styles applied to the root element when step is not in \"current\" state.\n */\n \"not-current\": PropTypes.string,\n /**\n * Styles applied to the root element when size is XS.\n */\n XS: PropTypes.string,\n /**\n * Styles applied to the root element when size is SM.\n */\n SM: PropTypes.string,\n /**\n * Styles applied to the root element when size is MD.\n */\n MD: PropTypes.string,\n /**\n * Styles applied to the root element when size is LG.\n */\n LG: PropTypes.string,\n /**\n * Styles applied to the root element when size is XL.\n */\n XL: PropTypes.string,\n /**\n * Styles applied to the avatar element.\n */\n avatar: PropTypes.string,\n /**\n * Styles applied to the title of a step element.\n */\n stepTitle: PropTypes.string,\n }).isRequired,\n /**\n * Sets one of the standard sizes of the step\n */\n size: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * Number of the step.\n */\n number: PropTypes.number,\n /**\n * Event onClick of the step.\n */\n onClick: PropTypes.func,\n /**\n * Define if a step is disabled/enabled.\n * If this property is not defined and the step is on state \"Disabled\", the step component will be disabled\n */\n disabled: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvStep\" })(HvStep);\n"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AAEA,SAASC,UAAT,QAA2B,mBAA3B;AAEA,SAASC,UAAT,EAAqBC,SAArB,EAAgCC,SAAhC,QAAiD,mCAAjD;AACA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,kCAAnC;AAEA,SAASC,QAAT,QAAyB,UAAzB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;;AACA,MAAMC,MAAM,GAAG,CAAC;EACdC,SADc;EAEdC,OAFc;EAGdC,KAHc;EAIdC,KAJc;EAKdC,OALc;EAMdC,QANc;EAOdC,IAAI,GAAG,IAPO;EAQdC,MAAM,GAAG;AARK,CAAD,KAST;EACJ,MAAMC,QAAQ,GAAG;IACfC,EAAE,EAAE,IADW;IAEfC,EAAE,EAAE,IAFW;IAGfC,EAAE,EAAE,GAHW;IAIfC,EAAE,EAAE,GAJW;IAKfC,EAAE,EAAE;EALW,EAMfP,IANe,CAAjB;EAQA,MAAMQ,OAAO,GAAG;IACdC,OAAO,EAAE,EADK;IAEdC,MAAM,EAAE,EAFM;IAGdC,SAAS,EAAE;EAHG,EAIdf,KAJc,CAAhB;EAMA,MAAMgB,OAAO,GAAG;IACdT,EAAE,EAAEK,OAAO,GAAG,CADA;IAEdJ,EAAE,EAAEI,OAFU;IAGdH,EAAE,EAAEG,OAAO,GAAG,CAHA;IAIdF,EAAE,EAAEE,OAAO,GAAG,EAJA;IAKdD,EAAE,EAAEC,OAAO,GAAG;EALA,EAMdR,IANc,CAAhB;EAQA,MAAMa,eAAe,GAAGtB,QAAQ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B;AACF;AACA;EACE/B,KAAK,EAAEd,SAAS,CAAC0C,MAAV,CAAiBG,UAjEP;;EAkEjB;AACF;AACA;EACE3B,MAAM,EAAElB,SAAS,CAACkB,MArED;;EAsEjB;AACF;AACA;EACEH,OAAO,EAAEf,SAAS,CAAC+C,IAzEF;;EA0EjB;AACF;AACA;AACA;EACE/B,QAAQ,EAAEhB,SAAS,CAACgD;AA9EH,CAAnB;AAiFA,eAAe9C,UAAU,CAACO,MAAD,EAAS;EAAEwC,IAAI,EAAE;AAAR,CAAT,CAAV,CAAuCvC,MAAvC,CAAf"}
|
|
@@ -5,6 +5,6 @@ import { HvStepProps } from "../../DefaultNavigation/Step";
|
|
|
5
5
|
export type HvDotClassKey = "root";
|
|
6
6
|
|
|
7
7
|
export type HvDotProps = StandardProps<React.HTMLAttributes<HTMLDivElement>, HvDotClassKey> &
|
|
8
|
-
Pick<HvStepProps, "size" | "title" | "state" | "onClick">;
|
|
8
|
+
Pick<HvStepProps, "size" | "title" | "state" | "onClick" | "disabled">;
|
|
9
9
|
|
|
10
10
|
export default function HvDot(props: HvDotProps): JSX.Element | null;
|
|
@@ -22,7 +22,8 @@ const HvDot = ({
|
|
|
22
22
|
state,
|
|
23
23
|
title,
|
|
24
24
|
size,
|
|
25
|
-
onClick
|
|
25
|
+
onClick,
|
|
26
|
+
disabled
|
|
26
27
|
}) => {
|
|
27
28
|
const dotSize = dotSizes[size] * (state === "Current" ? 1.5 : 1);
|
|
28
29
|
const getBackgroundColor = useCallback(theme => state === "Disabled" ? disabledColor(theme) : defaultColor(theme), [state]);
|
|
@@ -48,11 +49,11 @@ const HvDot = ({
|
|
|
48
49
|
};
|
|
49
50
|
}), [dotSize, getBackgroundColor])();
|
|
50
51
|
return /*#__PURE__*/React.createElement(HvButton, {
|
|
51
|
-
className: clsx(classes.root, customClasses.ghost,
|
|
52
|
+
className: clsx(classes.root, customClasses.ghost, (disabled !== null && disabled !== void 0 ? disabled : "Current Disabled".includes(state)) && customClasses.ghostDisabled, className, state === "Current" && customClasses.active),
|
|
52
53
|
"aria-label": `step-${title}`,
|
|
53
54
|
icon: true,
|
|
54
55
|
overrideIconColors: false,
|
|
55
|
-
disabled: ["Current", "Disabled"].includes(state),
|
|
56
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : ["Current", "Disabled"].includes(state),
|
|
56
57
|
onClick: onClick
|
|
57
58
|
}, []);
|
|
58
59
|
};
|
|
@@ -106,7 +107,13 @@ process.env.NODE_ENV !== "production" ? HvDot.propTypes = {
|
|
|
106
107
|
/**
|
|
107
108
|
* Event onClick of the step.
|
|
108
109
|
*/
|
|
109
|
-
onClick: PropTypes.func
|
|
110
|
+
onClick: PropTypes.func,
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Define if a step is disabled/enabled.
|
|
114
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
115
|
+
*/
|
|
116
|
+
disabled: PropTypes.bool
|
|
110
117
|
} : void 0;
|
|
111
118
|
export default withStyles(styles, {
|
|
112
119
|
name: "HvDot"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dot.js","names":["React","useCallback","useMemo","PropTypes","clsx","HvButton","makeStyles","withStyles","defaultColor","disabledColor","dotSizes","styles","HvDot","classes","className","state","title","size","onClick","dotSize","getBackgroundColor","theme","customClasses","backgroundColor","ghostDisabled","active","ghost","width","height","root","includes","propTypes","string","shape","isRequired","oneOf","func","name"],"sources":["../../../../../src/StepNavigation/SimpleNavigation/Dot/Dot.js"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { HvButton } from \"@hitachivantara/uikit-react-core\";\nimport { makeStyles, withStyles } from \"@material-ui/core\";\n\nimport { defaultColor, disabledColor, dotSizes } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Simple\" Step Navigation root component\n */\nconst HvDot = ({ classes, className, state, title, size, onClick }) => {\n const dotSize = dotSizes[size] * (state === \"Current\" ? 1.5 : 1);\n const getBackgroundColor = useCallback(\n (theme) => (state === \"Disabled\" ? disabledColor(theme) : defaultColor(theme)),\n [state]\n );\n const customClasses = useMemo(\n () =>\n makeStyles((theme) => {\n const backgroundColor = getBackgroundColor(theme);\n return {\n ghostDisabled: {},\n active: {},\n ghost: {\n ...styles.ghost,\n width: dotSize,\n height: dotSize,\n backgroundColor,\n \"&:hover\": {\n backgroundColor,\n },\n \"&$ghostDisabled\": {\n ...styles.ghost[\"&$ghostDisabled\"],\n backgroundColor,\n },\n \"&$ghostDisabled&:hover\": {\n ...styles.ghost[\"&$ghostDisabled&:hover\"],\n backgroundColor,\n },\n },\n };\n }),\n [dotSize, getBackgroundColor]\n )();\n return (\n <HvButton\n className={clsx(\n classes.root,\n customClasses.ghost,\n {\n [customClasses.active]: state === \"Current\",\n [customClasses.ghostDisabled]: [\"Current\", \"Disabled\"].includes(state),\n },\n className\n )}\n aria-label={`step-${title}`}\n icon\n overrideIconColors={false}\n disabled={[\"Current\", \"Disabled\"].includes(state)}\n onClick={onClick}\n >\n {[]}\n </HvButton>\n );\n};\n\nHvDot.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the active class.\n */\n active: PropTypes.string,\n /**\n * Styles applied to the ghost class.\n */\n ghost: PropTypes.string,\n /**\n * Styles applied to the ghostDisabled class.\n */\n ghostDisabled: PropTypes.string,\n }).isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * Sets one of the standard sizes of the steps\n */\n size: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]).isRequired,\n /**\n * Event onClick of the step.\n */\n onClick: PropTypes.func,\n};\n\nexport default withStyles(styles, { name: \"HvDot\" })(HvDot);\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,OAA7B,QAA4C,OAA5C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AAEA,SAASC,QAAT,QAAyB,kCAAzB;AACA,SAASC,UAAT,EAAqBC,UAArB,QAAuC,mBAAvC;AAEA,SAASC,YAAT,EAAuBC,aAAvB,EAAsCC,QAAtC,QAAsD,UAAtD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;;AACA,MAAMC,KAAK,GAAG,CAAC;EAAEC,OAAF;EAAWC,SAAX;EAAsBC,KAAtB;EAA6BC,KAA7B;EAAoCC,IAApC;EAA0CC;
|
|
1
|
+
{"version":3,"file":"Dot.js","names":["React","useCallback","useMemo","PropTypes","clsx","HvButton","makeStyles","withStyles","defaultColor","disabledColor","dotSizes","styles","HvDot","classes","className","state","title","size","onClick","disabled","dotSize","getBackgroundColor","theme","customClasses","backgroundColor","ghostDisabled","active","ghost","width","height","root","includes","propTypes","string","shape","isRequired","oneOf","func","bool","name"],"sources":["../../../../../src/StepNavigation/SimpleNavigation/Dot/Dot.js"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { HvButton } from \"@hitachivantara/uikit-react-core\";\nimport { makeStyles, withStyles } from \"@material-ui/core\";\n\nimport { defaultColor, disabledColor, dotSizes } from \"../utils\";\nimport styles from \"./styles\";\n\n/**\n * Step element of \"Simple\" Step Navigation root component\n */\nconst HvDot = ({ classes, className, state, title, size, onClick, disabled }) => {\n const dotSize = dotSizes[size] * (state === \"Current\" ? 1.5 : 1);\n const getBackgroundColor = useCallback(\n (theme) => (state === \"Disabled\" ? disabledColor(theme) : defaultColor(theme)),\n [state]\n );\n const customClasses = useMemo(\n () =>\n makeStyles((theme) => {\n const backgroundColor = getBackgroundColor(theme);\n return {\n ghostDisabled: {},\n active: {},\n ghost: {\n ...styles.ghost,\n width: dotSize,\n height: dotSize,\n backgroundColor,\n \"&:hover\": {\n backgroundColor,\n },\n \"&$ghostDisabled\": {\n ...styles.ghost[\"&$ghostDisabled\"],\n backgroundColor,\n },\n \"&$ghostDisabled&:hover\": {\n ...styles.ghost[\"&$ghostDisabled&:hover\"],\n backgroundColor,\n },\n },\n };\n }),\n [dotSize, getBackgroundColor]\n )();\n return (\n <HvButton\n className={clsx(\n classes.root,\n customClasses.ghost,\n {\n [customClasses.active]: state === \"Current\",\n [customClasses.ghostDisabled]: disabled ?? [\"Current\", \"Disabled\"].includes(state),\n },\n className\n )}\n aria-label={`step-${title}`}\n icon\n overrideIconColors={false}\n disabled={disabled ?? [\"Current\", \"Disabled\"].includes(state)}\n onClick={onClick}\n >\n {[]}\n </HvButton>\n );\n};\n\nHvDot.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the active class.\n */\n active: PropTypes.string,\n /**\n * Styles applied to the ghost class.\n */\n ghost: PropTypes.string,\n /**\n * Styles applied to the ghostDisabled class.\n */\n ghostDisabled: PropTypes.string,\n }).isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * Sets one of the standard sizes of the steps\n */\n size: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]).isRequired,\n /**\n * Event onClick of the step.\n */\n onClick: PropTypes.func,\n /**\n * Define if a step is disabled/enabled.\n * If this property is not defined and the step is on state \"Disabled\", the step component will be disabled\n */\n disabled: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvDot\" })(HvDot);\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,OAA7B,QAA4C,OAA5C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AAEA,SAASC,QAAT,QAAyB,kCAAzB;AACA,SAASC,UAAT,EAAqBC,UAArB,QAAuC,mBAAvC;AAEA,SAASC,YAAT,EAAuBC,aAAvB,EAAsCC,QAAtC,QAAsD,UAAtD;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;;AACA,MAAMC,KAAK,GAAG,CAAC;EAAEC,OAAF;EAAWC,SAAX;EAAsBC,KAAtB;EAA6BC,KAA7B;EAAoCC,IAApC;EAA0CC,OAA1C;EAAmDC;AAAnD,CAAD,KAAmE;EAC/E,MAAMC,OAAO,GAAGV,QAAQ,CAACO,IAAD,CAAR,IAAkBF,KAAK,KAAK,SAAV,GAAsB,GAAtB,GAA4B,CAA9C,CAAhB;EACA,MAAMM,kBAAkB,GAAGpB,WAAW,CACnCqB,KAAD,IAAYP,KAAK,KAAK,UAAV,GAAuBN,aAAa,CAACa,KAAD,CAApC,GAA8Cd,YAAY,CAACc,KAAD,CADlC,EAEpC,CAACP,KAAD,CAFoC,CAAtC;EAIA,MAAMQ,aAAa,GAAGrB,OAAO,CAC3B,MACEI,UAAU,CAAEgB,KAAD,IAAW;IACpB,MAAME,eAAe,GAAGH,kBAAkB,CAACC,KAAD,CAA1C;IACA,OAAO;MACLG,aAAa,EAAE,EADV;MAELC,MAAM,EAAE,EAFH;MAGLC,KAAK,kCACAhB,MAAM,CAACgB,KADP;QAEHC,KAAK,EAAER,OAFJ;QAGHS,MAAM,EAAET,OAHL;QAIHI,eAJG;QAKH,WAAW;UACTA;QADS,CALR;QAQH,mDACKb,MAAM,CAACgB,KAAP,C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B,CAAC,SAAD,EAAY,QAAZ,EAAsB,WAAtB,EAAmC,SAAnC,EAA8C,UAA9C,CAAhB,EAA2ED,UA7BlE;;EA8BhB;AACF;AACA;EACEnB,KAAK,EAAEb,SAAS,CAAC8B,MAAV,CAAiBE,UAjCR;;EAkChB;AACF;AACA;EACElB,IAAI,EAAEd,SAAS,CAACiC,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,EAAyB,IAAzB,CAAhB,EAAgDD,UArCtC;;EAsChB;AACF;AACA;EACEjB,OAAO,EAAEf,SAAS,CAACkC,IAzCH;;EA0ChB;AACF;AACA;AACA;EACElB,QAAQ,EAAEhB,SAAS,CAACmC;AA9CJ,CAAlB;AAiDA,eAAe/B,UAAU,CAACI,MAAD,EAAS;EAAE4B,IAAI,EAAE;AAAR,CAAT,CAAV,CAAsC3B,KAAtC,CAAf"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { StandardProps } from "@material-ui/core";
|
|
3
|
+
import { Breakpoint } from "@material-ui/core/styles/createBreakpoints";
|
|
3
4
|
import { HvStepProps } from "./DefaultNavigation/Step/Step";
|
|
4
5
|
|
|
5
6
|
export type HvStepNavigationClassKey = "root";
|
|
@@ -15,7 +16,7 @@ export type HvStepNavigationProps = StandardProps<
|
|
|
15
16
|
/**
|
|
16
17
|
* Steps to show on the component.
|
|
17
18
|
*/
|
|
18
|
-
steps: Array<Pick<HvStepProps, "state" | "title" | "onClick" | "className">> & {
|
|
19
|
+
steps: Array<Pick<HvStepProps, "state" | "title" | "onClick" | "className" | "disabled">> & {
|
|
19
20
|
/**
|
|
20
21
|
* Class names to override styles on the separator component after the step.
|
|
21
22
|
*/
|
|
@@ -26,15 +27,15 @@ export type HvStepNavigationProps = StandardProps<
|
|
|
26
27
|
titleClassName: string;
|
|
27
28
|
};
|
|
28
29
|
/**
|
|
29
|
-
* Sets one of the standard sizes of the steps
|
|
30
|
+
* Sets one of the standard sizes of the steps.
|
|
30
31
|
*/
|
|
31
32
|
stepSize?: "XS" | "SM" | "MD" | "LG" | "XL";
|
|
32
33
|
/**
|
|
33
|
-
* Width of the component element.
|
|
34
|
+
* Width of the component element on each breakpoint screen resolution.
|
|
34
35
|
*/
|
|
35
|
-
width?: number;
|
|
36
|
+
width?: { [breakpoint in Breakpoint]?: number };
|
|
36
37
|
/**
|
|
37
|
-
* Defines either show a title or only a tooltip on each step component
|
|
38
|
+
* Defines either show a title or only a tooltip on each step component.
|
|
38
39
|
*/
|
|
39
40
|
showTitles?: boolean;
|
|
40
41
|
};
|
|
@@ -154,9 +154,9 @@ const HvStepNavigation = _ref => {
|
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
const getDynamicValues = stepsWidth => {
|
|
157
|
-
var _theme$breakpoints$va, _theme$breakpoints$va2;
|
|
157
|
+
var _width$breakpoint, _theme$breakpoints$va, _theme$breakpoints$va2;
|
|
158
158
|
|
|
159
|
-
const maxWidth = width !== null &&
|
|
159
|
+
const maxWidth = (_width$breakpoint = width === null || width === void 0 ? void 0 : width[breakpoint]) !== null && _width$breakpoint !== void 0 ? _width$breakpoint : Math.max(Number(hasTitles) * (TITLE_WIDTH + TITLE_MARGIN) * steps.length - TITLE_MARGIN, SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth);
|
|
160
160
|
const next = theme.breakpoints.keys.find((_, index, self) => index - 1 >= 0 ? self[index - 1] === breakpoint : false);
|
|
161
161
|
const navWidth = Math.min(maxWidth, (_theme$breakpoints$va = (_theme$breakpoints$va2 = theme.breakpoints.values) === null || _theme$breakpoints$va2 === void 0 ? void 0 : _theme$breakpoints$va2[next]) !== null && _theme$breakpoints$va !== void 0 ? _theme$breakpoints$va : maxWidth);
|
|
162
162
|
const titleWidth = Number(hasTitles) * Math.ceil((navWidth + TITLE_MARGIN) / steps.length);
|
|
@@ -300,7 +300,13 @@ process.env.NODE_ENV !== "production" ? HvStepNavigation.propTypes = {
|
|
|
300
300
|
/**
|
|
301
301
|
* State of the step. Values = {"Pending", "Failed", "Completed", "Current", "Disabled"}.
|
|
302
302
|
*/
|
|
303
|
-
state: PropTypes.oneOf(["Pending", "Failed", "Completed", "Current", "Disabled"]).isRequired
|
|
303
|
+
state: PropTypes.oneOf(["Pending", "Failed", "Completed", "Current", "Disabled"]).isRequired,
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Define if a step is disabled/enabled.
|
|
307
|
+
* If this property is not defined and the step is on state "Disabled", the step component will be disabled
|
|
308
|
+
*/
|
|
309
|
+
disabled: PropTypes.bool
|
|
304
310
|
})).isRequired,
|
|
305
311
|
|
|
306
312
|
/**
|
|
@@ -309,9 +315,15 @@ process.env.NODE_ENV !== "production" ? HvStepNavigation.propTypes = {
|
|
|
309
315
|
stepSize: PropTypes.oneOf(["XS", "SM", "MD", "LG", "XL"]),
|
|
310
316
|
|
|
311
317
|
/**
|
|
312
|
-
* Width of the component.
|
|
318
|
+
* Width of the component element on each breakpoint screen resolution.
|
|
313
319
|
*/
|
|
314
|
-
width: PropTypes.
|
|
320
|
+
width: PropTypes.shape({
|
|
321
|
+
xs: PropTypes.number,
|
|
322
|
+
sm: PropTypes.number,
|
|
323
|
+
md: PropTypes.number,
|
|
324
|
+
lg: PropTypes.number,
|
|
325
|
+
xl: PropTypes.number
|
|
326
|
+
}),
|
|
315
327
|
|
|
316
328
|
/**
|
|
317
329
|
* Defines either show a title or only a tooltip on each step component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepNavigation.js","names":["React","PropTypes","clsx","withStyles","Typography","styled","useTheme","HvTooltip","HvTypography","useWidth","HvDefaultNavigation","HvSimpleNavigation","SEPARATOR_WIDTH","TITLE_MARGIN","TITLE_WIDTH","styles","HvStepNavigation","className","classes","width","steps","stepSize","showTitles","type","others","theme","breakpoint","stepSizeKey","includes","hasTitles","styledLi","containerSize","height","styledDiv","styledSeparatorElement","title","separatorClassName","separatorHeight","separatorWidth","backgroundColor","Separator","separatorElement","separator","drawItems","separatorValues","minWidth","maxWidth","getColor","stepValues","minSize","maxSize","StepComponent","items","reduce","acc","index","state","props","StepContainer","Step","Math","max","stepProps","size","number","stepElement","li","length","ol","getDynamicValues","stepsWidth","Number","next","breakpoints","keys","find","_","self","navWidth","min","values","titleWidth","ceil","styledTitle","titleClassName","variant","stepTitle","textAlign","marginRight","getTitles","getTitleProps","titles","map","rawTitle","Title","StepNavigation","Default","Simple","numSteps","root","itemsProps","margin","propTypes","string","shape","isRequired","oneOf","arrayOf","bool","name"],"sources":["../../../src/StepNavigation/StepNavigation.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles, Typography, styled, useTheme } from \"@material-ui/core\";\nimport { HvTooltip, HvTypography, useWidth } from \"@hitachivantara/uikit-react-core\";\n\nimport HvDefaultNavigation from \"./DefaultNavigation\";\nimport HvSimpleNavigation from \"./SimpleNavigation\";\nimport { SEPARATOR_WIDTH, TITLE_MARGIN, TITLE_WIDTH } from \"./utils\";\nimport styles from \"./styles\";\n\n/**\n * Navigation page with steps.\n *\n * You need to define the <b>steps<b/> displayed on the component so that itself can be drawn on the UI.\n * On each step, you need to define a <b>state</b> - 'Pending', 'Failed', 'Completed', 'Current', 'Disabled' -\n * and a <b>title</b> to be shown as a tooltip or a text above of the step. You can also:\n * * Define a <b>className</b> on each step element;\n * * Define a <b>separatorClassName</b> to specify a className for the separator element. The default height\n * values of the separator element are 2px/3px on 'Simple'/'Default' layouts respectively;\n * * Define a <b>titleClassName</b> to specify a className for the title above each step element.\n *\n * For the root element, you can:\n * * Define a <b>className</b>;\n * * Choose a <b>type</b> of layout: 'Simple' or 'Default';\n * * Choose the <b>stepSize</b> of the step component: \"XS\", \"SM\", \"MD\", \"LG\", \"XL\". The default size will be\n * correspondent to the current media breakpoint;\n * * Choose either you want to <b>showTitles</b> near to each step component or a tootlip on hover;\n * * Define a <b>width</b> of the component. If you don't define any value and the step component has no title\n * displayed above, the width of the separator element;\n * will be 100px. If the step component has titles, each one will have 215px of width by default.\n */\nconst HvStepNavigation = ({\n className,\n classes,\n width,\n steps,\n stepSize,\n showTitles,\n type = \"Default\",\n ...others\n}) => {\n const theme = useTheme();\n // current breakpoint 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n const breakpoint = useWidth();\n // step configurations\n const stepSizeKey = stepSize ?? ([\"xs\", \"sm\"].includes(breakpoint) ? \"SM\" : \"MD\");\n const hasTitles = showTitles ?? ![\"xs\", \"sm\"].includes(breakpoint);\n\n const styledLi = (containerSize) =>\n styled(\"li\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledDiv = (containerSize) =>\n styled(\"div\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledSeparatorElement = (\n title,\n separatorClassName,\n separatorHeight,\n separatorWidth,\n backgroundColor\n ) => {\n const Separator = withStyles({\n separatorElement: {\n height: separatorHeight,\n width: separatorWidth,\n backgroundColor,\n },\n })(({ classes: { separatorElement } }) => (\n <div\n aria-label={`separator-${title}`}\n className={clsx(separatorElement, separatorClassName)}\n />\n ));\n return (\n <li aria-hidden key={`separator-${title}`} className={classes.separator}>\n <Separator />\n </li>\n );\n };\n\n const drawItems = ({\n separatorValues: { minWidth, maxWidth, getColor, height },\n stepValues: { minSize, maxSize, StepComponent },\n }) => {\n const items = steps.reduce((acc, { state, title, separatorClassName, ...props }, index) => {\n const containerSize = state === \"Current\" ? maxSize : minSize;\n const StepContainer = styledLi(containerSize);\n const Step = styledDiv(Math.max(containerSize, 30), Math.max(containerSize, 30));\n const stepProps = {\n ...{\n size: stepSizeKey,\n state,\n title,\n number: index + 1,\n ...props,\n },\n };\n const stepElement = (\n <StepContainer key={`step-${title}`} className={classes.li}>\n {hasTitles ? (\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n ) : (\n <HvTooltip\n placement=\"bottom\"\n title={<HvTypography>{`${index + 1}. ${title}`}</HvTypography>}\n >\n <div aria-label={`step-container-${title}`}>\n <Step className={classes.li}>\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n </Step>\n </div>\n </HvTooltip>\n )}\n </StepContainer>\n );\n if (index < steps.length - 1) {\n const separatorElement = styledSeparatorElement(\n title,\n separatorClassName,\n height,\n [steps[index + 1].state, state].includes(\"Current\") ? minWidth : maxWidth,\n getColor(state)\n );\n return [...acc, stepElement, separatorElement];\n }\n return [...acc, stepElement];\n }, []);\n\n return <ol className={classes.ol}>{items}</ol>;\n };\n\n const getDynamicValues = (stepsWidth) => {\n const maxWidth =\n width ??\n Math.max(\n Number(hasTitles) * (TITLE_WIDTH + TITLE_MARGIN) * steps.length - TITLE_MARGIN,\n SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth\n );\n const next = theme.breakpoints.keys.find((_, index, self) =>\n index - 1 >= 0 ? self[index - 1] === breakpoint : false\n );\n const navWidth = Math.min(maxWidth, theme.breakpoints.values?.[next] ?? maxWidth);\n const titleWidth = Number(hasTitles) * Math.ceil((navWidth + TITLE_MARGIN) / steps.length);\n const separatorWidth =\n Number(!hasTitles) * Math.ceil((navWidth - stepsWidth) / (steps.length - 1));\n return { width: navWidth, titleWidth, separatorWidth };\n };\n\n const styledTitle = (titleClassName, variant, title, titleWidth) =>\n withStyles({\n stepTitle: {\n textAlign: \"center\",\n width: titleWidth - TITLE_MARGIN,\n marginRight: TITLE_MARGIN,\n },\n })(({ classes: { stepTitle } }) =>\n title ? (\n <HvTypography variant={variant} className={clsx(stepTitle, titleClassName)}>\n {title}\n </HvTypography>\n ) : null\n );\n\n const getTitles = (getTitleProps) =>\n hasTitles ? (\n <div className={classes.titles}>\n {steps.map(({ title: rawTitle, state, titleClassName }, index) => {\n const {\n variant = \"highlightText\",\n title = rawTitle,\n titleWidth = 0,\n } = getTitleProps({\n state,\n rawTitle,\n number: index + 1,\n });\n const Title = styledTitle(titleClassName, variant, title, titleWidth);\n return <Title key={`step-title-${rawTitle}`} />;\n })}\n </div>\n ) : null;\n\n const StepNavigation = {\n Default: HvDefaultNavigation,\n Simple: HvSimpleNavigation,\n }[type];\n\n return (\n <StepNavigation\n {...{\n stepSize: stepSizeKey,\n numSteps: steps.length,\n getTitles,\n getDynamicValues,\n className: clsx(className, classes.root),\n ...others,\n }}\n >\n {({ stepsWidth, navWidth, ...itemsProps }) => (\n <Typography\n component=\"nav\"\n style={{\n width: `${navWidth}px`,\n margin: 0,\n }}\n >\n {drawItems(itemsProps)}\n </Typography>\n )}\n </StepNavigation>\n );\n};\n\nHvStepNavigation.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the li element.\n */\n li: PropTypes.string,\n /**\n * Styles applied to the ol element.\n */\n ol: PropTypes.string,\n /**\n * Styles applied to the separator element.\n */\n separator: PropTypes.string,\n /**\n * Styles applied to the titles container element.\n */\n titles: PropTypes.string,\n }).isRequired,\n /**\n * Type of step navigation. Values = {\"Simple\", \"Default\"}.\n */\n type: PropTypes.oneOf([\"Simple\", \"Default\"]),\n /**\n * Steps to show on the component.\n */\n steps: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * Class names to override styles on the step component.\n */\n className: PropTypes.string,\n /**\n * Class names to override styles on the separator component after the step.\n */\n separatorClassName: PropTypes.string,\n /**\n * Class names to override styles on the title component above the step.\n */\n titleClassName: PropTypes.string,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}.\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n })\n ).isRequired,\n /**\n * Sets one of the standard sizes of the steps. Values = {\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"}\n */\n stepSize: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * Width of the component.\n */\n width: PropTypes.number,\n /**\n * Defines either show a title or only a tooltip on each step component\n */\n showTitles: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvStepNavigation\" })(HvStepNavigation);\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AAEA,SAASC,UAAT,EAAqBC,UAArB,EAAiCC,MAAjC,EAAyCC,QAAzC,QAAyD,mBAAzD;AACA,SAASC,SAAT,EAAoBC,YAApB,EAAkCC,QAAlC,QAAkD,kCAAlD;AAEA,OAAOC,mBAAP,MAAgC,qBAAhC;AACA,OAAOC,kBAAP,MAA+B,oBAA/B;AACA,SAASC,eAAT,EAA0BC,YAA1B,EAAwCC,WAAxC,QAA2D,SAA3D;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,QASnB;EAAA,IAToB;IACxBC,SADwB;IAExBC,OAFwB;IAGxBC,KAHwB;IAIxBC,KAJwB;IAKxBC,QALwB;IAMxBC,UANwB;IAOxBC,IAAI,GAAG;EAPiB,CASpB;EAAA,IADDC,MACC;;EACJ,MAAMC,KAAK,GAAGnB,QAAQ,EAAtB,CADI,CAEJ;;EACA,MAAMoB,UAAU,GAAGjB,QAAQ,EAA3B,CAHI,CAIJ;;EACA,MAAMkB,WAAW,GAAGN,QAAH,aAAGA,QAAH,cAAGA,QAAH,GAAgB,CAAC,IAAD,EAAO,IAAP,EAAaO,QAAb,CAAsBF,UAAtB,IAAoC,IAApC,GAA2C,IAA5E;EACA,MAAMG,SAAS,GAAGP,UAAH,aAAGA,UAAH,cAAGA,UAAH,GAAiB,CAAC,CAAC,IAAD,EAAO,IAAP,EAAaM,QAAb,CAAsBF,UAAtB,CAAjC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ElF,IAAI,EAAEtB,SAAS,CAACyG,KAAV,CAAgB,CAAC,QAAD,EAAW,SAAX,CAAhB,CAjCqB;;EAkC3B;AACF;AACA;EACEtF,KAAK,EAAEnB,SAAS,CAAC0G,OAAV,CACL1G,SAAS,CAACuG,KAAV,CAAgB;IACd;AACN;AACA;IACMvF,SAAS,EAAEhB,SAAS,CAACsG,MAJP;;IAKd;AACN;AACA;IACMnE,kBAAkB,EAAEnC,SAAS,CAACsG,MARhB;;IASd;AACN;AACA;IACMnB,cAAc,EAAEnF,SAAS,CAACsG,MAZZ;;IAad;AACN;AACA;IACMpE,KAAK,EAAElC,SAAS,CAACsG,MAAV,CAAiBE,UAhBV;;IAiBd;AACN;AACA;IACMjD,KAAK,EAAEvD,SAAS,CAACyG,KAAV,CAAgB,CAAC,SAAD,EAAY,QAAZ,EAAsB,WAAtB,EAAmC,SAAnC,EAA8C,UAA9C,CAAhB,EAA2ED;EApBpE,CAAhB,CADK,EAuBLA,UA5DyB;;EA6D3B;AACF;AACA;EACEpF,QAAQ,EAAEpB,SAAS,CAACyG,KAAV,CAAgB,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,EAAyB,IAAzB,CAAhB,CAhEiB;;EAiE3B;AACF;AACA;EACEvF,KAAK,EAAElB,SAAS,CAAC+D,MApEU;;EAqE3B;AACF;AACA;EACE1C,UAAU,EAAErB,SAAS,CAAC2G;AAxEK,CAA7B;AA2EA,eAAezG,UAAU,CAACY,MAAD,EAAS;EAAE8F,IAAI,EAAE;AAAR,CAAT,CAAV,CAAiD7F,gBAAjD,CAAf"}
|
|
1
|
+
{"version":3,"file":"StepNavigation.js","names":["React","PropTypes","clsx","withStyles","Typography","styled","useTheme","HvTooltip","HvTypography","useWidth","HvDefaultNavigation","HvSimpleNavigation","SEPARATOR_WIDTH","TITLE_MARGIN","TITLE_WIDTH","styles","HvStepNavigation","className","classes","width","steps","stepSize","showTitles","type","others","theme","breakpoint","stepSizeKey","includes","hasTitles","styledLi","containerSize","height","styledDiv","styledSeparatorElement","title","separatorClassName","separatorHeight","separatorWidth","backgroundColor","Separator","separatorElement","separator","drawItems","separatorValues","minWidth","maxWidth","getColor","stepValues","minSize","maxSize","StepComponent","items","reduce","acc","index","state","props","StepContainer","Step","Math","max","stepProps","size","number","stepElement","li","length","ol","getDynamicValues","stepsWidth","Number","next","breakpoints","keys","find","_","self","navWidth","min","values","titleWidth","ceil","styledTitle","titleClassName","variant","stepTitle","textAlign","marginRight","getTitles","getTitleProps","titles","map","rawTitle","Title","StepNavigation","Default","Simple","numSteps","root","itemsProps","margin","propTypes","string","shape","isRequired","oneOf","arrayOf","disabled","bool","xs","sm","md","lg","xl","name"],"sources":["../../../src/StepNavigation/StepNavigation.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\n\nimport { withStyles, Typography, styled, useTheme } from \"@material-ui/core\";\nimport { HvTooltip, HvTypography, useWidth } from \"@hitachivantara/uikit-react-core\";\n\nimport HvDefaultNavigation from \"./DefaultNavigation\";\nimport HvSimpleNavigation from \"./SimpleNavigation\";\nimport { SEPARATOR_WIDTH, TITLE_MARGIN, TITLE_WIDTH } from \"./utils\";\nimport styles from \"./styles\";\n\n/**\n * Navigation page with steps.\n *\n * You need to define the <b>steps<b/> displayed on the component so that itself can be drawn on the UI.\n * On each step, you need to define a <b>state</b> - 'Pending', 'Failed', 'Completed', 'Current', 'Disabled' -\n * and a <b>title</b> to be shown as a tooltip or a text above of the step. You can also:\n * * Define a <b>className</b> on each step element;\n * * Define a <b>separatorClassName</b> to specify a className for the separator element. The default height\n * values of the separator element are 2px/3px on 'Simple'/'Default' layouts respectively;\n * * Define a <b>titleClassName</b> to specify a className for the title above each step element.\n *\n * For the root element, you can:\n * * Define a <b>className</b>;\n * * Choose a <b>type</b> of layout: 'Simple' or 'Default';\n * * Choose the <b>stepSize</b> of the step component: \"XS\", \"SM\", \"MD\", \"LG\", \"XL\". The default size will be\n * correspondent to the current media breakpoint;\n * * Choose either you want to <b>showTitles</b> near to each step component or a tootlip on hover;\n * * Define a <b>width</b> of the component. If you don't define any value and the step component has no title\n * displayed above, the width of the separator element;\n * will be 100px. If the step component has titles, each one will have 215px of width by default.\n */\nconst HvStepNavigation = ({\n className,\n classes,\n width,\n steps,\n stepSize,\n showTitles,\n type = \"Default\",\n ...others\n}) => {\n const theme = useTheme();\n // current breakpoint 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n const breakpoint = useWidth();\n // step configurations\n const stepSizeKey = stepSize ?? ([\"xs\", \"sm\"].includes(breakpoint) ? \"SM\" : \"MD\");\n const hasTitles = showTitles ?? ![\"xs\", \"sm\"].includes(breakpoint);\n\n const styledLi = (containerSize) =>\n styled(\"li\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledDiv = (containerSize) =>\n styled(\"div\")({\n width: containerSize,\n height: containerSize,\n });\n\n const styledSeparatorElement = (\n title,\n separatorClassName,\n separatorHeight,\n separatorWidth,\n backgroundColor\n ) => {\n const Separator = withStyles({\n separatorElement: {\n height: separatorHeight,\n width: separatorWidth,\n backgroundColor,\n },\n })(({ classes: { separatorElement } }) => (\n <div\n aria-label={`separator-${title}`}\n className={clsx(separatorElement, separatorClassName)}\n />\n ));\n return (\n <li aria-hidden key={`separator-${title}`} className={classes.separator}>\n <Separator />\n </li>\n );\n };\n\n const drawItems = ({\n separatorValues: { minWidth, maxWidth, getColor, height },\n stepValues: { minSize, maxSize, StepComponent },\n }) => {\n const items = steps.reduce((acc, { state, title, separatorClassName, ...props }, index) => {\n const containerSize = state === \"Current\" ? maxSize : minSize;\n const StepContainer = styledLi(containerSize);\n const Step = styledDiv(Math.max(containerSize, 30), Math.max(containerSize, 30));\n const stepProps = {\n ...{\n size: stepSizeKey,\n state,\n title,\n number: index + 1,\n ...props,\n },\n };\n const stepElement = (\n <StepContainer key={`step-${title}`} className={classes.li}>\n {hasTitles ? (\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n ) : (\n <HvTooltip\n placement=\"bottom\"\n title={<HvTypography>{`${index + 1}. ${title}`}</HvTypography>}\n >\n <div aria-label={`step-container-${title}`}>\n <Step className={classes.li}>\n <StepComponent aria-label={`step-${title}`} {...stepProps} />\n </Step>\n </div>\n </HvTooltip>\n )}\n </StepContainer>\n );\n if (index < steps.length - 1) {\n const separatorElement = styledSeparatorElement(\n title,\n separatorClassName,\n height,\n [steps[index + 1].state, state].includes(\"Current\") ? minWidth : maxWidth,\n getColor(state)\n );\n return [...acc, stepElement, separatorElement];\n }\n return [...acc, stepElement];\n }, []);\n\n return <ol className={classes.ol}>{items}</ol>;\n };\n\n const getDynamicValues = (stepsWidth) => {\n const maxWidth =\n width?.[breakpoint] ??\n Math.max(\n Number(hasTitles) * (TITLE_WIDTH + TITLE_MARGIN) * steps.length - TITLE_MARGIN,\n SEPARATOR_WIDTH * (steps.length - 1) + stepsWidth\n );\n const next = theme.breakpoints.keys.find((_, index, self) =>\n index - 1 >= 0 ? self[index - 1] === breakpoint : false\n );\n const navWidth = Math.min(maxWidth, theme.breakpoints.values?.[next] ?? maxWidth);\n const titleWidth = Number(hasTitles) * Math.ceil((navWidth + TITLE_MARGIN) / steps.length);\n const separatorWidth =\n Number(!hasTitles) * Math.ceil((navWidth - stepsWidth) / (steps.length - 1));\n return { width: navWidth, titleWidth, separatorWidth };\n };\n\n const styledTitle = (titleClassName, variant, title, titleWidth) =>\n withStyles({\n stepTitle: {\n textAlign: \"center\",\n width: titleWidth - TITLE_MARGIN,\n marginRight: TITLE_MARGIN,\n },\n })(({ classes: { stepTitle } }) =>\n title ? (\n <HvTypography variant={variant} className={clsx(stepTitle, titleClassName)}>\n {title}\n </HvTypography>\n ) : null\n );\n\n const getTitles = (getTitleProps) =>\n hasTitles ? (\n <div className={classes.titles}>\n {steps.map(({ title: rawTitle, state, titleClassName }, index) => {\n const {\n variant = \"highlightText\",\n title = rawTitle,\n titleWidth = 0,\n } = getTitleProps({\n state,\n rawTitle,\n number: index + 1,\n });\n const Title = styledTitle(titleClassName, variant, title, titleWidth);\n return <Title key={`step-title-${rawTitle}`} />;\n })}\n </div>\n ) : null;\n\n const StepNavigation = {\n Default: HvDefaultNavigation,\n Simple: HvSimpleNavigation,\n }[type];\n\n return (\n <StepNavigation\n {...{\n stepSize: stepSizeKey,\n numSteps: steps.length,\n getTitles,\n getDynamicValues,\n className: clsx(className, classes.root),\n ...others,\n }}\n >\n {({ stepsWidth, navWidth, ...itemsProps }) => (\n <Typography\n component=\"nav\"\n style={{\n width: `${navWidth}px`,\n margin: 0,\n }}\n >\n {drawItems(itemsProps)}\n </Typography>\n )}\n </StepNavigation>\n );\n};\n\nHvStepNavigation.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the li element.\n */\n li: PropTypes.string,\n /**\n * Styles applied to the ol element.\n */\n ol: PropTypes.string,\n /**\n * Styles applied to the separator element.\n */\n separator: PropTypes.string,\n /**\n * Styles applied to the titles container element.\n */\n titles: PropTypes.string,\n }).isRequired,\n /**\n * Type of step navigation. Values = {\"Simple\", \"Default\"}.\n */\n type: PropTypes.oneOf([\"Simple\", \"Default\"]),\n /**\n * Steps to show on the component.\n */\n steps: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * Class names to override styles on the step component.\n */\n className: PropTypes.string,\n /**\n * Class names to override styles on the separator component after the step.\n */\n separatorClassName: PropTypes.string,\n /**\n * Class names to override styles on the title component above the step.\n */\n titleClassName: PropTypes.string,\n /**\n * Title of the step.\n */\n title: PropTypes.string.isRequired,\n /**\n * State of the step. Values = {\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"}.\n */\n state: PropTypes.oneOf([\"Pending\", \"Failed\", \"Completed\", \"Current\", \"Disabled\"]).isRequired,\n /**\n * Define if a step is disabled/enabled.\n * If this property is not defined and the step is on state \"Disabled\", the step component will be disabled\n */\n disabled: PropTypes.bool,\n })\n ).isRequired,\n /**\n * Sets one of the standard sizes of the steps. Values = {\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"}\n */\n stepSize: PropTypes.oneOf([\"XS\", \"SM\", \"MD\", \"LG\", \"XL\"]),\n /**\n * Width of the component element on each breakpoint screen resolution.\n */\n width: PropTypes.shape({\n xs: PropTypes.number,\n sm: PropTypes.number,\n md: PropTypes.number,\n lg: PropTypes.number,\n xl: PropTypes.number,\n }),\n /**\n * Defines either show a title or only a tooltip on each step component\n */\n showTitles: PropTypes.bool,\n};\n\nexport default withStyles(styles, { name: \"HvStepNavigation\" })(HvStepNavigation);\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AAEA,SAASC,UAAT,EAAqBC,UAArB,EAAiCC,MAAjC,EAAyCC,QAAzC,QAAyD,mBAAzD;AACA,SAASC,SAAT,EAAoBC,YAApB,EAAkCC,QAAlC,QAAkD,kCAAlD;AAEA,OAAOC,mBAAP,MAAgC,qBAAhC;AACA,OAAOC,kBAAP,MAA+B,oBAA/B;AACA,SAASC,eAAT,EAA0BC,YAA1B,EAAwCC,WAAxC,QAA2D,SAA3D;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,QASnB;EAAA,IAToB;IACxBC,SADwB;IAExBC,OAFwB;IAGxBC,KAHwB;IAIxBC,KAJwB;IAKxBC,QALwB;IAMxBC,UANwB;IAOxBC,IAAI,GAAG;EAPiB,CASpB;EAAA,IADDC,MACC;;EACJ,MAAMC,KAAK,GAAGnB,QAAQ,EAAtB,CADI,CAEJ;;EACA,MAAMoB,UAAU,GAAGjB,QAAQ,EAA3B,CAH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AC+D,MADO;IAErB+C,EAAE,EAAE9G,SAAS,CAAC+D,MAFO;IAGrBgD,EAAE,EAAE/G,SAAS,CAAC+D,MAHO;IAIrBiD,EAAE,EAAEhH,SAAS,CAAC+D,MAJO;IAKrBkD,EAAE,EAAEjH,SAAS,CAAC+D;EALO,CAAhB,CAzEoB;;EAgF3B;AACF;AACA;EACE1C,UAAU,EAAErB,SAAS,CAAC4G;AAnFK,CAA7B;AAsFA,eAAe1G,UAAU,CAACY,MAAD,EAAS;EAAEoG,IAAI,EAAE;AAAR,CAAT,CAAV,CAAiDnG,gBAAjD,CAAf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-lab",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.55.0",
|
|
4
4
|
"description": "A collection of contributed React components for the Hitachi Vantara's Design System.",
|
|
5
5
|
"homepage": "https://github.com/lumada-design/hv-uikit-react",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "9948231e8d50be1b40c4a620952b1950cea845bf"
|
|
66
66
|
}
|