@coveord/plasma-mantine 48.18.1 → 48.22.3
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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +7 -7
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/modal-wizard/ModalWizard.js +66 -37
- package/dist/cjs/components/modal-wizard/ModalWizard.js.map +1 -1
- package/dist/cjs/components/modal-wizard/ModalWizardStep.js +1 -4
- package/dist/cjs/components/modal-wizard/ModalWizardStep.js.map +1 -1
- package/dist/cjs/components/sticky-footer/StickyFooter.js +2 -1
- package/dist/cjs/components/sticky-footer/StickyFooter.js.map +1 -1
- package/dist/cjs/components/table/TableFilter.js +16 -5
- package/dist/cjs/components/table/TableFilter.js.map +1 -1
- package/dist/definitions/components/modal-wizard/ModalWizard.d.ts +8 -2
- package/dist/definitions/components/modal-wizard/ModalWizard.d.ts.map +1 -1
- package/dist/definitions/components/modal-wizard/ModalWizardStep.d.ts +1 -0
- package/dist/definitions/components/modal-wizard/ModalWizardStep.d.ts.map +1 -1
- package/dist/definitions/components/table/TableFilter.d.ts +8 -1
- package/dist/definitions/components/table/TableFilter.d.ts.map +1 -1
- package/dist/esm/components/modal-wizard/ModalWizard.js +67 -38
- package/dist/esm/components/modal-wizard/ModalWizard.js.map +1 -1
- package/dist/esm/components/modal-wizard/ModalWizardStep.js +1 -4
- package/dist/esm/components/modal-wizard/ModalWizardStep.js.map +1 -1
- package/dist/esm/components/sticky-footer/StickyFooter.js +2 -1
- package/dist/esm/components/sticky-footer/StickyFooter.js.map +1 -1
- package/dist/esm/components/table/TableFilter.js +16 -5
- package/dist/esm/components/table/TableFilter.js.map +1 -1
- package/package.json +1 -1
- package/src/components/modal-wizard/ModalWizard.tsx +68 -37
- package/src/components/modal-wizard/ModalWizardStep.tsx +2 -3
- package/src/components/sticky-footer/StickyFooter.tsx +1 -1
- package/src/components/table/TableFilter.tsx +12 -4
|
@@ -18,8 +18,21 @@ var _react = require("react");
|
|
|
18
18
|
var _stickyFooter = require("../sticky-footer");
|
|
19
19
|
var _modalWizardStep = require("./ModalWizardStep");
|
|
20
20
|
var _header = require("../header");
|
|
21
|
+
var useStyles = (0, _core.createStyles)(function() {
|
|
22
|
+
return {
|
|
23
|
+
modal: {
|
|
24
|
+
display: "flex",
|
|
25
|
+
flexDirection: "column"
|
|
26
|
+
},
|
|
27
|
+
body: {
|
|
28
|
+
flex: 1,
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: "column"
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
});
|
|
21
34
|
var ModalWizard = function(_param) {
|
|
22
|
-
var _param_cancelButtonLabel = _param.cancelButtonLabel, cancelButtonLabel = _param_cancelButtonLabel === void 0 ? "Cancel" : _param_cancelButtonLabel, _param_nextButtonLabel = _param.nextButtonLabel, nextButtonLabel = _param_nextButtonLabel === void 0 ? "Next" : _param_nextButtonLabel, _param_previousButtonLabel = _param.previousButtonLabel, previousButtonLabel = _param_previousButtonLabel === void 0 ? "Previous" : _param_previousButtonLabel, _param_finishButtonLabel = _param.finishButtonLabel, finishButtonLabel = _param_finishButtonLabel === void 0 ? "Finish" : _param_finishButtonLabel, opened = _param.opened, onNext = _param.onNext, onPrevious = _param.onPrevious, onClose = _param.onClose, onFinish = _param.onFinish, isDirty = _param.isDirty, handleDirtyState = _param.handleDirtyState, classNames = _param.classNames, children = _param.children, modalProps = _objectWithoutProperties(_param, [
|
|
35
|
+
var _param_cancelButtonLabel = _param.cancelButtonLabel, cancelButtonLabel = _param_cancelButtonLabel === void 0 ? "Cancel" : _param_cancelButtonLabel, _param_nextButtonLabel = _param.nextButtonLabel, nextButtonLabel = _param_nextButtonLabel === void 0 ? "Next" : _param_nextButtonLabel, _param_previousButtonLabel = _param.previousButtonLabel, previousButtonLabel = _param_previousButtonLabel === void 0 ? "Previous" : _param_previousButtonLabel, _param_finishButtonLabel = _param.finishButtonLabel, finishButtonLabel = _param_finishButtonLabel === void 0 ? "Finish" : _param_finishButtonLabel, opened = _param.opened, onNext = _param.onNext, onPrevious = _param.onPrevious, onClose = _param.onClose, onFinish = _param.onFinish, isDirty = _param.isDirty, handleDirtyState = _param.handleDirtyState, classNames = _param.classNames, className = _param.className, styles = _param.styles, unstyled = _param.unstyled, children = _param.children, modalProps = _objectWithoutProperties(_param, [
|
|
23
36
|
"cancelButtonLabel",
|
|
24
37
|
"nextButtonLabel",
|
|
25
38
|
"previousButtonLabel",
|
|
@@ -32,9 +45,18 @@ var ModalWizard = function(_param) {
|
|
|
32
45
|
"isDirty",
|
|
33
46
|
"handleDirtyState",
|
|
34
47
|
"classNames",
|
|
48
|
+
"className",
|
|
49
|
+
"styles",
|
|
50
|
+
"unstyled",
|
|
35
51
|
"children"
|
|
36
52
|
]);
|
|
37
53
|
var _currentStep_props, _currentStep_props_validateStep;
|
|
54
|
+
var _useStyles = useStyles(null, {
|
|
55
|
+
name: "ModalWizard",
|
|
56
|
+
classNames: classNames,
|
|
57
|
+
styles: styles,
|
|
58
|
+
unstyled: unstyled
|
|
59
|
+
}), _useStyles_classes = _useStyles.classes, modal = _useStyles_classes.modal, body = _useStyles_classes.body, cx = _useStyles.cx;
|
|
38
60
|
var _useState = _slicedToArray((0, _react.useState)(0), 2), currentStepIndex = _useState[0], setCurrentStepIndex = _useState[1];
|
|
39
61
|
var modalSteps = _react.Children.toArray(children).filter(function(child) {
|
|
40
62
|
return child.type === _modalWizardStep.ModalWizardStep;
|
|
@@ -73,7 +95,10 @@ var ModalWizard = function(_param) {
|
|
|
73
95
|
]);
|
|
74
96
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_core.Modal, _objectSpreadProps(_objectSpread({
|
|
75
97
|
opened: opened,
|
|
76
|
-
classNames:
|
|
98
|
+
classNames: {
|
|
99
|
+
modal: cx(modal, classNames === null || classNames === void 0 ? void 0 : classNames.modal),
|
|
100
|
+
body: cx(body, classNames === null || classNames === void 0 ? void 0 : classNames.body)
|
|
101
|
+
},
|
|
77
102
|
centered: true,
|
|
78
103
|
title: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_header.Header, {
|
|
79
104
|
docLink: currentStep.props.docLink,
|
|
@@ -91,41 +116,45 @@ var ModalWizard = function(_param) {
|
|
|
91
116
|
value: getProgressMemo
|
|
92
117
|
}),
|
|
93
118
|
currentStep,
|
|
94
|
-
/*#__PURE__*/ (0, _jsxRuntime.
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Box, {
|
|
120
|
+
sx: function(theme) {
|
|
121
|
+
return {
|
|
122
|
+
marginTop: "auto"
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_stickyFooter.StickyFooter, {
|
|
126
|
+
px: 0,
|
|
127
|
+
pt: "sm",
|
|
128
|
+
pb: 0,
|
|
129
|
+
borderTop: true,
|
|
130
|
+
children: [
|
|
131
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Button, {
|
|
132
|
+
name: isFirstStep ? cancelButtonLabel : previousButtonLabel,
|
|
133
|
+
variant: "outline",
|
|
134
|
+
onClick: function() {
|
|
135
|
+
if (isFirstStep) {
|
|
136
|
+
closeModalWizard();
|
|
137
|
+
} else {
|
|
138
|
+
onPrevious === null || onPrevious === void 0 ? void 0 : onPrevious();
|
|
139
|
+
setCurrentStepIndex(currentStepIndex - 1);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
children: isFirstStep ? cancelButtonLabel : previousButtonLabel
|
|
143
|
+
}),
|
|
144
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Button, {
|
|
145
|
+
disabled: !isValid,
|
|
146
|
+
onClick: function() {
|
|
147
|
+
if (isLastStep) {
|
|
148
|
+
onFinish ? onFinish() : onClose();
|
|
149
|
+
} else {
|
|
150
|
+
onNext === null || onNext === void 0 ? void 0 : onNext();
|
|
151
|
+
setCurrentStepIndex(currentStepIndex + 1);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
children: isLastStep ? finishButtonLabel : nextButtonLabel
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
})
|
|
129
158
|
})
|
|
130
159
|
]
|
|
131
160
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Button, Modal, ModalProps, Progress} from '@mantine/core';\nimport {Children, ReactElement, useMemo, useState} from 'react';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep} from './ModalWizardStep';\nimport {Header} from '../header';\n\ninterface ModalWizardProps extends Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: () => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: () => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n children,\n ...modalProps\n}) => {\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const numberOfStepsCountAsProgress = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n const isModalDirty = isDirty && isDirty();\n\n const closeModalWizard = () => {\n if (isModalDirty && handleDirtyState) {\n handleDirtyState() && onClose?.();\n } else {\n onClose?.();\n }\n };\n\n const getProgress = (currStepIndex: number) => {\n const validSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (validSteps / numberOfStepsCountAsProgress) * 100;\n };\n\n const getProgressMemo = useMemo(() => getProgress(currentStepIndex), [currentStepIndex]);\n\n return (\n <Modal\n opened={opened}\n classNames={classNames}\n centered\n title={\n <Header\n docLink={currentStep.props.docLink}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={0}\n px={0}\n >\n {typeof currentStep.props.title === 'function'\n ? currentStep.props.title(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.title}\n </Header>\n }\n onClose={closeModalWizard}\n {...modalProps}\n >\n {currentStep.props.showProgressBar && <Progress color=\"teal\" size=\"lg\" value={getProgressMemo} />}\n {currentStep}\n <StickyFooter py={0} px={0} pt=\"sm\" borderTop>\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n disabled={false}\n size=\"sm\"\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n closeModalWizard();\n } else {\n onPrevious?.();\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n size=\"sm\"\n onClick={() => {\n if (isLastStep) {\n onFinish ? onFinish() : onClose();\n } else {\n onNext?.();\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["ModalWizard","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","children","modalProps","currentStep","useState","currentStepIndex","setCurrentStepIndex","modalSteps","Children","toArray","filter","child","type","ModalWizardStep","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","useMemo","Modal","centered","title","Header","docLink","description","py","px","showProgressBar","Progress","color","size","value","StickyFooter","pt","borderTop","Button","name","disabled","variant","onClick","Step"],"mappings":"AAAA;;;;+BA0EaA;;;eAAAA;;;;;;;;oBA1EqC;qBACM;4BAC7B;+BACG;sBACT;AAsEd,IAAMA,cAA+B,iBAetC;0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A;gCACAW,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECe,cAAc/B,oBAAoBE,mBAAmB;;kCAG1D,qBAACyD,YAAM;wBACHE,UAAU,CAAC3B;wBACXoB,MAAK;wBACLS,SAAS,WAAM;4BACX,IAAI/B,YAAY;gCACZxB,WAAWA,aAAaD,SAAS;4BACrC,OAAO;gCACHF,mBAAAA,oBAAAA,KAAAA,IAAAA;gCACAY,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECgB,aAAa7B,oBAAoBF,eAAe;;;;;;AAKrE;AAEAF,YAAYiE,IAAI,GAAGxC,gCAAe"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Box, Button, createStyles, DefaultProps, Modal, ModalProps, Progress, Selectors} from '@mantine/core';\nimport {Children, ReactElement, useMemo, useState} from 'react';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep} from './ModalWizardStep';\nimport {Header} from '../header';\n\nconst useStyles = createStyles(() => ({\n modal: {\n display: 'flex',\n flexDirection: 'column',\n },\n body: {\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n },\n}));\n\ntype ModalWizardStylesNames = Selectors<typeof useStyles>;\n\ninterface ModalWizardProps\n extends Omit<DefaultProps<ModalWizardStylesNames>, 'classNames' | 'styles'>,\n Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: () => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: () => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n className,\n styles,\n unstyled,\n children,\n ...modalProps\n}) => {\n const {\n classes: {modal, body},\n cx,\n } = useStyles(null, {\n name: 'ModalWizard',\n classNames,\n styles,\n unstyled,\n });\n\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const numberOfStepsCountAsProgress = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n const isModalDirty = isDirty && isDirty();\n\n const closeModalWizard = () => {\n if (isModalDirty && handleDirtyState) {\n handleDirtyState() && onClose?.();\n } else {\n onClose?.();\n }\n };\n\n const getProgress = (currStepIndex: number) => {\n const validSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (validSteps / numberOfStepsCountAsProgress) * 100;\n };\n\n const getProgressMemo = useMemo(() => getProgress(currentStepIndex), [currentStepIndex]);\n return (\n <Modal\n opened={opened}\n classNames={{modal: cx(modal, classNames?.modal), body: cx(body, classNames?.body)}}\n centered\n title={\n <Header\n docLink={currentStep.props.docLink}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={0}\n px={0}\n >\n {typeof currentStep.props.title === 'function'\n ? currentStep.props.title(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.title}\n </Header>\n }\n onClose={closeModalWizard}\n {...modalProps}\n >\n {currentStep.props.showProgressBar && <Progress color=\"teal\" size=\"lg\" value={getProgressMemo} />}\n {currentStep}\n <Box\n sx={(theme) => ({\n marginTop: 'auto',\n })}\n >\n <StickyFooter px={0} pt=\"sm\" pb={0} borderTop>\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n closeModalWizard();\n } else {\n onPrevious?.();\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n onClick={() => {\n if (isLastStep) {\n onFinish ? onFinish() : onClose();\n } else {\n onNext?.();\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Box>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["ModalWizard","useStyles","createStyles","modal","display","flexDirection","body","flex","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","className","styles","unstyled","children","modalProps","currentStep","name","classes","cx","useState","currentStepIndex","setCurrentStepIndex","modalSteps","Children","toArray","filter","child","type","ModalWizardStep","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","useMemo","Modal","centered","title","Header","docLink","description","py","px","showProgressBar","Progress","color","size","value","Box","sx","theme","marginTop","StickyFooter","pt","pb","borderTop","Button","variant","onClick","disabled","Step"],"mappings":"AAAA;;;;+BA0FaA;;;eAAAA;;;;;;;;oBA1FiF;qBACtC;4BAC7B;+BACG;sBACT;AAErB,IAAMC,YAAYC,IAAAA,kBAAY,EAAC;WAAO;QAClCC,OAAO;YACHC,SAAS;YACTC,eAAe;QACnB;QACAC,MAAM;YACFC,MAAM;YACNH,SAAS;YACTC,eAAe;QACnB;IACJ;;AA0EO,IAAML,cAA+B,iBAkBtC;0CAjBFQ,mBAAAA,0DAAoB,qEACpBC,iBAAAA,sDAAkB,qEAClBC,qBAAAA,8DAAsB,2EACtBC,mBAAAA,0DAAoB,qCACpBC,gBAAAA,QACAC,gBAAAA,QACAC,oBAAAA,YACAC,iBAAAA,SACAC,kBAAAA,UACAC,iBAAAA,SACAC,0BAAAA,kBACAC,oBAAAA,YACAC,mBAAAA,WACAC,gBAAAA,QACAC,kBAAAA,UACAC,kBAAAA,UACGC;QAhBHhB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;;QAsBkBE;IAnBlB,IAGIxB,aAAAA,UAAU,IAAI,EAAE;QAChByB,MAAM;QACNP,YAAAA;QACAE,QAAAA;QACAC,UAAAA;IACJ,yBALIrB,WAFA0B,SAAUxB,2BAAAA,OAAOG,0BAAAA,MACjBsB,KACA3B,WADA2B;IAQJ,IAAgDC,2BAAAA,IAAAA,eAAQ,EAAC,QAAlDC,mBAAyCD,cAAvBE,sBAAuBF;IAChD,IAAMG,aAAa,AAACC,eAAQ,CAACC,OAAO,CAACX,UAA6BY,MAAM,CAAC,SAACC;eAAUA,MAAMC,IAAI,KAAKC,gCAAe;;IAElH,IAAMC,gBAAgBP,WAAWQ,MAAM;IACvC,IAAMC,+BAA+BT,WAAWG,MAAM,C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|
@@ -8,12 +8,9 @@ Object.defineProperty(exports, "ModalWizardStep", {
|
|
|
8
8
|
return ModalWizardStep;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
11
|
var ModalWizardStep = function(param) {
|
|
13
12
|
var children = param.children;
|
|
14
|
-
return
|
|
15
|
-
children: children
|
|
16
|
-
});
|
|
13
|
+
return children;
|
|
17
14
|
};
|
|
18
15
|
ModalWizardStep.defaultProps = {
|
|
19
16
|
showProgressBar: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizardStep.tsx"],"sourcesContent":["import {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\ntype DependsOnStep<T> = (currentStep: number, numberOfSteps: number) => T;\n\nexport interface ModalWizardStepProps {\n /**\n * The title of the current step. The title can be dependent on the current step if needed\n */\n title?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * The description of the current step. The description can be dependent on the current step if needed\n */\n description?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * A link to the documentation for the current step\n */\n docLink: string;\n\n /**\n * A tooltip label for the docLink\n */\n docLinkTooltipLabel?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * A function to validate the current step, it determines if the next step should be enabled or not.\n */\n validateStep: (currentStep: any, numberOfSteps: any) => {isValid: boolean; messsage?: unknown};\n\n /**\n * Show progress bar at this step\n *\n * @default true\n */\n showProgressBar?: boolean;\n\n /**\n * Does completion of current step count moves the progress bar\n *\n * @default true\n */\n countsAsProgress?: boolean;\n}\n\nconst ModalWizardStep: FunctionComponent<PropsWithChildren<ModalWizardStepProps>> = ({children}) =>
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizardStep.tsx"],"sourcesContent":["import {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\ntype DependsOnStep<T> = (currentStep: number, numberOfSteps: number) => T;\n\nexport interface ModalWizardStepProps {\n /**\n * The title of the current step. The title can be dependent on the current step if needed\n */\n title?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * The description of the current step. The description can be dependent on the current step if needed\n */\n description?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * A link to the documentation for the current step\n */\n docLink: string;\n\n /**\n * A tooltip label for the docLink\n */\n docLinkTooltipLabel?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * A function to validate the current step, it determines if the next step should be enabled or not.\n */\n validateStep: (currentStep: any, numberOfSteps: any) => {isValid: boolean; messsage?: unknown};\n\n /**\n * Show progress bar at this step\n *\n * @default true\n */\n showProgressBar?: boolean;\n\n /**\n * Does completion of current step count moves the progress bar\n *\n * @default true\n */\n countsAsProgress?: boolean;\n children: ReactElement<any, any>;\n}\n\nconst ModalWizardStep: FunctionComponent<PropsWithChildren<ModalWizardStepProps>> = ({children}) => children;\n\nModalWizardStep.defaultProps = {\n showProgressBar: true,\n countsAsProgress: true,\n};\n\nexport {ModalWizardStep};\n"],"names":["ModalWizardStep","children","defaultProps","showProgressBar","countsAsProgress"],"mappings":"AAAA;;;;+BAqDQA;;;eAAAA;;;AAPR,IAAMA,kBAA8E;QAAEC,iBAAAA;WAAcA;;AAEpGD,gBAAgBE,YAAY,GAAG;IAC3BC,iBAAiB,IAAI;IACrBC,kBAAkB,IAAI;AAC1B"}
|
|
@@ -39,7 +39,8 @@ var StickyFooter = function(_param) {
|
|
|
39
39
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Group, _objectSpreadProps(_objectSpread({
|
|
40
40
|
position: "right",
|
|
41
41
|
spacing: "xs",
|
|
42
|
-
|
|
42
|
+
pt: "md",
|
|
43
|
+
pb: "md",
|
|
43
44
|
px: "xl"
|
|
44
45
|
}, others), {
|
|
45
46
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"sourcesContent":["import {Box, createStyles, DefaultProps, Divider, Group} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nexport interface StickyFooterProps extends DefaultProps {\n /**\n * Whether a border is render on top of the footer\n */\n borderTop?: boolean;\n}\n\nconst useStyles = createStyles(() => ({\n footer: {\n position: 'sticky',\n bottom: 0,\n zIndex: 1,\n backgroundColor: 'white',\n },\n}));\n\nexport const StickyFooter: FunctionComponent<PropsWithChildren<StickyFooterProps>> = ({\n borderTop,\n children,\n ...others\n}) => {\n const {classes} = useStyles();\n\n return (\n <>\n {borderTop ? <Divider size=\"xs\" /> : null}\n <Box className={classes.footer}>\n <Group position=\"right\" spacing=\"xs\"
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"sourcesContent":["import {Box, createStyles, DefaultProps, Divider, Group} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nexport interface StickyFooterProps extends DefaultProps {\n /**\n * Whether a border is render on top of the footer\n */\n borderTop?: boolean;\n}\n\nconst useStyles = createStyles(() => ({\n footer: {\n position: 'sticky',\n bottom: 0,\n zIndex: 1,\n backgroundColor: 'white',\n },\n}));\n\nexport const StickyFooter: FunctionComponent<PropsWithChildren<StickyFooterProps>> = ({\n borderTop,\n children,\n ...others\n}) => {\n const {classes} = useStyles();\n\n return (\n <>\n {borderTop ? <Divider size=\"xs\" /> : null}\n <Box className={classes.footer}>\n <Group position=\"right\" spacing=\"xs\" pt=\"md\" pb=\"md\" px=\"xl\" {...others}>\n {children}\n </Group>\n </Box>\n </>\n );\n};\n"],"names":["StickyFooter","useStyles","createStyles","footer","position","bottom","zIndex","backgroundColor","borderTop","children","others","classes","Divider","size","Box","className","Group","spacing","pt","pb","px"],"mappings":"AAAA;;;;+BAmBaA;;;eAAAA;;;;;;;oBAnBiD;AAU9D,IAAMC,YAAYC,IAAAA,kBAAY,EAAC;WAAO;QAClCC,QAAQ;YACJC,UAAU;YACVC,QAAQ;YACRC,QAAQ;YACRC,iBAAiB;QACrB;IACJ;;AAEO,IAAMP,eAAwE,iBAI/E;QAHFQ,mBAAAA,WACAC,kBAAAA,UACGC;QAFHF;QACAC;;IAGA,IAAM,AAACE,UAAWV,YAAXU;IAEP,qBACI;;YACKH,0BAAY,qBAACI,aAAO;gBAACC,MAAK;iBAAU,IAAI;0BACzC,qBAACC,SAAG;gBAACC,WAAWJ,QAAQR,MAAM;0BAC1B,cAAA,qBAACa,WAAK;oBAACZ,UAAS;oBAAQa,SAAQ;oBAAKC,IAAG;oBAAKC,IAAG;oBAAKC,IAAG;mBAASV;8BAC5DD;;;;;AAKrB"}
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "TableFilter", {
|
|
|
11
11
|
var _defineProperty = require("@swc/helpers/lib/_define_property.js").default;
|
|
12
12
|
var _objectSpread = require("@swc/helpers/lib/_object_spread.js").default;
|
|
13
13
|
var _objectSpreadProps = require("@swc/helpers/lib/_object_spread_props.js").default;
|
|
14
|
+
var _objectWithoutProperties = require("@swc/helpers/lib/_object_without_properties.js").default;
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
var _plasmaReactIcons = require("@coveord/plasma-react-icons");
|
|
16
17
|
var _core = require("@mantine/core");
|
|
@@ -25,9 +26,19 @@ var useStyles = (0, _core.createStyles)(function(theme) {
|
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
});
|
|
28
|
-
var TableFilter = function(
|
|
29
|
-
var _param_placeholder =
|
|
30
|
-
|
|
29
|
+
var TableFilter = function(_param) {
|
|
30
|
+
var _param_placeholder = _param.placeholder, placeholder = _param_placeholder === void 0 ? "Search by any field" : _param_placeholder, classNames = _param.classNames, styles = _param.styles, unstyled = _param.unstyled, others = _objectWithoutProperties(_param, [
|
|
31
|
+
"placeholder",
|
|
32
|
+
"classNames",
|
|
33
|
+
"styles",
|
|
34
|
+
"unstyled"
|
|
35
|
+
]);
|
|
36
|
+
var _useStyles = useStyles(null, {
|
|
37
|
+
name: "TableHeader",
|
|
38
|
+
classNames: classNames,
|
|
39
|
+
styles: styles,
|
|
40
|
+
unstyled: unstyled
|
|
41
|
+
}), classes = _useStyles.classes, cx = _useStyles.cx;
|
|
31
42
|
var _useTable1 = (0, _useTable.useTable)(), state = _useTable1.state, setState = _useTable1.setState;
|
|
32
43
|
var handleSearchChange = function(event) {
|
|
33
44
|
var value = event.currentTarget.value;
|
|
@@ -37,7 +48,7 @@ var TableFilter = function(param) {
|
|
|
37
48
|
});
|
|
38
49
|
});
|
|
39
50
|
};
|
|
40
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.TextInput, {
|
|
51
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.TextInput, _objectSpread({
|
|
41
52
|
className: classes.wrapper,
|
|
42
53
|
placeholder: placeholder,
|
|
43
54
|
mb: "md",
|
|
@@ -47,7 +58,7 @@ var TableFilter = function(param) {
|
|
|
47
58
|
}),
|
|
48
59
|
value: state.globalFilter,
|
|
49
60
|
onChange: handleSearchChange
|
|
50
|
-
});
|
|
61
|
+
}, others));
|
|
51
62
|
};
|
|
52
63
|
|
|
53
64
|
//# sourceMappingURL=TableFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/table/TableFilter.tsx"],"sourcesContent":["import {SearchSize16Px} from '@coveord/plasma-react-icons';\nimport {createStyles, TextInput} from '@mantine/core';\nimport {TableState} from '@tanstack/react-table';\nimport {ChangeEvent, FunctionComponent} from 'react';\nimport {useTable} from './useTable';\n\nconst useStyles = createStyles((theme) => ({\n wrapper: {\n marginBottom: '0 !important',\n },\n empty: {\n color: theme.colors.gray[4],\n },\n}));\n\ninterface TableFilterProps {\n /**\n * The placeholder for the filter input\n *\n * @default \"Search by any field\"\n */\n placeholder?: string;\n}\n\nexport const TableFilter: FunctionComponent<TableFilterProps> = ({placeholder = 'Search by any field'}) => {\n const {classes, cx} = useStyles();\n const {state, setState} = useTable();\n\n const handleSearchChange = (event: ChangeEvent<HTMLInputElement>) => {\n const {value} = event.currentTarget;\n setState((prevState: TableState) => ({...prevState, globalFilter: value}));\n };\n\n return (\n <TextInput\n className={classes.wrapper}\n placeholder={placeholder}\n mb=\"md\"\n rightSection={<SearchSize16Px height={14} className={cx({[classes.empty]: !state.globalFilter})} />}\n value={state.globalFilter}\n onChange={handleSearchChange}\n />\n );\n};\n"],"names":["TableFilter","useStyles","createStyles","theme","wrapper","marginBottom","empty","color","colors","gray","placeholder","classes","cx","useTable","state","setState","handleSearchChange","event","value","currentTarget","prevState","globalFilter","TextInput","className","mb","rightSection","SearchSize16Px","height","onChange"],"mappings":"AAAA;;;;+
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/table/TableFilter.tsx"],"sourcesContent":["import {SearchSize16Px} from '@coveord/plasma-react-icons';\nimport {createStyles, TextInput, Selectors, DefaultProps} from '@mantine/core';\nimport {TableState} from '@tanstack/react-table';\nimport {ChangeEvent, FunctionComponent} from 'react';\nimport {useTable} from './useTable';\n\nconst useStyles = createStyles((theme) => ({\n wrapper: {\n marginBottom: '0 !important',\n },\n empty: {\n color: theme.colors.gray[4],\n },\n}));\n\ntype TableFilterStylesNames = Selectors<typeof useStyles>;\ninterface TableFilterProps extends DefaultProps<TableFilterStylesNames> {\n /**\n * The placeholder for the filter input\n *\n * @default \"Search by any field\"\n */\n placeholder?: string;\n}\n\nexport const TableFilter: FunctionComponent<TableFilterProps> = ({\n placeholder = 'Search by any field',\n classNames,\n styles,\n unstyled,\n ...others\n}) => {\n const {classes, cx} = useStyles(null, {name: 'TableHeader', classNames, styles, unstyled});\n const {state, setState} = useTable();\n\n const handleSearchChange = (event: ChangeEvent<HTMLInputElement>) => {\n const {value} = event.currentTarget;\n setState((prevState: TableState) => ({...prevState, globalFilter: value}));\n };\n\n return (\n <TextInput\n className={classes.wrapper}\n placeholder={placeholder}\n mb=\"md\"\n rightSection={<SearchSize16Px height={14} className={cx({[classes.empty]: !state.globalFilter})} />}\n value={state.globalFilter}\n onChange={handleSearchChange}\n {...others}\n />\n );\n};\n"],"names":["TableFilter","useStyles","createStyles","theme","wrapper","marginBottom","empty","color","colors","gray","placeholder","classNames","styles","unstyled","others","name","classes","cx","useTable","state","setState","handleSearchChange","event","value","currentTarget","prevState","globalFilter","TextInput","className","mb","rightSection","SearchSize16Px","height","onChange"],"mappings":"AAAA;;;;+BAyBaA;;;eAAAA;;;;;;;;gCAzBgB;oBACkC;wBAGxC;AAEvB,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;WAAW;QACvCC,SAAS;YACLC,cAAc;QAClB;QACAC,OAAO;YACHC,OAAOJ,MAAMK,MAAM,CAACC,IAAI,CAAC,EAAE;QAC/B;IACJ;;AAYO,IAAMT,cAAmD,iBAM1D;oCALFU,aAAAA,8CAAc,4CACdC,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACGC;QAJHJ;QACAC;QACAC;QACAC;;IAGA,IAAsBZ,aAAAA,UAAU,IAAI,EAAE;QAACc,MAAM;QAAeJ,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,IAAjFG,UAAef,WAAfe,SAASC,KAAMhB,WAANgB;IAChB,IAA0BC,aAAAA,IAAAA,kBAAQ,KAA3BC,QAAmBD,WAAnBC,OAAOC,WAAYF,WAAZE;IAEd,IAAMC,qBAAqB,SAACC,OAAyC;QACjE,IAAM,AAACC,QAASD,MAAME,aAAa,CAA5BD;QACPH,SAAS,SAACK;mBAA2B,qCAAIA;gBAAWC,cAAcH;;;IACtE;IAEA,qBACI,qBAACI,eAAS;QACNC,WAAWZ,QAAQZ,OAAO;QAC1BM,aAAaA;QACbmB,IAAG;QACHC,4BAAc,qBAACC,gCAAc;YAACC,QAAQ;YAAIJ,WAAWX,GAAI,oBAACD,QAAQV,KAAK,EAAG,CAACa,MAAMO,YAAY;;QAC7FH,OAAOJ,MAAMO,YAAY;QACzBO,UAAUZ;OACNP;AAGhB"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { ModalProps } from '@mantine/core';
|
|
1
|
+
import { DefaultProps, ModalProps, Selectors } from '@mantine/core';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
3
|
import { ModalWizardStep } from './ModalWizardStep';
|
|
4
|
-
|
|
4
|
+
declare const useStyles: (params: void, options?: import("@mantine/core").UseStylesOptions<"body" | "modal">) => {
|
|
5
|
+
classes: Record<"body" | "modal", string>;
|
|
6
|
+
cx: (...args: any) => string;
|
|
7
|
+
theme: import("@mantine/core").MantineTheme;
|
|
8
|
+
};
|
|
9
|
+
type ModalWizardStylesNames = Selectors<typeof useStyles>;
|
|
10
|
+
interface ModalWizardProps extends Omit<DefaultProps<ModalWizardStylesNames>, 'classNames' | 'styles'>, Omit<ModalProps, 'centered' | 'title'> {
|
|
5
11
|
/**
|
|
6
12
|
* The label of the cancel button
|
|
7
13
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalWizard.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ModalWizard.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAS,UAAU,EAAY,SAAS,EAAC,MAAM,eAAe,CAAC;AAC9G,OAAO,EAAW,YAAY,EAAoB,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAGlD,QAAA,MAAM,SAAS;;;;CAUZ,CAAC;AAEJ,KAAK,sBAAsB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAE1D,UAAU,gBACN,SAAQ,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAC,EAAE,YAAY,GAAG,QAAQ,CAAC,EACvE,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IAC1C;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC;IAExB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC;IAEjC;;SAEK;IACL,QAAQ,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC;CACxD;AAED,UAAU,eAAe;IACrB,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAAC;IAExC,IAAI,EAAE,OAAO,eAAe,CAAC;CAChC;AAED,eAAO,MAAM,WAAW,EAAE,eAyHzB,CAAC"}
|
|
@@ -36,6 +36,7 @@ export interface ModalWizardStepProps {
|
|
|
36
36
|
* @default true
|
|
37
37
|
*/
|
|
38
38
|
countsAsProgress?: boolean;
|
|
39
|
+
children: ReactElement<any, any>;
|
|
39
40
|
}
|
|
40
41
|
declare const ModalWizardStep: FunctionComponent<PropsWithChildren<ModalWizardStepProps>>;
|
|
41
42
|
export { ModalWizardStep };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalWizardStep.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-wizard/ModalWizardStep.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAC,MAAM,OAAO,CAAC;AAEzE,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa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,MAAM,CAAC;IAEhB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa,CAAC,MAAM,GAAG,YAAY,CAAC,CAAC;IAEnF;;OAEG;IACH,YAAY,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,KAAK;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAC,CAAC;IAE/F;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAA4B,CAAC;AAO7G,OAAO,EAAC,eAAe,EAAC,CAAC"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { Selectors, DefaultProps } from '@mantine/core';
|
|
1
2
|
import { FunctionComponent } from 'react';
|
|
2
|
-
|
|
3
|
+
declare const useStyles: (params: void, options?: import("@mantine/core").UseStylesOptions<"wrapper" | "empty">) => {
|
|
4
|
+
classes: Record<"wrapper" | "empty", string>;
|
|
5
|
+
cx: (...args: any) => string;
|
|
6
|
+
theme: import("@mantine/core").MantineTheme;
|
|
7
|
+
};
|
|
8
|
+
type TableFilterStylesNames = Selectors<typeof useStyles>;
|
|
9
|
+
interface TableFilterProps extends DefaultProps<TableFilterStylesNames> {
|
|
3
10
|
/**
|
|
4
11
|
* The placeholder for the filter input
|
|
5
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/table/TableFilter.tsx"],"names":[],"mappings":"AACA,OAAO,EAA0B,SAAS,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAc,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAGrD,QAAA,MAAM,SAAS;;;;CAOZ,CAAC;AAEJ,KAAK,sBAAsB,GAAG,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC;AAC1D,UAAU,gBAAiB,SAAQ,YAAY,CAAC,sBAAsB,CAAC;IACnE;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CA0B3D,CAAC"}
|
|
@@ -3,13 +3,26 @@ import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
|
|
|
3
3
|
import _object_without_properties from "@swc/helpers/src/_object_without_properties.mjs";
|
|
4
4
|
import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs";
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Button, Modal, Progress } from "@mantine/core";
|
|
6
|
+
import { Box, Button, createStyles, Modal, Progress } from "@mantine/core";
|
|
7
7
|
import { Children, useMemo, useState } from "react";
|
|
8
8
|
import { StickyFooter } from "../sticky-footer";
|
|
9
9
|
import { ModalWizardStep } from "./ModalWizardStep";
|
|
10
10
|
import { Header } from "../header";
|
|
11
|
+
var useStyles = createStyles(function() {
|
|
12
|
+
return {
|
|
13
|
+
modal: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column"
|
|
16
|
+
},
|
|
17
|
+
body: {
|
|
18
|
+
flex: 1,
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
});
|
|
11
24
|
export var ModalWizard = function(_param) {
|
|
12
|
-
var _param_cancelButtonLabel = _param.cancelButtonLabel, cancelButtonLabel = _param_cancelButtonLabel === void 0 ? "Cancel" : _param_cancelButtonLabel, _param_nextButtonLabel = _param.nextButtonLabel, nextButtonLabel = _param_nextButtonLabel === void 0 ? "Next" : _param_nextButtonLabel, _param_previousButtonLabel = _param.previousButtonLabel, previousButtonLabel = _param_previousButtonLabel === void 0 ? "Previous" : _param_previousButtonLabel, _param_finishButtonLabel = _param.finishButtonLabel, finishButtonLabel = _param_finishButtonLabel === void 0 ? "Finish" : _param_finishButtonLabel, opened = _param.opened, onNext = _param.onNext, onPrevious = _param.onPrevious, onClose = _param.onClose, onFinish = _param.onFinish, isDirty = _param.isDirty, handleDirtyState = _param.handleDirtyState, classNames = _param.classNames, children = _param.children, modalProps = _object_without_properties(_param, [
|
|
25
|
+
var _param_cancelButtonLabel = _param.cancelButtonLabel, cancelButtonLabel = _param_cancelButtonLabel === void 0 ? "Cancel" : _param_cancelButtonLabel, _param_nextButtonLabel = _param.nextButtonLabel, nextButtonLabel = _param_nextButtonLabel === void 0 ? "Next" : _param_nextButtonLabel, _param_previousButtonLabel = _param.previousButtonLabel, previousButtonLabel = _param_previousButtonLabel === void 0 ? "Previous" : _param_previousButtonLabel, _param_finishButtonLabel = _param.finishButtonLabel, finishButtonLabel = _param_finishButtonLabel === void 0 ? "Finish" : _param_finishButtonLabel, opened = _param.opened, onNext = _param.onNext, onPrevious = _param.onPrevious, onClose = _param.onClose, onFinish = _param.onFinish, isDirty = _param.isDirty, handleDirtyState = _param.handleDirtyState, classNames = _param.classNames, className = _param.className, styles = _param.styles, unstyled = _param.unstyled, children = _param.children, modalProps = _object_without_properties(_param, [
|
|
13
26
|
"cancelButtonLabel",
|
|
14
27
|
"nextButtonLabel",
|
|
15
28
|
"previousButtonLabel",
|
|
@@ -22,9 +35,18 @@ export var ModalWizard = function(_param) {
|
|
|
22
35
|
"isDirty",
|
|
23
36
|
"handleDirtyState",
|
|
24
37
|
"classNames",
|
|
38
|
+
"className",
|
|
39
|
+
"styles",
|
|
40
|
+
"unstyled",
|
|
25
41
|
"children"
|
|
26
42
|
]);
|
|
27
43
|
var _currentStep_props, _currentStep_props_validateStep;
|
|
44
|
+
var _useStyles = useStyles(null, {
|
|
45
|
+
name: "ModalWizard",
|
|
46
|
+
classNames: classNames,
|
|
47
|
+
styles: styles,
|
|
48
|
+
unstyled: unstyled
|
|
49
|
+
}), _useStyles_classes = _useStyles.classes, modal = _useStyles_classes.modal, body = _useStyles_classes.body, cx = _useStyles.cx;
|
|
28
50
|
var _useState = _sliced_to_array(useState(0), 2), currentStepIndex = _useState[0], setCurrentStepIndex = _useState[1];
|
|
29
51
|
var modalSteps = Children.toArray(children).filter(function(child) {
|
|
30
52
|
return child.type === ModalWizardStep;
|
|
@@ -63,7 +85,10 @@ export var ModalWizard = function(_param) {
|
|
|
63
85
|
]);
|
|
64
86
|
return /*#__PURE__*/ _jsxs(Modal, _object_spread_props(_object_spread({
|
|
65
87
|
opened: opened,
|
|
66
|
-
classNames:
|
|
88
|
+
classNames: {
|
|
89
|
+
modal: cx(modal, classNames === null || classNames === void 0 ? void 0 : classNames.modal),
|
|
90
|
+
body: cx(body, classNames === null || classNames === void 0 ? void 0 : classNames.body)
|
|
91
|
+
},
|
|
67
92
|
centered: true,
|
|
68
93
|
title: /*#__PURE__*/ _jsx(Header, {
|
|
69
94
|
docLink: currentStep.props.docLink,
|
|
@@ -81,41 +106,45 @@ export var ModalWizard = function(_param) {
|
|
|
81
106
|
value: getProgressMemo
|
|
82
107
|
}),
|
|
83
108
|
currentStep,
|
|
84
|
-
/*#__PURE__*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
109
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
110
|
+
sx: function(theme) {
|
|
111
|
+
return {
|
|
112
|
+
marginTop: "auto"
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
children: /*#__PURE__*/ _jsxs(StickyFooter, {
|
|
116
|
+
px: 0,
|
|
117
|
+
pt: "sm",
|
|
118
|
+
pb: 0,
|
|
119
|
+
borderTop: true,
|
|
120
|
+
children: [
|
|
121
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
122
|
+
name: isFirstStep ? cancelButtonLabel : previousButtonLabel,
|
|
123
|
+
variant: "outline",
|
|
124
|
+
onClick: function() {
|
|
125
|
+
if (isFirstStep) {
|
|
126
|
+
closeModalWizard();
|
|
127
|
+
} else {
|
|
128
|
+
onPrevious === null || onPrevious === void 0 ? void 0 : onPrevious();
|
|
129
|
+
setCurrentStepIndex(currentStepIndex - 1);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
children: isFirstStep ? cancelButtonLabel : previousButtonLabel
|
|
133
|
+
}),
|
|
134
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
135
|
+
disabled: !isValid,
|
|
136
|
+
onClick: function() {
|
|
137
|
+
if (isLastStep) {
|
|
138
|
+
onFinish ? onFinish() : onClose();
|
|
139
|
+
} else {
|
|
140
|
+
onNext === null || onNext === void 0 ? void 0 : onNext();
|
|
141
|
+
setCurrentStepIndex(currentStepIndex + 1);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
children: isLastStep ? finishButtonLabel : nextButtonLabel
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
})
|
|
119
148
|
})
|
|
120
149
|
]
|
|
121
150
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Button, Modal, ModalProps, Progress} from '@mantine/core';\nimport {Children, ReactElement, useMemo, useState} from 'react';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep} from './ModalWizardStep';\nimport {Header} from '../header';\n\ninterface ModalWizardProps extends Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: () => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: () => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n children,\n ...modalProps\n}) => {\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const numberOfStepsCountAsProgress = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n const isModalDirty = isDirty && isDirty();\n\n const closeModalWizard = () => {\n if (isModalDirty && handleDirtyState) {\n handleDirtyState() && onClose?.();\n } else {\n onClose?.();\n }\n };\n\n const getProgress = (currStepIndex: number) => {\n const validSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (validSteps / numberOfStepsCountAsProgress) * 100;\n };\n\n const getProgressMemo = useMemo(() => getProgress(currentStepIndex), [currentStepIndex]);\n\n return (\n <Modal\n opened={opened}\n classNames={classNames}\n centered\n title={\n <Header\n docLink={currentStep.props.docLink}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={0}\n px={0}\n >\n {typeof currentStep.props.title === 'function'\n ? currentStep.props.title(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.title}\n </Header>\n }\n onClose={closeModalWizard}\n {...modalProps}\n >\n {currentStep.props.showProgressBar && <Progress color=\"teal\" size=\"lg\" value={getProgressMemo} />}\n {currentStep}\n <StickyFooter py={0} px={0} pt=\"sm\" borderTop>\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n disabled={false}\n size=\"sm\"\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n closeModalWizard();\n } else {\n onPrevious?.();\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n size=\"sm\"\n onClick={() => {\n if (isLastStep) {\n onFinish ? onFinish() : onClose();\n } else {\n onNext?.();\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["Button","Modal","Progress","Children","useMemo","useState","StickyFooter","ModalWizardStep","Header","ModalWizard","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","children","modalProps","currentStep","currentStepIndex","setCurrentStepIndex","modalSteps","toArray","filter","child","type","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","centered","title","docLink","description","py","px","showProgressBar","color","size","value","pt","borderTop","name","disabled","variant","onClick","Step"],"mappings":"AAAA;;;;;AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAcC,QAAQ,QAAO,gBAAgB;AAClE,SAAQC,QAAQ,EAAgBC,OAAO,EAAEC,QAAQ,QAAO,QAAQ;AAChE,SAAQC,YAAY,QAAO,mBAAmB;AAC9C,SAAQC,eAAe,QAAO,oBAAoB;AAClD,SAAQC,MAAM,QAAO,YAAY;AAsEjC,OAAO,IAAMC,cAA+B,iBAetC;0CAdFC,mBAAAA,0DAAoB,qEACpBC,iBAAAA,sDAAkB,qEAClBC,qBAAAA,8DAAsB,2EACtBC,mBAAAA,0DAAoB,qCACpBC,gBAAAA,QACAC,gBAAAA,QACAC,oBAAAA,YACAC,iBAAAA,SACAC,kBAAAA,UACAC,iBAAAA,SACAC,0BAAAA,kBACAC,oBAAAA,YACAC,kBAAAA,UACGC;QAbHb;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;;QAYkBE;IATlB,IAAgDnB,6BAAAA,SAAS,QAAlDoB,mBAAyCpB,cAAvBqB,sBAAuBrB;IAChD,IAAMsB,aAAa,AAACxB,SAASyB,OAAO,CAACN,UAA6BO,MAAM,CAAC,SAACC;eAAUA,MAAMC,IAAI,KAAKxB;;IA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,YAAYY,KAAK,CAACgB,WAAW,CAAC3B,mBAAmB,GAAGO,iBACpDR,YAAYY,KAAK,CAACgB,WAAW;YAEvCC,IAAI;YACJC,IAAI;sBAEH,OAAO9B,YAAYY,KAAK,CAACc,KAAK,KAAK,aAC9B1B,YAAYY,KAAK,CAACc,KAAK,CAACzB,mBAAmB,GAAGO,iBAC9CR,YAAYY,KAAK,CAACc,KAAK;;QAGrCjC,SAAS2B;OACLrB;;YAEHC,YAAYY,KAAK,CAACmB,eAAe,kBAAI,KAACrD;gBAASsD,OAAM;gBAAOC,MAAK;gBAAKC,OAAOV;;YAC7ExB;0BACD,MAAClB;gBAAa+C,IAAI;gBAAGC,IAAI;gBAAGK,IAAG;gBAAKC,SAAS;;kCACzC,KAAC5D;wBACG6D,MAAMvB,cAAc5B,oBAAoBE,mBAAmB;wBAC3DkD,UAAU,KAAK;wBACfL,MAAK;wBACLM,SAAQ;wBACRC,SAAS,WAAM;4BACX,IAAI1B,aAAa;gCACbM;4BACJ,OAAO;gCACH5B,uBAAAA,wBAAAA,KAAAA,IAAAA;gCACAU,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECa,cAAc5B,oBAAoBE,mBAAmB;;kCAG1D,KAACZ;wBACG8D,UAAU,CAACrB;wBACXgB,MAAK;wBACLO,SAAS,WAAM;4BACX,IAAIzB,YAAY;gCACZrB,WAAWA,aAAaD,SAAS;4BACrC,OAAO;gCACHF,mBAAAA,oBAAAA,KAAAA,IAAAA;gCACAW,oBAAoBD,mBAAmB;4BAC3C,CAAC;wBACL;kCAECc,aAAa1B,oBAAoBF,eAAe;;;;;;AAKrE,EAAE;AAEFF,YAAYwD,IAAI,GAAG1D"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Box, Button, createStyles, DefaultProps, Modal, ModalProps, Progress, Selectors} from '@mantine/core';\nimport {Children, ReactElement, useMemo, useState} from 'react';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep} from './ModalWizardStep';\nimport {Header} from '../header';\n\nconst useStyles = createStyles(() => ({\n modal: {\n display: 'flex',\n flexDirection: 'column',\n },\n body: {\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n },\n}));\n\ntype ModalWizardStylesNames = Selectors<typeof useStyles>;\n\ninterface ModalWizardProps\n extends Omit<DefaultProps<ModalWizardStylesNames>, 'classNames' | 'styles'>,\n Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: () => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: () => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n className,\n styles,\n unstyled,\n children,\n ...modalProps\n}) => {\n const {\n classes: {modal, body},\n cx,\n } = useStyles(null, {\n name: 'ModalWizard',\n classNames,\n styles,\n unstyled,\n });\n\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const numberOfStepsCountAsProgress = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n const isModalDirty = isDirty && isDirty();\n\n const closeModalWizard = () => {\n if (isModalDirty && handleDirtyState) {\n handleDirtyState() && onClose?.();\n } else {\n onClose?.();\n }\n };\n\n const getProgress = (currStepIndex: number) => {\n const validSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (validSteps / numberOfStepsCountAsProgress) * 100;\n };\n\n const getProgressMemo = useMemo(() => getProgress(currentStepIndex), [currentStepIndex]);\n return (\n <Modal\n opened={opened}\n classNames={{modal: cx(modal, classNames?.modal), body: cx(body, classNames?.body)}}\n centered\n title={\n <Header\n docLink={currentStep.props.docLink}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={0}\n px={0}\n >\n {typeof currentStep.props.title === 'function'\n ? currentStep.props.title(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.title}\n </Header>\n }\n onClose={closeModalWizard}\n {...modalProps}\n >\n {currentStep.props.showProgressBar && <Progress color=\"teal\" size=\"lg\" value={getProgressMemo} />}\n {currentStep}\n <Box\n sx={(theme) => ({\n marginTop: 'auto',\n })}\n >\n <StickyFooter px={0} pt=\"sm\" pb={0} borderTop>\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n closeModalWizard();\n } else {\n onPrevious?.();\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n onClick={() => {\n if (isLastStep) {\n onFinish ? onFinish() : onClose();\n } else {\n onNext?.();\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Box>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["Box","Button","createStyles","Modal","Progress","Children","useMemo","useState","StickyFooter","ModalWizardStep","Header","useStyles","modal","display","flexDirection","body","flex","ModalWizard","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","className","styles","unstyled","children","modalProps","currentStep","name","classes","cx","currentStepIndex","setCurrentStepIndex","modalSteps","toArray","filter","child","type","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","centered","title","docLink","description","py","px","showProgressBar","color","size","value","sx","theme","marginTop","pt","pb","borderTop","variant","onClick","disabled","Step"],"mappings":"AAAA;;;;;AAAA,SAAQA,GAAG,EAAEC,MAAM,EAAEC,YAAY,EAAgBC,KAAK,EAAcC,QAAQ,QAAkB,gBAAgB;AAC9G,SAAQC,QAAQ,EAAgBC,OAAO,EAAEC,QAAQ,QAAO,QAAQ;AAChE,SAAQC,YAAY,QAAO,mBAAmB;AAC9C,SAAQC,eAAe,QAAO,oBAAoB;AAClD,SAAQC,MAAM,QAAO,YAAY;AAEjC,IAAMC,YAAYT,aAAa;WAAO;QAClCU,OAAO;YACHC,SAAS;YACTC,eAAe;QACnB;QACAC,MAAM;YACFC,MAAM;YACNH,SAAS;YACTC,eAAe;QACnB;IACJ;;AA0EA,OAAO,IAAMG,cAA+B,iBAkBtC;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BAASkE,OAAM;gBAAOC,MAAK;gBAAKC,OAAOV;;YAC7E3B;0BACD,KAACnC;gBACGyE,IAAI,SAACC;2BAAW;wBACZC,WAAW;oBACf;;0BAEA,cAAA,MAACnE;oBAAa4D,IAAI;oBAAGQ,IAAG;oBAAKC,IAAI;oBAAGC,SAAS;;sCACzC,KAAC7E;4BACGmC,MAAMgB,cAAclC,oBAAoBE,mBAAmB;4BAC3D2D,SAAQ;4BACRC,SAAS,WAAM;gCACX,IAAI5B,aAAa;oCACbM;gCACJ,OAAO;oCACHlC,uBAAAA,wBAAAA,KAAAA,IAAAA;oCACAgB,oBAAoBD,mBAAmB;gCAC3C,CAAC;4BACL;sCAECa,cAAclC,oBAAoBE,mBAAmB;;sCAG1D,KAACnB;4BACGgF,UAAU,CAAC1B;4BACXyB,SAAS,WAAM;gCACX,IAAI3B,YAAY;oCACZ3B,WAAWA,aAAaD,SAAS;gCACrC,OAAO;oCACHF,mBAAAA,oBAAAA,KAAAA,IAAAA;oCACAiB,oBAAoBD,mBAAmB;gCAC3C,CAAC;4BACL;sCAECc,aAAahC,oBAAoBF,eAAe;;;;;;;AAMzE,EAAE;AAEFF,YAAYiE,IAAI,GAAGzE"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
var ModalWizardStep = function(param) {
|
|
3
2
|
var children = param.children;
|
|
4
|
-
return
|
|
5
|
-
children: children
|
|
6
|
-
});
|
|
3
|
+
return children;
|
|
7
4
|
};
|
|
8
5
|
ModalWizardStep.defaultProps = {
|
|
9
6
|
showProgressBar: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizardStep.tsx"],"sourcesContent":["import {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\ntype DependsOnStep<T> = (currentStep: number, numberOfSteps: number) => T;\n\nexport interface ModalWizardStepProps {\n /**\n * The title of the current step. The title can be dependent on the current step if needed\n */\n title?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * The description of the current step. The description can be dependent on the current step if needed\n */\n description?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * A link to the documentation for the current step\n */\n docLink: string;\n\n /**\n * A tooltip label for the docLink\n */\n docLinkTooltipLabel?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * A function to validate the current step, it determines if the next step should be enabled or not.\n */\n validateStep: (currentStep: any, numberOfSteps: any) => {isValid: boolean; messsage?: unknown};\n\n /**\n * Show progress bar at this step\n *\n * @default true\n */\n showProgressBar?: boolean;\n\n /**\n * Does completion of current step count moves the progress bar\n *\n * @default true\n */\n countsAsProgress?: boolean;\n}\n\nconst ModalWizardStep: FunctionComponent<PropsWithChildren<ModalWizardStepProps>> = ({children}) =>
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizardStep.tsx"],"sourcesContent":["import {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\ntype DependsOnStep<T> = (currentStep: number, numberOfSteps: number) => T;\n\nexport interface ModalWizardStepProps {\n /**\n * The title of the current step. The title can be dependent on the current step if needed\n */\n title?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * The description of the current step. The description can be dependent on the current step if needed\n */\n description?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * A link to the documentation for the current step\n */\n docLink: string;\n\n /**\n * A tooltip label for the docLink\n */\n docLinkTooltipLabel?: string | ReactElement | DependsOnStep<string | ReactElement>;\n\n /**\n * A function to validate the current step, it determines if the next step should be enabled or not.\n */\n validateStep: (currentStep: any, numberOfSteps: any) => {isValid: boolean; messsage?: unknown};\n\n /**\n * Show progress bar at this step\n *\n * @default true\n */\n showProgressBar?: boolean;\n\n /**\n * Does completion of current step count moves the progress bar\n *\n * @default true\n */\n countsAsProgress?: boolean;\n children: ReactElement<any, any>;\n}\n\nconst ModalWizardStep: FunctionComponent<PropsWithChildren<ModalWizardStepProps>> = ({children}) => children;\n\nModalWizardStep.defaultProps = {\n showProgressBar: true,\n countsAsProgress: true,\n};\n\nexport {ModalWizardStep};\n"],"names":["ModalWizardStep","children","defaultProps","showProgressBar","countsAsProgress"],"mappings":"AA8CA,IAAMA,kBAA8E;QAAEC,iBAAAA;WAAcA;;AAEpGD,gBAAgBE,YAAY,GAAG;IAC3BC,iBAAiB,IAAI;IACrBC,kBAAkB,IAAI;AAC1B;AAEA,SAAQJ,eAAe,GAAE"}
|