@coveord/plasma-mantine 48.6.0 → 48.9.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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +6 -6
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/modal-wizard/ModalWizard.js +24 -21
- package/dist/cjs/components/modal-wizard/ModalWizard.js.map +1 -1
- package/dist/cjs/theme/Theme.js +0 -6
- package/dist/cjs/theme/Theme.js.map +1 -1
- package/dist/definitions/components/modal-wizard/ModalWizard.d.ts +3 -14
- package/dist/definitions/components/modal-wizard/ModalWizard.d.ts.map +1 -1
- package/dist/definitions/theme/Theme.d.ts.map +1 -1
- package/dist/esm/components/modal-wizard/ModalWizard.js +25 -22
- package/dist/esm/components/modal-wizard/ModalWizard.js.map +1 -1
- package/dist/esm/theme/Theme.js +0 -6
- package/dist/esm/theme/Theme.js.map +1 -1
- package/package.json +1 -1
- package/src/components/modal-wizard/ModalWizard.tsx +14 -42
- package/src/components/modal-wizard/__tests__/ModalWizard.spec.tsx +45 -39
- package/src/theme/Theme.tsx +0 -6
- package/dist/cjs/components/collection/Collection.example.js +0 -64
- package/dist/cjs/components/collection/Collection.example.js.map +0 -1
- package/dist/definitions/components/collection/Collection.example.d.ts +0 -4
- package/dist/definitions/components/collection/Collection.example.d.ts.map +0 -1
- package/dist/esm/components/collection/Collection.example.js +0 -54
- package/dist/esm/components/collection/Collection.example.js.map +0 -1
- package/src/components/collection/Collection.example.tsx +0 -37
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "ModalWizard", {
|
|
|
10
10
|
});
|
|
11
11
|
var _objectSpread = require("@swc/helpers/lib/_object_spread.js").default;
|
|
12
12
|
var _objectSpreadProps = require("@swc/helpers/lib/_object_spread_props.js").default;
|
|
13
|
+
var _objectWithoutProperties = require("@swc/helpers/lib/_object_without_properties.js").default;
|
|
13
14
|
var _slicedToArray = require("@swc/helpers/lib/_sliced_to_array.js").default;
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
var _core = require("@mantine/core");
|
|
@@ -17,17 +18,22 @@ var _react = require("react");
|
|
|
17
18
|
var _stickyFooter = require("../sticky-footer");
|
|
18
19
|
var _modalWizardStep = require("./ModalWizardStep");
|
|
19
20
|
var _header = require("../header");
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
var ModalWizard = function(_param) {
|
|
22
|
+
var _cancelButtonLabel = _param.cancelButtonLabel, cancelButtonLabel = _cancelButtonLabel === void 0 ? "Cancel" : _cancelButtonLabel, _nextButtonLabel = _param.nextButtonLabel, nextButtonLabel = _nextButtonLabel === void 0 ? "Next" : _nextButtonLabel, _previousButtonLabel = _param.previousButtonLabel, previousButtonLabel = _previousButtonLabel === void 0 ? "Previous" : _previousButtonLabel, _finishButtonLabel = _param.finishButtonLabel, finishButtonLabel = _finishButtonLabel === void 0 ? "Finish" : _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, [
|
|
23
|
+
"cancelButtonLabel",
|
|
24
|
+
"nextButtonLabel",
|
|
25
|
+
"previousButtonLabel",
|
|
26
|
+
"finishButtonLabel",
|
|
27
|
+
"opened",
|
|
28
|
+
"onNext",
|
|
29
|
+
"onPrevious",
|
|
30
|
+
"onClose",
|
|
31
|
+
"onFinish",
|
|
32
|
+
"isDirty",
|
|
33
|
+
"handleDirtyState",
|
|
34
|
+
"classNames",
|
|
35
|
+
"children"
|
|
36
|
+
]);
|
|
31
37
|
var ref, ref1;
|
|
32
38
|
var ref2 = _slicedToArray((0, _react.useState)(0), 2), currentStepIndex = ref2[0], setCurrentStepIndex = ref2[1];
|
|
33
39
|
var modalSteps = _react.Children.toArray(children).filter(function(child) {
|
|
@@ -47,7 +53,6 @@ var ModalWizard = function(param) {
|
|
|
47
53
|
isValid: true
|
|
48
54
|
}).isValid;
|
|
49
55
|
var isModalDirty = isDirty && isDirty();
|
|
50
|
-
var classes = useStyles().classes;
|
|
51
56
|
var closeModalWizard = function() {
|
|
52
57
|
if (isModalDirty && handleDirtyState) {
|
|
53
58
|
handleDirtyState() && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
@@ -67,15 +72,11 @@ var ModalWizard = function(param) {
|
|
|
67
72
|
currentStepIndex
|
|
68
73
|
]);
|
|
69
74
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_core.Modal, _objectSpreadProps(_objectSpread({
|
|
70
|
-
opened:
|
|
71
|
-
classNames:
|
|
72
|
-
modal: classes.modal
|
|
73
|
-
},
|
|
75
|
+
opened: opened,
|
|
76
|
+
classNames: classNames,
|
|
74
77
|
centered: true,
|
|
75
|
-
closeButtonLabel: closeButtonLabel,
|
|
76
|
-
padding: "xl",
|
|
77
78
|
title: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_header.Header, {
|
|
78
|
-
docLink: currentStep.props.
|
|
79
|
+
docLink: currentStep.props.docLink,
|
|
79
80
|
description: typeof currentStep.props.description === "function" ? currentStep.props.description(currentStepIndex + 1, numberOfSteps) : currentStep.props.description,
|
|
80
81
|
py: null,
|
|
81
82
|
px: null,
|
|
@@ -85,6 +86,8 @@ var ModalWizard = function(param) {
|
|
|
85
86
|
}, modalProps), {
|
|
86
87
|
children: [
|
|
87
88
|
currentStep.props.showProgressBar && /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Progress, {
|
|
89
|
+
color: "teal",
|
|
90
|
+
size: "lg",
|
|
88
91
|
value: getProgressMemo
|
|
89
92
|
}),
|
|
90
93
|
currentStep,
|
|
@@ -97,7 +100,7 @@ var ModalWizard = function(param) {
|
|
|
97
100
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Button, {
|
|
98
101
|
name: isFirstStep ? cancelButtonLabel : previousButtonLabel,
|
|
99
102
|
disabled: false,
|
|
100
|
-
size: "
|
|
103
|
+
size: "sm",
|
|
101
104
|
variant: "outline",
|
|
102
105
|
onClick: function() {
|
|
103
106
|
if (isFirstStep) {
|
|
@@ -111,7 +114,7 @@ var ModalWizard = function(param) {
|
|
|
111
114
|
}),
|
|
112
115
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Button, {
|
|
113
116
|
disabled: !isValid,
|
|
114
|
-
size: "
|
|
117
|
+
size: "sm",
|
|
115
118
|
onClick: function() {
|
|
116
119
|
if (isLastStep) {
|
|
117
120
|
onFinish ? onFinish() : onClose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Button, createStyles, Modal, 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 {\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\n nextButtonLabel?: string;\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\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 callback function that is executed when the user clicks on the cancel button\n */\n\n onClose?: () => 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\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 * Props to pass to each modal\n */\n modalProps?: any;\n\n /**\n * Label for close button\n */\n closeButtonLabel?: string;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\nconst useStyles = createStyles(() => ({\n modal: {\n height: '70%',\n display: 'flex',\n flexDirection: 'column',\n },\n}));\n\ninterface ModalWizardType {\n <T>(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 onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n modalProps,\n handleDirtyState,\n closeButtonLabel,\n children,\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 {classes} = useStyles();\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\n classNames={{modal: classes.modal}}\n centered\n closeButtonLabel={closeButtonLabel}\n padding=\"xl\"\n title={\n <Header\n docLink={currentStep.props.docLin}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={null}\n px={null}\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 value={getProgressMemo} />}\n {currentStep}\n <StickyFooter borderTop py={null} px={null} pt=\"md\">\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n disabled={false}\n size=\"md\"\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=\"md\"\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","useStyles","createStyles","modal","height","display","flexDirection","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","onNext","onPrevious","onClose","onFinish","isDirty","modalProps","handleDirtyState","closeButtonLabel","children","currentStep","useState","currentStepIndex","setCurrentStepIndex","modalSteps","Children","toArray","filter","child","type","ModalWizardStep","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","classes","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","useMemo","Modal","opened","classNames","centered","padding","title","Header","docLink","docLin","description","py","px","showProgress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AAW,CAAC0E,IAAI,GAAG5C,gBAAe,gBAAA,CAAC"}
|
|
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={null}\n px={null}\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 borderTop py={null} px={null} pt=\"md\">\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","borderTop","pt","Button","name","disabled","variant","onClick","Step"],"mappings":"AAAA;;;;+BA0EaA,aAAW;;;eAAXA,WAAW;;;;;;;;oBA1E0B,eAAe;qBACT,OAAO;4BACpC,kBAAkB;+BACf,mBAAmB;sBAC5B,WAAW;AAsEzB,IAAMA,WAAW,GAAoB,iBAetC;oCAdFC,iBAAiB,EAAjBA,iBAAiB,mCAAG,QAAQ,qBAAA,4BAC5BC,eAAe,EAAfA,eAAe,iCAAG,MAAM,mBAAA,gCACxBC,mBAAmB,EAAnBA,mBAAmB,qCAAG,UAAU,uBAAA,8BAChCC,iBAAiB,EAAjBA,iBAAiB,mCAAG,QAAQ,qBAAA,EAC5BC,MAAM,UAANA,MAAM,EACNC,MAAM,UAANA,MAAM,EACNC,UAAU,UAAVA,UAAU,EACVC,OAAO,UAAPA,OAAO,EACPC,QAAQ,UAARA,QAAQ,EACRC,OAAO,UAAPA,OAAO,EACPC,gBAAgB,UAAhBA,gBAAgB,EAChBC,UAAU,UAAVA,UAAU,EACVC,QAAQ,UAARA,QAAQ,EACLC,UAAU;QAbbb,mBAAiB;QACjBC,iBAAe;QACf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wBAClBoB,IAAI,EAAC,IAAI;wBACTS,OAAO,EAAE,WAAM;4BACX,IAAI/B,UAAU,EAAE;gCACZxB,QAAQ,GAAGA,QAAQ,EAAE,GAAGD,OAAO,EAAE,CAAC;4BACtC,OAAO;gCACHF,MAAM,aAANA,MAAM,WAAI,GAAVA,KAAAA,CAAU,GAAVA,MAAM,EAAI,CAAC;gCACXY,mBAAmB,CAACD,gBAAgB,GAAG,CAAC,CAAC,CAAC;4BAC9C,CAAC;wBACL,CAAC;kCAEAgB,UAAU,GAAG7B,iBAAiB,GAAGF,eAAe;sBAC5C;;cACE;;OACX,CACV;AACN,CAAC,AAAC;AAEFF,WAAW,CAACiE,IAAI,GAAGxC,gBAAe,gBAAA,CAAC"}
|
package/dist/cjs/theme/Theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {ArrowHeadRightSize24Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {ButtonStylesParams, MantineThemeOverride, ModalStylesParams} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n spacing: {\n xs: 8,\n sm: 16,\n md: 24,\n lg: 32,\n xl: 40,\n },\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: 48, lineHeight: '56px', fontWeight: undefined},\n h2: {fontSize: 32, lineHeight: '40px', fontWeight: undefined},\n h3: {fontSize: 28, lineHeight: '40px', fontWeight: undefined},\n h4: {fontSize: 24, lineHeight: '32px', fontWeight: undefined},\n h5: {fontSize: 18, lineHeight: '28px', fontWeight: undefined},\n h6: {fontSize: 16, lineHeight: '24px', fontWeight: undefined},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: (theme) => ({\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em', color: theme.colors.gray[9]},\n },\n }),\n },\n Button: {\n styles: (theme, params: ButtonStylesParams) => ({\n root: {\n '&': {fontWeight: 400},\n backgroundColor: params.variant === 'outline' ? 'white' : undefined,\n },\n }),\n },\n Modal: {\n styles: (theme, {size, fullScreen}: ModalStylesParams) => ({\n modal: {\n width: fullScreen\n ? undefined\n : theme.fn.size({size, sizes: {xs: 320, sm: 440, md: '45%', lg: 1334, xl: '85%'}}),\n },\n }),\n defaultProps: {\n overlayColor: color.primary.navy[9],\n overlayOpacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n styles: (theme) => ({\n description: {\n fontSize: 'inherit',\n paddingBottom: theme.spacing.xs,\n },\n }),\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n withArrow: true,\n withinPortal: true,\n },\n },\n Breadcrumbs: {\n defaultProps: {\n separator: <ArrowHeadRightSize24Px height={24} />,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n
|
|
1
|
+
{"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {ArrowHeadRightSize24Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {ButtonStylesParams, MantineThemeOverride, ModalStylesParams} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n spacing: {\n xs: 8,\n sm: 16,\n md: 24,\n lg: 32,\n xl: 40,\n },\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: 48, lineHeight: '56px', fontWeight: undefined},\n h2: {fontSize: 32, lineHeight: '40px', fontWeight: undefined},\n h3: {fontSize: 28, lineHeight: '40px', fontWeight: undefined},\n h4: {fontSize: 24, lineHeight: '32px', fontWeight: undefined},\n h5: {fontSize: 18, lineHeight: '28px', fontWeight: undefined},\n h6: {fontSize: 16, lineHeight: '24px', fontWeight: undefined},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: (theme) => ({\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em', color: theme.colors.gray[9]},\n },\n }),\n },\n Button: {\n styles: (theme, params: ButtonStylesParams) => ({\n root: {\n '&': {fontWeight: 400},\n backgroundColor: params.variant === 'outline' ? 'white' : undefined,\n },\n }),\n },\n Modal: {\n styles: (theme, {size, fullScreen}: ModalStylesParams) => ({\n modal: {\n width: fullScreen\n ? undefined\n : theme.fn.size({size, sizes: {xs: 320, sm: 440, md: '45%', lg: 1334, xl: '85%'}}),\n },\n }),\n defaultProps: {\n overlayColor: color.primary.navy[9],\n overlayOpacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n styles: (theme) => ({\n description: {\n fontSize: 'inherit',\n paddingBottom: theme.spacing.xs,\n },\n }),\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n withArrow: true,\n withinPortal: true,\n },\n },\n Breadcrumbs: {\n defaultProps: {\n separator: <ArrowHeadRightSize24Px height={24} />,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n },\n List: {\n styles: () => ({\n root: {\n listStyleType: 'disc',\n },\n }),\n },\n Radio: {\n styles: {\n labelWrapper: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n },\n },\n },\n};\n"],"names":["plasmaTheme","colorScheme","fontFamily","black","color","primary","gray","defaultRadius","spacing","xs","sm","md","lg","xl","primaryColor","headings","fontWeight","sizes","h1","fontSize","lineHeight","undefined","h2","h3","h4","h5","h6","shadows","colors","PlasmaColors","components","Alert","defaultProps","icon","InfoSize24Px","height","styles","title","Title","theme","root","letterSpacing","Button","params","backgroundColor","variant","Modal","size","fullScreen","modal","width","fn","overlayColor","navy","overlayOpacity","InputWrapper","withAsterisk","TextInput","radius","description","paddingBottom","Tooltip","withArrow","withinPortal","Breadcrumbs","separator","ArrowHeadRightSize24Px","Loader","DateRangePicker","cell","textAlign","Anchor","hover","textDecoration","action","Checkbox","List","listStyleType","Radio","labelWrapper","display","alignItems"],"mappings":"AAAA;;;;+BAMaA,aAAW;;;eAAXA,WAAW;;;;;gCAN2B,6BAA6B;4BAC5D,wBAAwB;4BAGjB,gBAAgB;AAEpC,IAAMA,WAAW,GAAyB;IAC7CC,WAAW,EAAE,OAAO;IACpBC,UAAU,EAAE,gCAAgC;IAC5CC,KAAK,EAAEC,aAAK,MAAA,CAACC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;IAC5BC,aAAa,EAAE,CAAC;IAChBC,OAAO,EAAE;QACLC,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,EAAE;QACNC,EAAE,EAAE,EAAE;QACNC,EAAE,EAAE,EAAE;QACNC,EAAE,EAAE,EAAE;KACT;IACDC,YAAY,EAAE,QAAQ;IACtBC,QAAQ,EAAE;QACNb,UAAU,EAAE,gCAAgC;QAC5Cc,UAAU,EAAE,GAAG;QACfC,KAAK,EAAE;YACHC,EAAE,EAAE;gBAACC,QAAQ,EAAE,EAAE;gBAAEC,UAAU,EAAE,MAAM;gBAAEJ,UAAU,EAAEK,SAAS;aAAC;YAC7DC,EAAE,EAAE;gBAACH,QAAQ,EAAE,EAAE;gBAAEC,UAAU,EAAE,MAAM;gBAAEJ,UAAU,EAAEK,SAAS;aAAC;YAC7DE,EAAE,EAAE;gBAACJ,QAAQ,EAAE,EAAE;gBAAEC,UAAU,EAAE,MAAM;gBAAEJ,UAAU,EAAEK,SAAS;aAAC;YAC7DG,EAAE,EAAE;gBAACL,QAAQ,EAAE,EAAE;gBAAEC,UAAU,EAAE,MAAM;gBAAEJ,UAAU,EAAEK,SAAS;aAAC;YAC7DI,EAAE,EAAE;gBAACN,QAAQ,EAAE,EAAE;gBAAEC,UAAU,EAAE,MAAM;gBAAEJ,UAAU,EAAEK,SAAS;aAAC;YAC7DK,EAAE,EAAE;gBAACP,QAAQ,EAA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C,IAAI,EAAE,kBACCD,KAAK,CAACY,EAAE,CAACqB,KAAK,CAAC;wBACdC,cAAc,EAAE,WAAW;wBAC3BrE,KAAK,EAAEmC,KAAK,CAACX,MAAM,CAAC8C,MAAM,CAAC,CAAC,CAAC;qBAChC,CAAC,CACL;iBACJ;aAAC;SACL;QACDC,QAAQ,EAAE;YACN3C,YAAY,EAAE;gBACV0B,MAAM,EAAE,IAAI;aACf;SACJ;QACDkB,IAAI,EAAE;YACFxC,MAAM,EAAE;uBAAO;oBACXI,IAAI,EAAE;wBACFqC,aAAa,EAAE,MAAM;qBACxB;iBACJ;aAAC;SACL;QACDC,KAAK,EAAE;YACH1C,MAAM,EAAE;gBACJ2C,YAAY,EAAE;oBACVC,OAAO,EAAE,MAAM;oBACfC,UAAU,EAAE,YAAY;iBAC3B;aACJ;SACJ;KACJ;CACJ,AAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ModalProps } from '@mantine/core';
|
|
1
2
|
import { ReactElement } from 'react';
|
|
2
3
|
import { ModalWizardStep } from './ModalWizardStep';
|
|
3
|
-
interface ModalWizardProps {
|
|
4
|
+
interface ModalWizardProps extends Omit<ModalProps, 'centered' | 'title'> {
|
|
4
5
|
/**
|
|
5
6
|
* The label of the cancel button
|
|
6
7
|
*
|
|
@@ -33,10 +34,6 @@ interface ModalWizardProps {
|
|
|
33
34
|
* A callback function that is executed when the user clicks on the previous button
|
|
34
35
|
*/
|
|
35
36
|
onPrevious?: () => unknown;
|
|
36
|
-
/**
|
|
37
|
-
* A callback function that is executed when the user clicks on the cancel button
|
|
38
|
-
*/
|
|
39
|
-
onClose?: () => unknown;
|
|
40
37
|
/**
|
|
41
38
|
* A function that is executed when user completes all the steps.
|
|
42
39
|
*
|
|
@@ -51,21 +48,13 @@ interface ModalWizardProps {
|
|
|
51
48
|
* A function to confirm close if the state is dirty before closing
|
|
52
49
|
*/
|
|
53
50
|
handleDirtyState?: () => boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Props to pass to each modal
|
|
56
|
-
*/
|
|
57
|
-
modalProps?: any;
|
|
58
|
-
/**
|
|
59
|
-
* Label for close button
|
|
60
|
-
*/
|
|
61
|
-
closeButtonLabel?: string;
|
|
62
51
|
/**
|
|
63
52
|
* Children to display in modal wizard
|
|
64
53
|
* */
|
|
65
54
|
children?: Array<ReturnType<typeof ModalWizardStep>>;
|
|
66
55
|
}
|
|
67
56
|
interface ModalWizardType {
|
|
68
|
-
|
|
57
|
+
(props: ModalWizardProps): ReactElement;
|
|
69
58
|
Step: typeof ModalWizardStep;
|
|
70
59
|
}
|
|
71
60
|
export declare const ModalWizard: ModalWizardType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalWizard.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModalWizard.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAW,MAAM,eAAe,CAAC;AAClE,OAAO,EAAW,YAAY,EAAoB,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAGlD,UAAU,gBAAiB,SAAQ,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IACrE;;;;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,eA0GzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../src/theme/Theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqB,oBAAoB,EAAoB,MAAM,eAAe,CAAC;AAI1F,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../src/theme/Theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqB,oBAAoB,EAAoB,MAAM,eAAe,CAAC;AAI1F,eAAO,MAAM,WAAW,EAAE,oBAoJzB,CAAC"}
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import _object_spread from "@swc/helpers/src/_object_spread.mjs";
|
|
2
2
|
import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
|
|
3
|
+
import _object_without_properties from "@swc/helpers/src/_object_without_properties.mjs";
|
|
3
4
|
import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs";
|
|
4
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { Button,
|
|
6
|
+
import { Button, Modal, Progress } from "@mantine/core";
|
|
6
7
|
import { Children, useMemo, useState } from "react";
|
|
7
8
|
import { StickyFooter } from "../sticky-footer";
|
|
8
9
|
import { ModalWizardStep } from "./ModalWizardStep";
|
|
9
10
|
import { Header } from "../header";
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
export var ModalWizard = function(_param) {
|
|
12
|
+
var _cancelButtonLabel = _param.cancelButtonLabel, cancelButtonLabel = _cancelButtonLabel === void 0 ? "Cancel" : _cancelButtonLabel, _nextButtonLabel = _param.nextButtonLabel, nextButtonLabel = _nextButtonLabel === void 0 ? "Next" : _nextButtonLabel, _previousButtonLabel = _param.previousButtonLabel, previousButtonLabel = _previousButtonLabel === void 0 ? "Previous" : _previousButtonLabel, _finishButtonLabel = _param.finishButtonLabel, finishButtonLabel = _finishButtonLabel === void 0 ? "Finish" : _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, [
|
|
13
|
+
"cancelButtonLabel",
|
|
14
|
+
"nextButtonLabel",
|
|
15
|
+
"previousButtonLabel",
|
|
16
|
+
"finishButtonLabel",
|
|
17
|
+
"opened",
|
|
18
|
+
"onNext",
|
|
19
|
+
"onPrevious",
|
|
20
|
+
"onClose",
|
|
21
|
+
"onFinish",
|
|
22
|
+
"isDirty",
|
|
23
|
+
"handleDirtyState",
|
|
24
|
+
"classNames",
|
|
25
|
+
"children"
|
|
26
|
+
]);
|
|
21
27
|
var ref, ref1;
|
|
22
28
|
var ref2 = _sliced_to_array(useState(0), 2), currentStepIndex = ref2[0], setCurrentStepIndex = ref2[1];
|
|
23
29
|
var modalSteps = Children.toArray(children).filter(function(child) {
|
|
@@ -37,7 +43,6 @@ export var ModalWizard = function(param) {
|
|
|
37
43
|
isValid: true
|
|
38
44
|
}).isValid;
|
|
39
45
|
var isModalDirty = isDirty && isDirty();
|
|
40
|
-
var classes = useStyles().classes;
|
|
41
46
|
var closeModalWizard = function() {
|
|
42
47
|
if (isModalDirty && handleDirtyState) {
|
|
43
48
|
handleDirtyState() && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
@@ -57,15 +62,11 @@ export var ModalWizard = function(param) {
|
|
|
57
62
|
currentStepIndex
|
|
58
63
|
]);
|
|
59
64
|
return /*#__PURE__*/ _jsxs(Modal, _object_spread_props(_object_spread({
|
|
60
|
-
opened:
|
|
61
|
-
classNames:
|
|
62
|
-
modal: classes.modal
|
|
63
|
-
},
|
|
65
|
+
opened: opened,
|
|
66
|
+
classNames: classNames,
|
|
64
67
|
centered: true,
|
|
65
|
-
closeButtonLabel: closeButtonLabel,
|
|
66
|
-
padding: "xl",
|
|
67
68
|
title: /*#__PURE__*/ _jsx(Header, {
|
|
68
|
-
docLink: currentStep.props.
|
|
69
|
+
docLink: currentStep.props.docLink,
|
|
69
70
|
description: typeof currentStep.props.description === "function" ? currentStep.props.description(currentStepIndex + 1, numberOfSteps) : currentStep.props.description,
|
|
70
71
|
py: null,
|
|
71
72
|
px: null,
|
|
@@ -75,6 +76,8 @@ export var ModalWizard = function(param) {
|
|
|
75
76
|
}, modalProps), {
|
|
76
77
|
children: [
|
|
77
78
|
currentStep.props.showProgressBar && /*#__PURE__*/ _jsx(Progress, {
|
|
79
|
+
color: "teal",
|
|
80
|
+
size: "lg",
|
|
78
81
|
value: getProgressMemo
|
|
79
82
|
}),
|
|
80
83
|
currentStep,
|
|
@@ -87,7 +90,7 @@ export var ModalWizard = function(param) {
|
|
|
87
90
|
/*#__PURE__*/ _jsx(Button, {
|
|
88
91
|
name: isFirstStep ? cancelButtonLabel : previousButtonLabel,
|
|
89
92
|
disabled: false,
|
|
90
|
-
size: "
|
|
93
|
+
size: "sm",
|
|
91
94
|
variant: "outline",
|
|
92
95
|
onClick: function() {
|
|
93
96
|
if (isFirstStep) {
|
|
@@ -101,7 +104,7 @@ export var ModalWizard = function(param) {
|
|
|
101
104
|
}),
|
|
102
105
|
/*#__PURE__*/ _jsx(Button, {
|
|
103
106
|
disabled: !isValid,
|
|
104
|
-
size: "
|
|
107
|
+
size: "sm",
|
|
105
108
|
onClick: function() {
|
|
106
109
|
if (isLastStep) {
|
|
107
110
|
onFinish ? onFinish() : onClose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Button, createStyles, Modal, 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 {\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\n nextButtonLabel?: string;\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\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 callback function that is executed when the user clicks on the cancel button\n */\n\n onClose?: () => 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\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 * Props to pass to each modal\n */\n modalProps?: any;\n\n /**\n * Label for close button\n */\n closeButtonLabel?: string;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n}\n\nconst useStyles = createStyles(() => ({\n modal: {\n height: '70%',\n display: 'flex',\n flexDirection: 'column',\n },\n}));\n\ninterface ModalWizardType {\n <T>(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 onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n modalProps,\n handleDirtyState,\n closeButtonLabel,\n children,\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 {classes} = useStyles();\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\n classNames={{modal: classes.modal}}\n centered\n closeButtonLabel={closeButtonLabel}\n padding=\"xl\"\n title={\n <Header\n docLink={currentStep.props.docLin}\n description={\n typeof currentStep.props.description === 'function'\n ? currentStep.props.description(currentStepIndex + 1, numberOfSteps)\n : currentStep.props.description\n }\n py={null}\n px={null}\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 value={getProgressMemo} />}\n {currentStep}\n <StickyFooter borderTop py={null} px={null} pt=\"md\">\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n disabled={false}\n size=\"md\"\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=\"md\"\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","createStyles","Modal","Progress","Children","useMemo","useState","StickyFooter","ModalWizardStep","Header","useStyles","modal","height","display","flexDirection","ModalWizard","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","onNext","onPrevious","onClose","onFinish","isDirty","modalProps","handleDirtyState","closeButtonLabel","children","currentStep","currentStepIndex","setCurrentStepIndex","modalSteps","toArray","filter","child","type","numberOfSteps","length","numberOfStepsCountAsProgress","step","props","countsAsProgress","isFirstStep","isLastStep","index","isValid","validateStep","isModalDirty","classes","closeModalWizard","getProgress","currStepIndex","validSteps","getProgressMemo","opened","classNames","centered","padding","title","docLink","docLin","description","py","px","showProgressBar","value","borderTop","pt","name","disabled","size","variant","onClick","Step"],"mappings":"AAAA;;;;AAAA,SAAQA,MAAM,EAAEC,YAAY,EAAEC,KAAK,EAAEC,QAAQ,QAAO,eAAe,CAAC;AACpE,SAAQC,QAAQ,EAAgBC,OAAO,EAAEC,QAAQ,QAAO,OAAO,CAAC;AAChE,SAAQC,YAAY,QAAO,kBAAkB,CAAC;AAC9C,SAAQC,eAAe,QAAO,mBAAmB,CAAC;AAClD,SAAQC,MAAM,QAAO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AE,IAAI;gBAAEC,EAAE,EAAE,IAAI;gBAAEI,EAAE,EAAC,IAAI;;kCAC/C,KAACpE,MAAM;wBACHqE,IAAI,EAAE1B,WAAW,GAAG3B,iBAAiB,GAAGE,mBAAmB;wBAC3DoD,QAAQ,EAAE,KAAK;wBACfC,IAAI,EAAC,IAAI;wBACTC,OAAO,EAAC,SAAS;wBACjBC,OAAO,EAAE,WAAM;4BACX,IAAI9B,WAAW,EAAE;gCACbO,gBAAgB,EAAE,CAAC;4BACvB,OAAO;gCACH7B,UAAU,aAAVA,UAAU,WAAI,GAAdA,KAAAA,CAAc,GAAdA,UAAU,EAAI,CAAC;gCACfU,mBAAmB,CAACD,gBAAgB,GAAG,CAAC,CAAC,CAAC;4BAC9C,CAAC;wBACL,CAAC;kCAEAa,WAAW,GAAG3B,iBAAiB,GAAGE,mBAAmB;sBACjD;kCAET,KAAClB,MAAM;wBACHsE,QAAQ,EAAE,CAACxB,OAAO;wBAClByB,IAAI,EAAC,IAAI;wBACTE,OAAO,EAAE,WAAM;4BACX,IAAI7B,UAAU,EAAE;gCACZrB,QAAQ,GAAGA,QAAQ,EAAE,GAAGD,OAAO,EAAE,CAAC;4BACtC,OAAO;gCACHF,MAAM,aAANA,MAAM,WAAI,GAAVA,KAAAA,CAAU,GAAVA,MAAM,EAAI,CAAC;gCACXW,mBAAmB,CAACD,gBAAgB,GAAG,CAAC,CAAC,CAAC;4BAC9C,CAAC;wBACL,CAAC;kCAEAc,UAAU,GAAGzB,iBAAiB,GAAGF,eAAe;sBAC5C;;cACE;;OACX,CACV;AACN,CAAC,CAAC;AAEFF,WAAW,CAAC2D,IAAI,GAAGlE,eAAe,CAAC"}
|
|
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={null}\n px={null}\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 borderTop py={null} px={null} pt=\"md\">\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","borderTop","pt","name","disabled","variant","onClick","Step"],"mappings":"AAAA;;;;;AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAcC,QAAQ,QAAO,eAAe,CAAC;AAClE,SAAQC,QAAQ,EAAgBC,OAAO,EAAEC,QAAQ,QAAO,OAAO,CAAC;AAChE,SAAQC,YAAY,QAAO,kBAAkB,CAAC;AAC9C,SAAQC,eAAe,QAAO,mBAAmB,CAAC;AAClD,SAAQC,MAAM,QAAO,WAAW,CAAC;AAsEjC,OAAO,IAAMC,WAAW,GAAoB,iBAetC;oCAdFC,iBAAiB,EAAjBA,iBAAiB,mCAAG,QAAQ,qBAAA,4BAC5BC,eAAe,EAAfA,eAAe,iCAAG,MAAM,mBAAA,gCACxBC,mBAAmB,EAAnBA,mBAAmB,qCAAG,UAAU,uBAAA,8BAChCC,iBAAiB,EAAjBA,iBAAiB,mCAAG,QAAQ,qBAAA,EAC5BC,MAAM,UAANA,MAAM,EACNC,MAAM,UAANA,MAAM,EACNC,UAAU,UAAVA,UAAU,EACVC,OAAO,UAAPA,OAAO,EACPC,QAAQ,UAARA,QAAQ,EACRC,OAAO,UAAPA,OAAO,EACPC,gBAAgB,UAAhBA,gBAAgB,EAChBC,UAAU,UAAVA,UAAU,EACVC,QAAQ,UAARA,QAAQ,EACLC,UAAU;QAbbb,mBAAiB;QACjBC,iBAAe;QACfC,qBAAmB;QACnBC,mBAAiB;QACjBC,QAAM;QACNC,QAAM;QACNC,YAAU;QACVC,SAAO;QACPC,UAAQ;QACRC,SAAO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MAAM,WAAI,GAAVA,KAAAA,CAAU,GAAVA,MAAM,EAAI,CAAC;gCACXW,mBAAmB,CAACD,gBAAgB,GAAG,CAAC,CAAC,CAAC;4BAC9C,CAAC;wBACL,CAAC;kCAEAc,UAAU,GAAG1B,iBAAiB,GAAGF,eAAe;sBAC5C;;cACE;;OACX,CACV;AACN,CAAC,CAAC;AAEFF,WAAW,CAACwD,IAAI,GAAG1D,eAAe,CAAC"}
|
package/dist/esm/theme/Theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {ArrowHeadRightSize24Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {ButtonStylesParams, MantineThemeOverride, ModalStylesParams} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n spacing: {\n xs: 8,\n sm: 16,\n md: 24,\n lg: 32,\n xl: 40,\n },\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: 48, lineHeight: '56px', fontWeight: undefined},\n h2: {fontSize: 32, lineHeight: '40px', fontWeight: undefined},\n h3: {fontSize: 28, lineHeight: '40px', fontWeight: undefined},\n h4: {fontSize: 24, lineHeight: '32px', fontWeight: undefined},\n h5: {fontSize: 18, lineHeight: '28px', fontWeight: undefined},\n h6: {fontSize: 16, lineHeight: '24px', fontWeight: undefined},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: (theme) => ({\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em', color: theme.colors.gray[9]},\n },\n }),\n },\n Button: {\n styles: (theme, params: ButtonStylesParams) => ({\n root: {\n '&': {fontWeight: 400},\n backgroundColor: params.variant === 'outline' ? 'white' : undefined,\n },\n }),\n },\n Modal: {\n styles: (theme, {size, fullScreen}: ModalStylesParams) => ({\n modal: {\n width: fullScreen\n ? undefined\n : theme.fn.size({size, sizes: {xs: 320, sm: 440, md: '45%', lg: 1334, xl: '85%'}}),\n },\n }),\n defaultProps: {\n overlayColor: color.primary.navy[9],\n overlayOpacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n styles: (theme) => ({\n description: {\n fontSize: 'inherit',\n paddingBottom: theme.spacing.xs,\n },\n }),\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n withArrow: true,\n withinPortal: true,\n },\n },\n Breadcrumbs: {\n defaultProps: {\n separator: <ArrowHeadRightSize24Px height={24} />,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n
|
|
1
|
+
{"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {ArrowHeadRightSize24Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {ButtonStylesParams, MantineThemeOverride, ModalStylesParams} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n spacing: {\n xs: 8,\n sm: 16,\n md: 24,\n lg: 32,\n xl: 40,\n },\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: 48, lineHeight: '56px', fontWeight: undefined},\n h2: {fontSize: 32, lineHeight: '40px', fontWeight: undefined},\n h3: {fontSize: 28, lineHeight: '40px', fontWeight: undefined},\n h4: {fontSize: 24, lineHeight: '32px', fontWeight: undefined},\n h5: {fontSize: 18, lineHeight: '28px', fontWeight: undefined},\n h6: {fontSize: 16, lineHeight: '24px', fontWeight: undefined},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: (theme) => ({\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em', color: theme.colors.gray[9]},\n },\n }),\n },\n Button: {\n styles: (theme, params: ButtonStylesParams) => ({\n root: {\n '&': {fontWeight: 400},\n backgroundColor: params.variant === 'outline' ? 'white' : undefined,\n },\n }),\n },\n Modal: {\n styles: (theme, {size, fullScreen}: ModalStylesParams) => ({\n modal: {\n width: fullScreen\n ? undefined\n : theme.fn.size({size, sizes: {xs: 320, sm: 440, md: '45%', lg: 1334, xl: '85%'}}),\n },\n }),\n defaultProps: {\n overlayColor: color.primary.navy[9],\n overlayOpacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n styles: (theme) => ({\n description: {\n fontSize: 'inherit',\n paddingBottom: theme.spacing.xs,\n },\n }),\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n withArrow: true,\n withinPortal: true,\n },\n },\n Breadcrumbs: {\n defaultProps: {\n separator: <ArrowHeadRightSize24Px height={24} />,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n },\n List: {\n styles: () => ({\n root: {\n listStyleType: 'disc',\n },\n }),\n },\n Radio: {\n styles: {\n labelWrapper: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n },\n },\n },\n};\n"],"names":["ArrowHeadRightSize24Px","InfoSize24Px","color","PlasmaColors","plasmaTheme","colorScheme","fontFamily","black","primary","gray","defaultRadius","spacing","xs","sm","md","lg","xl","primaryColor","headings","fontWeight","sizes","h1","fontSize","lineHeight","undefined","h2","h3","h4","h5","h6","shadows","colors","components","Alert","defaultProps","icon","height","styles","title","Title","theme","root","letterSpacing","Button","params","backgroundColor","variant","Modal","size","fullScreen","modal","width","fn","overlayColor","navy","overlayOpacity","InputWrapper","withAsterisk","TextInput","radius","description","paddingBottom","Tooltip","withArrow","withinPortal","Breadcrumbs","separator","Loader","DateRangePicker","cell","textAlign","Anchor","hover","textDecoration","action","Checkbox","List","listStyleType","Radio","labelWrapper","display","alignItems"],"mappings":"AAAA;;AAAA,SAAQA,sBAAsB,EAAEC,YAAY,QAAO,6BAA6B,CAAC;AACjF,SAA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