@yamatozhen/design_system 1.0.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +101 -101
- package/package.json +50 -50
- package/scripts/postinstall.js +91 -91
- package/template/app/ClientNav.tsx +258 -310
- package/template/app/globals.css +2 -167
- package/template/app/layout.tsx +94 -82
- package/template/app/themes/dark-mc.css +51 -51
- package/template/app/themes/dark.css +51 -51
- package/template/app/themes/light-mc.css +51 -51
- package/template/app/themes/light.css +51 -51
- package/template/app/themes/theme.css +272 -82
- package/template/components/{layout/button → (buttons)}/Button.module.css +351 -305
- package/template/components/{layout/button → (buttons)}/ButtonGroup.tsx +414 -503
- package/template/components/{layout/button → (buttons)}/FAB.tsx +119 -118
- package/template/components/(buttons)/button.tsx +164 -0
- package/template/components/(controls)/slider/Slider.module.css +250 -0
- package/template/components/(controls)/slider/Slider.tsx +386 -0
- package/template/components/{layout → (controls)}/switch/Switch.module.css +108 -102
- package/template/components/{layout → (controls)}/switch/Switch.tsx +69 -48
- package/template/components/(date & time)/calendar/Calendar.module.css +125 -0
- package/template/components/(date & time)/calendar/Calendar.tsx +206 -0
- package/template/components/(date & time)/dateField/DateField.module.css +25 -0
- package/template/components/(date & time)/dateField/DateField.tsx +193 -0
- package/template/components/(date & time)/datePicker/DatePicker.tsx +118 -0
- package/template/components/(date & time)/dateRangePicker/DateRangePicker.tsx +144 -0
- package/template/components/(date & time)/rangeCalendar/RangeCalendar.module.css +203 -0
- package/template/components/(date & time)/rangeCalendar/RangeCalendar.tsx +263 -0
- package/template/components/(date & time)/shared/dateUtils.ts +107 -0
- package/template/components/(date & time)/timeField/TimeField.module.css +39 -0
- package/template/components/(date & time)/timeField/TimeField.tsx +158 -0
- package/template/components/(feedback)/circularProgress/CircularProgress.tsx +646 -0
- package/template/components/(feedback)/linearProgress/LinearProgress.tsx +337 -0
- package/template/components/(feedback)/meter/Meter.tsx +111 -0
- package/template/components/(feedback)/skeleton/Skeleton.module.css +49 -0
- package/template/components/(feedback)/skeleton/Skeleton.tsx +32 -0
- package/template/components/(feedback)/spinner/Spinner.module.css +27 -0
- package/template/components/(feedback)/spinner/Spinner.tsx +60 -0
- package/template/components/(forms)/checkbox/Checkbox.tsx +121 -0
- package/template/components/(forms)/checkboxGroup/CheckboxGroup.tsx +83 -0
- package/template/components/(forms)/description/Description.tsx +34 -0
- package/template/components/(forms)/errorMessage/ErrorMessage.tsx +31 -0
- package/template/components/(forms)/fieldError/FieldError.tsx +39 -0
- package/template/components/(forms)/fieldset/Fieldset.tsx +51 -0
- package/template/components/(forms)/form/Form.tsx +54 -0
- package/template/components/(forms)/input/Input.tsx +50 -0
- package/template/components/(forms)/inputGroup/InputGroup.tsx +65 -0
- package/template/components/(forms)/inputOtp/InputOtp.tsx +139 -0
- package/template/components/(forms)/label/Label.tsx +46 -0
- package/template/components/(forms)/numberField/NumberField.tsx +292 -0
- package/template/components/(forms)/radioGroup/RadioGroup.tsx +175 -0
- package/template/components/(forms)/searchField/SearchField.tsx +139 -0
- package/template/components/(forms)/shared/field.module.css +75 -0
- package/template/components/(forms)/shared/fieldContext.ts +28 -0
- package/template/components/(forms)/textArea/TextArea.tsx +55 -0
- package/template/components/(forms)/textField/TextField.tsx +91 -0
- package/template/components/{layout → (layout)}/Lightbox/LightboxCard.tsx +100 -100
- package/template/components/{layout → (layout)}/Lightbox/LightboxGallery.module.css +249 -249
- package/template/components/{layout → (layout)}/Lightbox/LightboxGallery.tsx +72 -72
- package/template/components/{layout → (layout)}/Lightbox/LightboxGrid.tsx +185 -186
- package/template/components/{layout → (layout)}/Lightbox/LightboxModal.module.css +395 -395
- package/template/components/{layout → (layout)}/Lightbox/LightboxModal.tsx +498 -500
- package/template/components/{layout → (layout)}/Lightbox/demo.tsx +396 -412
- package/template/components/{layout → (layout)}/Lightbox/index.ts +30 -30
- package/template/components/{layout → (layout)}/Lightbox/types.ts +101 -113
- package/template/components/{layout → (layout)}/Lightbox/useLightboxFilters.ts +140 -140
- package/template/components/(layout)/accordion/Accordion.module.css +108 -0
- package/template/components/(layout)/accordion/Accordion.tsx +251 -0
- package/template/components/(layout)/card/Card.module.css +136 -0
- package/template/components/(layout)/card/Card.tsx +371 -0
- package/template/components/(layout)/list/List.module.css +83 -0
- package/template/components/(layout)/list/List.tsx +332 -0
- package/template/components/{layout → (layout)}/navigation/Wrap.tsx +41 -41
- package/template/components/(layout)/navigation/breadcrumbs/Breadcrumbs.tsx +145 -0
- package/template/components/{layout/navigation/nav/Nav.module.css → (layout)/navigation/nav/Nav.module.css.old} +474 -508
- package/template/components/{layout → (layout)}/navigation/nav/Nav.tsx +186 -167
- package/template/components/{layout → (layout)}/navigation/nav/NavBar.tsx +396 -419
- package/template/components/{layout → (layout)}/navigation/nav/NavContext.tsx +259 -259
- package/template/components/{layout → (layout)}/navigation/nav/NavItem.tsx +195 -173
- package/template/components/{layout → (layout)}/navigation/nav/NavNew.module.css +406 -373
- package/template/components/{layout → (layout)}/navigation/nav/NavRail.tsx +317 -315
- package/template/components/{layout → (layout)}/navigation/nav/NavSection.tsx +101 -102
- package/template/components/{layout → (layout)}/navigation/nav/NavTab.tsx +25 -25
- package/template/components/{layout → (layout)}/navigation/nav/navftb/NavFTB.module.css +253 -252
- package/template/components/{layout → (layout)}/navigation/nav/navftb/NavFTB.tsx +448 -399
- package/template/components/{layout → (layout)}/navigation/nav/navftb/useTabIndicator.ts +498 -484
- package/template/components/{layout → (layout)}/navigation/nav/navheader/NavHeader.module.css +59 -59
- package/template/components/{layout → (layout)}/navigation/nav/navheader/NavHeader.tsx +465 -473
- package/template/components/(layout)/navigation/pagination/Pagination.tsx +261 -0
- package/template/components/{layout → (layout)}/pages/loadingScreen.tsx +117 -102
- package/template/components/{layout → (layout)}/pages/maintenance/Maintenance.tsx +52 -52
- package/template/components/{layout → (layout)}/pages/maintenance/maintenance.module.css +162 -162
- package/template/components/(layout)/scrollShadow/ScrollShadow.module.css +81 -0
- package/template/components/(layout)/scrollShadow/ScrollShadow.tsx +161 -0
- package/template/components/(layout)/scrollShadow/useScrollShadow.ts +130 -0
- package/template/components/(layout)/separator/Separator.tsx +112 -0
- package/template/components/(overlays)/accessibilityModal/AccessibilityModal.tsx +307 -0
- package/template/components/(overlays)/drawer/Drawer.tsx +953 -0
- package/template/components/(overlays)/modal/Modal.tsx +654 -0
- package/template/components/(overlays)/popover/Popover.tsx +420 -0
- package/template/components/(overlays)/toast/Toast.tsx +692 -0
- package/template/components/(pickers)/autocomplete/Autocomplete.tsx +24 -0
- package/template/components/(pickers)/comboBox/ComboBox.tsx +21 -0
- package/template/components/(pickers)/select/Select.tsx +188 -0
- package/template/components/(pickers)/shared/FilterableField.tsx +223 -0
- package/template/components/(pickers)/shared/PickerItem.ts +13 -0
- package/template/components/tools/CustomScrollbar.tsx +107 -0
- package/template/components/tools/Divider.tsx +11 -11
- package/template/components/tools/ReduceMotionContext.tsx +5 -5
- package/template/components/tools/Sinewave.tsx +396 -199
- package/template/components/tools/SinewaveProgress.tsx +140 -135
- package/template/components/tools/badge/Badge.tsx +28 -28
- package/template/components/tools/dropdown/drop.module.css +196 -0
- package/template/components/tools/dropdown/drop.tsx +568 -0
- package/template/components/tools/easing.ts +118 -0
- package/template/components/tools/flubber.d.ts +6 -6
- package/template/components/tools/footer/Footer.tsx +20 -0
- package/template/components/tools/input/Input.module.css +45 -0
- package/template/components/tools/input/Input.tsx +99 -0
- package/template/components/tools/label/Icon.tsx +39 -0
- package/template/components/tools/label/Label.tsx +156 -0
- package/template/components/tools/mobileViewProvider.tsx +53 -58
- package/template/components/tools/ripple/ripple.css +38 -41
- package/template/components/tools/ripple/ripple.tsx +78 -53
- package/template/components/tools/shape/Shape.module.css +25 -0
- package/template/components/tools/shape/{ShapeMorph.tsx → Shape.tsx} +316 -190
- package/template/components/tools/shape/ShapeLoader.tsx +104 -101
- package/template/components/tools/shape/ShapePaths.ts +116 -116
- package/template/components/tools/switch/Switch.module.css +102 -102
- package/template/components/tools/switch/Switch.tsx +48 -48
- package/template/components/tools/useBodyScrollLock.tsx +27 -27
- package/template/components/tools/useImageColor.ts +47 -47
- package/template/components/tools/useNavSheetDrag.tsx +196 -196
- package/template/components/layout/accordion/Accordion.module.css +0 -149
- package/template/components/layout/accordion/Accordion.tsx +0 -114
- package/template/components/layout/button/button.tsx +0 -128
- package/template/components/layout/button/drop.module.css +0 -229
- package/template/components/layout/button/drop.tsx +0 -516
- package/template/components/layout/hero/v1/heroSlideshow.module.css +0 -107
- package/template/components/layout/hero/v1/heroSlideshow.tsx +0 -233
- package/template/components/layout/modals/accessibilityModal/AccessibilityModal.module.css +0 -126
- package/template/components/layout/modals/accessibilityModal/AccessibilityModal.tsx +0 -290
- package/template/components/layout/modals/alert/Alert.tsx +0 -188
- package/template/components/layout/navigation/MioCard.module.css +0 -88
- package/template/components/layout/navigation/MioCard.tsx +0 -266
- package/template/components/tools/ProgressiveBlur.tsx +0 -73
- package/template/components/tools/icon/icon.module.css +0 -0
- package/template/components/tools/icon/icon.tsx +0 -125
- package/template/components/tools/react-bits/ClickSpark.tsx +0 -177
- package/template/components/tools/react-bits/FadeContent.tsx +0 -90
- package/template/components/tools/react-bits/GlareHover.tsx +0 -73
- package/template/components/tools/react-bits/GradientText/GradientText.css +0 -70
- package/template/components/tools/react-bits/GradientText/GradientText.tsx +0 -44
- package/template/components/tools/react-bits/Magnet.tsx +0 -118
- package/template/components/tools/react-bits/Stepper/Stepper.css +0 -134
- package/template/components/tools/react-bits/Stepper/Stepper.tsx +0 -412
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
.outer-container {
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
min-width: 400px;
|
|
5
|
-
flex: 1 1 0%;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
padding: 1rem;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@media (min-width: 640px) {
|
|
13
|
-
.outer-container {
|
|
14
|
-
aspect-ratio: 4 / 3;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@media (min-width: 768px) {
|
|
19
|
-
.outer-container {
|
|
20
|
-
aspect-ratio: 2 / 1;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.step-circle-container {
|
|
25
|
-
margin-left: auto;
|
|
26
|
-
margin-right: auto;
|
|
27
|
-
width: 100%;
|
|
28
|
-
max-width: 28rem;
|
|
29
|
-
border-radius: 2rem;
|
|
30
|
-
font-size: 16px;
|
|
31
|
-
background-color: var(--md-sys-color-surface-container-low);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/* ── Accessibility: Show Borders ──────────────────────────────────────────── */
|
|
35
|
-
[data-show-borders="true"] .step-circle-container {
|
|
36
|
-
border: var(--a11y-border);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.step-indicator-row {
|
|
40
|
-
display: flex;
|
|
41
|
-
width: 100%;
|
|
42
|
-
align-items: center;
|
|
43
|
-
padding: 2rem;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.step-content-default {
|
|
47
|
-
min-height: 5em;
|
|
48
|
-
height: auto;
|
|
49
|
-
position: relative;
|
|
50
|
-
overflow: hidden;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.step-default {
|
|
54
|
-
min-height: 5em;
|
|
55
|
-
position: relative;
|
|
56
|
-
color: var(--md-sys-color-on-surface);
|
|
57
|
-
padding-left: 2rem;
|
|
58
|
-
padding-right: 2rem;
|
|
59
|
-
p {
|
|
60
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.footer-container {
|
|
65
|
-
padding-left: 1rem;
|
|
66
|
-
padding-right: 1rem;
|
|
67
|
-
padding-bottom: 1rem;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.footer-nav {
|
|
71
|
-
margin-top: 2rem;
|
|
72
|
-
display: flex;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.footer-nav.spread {
|
|
76
|
-
justify-content: space-between;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.footer-nav.end {
|
|
80
|
-
justify-content: flex-end;
|
|
81
|
-
}
|
|
82
|
-
.next-button {
|
|
83
|
-
right: 0;
|
|
84
|
-
}
|
|
85
|
-
.step-indicator {
|
|
86
|
-
position: relative;
|
|
87
|
-
cursor: pointer;
|
|
88
|
-
outline: none;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.step-indicator-inner {
|
|
92
|
-
display: flex;
|
|
93
|
-
height: 2rem;
|
|
94
|
-
width: 2rem;
|
|
95
|
-
align-items: center;
|
|
96
|
-
justify-content: center;
|
|
97
|
-
border-radius: 9999px;
|
|
98
|
-
font-weight: 600;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.active-dot {
|
|
102
|
-
height: 0.75rem;
|
|
103
|
-
width: 0.75rem;
|
|
104
|
-
border-radius: 9999px;
|
|
105
|
-
background-color: var(--md-sys-color-on-primary);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.step-number {
|
|
109
|
-
font-size: 0.875rem;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.step-connector {
|
|
113
|
-
position: relative;
|
|
114
|
-
margin-left: 0.5rem;
|
|
115
|
-
margin-right: 0.5rem;
|
|
116
|
-
height: 0.125rem;
|
|
117
|
-
flex: 1;
|
|
118
|
-
overflow: hidden;
|
|
119
|
-
border-radius: 0.25rem;
|
|
120
|
-
background-color: var(--md-sys-color-surface-container);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.step-connector-inner {
|
|
124
|
-
position: absolute;
|
|
125
|
-
left: 0;
|
|
126
|
-
top: 0;
|
|
127
|
-
height: 100%;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.check-icon {
|
|
131
|
-
height: 1rem;
|
|
132
|
-
width: 1rem;
|
|
133
|
-
color: var(--md-sys-color-on-primary);
|
|
134
|
-
}
|
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useState,
|
|
3
|
-
useEffect,
|
|
4
|
-
Children,
|
|
5
|
-
useRef,
|
|
6
|
-
HTMLAttributes,
|
|
7
|
-
ReactNode,
|
|
8
|
-
JSX,
|
|
9
|
-
} from "react";
|
|
10
|
-
import { motion, AnimatePresence, Variants } from "framer-motion";
|
|
11
|
-
|
|
12
|
-
import "./Stepper.css";
|
|
13
|
-
import Button from "../../../layout/button/button";
|
|
14
|
-
import Icon from "../../icon/icon";
|
|
15
|
-
import FadeContent from "../FadeContent";
|
|
16
|
-
|
|
17
|
-
interface StepperProps extends HTMLAttributes<HTMLDivElement> {
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
initialStep?: number;
|
|
20
|
-
onStepChange?: (step: number) => void;
|
|
21
|
-
onFinalStepCompleted?: () => void;
|
|
22
|
-
stepCircleContainerClassName?: string;
|
|
23
|
-
stepContainerClassName?: string;
|
|
24
|
-
contentClassName?: string;
|
|
25
|
-
footerClassName?: string;
|
|
26
|
-
backButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
27
|
-
nextButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
28
|
-
backButtonText?: string;
|
|
29
|
-
nextButtonText?: string;
|
|
30
|
-
nextButtonIcon?: string;
|
|
31
|
-
lastNextButtonIcon?: string;
|
|
32
|
-
lastNextButtonText?: string;
|
|
33
|
-
disableStepIndicators?: boolean;
|
|
34
|
-
renderStepIndicator?: (props: RenderStepIndicatorProps) => ReactNode;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface RenderStepIndicatorProps {
|
|
38
|
-
step: number;
|
|
39
|
-
currentStep: number;
|
|
40
|
-
onStepClick: (clicked: number) => void;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default function Stepper({
|
|
44
|
-
children,
|
|
45
|
-
initialStep = 1,
|
|
46
|
-
onStepChange = () => {},
|
|
47
|
-
onFinalStepCompleted = () => {},
|
|
48
|
-
stepCircleContainerClassName = "",
|
|
49
|
-
stepContainerClassName = "",
|
|
50
|
-
contentClassName = "",
|
|
51
|
-
footerClassName = "",
|
|
52
|
-
backButtonProps = {},
|
|
53
|
-
nextButtonProps = {},
|
|
54
|
-
backButtonText = "Back",
|
|
55
|
-
nextButtonText = "Continue",
|
|
56
|
-
disableStepIndicators = false,
|
|
57
|
-
renderStepIndicator,
|
|
58
|
-
nextButtonIcon = "keyboard_arrow_right",
|
|
59
|
-
lastNextButtonText = "Complete",
|
|
60
|
-
lastNextButtonIcon = "send",
|
|
61
|
-
...rest
|
|
62
|
-
}: StepperProps) {
|
|
63
|
-
const [currentStep, setCurrentStep] = useState<number>(initialStep);
|
|
64
|
-
const [direction, setDirection] = useState<number>(0);
|
|
65
|
-
const stepsArray = Children.toArray(children);
|
|
66
|
-
const totalSteps = stepsArray.length;
|
|
67
|
-
const isCompleted = currentStep > totalSteps;
|
|
68
|
-
const isLastStep = currentStep === totalSteps;
|
|
69
|
-
|
|
70
|
-
const updateStep = (newStep: number) => {
|
|
71
|
-
setCurrentStep(newStep);
|
|
72
|
-
if (newStep > totalSteps) {
|
|
73
|
-
onFinalStepCompleted();
|
|
74
|
-
} else {
|
|
75
|
-
onStepChange(newStep);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const handleBack = () => {
|
|
80
|
-
if (currentStep > 1) {
|
|
81
|
-
setDirection(-1);
|
|
82
|
-
updateStep(currentStep - 1);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const handleNext = () => {
|
|
87
|
-
if (!isLastStep) {
|
|
88
|
-
setDirection(1);
|
|
89
|
-
updateStep(currentStep + 1);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const handleComplete = () => {
|
|
94
|
-
setDirection(1);
|
|
95
|
-
updateStep(totalSteps + 1);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<FadeContent
|
|
100
|
-
blur={true}
|
|
101
|
-
duration={500}
|
|
102
|
-
easing="ease-out"
|
|
103
|
-
initialOpacity={0}
|
|
104
|
-
>
|
|
105
|
-
<div className="outer-container" {...rest}>
|
|
106
|
-
<div
|
|
107
|
-
className={`step-circle-container elevated${stepCircleContainerClassName}`}
|
|
108
|
-
>
|
|
109
|
-
<div className={`step-indicator-row ${stepContainerClassName}`}>
|
|
110
|
-
{stepsArray.map((_, index) => {
|
|
111
|
-
const stepNumber = index + 1;
|
|
112
|
-
const isNotLastStep = index < totalSteps - 1;
|
|
113
|
-
return (
|
|
114
|
-
<React.Fragment key={stepNumber}>
|
|
115
|
-
{renderStepIndicator ? (
|
|
116
|
-
renderStepIndicator({
|
|
117
|
-
step: stepNumber,
|
|
118
|
-
currentStep,
|
|
119
|
-
onStepClick: (clicked) => {
|
|
120
|
-
setDirection(clicked > currentStep ? 1 : -1);
|
|
121
|
-
updateStep(clicked);
|
|
122
|
-
},
|
|
123
|
-
})
|
|
124
|
-
) : (
|
|
125
|
-
<StepIndicator
|
|
126
|
-
step={stepNumber}
|
|
127
|
-
disableStepIndicators={disableStepIndicators}
|
|
128
|
-
currentStep={currentStep}
|
|
129
|
-
onClickStep={(clicked) => {
|
|
130
|
-
setDirection(clicked > currentStep ? 1 : -1);
|
|
131
|
-
updateStep(clicked);
|
|
132
|
-
}}
|
|
133
|
-
/>
|
|
134
|
-
)}
|
|
135
|
-
{isNotLastStep && (
|
|
136
|
-
<StepConnector isComplete={currentStep > stepNumber} />
|
|
137
|
-
)}
|
|
138
|
-
</React.Fragment>
|
|
139
|
-
);
|
|
140
|
-
})}
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<StepContentWrapper
|
|
144
|
-
isCompleted={isCompleted}
|
|
145
|
-
currentStep={currentStep}
|
|
146
|
-
direction={direction}
|
|
147
|
-
className={`step-content-default ${contentClassName}`}
|
|
148
|
-
>
|
|
149
|
-
{stepsArray[currentStep - 1]}
|
|
150
|
-
</StepContentWrapper>
|
|
151
|
-
{!isCompleted && (
|
|
152
|
-
<div className={`footer-container ${footerClassName}`}>
|
|
153
|
-
<div
|
|
154
|
-
className={`footer-nav ${currentStep !== 1 ? "spread" : "end"}`}
|
|
155
|
-
>
|
|
156
|
-
{currentStep !== 1 && (
|
|
157
|
-
<Button
|
|
158
|
-
id={""}
|
|
159
|
-
text
|
|
160
|
-
className="back-button"
|
|
161
|
-
onClick={() => handleBack()}
|
|
162
|
-
{...backButtonProps}
|
|
163
|
-
>
|
|
164
|
-
{backButtonText}
|
|
165
|
-
</Button>
|
|
166
|
-
)}
|
|
167
|
-
<Button
|
|
168
|
-
id={""}
|
|
169
|
-
primary
|
|
170
|
-
className="next-button"
|
|
171
|
-
onClick={isLastStep ? handleComplete : handleNext}
|
|
172
|
-
{...nextButtonProps}
|
|
173
|
-
>
|
|
174
|
-
<Icon
|
|
175
|
-
systemName={
|
|
176
|
-
isLastStep ? lastNextButtonIcon : nextButtonIcon
|
|
177
|
-
}
|
|
178
|
-
label={isLastStep ? lastNextButtonText : nextButtonText}
|
|
179
|
-
/>
|
|
180
|
-
</Button>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
)}
|
|
184
|
-
</div>
|
|
185
|
-
</div>
|
|
186
|
-
</FadeContent>
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
interface StepContentWrapperProps {
|
|
191
|
-
isCompleted: boolean;
|
|
192
|
-
currentStep: number;
|
|
193
|
-
direction: number;
|
|
194
|
-
children: ReactNode;
|
|
195
|
-
className?: string;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function StepContentWrapper({
|
|
199
|
-
isCompleted,
|
|
200
|
-
currentStep,
|
|
201
|
-
direction,
|
|
202
|
-
children,
|
|
203
|
-
className,
|
|
204
|
-
}: StepContentWrapperProps) {
|
|
205
|
-
const [parentHeight, setParentHeight] = useState<number>(0);
|
|
206
|
-
|
|
207
|
-
return (
|
|
208
|
-
<motion.div
|
|
209
|
-
className={className}
|
|
210
|
-
style={{ position: "relative", overflow: "hidden" }}
|
|
211
|
-
animate={{ height: isCompleted ? 0 : parentHeight }}
|
|
212
|
-
transition={{ type: "spring", duration: 0.4 }}
|
|
213
|
-
>
|
|
214
|
-
<AnimatePresence initial={false} mode="sync" custom={direction}>
|
|
215
|
-
{!isCompleted && (
|
|
216
|
-
<SlideTransition
|
|
217
|
-
key={currentStep}
|
|
218
|
-
direction={direction}
|
|
219
|
-
onHeightReady={(h) => setParentHeight(h)}
|
|
220
|
-
>
|
|
221
|
-
{children}
|
|
222
|
-
</SlideTransition>
|
|
223
|
-
)}
|
|
224
|
-
</AnimatePresence>
|
|
225
|
-
</motion.div>
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
interface SlideTransitionProps {
|
|
230
|
-
children: ReactNode;
|
|
231
|
-
direction: number;
|
|
232
|
-
onHeightReady: (h: number) => void;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function SlideTransition({
|
|
236
|
-
children,
|
|
237
|
-
direction,
|
|
238
|
-
onHeightReady,
|
|
239
|
-
}: SlideTransitionProps) {
|
|
240
|
-
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
241
|
-
|
|
242
|
-
useEffect(() => {
|
|
243
|
-
const el = containerRef.current;
|
|
244
|
-
if (!el) return;
|
|
245
|
-
const ro = new ResizeObserver((entries) => {
|
|
246
|
-
const h = entries[0]?.contentRect.height;
|
|
247
|
-
if (h !== undefined) onHeightReady(h);
|
|
248
|
-
});
|
|
249
|
-
ro.observe(el);
|
|
250
|
-
return () => ro.disconnect();
|
|
251
|
-
}, [onHeightReady]);
|
|
252
|
-
|
|
253
|
-
return (
|
|
254
|
-
<motion.div
|
|
255
|
-
ref={containerRef}
|
|
256
|
-
custom={direction}
|
|
257
|
-
variants={stepVariants}
|
|
258
|
-
initial="enter"
|
|
259
|
-
animate="center"
|
|
260
|
-
exit="exit"
|
|
261
|
-
transition={{ duration: 0.4 }}
|
|
262
|
-
style={{ position: "absolute", left: 0, right: 0, top: 0 }}
|
|
263
|
-
>
|
|
264
|
-
{children}
|
|
265
|
-
</motion.div>
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const stepVariants: Variants = {
|
|
270
|
-
enter: (dir: number) => ({
|
|
271
|
-
x: dir >= 0 ? "100%" : "-100%", // <-- Slide in from right if going forward, from left if going back
|
|
272
|
-
opacity: 0,
|
|
273
|
-
}),
|
|
274
|
-
center: {
|
|
275
|
-
x: "0%",
|
|
276
|
-
opacity: 1,
|
|
277
|
-
},
|
|
278
|
-
exit: (dir: number) => ({
|
|
279
|
-
x: dir >= 0 ? "-50%" : "50%", // <-- Slide out to left if going forward, to right if going back
|
|
280
|
-
opacity: 0,
|
|
281
|
-
}),
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
interface StepProps {
|
|
285
|
-
children: ReactNode;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
export function Step({ children }: StepProps): JSX.Element {
|
|
289
|
-
return <div className="step-default">{children}</div>;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
interface StepIndicatorProps {
|
|
293
|
-
step: number;
|
|
294
|
-
currentStep: number;
|
|
295
|
-
onClickStep: (step: number) => void;
|
|
296
|
-
disableStepIndicators?: boolean;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function StepIndicator({
|
|
300
|
-
step,
|
|
301
|
-
currentStep,
|
|
302
|
-
onClickStep,
|
|
303
|
-
disableStepIndicators,
|
|
304
|
-
}: StepIndicatorProps) {
|
|
305
|
-
const status =
|
|
306
|
-
currentStep === step
|
|
307
|
-
? "active"
|
|
308
|
-
: currentStep < step
|
|
309
|
-
? "inactive"
|
|
310
|
-
: "complete";
|
|
311
|
-
|
|
312
|
-
const handleClick = () => {
|
|
313
|
-
if (step !== currentStep && !disableStepIndicators) {
|
|
314
|
-
onClickStep(step);
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
return (
|
|
319
|
-
<motion.div
|
|
320
|
-
onClick={handleClick}
|
|
321
|
-
className="step-indicator"
|
|
322
|
-
animate={status}
|
|
323
|
-
initial={false}
|
|
324
|
-
>
|
|
325
|
-
<motion.div
|
|
326
|
-
variants={{
|
|
327
|
-
inactive: {
|
|
328
|
-
scale: 1,
|
|
329
|
-
backgroundColor: "var(--md-sys-color-surface-container-highest)",
|
|
330
|
-
color: "var(--md-sys-color-on-surface)",
|
|
331
|
-
},
|
|
332
|
-
active: {
|
|
333
|
-
scale: 1,
|
|
334
|
-
backgroundColor: "var(--md-sys-color-primary)",
|
|
335
|
-
color: "var(--md-sys-color-on-primary)",
|
|
336
|
-
},
|
|
337
|
-
complete: {
|
|
338
|
-
scale: 1,
|
|
339
|
-
backgroundColor: "var(--md-sys-color-primary)",
|
|
340
|
-
color: "var(--md-sys-color-on-primary)",
|
|
341
|
-
},
|
|
342
|
-
}}
|
|
343
|
-
transition={{ duration: 0.3 }}
|
|
344
|
-
className="step-indicator-inner"
|
|
345
|
-
>
|
|
346
|
-
{status === "complete" ? (
|
|
347
|
-
<CheckIcon className="check-icon" />
|
|
348
|
-
) : status === "active" ? (
|
|
349
|
-
<div className="active-dot" />
|
|
350
|
-
) : (
|
|
351
|
-
<span className="step-number">{step}</span>
|
|
352
|
-
)}
|
|
353
|
-
</motion.div>
|
|
354
|
-
</motion.div>
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
interface StepConnectorProps {
|
|
359
|
-
isComplete: boolean;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
function StepConnector({ isComplete }: StepConnectorProps) {
|
|
363
|
-
const lineVariants: Variants = {
|
|
364
|
-
incomplete: { width: 0, backgroundColor: "transparent" },
|
|
365
|
-
complete: { width: "100%", backgroundColor: "var(--md-sys-color-primary)" },
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
return (
|
|
369
|
-
<div
|
|
370
|
-
className="step-connector"
|
|
371
|
-
style={{
|
|
372
|
-
backgroundColor: "var(--md-sys-color-surface-container-highest)",
|
|
373
|
-
}}
|
|
374
|
-
>
|
|
375
|
-
<motion.div
|
|
376
|
-
className="step-connector-inner"
|
|
377
|
-
variants={lineVariants}
|
|
378
|
-
initial={false}
|
|
379
|
-
animate={isComplete ? "complete" : "incomplete"}
|
|
380
|
-
transition={{ duration: 0.4 }}
|
|
381
|
-
/>
|
|
382
|
-
</div>
|
|
383
|
-
);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
type CheckIconProps = React.SVGProps<SVGSVGElement>;
|
|
387
|
-
|
|
388
|
-
function CheckIcon(props: CheckIconProps) {
|
|
389
|
-
return (
|
|
390
|
-
<svg
|
|
391
|
-
{...props}
|
|
392
|
-
fill="none"
|
|
393
|
-
stroke="currentColor"
|
|
394
|
-
strokeWidth={2}
|
|
395
|
-
viewBox="0 0 24 24"
|
|
396
|
-
>
|
|
397
|
-
<motion.path
|
|
398
|
-
initial={{ pathLength: 0 }}
|
|
399
|
-
animate={{ pathLength: 1 }}
|
|
400
|
-
transition={{
|
|
401
|
-
delay: 0.1,
|
|
402
|
-
type: "tween",
|
|
403
|
-
ease: "easeOut",
|
|
404
|
-
duration: 0.3,
|
|
405
|
-
}}
|
|
406
|
-
strokeLinecap="round"
|
|
407
|
-
strokeLinejoin="round"
|
|
408
|
-
d="M5 13l4 4L19 7"
|
|
409
|
-
/>
|
|
410
|
-
</svg>
|
|
411
|
-
);
|
|
412
|
-
}
|