@hitachivantara/uikit-react-lab 5.2.0 → 5.2.1
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/packages/lab/src/components/Wizard/Wizard.cjs +65 -0
- package/dist/cjs/packages/lab/src/components/Wizard/Wizard.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardActions/WizardActions.cjs +113 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardActions/WizardActions.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardActions/WizardActions.styles.cjs +28 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardActions/WizardActions.styles.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardActions/wizardActionsClasses.cjs +8 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardActions/wizardActionsClasses.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContainer/WizardContainer.cjs +34 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContainer/WizardContainer.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContainer/WizardContainer.styles.cjs +15 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContainer/WizardContainer.styles.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContainer/wizardContainerClasses.cjs +8 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContainer/wizardContainerClasses.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/LoadingContainer.cjs +38 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/LoadingContainer.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/LoadingContainer.styles.cjs +21 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/LoadingContainer.styles.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/WizardContent.cjs +141 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/WizardContent.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/WizardContent.styles.cjs +37 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/WizardContent.styles.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/wizardContentClasses.cjs +8 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/wizardContentClasses.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContext/WizardContext.cjs +42 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardContext/WizardContext.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardTitle/WizardTitle.cjs +106 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardTitle/WizardTitle.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardTitle/WizardTitle.styles.cjs +33 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardTitle/WizardTitle.styles.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardTitle/wizardTitleClasses.cjs +8 -0
- package/dist/cjs/packages/lab/src/components/Wizard/WizardTitle/wizardTitleClasses.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/components/Wizard/wizardClasses.cjs +8 -0
- package/dist/cjs/packages/lab/src/components/Wizard/wizardClasses.cjs.map +1 -0
- package/dist/cjs/packages/lab/src/index.cjs +14 -0
- package/dist/cjs/packages/lab/src/index.cjs.map +1 -1
- package/dist/esm/packages/lab/src/components/Wizard/Wizard.js +65 -0
- package/dist/esm/packages/lab/src/components/Wizard/Wizard.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardActions/WizardActions.js +113 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardActions/WizardActions.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardActions/WizardActions.styles.js +28 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardActions/WizardActions.styles.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardActions/wizardActionsClasses.js +8 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardActions/wizardActionsClasses.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContainer/WizardContainer.js +34 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContainer/WizardContainer.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContainer/WizardContainer.styles.js +15 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContainer/WizardContainer.styles.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContainer/wizardContainerClasses.js +8 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContainer/wizardContainerClasses.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/LoadingContainer.js +38 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/LoadingContainer.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/LoadingContainer.styles.js +21 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/LoadingContainer.styles.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/WizardContent.js +139 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/WizardContent.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/WizardContent.styles.js +37 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/WizardContent.styles.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/wizardContentClasses.js +8 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContent/wizardContentClasses.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContext/WizardContext.js +42 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardContext/WizardContext.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardTitle/WizardTitle.js +106 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardTitle/WizardTitle.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardTitle/WizardTitle.styles.js +33 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardTitle/WizardTitle.styles.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardTitle/wizardTitleClasses.js +8 -0
- package/dist/esm/packages/lab/src/components/Wizard/WizardTitle/wizardTitleClasses.js.map +1 -0
- package/dist/esm/packages/lab/src/components/Wizard/wizardClasses.js +8 -0
- package/dist/esm/packages/lab/src/components/Wizard/wizardClasses.js.map +1 -0
- package/dist/esm/packages/lab/src/index.js +15 -1
- package/dist/esm/packages/lab/src/index.js.map +1 -1
- package/dist/types/index.d.ts +172 -1
- package/package.json +3 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
4
|
+
const classKeys = ["contentContainer", "fixedHeight", "summaryRef", "summarySticky", "summaryContainer"];
|
|
5
|
+
const wizardContentClasses = uikitReactCore.getClasses(classKeys, "HvWizardContent");
|
|
6
|
+
const wizardContentClasses$1 = wizardContentClasses;
|
|
7
|
+
exports.default = wizardContentClasses$1;
|
|
8
|
+
//# sourceMappingURL=wizardContentClasses.cjs.map
|
package/dist/cjs/packages/lab/src/components/Wizard/WizardContent/wizardContentClasses.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizardContentClasses.cjs","sources":["../../../../../../../../src/components/Wizard/WizardContent/wizardContentClasses.ts"],"sourcesContent":["import { getClasses } from \"@hitachivantara/uikit-react-core\";\n\nexport type HvWizardContentClasses = {\n /** Style applied to the Wizard content container. */\n contentContainer?: string;\n /** Style applied to the Wizard to fix its height. */\n fixedHeight?: string;\n /** Style applied to the summary container around the page content container. */\n summaryRef?: string;\n /** Style applied to the Summary container to stick it to the top. */\n summarySticky?: string;\n /** Style applied to the Summary container to position it on the right. */\n summaryContainer?: string;\n};\n\nconst classKeys: string[] = [\n \"contentContainer\",\n \"fixedHeight\",\n \"summaryRef\",\n \"summarySticky\",\n \"summaryContainer\",\n];\n\nconst wizardContentClasses = getClasses<HvWizardContentClasses>(\n classKeys,\n \"HvWizardContent\"\n);\n\nexport default wizardContentClasses;\n"],"names":["classKeys","wizardContentClasses","getClasses"],"mappings":";;;AAeA,MAAMA,YAAsB,CAC1B,oBACA,eACA,cACA,iBACA,kBAAkB;AAGpB,MAAMC,uBAAuBC,eAC3BF,WAAAA,WACA,iBAAiB;AAGnB,MAAA,yBAAeC;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const HvWizardContext = React.createContext({
|
|
6
|
+
context: {},
|
|
7
|
+
updateContext: () => {
|
|
8
|
+
},
|
|
9
|
+
summary: void 0,
|
|
10
|
+
setSummary: ({}) => {
|
|
11
|
+
},
|
|
12
|
+
tab: 0,
|
|
13
|
+
setTab: () => {
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const HvWizardProvider = ({
|
|
17
|
+
children
|
|
18
|
+
}) => {
|
|
19
|
+
const [context, setContext] = React.useState({});
|
|
20
|
+
const [summary, setSummary] = React.useState(void 0);
|
|
21
|
+
const [tab, setTab] = React.useState(0);
|
|
22
|
+
const updateContext = React.useCallback((newContext) => {
|
|
23
|
+
if (Object.entries(newContext).length > 0) {
|
|
24
|
+
setContext(newContext);
|
|
25
|
+
}
|
|
26
|
+
}, [setContext]);
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(HvWizardContext.Provider, {
|
|
28
|
+
value: {
|
|
29
|
+
context,
|
|
30
|
+
updateContext,
|
|
31
|
+
summary,
|
|
32
|
+
setSummary,
|
|
33
|
+
tab,
|
|
34
|
+
setTab
|
|
35
|
+
},
|
|
36
|
+
children
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const WizardProvider = HvWizardProvider;
|
|
40
|
+
exports.HvWizardContext = HvWizardContext;
|
|
41
|
+
exports.default = WizardProvider;
|
|
42
|
+
//# sourceMappingURL=WizardContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardContext.cjs","sources":["../../../../../../../../src/components/Wizard/WizardContext/WizardContext.tsx"],"sourcesContent":["import React, {\n createContext,\n useState,\n Dispatch,\n SetStateAction,\n useCallback,\n} from \"react\";\n\nexport type HvWizardTab = {\n name?: string;\n valid?: boolean;\n mustValidate?: boolean;\n touched?: boolean;\n form?: any;\n children?: React.ReactNode;\n};\n\nexport type HvWizardTabs<T extends HvWizardTab> = {\n [tab in number]?: T;\n};\n\ntype HvWizardContextProp = {\n context: HvWizardTabs<HvWizardTab>;\n updateContext: (values?: HvWizardTabs<HvWizardTab>) => void;\n summary: any;\n setSummary: (oldSummary?: any) => void;\n tab: any;\n setTab: Dispatch<SetStateAction<number>>;\n};\n\nexport const HvWizardContext = createContext<HvWizardContextProp>({\n context: {},\n updateContext: () => {},\n summary: undefined,\n setSummary: ({}) => {},\n tab: 0,\n setTab: () => {},\n});\n\nconst HvWizardProvider = ({ children }) => {\n const [context, setContext] = useState({});\n const [summary, setSummary] = useState(undefined);\n const [tab, setTab] = useState(0);\n\n const updateContext = useCallback(\n (newContext) => {\n if (Object.entries(newContext).length > 0) {\n setContext(newContext);\n }\n },\n [setContext]\n );\n\n return (\n <HvWizardContext.Provider\n value={{\n context,\n updateContext,\n summary,\n setSummary,\n tab,\n setTab,\n }}\n >\n {children}\n </HvWizardContext.Provider>\n );\n};\n\nexport default HvWizardProvider;\n"],"names":["HvWizardContext","createContext","context","updateContext","summary","undefined","setSummary","tab","setTab","HvWizardProvider","children","setContext","useState","useCallback","newContext","Object","entries","length","_jsx","Provider","value"],"mappings":";;;;AA8BO,MAAMA,kBAAkBC,MAAAA,cAAmC;AAAA,EAChEC,SAAS,CAAC;AAAA,EACVC,eAAeA,MAAM;AAAA,EAAC;AAAA,EACtBC,SAASC;AAAAA,EACTC,YAAYA,CAAC,CAAA,MAAO;AAAA,EAAC;AAAA,EACrBC,KAAK;AAAA,EACLC,QAAQA,MAAM;AAAA,EAAC;AACjB,CAAC;AAED,MAAMC,mBAAmBA,CAAC;AAAA,EAAEC;AAAS,MAAM;AACzC,QAAM,CAACR,SAASS,UAAU,IAAIC,MAAAA,SAAS,CAAE,CAAA;AACzC,QAAM,CAACR,SAASE,UAAU,IAAIM,MAAAA,SAASP,MAAS;AAChD,QAAM,CAACE,KAAKC,MAAM,IAAII,eAAS,CAAC;AAE1BT,QAAAA,gBAAgBU,kBACnBC,CAAe,eAAA;AACd,QAAIC,OAAOC,QAAQF,UAAU,EAAEG,SAAS,GAAG;AACzCN,iBAAWG,UAAU;AAAA,IACvB;AAAA,EAAA,GAEF,CAACH,UAAU,CAAC;AAIZO,SAAAA,2BAAAA,IAAClB,gBAAgBmB,UAAQ;AAAA,IACvBC,OAAO;AAAA,MACLlB;AAAAA,MACAC;AAAAA,MACAC;AAAAA,MACAE;AAAAA,MACAC;AAAAA,MACAC;AAAAA,IACF;AAAA,IAAEE;AAAAA,EAAAA,CAGuB;AAE/B;AAEA,MAAA,iBAAeD;;;"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("@emotion/react");
|
|
4
|
+
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
5
|
+
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
6
|
+
const clsx_m = require("../../../../../../node_modules/clsx/dist/clsx.m.cjs");
|
|
7
|
+
const wizardTitleClasses = require("./wizardTitleClasses.cjs");
|
|
8
|
+
const WizardTitle_styles = require("./WizardTitle.styles.cjs");
|
|
9
|
+
const React = require("react");
|
|
10
|
+
const WizardContext = require("../WizardContext/WizardContext.cjs");
|
|
11
|
+
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
12
|
+
const StepNavigation = require("../../StepNavigation/StepNavigation.cjs");
|
|
13
|
+
const switchTabState = (state, currentTab, index) => {
|
|
14
|
+
if (index === currentTab)
|
|
15
|
+
return "Current";
|
|
16
|
+
if (state.valid)
|
|
17
|
+
return "Completed";
|
|
18
|
+
if (state.valid === null)
|
|
19
|
+
return "Enabled";
|
|
20
|
+
if (state.touched && state.valid === false)
|
|
21
|
+
return "Failed";
|
|
22
|
+
return "Enabled";
|
|
23
|
+
};
|
|
24
|
+
const HvWizardTitle = ({
|
|
25
|
+
title,
|
|
26
|
+
hasSummary = false,
|
|
27
|
+
labels = {},
|
|
28
|
+
classes,
|
|
29
|
+
customStep = {}
|
|
30
|
+
}) => {
|
|
31
|
+
const {
|
|
32
|
+
context,
|
|
33
|
+
summary,
|
|
34
|
+
setSummary,
|
|
35
|
+
tab,
|
|
36
|
+
setTab
|
|
37
|
+
} = React.useContext(WizardContext.HvWizardContext);
|
|
38
|
+
const [steps, setSteps] = React.useState([]);
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
if (summary === null && hasSummary) {
|
|
41
|
+
setSummary(false);
|
|
42
|
+
}
|
|
43
|
+
return () => {
|
|
44
|
+
setSummary(false);
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
const contextArray = Object.entries(context);
|
|
49
|
+
if (contextArray.length) {
|
|
50
|
+
const updatedSteps = contextArray.map(([, childState], index) => {
|
|
51
|
+
return {
|
|
52
|
+
title: (childState == null ? void 0 : childState.name) ?? `${index + 1}`,
|
|
53
|
+
state: switchTabState(childState, tab, index),
|
|
54
|
+
onClick: () => setTab(index)
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
setSteps(updatedSteps);
|
|
58
|
+
}
|
|
59
|
+
}, [context, tab, setTab]);
|
|
60
|
+
const toggleSummary = () => {
|
|
61
|
+
setSummary((oldSummary) => !oldSummary);
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.ClassNames, {
|
|
64
|
+
children: ({
|
|
65
|
+
css
|
|
66
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(uikitReactCore.HvDialogTitle, {
|
|
67
|
+
className: clsx_m.clsx(classes == null ? void 0 : classes.headerContainer, wizardTitleClasses.default.headerContainer, css(WizardTitle_styles.styles.headerContainer)),
|
|
68
|
+
classes: {
|
|
69
|
+
messageContainer: clsx_m.clsx(classes == null ? void 0 : classes.messageContainer, wizardTitleClasses.default.messageContainer, css(WizardTitle_styles.styles.messageContainer))
|
|
70
|
+
},
|
|
71
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(uikitReactCore.HvGrid, {
|
|
72
|
+
container: true,
|
|
73
|
+
justifyContent: "space-between",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
className: clsx_m.clsx(classes == null ? void 0 : classes.titleContainer, wizardTitleClasses.default.titleContainer, css(WizardTitle_styles.styles.titleContainer)),
|
|
76
|
+
children: [title && /* @__PURE__ */ jsxRuntime.jsx(uikitReactCore.HvTypography, {
|
|
77
|
+
variant: "title3",
|
|
78
|
+
component: "h3",
|
|
79
|
+
children: title
|
|
80
|
+
}), !!steps.length && /* @__PURE__ */ jsxRuntime.jsx(StepNavigation.HvStepNavigation, {
|
|
81
|
+
className: clsx_m.clsx(classes == null ? void 0 : classes.stepContainer, wizardTitleClasses.default.stepContainer, css(WizardTitle_styles.styles.stepContainer)),
|
|
82
|
+
steps,
|
|
83
|
+
type: (customStep == null ? void 0 : customStep.type) ?? "Default",
|
|
84
|
+
stepSize: (customStep == null ? void 0 : customStep.stepSize) ?? "xs",
|
|
85
|
+
width: (customStep == null ? void 0 : customStep.width) ?? {
|
|
86
|
+
xs: 200,
|
|
87
|
+
sm: 350,
|
|
88
|
+
md: 600,
|
|
89
|
+
lg: 800
|
|
90
|
+
}
|
|
91
|
+
}), hasSummary && /* @__PURE__ */ jsxRuntime.jsx(uikitReactCore.HvButton, {
|
|
92
|
+
variant: "secondarySubtle",
|
|
93
|
+
className: clsx_m.clsx(classes == null ? void 0 : classes.buttonWidth, wizardTitleClasses.default.buttonWidth, css(WizardTitle_styles.styles.buttonWidth)),
|
|
94
|
+
classes: {
|
|
95
|
+
root: clsx_m.clsx(classes == null ? void 0 : classes.rootSummaryButton, wizardTitleClasses.default.rootSummaryButton, css(WizardTitle_styles.styles.rootSummaryButton))
|
|
96
|
+
},
|
|
97
|
+
onClick: toggleSummary,
|
|
98
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Report, {}),
|
|
99
|
+
children: `${labels.summary ?? "Summary"}`
|
|
100
|
+
})]
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
exports.HvWizardTitle = HvWizardTitle;
|
|
106
|
+
//# sourceMappingURL=WizardTitle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardTitle.cjs","sources":["../../../../../../../../src/components/Wizard/WizardTitle/WizardTitle.tsx"],"sourcesContent":["import { ClassNames } from \"@emotion/react\";\nimport {\n HvBaseProps,\n HvButton,\n HvDialogTitle,\n HvGrid,\n HvTypography,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Report } from \"@hitachivantara/uikit-react-icons\";\nimport { clsx } from \"clsx\";\nimport wizardTitleClasses, { HvWizardTitleClasses } from \"./wizardTitleClasses\";\nimport { styles } from \"./WizardTitle.styles\";\nimport { HvStepNavigation, HvStepNavigationProps } from \"../..\";\nimport { useContext, useEffect, useState } from \"react\";\nimport { HvWizardContext } from \"../WizardContext/WizardContext\";\nimport { HvStepProps } from \"components/StepNavigation/DefaultNavigation/Step/Step\";\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,\n customStep = {},\n}: HvWizardTitleProps) => {\n const { context, summary, setSummary, tab, setTab } =\n useContext(HvWizardContext);\n\n const [steps, setSteps] = useState<HvStepProps[]>([]);\n\n useEffect(() => {\n if (summary === null && hasSummary) {\n setSummary(false);\n }\n\n return () => {\n setSummary(false);\n };\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 const toggleSummary = () => {\n setSummary((oldSummary) => !oldSummary);\n };\n\n return (\n <ClassNames>\n {({ css }) => (\n <HvDialogTitle\n className={clsx(\n classes?.headerContainer,\n wizardTitleClasses.headerContainer,\n css(styles.headerContainer)\n )}\n classes={{\n messageContainer: clsx(\n classes?.messageContainer,\n wizardTitleClasses.messageContainer,\n css(styles.messageContainer)\n ),\n }}\n >\n <HvGrid\n container\n justifyContent=\"space-between\"\n alignItems=\"center\"\n className={clsx(\n classes?.titleContainer,\n wizardTitleClasses.titleContainer,\n css(styles.titleContainer)\n )}\n >\n {title && (\n <HvTypography variant=\"title3\" component=\"h3\">\n {title}\n </HvTypography>\n )}\n {!!steps.length && (\n <HvStepNavigation\n className={clsx(\n classes?.stepContainer,\n wizardTitleClasses.stepContainer,\n css(styles.stepContainer)\n )}\n steps={steps}\n type={customStep?.type ?? \"Default\"}\n stepSize={customStep?.stepSize ?? \"xs\"}\n width={\n customStep?.width ?? { xs: 200, sm: 350, md: 600, lg: 800 }\n }\n />\n )}\n {hasSummary && (\n <HvButton\n variant=\"secondarySubtle\"\n className={clsx(\n classes?.buttonWidth,\n wizardTitleClasses.buttonWidth,\n css(styles.buttonWidth)\n )}\n classes={{\n root: clsx(\n classes?.rootSummaryButton,\n wizardTitleClasses.rootSummaryButton,\n css(styles.rootSummaryButton)\n ),\n }}\n onClick={toggleSummary}\n startIcon={<Report />}\n >\n {`${labels.summary ?? \"Summary\"}`}\n </HvButton>\n )}\n </HvGrid>\n </HvDialogTitle>\n )}\n </ClassNames>\n );\n};\n"],"names":["switchTabState","state","currentTab","index","valid","touched","HvWizardTitle","title","hasSummary","labels","classes","customStep","context","summary","setSummary","tab","setTab","useContext","HvWizardContext","steps","setSteps","useState","useEffect","contextArray","Object","entries","length","updatedSteps","map","childState","name","onClick","toggleSummary","oldSummary","ClassNames","children","css","HvDialogTitle","className","clsx","headerContainer","wizardTitleClasses","styles","messageContainer","HvGrid","container","justifyContent","alignItems","titleContainer","_jsx","HvTypography","variant","component","HvStepNavigation","stepContainer","type","stepSize","width","xs","sm","md","lg","HvButton","buttonWidth","root","rootSummaryButton","startIcon","Report"],"mappings":";;;;;;;;;;;;AAiCA,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,WAAWJ,MAAMG,UAAU;AAAc,WAAA;AAG5C,SAAA;AACT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BAAU,QAAA,EAAA;AAAA,UAAAhC,UAEpB,GAAE1B,OAAOI,WAAW;AAAA,QAAA,CAEzB,CAAA;AAAA,MAAA,CAAA;AAAA,IAAA,CACM;AAAA,EAAA,CAGF;AAEjB;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
4
|
+
const styles = {
|
|
5
|
+
messageContainer: {
|
|
6
|
+
"& > div": {
|
|
7
|
+
width: "100%"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
titleContainer: {
|
|
11
|
+
margin: 0,
|
|
12
|
+
width: "100%"
|
|
13
|
+
},
|
|
14
|
+
buttonWidth: {
|
|
15
|
+
width: 120
|
|
16
|
+
},
|
|
17
|
+
rootSummaryButton: {
|
|
18
|
+
paddingRight: 18
|
|
19
|
+
},
|
|
20
|
+
headerContainer: {
|
|
21
|
+
backgroundColor: uikitReactCore.theme.colors.atmo2,
|
|
22
|
+
"& h6": {
|
|
23
|
+
fontSize: "16px",
|
|
24
|
+
fontWeight: "bold",
|
|
25
|
+
letterSpacing: 0
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
stepContainer: {
|
|
29
|
+
margin: "auto"
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.styles = styles;
|
|
33
|
+
//# sourceMappingURL=WizardTitle.styles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardTitle.styles.cjs","sources":["../../../../../../../../src/components/Wizard/WizardTitle/WizardTitle.styles.tsx"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-react-core\";\n\nexport const styles: { [key: string]: CSSInterpolation } = {\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":["styles","messageContainer","width","titleContainer","margin","buttonWidth","rootSummaryButton","paddingRight","headerContainer","backgroundColor","theme","colors","atmo2","fontSize","fontWeight","letterSpacing","stepContainer"],"mappings":";;;AAGO,MAAMA,SAA8C;AAAA,EACzDC,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,eAAAA,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;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
4
|
+
const classKeys = ["headerContainer", "messageContainer", "titleContainer", "buttonWidth", "rootSummaryButton", "stepContainer"];
|
|
5
|
+
const wizardTitleClasses = uikitReactCore.getClasses(classKeys, "HvWizardTitle");
|
|
6
|
+
const wizardTitleClasses$1 = wizardTitleClasses;
|
|
7
|
+
exports.default = wizardTitleClasses$1;
|
|
8
|
+
//# sourceMappingURL=wizardTitleClasses.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizardTitleClasses.cjs","sources":["../../../../../../../../src/components/Wizard/WizardTitle/wizardTitleClasses.ts"],"sourcesContent":["import { getClasses } from \"@hitachivantara/uikit-react-core\";\n\nexport type HvWizardTitleClasses = {\n /** Styles applied to the header container. */\n headerContainer?: string;\n /** Styles applied to override the Dialog Title styles. */\n messageContainer?: string;\n /** Styles applied to the header content container. */\n titleContainer?: string;\n /** Styles applied to the Button component to override its width. */\n buttonWidth?: string;\n /** Styles applied to the Button component to override its right padding. */\n rootSummaryButton?: string;\n /** Styles applies to the step container. */\n stepContainer?: string;\n};\n\nconst classKeys: string[] = [\n \"headerContainer\",\n \"messageContainer\",\n \"titleContainer\",\n \"buttonWidth\",\n \"rootSummaryButton\",\n \"stepContainer\",\n];\n\nconst wizardTitleClasses = getClasses<HvWizardTitleClasses>(\n classKeys,\n \"HvWizardTitle\"\n);\n\nexport default wizardTitleClasses;\n"],"names":["classKeys","wizardTitleClasses","getClasses"],"mappings":";;;AAiBA,MAAMA,YAAsB,CAC1B,mBACA,oBACA,kBACA,eACA,qBACA,eAAe;AAGjB,MAAMC,qBAAqBC,eACzBF,WAAAA,WACA,eAAe;AAGjB,MAAA,uBAAeC;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
4
|
+
const classKeys = ["root"];
|
|
5
|
+
const wizardClasses = uikitReactCore.getClasses(classKeys, "HvWizard");
|
|
6
|
+
const wizardClasses$1 = wizardClasses;
|
|
7
|
+
exports.default = wizardClasses$1;
|
|
8
|
+
//# sourceMappingURL=wizardClasses.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizardClasses.cjs","sources":["../../../../../../../src/components/Wizard/wizardClasses.ts"],"sourcesContent":["import { getClasses } from \"@hitachivantara/uikit-react-core\";\n\nexport type HvWizardClasses = {\n /** Styles applied to the component root class. */\n root?: string;\n};\n\nconst classKeys: string[] = [\"root\"];\n\nconst wizardClasses = getClasses<HvWizardClasses>(classKeys, \"HvWizard\");\n\nexport default wizardClasses;\n"],"names":["classKeys","wizardClasses","getClasses"],"mappings":";;;AAOA,MAAMA,YAAsB,CAAC,MAAM;AAEnC,MAAMC,gBAAgBC,eAA4BF,WAAAA,WAAW,UAAU;AAEvE,MAAA,kBAAeC;;"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const stepNavigationClasses = require("./components/StepNavigation/stepNavigationClasses.cjs");
|
|
3
4
|
const StepNavigation = require("./components/StepNavigation/StepNavigation.cjs");
|
|
5
|
+
const wizardClasses = require("./components/Wizard/wizardClasses.cjs");
|
|
6
|
+
const WizardContainer = require("./components/Wizard/WizardContainer/WizardContainer.cjs");
|
|
7
|
+
const WizardTitle = require("./components/Wizard/WizardTitle/WizardTitle.cjs");
|
|
8
|
+
const WizardContent = require("./components/Wizard/WizardContent/WizardContent.cjs");
|
|
9
|
+
const WizardActions = require("./components/Wizard/WizardActions/WizardActions.cjs");
|
|
10
|
+
const Wizard = require("./components/Wizard/Wizard.cjs");
|
|
11
|
+
exports.stepNavigationClasses = stepNavigationClasses.default;
|
|
4
12
|
exports.HvStepNavigation = StepNavigation.HvStepNavigation;
|
|
13
|
+
exports.wizardClasses = wizardClasses.default;
|
|
14
|
+
exports.HvWizardContainer = WizardContainer.HvWizardContainer;
|
|
15
|
+
exports.HvWizardTitle = WizardTitle.HvWizardTitle;
|
|
16
|
+
exports.HvWizardContent = WizardContent.HvWizardContent;
|
|
17
|
+
exports.HvWizardActions = WizardActions.HvWizardActions;
|
|
18
|
+
exports.HvWizard = Wizard.HvWizard;
|
|
5
19
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { HvWizardContainer } from "./WizardContainer/WizardContainer.js";
|
|
3
|
+
import { HvWizardTitle } from "./WizardTitle/WizardTitle.js";
|
|
4
|
+
import { HvWizardContent } from "./WizardContent/WizardContent.js";
|
|
5
|
+
import WizardProvider from "./WizardContext/WizardContext.js";
|
|
6
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
7
|
+
import { HvWizardActions } from "./WizardActions/WizardActions.js";
|
|
8
|
+
const HvWizard = ({
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
onClose,
|
|
12
|
+
handleSubmit,
|
|
13
|
+
title,
|
|
14
|
+
open,
|
|
15
|
+
skippable = true,
|
|
16
|
+
loading = false,
|
|
17
|
+
hasSummary = false,
|
|
18
|
+
summaryContent,
|
|
19
|
+
labels = {
|
|
20
|
+
cancel: "Cancel",
|
|
21
|
+
next: "Next",
|
|
22
|
+
previous: "Previous",
|
|
23
|
+
skip: "Skip",
|
|
24
|
+
submit: "Submit",
|
|
25
|
+
summary: "Summary"
|
|
26
|
+
},
|
|
27
|
+
fixedHeight = false,
|
|
28
|
+
customStep,
|
|
29
|
+
...others
|
|
30
|
+
}) => {
|
|
31
|
+
const handleClose = useCallback((evt, reason) => {
|
|
32
|
+
if (reason !== "backdropClick") {
|
|
33
|
+
onClose == null ? void 0 : onClose(evt, reason);
|
|
34
|
+
}
|
|
35
|
+
}, [onClose]);
|
|
36
|
+
return /* @__PURE__ */ jsx(WizardProvider, {
|
|
37
|
+
children: /* @__PURE__ */ jsxs(HvWizardContainer, {
|
|
38
|
+
className,
|
|
39
|
+
handleClose,
|
|
40
|
+
open,
|
|
41
|
+
...others,
|
|
42
|
+
children: [/* @__PURE__ */ jsx(HvWizardTitle, {
|
|
43
|
+
title,
|
|
44
|
+
hasSummary,
|
|
45
|
+
labels,
|
|
46
|
+
customStep
|
|
47
|
+
}), /* @__PURE__ */ jsx(HvWizardContent, {
|
|
48
|
+
loading,
|
|
49
|
+
fixedHeight,
|
|
50
|
+
summaryContent,
|
|
51
|
+
children
|
|
52
|
+
}), /* @__PURE__ */ jsx(HvWizardActions, {
|
|
53
|
+
loading,
|
|
54
|
+
skippable,
|
|
55
|
+
labels,
|
|
56
|
+
handleClose,
|
|
57
|
+
handleSubmit
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
HvWizard
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=Wizard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wizard.js","sources":["../../../../../../../src/components/Wizard/Wizard.tsx"],"sourcesContent":["import { HvBaseProps } from \"@hitachivantara/uikit-react-core\";\nimport { HvStepNavigationProps } from \"..\";\nimport { HvWizardClasses } from \"./wizardClasses\";\nimport { ModalProps } from \"@mui/material\";\nimport React, { useCallback } from \"react\";\nimport { HvWizardContainer } from \"./WizardContainer/WizardContainer\";\nimport { HvWizardTitle, HvWizardTitleProps } from \"./WizardTitle/WizardTitle\";\nimport { HvWizardContent } from \"./WizardContent/WizardContent\";\nimport { HvWizardActions } from \"./index\";\nimport WizardProvider, {\n HvWizardTabs,\n HvWizardTab,\n} from \"./WizardContext/WizardContext\";\nimport { HvWizardActionsProps } from \"./WizardActions/WizardActions\";\n\nexport interface HvWizardProps extends HvBaseProps {\n /** Current state of the Wizard. */\n open: boolean;\n /** Function executed on close. */\n onClose: ModalProps[\"onClose\"];\n /** Function executed on submit. */\n handleSubmit: (context: HvWizardTabs<HvWizardTab>) => void;\n /** Title for the wizard. */\n title?: string;\n /** An object containing all the labels for the wizard. */\n labels?: HvWizardActionsProps[\"labels\"] & HvWizardTitleProps[\"labels\"];\n /** Shows the summary button. */\n hasSummary?: boolean;\n /** The content of the summary. */\n summaryContent?: React.ReactNode;\n /** Enables the skip button. */\n skippable?: boolean;\n /** Forces minimum height to the component. */\n fixedHeight?: boolean;\n /** Whether the loading animation is shown. */\n loading?: boolean;\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?: HvWizardClasses;\n}\n\nexport const HvWizard = ({\n className,\n children,\n onClose,\n handleSubmit,\n title,\n open,\n skippable = true,\n loading = false,\n hasSummary = false,\n summaryContent,\n labels = {\n cancel: \"Cancel\",\n next: \"Next\",\n previous: \"Previous\",\n skip: \"Skip\",\n submit: \"Submit\",\n summary: \"Summary\",\n },\n fixedHeight = false,\n customStep,\n ...others\n}: HvWizardProps) => {\n const handleClose = useCallback(\n (evt, reason) => {\n if (reason !== \"backdropClick\") {\n onClose?.(evt, reason);\n }\n },\n [onClose]\n );\n\n return (\n <WizardProvider>\n <HvWizardContainer\n className={className}\n handleClose={handleClose}\n open={open}\n {...others}\n >\n <HvWizardTitle\n title={title}\n hasSummary={hasSummary}\n labels={labels}\n customStep={customStep}\n />\n <HvWizardContent\n loading={loading}\n fixedHeight={fixedHeight}\n summaryContent={summaryContent}\n >\n {children}\n </HvWizardContent>\n <HvWizardActions\n loading={loading}\n skippable={skippable}\n labels={labels}\n handleClose={handleClose}\n handleSubmit={handleSubmit}\n />\n </HvWizardContainer>\n </WizardProvider>\n );\n};\n"],"names":["HvWizard","className","children","onClose","handleSubmit","title","open","skippable","loading","hasSummary","summaryContent","labels","cancel","next","previous","skip","submit","summary","fixedHeight","customStep","others","handleClose","useCallback","evt","reason","WizardProvider","HvWizardContainer","_jsx","HvWizardTitle","HvWizardContent","HvWizardActions"],"mappings":";;;;;;;AA0CO,MAAMA,WAAWA,CAAC;AAAA,EACvBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,YAAY;AAAA,EACZC,UAAU;AAAA,EACVC,aAAa;AAAA,EACbC;AAAAA,EACAC,SAAS;AAAA,IACPC,QAAQ;AAAA,IACRC,MAAM;AAAA,IACNC,UAAU;AAAA,IACVC,MAAM;AAAA,IACNC,QAAQ;AAAA,IACRC,SAAS;AAAA,EACX;AAAA,EACAC,cAAc;AAAA,EACdC;AAAAA,EACA,GAAGC;AACU,MAAM;AACnB,QAAMC,cAAcC,YAClB,CAACC,KAAKC,WAAW;AACf,QAAIA,WAAW,iBAAiB;AAC9BrB,yCAAUoB,KAAKC;AAAAA,IACjB;AAAA,EAAA,GAEF,CAACrB,OAAO,CAAC;AAGX,6BACGsB,gBAAc;AAAA,IAAAvB,+BACZwB,mBAAiB;AAAA,MAChBzB;AAAAA,MACAoB;AAAAA,MACAf;AAAAA,MAAW,GACPc;AAAAA,MAAMlB,UAAA,CAEVyB,oBAACC,eAAa;AAAA,QACZvB;AAAAA,QACAI;AAAAA,QACAE;AAAAA,QACAQ;AAAAA,MAAAA,CACA,GACFQ,oBAACE,iBAAe;AAAA,QACdrB;AAAAA,QACAU;AAAAA,QACAR;AAAAA,QAA+BR;AAAAA,MAAAA,CAGf,GAClByB,oBAACG,iBAAe;AAAA,QACdtB;AAAAA,QACAD;AAAAA,QACAI;AAAAA,QACAU;AAAAA,QACAjB;AAAAA,MAAAA,CACA,CAAA;AAAA,IAAA,CAAA;AAAA,EAAA,CAEW;AAErB;"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useContext, useState, useEffect, useCallback } from "react";
|
|
2
|
+
import { ClassNames } from "@emotion/react";
|
|
3
|
+
import { clsx } from "../../../../../../node_modules/clsx/dist/clsx.m.js";
|
|
4
|
+
import { HvDialogActions, HvGrid, HvButton } from "@hitachivantara/uikit-react-core";
|
|
5
|
+
import { Backwards, Forwards } from "@hitachivantara/uikit-react-icons";
|
|
6
|
+
import wizardActionsClasses from "./wizardActionsClasses.js";
|
|
7
|
+
import { styles } from "./WizardActions.styles.js";
|
|
8
|
+
import { HvWizardContext } from "../WizardContext/WizardContext.js";
|
|
9
|
+
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
10
|
+
const HvWizardActions = ({
|
|
11
|
+
classes,
|
|
12
|
+
handleClose,
|
|
13
|
+
handleSubmit,
|
|
14
|
+
loading = false,
|
|
15
|
+
skippable = false,
|
|
16
|
+
labels = {
|
|
17
|
+
cancel: "Cancel",
|
|
18
|
+
next: "Next",
|
|
19
|
+
previous: "Previous",
|
|
20
|
+
skip: "Skip",
|
|
21
|
+
submit: "Submit"
|
|
22
|
+
}
|
|
23
|
+
}) => {
|
|
24
|
+
const {
|
|
25
|
+
context,
|
|
26
|
+
updateContext,
|
|
27
|
+
tab,
|
|
28
|
+
setTab
|
|
29
|
+
} = useContext(HvWizardContext);
|
|
30
|
+
const [pages, setPages] = useState(0);
|
|
31
|
+
const [canSubmit, setCanSubmit] = useState(false);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const contextEntries = Object.entries(context);
|
|
34
|
+
if (contextEntries.length) {
|
|
35
|
+
setPages(contextEntries.length);
|
|
36
|
+
const validWizard = Object.entries(context).every(([, value]) => value == null ? void 0 : value.valid);
|
|
37
|
+
if (validWizard !== canSubmit) {
|
|
38
|
+
setCanSubmit(validWizard);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, [context]);
|
|
42
|
+
const lastPage = pages - 1;
|
|
43
|
+
const isLastPage = tab >= lastPage;
|
|
44
|
+
const handleSkip = useCallback(() => {
|
|
45
|
+
const skippedContext = Object.entries(context).map(([, child]) => ({
|
|
46
|
+
...child,
|
|
47
|
+
valid: (child == null ? void 0 : child.valid) !== false
|
|
48
|
+
}));
|
|
49
|
+
updateContext(skippedContext);
|
|
50
|
+
setTab(lastPage);
|
|
51
|
+
}, [setTab, context, lastPage, updateContext]);
|
|
52
|
+
const handleSubmitInternal = useCallback(() => handleSubmit(context), [handleSubmit, context]);
|
|
53
|
+
const onCloseHander = useCallback((event) => {
|
|
54
|
+
const clearContext = Object.entries(context).map(([, child]) => ({
|
|
55
|
+
...child,
|
|
56
|
+
touched: false
|
|
57
|
+
}));
|
|
58
|
+
updateContext(clearContext);
|
|
59
|
+
setTab(0);
|
|
60
|
+
handleClose == null ? void 0 : handleClose(event);
|
|
61
|
+
}, []);
|
|
62
|
+
return /* @__PURE__ */ jsx(ClassNames, {
|
|
63
|
+
children: ({
|
|
64
|
+
css
|
|
65
|
+
}) => {
|
|
66
|
+
var _a;
|
|
67
|
+
return /* @__PURE__ */ jsxs(HvDialogActions, {
|
|
68
|
+
className: clsx(classes == null ? void 0 : classes.actionsContainer, wizardActionsClasses.actionsContainer, css(styles.actionsContainer)),
|
|
69
|
+
children: [/* @__PURE__ */ jsxs(HvGrid, {
|
|
70
|
+
children: [/* @__PURE__ */ jsx(HvButton, {
|
|
71
|
+
variant: "secondaryGhost",
|
|
72
|
+
onClick: onCloseHander,
|
|
73
|
+
className: clsx(classes == null ? void 0 : classes.buttonWidth, wizardActionsClasses.buttonWidth, css(styles.buttonWidth)),
|
|
74
|
+
children: `${labels.cancel ?? "Cancel"}`
|
|
75
|
+
}), skippable && /* @__PURE__ */ jsx(HvButton, {
|
|
76
|
+
variant: "secondaryGhost",
|
|
77
|
+
disabled: isLastPage,
|
|
78
|
+
className: clsx(classes == null ? void 0 : classes.buttonWidth, wizardActionsClasses.buttonWidth, css(styles.buttonWidth)),
|
|
79
|
+
onClick: handleSkip,
|
|
80
|
+
children: `${labels.skip ?? "Skip"}`
|
|
81
|
+
})]
|
|
82
|
+
}), /* @__PURE__ */ jsxs(HvGrid, {
|
|
83
|
+
className: clsx(classes == null ? void 0 : classes.buttonsContainer, wizardActionsClasses.buttonsContainer, css(styles.buttonsContainer)),
|
|
84
|
+
children: [/* @__PURE__ */ jsx(HvButton, {
|
|
85
|
+
variant: "secondaryGhost",
|
|
86
|
+
className: clsx(classes == null ? void 0 : classes.buttonWidth, wizardActionsClasses.buttonWidth, css(styles.buttonWidth)),
|
|
87
|
+
disabled: tab <= 0,
|
|
88
|
+
onClick: () => setTab((t) => t - 1),
|
|
89
|
+
startIcon: /* @__PURE__ */ jsx(Backwards, {}),
|
|
90
|
+
children: `${labels.previous ?? "Previous"}`
|
|
91
|
+
}), isLastPage ? /* @__PURE__ */ jsx(HvButton, {
|
|
92
|
+
variant: "primary",
|
|
93
|
+
className: clsx(classes == null ? void 0 : classes.buttonWidth, wizardActionsClasses.buttonWidth, css(styles.buttonWidth)),
|
|
94
|
+
disabled: loading || !canSubmit,
|
|
95
|
+
onClick: handleSubmitInternal,
|
|
96
|
+
children: `${labels.submit ?? "Submit"}`
|
|
97
|
+
}) : /* @__PURE__ */ jsx(HvButton, {
|
|
98
|
+
variant: "secondaryGhost",
|
|
99
|
+
className: clsx(classes == null ? void 0 : classes.buttonWidth, wizardActionsClasses.buttonWidth, css(styles.buttonWidth), classes == null ? void 0 : classes.buttonSpacing, wizardActionsClasses.buttonSpacing, css(styles.buttonSpacing)),
|
|
100
|
+
onClick: () => setTab((t) => t + 1),
|
|
101
|
+
disabled: !skippable && !((_a = context == null ? void 0 : context[tab]) == null ? void 0 : _a.valid),
|
|
102
|
+
endIcon: /* @__PURE__ */ jsx(Forwards, {}),
|
|
103
|
+
children: `${labels.next ?? "Next"}`
|
|
104
|
+
})]
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
HvWizardActions
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=WizardActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardActions.js","sources":["../../../../../../../../src/components/Wizard/WizardActions/WizardActions.tsx"],"sourcesContent":["import { useCallback, useContext, useEffect, useState } from \"react\";\nimport { ClassNames } from \"@emotion/react\";\nimport { clsx } from \"clsx\";\nimport {\n HvBaseProps,\n HvButton,\n HvDialogActions,\n HvGrid,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Backwards, Forwards } from \"@hitachivantara/uikit-react-icons\";\nimport wizardActionsClasses, {\n HvWizardActionsClasses,\n} from \"./wizardActionsClasses\";\nimport { styles } from \"./WizardActions.styles\";\nimport { HvWizardContext } from \"../WizardContext/WizardContext\";\n\nexport interface HvWizardActionsProps extends HvBaseProps {\n /** Function to handle the cancel button. */\n handleClose: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /** Function to handle the submit button. Also sends the current context state. */\n handleSubmit: (context: any) => void;\n /** An object containing all the labels for the wizard actions component. */\n labels?: {\n /** Cancel button label. */\n cancel?: string;\n /** Skip button label. */\n skip?: string;\n /** Previous button label. */\n previous?: string;\n /** Next button label. */\n next?: string;\n /** Submit button label. */\n submit?: string;\n };\n /** Whether the submit button is disabled. */\n loading?: boolean;\n /** Enables the skip button. */\n skippable?: boolean;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardActionsClasses;\n}\n\nexport const HvWizardActions = ({\n classes,\n handleClose,\n handleSubmit,\n loading = false,\n skippable = false,\n labels = {\n cancel: \"Cancel\",\n next: \"Next\",\n previous: \"Previous\",\n skip: \"Skip\",\n submit: \"Submit\",\n },\n}: HvWizardActionsProps) => {\n const { context, updateContext, tab, setTab } = useContext(HvWizardContext);\n const [pages, setPages] = useState(0);\n const [canSubmit, setCanSubmit] = useState(false);\n\n useEffect(() => {\n const contextEntries = Object.entries(context);\n if (contextEntries.length) {\n setPages(contextEntries.length);\n\n const validWizard = Object.entries(context).every(\n ([, value]) => value?.valid\n );\n if (validWizard !== canSubmit) {\n setCanSubmit(validWizard);\n }\n }\n }, [context]);\n\n const lastPage = pages - 1;\n const isLastPage = tab >= lastPage;\n\n const handleSkip = useCallback(() => {\n const skippedContext = Object.entries(context).map(([, child]) => ({\n ...child,\n valid: child?.valid !== false,\n }));\n\n updateContext(skippedContext);\n setTab(lastPage);\n }, [setTab, context, lastPage, updateContext]);\n\n const handleSubmitInternal = useCallback(\n () => handleSubmit(context),\n [handleSubmit, context]\n );\n\n const onCloseHander = useCallback((event) => {\n const clearContext = Object.entries(context).map(([, child]) => ({\n ...child,\n touched: false,\n }));\n\n updateContext(clearContext);\n setTab(0);\n handleClose?.(event);\n }, []);\n\n return (\n <ClassNames>\n {({ css }) => (\n <HvDialogActions\n className={clsx(\n classes?.actionsContainer,\n wizardActionsClasses.actionsContainer,\n css(styles.actionsContainer)\n )}\n >\n <HvGrid>\n <HvButton\n variant=\"secondaryGhost\"\n onClick={onCloseHander}\n className={clsx(\n classes?.buttonWidth,\n wizardActionsClasses.buttonWidth,\n css(styles.buttonWidth)\n )}\n >\n {`${labels.cancel ?? \"Cancel\"}`}\n </HvButton>\n {skippable && (\n <HvButton\n variant=\"secondaryGhost\"\n disabled={isLastPage}\n className={clsx(\n classes?.buttonWidth,\n wizardActionsClasses.buttonWidth,\n css(styles.buttonWidth)\n )}\n onClick={handleSkip}\n >\n {`${labels.skip ?? \"Skip\"}`}\n </HvButton>\n )}\n </HvGrid>\n <HvGrid\n className={clsx(\n classes?.buttonsContainer,\n wizardActionsClasses.buttonsContainer,\n css(styles.buttonsContainer)\n )}\n >\n <HvButton\n variant=\"secondaryGhost\"\n className={clsx(\n classes?.buttonWidth,\n wizardActionsClasses.buttonWidth,\n css(styles.buttonWidth)\n )}\n disabled={tab <= 0}\n onClick={() => setTab((t) => t - 1)}\n startIcon={<Backwards />}\n >\n {`${labels.previous ?? \"Previous\"}`}\n </HvButton>\n {isLastPage ? (\n <HvButton\n variant=\"primary\"\n className={clsx(\n classes?.buttonWidth,\n wizardActionsClasses.buttonWidth,\n css(styles.buttonWidth)\n )}\n disabled={loading || !canSubmit}\n onClick={handleSubmitInternal}\n >\n {`${labels.submit ?? \"Submit\"}`}\n </HvButton>\n ) : (\n <HvButton\n variant=\"secondaryGhost\"\n className={clsx(\n classes?.buttonWidth,\n wizardActionsClasses.buttonWidth,\n css(styles.buttonWidth),\n classes?.buttonSpacing,\n wizardActionsClasses.buttonSpacing,\n css(styles.buttonSpacing)\n )}\n onClick={() => setTab((t) => t + 1)}\n disabled={!skippable && !context?.[tab]?.valid}\n endIcon={<Forwards />}\n >\n {`${labels.next ?? \"Next\"}`}\n </HvButton>\n )}\n </HvGrid>\n </HvDialogActions>\n )}\n </ClassNames>\n );\n};\n"],"names":["HvWizardActions","classes","handleClose","handleSubmit","loading","skippable","labels","cancel","next","previous","skip","submit","context","updateContext","tab","setTab","useContext","HvWizardContext","pages","setPages","useState","canSubmit","setCanSubmit","useEffect","contextEntries","Object","entries","length","validWizard","every","value","valid","lastPage","isLastPage","handleSkip","useCallback","skippedContext","map","child","handleSubmitInternal","onCloseHander","event","clearContext","touched","ClassNames","children","css","HvDialogActions","className","clsx","actionsContainer","wizardActionsClasses","styles","_jsxs","HvGrid","_jsx","HvButton","variant","onClick","buttonWidth","disabled","buttonsContainer","t","startIcon","Backwards","buttonSpacing","endIcon","Forwards"],"mappings":";;;;;;;;;AA6CO,MAAMA,kBAAkBA,CAAC;AAAA,EAC9BC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,UAAU;AAAA,EACVC,YAAY;AAAA,EACZC,SAAS;AAAA,IACPC,QAAQ;AAAA,IACRC,MAAM;AAAA,IACNC,UAAU;AAAA,IACVC,MAAM;AAAA,IACNC,QAAQ;AAAA,EACV;AACoB,MAAM;AACpB,QAAA;AAAA,IAAEC;AAAAA,IAASC;AAAAA,IAAeC;AAAAA,IAAKC;AAAAA,EAAAA,IAAWC,WAAWC,eAAe;AAC1E,QAAM,CAACC,OAAOC,QAAQ,IAAIC,SAAS,CAAC;AACpC,QAAM,CAACC,WAAWC,YAAY,IAAIF,SAAS,KAAK;AAEhDG,YAAU,MAAM;AACRC,UAAAA,iBAAiBC,OAAOC,QAAQd,OAAO;AAC7C,QAAIY,eAAeG,QAA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AS0D,aACTR,qBAAqBQ,aACrBb,IAAIM,OAAOO,WAAW,GACtB1D,mCAASgE,eACTd,qBAAqBc,eACrBnB,IAAIM,OAAOa,aAAa,CAAC;AAAA,YAE3BP,SAASA,MAAM3C,OAAQ+C,CAAAA,MAAMA,IAAI,CAAC;AAAA,YAClCF,UAAU,CAACvD,aAAa,GAACO,wCAAUE,SAAVF,mBAAgBmB;AAAAA,YACzCmC,SAASX,oBAACY,UAAY,EAAA;AAAA,YAAAtB,UAEpB,GAAEvC,OAAOE,QAAQ;AAAA,UAAA,CAEtB,CAAA;AAAA,QAAA,CACM,CAAA;AAAA,MAAA,CAAA;AAAA;AAAA,EAAA,CAGF;AAEjB;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { theme } from "@hitachivantara/uikit-react-core";
|
|
2
|
+
const styles = {
|
|
3
|
+
buttonWidth: {
|
|
4
|
+
width: 120,
|
|
5
|
+
"& span": {
|
|
6
|
+
whiteSpace: "normal",
|
|
7
|
+
lineHeight: theme.lineHeights.sm
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
actionsContainer: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
justifyContent: "space-between"
|
|
13
|
+
},
|
|
14
|
+
buttonsContainer: {
|
|
15
|
+
display: "flex",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
"& > button:last-child": {
|
|
18
|
+
marginLeft: 20
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
buttonSpacing: {
|
|
22
|
+
paddingLeft: 28
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
styles
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=WizardActions.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardActions.styles.js","sources":["../../../../../../../../src/components/Wizard/WizardActions/WizardActions.styles.tsx"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-react-core\";\n\nexport const styles: { [key: string]: CSSInterpolation } = {\n buttonWidth: {\n width: 120,\n \"& span\": {\n whiteSpace: \"normal\",\n lineHeight: theme.lineHeights.sm,\n },\n },\n actionsContainer: {\n display: \"flex\",\n justifyContent: \"space-between\",\n },\n buttonsContainer: {\n display: \"flex\",\n alignItems: \"center\",\n \"& > button:last-child\": {\n marginLeft: 20,\n },\n },\n buttonSpacing: {\n paddingLeft: 28,\n },\n};\n"],"names":["styles","buttonWidth","width","whiteSpace","lineHeight","theme","lineHeights","sm","actionsContainer","display","justifyContent","buttonsContainer","alignItems","marginLeft","buttonSpacing","paddingLeft"],"mappings":";AAGO,MAAMA,SAA8C;AAAA,EACzDC,aAAa;AAAA,IACXC,OAAO;AAAA,IACP,UAAU;AAAA,MACRC,YAAY;AAAA,MACZC,YAAYC,MAAMC,YAAYC;AAAAA,IAChC;AAAA,EACF;AAAA,EACAC,kBAAkB;AAAA,IAChBC,SAAS;AAAA,IACTC,gBAAgB;AAAA,EAClB;AAAA,EACAC,kBAAkB;AAAA,IAChBF,SAAS;AAAA,IACTG,YAAY;AAAA,IACZ,yBAAyB;AAAA,MACvBC,YAAY;AAAA,IACd;AAAA,EACF;AAAA,EACAC,eAAe;AAAA,IACbC,aAAa;AAAA,EACf;AACF;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getClasses } from "@hitachivantara/uikit-react-core";
|
|
2
|
+
const classKeys = ["actionsContainer", "buttonsContainer", "buttonWidth", "buttonSpacing"];
|
|
3
|
+
const wizardActionsClasses = getClasses(classKeys, "HvWizardActions");
|
|
4
|
+
const wizardActionsClasses$1 = wizardActionsClasses;
|
|
5
|
+
export {
|
|
6
|
+
wizardActionsClasses$1 as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=wizardActionsClasses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizardActionsClasses.js","sources":["../../../../../../../../src/components/Wizard/WizardActions/wizardActionsClasses.ts"],"sourcesContent":["import { getClasses } from \"@hitachivantara/uikit-react-core\";\n\nexport type HvWizardActionsClasses = {\n /** Styles applied to the component which contains the groups of buttons. */\n actionsContainer?: string;\n /** Styles applied to the component which contains the buttons. */\n buttonsContainer?: string;\n /** Styles applied to the Button component to override its width. */\n buttonWidth?: string;\n /** Styles applied to some Button components to override its left padding. */\n buttonSpacing?: string;\n};\n\nconst classKeys: string[] = [\n \"actionsContainer\",\n \"buttonsContainer\",\n \"buttonWidth\",\n \"buttonSpacing\",\n];\n\nconst wizardActionsClasses = getClasses<HvWizardActionsClasses>(\n classKeys,\n \"HvWizardActions\"\n);\n\nexport default wizardActionsClasses;\n"],"names":["classKeys","wizardActionsClasses","getClasses"],"mappings":";AAaA,MAAMA,YAAsB,CAC1B,oBACA,oBACA,eACA,eAAe;AAGjB,MAAMC,uBAAuBC,WAC3BF,WACA,iBAAiB;AAGnB,MAAA,yBAAeC;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ClassNames } from "@emotion/react";
|
|
2
|
+
import { HvDialog } from "@hitachivantara/uikit-react-core";
|
|
3
|
+
import { clsx } from "../../../../../../node_modules/clsx/dist/clsx.m.js";
|
|
4
|
+
import wizardContainerClasses from "./wizardContainerClasses.js";
|
|
5
|
+
import { styles } from "./WizardContainer.styles.js";
|
|
6
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
7
|
+
const HvWizardContainer = ({
|
|
8
|
+
classes,
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
handleClose,
|
|
12
|
+
open,
|
|
13
|
+
...others
|
|
14
|
+
}) => {
|
|
15
|
+
return /* @__PURE__ */ jsx(ClassNames, {
|
|
16
|
+
children: ({
|
|
17
|
+
css
|
|
18
|
+
}) => /* @__PURE__ */ jsx(HvDialog, {
|
|
19
|
+
classes: {
|
|
20
|
+
closeButton: clsx(classes == null ? void 0 : classes.closeButton, wizardContainerClasses.closeButton, css(styles.closeButton)),
|
|
21
|
+
paper: clsx(classes == null ? void 0 : classes.paper, wizardContainerClasses.paper, css(styles.paper))
|
|
22
|
+
},
|
|
23
|
+
className: clsx(className, classes == null ? void 0 : classes.root, wizardContainerClasses.root),
|
|
24
|
+
open,
|
|
25
|
+
onClose: handleClose,
|
|
26
|
+
...others,
|
|
27
|
+
children
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
HvWizardContainer
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=WizardContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardContainer.js","sources":["../../../../../../../../src/components/Wizard/WizardContainer/WizardContainer.tsx"],"sourcesContent":["import { ClassNames } from \"@emotion/react\";\nimport { HvBaseProps, HvDialog } from \"@hitachivantara/uikit-react-core\";\nimport { clsx } from \"clsx\";\nimport wizardContainerClasses, {\n HvWizardContainerClasses,\n} from \"./wizardContainerClasses\";\nimport { styles } from \"./WizardContainer.styles\";\nimport React from \"react\";\n\nexport interface HvWizardContainerProps extends Omit<HvBaseProps, \"onClose\"> {\n /** Current state of the Wizard. */\n open: boolean;\n /** Function executed on close. */\n handleClose: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /** A Jss Object used to override or extend the styles applied to the empty state Wizard. */\n classes?: HvWizardContainerClasses;\n}\n\nexport const HvWizardContainer = ({\n classes,\n className,\n children,\n handleClose,\n open,\n ...others\n}: HvWizardContainerProps) => {\n return (\n <ClassNames>\n {({ css }) => (\n <HvDialog\n classes={{\n closeButton: clsx(\n classes?.closeButton,\n wizardContainerClasses.closeButton,\n css(styles.closeButton)\n ),\n paper: clsx(\n classes?.paper,\n wizardContainerClasses.paper,\n css(styles.paper)\n ),\n }}\n className={clsx(\n className,\n classes?.root,\n wizardContainerClasses.root\n )}\n open={open}\n onClose={handleClose}\n {...others}\n >\n {children}\n </HvDialog>\n )}\n </ClassNames>\n );\n};\n"],"names":["HvWizardContainer","classes","className","children","handleClose","open","others","ClassNames","css","HvDialog","closeButton","clsx","wizardContainerClasses","styles","paper","root","onClose"],"mappings":";;;;;;AAqBO,MAAMA,oBAAoBA,CAAC;AAAA,EAChCC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACA,GAAGC;AACmB,MAAM;AAC5B,6BACGC,YAAU;AAAA,IAAAJ,UACRA,CAAC;AAAA,MAAEK;AAAAA,IAAAA,0BACDC,UAAQ;AAAA,MACPR,SAAS;AAAA,QACPS,aAAaC,KACXV,mCAASS,aACTE,uBAAuBF,aACvBF,IAAIK,OAAOH,WAAW,CAAC;AAAA,QAEzBI,OAAOH,KACLV,mCAASa,OACTF,uBAAuBE,OACvBN,IAAIK,OAAOC,KAAK,CAAC;AAAA,MAErB;AAAA,MACAZ,WAAWS,KACTT,WACAD,mCAASc,MACTH,uBAAuBG,IAAI;AAAA,MAE7BV;AAAAA,MACAW,SAASZ;AAAAA,MAAY,GACjBE;AAAAA,MAAMH;AAAAA,IAAAA,CAED;AAAA,EAAA,CAGF;AAEjB;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { theme } from "@hitachivantara/uikit-react-core";
|
|
2
|
+
const styles = {
|
|
3
|
+
paper: {
|
|
4
|
+
width: "80%",
|
|
5
|
+
maxWidth: "80%",
|
|
6
|
+
maxHeight: `calc(100% - (2 * ${theme.dialog.margin}))`
|
|
7
|
+
},
|
|
8
|
+
closeButton: {
|
|
9
|
+
display: "none"
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
styles
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=WizardContainer.styles.js.map
|
package/dist/esm/packages/lab/src/components/Wizard/WizardContainer/WizardContainer.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardContainer.styles.js","sources":["../../../../../../../../src/components/Wizard/WizardContainer/WizardContainer.styles.tsx"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-react-core\";\n\nexport const styles: { [key: string]: CSSInterpolation } = {\n paper: {\n width: \"80%\",\n maxWidth: \"80%\",\n maxHeight: `calc(100% - (2 * ${theme.dialog.margin}))`,\n },\n closeButton: {\n display: \"none\",\n },\n};\n"],"names":["styles","paper","width","maxWidth","maxHeight","theme","dialog","margin","closeButton","display"],"mappings":";AAGO,MAAMA,SAA8C;AAAA,EACzDC,OAAO;AAAA,IACLC,OAAO;AAAA,IACPC,UAAU;AAAA,IACVC,WAAY,oBAAmBC,MAAMC,OAAOC;AAAAA,EAC9C;AAAA,EACAC,aAAa;AAAA,IACXC,SAAS;AAAA,EACX;AACF;"}
|