@semcore/wizard 17.3.1 → 17.3.2-prerelease.0

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.
@@ -1,160 +1,215 @@
1
- import type { BoxProps } from '@semcore/base-components';
2
- import type { ButtonProps } from '@semcore/button';
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
6
  import type { Text, NSText } from '@semcore/typography';
7
7
  import type React from 'react';
8
8
 
9
- /** Ordered step position from 0 */
10
- export type WizardStep = number;
11
-
12
- export type WizardProps = NSModal.Props & {
13
- /**
14
- * Active step value
15
- */
16
- step: WizardStep;
17
- /** Specifies the locale for i18n support */
18
- locale?: string;
19
- };
20
-
21
- export type WizardSidebarProps = BoxProps & {
22
- /**
23
- * Sidebar title
24
- */
25
- title?: React.ReactNode;
26
-
27
- /**
28
- * @internal html id attribute
29
- */
30
- id?: string;
31
- };
32
-
33
- export type WizardStepProps = BoxProps & {
34
- /**
35
- * Ordered step position from 0
36
- */
37
- step: WizardStep;
38
- /**
39
- * Disabled step
40
- */
41
- disabled?: boolean;
42
- /**
43
- * Active flag
44
- * @internal
45
- */
46
- active?: boolean;
47
- };
48
-
49
- export type WizardStepperProps = BoxProps & {
50
- /**
51
- * Ordered step position from 0
52
- */
53
- step: WizardStep;
54
- /**
55
- * Is invoked when active the step
56
- */
57
- onActive?:
58
- | ((step: WizardStep, e: React.SyntheticEvent<HTMLElement> | React.KeyboardEvent) => void)
59
- | React.Dispatch<React.SetStateAction<WizardStep>>;
60
- /**
61
- * Stepper number
62
- * @default incremental value
63
- */
64
- number?: React.ReactNode;
65
- /**
66
- * Is the step completed
67
- */
68
- completed?: boolean;
69
- /** Disables interaction with the stepper */
70
- disabled?: boolean;
71
-
72
- /**
73
- * Translation function
74
- * @internal
75
- */
76
- getI18nText?: ReturnType<typeof useI18n>;
77
-
78
- /**
79
- * Go to next step
80
- * @internal
81
- */
82
- focusNext?: () => void;
83
- /**
84
- * Go to prev step
85
- * @internal
86
- */
87
- focusPrev?: () => void;
88
- };
89
-
90
- export type WizardContentProps = BoxProps & {
91
- /**
92
- * Renders wizard content container with border-radius on the left side
93
- */
94
- noSidebar?: boolean;
95
- };
96
-
97
- export type WizardStepBackProps = ButtonProps & {
98
- /** Callback invoked when navigating to the previous step */
99
- onActive?:
100
- | ((step: WizardStep, e?: React.SyntheticEvent<HTMLElement>) => void)
101
- | React.Dispatch<React.SetStateAction<WizardStep>>;
102
- /** Step name being navigated to */
103
- stepName?: string;
104
-
105
- /**
106
- * CurrentStep
107
- * @internal
108
- */
109
- step?: WizardStep;
110
- /**
111
- * Translation function
112
- * @internal
113
- */
114
- getI18nText?: ReturnType<typeof useI18n>;
115
- };
116
- export type WizardStepNextProps = ButtonProps & {
117
- /** Callback invoked when navigating to the next step */
118
- onActive?:
119
- | ((step: WizardStep, e?: React.SyntheticEvent<HTMLElement>) => void)
120
- | React.Dispatch<React.SetStateAction<WizardStep>>;
121
- /** Step name being navigated to */
122
- stepName?: string;
123
-
124
- /**
125
- * CurrentStep
126
- * @internal
127
- */
128
- step?: WizardStep;
129
- /**
130
- * Translation function
131
- * @internal
132
- */
133
- getI18nText?: ReturnType<typeof useI18n>;
134
- };
135
- export type WizardDefaultProps = {
136
- step: WizardStep;
137
- i18n: Record<string, any>;
138
- locale: 'en';
139
- };
9
+ declare namespace NSWizard {
10
+ /** Ordered step position from 0 */
11
+ type Step = number;
12
+ type Props = NSModal.Props & {
13
+ /**
14
+ * Active step value
15
+ */
16
+ step: NSWizard.Step;
17
+ /** Specifies the locale for i18n support */
18
+ locale?: string;
19
+ };
20
+ type DefaultProps = {
21
+ step: NSWizard.Step;
22
+ i18n: Record<string, any>;
23
+ locale: 'en';
24
+ };
25
+ type State = {
26
+ highlighted: number;
27
+ };
140
28
 
29
+ namespace Sidebar {
30
+ type Props = NSBox.Props & {
31
+ /**
32
+ * Sidebar title
33
+ */
34
+ title?: React.ReactNode;
35
+
36
+ /**
37
+ * @internal html id attribute
38
+ */
39
+ id?: string;
40
+ };
41
+
42
+ type Component = Intergalactic.Component<'div', Props>;
43
+ }
44
+
45
+ namespace Step {
46
+ type Props = NSBox.Props & {
47
+ /**
48
+ * Ordered step position from 0
49
+ */
50
+ step: NSWizard.Step;
51
+ /**
52
+ * Disabled step
53
+ */
54
+ disabled?: boolean;
55
+ /**
56
+ * Active flag
57
+ * @internal
58
+ */
59
+ active?: boolean;
60
+ };
61
+
62
+ type Component = Intergalactic.Component<'div', Props>;
63
+ }
64
+
65
+ namespace StepTitle {
66
+ type Props = NSText.Props;
67
+
68
+ type Component = NSText.Component;
69
+ }
70
+
71
+ namespace Stepper {
72
+ type Props = NSBox.Props & {
73
+ /**
74
+ * Ordered step position from 0
75
+ */
76
+ step: NSWizard.Step;
77
+ /**
78
+ * Is invoked when active the step
79
+ */
80
+ onActive?:
81
+ | ((step: NSWizard.Step, e: React.SyntheticEvent<HTMLElement> | React.KeyboardEvent) => void)
82
+ | React.Dispatch<React.SetStateAction<NSWizard.Step>>;
83
+ /**
84
+ * Stepper number
85
+ * @default incremental value
86
+ */
87
+ number?: React.ReactNode;
88
+ /**
89
+ * Is the step completed
90
+ */
91
+ completed?: boolean;
92
+ /** Disables interaction with the stepper */
93
+ disabled?: boolean;
94
+
95
+ /**
96
+ * Translation function
97
+ * @internal
98
+ */
99
+ getI18nText?: ReturnType<typeof useI18n>;
100
+
101
+ /**
102
+ * Go to next step
103
+ * @internal
104
+ */
105
+ focusNext?: () => void;
106
+ /**
107
+ * Go to prev step
108
+ * @internal
109
+ */
110
+ focusPrev?: () => void;
111
+ };
112
+
113
+ type Component<PropsExtending = {}> = (<Tag extends Intergalactic.Tag = 'div'>(
114
+ props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', Props> & PropsExtending,
115
+ ) => Intergalactic.InternalTypings.ComponentRenderingResults) &
116
+ Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;
117
+ }
118
+
119
+ namespace Content {
120
+ type Props = NSBox.Props & {
121
+ /**
122
+ * Renders wizard content container with border-radius on the left side
123
+ */
124
+ noSidebar?: boolean;
125
+ };
126
+
127
+ type Component = Intergalactic.Component<'div', Props>;
128
+ }
129
+
130
+ namespace StepBack {
131
+ type Props = NSButton.Props & {
132
+ /** Callback invoked when navigating to the previous step */
133
+ onActive?:
134
+ | ((step: NSWizard.Step, e?: React.SyntheticEvent<HTMLElement>) => void)
135
+ | React.Dispatch<React.SetStateAction<NSWizard.Step>>;
136
+ /** Step name being navigated to */
137
+ stepName?: string;
138
+
139
+ /**
140
+ * CurrentStep
141
+ * @internal
142
+ */
143
+ step?: NSWizard.Step;
144
+ /**
145
+ * Translation function
146
+ * @internal
147
+ */
148
+ getI18nText?: ReturnType<typeof useI18n>;
149
+ };
150
+
151
+ type Component = Intergalactic.Component<'button', Props>;
152
+ }
153
+
154
+ namespace StepNext {
155
+ type Props = NSButton.Props & {
156
+ /** Callback invoked when navigating to the next step */
157
+ onActive?:
158
+ | ((step: NSWizard.Step, e?: React.SyntheticEvent<HTMLElement>) => void)
159
+ | React.Dispatch<React.SetStateAction<NSWizard.Step>>;
160
+ /** Step name being navigated to */
161
+ stepName?: string;
162
+
163
+ /**
164
+ * CurrentStep
165
+ * @internal
166
+ */
167
+ step?: NSWizard.Step;
168
+ /**
169
+ * Translation function
170
+ * @internal
171
+ */
172
+ getI18nText?: ReturnType<typeof useI18n>;
173
+ };
174
+
175
+ type Component = Intergalactic.Component<'button', Props>;
176
+ }
177
+
178
+ type Component = Intergalactic.Component<'div', Props> & {
179
+ Sidebar: Sidebar.Component;
180
+ Step: Step.Component;
181
+ StepTitle: StepTitle.Component;
182
+ Stepper: Stepper.Component;
183
+ Content: Content.Component;
184
+ StepBack: StepBack.Component;
185
+ StepNext: StepNext.Component;
186
+ };
187
+ }
188
+
189
+ /** @deprecated It will be removed in v19. */
190
+ export type WizardStep = NSWizard.Step;
191
+ /** @deprecated It will be removed in v19. */
192
+ export type WizardProps = NSWizard.Props;
193
+ /** @deprecated It will be removed in v19. */
194
+ export type WizardSidebarProps = NSWizard.Sidebar.Props;
195
+ /** @deprecated It will be removed in v19. */
196
+ export type WizardStepProps = NSWizard.Step.Props;
197
+ /** @deprecated It will be removed in v19. */
198
+ export type WizardStepperProps = NSWizard.Stepper.Props;
199
+ /** @deprecated It will be removed in v19. */
200
+ export type WizardContentProps = NSWizard.Content.Props;
201
+ /** @deprecated It will be removed in v19. */
202
+ export type WizardStepBackProps = NSWizard.StepBack.Props;
203
+ /** @deprecated It will be removed in v19. */
204
+ export type WizardStepNextProps = NSWizard.StepNext.Props;
205
+ /** @deprecated It will be removed in v19. */
206
+ export type WizardDefaultProps = NSWizard.DefaultProps;
141
207
  // Need this for API page in docs
142
- export type WizardStepTitleProps = NSText.Props;
143
-
144
- export type IntergalacticWizardStepperComponent<PropsExtending = {}> = (<
145
- Tag extends Intergalactic.Tag = 'div',
146
- >(
147
- props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', WizardStepperProps> &
148
- PropsExtending,
149
- ) => Intergalactic.InternalTypings.ComponentRenderingResults) &
150
- Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', WizardStepperProps>;
151
-
152
- export type WizardType = Intergalactic.Component<'div', WizardProps> & {
153
- Sidebar: Intergalactic.Component<'div', WizardSidebarProps>;
154
- Step: Intergalactic.Component<'div', WizardStepProps>;
155
- StepTitle: typeof Text;
156
- Stepper: IntergalacticWizardStepperComponent;
157
- Content: Intergalactic.Component<'div', WizardContentProps>;
158
- StepBack: Intergalactic.Component<'button', WizardStepBackProps>;
159
- StepNext: Intergalactic.Component<'button', WizardStepNextProps>;
160
- };
208
+ /** @deprecated It will be removed in v19. */
209
+ export type WizardStepTitleProps = NSWizard.StepTitle.Props;
210
+ /** @deprecated It will be removed in v19. */
211
+ export type IntergalacticWizardStepperComponent<PropsExtending = {}> = NSWizard.Stepper.Component<PropsExtending>;
212
+ /** @deprecated It will be removed in v19. */
213
+ export type WizardType = NSWizard.Component;
214
+
215
+ export type { NSWizard };
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json"],
4
- "compilerOptions": {
5
- "rootDir": "./src"
6
- }
7
- }