@hitachivantara/uikit-react-lab 5.4.20 → 5.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/StepNavigation/DefaultNavigation/DefaultNavigation.cjs.map +1 -1
- package/dist/cjs/components/StepNavigation/DefaultNavigation/Step/Step.cjs +17 -12
- package/dist/cjs/components/StepNavigation/DefaultNavigation/Step/Step.cjs.map +1 -1
- package/dist/cjs/components/StepNavigation/DefaultNavigation/Step/Step.styles.cjs +29 -49
- package/dist/cjs/components/StepNavigation/DefaultNavigation/Step/Step.styles.cjs.map +1 -1
- package/dist/cjs/components/StepNavigation/SimpleNavigation/Dot/Dot.cjs +27 -24
- package/dist/cjs/components/StepNavigation/SimpleNavigation/Dot/Dot.cjs.map +1 -1
- package/dist/cjs/components/StepNavigation/SimpleNavigation/Dot/Dot.styles.cjs +12 -20
- package/dist/cjs/components/StepNavigation/SimpleNavigation/Dot/Dot.styles.cjs.map +1 -1
- package/dist/cjs/components/StepNavigation/SimpleNavigation/SimpleNavigation.cjs.map +1 -1
- package/dist/cjs/components/StepNavigation/StepNavigation.cjs +72 -94
- package/dist/cjs/components/StepNavigation/StepNavigation.cjs.map +1 -1
- package/dist/cjs/components/StepNavigation/StepNavigation.styles.cjs +8 -3
- package/dist/cjs/components/StepNavigation/StepNavigation.styles.cjs.map +1 -1
- package/dist/cjs/components/Wizard/Wizard.cjs +9 -0
- package/dist/cjs/components/Wizard/Wizard.cjs.map +1 -1
- package/dist/cjs/components/Wizard/Wizard.styles.cjs +12 -0
- package/dist/cjs/components/Wizard/Wizard.styles.cjs.map +1 -0
- package/dist/cjs/components/Wizard/WizardActions/WizardActions.cjs +46 -50
- package/dist/cjs/components/Wizard/WizardActions/WizardActions.cjs.map +1 -1
- package/dist/cjs/components/Wizard/WizardActions/WizardActions.styles.cjs +8 -3
- package/dist/cjs/components/Wizard/WizardActions/WizardActions.styles.cjs.map +1 -1
- package/dist/cjs/components/Wizard/WizardContainer/WizardContainer.cjs +16 -19
- package/dist/cjs/components/Wizard/WizardContainer/WizardContainer.cjs.map +1 -1
- package/dist/cjs/components/Wizard/WizardContainer/WizardContainer.styles.cjs +9 -3
- package/dist/cjs/components/Wizard/WizardContainer/WizardContainer.styles.cjs.map +1 -1
- package/dist/cjs/components/Wizard/WizardContent/LoadingContainer.cjs +28 -29
- package/dist/cjs/components/Wizard/WizardContent/LoadingContainer.cjs.map +1 -1
- package/dist/cjs/components/Wizard/WizardContent/LoadingContainer.styles.cjs +7 -3
- package/dist/cjs/components/Wizard/WizardContent/LoadingContainer.styles.cjs.map +1 -1
- package/dist/cjs/components/Wizard/WizardContent/WizardContent.cjs +42 -42
- package/dist/cjs/components/Wizard/WizardContent/WizardContent.cjs.map +1 -1
- package/dist/cjs/components/Wizard/WizardContent/WizardContent.styles.cjs +8 -3
- package/dist/cjs/components/Wizard/WizardContent/WizardContent.styles.cjs.map +1 -1
- package/dist/cjs/components/Wizard/WizardTitle/WizardTitle.cjs +44 -47
- package/dist/cjs/components/Wizard/WizardTitle/WizardTitle.cjs.map +1 -1
- package/dist/cjs/components/Wizard/WizardTitle/WizardTitle.styles.cjs +8 -3
- package/dist/cjs/components/Wizard/WizardTitle/WizardTitle.styles.cjs.map +1 -1
- package/dist/cjs/index.cjs +12 -12
- package/dist/esm/components/StepNavigation/DefaultNavigation/DefaultNavigation.js.map +1 -1
- package/dist/esm/components/StepNavigation/DefaultNavigation/Step/Step.js +17 -12
- package/dist/esm/components/StepNavigation/DefaultNavigation/Step/Step.js.map +1 -1
- package/dist/esm/components/StepNavigation/DefaultNavigation/Step/Step.styles.js +30 -48
- package/dist/esm/components/StepNavigation/DefaultNavigation/Step/Step.styles.js.map +1 -1
- package/dist/esm/components/StepNavigation/SimpleNavigation/Dot/Dot.js +29 -25
- package/dist/esm/components/StepNavigation/SimpleNavigation/Dot/Dot.js.map +1 -1
- package/dist/esm/components/StepNavigation/SimpleNavigation/Dot/Dot.styles.js +13 -19
- package/dist/esm/components/StepNavigation/SimpleNavigation/Dot/Dot.styles.js.map +1 -1
- package/dist/esm/components/StepNavigation/SimpleNavigation/SimpleNavigation.js.map +1 -1
- package/dist/esm/components/StepNavigation/StepNavigation.js +74 -95
- package/dist/esm/components/StepNavigation/StepNavigation.js.map +1 -1
- package/dist/esm/components/StepNavigation/StepNavigation.styles.js +8 -3
- package/dist/esm/components/StepNavigation/StepNavigation.styles.js.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +11 -1
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/components/Wizard/Wizard.styles.js +12 -0
- package/dist/esm/components/Wizard/Wizard.styles.js.map +1 -0
- package/dist/esm/components/Wizard/WizardActions/WizardActions.js +50 -53
- package/dist/esm/components/Wizard/WizardActions/WizardActions.js.map +1 -1
- package/dist/esm/components/Wizard/WizardActions/WizardActions.styles.js +8 -3
- package/dist/esm/components/Wizard/WizardActions/WizardActions.styles.js.map +1 -1
- package/dist/esm/components/Wizard/WizardContainer/WizardContainer.js +19 -21
- package/dist/esm/components/Wizard/WizardContainer/WizardContainer.js.map +1 -1
- package/dist/esm/components/Wizard/WizardContainer/WizardContainer.styles.js +9 -3
- package/dist/esm/components/Wizard/WizardContainer/WizardContainer.styles.js.map +1 -1
- package/dist/esm/components/Wizard/WizardContent/LoadingContainer.js +30 -31
- package/dist/esm/components/Wizard/WizardContent/LoadingContainer.js.map +1 -1
- package/dist/esm/components/Wizard/WizardContent/LoadingContainer.styles.js +8 -4
- package/dist/esm/components/Wizard/WizardContent/LoadingContainer.styles.js.map +1 -1
- package/dist/esm/components/Wizard/WizardContent/WizardContent.js +46 -45
- package/dist/esm/components/Wizard/WizardContent/WizardContent.js.map +1 -1
- package/dist/esm/components/Wizard/WizardContent/WizardContent.styles.js +8 -3
- package/dist/esm/components/Wizard/WizardContent/WizardContent.styles.js.map +1 -1
- package/dist/esm/components/Wizard/WizardTitle/WizardTitle.js +47 -49
- package/dist/esm/components/Wizard/WizardTitle/WizardTitle.js.map +1 -1
- package/dist/esm/components/Wizard/WizardTitle/WizardTitle.styles.js +8 -3
- package/dist/esm/components/Wizard/WizardTitle/WizardTitle.styles.js.map +1 -1
- package/dist/esm/index.js +14 -14
- package/dist/types/index.d.ts +126 -97
- package/package.json +4 -6
- package/dist/cjs/components/StepNavigation/DefaultNavigation/Step/stepClasses.cjs +0 -8
- package/dist/cjs/components/StepNavigation/DefaultNavigation/Step/stepClasses.cjs.map +0 -1
- package/dist/cjs/components/StepNavigation/SimpleNavigation/Dot/dotClasses.cjs +0 -8
- package/dist/cjs/components/StepNavigation/SimpleNavigation/Dot/dotClasses.cjs.map +0 -1
- package/dist/cjs/components/StepNavigation/stepNavigationClasses.cjs +0 -8
- package/dist/cjs/components/StepNavigation/stepNavigationClasses.cjs.map +0 -1
- package/dist/cjs/components/Wizard/WizardActions/wizardActionsClasses.cjs +0 -8
- package/dist/cjs/components/Wizard/WizardActions/wizardActionsClasses.cjs.map +0 -1
- package/dist/cjs/components/Wizard/WizardContainer/wizardContainerClasses.cjs +0 -8
- package/dist/cjs/components/Wizard/WizardContainer/wizardContainerClasses.cjs.map +0 -1
- package/dist/cjs/components/Wizard/WizardContent/loadingContainerClasses.cjs +0 -8
- package/dist/cjs/components/Wizard/WizardContent/loadingContainerClasses.cjs.map +0 -1
- package/dist/cjs/components/Wizard/WizardContent/wizardContentClasses.cjs +0 -8
- package/dist/cjs/components/Wizard/WizardContent/wizardContentClasses.cjs.map +0 -1
- package/dist/cjs/components/Wizard/WizardTitle/wizardTitleClasses.cjs +0 -8
- package/dist/cjs/components/Wizard/WizardTitle/wizardTitleClasses.cjs.map +0 -1
- package/dist/cjs/components/Wizard/wizardClasses.cjs +0 -8
- package/dist/cjs/components/Wizard/wizardClasses.cjs.map +0 -1
- package/dist/esm/components/StepNavigation/DefaultNavigation/Step/stepClasses.js +0 -8
- package/dist/esm/components/StepNavigation/DefaultNavigation/Step/stepClasses.js.map +0 -1
- package/dist/esm/components/StepNavigation/SimpleNavigation/Dot/dotClasses.js +0 -8
- package/dist/esm/components/StepNavigation/SimpleNavigation/Dot/dotClasses.js.map +0 -1
- package/dist/esm/components/StepNavigation/stepNavigationClasses.js +0 -8
- package/dist/esm/components/StepNavigation/stepNavigationClasses.js.map +0 -1
- package/dist/esm/components/Wizard/WizardActions/wizardActionsClasses.js +0 -8
- package/dist/esm/components/Wizard/WizardActions/wizardActionsClasses.js.map +0 -1
- package/dist/esm/components/Wizard/WizardContainer/wizardContainerClasses.js +0 -8
- package/dist/esm/components/Wizard/WizardContainer/wizardContainerClasses.js.map +0 -1
- package/dist/esm/components/Wizard/WizardContent/loadingContainerClasses.js +0 -8
- package/dist/esm/components/Wizard/WizardContent/loadingContainerClasses.js.map +0 -1
- package/dist/esm/components/Wizard/WizardContent/wizardContentClasses.js +0 -8
- package/dist/esm/components/Wizard/WizardContent/wizardContentClasses.js.map +0 -1
- package/dist/esm/components/Wizard/WizardTitle/wizardTitleClasses.js +0 -8
- package/dist/esm/components/Wizard/WizardTitle/wizardTitleClasses.js.map +0 -1
- package/dist/esm/components/Wizard/wizardClasses.js +0 -8
- package/dist/esm/components/Wizard/wizardClasses.js.map +0 -1
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import { ClassNames } from "@emotion/react";
|
|
2
1
|
import { HvDialogContent } from "@hitachivantara/uikit-react-core";
|
|
3
2
|
import { useElementSize } from "usehooks-ts";
|
|
4
3
|
import React, { useContext, useRef, useState, useCallback, useEffect } from "react";
|
|
5
|
-
import {
|
|
4
|
+
import { useClasses } from "./WizardContent.styles.js";
|
|
5
|
+
import { staticClasses } from "./WizardContent.styles.js";
|
|
6
6
|
import { LoadingContainer } from "./LoadingContainer.js";
|
|
7
|
-
import {
|
|
8
|
-
import wizardContentClasses from "./wizardContentClasses.js";
|
|
7
|
+
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
9
8
|
import HvWizardContext from "../WizardContext/WizardContext.js";
|
|
10
9
|
const DRAWER_PERCENTAGE = 0.3;
|
|
11
10
|
const DRAWER_MIN_WIDTH = 280;
|
|
12
11
|
const HvWizardContent = ({
|
|
13
|
-
classes,
|
|
12
|
+
classes: classesProp,
|
|
14
13
|
fixedHeight = false,
|
|
15
14
|
loading = false,
|
|
16
15
|
children,
|
|
17
16
|
summaryContent
|
|
18
17
|
}) => {
|
|
18
|
+
const {
|
|
19
|
+
classes,
|
|
20
|
+
cx
|
|
21
|
+
} = useClasses(classesProp);
|
|
19
22
|
const {
|
|
20
23
|
context,
|
|
21
24
|
setContext,
|
|
@@ -91,49 +94,47 @@ const HvWizardContent = ({
|
|
|
91
94
|
}
|
|
92
95
|
}, [tab, context, setContext]);
|
|
93
96
|
const translateX = summaryWidth ? summaryWidth + 10 : 450;
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
children:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
return null;
|
|
130
|
-
})
|
|
97
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
98
|
+
className: classes.summaryRef,
|
|
99
|
+
ref: (el) => {
|
|
100
|
+
containerRef(el);
|
|
101
|
+
if (el) {
|
|
102
|
+
summaryRef.current = el;
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
children: [summary !== null && /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: classes.summarySticky,
|
|
107
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
108
|
+
className: classes.summaryContainer,
|
|
109
|
+
style: {
|
|
110
|
+
left: summaryLeft,
|
|
111
|
+
width: summaryWidth,
|
|
112
|
+
height: summaryHeight,
|
|
113
|
+
transform: `translate(${summary ? 0 : translateX}px, 0)`
|
|
114
|
+
},
|
|
115
|
+
children: summaryContent
|
|
116
|
+
})
|
|
117
|
+
}), /* @__PURE__ */ jsx(HvDialogContent, {
|
|
118
|
+
className: cx(classes.contentContainer, {
|
|
119
|
+
[classes.fixedHeight]: fixedHeight
|
|
120
|
+
}),
|
|
121
|
+
indentContent: true,
|
|
122
|
+
children: /* @__PURE__ */ jsx(LoadingContainer, {
|
|
123
|
+
hidden: !loading,
|
|
124
|
+
children: React.Children.map(arrayChildren, (child, index) => {
|
|
125
|
+
if (index === tab) {
|
|
126
|
+
return React.cloneElement(child, {
|
|
127
|
+
tab
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
131
|
})
|
|
132
|
-
})
|
|
133
|
-
})
|
|
132
|
+
})
|
|
133
|
+
})]
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
136
|
export {
|
|
137
|
-
HvWizardContent
|
|
137
|
+
HvWizardContent,
|
|
138
|
+
staticClasses as wizardContentClasses
|
|
138
139
|
};
|
|
139
140
|
//# sourceMappingURL=WizardContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardContent.js","sources":["../../../../../src/components/Wizard/WizardContent/WizardContent.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport { ClassNames } from \"@emotion/react\";\nimport { HvBaseProps, HvDialogContent } from \"@hitachivantara/uikit-react-core\";\nimport { useElementSize } from \"usehooks-ts\";\nimport React, {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport {\n HvWizardContext,\n HvWizardTabs,\n wizardContentClasses,\n HvWizardContentClasses,\n} from \"..\";\nimport { styles } from \"./WizardContent.styles\";\nimport { LoadingContainer } from \"./LoadingContainer\";\n\nexport interface HvWizardContentProps extends HvBaseProps {\n /** Forces minimum height to the component. */\n fixedHeight?: boolean;\n /** Whether the loading animation is shown. */\n loading?: boolean;\n /** The content of the summary. */\n summaryContent?: React.ReactNode;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardContentClasses;\n}\n\ntype ChildElement = React.ReactElement<HvWizardTabs>;\n\nconst DRAWER_PERCENTAGE = 0.3;\nconst DRAWER_MIN_WIDTH = 280;\n\nexport const HvWizardContent = ({\n classes,\n fixedHeight = false,\n loading = false,\n children,\n summaryContent,\n}: HvWizardContentProps) => {\n const { context, setContext, summary, tab } = useContext(HvWizardContext);\n\n const arrayChildren = React.Children.toArray(children) as ChildElement[];\n\n const initialContext = arrayChildren.reduce(\n (acc, child: ChildElement, index) => {\n const invalid =\n \"mustValidate\" in child.props && child.props.mustValidate === true\n ? false\n : null;\n const valid = invalid ?? (index === 0 || null);\n return {\n ...acc,\n [index]: { ...child.props, form: {}, valid, touched: index === 0 },\n };\n },\n {}\n );\n\n const summaryRef = useRef<HTMLElement>();\n const resizedRef = useRef({ height: 0, width: 0 });\n const [containerRef, sizes] = useElementSize();\n\n const [summaryHeight, setSummaryHeight] = useState(0);\n const [summaryWidth, setSummaryWidth] = useState(0);\n const [summaryLeft, setSummaryLeft] = useState(0);\n\n const updateSummaryMeasures = useCallback((newSizes) => {\n const modalWidth = newSizes.width;\n const drawerWidth = modalWidth * DRAWER_PERCENTAGE;\n setSummaryHeight(newSizes.height);\n setSummaryWidth(Math.max(drawerWidth, DRAWER_MIN_WIDTH));\n setSummaryLeft(modalWidth - Math.max(drawerWidth, DRAWER_MIN_WIDTH));\n\n resizedRef.current = {\n height: newSizes.height,\n width: newSizes.width,\n };\n }, []);\n\n useEffect(() => {\n const pageHeight = summaryRef.current?.getBoundingClientRect?.()?.height;\n if (\n (summary && sizes.height !== resizedRef.current.height) ||\n sizes.width !== resizedRef.current.width\n ) {\n updateSummaryMeasures(sizes);\n }\n\n if (pageHeight && sizes.height !== pageHeight) {\n updateSummaryMeasures({\n width: sizes.width,\n height: pageHeight,\n });\n }\n }, [tab, sizes, summary, updateSummaryMeasures]);\n\n useEffect(() => {\n setContext(initialContext);\n }, []);\n\n useEffect(() => {\n if (tab && !context[tab]?.touched) {\n const updatedContext = Object.entries(context).reduce(\n (acc, [key, childState]) => ({\n ...acc,\n ...(+key <= tab\n ? {\n [key]: {\n ...childState,\n touched: true,\n valid: childState?.valid ?? true,\n },\n }\n : { [key]: childState }),\n }),\n {}\n );\n\n setContext(updatedContext);\n }\n }, [tab, context, setContext]);\n\n const translateX = summaryWidth ? summaryWidth + 10 : 450;\n\n return (\n <ClassNames>\n {({ css, cx }) => (\n <div\n className={cx(\n wizardContentClasses.summaryRef,\n css(styles.summaryRef),\n classes?.summaryRef\n )}\n ref={(el) => {\n containerRef(el);\n if (el) {\n summaryRef.current = el;\n }\n }}\n >\n {summary !== null && (\n <div\n className={cx(\n wizardContentClasses.summarySticky,\n css(styles.summarySticky),\n classes?.summarySticky\n )}\n >\n <div\n className={cx(\n wizardContentClasses.summaryContainer,\n css(styles.summaryContainer),\n classes?.summaryContainer\n )}\n style={{\n left: summaryLeft,\n width: summaryWidth,\n height: summaryHeight,\n transform: `translate(${summary ? 0 : translateX}px, 0)`,\n }}\n >\n {summaryContent}\n </div>\n </div>\n )}\n <HvDialogContent\n className={cx(\n wizardContentClasses.contentContainer,\n fixedHeight && wizardContentClasses.fixedHeight,\n css(styles.contentContainer),\n fixedHeight && css(styles.fixedHeight),\n classes?.contentContainer,\n fixedHeight && classes?.fixedHeight\n )}\n indentContent\n >\n <LoadingContainer hidden={!loading}>\n {React.Children.map(arrayChildren, (child, index) => {\n if (index === tab) {\n return React.cloneElement(child as React.ReactElement, {\n tab,\n });\n }\n return null;\n })}\n </LoadingContainer>\n </HvDialogContent>\n </div>\n )}\n </ClassNames>\n );\n};\n"],"names":["DRAWER_PERCENTAGE","DRAWER_MIN_WIDTH","HvWizardContent","classes","fixedHeight","loading","children","summaryContent","context","setContext","summary","tab","useContext","HvWizardContext","arrayChildren","React","Children","toArray","initialContext","reduce","acc","child","index","invalid","props","mustValidate","valid","form","touched","summaryRef","useRef","resizedRef","height","width","containerRef","sizes","useElementSize","summaryHeight","setSummaryHeight","useState","summaryWidth","setSummaryWidth","summaryLeft","setSummaryLeft","updateSummaryMeasures","useCallback","newSizes","modalWidth","drawerWidth","Math","max","current","useEffect","pageHeight","getBoundingClientRect","updatedContext","Object","entries","key","childState","translateX","ClassNames","css","cx","className","wizardContentClasses","styles","ref","el","summarySticky","summaryContainer","style","left","transform","_jsx","HvDialogContent","contentContainer","indentContent","LoadingContainer","hidden","map","cloneElement"],"mappings":";;;;;;;;;AAiCA,MAAMA,oBAAoB;AAC1B,MAAMC,mBAAmB;AAElB,MAAMC,kBAAkBA,CAAC;AAAA,EAC9BC;AAAAA,EACAC,cAAc;AAAA,EACdC,UAAU;AAAA,EACVC;AAAAA,EACAC;AACoB,MAAM;AACpB,QAAA;AAAA,IAAEC;AAAAA,IAASC;AAAAA,IAAYC;AAAAA,IAASC;AAAAA,EAAAA,IAAQC,WAAWC,eAAe;AAExE,QAAMC,gBAAgBC,MAAMC,SAASC,QAAQX,QAAQ;AAErD,QAAMY,iBAAiBJ,cAAcK,OACnC,CAACC,KAAKC,OAAqBC,UAAU;AAC7BC,UAAAA,UACJ,kBAAkBF,MAAMG,SAASH,MAAMG,MAAMC,iBAAiB,OAC1D,QACA;AACAC,UAAAA,QAAQH,YAAYD,UAAU,KAAK;AAClC,WAAA;AAAA,MACL,GAAGF;AAAAA,MACH,CAACE,KAAK,GAAG;AAAA,QAAE,GAAGD,MAAMG;AAAAA,QAAOG,MAAM,CAAC;AAAA,QAAGD;AAAAA,QAAOE,SAASN,UAAU;AAAA,MAAE;AAAA,IAAA;AAAA,EAErE,GACA,CACF,CAAA;AAEA,QAAMO,aAAaC;AACnB,QAAMC,aAAaD,OAAO;AAAA,IAAEE,QAAQ;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,iBAAe;AAAA,QACdX,WAAWD,GACTE,qBAAqBW,kBACrBxE,eAAe6D,qBAAqB7D,aACpC0D,IAAII,OAAOU,gBAAgB,GAC3BxE,eAAe0D,IAAII,OAAO9D,WAAW,GACrCD,mCAASyE,kBACTxE,gBAAeD,mCAASC,YAC1B;AAAA,QACAyE,eAAa;AAAA,QAAAvE,8BAEZwE,kBAAgB;AAAA,UAACC,QAAQ,CAAC1E;AAAAA,UAAQC,UAChCS,MAAMC,SAASgE,IAAIlE,eAAe,CAACO,OAAOC,UAAU;AACnD,gBAAIA,UAAUX,KAAK;AACVI,qBAAAA,MAAMkE,aAAa5D,OAA6B;AAAA,gBACrDV;AAAAA,cAAAA,CACD;AAAA,YACH;AACO,mBAAA;AAAA,UAAA,CACR;AAAA,QAAA,CACe;AAAA,MAAA,CACH,CAAC;AAAA,IAAA,CACf;AAAA,EAAA,CAEG;AAEhB;"}
|
|
1
|
+
{"version":3,"file":"WizardContent.js","sources":["../../../../../src/components/Wizard/WizardContent/WizardContent.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport {\n ExtractNames,\n HvBaseProps,\n HvDialogContent,\n} from \"@hitachivantara/uikit-react-core\";\n\nimport { useElementSize } from \"usehooks-ts\";\n\nimport React, {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { HvWizardContext, HvWizardTabs } from \"..\";\nimport { staticClasses, useClasses } from \"./WizardContent.styles\";\nimport { LoadingContainer } from \"./LoadingContainer\";\n\nexport { staticClasses as wizardContentClasses };\n\nexport type HvWizardContentClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardContentProps extends HvBaseProps {\n /** Forces minimum height to the component. */\n fixedHeight?: boolean;\n /** Whether the loading animation is shown. */\n loading?: boolean;\n /** The content of the summary. */\n summaryContent?: React.ReactNode;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardContentClasses;\n}\n\ntype ChildElement = React.ReactElement<HvWizardTabs>;\n\nconst DRAWER_PERCENTAGE = 0.3;\nconst DRAWER_MIN_WIDTH = 280;\n\nexport const HvWizardContent = ({\n classes: classesProp,\n fixedHeight = false,\n loading = false,\n children,\n summaryContent,\n}: HvWizardContentProps) => {\n const { classes, cx } = useClasses(classesProp);\n\n const { context, setContext, summary, tab } = useContext(HvWizardContext);\n\n const arrayChildren = React.Children.toArray(children) as ChildElement[];\n\n const initialContext = arrayChildren.reduce(\n (acc, child: ChildElement, index) => {\n const invalid =\n \"mustValidate\" in child.props && child.props.mustValidate === true\n ? false\n : null;\n const valid = invalid ?? (index === 0 || null);\n return {\n ...acc,\n [index]: { ...child.props, form: {}, valid, touched: index === 0 },\n };\n },\n {}\n );\n\n const summaryRef = useRef<HTMLElement>();\n const resizedRef = useRef({ height: 0, width: 0 });\n const [containerRef, sizes] = useElementSize();\n\n const [summaryHeight, setSummaryHeight] = useState(0);\n const [summaryWidth, setSummaryWidth] = useState(0);\n const [summaryLeft, setSummaryLeft] = useState(0);\n\n const updateSummaryMeasures = useCallback((newSizes) => {\n const modalWidth = newSizes.width;\n const drawerWidth = modalWidth * DRAWER_PERCENTAGE;\n setSummaryHeight(newSizes.height);\n setSummaryWidth(Math.max(drawerWidth, DRAWER_MIN_WIDTH));\n setSummaryLeft(modalWidth - Math.max(drawerWidth, DRAWER_MIN_WIDTH));\n\n resizedRef.current = {\n height: newSizes.height,\n width: newSizes.width,\n };\n }, []);\n\n useEffect(() => {\n const pageHeight = summaryRef.current?.getBoundingClientRect?.()?.height;\n if (\n (summary && sizes.height !== resizedRef.current.height) ||\n sizes.width !== resizedRef.current.width\n ) {\n updateSummaryMeasures(sizes);\n }\n\n if (pageHeight && sizes.height !== pageHeight) {\n updateSummaryMeasures({\n width: sizes.width,\n height: pageHeight,\n });\n }\n }, [tab, sizes, summary, updateSummaryMeasures]);\n\n useEffect(() => {\n setContext(initialContext);\n }, []);\n\n useEffect(() => {\n if (tab && !context[tab]?.touched) {\n const updatedContext = Object.entries(context).reduce(\n (acc, [key, childState]) => ({\n ...acc,\n ...(+key <= tab\n ? {\n [key]: {\n ...childState,\n touched: true,\n valid: childState?.valid ?? true,\n },\n }\n : { [key]: childState }),\n }),\n {}\n );\n\n setContext(updatedContext);\n }\n }, [tab, context, setContext]);\n\n const translateX = summaryWidth ? summaryWidth + 10 : 450;\n\n return (\n <div\n className={classes.summaryRef}\n ref={(el) => {\n containerRef(el);\n if (el) {\n summaryRef.current = el;\n }\n }}\n >\n {summary !== null && (\n <div className={classes.summarySticky}>\n <div\n className={classes.summaryContainer}\n style={{\n left: summaryLeft,\n width: summaryWidth,\n height: summaryHeight,\n transform: `translate(${summary ? 0 : translateX}px, 0)`,\n }}\n >\n {summaryContent}\n </div>\n </div>\n )}\n <HvDialogContent\n className={cx(classes.contentContainer, {\n [classes.fixedHeight]: fixedHeight,\n })}\n indentContent\n >\n <LoadingContainer hidden={!loading}>\n {React.Children.map(arrayChildren, (child, index) => {\n if (index === tab) {\n return React.cloneElement(child as React.ReactElement, {\n tab,\n });\n }\n return null;\n })}\n </LoadingContainer>\n </HvDialogContent>\n </div>\n );\n};\n"],"names":["DRAWER_PERCENTAGE","DRAWER_MIN_WIDTH","HvWizardContent","classes","classesProp","fixedHeight","loading","children","summaryContent","cx","useClasses","context","setContext","summary","tab","useContext","HvWizardContext","arrayChildren","React","Children","toArray","initialContext","reduce","acc","child","index","invalid","props","mustValidate","valid","form","touched","summaryRef","useRef","resizedRef","height","width","containerRef","sizes","useElementSize","summaryHeight","setSummaryHeight","useState","summaryWidth","setSummaryWidth","summaryLeft","setSummaryLeft","updateSummaryMeasures","useCallback","newSizes","modalWidth","drawerWidth","Math","max","current","useEffect","pageHeight","getBoundingClientRect","updatedContext","Object","entries","key","childState","translateX","className","ref","el","summarySticky","summaryContainer","style","left","transform","_jsx","HvDialogContent","contentContainer","indentContent","LoadingContainer","hidden","map","cloneElement"],"mappings":";;;;;;;;AAsCA,MAAMA,oBAAoB;AAC1B,MAAMC,mBAAmB;A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AA,aAAapB,eAAeA,eAAe,KAAK;AAEtD,8BACE,OAAA;AAAA,IACEqB,WAAW7D,QAAQ6B;AAAAA,IACnBiC,KAAMC,CAAO,OAAA;AACX7B,mBAAa6B,EAAE;AACf,UAAIA,IAAI;AACNlC,mBAAWsB,UAAUY;AAAAA,MACvB;AAAA,IACF;AAAA,IAAE3D,UAEDM,CAAAA,YAAY,4BACX,OAAA;AAAA,MAAKmD,WAAW7D,QAAQgE;AAAAA,MAAc5D,8BACpC,OAAA;AAAA,QACEyD,WAAW7D,QAAQiE;AAAAA,QACnBC,OAAO;AAAA,UACLC,MAAMzB;AAAAA,UACNT,OAAOO;AAAAA,UACPR,QAAQK;AAAAA,UACR+B,WAAY,aAAY1D,UAAU,IAAIkD;AAAAA,QACxC;AAAA,QAAExD,UAEDC;AAAAA,MAAAA,CACE;AAAA,IAAA,CACF,GAEPgE,oBAACC,iBAAe;AAAA,MACdT,WAAWvD,GAAGN,QAAQuE,kBAAkB;AAAA,QACtC,CAACvE,QAAQE,WAAW,GAAGA;AAAAA,MAAAA,CACxB;AAAA,MACDsE,eAAa;AAAA,MAAApE,8BAEZqE,kBAAgB;AAAA,QAACC,QAAQ,CAACvE;AAAAA,QAAQC,UAChCW,MAAMC,SAAS2D,IAAI7D,eAAe,CAACO,OAAOC,UAAU;AACnD,cAAIA,UAAUX,KAAK;AACVI,mBAAAA,MAAM6D,aAAavD,OAA6B;AAAA,cACrDV;AAAAA,YAAAA,CACD;AAAA,UACH;AACO,iBAAA;AAAA,QAAA,CACR;AAAA,MAAA,CACe;AAAA,IAAA,CACH,CAAC;AAAA,EAAA,CACf;AAET;"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
2
|
-
|
|
2
|
+
import { createClasses } from "@hitachivantara/uikit-react-core";
|
|
3
|
+
const {
|
|
4
|
+
staticClasses,
|
|
5
|
+
useClasses
|
|
6
|
+
} = createClasses("HvWizardContent", {
|
|
3
7
|
contentContainer: {
|
|
4
8
|
position: "relative",
|
|
5
9
|
padding: 20,
|
|
@@ -30,8 +34,9 @@ const styles = {
|
|
|
30
34
|
transitionTimingFunction: "ease-in-out",
|
|
31
35
|
overflowY: "scroll"
|
|
32
36
|
}
|
|
33
|
-
};
|
|
37
|
+
});
|
|
34
38
|
export {
|
|
35
|
-
|
|
39
|
+
staticClasses,
|
|
40
|
+
useClasses
|
|
36
41
|
};
|
|
37
42
|
//# sourceMappingURL=WizardContent.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardContent.styles.js","sources":["../../../../../src/components/Wizard/WizardContent/WizardContent.styles.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"WizardContent.styles.js","sources":["../../../../../src/components/Wizard/WizardContent/WizardContent.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\nimport { createClasses } from \"@hitachivantara/uikit-react-core\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvWizardContent\", {\n contentContainer: {\n position: \"relative\",\n padding: 20,\n marginLeft: 0,\n minHeight: 400,\n overflowX: \"hidden\",\n },\n fixedHeight: {\n minHeight: \"calc(100vh - 387px)\",\n },\n summaryRef: {\n flex: 1,\n overflowY: \"auto\",\n overflowX: \"hidden\",\n },\n summarySticky: {\n position: \"sticky\",\n top: 0,\n zIndex: 1,\n },\n summaryContainer: {\n position: \"absolute\",\n top: 0,\n minWidth: 280,\n boxShadow: theme.colors.shadow,\n backgroundColor: theme.colors.atmo1,\n transition: \"transform 0.3s\",\n transitionTimingFunction: \"ease-in-out\",\n overflowY: \"scroll\",\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","contentContainer","position","padding","marginLeft","minHeight","overflowX","fixedHeight","summaryRef","flex","overflowY","summarySticky","top","zIndex","summaryContainer","minWidth","boxShadow","theme","colors","shadow","backgroundColor","atmo1","transition","transitionTimingFunction"],"mappings":";;AAGa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,mBAAmB;AAAA,EAC5EC,kBAAkB;AAAA,IAChBC,UAAU;AAAA,IACVC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,WAAW;AAAA,IACXC,WAAW;AAAA,EACb;AAAA,EACAC,aAAa;AAAA,IACXF,WAAW;AAAA,EACb;AAAA,EACAG,YAAY;AAAA,IACVC,MAAM;AAAA,IACNC,WAAW;AAAA,IACXJ,WAAW;AAAA,EACb;AAAA,EACAK,eAAe;AAAA,IACbT,UAAU;AAAA,IACVU,KAAK;AAAA,IACLC,QAAQ;AAAA,EACV;AAAA,EACAC,kBAAkB;AAAA,IAChBZ,UAAU;AAAA,IACVU,KAAK;AAAA,IACLG,UAAU;AAAA,IACVC,WAAWC,MAAMC,OAAOC;AAAAA,IACxBC,iBAAiBH,MAAMC,OAAOG;AAAAA,IAC9BC,YAAY;AAAA,IACZC,0BAA0B;AAAA,IAC1Bb,WAAW;AAAA,EACb;AACF,CAAC;"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useContext, useState, useEffect } from "react";
|
|
2
2
|
import { HvDialogTitle, HvGrid, HvTypography, HvButton } from "@hitachivantara/uikit-react-core";
|
|
3
3
|
import { Report } from "@hitachivantara/uikit-react-icons";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useClasses } from "./WizardTitle.styles.js";
|
|
5
|
+
import { staticClasses } from "./WizardTitle.styles.js";
|
|
6
6
|
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
7
|
-
import wizardTitleClasses from "./wizardTitleClasses.js";
|
|
8
|
-
import { HvStepNavigation } from "../../StepNavigation/StepNavigation.js";
|
|
9
7
|
import HvWizardContext from "../WizardContext/WizardContext.js";
|
|
8
|
+
import { HvStepNavigation } from "../../StepNavigation/StepNavigation.js";
|
|
10
9
|
const switchTabState = (state, currentTab, index) => {
|
|
11
10
|
if (index === currentTab)
|
|
12
11
|
return "Current";
|
|
@@ -22,7 +21,7 @@ const HvWizardTitle = ({
|
|
|
22
21
|
title,
|
|
23
22
|
hasSummary = false,
|
|
24
23
|
labels = {},
|
|
25
|
-
classes,
|
|
24
|
+
classes: classesProp,
|
|
26
25
|
customStep = {}
|
|
27
26
|
}) => {
|
|
28
27
|
const {
|
|
@@ -31,6 +30,9 @@ const HvWizardTitle = ({
|
|
|
31
30
|
tab,
|
|
32
31
|
setTab
|
|
33
32
|
} = useContext(HvWizardContext);
|
|
33
|
+
const {
|
|
34
|
+
classes
|
|
35
|
+
} = useClasses(classesProp);
|
|
34
36
|
const [steps, setSteps] = useState([]);
|
|
35
37
|
useEffect(() => {
|
|
36
38
|
return () => {
|
|
@@ -53,52 +55,48 @@ const HvWizardTitle = ({
|
|
|
53
55
|
setSteps(updatedSteps);
|
|
54
56
|
}
|
|
55
57
|
}, [context, tab, setTab]);
|
|
56
|
-
return /* @__PURE__ */ jsx(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
onClick: toggleSummary,
|
|
94
|
-
startIcon: /* @__PURE__ */ jsx(Report, {}),
|
|
95
|
-
children: `${labels.summary ?? "Summary"}`
|
|
96
|
-
})]
|
|
97
|
-
})
|
|
58
|
+
return /* @__PURE__ */ jsx(HvDialogTitle, {
|
|
59
|
+
className: classes.headerContainer,
|
|
60
|
+
classes: {
|
|
61
|
+
messageContainer: classes.messageContainer
|
|
62
|
+
},
|
|
63
|
+
children: /* @__PURE__ */ jsxs(HvGrid, {
|
|
64
|
+
container: true,
|
|
65
|
+
justifyContent: "space-between",
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
className: classes.titleContainer,
|
|
68
|
+
children: [title && /* @__PURE__ */ jsx(HvTypography, {
|
|
69
|
+
variant: "title3",
|
|
70
|
+
component: "h3",
|
|
71
|
+
children: title
|
|
72
|
+
}), !!steps.length && /* @__PURE__ */ jsx(HvStepNavigation, {
|
|
73
|
+
className: classes.stepContainer,
|
|
74
|
+
steps,
|
|
75
|
+
type: "Default",
|
|
76
|
+
stepSize: "xs",
|
|
77
|
+
width: {
|
|
78
|
+
xs: 200,
|
|
79
|
+
sm: 350,
|
|
80
|
+
md: 600,
|
|
81
|
+
lg: 800,
|
|
82
|
+
xl: 1e3
|
|
83
|
+
},
|
|
84
|
+
...customStep
|
|
85
|
+
}), hasSummary && /* @__PURE__ */ jsx(HvButton, {
|
|
86
|
+
variant: "secondarySubtle",
|
|
87
|
+
className: classes.buttonWidth,
|
|
88
|
+
classes: {
|
|
89
|
+
root: classes.rootSummaryButton
|
|
90
|
+
},
|
|
91
|
+
onClick: toggleSummary,
|
|
92
|
+
startIcon: /* @__PURE__ */ jsx(Report, {}),
|
|
93
|
+
children: `${labels.summary ?? "Summary"}`
|
|
94
|
+
})]
|
|
98
95
|
})
|
|
99
96
|
});
|
|
100
97
|
};
|
|
101
98
|
export {
|
|
102
|
-
HvWizardTitle
|
|
99
|
+
HvWizardTitle,
|
|
100
|
+
staticClasses as wizardTitleClasses
|
|
103
101
|
};
|
|
104
102
|
//# sourceMappingURL=WizardTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardTitle.js","sources":["../../../../../src/components/Wizard/WizardTitle/WizardTitle.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"WizardTitle.js","sources":["../../../../../src/components/Wizard/WizardTitle/WizardTitle.tsx"],"sourcesContent":["import { useContext, useEffect, useState } from \"react\";\n\nimport {\n ExtractNames,\n HvBaseProps,\n HvButton,\n HvDialogTitle,\n HvGrid,\n HvTypography,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Report } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvStepNavigation, HvStepNavigationProps } from \"../../StepNavigation\";\nimport { HvStepProps } from \"../../StepNavigation/DefaultNavigation\";\nimport { HvWizardContext } from \"../WizardContext\";\nimport { staticClasses, useClasses } from \"./WizardTitle.styles\";\n\nexport { staticClasses as wizardTitleClasses };\n\nexport type HvWizardTitleClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvWizardTitleProps extends HvBaseProps {\n /** Title for the wizard. */\n title?: string;\n /** Shows the summary button. */\n hasSummary?: boolean;\n /** An object containing all the labels for the wizard header. */\n labels?: {\n /** Summary button label. */\n summary?: string;\n };\n /** Custom object to define type, size and width of the StepNavigation component */\n customStep?: Pick<HvStepNavigationProps, \"type\" | \"stepSize\" | \"width\">;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardTitleClasses;\n}\n\nconst switchTabState = (state, currentTab, index) => {\n if (index === currentTab) return \"Current\";\n if (state.valid) return \"Completed\";\n if (state.valid === null) return \"Enabled\";\n if (state.touched && state.valid === false) return \"Failed\";\n // \"Disabled\"\n // \"Pending\"\n return \"Enabled\";\n};\n\nexport const HvWizardTitle = ({\n title,\n hasSummary = false,\n labels = {},\n classes: classesProp,\n customStep = {},\n}: HvWizardTitleProps) => {\n const { context, setSummary, tab, setTab } = useContext(HvWizardContext);\n\n const { classes } = useClasses(classesProp);\n\n const [steps, setSteps] = useState<HvStepProps[]>([]);\n\n useEffect(() => {\n return () => {\n setSummary(false);\n };\n }, [setSummary]);\n\n const toggleSummary = () => {\n setSummary((prevValue) => !prevValue);\n };\n\n useEffect(() => {\n const contextArray = Object.entries(context);\n\n if (contextArray.length) {\n const updatedSteps: HvStepProps[] = contextArray.map(\n ([, childState], index) => {\n return {\n title: childState?.name ?? `${index + 1}`,\n state: switchTabState(childState, tab, index),\n onClick: () => setTab(index),\n };\n }\n );\n\n setSteps(updatedSteps);\n }\n }, [context, tab, setTab]);\n\n return (\n <HvDialogTitle\n className={classes.headerContainer}\n classes={{\n messageContainer: classes.messageContainer,\n }}\n >\n <HvGrid\n container\n justifyContent=\"space-between\"\n alignItems=\"center\"\n className={classes.titleContainer}\n >\n {title && (\n <HvTypography variant=\"title3\" component=\"h3\">\n {title}\n </HvTypography>\n )}\n {!!steps.length && (\n <HvStepNavigation\n className={classes.stepContainer}\n steps={steps}\n type=\"Default\"\n stepSize=\"xs\"\n width={{\n xs: 200,\n sm: 350,\n md: 600,\n lg: 800,\n xl: 1000,\n }}\n {...customStep}\n />\n )}\n {hasSummary && (\n <HvButton\n variant=\"secondarySubtle\"\n className={classes.buttonWidth}\n classes={{\n root: classes.rootSummaryButton,\n }}\n onClick={toggleSummary}\n startIcon={<Report />}\n >\n {`${labels.summary ?? \"Summary\"}`}\n </HvButton>\n )}\n </HvGrid>\n </HvDialogTitle>\n );\n};\n"],"names":["switchTabState","state","currentTab","index","valid","touched","HvWizardTitle","title","hasSummary","labels","classes","classesProp","customStep","context","setSummary","tab","setTab","useContext","HvWizardContext","useClasses","steps","setSteps","useState","useEffect","toggleSummary","prevValue","contextArray","Object","entries","length","updatedSteps","map","childState","name","onClick","HvDialogTitle","className","headerContainer","messageContainer","children","HvGrid","container","justifyContent","alignItems","titleContainer","_jsx","HvTypography","variant","component","HvStepNavigation","stepContainer","type","stepSize","width","xs","sm","md","lg","xl","HvButton","buttonWidth","root","rootSummaryButton","startIcon","Report","summary"],"mappings":";;;;;;;;AAqCA,MAAMA,iBAAiBA,CAACC,OAAOC,YAAYC,UAAU;AACnD,MAAIA,UAAUD;AAAmB,WAAA;AACjC,MAAID,MAAMG;AAAc,WAAA;AACxB,MAAIH,MAAMG,UAAU;AAAa,WAAA;AAC7BH,MAAAA,MAAMI,WAAW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AAW;AAAA,MACXP,WAAW1B,QAAQkC;AAAAA,MAAeL,UAEjChC,CAAAA,SACCsC,oBAACC,cAAY;AAAA,QAACC,SAAQ;AAAA,QAASC,WAAU;AAAA,QAAIT,UAC1ChC;AAAAA,MACW,CAAA,GAEf,CAAC,CAACa,MAAMS,8BACNoB,kBAAgB;AAAA,QACfb,WAAW1B,QAAQwC;AAAAA,QACnB9B;AAAAA,QACA+B,MAAK;AAAA,QACLC,UAAS;AAAA,QACTC,OAAO;AAAA,UACLC,IAAI;AAAA,UACJC,IAAI;AAAA,UACJC,IAAI;AAAA,UACJC,IAAI;AAAA,UACJC,IAAI;AAAA,QACN;AAAA,QAAE,GACE9C;AAAAA,MAAAA,CACL,GAEFJ,cACCqC,oBAACc,UAAQ;AAAA,QACPZ,SAAQ;AAAA,QACRX,WAAW1B,QAAQkD;AAAAA,QACnBlD,SAAS;AAAA,UACPmD,MAAMnD,QAAQoD;AAAAA,QAChB;AAAA,QACA5B,SAASV;AAAAA,QACTuC,WAAWlB,oBAACmB,UAAQ;AAAA,QAAEzB,UAEpB,GAAE9B,OAAOwD,WAAW;AAAA,MAAA,CACd,CACX;AAAA,IAAA,CACK;AAAA,EAAA,CACK;AAEnB;"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
2
|
-
|
|
2
|
+
import { createClasses } from "@hitachivantara/uikit-react-core";
|
|
3
|
+
const {
|
|
4
|
+
staticClasses,
|
|
5
|
+
useClasses
|
|
6
|
+
} = createClasses("HvWizardTitle", {
|
|
3
7
|
messageContainer: {
|
|
4
8
|
"& > div": {
|
|
5
9
|
width: "100%"
|
|
@@ -26,8 +30,9 @@ const styles = {
|
|
|
26
30
|
stepContainer: {
|
|
27
31
|
margin: "auto"
|
|
28
32
|
}
|
|
29
|
-
};
|
|
33
|
+
});
|
|
30
34
|
export {
|
|
31
|
-
|
|
35
|
+
staticClasses,
|
|
36
|
+
useClasses
|
|
32
37
|
};
|
|
33
38
|
//# sourceMappingURL=WizardTitle.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardTitle.styles.js","sources":["../../../../../src/components/Wizard/WizardTitle/WizardTitle.styles.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"WizardTitle.styles.js","sources":["../../../../../src/components/Wizard/WizardTitle/WizardTitle.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\nimport { createClasses } from \"@hitachivantara/uikit-react-core\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvWizardTitle\", {\n messageContainer: {\n \"& > div\": {\n width: \"100%\",\n },\n },\n titleContainer: {\n margin: 0,\n width: \"100%\",\n },\n buttonWidth: {\n width: 120,\n },\n rootSummaryButton: {\n paddingRight: 18,\n },\n headerContainer: {\n backgroundColor: theme.colors.atmo2,\n \"& h6\": {\n fontSize: \"16px\",\n fontWeight: \"bold\",\n letterSpacing: 0,\n },\n },\n stepContainer: {\n margin: \"auto\",\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","messageContainer","width","titleContainer","margin","buttonWidth","rootSummaryButton","paddingRight","headerContainer","backgroundColor","theme","colors","atmo2","fontSize","fontWeight","letterSpacing","stepContainer"],"mappings":";;AAGa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,iBAAiB;AAAA,EAC1EC,kBAAkB;AAAA,IAChB,WAAW;AAAA,MACTC,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACAC,gBAAgB;AAAA,IACdC,QAAQ;AAAA,IACRF,OAAO;AAAA,EACT;AAAA,EACAG,aAAa;AAAA,IACXH,OAAO;AAAA,EACT;AAAA,EACAI,mBAAmB;AAAA,IACjBC,cAAc;AAAA,EAChB;AAAA,EACAC,iBAAiB;AAAA,IACfC,iBAAiBC,MAAMC,OAAOC;AAAAA,IAC9B,QAAQ;AAAA,MACNC,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,eAAe;AAAA,IACjB;AAAA,EACF;AAAA,EACAC,eAAe;AAAA,IACbZ,QAAQ;AAAA,EACV;AACF,CAAC;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { staticClasses } from "./components/StepNavigation/StepNavigation.styles.js";
|
|
2
2
|
import { HvStepNavigation } from "./components/StepNavigation/StepNavigation.js";
|
|
3
|
-
import {
|
|
3
|
+
import { staticClasses as staticClasses2 } from "./components/Wizard/Wizard.styles.js";
|
|
4
4
|
import { HvWizard } from "./components/Wizard/Wizard.js";
|
|
5
|
-
import {
|
|
5
|
+
import { staticClasses as staticClasses3 } from "./components/Wizard/WizardActions/WizardActions.styles.js";
|
|
6
6
|
import { HvWizardActions } from "./components/Wizard/WizardActions/WizardActions.js";
|
|
7
|
-
import {
|
|
7
|
+
import { staticClasses as staticClasses4 } from "./components/Wizard/WizardContainer/WizardContainer.styles.js";
|
|
8
8
|
import { HvWizardContainer } from "./components/Wizard/WizardContainer/WizardContainer.js";
|
|
9
|
-
import {
|
|
9
|
+
import { staticClasses as staticClasses5 } from "./components/Wizard/WizardContent/WizardContent.styles.js";
|
|
10
10
|
import { HvWizardContent } from "./components/Wizard/WizardContent/WizardContent.js";
|
|
11
|
-
import { default as
|
|
12
|
-
import {
|
|
11
|
+
import { default as default2 } from "./components/Wizard/WizardContext/WizardContext.js";
|
|
12
|
+
import { staticClasses as staticClasses6 } from "./components/Wizard/WizardTitle/WizardTitle.styles.js";
|
|
13
13
|
import { HvWizardTitle } from "./components/Wizard/WizardTitle/WizardTitle.js";
|
|
14
14
|
export {
|
|
15
15
|
HvStepNavigation,
|
|
@@ -17,13 +17,13 @@ export {
|
|
|
17
17
|
HvWizardActions,
|
|
18
18
|
HvWizardContainer,
|
|
19
19
|
HvWizardContent,
|
|
20
|
-
|
|
20
|
+
default2 as HvWizardContext,
|
|
21
21
|
HvWizardTitle,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
staticClasses as stepNavigationClasses,
|
|
23
|
+
staticClasses3 as wizardActionsClasses,
|
|
24
|
+
staticClasses2 as wizardClasses,
|
|
25
|
+
staticClasses4 as wizardContainerClasses,
|
|
26
|
+
staticClasses5 as wizardContentClasses,
|
|
27
|
+
staticClasses6 as wizardTitleClasses
|
|
28
28
|
};
|
|
29
29
|
//# sourceMappingURL=index.js.map
|