@drivy/cobalt 1.3.0 → 1.3.2
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.
|
@@ -7,9 +7,7 @@ const MultiStepModal = ({ stepData = null, close, steps, onHidden, useMidSizeHei
|
|
|
7
7
|
const [currentStep, setCurrentStep] = useState(0);
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
var _a, _b;
|
|
10
|
-
(_b = (_a = bodyScrollContentRef.current) === null || _a === void 0 ? void 0 : _a.children.item(currentStep)) === null || _b === void 0 ? void 0 : _b.scrollIntoView(
|
|
11
|
-
behavior: "smooth",
|
|
12
|
-
});
|
|
10
|
+
(_b = (_a = bodyScrollContentRef.current) === null || _a === void 0 ? void 0 : _a.children.item(currentStep)) === null || _b === void 0 ? void 0 : _b.scrollIntoView();
|
|
13
11
|
}, [currentStep]);
|
|
14
12
|
const handleNextStep = () => {
|
|
15
13
|
setCurrentStep(currentStep >= steps.length - 1 ? currentStep : currentStep + 1);
|
|
@@ -32,7 +30,7 @@ const MultiStepModal = ({ stepData = null, close, steps, onHidden, useMidSizeHei
|
|
|
32
30
|
? "c-opacity-0 c-grid-rows-[0.5fr]"
|
|
33
31
|
: "c-opacity-0 c-grid-rows-[0fr]";
|
|
34
32
|
return (React.createElement(Modal, { ...modalProps, title: React.createElement(CurrentStepComponents.title, { ...stepProps }), close: close, onHidden: onModalClosed },
|
|
35
|
-
React.createElement("div", { className: "c-w-full c-overflow-x-hidden" },
|
|
33
|
+
React.createElement("div", { className: "c-w-full c-overflow-x-hidden c-scroll-smooth" },
|
|
36
34
|
React.createElement("div", { className: "c-py-sm", ref: bodyScrollContentRef, style: { width: `${steps.length * 100}%` } }, steps.map((StepComponents, index) => {
|
|
37
35
|
return (React.createElement("div", { key: "modal_step_" + index, className: cx("c-inline-grid c-align-top c-transition-all c-duration-500", {
|
|
38
36
|
"c-opacity-100 c-grid-rows-[1fr]": index === currentStep,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiStepModal.js","sources":["../../../src/components/Modal/MultiStepModal.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\"\nimport cx from \"classnames\"\nimport Modal, { ModalPropsType } from \".\"\n\ntype StepComponentType<T> = (props: {\n navigation: {\n nextStep: () => void\n previousStep: () => void\n closeModal: () => void\n }\n data: T\n}) => React.ReactNode\n\nexport type ModalStepType<T> = {\n title: StepComponentType<T>\n content: StepComponentType<T>\n footer?: StepComponentType<T>\n}\n\ntype MultiStepsModalProps<T = null> = {\n stepData?: T\n close: () => void\n onHidden?: (currentStepIndex: number) => void\n steps: ModalStepType<T>[]\n useMidSizeHeight?: boolean\n} & Omit<ModalPropsType, \"children\" | \"onHidden\" | \"close\">\n\nconst MultiStepModal = <T,>({\n stepData = null as T,\n close,\n steps,\n onHidden,\n useMidSizeHeight = true,\n ...modalProps\n}: MultiStepsModalProps<T>) => {\n const bodyScrollContentRef = useRef<HTMLDivElement>(null)\n const [currentStep, setCurrentStep] = useState(0)\n\n useEffect(() => {\n bodyScrollContentRef.current?.children.item(currentStep)?.scrollIntoView(
|
|
1
|
+
{"version":3,"file":"MultiStepModal.js","sources":["../../../src/components/Modal/MultiStepModal.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\"\nimport cx from \"classnames\"\nimport Modal, { ModalPropsType } from \".\"\n\ntype StepComponentType<T> = (props: {\n navigation: {\n nextStep: () => void\n previousStep: () => void\n closeModal: () => void\n }\n data: T\n}) => React.ReactNode\n\nexport type ModalStepType<T> = {\n title: StepComponentType<T>\n content: StepComponentType<T>\n footer?: StepComponentType<T>\n}\n\ntype MultiStepsModalProps<T = null> = {\n stepData?: T\n close: () => void\n onHidden?: (currentStepIndex: number) => void\n steps: ModalStepType<T>[]\n useMidSizeHeight?: boolean\n} & Omit<ModalPropsType, \"children\" | \"onHidden\" | \"close\">\n\nconst MultiStepModal = <T,>({\n stepData = null as T,\n close,\n steps,\n onHidden,\n useMidSizeHeight = true,\n ...modalProps\n}: MultiStepsModalProps<T>) => {\n const bodyScrollContentRef = useRef<HTMLDivElement>(null)\n const [currentStep, setCurrentStep] = useState(0)\n\n useEffect(() => {\n bodyScrollContentRef.current?.children.item(currentStep)?.scrollIntoView()\n }, [currentStep])\n\n const handleNextStep = () => {\n setCurrentStep(\n currentStep >= steps.length - 1 ? currentStep : currentStep + 1\n )\n }\n\n const handlePreviousStep = () => {\n setCurrentStep(currentStep <= 0 ? 0 : currentStep - 1)\n }\n\n const onModalClosed = () => {\n onHidden?.(currentStep)\n setCurrentStep(0)\n }\n\n const navigation = {\n nextStep: handleNextStep,\n previousStep: handlePreviousStep,\n closeModal: close,\n }\n\n const CurrentStepComponents = steps[currentStep]\n const stepProps = { data: stepData, navigation }\n\n const minimumScale = useMidSizeHeight\n ? \"c-opacity-0 c-grid-rows-[0.5fr]\"\n : \"c-opacity-0 c-grid-rows-[0fr]\"\n\n return (\n <Modal\n {...modalProps}\n title={<CurrentStepComponents.title {...stepProps} />}\n close={close}\n onHidden={onModalClosed}\n >\n <div className=\"c-w-full c-overflow-x-hidden c-scroll-smooth\">\n <div\n className=\"c-py-sm\"\n ref={bodyScrollContentRef}\n style={{ width: `${steps.length * 100}%` }}\n >\n {steps.map((StepComponents, index) => {\n return (\n <div\n key={\"modal_step_\" + index}\n className={cx(\n \"c-inline-grid c-align-top c-transition-all c-duration-500\",\n {\n \"c-opacity-100 c-grid-rows-[1fr]\": index === currentStep,\n [minimumScale]: index !== currentStep,\n }\n )}\n style={{ width: `${100 / steps.length}%` }}\n >\n <div className=\"c-overflow-hidden\">\n <StepComponents.content {...stepProps} />\n </div>\n </div>\n )\n })}\n </div>\n </div>\n {CurrentStepComponents.footer && (\n <Modal.Footer>\n <CurrentStepComponents.footer {...stepProps} />\n </Modal.Footer>\n )}\n </Modal>\n )\n}\n\nexport default MultiStepModal\n"],"names":[],"mappings":";;;;AA2BM,MAAA,cAAc,GAAG,CAAK,EAC1B,QAAQ,GAAG,IAAS,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C,CAAA,aAAA,CAAA,KAAK,CAAC,MAAM,EAAA,IAAA;YACX,KAAC,CAAA,aAAA,CAAA,qBAAqB,CAAC,MAAM,EAAK,EAAA,GAAA,SAAS,GAAI,CAClC,CAChB,CACK,EACT;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drivy/cobalt",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Opinionated design system for Drivy's projects.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/src/index.d.ts",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@types/lodash.throttle": "4.1.9",
|
|
61
61
|
"@types/media-typer": "1.1.3",
|
|
62
62
|
"@types/node": "22.14.1",
|
|
63
|
-
"@types/react": "18.3.
|
|
64
|
-
"@types/react-dom": "18.3.
|
|
63
|
+
"@types/react": "18.3.20",
|
|
64
|
+
"@types/react-dom": "18.3.6",
|
|
65
65
|
"autoprefixer": "10.4.21",
|
|
66
66
|
"core-js": "3.41.0",
|
|
67
67
|
"css-loader": "7.1.2",
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
.cobalt- {
|
|
2
|
-
&alerter {
|
|
3
|
-
// Force alerts to display bottom-end when larger than mobile
|
|
4
|
-
@include breakpoint($from: "md") {
|
|
5
|
-
align-items: flex-end !important;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
2
|
&alert {
|
|
10
3
|
@apply c-text-body-md c-p-sm c-mx-sm c-mb-sm c-shadow-md c-rounded-md;
|
|
11
4
|
z-index: var(--z-index);
|
|
@@ -15,25 +15,19 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
&[data-placement^="top"] > .tippy-arrow::before {
|
|
18
|
-
border-top-color:
|
|
18
|
+
border-top-color: theme("semanticBackgroundColor.secondary") !important;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&[data-placement^="bottom"] > .tippy-arrow::before {
|
|
22
|
-
border-bottom-color:
|
|
23
|
-
--theme-semanticBackgroundColor-secondary
|
|
24
|
-
) !important;
|
|
22
|
+
border-bottom-color: theme("semanticBackgroundColor.secondary") !important;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
&[data-placement^="left"] > .tippy-arrow::before {
|
|
28
|
-
border-left-color:
|
|
29
|
-
--theme-semanticBackgroundColor-secondary
|
|
30
|
-
) !important;
|
|
26
|
+
border-left-color: theme("semanticBackgroundColor.secondary") !important;
|
|
31
27
|
}
|
|
32
28
|
|
|
33
29
|
&[data-placement^="right"] > .tippy-arrow::before {
|
|
34
|
-
border-right-color:
|
|
35
|
-
--theme-semanticBackgroundColor-secondary
|
|
36
|
-
) !important;
|
|
30
|
+
border-right-color: theme("semanticBackgroundColor.secondary") !important;
|
|
37
31
|
}
|
|
38
32
|
}
|
|
39
33
|
|
|
@@ -59,13 +53,13 @@
|
|
|
59
53
|
|
|
60
54
|
.use-cobalt-dark-theme {
|
|
61
55
|
[data-theme~="cobalt-popover"] {
|
|
62
|
-
box-shadow: 0 0 0 1px
|
|
56
|
+
box-shadow: 0 0 0 1px theme("semanticBorderColor.base");
|
|
63
57
|
|
|
64
58
|
&[data-placement^="top"] > .tippy-arrow {
|
|
65
59
|
bottom: -1px;
|
|
66
60
|
|
|
67
61
|
&::before {
|
|
68
|
-
border-top-color:
|
|
62
|
+
border-top-color: theme("semanticBorderColor.base") !important;
|
|
69
63
|
}
|
|
70
64
|
}
|
|
71
65
|
|
|
@@ -73,7 +67,7 @@
|
|
|
73
67
|
top: -1px;
|
|
74
68
|
|
|
75
69
|
&::before {
|
|
76
|
-
border-bottom-color:
|
|
70
|
+
border-bottom-color: theme("semanticBorderColor.base") !important;
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
73
|
|
|
@@ -81,7 +75,7 @@
|
|
|
81
75
|
right: -1px;
|
|
82
76
|
|
|
83
77
|
&::before {
|
|
84
|
-
border-left-color:
|
|
78
|
+
border-left-color: theme("semanticBorderColor.base") !important;
|
|
85
79
|
}
|
|
86
80
|
}
|
|
87
81
|
|
|
@@ -89,7 +83,7 @@
|
|
|
89
83
|
left: -1px;
|
|
90
84
|
|
|
91
85
|
&::before {
|
|
92
|
-
border-right-color:
|
|
86
|
+
border-right-color: theme("semanticBorderColor.base") !important;
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
89
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.cobalt-circularProgressBar {
|
|
2
2
|
--content-size: 64px;
|
|
3
3
|
--total-size: calc((var(--content-size) / 4) + var(--content-size));
|
|
4
|
-
--progress-color:
|
|
4
|
+
--progress-color: theme("semanticFillColor.base");
|
|
5
5
|
|
|
6
6
|
position: relative;
|
|
7
7
|
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
&--info {
|
|
75
|
-
--progress-color:
|
|
75
|
+
--progress-color: theme("semanticFillColor.secondary");
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
&--error {
|
|
79
|
-
--progress-color:
|
|
79
|
+
--progress-color: theme("semanticFillColor.error");
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
&--success {
|
|
83
|
-
--progress-color:
|
|
83
|
+
--progress-color: theme("semanticFillColor.success");
|
|
84
84
|
}
|
|
85
85
|
}
|