@semcore/wizard 17.3.1 → 17.3.2-prerelease.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.
- package/CHANGELOG.md +7 -0
- package/lib/cjs/Wizard.js +14 -14
- package/lib/cjs/Wizard.js.map +1 -1
- package/lib/cjs/Wizard.types.js.map +1 -1
- package/lib/es6/Wizard.js +14 -14
- package/lib/es6/Wizard.js.map +1 -1
- package/lib/es6/Wizard.types.js.map +1 -1
- package/lib/esm/Wizard.mjs +15 -15
- package/lib/types/Wizard.d.ts +4 -3
- package/lib/types/Wizard.d.ts.map +1 -0
- package/lib/types/Wizard.types.d.ts +179 -128
- package/lib/types/Wizard.types.d.ts.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +1 -0
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts.map +1 -0
- package/package.json +9 -9
- package/src/Wizard.tsx +33 -33
- package/src/Wizard.types.ts +207 -152
- package/tsconfig.json +0 -7
|
@@ -1,132 +1,183 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { NSBox } from '@semcore/base-components';
|
|
2
|
+
import type { NSButton } from '@semcore/button';
|
|
3
3
|
import type { Intergalactic } from '@semcore/core';
|
|
4
4
|
import type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';
|
|
5
5
|
import type { NSModal } from '@semcore/modal';
|
|
6
|
-
import type {
|
|
6
|
+
import type { NSText } from '@semcore/typography';
|
|
7
7
|
import type React from 'react';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
8
|
+
declare namespace NSWizard {
|
|
9
|
+
/** Ordered step position from 0 */
|
|
10
|
+
type Step = number;
|
|
11
|
+
type Props = NSModal.Props & {
|
|
12
|
+
/**
|
|
13
|
+
* Active step value
|
|
14
|
+
*/
|
|
15
|
+
step: NSWizard.Step;
|
|
16
|
+
/** Specifies the locale for i18n support */
|
|
17
|
+
locale?: string;
|
|
18
|
+
};
|
|
19
|
+
type DefaultProps = {
|
|
20
|
+
step: NSWizard.Step;
|
|
21
|
+
i18n: Record<string, any>;
|
|
22
|
+
locale: 'en';
|
|
23
|
+
};
|
|
24
|
+
type State = {
|
|
25
|
+
highlighted: number;
|
|
26
|
+
};
|
|
27
|
+
namespace Sidebar {
|
|
28
|
+
type Props = NSBox.Props & {
|
|
29
|
+
/**
|
|
30
|
+
* Sidebar title
|
|
31
|
+
*/
|
|
32
|
+
title?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* @internal html id attribute
|
|
35
|
+
*/
|
|
36
|
+
id?: string;
|
|
37
|
+
};
|
|
38
|
+
type Component = Intergalactic.Component<'div', Props>;
|
|
39
|
+
}
|
|
40
|
+
namespace Step {
|
|
41
|
+
type Props = NSBox.Props & {
|
|
42
|
+
/**
|
|
43
|
+
* Ordered step position from 0
|
|
44
|
+
*/
|
|
45
|
+
step: NSWizard.Step;
|
|
46
|
+
/**
|
|
47
|
+
* Disabled step
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Active flag
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
active?: boolean;
|
|
55
|
+
};
|
|
56
|
+
type Component = Intergalactic.Component<'div', Props>;
|
|
57
|
+
}
|
|
58
|
+
namespace StepTitle {
|
|
59
|
+
type Props = NSText.Props;
|
|
60
|
+
type Component = NSText.Component;
|
|
61
|
+
}
|
|
62
|
+
namespace Stepper {
|
|
63
|
+
type Props = NSBox.Props & {
|
|
64
|
+
/**
|
|
65
|
+
* Ordered step position from 0
|
|
66
|
+
*/
|
|
67
|
+
step: NSWizard.Step;
|
|
68
|
+
/**
|
|
69
|
+
* Is invoked when active the step
|
|
70
|
+
*/
|
|
71
|
+
onActive?: ((step: NSWizard.Step, e: React.SyntheticEvent<HTMLElement> | React.KeyboardEvent) => void) | React.Dispatch<React.SetStateAction<NSWizard.Step>>;
|
|
72
|
+
/**
|
|
73
|
+
* Stepper number
|
|
74
|
+
* @default incremental value
|
|
75
|
+
*/
|
|
76
|
+
number?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* Is the step completed
|
|
79
|
+
*/
|
|
80
|
+
completed?: boolean;
|
|
81
|
+
/** Disables interaction with the stepper */
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Translation function
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
getI18nText?: ReturnType<typeof useI18n>;
|
|
88
|
+
/**
|
|
89
|
+
* Go to next step
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
focusNext?: () => void;
|
|
93
|
+
/**
|
|
94
|
+
* Go to prev step
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
focusPrev?: () => void;
|
|
98
|
+
};
|
|
99
|
+
type Component<PropsExtending = {}> = (<Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', Props> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;
|
|
100
|
+
}
|
|
101
|
+
namespace Content {
|
|
102
|
+
type Props = NSBox.Props & {
|
|
103
|
+
/**
|
|
104
|
+
* Renders wizard content container with border-radius on the left side
|
|
105
|
+
*/
|
|
106
|
+
noSidebar?: boolean;
|
|
107
|
+
};
|
|
108
|
+
type Component = Intergalactic.Component<'div', Props>;
|
|
109
|
+
}
|
|
110
|
+
namespace StepBack {
|
|
111
|
+
type Props = NSButton.Props & {
|
|
112
|
+
/** Callback invoked when navigating to the previous step */
|
|
113
|
+
onActive?: ((step: NSWizard.Step, e?: React.SyntheticEvent<HTMLElement>) => void) | React.Dispatch<React.SetStateAction<NSWizard.Step>>;
|
|
114
|
+
/** Step name being navigated to */
|
|
115
|
+
stepName?: string;
|
|
116
|
+
/**
|
|
117
|
+
* CurrentStep
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
step?: NSWizard.Step;
|
|
121
|
+
/**
|
|
122
|
+
* Translation function
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
getI18nText?: ReturnType<typeof useI18n>;
|
|
126
|
+
};
|
|
127
|
+
type Component = Intergalactic.Component<'button', Props>;
|
|
128
|
+
}
|
|
129
|
+
namespace StepNext {
|
|
130
|
+
type Props = NSButton.Props & {
|
|
131
|
+
/** Callback invoked when navigating to the next step */
|
|
132
|
+
onActive?: ((step: NSWizard.Step, e?: React.SyntheticEvent<HTMLElement>) => void) | React.Dispatch<React.SetStateAction<NSWizard.Step>>;
|
|
133
|
+
/** Step name being navigated to */
|
|
134
|
+
stepName?: string;
|
|
135
|
+
/**
|
|
136
|
+
* CurrentStep
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
step?: NSWizard.Step;
|
|
140
|
+
/**
|
|
141
|
+
* Translation function
|
|
142
|
+
* @internal
|
|
143
|
+
*/
|
|
144
|
+
getI18nText?: ReturnType<typeof useI18n>;
|
|
145
|
+
};
|
|
146
|
+
type Component = Intergalactic.Component<'button', Props>;
|
|
147
|
+
}
|
|
148
|
+
type Component = Intergalactic.Component<'div', Props> & {
|
|
149
|
+
Sidebar: Sidebar.Component;
|
|
150
|
+
Step: Step.Component;
|
|
151
|
+
StepTitle: StepTitle.Component;
|
|
152
|
+
Stepper: Stepper.Component;
|
|
153
|
+
Content: Content.Component;
|
|
154
|
+
StepBack: StepBack.Component;
|
|
155
|
+
StepNext: StepNext.Component;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** @deprecated It will be removed in v19. */
|
|
159
|
+
export type WizardStep = NSWizard.Step;
|
|
160
|
+
/** @deprecated It will be removed in v19. */
|
|
161
|
+
export type WizardProps = NSWizard.Props;
|
|
162
|
+
/** @deprecated It will be removed in v19. */
|
|
163
|
+
export type WizardSidebarProps = NSWizard.Sidebar.Props;
|
|
164
|
+
/** @deprecated It will be removed in v19. */
|
|
165
|
+
export type WizardStepProps = NSWizard.Step.Props;
|
|
166
|
+
/** @deprecated It will be removed in v19. */
|
|
167
|
+
export type WizardStepperProps = NSWizard.Stepper.Props;
|
|
168
|
+
/** @deprecated It will be removed in v19. */
|
|
169
|
+
export type WizardContentProps = NSWizard.Content.Props;
|
|
170
|
+
/** @deprecated It will be removed in v19. */
|
|
171
|
+
export type WizardStepBackProps = NSWizard.StepBack.Props;
|
|
172
|
+
/** @deprecated It will be removed in v19. */
|
|
173
|
+
export type WizardStepNextProps = NSWizard.StepNext.Props;
|
|
174
|
+
/** @deprecated It will be removed in v19. */
|
|
175
|
+
export type WizardDefaultProps = NSWizard.DefaultProps;
|
|
176
|
+
/** @deprecated It will be removed in v19. */
|
|
177
|
+
export type WizardStepTitleProps = NSWizard.StepTitle.Props;
|
|
178
|
+
/** @deprecated It will be removed in v19. */
|
|
179
|
+
export type IntergalacticWizardStepperComponent<PropsExtending = {}> = NSWizard.Stepper.Component<PropsExtending>;
|
|
180
|
+
/** @deprecated It will be removed in v19. */
|
|
181
|
+
export type WizardType = NSWizard.Component;
|
|
182
|
+
export type { NSWizard };
|
|
183
|
+
//# sourceMappingURL=Wizard.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wizard.types.d.ts","sourceRoot":"","sources":["../../src/Wizard.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,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6CAA6C;AAC7C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC1D,6CAA6C;AAC7C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC1D,6CAA6C;AAC7C,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,YAAY,CAAC;AAEvD,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC;AAC5D,6CAA6C;AAC7C,MAAM,MAAM,mCAAmC,CAAC,cAAc,GAAG,EAAE,IAAI,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;AAClH,6CAA6C;AAC7C,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS,CAAC;AAE5C,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,UAAU,CAAC;AAEzB,mBAAmB,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__intergalactic-dynamic-locales.d.ts","sourceRoot":"","sources":["../../../src/translations/__intergalactic-dynamic-locales.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAe7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/wizard",
|
|
3
3
|
"description": "Semrush Wizard Component",
|
|
4
|
-
"version": "17.3.
|
|
4
|
+
"version": "17.3.2-prerelease.2",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"require": "./lib/cjs/index.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/button": "^17.2.
|
|
18
|
-
"@semcore/modal": "^17.2.2",
|
|
19
|
-
"@semcore/typography": "^17.2.1"
|
|
17
|
+
"@semcore/button": "^17.2.2-prerelease.2",
|
|
18
|
+
"@semcore/modal": "^17.2.2-prerelease.2",
|
|
19
|
+
"@semcore/typography": "^17.2.1-prerelease.2"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@semcore/base-components": "^17.2.
|
|
23
|
-
"@semcore/icon": "^17.2.
|
|
22
|
+
"@semcore/base-components": "^17.2.2",
|
|
23
|
+
"@semcore/icon": "^17.2.1"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"directory": "semcore/wizard"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@semcore/
|
|
32
|
-
"@semcore/base-components": "17.2.1",
|
|
31
|
+
"@semcore/base-components": "17.2.2-prerelease.2",
|
|
33
32
|
"@semcore/testing-utils": "1.0.0",
|
|
34
|
-
"@semcore/
|
|
33
|
+
"@semcore/core": "17.3.1-prerelease.2",
|
|
34
|
+
"@semcore/icon": "17.2.1-prerelease.2"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "pnpm semcore-builder && pnpm vite build"
|
package/src/Wizard.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ScreenReaderOnly, Box } from '@semcore/base-components';
|
|
2
2
|
import Button from '@semcore/button';
|
|
3
3
|
import { createComponent, Component, Root, sstyled } from '@semcore/core';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Intergalactic } from '@semcore/core';
|
|
5
5
|
import type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
6
6
|
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
7
7
|
import findComponent from '@semcore/core/lib/utils/findComponent';
|
|
@@ -16,31 +16,19 @@ import React from 'react';
|
|
|
16
16
|
|
|
17
17
|
import style from './style/wizard.shadow.css';
|
|
18
18
|
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
19
|
-
import type {
|
|
20
|
-
WizardStep,
|
|
21
|
-
WizardProps,
|
|
22
|
-
WizardStepProps,
|
|
23
|
-
WizardStepperProps,
|
|
24
|
-
WizardSidebarProps,
|
|
25
|
-
WizardContentProps,
|
|
26
|
-
IntergalacticWizardStepperComponent,
|
|
27
|
-
WizardType,
|
|
28
|
-
WizardStepBackProps,
|
|
29
|
-
WizardStepNextProps,
|
|
30
|
-
WizardDefaultProps,
|
|
31
|
-
} from './Wizard.types';
|
|
19
|
+
import type { NSWizard } from './Wizard.types';
|
|
32
20
|
|
|
33
21
|
type State = {
|
|
34
22
|
highlighted: number;
|
|
35
23
|
};
|
|
36
24
|
|
|
37
25
|
class WizardRoot extends Component<
|
|
38
|
-
|
|
26
|
+
Intergalactic.InternalTypings.InferComponentProps<NSWizard.Component>,
|
|
39
27
|
typeof WizardRoot.enhance,
|
|
40
28
|
{},
|
|
41
29
|
WithI18nEnhanceProps,
|
|
42
|
-
State,
|
|
43
|
-
|
|
30
|
+
NSWizard.State,
|
|
31
|
+
NSWizard.DefaultProps
|
|
44
32
|
> {
|
|
45
33
|
static displayName = 'Wizard';
|
|
46
34
|
static style = style;
|
|
@@ -61,7 +49,7 @@ class WizardRoot extends Component<
|
|
|
61
49
|
highlighted: this.props.step,
|
|
62
50
|
};
|
|
63
51
|
|
|
64
|
-
getStepId(step:
|
|
52
|
+
getStepId(step: NSWizard.Step): string {
|
|
65
53
|
return `${this.asProps.uid}-step-${step}`;
|
|
66
54
|
}
|
|
67
55
|
|
|
@@ -69,19 +57,19 @@ class WizardRoot extends Component<
|
|
|
69
57
|
return `${this.asProps.uid}-title`;
|
|
70
58
|
}
|
|
71
59
|
|
|
72
|
-
getStepperId(step:
|
|
60
|
+
getStepperId(step: NSWizard.Step): string {
|
|
73
61
|
const { uid } = this.asProps;
|
|
74
62
|
|
|
75
63
|
return `${uid}-stepper-${step}`;
|
|
76
64
|
}
|
|
77
65
|
|
|
78
|
-
getContentId(step:
|
|
66
|
+
getContentId(step: NSWizard.Step): string {
|
|
79
67
|
const { uid } = this.asProps;
|
|
80
68
|
|
|
81
69
|
return `${uid}-content-${step}`;
|
|
82
70
|
}
|
|
83
71
|
|
|
84
|
-
getStepProps(props:
|
|
72
|
+
getStepProps(props: NSWizard.Step.Props) {
|
|
85
73
|
return {
|
|
86
74
|
steps: this._steps,
|
|
87
75
|
active: props.step === this.asProps.step,
|
|
@@ -148,7 +136,7 @@ class WizardRoot extends Component<
|
|
|
148
136
|
}, 0);
|
|
149
137
|
};
|
|
150
138
|
|
|
151
|
-
getStepperProps(props:
|
|
139
|
+
getStepperProps(props: NSWizard.Stepper.Props, i: number) {
|
|
152
140
|
let number = i + 1;
|
|
153
141
|
if (this._steps.has(props.step)) {
|
|
154
142
|
const step = this._steps.get(props.step);
|
|
@@ -178,7 +166,7 @@ class WizardRoot extends Component<
|
|
|
178
166
|
};
|
|
179
167
|
}
|
|
180
168
|
|
|
181
|
-
componentDidUpdate(prevProps:
|
|
169
|
+
componentDidUpdate(prevProps: typeof this.asProps) {
|
|
182
170
|
if (prevProps.step === this.asProps.step) return;
|
|
183
171
|
|
|
184
172
|
this.setState({ highlighted: this.asProps.step });
|
|
@@ -209,7 +197,9 @@ class WizardRoot extends Component<
|
|
|
209
197
|
}
|
|
210
198
|
}
|
|
211
199
|
|
|
212
|
-
function Sidebar(
|
|
200
|
+
function Sidebar(
|
|
201
|
+
props: Intergalactic.InternalTypings.InferChildComponentProps<NSWizard.Sidebar.Component, typeof WizardRoot, 'Sidebar'>,
|
|
202
|
+
) {
|
|
213
203
|
const { Children, styles, title, id } = props;
|
|
214
204
|
const SSidebar = Root;
|
|
215
205
|
const SSidebarHeader = 'h2';
|
|
@@ -225,7 +215,9 @@ function Sidebar(props: WizardSidebarProps & IRootComponentProps) {
|
|
|
225
215
|
);
|
|
226
216
|
}
|
|
227
217
|
|
|
228
|
-
function Step(
|
|
218
|
+
function Step(
|
|
219
|
+
props: Intergalactic.InternalTypings.InferChildComponentProps<NSWizard.Step.Component, typeof WizardRoot, 'Step'>,
|
|
220
|
+
) {
|
|
229
221
|
const SStep = Root;
|
|
230
222
|
const { Children, styles, active } = props;
|
|
231
223
|
if (active) {
|
|
@@ -238,7 +230,9 @@ function Step(props: IRootComponentProps & WizardStepProps) {
|
|
|
238
230
|
return null;
|
|
239
231
|
}
|
|
240
232
|
|
|
241
|
-
function Stepper(
|
|
233
|
+
function Stepper(
|
|
234
|
+
props: Intergalactic.InternalTypings.InferChildComponentProps<NSWizard.Stepper.Component, typeof WizardRoot, 'Stepper'>,
|
|
235
|
+
) {
|
|
242
236
|
const {
|
|
243
237
|
Children,
|
|
244
238
|
styles,
|
|
@@ -299,7 +293,7 @@ function Stepper(props: Required<WizardStepperProps> & IRootComponentProps) {
|
|
|
299
293
|
);
|
|
300
294
|
}
|
|
301
295
|
|
|
302
|
-
function Content(props:
|
|
296
|
+
function Content(props: Intergalactic.InternalTypings.InferChildComponentProps<NSWizard.Content.Component, typeof WizardRoot, 'Content'>) {
|
|
303
297
|
const { Children, styles } = props;
|
|
304
298
|
const SContent = Root;
|
|
305
299
|
return sstyled(styles)(
|
|
@@ -312,7 +306,9 @@ function Content(props: WizardContentProps & IRootComponentProps) {
|
|
|
312
306
|
);
|
|
313
307
|
}
|
|
314
308
|
|
|
315
|
-
function StepBack(
|
|
309
|
+
function StepBack(
|
|
310
|
+
props: Intergalactic.InternalTypings.InferChildComponentProps<NSWizard.StepBack.Component, typeof WizardRoot, 'StepBack'>,
|
|
311
|
+
) {
|
|
316
312
|
const SStepBack = Root;
|
|
317
313
|
const { Children, children: hasChildren, styles, getI18nText, stepName } = props;
|
|
318
314
|
const handleClick = React.useCallback(() => {
|
|
@@ -333,7 +329,9 @@ function StepBack(props: Required<WizardStepBackProps> & IRootComponentProps) {
|
|
|
333
329
|
</SStepBack>,
|
|
334
330
|
);
|
|
335
331
|
}
|
|
336
|
-
function StepNext(
|
|
332
|
+
function StepNext(
|
|
333
|
+
props: Intergalactic.InternalTypings.InferChildComponentProps<NSWizard.StepNext.Component, typeof WizardRoot, 'StepNext'>,
|
|
334
|
+
) {
|
|
337
335
|
const SStepNext = Root;
|
|
338
336
|
const { Children, children: hasChildren, styles, getI18nText, stepName } = props;
|
|
339
337
|
const handleClick = React.useCallback(() => {
|
|
@@ -355,7 +353,9 @@ function StepNext(props: Required<WizardStepNextProps> & IRootComponentProps) {
|
|
|
355
353
|
);
|
|
356
354
|
}
|
|
357
355
|
|
|
358
|
-
function StepTitle(
|
|
356
|
+
function StepTitle(
|
|
357
|
+
props: Intergalactic.InternalTypings.InferChildComponentProps<NSWizard.StepTitle.Component, typeof WizardRoot, 'StepTitle'>,
|
|
358
|
+
) {
|
|
359
359
|
const SWizardStepTitle = Root;
|
|
360
360
|
const { styles } = props;
|
|
361
361
|
|
|
@@ -370,7 +370,7 @@ function StepTitle(props: Intergalactic.InternalTypings.InferChildComponentProps
|
|
|
370
370
|
* {@link https://developer.semrush.com/intergalactic/components/wizard/wizard-api/|API} | {@link https://developer.semrush.com/intergalactic/components/wizard/wizard-code/|Examples}
|
|
371
371
|
*/
|
|
372
372
|
const Wizard = createComponent<
|
|
373
|
-
|
|
373
|
+
NSWizard.Component,
|
|
374
374
|
typeof WizardRoot
|
|
375
375
|
>(WizardRoot, {
|
|
376
376
|
Sidebar,
|
|
@@ -385,10 +385,10 @@ const Wizard = createComponent<
|
|
|
385
385
|
export const wrapWizardStepper = <PropsExtending extends {}>(
|
|
386
386
|
wrapper: (
|
|
387
387
|
props: Intergalactic.InternalTypings.UntypeRefAndTag<
|
|
388
|
-
Intergalactic.InternalTypings.ComponentPropsNesting<
|
|
388
|
+
Intergalactic.InternalTypings.ComponentPropsNesting<NSWizard.Stepper.Component>
|
|
389
389
|
> &
|
|
390
390
|
PropsExtending,
|
|
391
391
|
) => React.ReactNode,
|
|
392
|
-
) => wrapper as
|
|
392
|
+
) => wrapper as NSWizard.Stepper.Component<PropsExtending>;
|
|
393
393
|
|
|
394
394
|
export default Wizard;
|