@dt-dds/react-stepper 1.0.0-beta.31
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 +334 -0
- package/LICENSE.md +21 -0
- package/README.md +86 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +262 -0
- package/dist/index.mjs +225 -0
- package/package.json +56 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# @dt-ui/react-stepper
|
|
2
|
+
|
|
3
|
+
## 1.0.0-beta.31
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- refactor!: rename pkg and publish to npmjs
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @dt-dds/react-core@1.0.0-beta.41
|
|
13
|
+
- @dt-dds/react-icon@1.0.0-beta.42
|
|
14
|
+
- @dt-dds/react-typography@1.0.0-beta.32
|
|
15
|
+
|
|
16
|
+
## 0.1.0-beta.30
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- refactor: drop icon funcional state
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @dt-ui/react-icon@0.1.0-beta.41
|
|
23
|
+
|
|
24
|
+
## 0.1.0-beta.29
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- refactor: theme typography values
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
- @dt-ui/react-core@0.1.0-beta.40
|
|
31
|
+
- @dt-ui/react-icon@0.1.0-beta.40
|
|
32
|
+
- @dt-ui/react-typography@0.1.0-beta.31
|
|
33
|
+
|
|
34
|
+
## 0.1.0-beta.28
|
|
35
|
+
|
|
36
|
+
### Minor Changes
|
|
37
|
+
|
|
38
|
+
- feat: update shadow theme values
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
- @dt-ui/react-core@0.1.0-beta.39
|
|
44
|
+
- @dt-ui/react-icon@0.1.0-beta.39
|
|
45
|
+
- @dt-ui/react-typography@0.1.0-beta.30
|
|
46
|
+
|
|
47
|
+
## 0.1.0-beta.27
|
|
48
|
+
|
|
49
|
+
### Minor Changes
|
|
50
|
+
|
|
51
|
+
- feat: add new icon font sizes
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies
|
|
56
|
+
- @dt-ui/react-icon@0.1.0-beta.38
|
|
57
|
+
|
|
58
|
+
## 0.1.0-beta.26
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- chore: update theme font-styles
|
|
63
|
+
- Updated dependencies
|
|
64
|
+
- @dt-ui/react-core@0.1.0-beta.38
|
|
65
|
+
- @dt-ui/react-icon@0.1.0-beta.37
|
|
66
|
+
- @dt-ui/react-typography@0.1.0-beta.29
|
|
67
|
+
|
|
68
|
+
## 0.1.0-beta.25
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- chore: review OSS files
|
|
73
|
+
- Updated dependencies
|
|
74
|
+
- @dt-ui/react-core@0.1.0-beta.37
|
|
75
|
+
- @dt-ui/react-icon@0.1.0-beta.36
|
|
76
|
+
- @dt-ui/react-typography@0.1.0-beta.28
|
|
77
|
+
|
|
78
|
+
## 0.1.0-beta.24
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- chore: update contextual colors
|
|
83
|
+
- Updated dependencies
|
|
84
|
+
- @dt-ui/react-core@0.1.0-beta.36
|
|
85
|
+
- @dt-ui/react-icon@0.1.0-beta.35
|
|
86
|
+
- @dt-ui/react-typography@0.1.0-beta.27
|
|
87
|
+
|
|
88
|
+
## 0.1.0-beta.23
|
|
89
|
+
|
|
90
|
+
### Minor Changes
|
|
91
|
+
|
|
92
|
+
- feat: implement IconButton contrast and size
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- Updated dependencies
|
|
97
|
+
- @dt-ui/react-icon@0.1.0-beta.34
|
|
98
|
+
|
|
99
|
+
## 0.1.0-beta.22
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- fix: change content.light contextual color
|
|
104
|
+
- Updated dependencies
|
|
105
|
+
- @dt-ui/react-core@0.1.0-beta.35
|
|
106
|
+
- @dt-ui/react-icon@0.1.0-beta.33
|
|
107
|
+
- @dt-ui/react-typography@0.1.0-beta.26
|
|
108
|
+
|
|
109
|
+
## 0.1.0-beta.21
|
|
110
|
+
|
|
111
|
+
### Minor Changes
|
|
112
|
+
|
|
113
|
+
- feat: move icon-button to independent
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- Updated dependencies
|
|
118
|
+
- @dt-ui/react-icon@0.1.0-beta.32
|
|
119
|
+
|
|
120
|
+
## 0.1.0-beta.20
|
|
121
|
+
|
|
122
|
+
### Patch Changes
|
|
123
|
+
|
|
124
|
+
- fix: add accent to colors type
|
|
125
|
+
- Updated dependencies
|
|
126
|
+
- @dt-ui/react-core@0.1.0-beta.34
|
|
127
|
+
- @dt-ui/react-icon@0.1.0-beta.31
|
|
128
|
+
- @dt-ui/react-typography@0.1.0-beta.25
|
|
129
|
+
|
|
130
|
+
## 0.1.0-beta.19
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- fix: change button text according to ux
|
|
135
|
+
- Updated dependencies
|
|
136
|
+
- @dt-ui/react-core@0.1.0-beta.33
|
|
137
|
+
- @dt-ui/react-icon@0.1.0-beta.30
|
|
138
|
+
- @dt-ui/react-typography@0.1.0-beta.24
|
|
139
|
+
|
|
140
|
+
## 0.1.0-beta.18
|
|
141
|
+
|
|
142
|
+
### Patch Changes
|
|
143
|
+
|
|
144
|
+
- chore: update contexual colors
|
|
145
|
+
- Updated dependencies
|
|
146
|
+
- @dt-ui/react-core@0.1.0-beta.32
|
|
147
|
+
- @dt-ui/react-typography@0.1.0-beta.23
|
|
148
|
+
- @dt-ui/react-icon@0.1.0-beta.29
|
|
149
|
+
|
|
150
|
+
## 0.1.0-beta.17
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- style: update responsive font styles
|
|
155
|
+
- Updated dependencies
|
|
156
|
+
- @dt-ui/react-core@0.1.0-beta.31
|
|
157
|
+
- @dt-ui/react-icon@0.1.0-beta.28
|
|
158
|
+
- @dt-ui/react-typography@0.1.0-beta.22
|
|
159
|
+
|
|
160
|
+
## 0.1.0-beta.16
|
|
161
|
+
|
|
162
|
+
### Minor Changes
|
|
163
|
+
|
|
164
|
+
- feat: add spinner size 'extra-small' & update specs
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- Updated dependencies
|
|
169
|
+
- @dt-ui/react-core@0.1.0-beta.30
|
|
170
|
+
- @dt-ui/react-icon@0.1.0-beta.27
|
|
171
|
+
- @dt-ui/react-typography@0.1.0-beta.21
|
|
172
|
+
|
|
173
|
+
## 0.1.0-beta.15
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- chore: add theme breakpoints
|
|
178
|
+
- Updated dependencies
|
|
179
|
+
- @dt-ui/react-core@0.1.0-beta.29
|
|
180
|
+
- @dt-ui/react-icon@0.1.0-beta.26
|
|
181
|
+
- @dt-ui/react-typography@0.1.0-beta.20
|
|
182
|
+
|
|
183
|
+
## 0.1.0-beta.14
|
|
184
|
+
|
|
185
|
+
### Patch Changes
|
|
186
|
+
|
|
187
|
+
- fix: export Stepper components and hooks
|
|
188
|
+
|
|
189
|
+
## 0.1.0-beta.13
|
|
190
|
+
|
|
191
|
+
### Minor Changes
|
|
192
|
+
|
|
193
|
+
- feat: add id to base props
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- Updated dependencies
|
|
198
|
+
- @dt-ui/react-core@0.1.0-beta.28
|
|
199
|
+
- @dt-ui/react-typography@0.1.0-beta.19
|
|
200
|
+
- @dt-ui/react-icon@0.1.0-beta.25
|
|
201
|
+
|
|
202
|
+
## 0.1.0-beta.12
|
|
203
|
+
|
|
204
|
+
### Minor Changes
|
|
205
|
+
|
|
206
|
+
- feat: change breakpoints values
|
|
207
|
+
|
|
208
|
+
### Patch Changes
|
|
209
|
+
|
|
210
|
+
- Updated dependencies
|
|
211
|
+
- @dt-ui/react-core@0.1.0-beta.27
|
|
212
|
+
- @dt-ui/react-icon@0.1.0-beta.24
|
|
213
|
+
- @dt-ui/react-typography@0.1.0-beta.18
|
|
214
|
+
|
|
215
|
+
## 0.1.0-beta.11
|
|
216
|
+
|
|
217
|
+
### Patch Changes
|
|
218
|
+
|
|
219
|
+
- fix: replace body to correct one
|
|
220
|
+
- Updated dependencies
|
|
221
|
+
- @dt-ui/react-core@0.1.0-beta.26
|
|
222
|
+
- @dt-ui/react-icon@0.1.0-beta.23
|
|
223
|
+
- @dt-ui/react-typography@0.1.0-beta.17
|
|
224
|
+
|
|
225
|
+
## 0.1.0-beta.10
|
|
226
|
+
|
|
227
|
+
### Patch Changes
|
|
228
|
+
|
|
229
|
+
- fix: step style
|
|
230
|
+
- chore: add theme colors missing types
|
|
231
|
+
- Updated dependencies
|
|
232
|
+
- @dt-ui/react-core@0.1.0-beta.25
|
|
233
|
+
- @dt-ui/react-icon@0.1.0-beta.22
|
|
234
|
+
- @dt-ui/react-typography@0.1.0-beta.16
|
|
235
|
+
|
|
236
|
+
## 0.1.0-beta.9
|
|
237
|
+
|
|
238
|
+
### Patch Changes
|
|
239
|
+
|
|
240
|
+
- refactor: drop truckapi theme
|
|
241
|
+
- Updated dependencies
|
|
242
|
+
- @dt-ui/react-core@0.1.0-beta.24
|
|
243
|
+
- @dt-ui/react-icon@0.1.0-beta.21
|
|
244
|
+
- @dt-ui/react-typography@0.1.0-beta.15
|
|
245
|
+
|
|
246
|
+
## 0.1.0-beta.8
|
|
247
|
+
|
|
248
|
+
### Minor Changes
|
|
249
|
+
|
|
250
|
+
- feat: update core and semantic colors
|
|
251
|
+
- feat: remove greenlane theme
|
|
252
|
+
|
|
253
|
+
### Patch Changes
|
|
254
|
+
|
|
255
|
+
- Updated dependencies
|
|
256
|
+
- Updated dependencies
|
|
257
|
+
- @dt-ui/react-core@0.1.0-beta.23
|
|
258
|
+
- @dt-ui/react-icon@0.1.0-beta.20
|
|
259
|
+
- @dt-ui/react-typography@0.1.0-beta.14
|
|
260
|
+
|
|
261
|
+
## 0.1.0-beta.7
|
|
262
|
+
|
|
263
|
+
### Minor Changes
|
|
264
|
+
|
|
265
|
+
- feat: add icon option for truckapi theme
|
|
266
|
+
|
|
267
|
+
### Patch Changes
|
|
268
|
+
|
|
269
|
+
- Updated dependencies
|
|
270
|
+
- @dt-ui/react-core@0.1.0-beta.22
|
|
271
|
+
- @dt-ui/react-icon@0.1.0-beta.19
|
|
272
|
+
- @dt-ui/react-typography@0.1.0-beta.13
|
|
273
|
+
|
|
274
|
+
## 0.1.0-beta.6
|
|
275
|
+
|
|
276
|
+
### Patch Changes
|
|
277
|
+
|
|
278
|
+
- fix: tooltip z index
|
|
279
|
+
- Updated dependencies
|
|
280
|
+
- @dt-ui/react-core@0.1.0-beta.21
|
|
281
|
+
- @dt-ui/react-icon@0.1.0-beta.18
|
|
282
|
+
- @dt-ui/react-typography@0.1.0-beta.12
|
|
283
|
+
|
|
284
|
+
## 0.1.0-beta.5
|
|
285
|
+
|
|
286
|
+
### Minor Changes
|
|
287
|
+
|
|
288
|
+
- feat: add segmented control component
|
|
289
|
+
|
|
290
|
+
### Patch Changes
|
|
291
|
+
|
|
292
|
+
- Updated dependencies
|
|
293
|
+
- @dt-ui/react-core@0.1.0-beta.20
|
|
294
|
+
- @dt-ui/react-icon@0.1.0-beta.17
|
|
295
|
+
- @dt-ui/react-typography@0.1.0-beta.11
|
|
296
|
+
|
|
297
|
+
## 0.1.0-beta.4
|
|
298
|
+
|
|
299
|
+
### Patch Changes
|
|
300
|
+
|
|
301
|
+
- fix: add shape for tooltip on truckapi theme
|
|
302
|
+
- Updated dependencies
|
|
303
|
+
- @dt-ui/react-core@0.1.0-beta.19
|
|
304
|
+
- @dt-ui/react-icon@0.1.0-beta.16
|
|
305
|
+
- @dt-ui/react-typography@0.1.0-beta.10
|
|
306
|
+
|
|
307
|
+
## 0.1.0-beta.3
|
|
308
|
+
|
|
309
|
+
### Patch Changes
|
|
310
|
+
|
|
311
|
+
- test: change back to using withProviders
|
|
312
|
+
- fix: remove devDependecy export
|
|
313
|
+
- Updated dependencies
|
|
314
|
+
- @dt-ui/react-core@0.1.0-beta.18
|
|
315
|
+
- @dt-ui/react-icon@0.1.0-beta.15
|
|
316
|
+
- @dt-ui/react-typography@0.1.0-beta.9
|
|
317
|
+
|
|
318
|
+
## 0.1.0-beta.2
|
|
319
|
+
|
|
320
|
+
### Patch Changes
|
|
321
|
+
|
|
322
|
+
- fix: change default export to naming export
|
|
323
|
+
|
|
324
|
+
## 0.1.0-beta.1
|
|
325
|
+
|
|
326
|
+
### Patch Changes
|
|
327
|
+
|
|
328
|
+
- chore: make stepper an independent pkg
|
|
329
|
+
- test: add test custom render
|
|
330
|
+
- chore: move counter component to stepper pkg
|
|
331
|
+
- Updated dependencies
|
|
332
|
+
- @dt-ui/react-core@0.1.0-beta.17
|
|
333
|
+
- @dt-ui/react-icon@0.1.0-beta.14
|
|
334
|
+
- @dt-ui/react-typography@0.1.0-beta.8
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Daimler Truck AG.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Stepper Package
|
|
2
|
+
|
|
3
|
+
Steppers convey progress through steps. These steps can be numbered or not. However, they are sequential.
|
|
4
|
+
|
|
5
|
+
By default, for screens smaller than our `theme.breakpoints.md` the stepper orientation is always vertical.
|
|
6
|
+
|
|
7
|
+
## Stepper Usage
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { Stepper, Step } from '@dt-dds/react';
|
|
11
|
+
|
|
12
|
+
export const App = () => {
|
|
13
|
+
const options = ['API version definition', 'Specifications', 'Review'];
|
|
14
|
+
|
|
15
|
+
const currentStep = 3;
|
|
16
|
+
const completed = [1, 2];
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Stepper>
|
|
20
|
+
{options.map((opt, idx) => (
|
|
21
|
+
<Step
|
|
22
|
+
key={option.value}
|
|
23
|
+
isActive={currentStep === idx + 1}
|
|
24
|
+
isCompleted={completed.includes(idx + 1)}
|
|
25
|
+
>
|
|
26
|
+
<Step.Counter>{idx + 1}</Step.Counter>
|
|
27
|
+
<Step.Label>{opt}</Step.Label>
|
|
28
|
+
</Step>
|
|
29
|
+
))}
|
|
30
|
+
</Stepper>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Properties
|
|
36
|
+
|
|
37
|
+
| Property | Type | Default | Description |
|
|
38
|
+
| ------------- | ---------------------------- | --------------- | ------------------------------------------------------------------------------- |
|
|
39
|
+
| `children` | `ReactNode` | - | Child components to be rendered |
|
|
40
|
+
| `dataTestId` | `string` | default-stepper | Customizable test identifier. This id is concatenated with the -stepper string. |
|
|
41
|
+
| `orientation` | `"vertical" \| "horizontal"` | vertical | To specify the direction of the step bar. |
|
|
42
|
+
|
|
43
|
+
## Stack
|
|
44
|
+
|
|
45
|
+
- [TypeScript](https://www.typescriptlang.org/) for static type checking
|
|
46
|
+
- [React](https://reactjs.org/) — JavaScript library for user interfaces
|
|
47
|
+
- [Emotion](https://emotion.sh/docs/introduction) — for writing css styles with JavaScript
|
|
48
|
+
- [Storybook](https://storybook.js.org/) — UI component environment powered by Vite
|
|
49
|
+
- [Jest](https://jestjs.io/) - JavaScript Testing Framework
|
|
50
|
+
- [React Testing Library](https://testing-library.com/) - to test UI components in a user-centric way
|
|
51
|
+
- [ESLint](https://eslint.org/) for code linting
|
|
52
|
+
- [Prettier](https://prettier.io) for code formatting
|
|
53
|
+
- [Tsup](https://github.com/egoist/tsup) — TypeScript bundler powered by esbuild
|
|
54
|
+
- [Yarn](https://yarnpkg.com/) from managing packages
|
|
55
|
+
|
|
56
|
+
## Commands
|
|
57
|
+
|
|
58
|
+
- `yarn build` - Build the package
|
|
59
|
+
- `yarn dev` - Run the package locally
|
|
60
|
+
- `yarn lint` - Lint all files within this package
|
|
61
|
+
- `yarn test` - Run all unit tests
|
|
62
|
+
- `yarn test:report` - Open the test coverage report
|
|
63
|
+
- `yarn test:update:snapshot` - Run all unit tests and update the snapshot
|
|
64
|
+
|
|
65
|
+
## Compilation
|
|
66
|
+
|
|
67
|
+
Running `yarn build` from the root of the package will use [tsup](https://tsup.egoist.dev/) to compile the raw TypeScript and React code to plain JavaScript.
|
|
68
|
+
|
|
69
|
+
The `/dist` folder contains the compiled output.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
stepper
|
|
73
|
+
└── dist
|
|
74
|
+
├── index.d.ts <-- Types
|
|
75
|
+
├── index.js <-- CommonJS version
|
|
76
|
+
└── index.mjs <-- ES Modules version
|
|
77
|
+
...
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Versioning
|
|
81
|
+
|
|
82
|
+
Follows [semantic versioning](https://semver.org/)
|
|
83
|
+
|
|
84
|
+
## © License
|
|
85
|
+
|
|
86
|
+
Licensed under [MIT License](LICENSE.md)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseProps, Orientation, Colors, Theme } from '@dt-dds/react-core';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
interface StepperProps extends BaseProps {
|
|
5
|
+
orientation?: Orientation;
|
|
6
|
+
}
|
|
7
|
+
declare const Stepper: ({ children, dataTestId, orientation, }: StepperProps) => react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
interface BaseStepProps extends Pick<BaseProps, 'children'> {
|
|
10
|
+
isActive?: boolean;
|
|
11
|
+
isCompleted?: boolean;
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
isError?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const Step: {
|
|
16
|
+
({ children, isActive, isCompleted, isDisabled, isError, }: BaseStepProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
Counter: ({ children, isActive, isCompleted, isDisabled, isError, }: BaseStepProps) => react_jsx_runtime.JSX.Element;
|
|
18
|
+
Label({ children, isActive, isCompleted, isDisabled, isError, }: BaseStepProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
interface CounterProps extends BaseProps {
|
|
22
|
+
color?: Colors | 'disabled';
|
|
23
|
+
outlined?: boolean;
|
|
24
|
+
isLarge?: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare const Counter: ({ children, color, dataTestId, style, outlined, isLarge, }: CounterProps) => react_jsx_runtime.JSX.Element;
|
|
27
|
+
|
|
28
|
+
declare const useStepper: () => {
|
|
29
|
+
activeStep: number;
|
|
30
|
+
handleChangeStep: (step: number) => void;
|
|
31
|
+
handleNext: () => void;
|
|
32
|
+
handleBack: () => void;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare module '@emotion/react' {
|
|
36
|
+
interface Theme extends Theme {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { Counter, CounterProps, Step, Stepper, StepperProps, useStepper };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
+
|
|
44
|
+
// index.ts
|
|
45
|
+
var stepper_exports = {};
|
|
46
|
+
__export(stepper_exports, {
|
|
47
|
+
Counter: () => Counter,
|
|
48
|
+
Step: () => Step_default,
|
|
49
|
+
Stepper: () => Stepper,
|
|
50
|
+
useStepper: () => useStepper
|
|
51
|
+
});
|
|
52
|
+
module.exports = __toCommonJS(stepper_exports);
|
|
53
|
+
|
|
54
|
+
// src/Stepper.styled.ts
|
|
55
|
+
var import_styled = __toESM(require("@emotion/styled"));
|
|
56
|
+
var StepperStyled = import_styled.default.ul`
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
gap: 32px;
|
|
60
|
+
list-style: none;
|
|
61
|
+
|
|
62
|
+
${({ theme, orientation = "vertical" }) => `
|
|
63
|
+
@media only screen and (min-width: ${theme.breakpoints.md}px) {
|
|
64
|
+
flex-direction: ${orientation === "horizontal" ? "row" : "column"}
|
|
65
|
+
}
|
|
66
|
+
`}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
// src/Stepper.tsx
|
|
70
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
71
|
+
var Stepper = ({
|
|
72
|
+
children,
|
|
73
|
+
dataTestId,
|
|
74
|
+
orientation
|
|
75
|
+
}) => {
|
|
76
|
+
const testId = dataTestId != null ? dataTestId : "default";
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StepperStyled, { "data-testid": `${testId}-stepper`, orientation, children });
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/components/Step/Step.tsx
|
|
81
|
+
var import_react_icon = require("@dt-dds/react-icon");
|
|
82
|
+
var import_react_typography = require("@dt-dds/react-typography");
|
|
83
|
+
var import_react = require("@emotion/react");
|
|
84
|
+
var import_react2 = require("react");
|
|
85
|
+
|
|
86
|
+
// src/components/Counter/Counter.styled.ts
|
|
87
|
+
var import_styled2 = __toESM(require("@emotion/styled"));
|
|
88
|
+
var CounterStyled = import_styled2.default.span`
|
|
89
|
+
${({ theme, color, outlined, isLarge }) => `
|
|
90
|
+
${theme.fontStyles.tag}
|
|
91
|
+
color: ${theme.palette.content.contrast};
|
|
92
|
+
border: ${theme.spacing.none};
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
display: flex;
|
|
96
|
+
width: ${isLarge ? "24px" : "16px"};
|
|
97
|
+
height: ${isLarge ? "24px" : "16px"};
|
|
98
|
+
border-radius: 50%;
|
|
99
|
+
background-color: ${color === "disabled" ? theme.palette.content.default : theme.palette[color].default};
|
|
100
|
+
|
|
101
|
+
${outlined && `
|
|
102
|
+
border: 2px solid ${color === "disabled" ? theme.palette.content.light : theme.palette[color].default};
|
|
103
|
+
color: ${color === "disabled" ? theme.palette.content.light : theme.palette[color].default};
|
|
104
|
+
background-color: ${theme.palette.surface.contrast}
|
|
105
|
+
`};
|
|
106
|
+
`}
|
|
107
|
+
`;
|
|
108
|
+
|
|
109
|
+
// src/components/Counter/Counter.tsx
|
|
110
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
111
|
+
var Counter = ({
|
|
112
|
+
children,
|
|
113
|
+
color = "informative",
|
|
114
|
+
dataTestId,
|
|
115
|
+
style,
|
|
116
|
+
outlined = false,
|
|
117
|
+
isLarge = false
|
|
118
|
+
}) => {
|
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
120
|
+
CounterStyled,
|
|
121
|
+
{
|
|
122
|
+
color,
|
|
123
|
+
"data-testid": dataTestId != null ? dataTestId : "counter",
|
|
124
|
+
isLarge,
|
|
125
|
+
outlined,
|
|
126
|
+
style,
|
|
127
|
+
children
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// src/components/Step/Step.styled.ts
|
|
133
|
+
var import_styled3 = __toESM(require("@emotion/styled"));
|
|
134
|
+
var StepStyled = import_styled3.default.li`
|
|
135
|
+
display: flex;
|
|
136
|
+
gap: 12px;
|
|
137
|
+
align-items: center;
|
|
138
|
+
`;
|
|
139
|
+
var LabelStyled = import_styled3.default.span`
|
|
140
|
+
${({ theme, color }) => `
|
|
141
|
+
${theme.fontStyles.pSmall};
|
|
142
|
+
color: ${color === "disabled" ? theme.palette.content.light : theme.palette[color].default};
|
|
143
|
+
`}
|
|
144
|
+
`;
|
|
145
|
+
|
|
146
|
+
// src/components/Step/Step.tsx
|
|
147
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
148
|
+
var Step = ({
|
|
149
|
+
children,
|
|
150
|
+
isActive = false,
|
|
151
|
+
isCompleted = false,
|
|
152
|
+
isDisabled = false,
|
|
153
|
+
isError = false
|
|
154
|
+
}) => {
|
|
155
|
+
const clonedChildren = (0, import_react2.useMemo)(
|
|
156
|
+
() => import_react2.Children.map(children, (child) => {
|
|
157
|
+
return child && (0, import_react2.cloneElement)(child, __spreadValues({
|
|
158
|
+
isActive,
|
|
159
|
+
isCompleted,
|
|
160
|
+
isDisabled,
|
|
161
|
+
isError
|
|
162
|
+
}, child.props));
|
|
163
|
+
}),
|
|
164
|
+
[children, isActive, isCompleted, isDisabled, isError]
|
|
165
|
+
);
|
|
166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StepStyled, { children: clonedChildren });
|
|
167
|
+
};
|
|
168
|
+
var StepCounter = ({
|
|
169
|
+
children,
|
|
170
|
+
isActive = false,
|
|
171
|
+
isCompleted = false,
|
|
172
|
+
isDisabled = false,
|
|
173
|
+
isError = false
|
|
174
|
+
}) => {
|
|
175
|
+
const theme = (0, import_react.useTheme)();
|
|
176
|
+
const color = isError ? "error" : isDisabled ? "disabled" : "primary";
|
|
177
|
+
const bgColor = isError ? theme.palette.error.light : theme.palette.primary.light;
|
|
178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
179
|
+
Counter,
|
|
180
|
+
{
|
|
181
|
+
color,
|
|
182
|
+
isLarge: true,
|
|
183
|
+
outlined: !isCompleted,
|
|
184
|
+
style: __spreadValues({
|
|
185
|
+
borderWidth: 1
|
|
186
|
+
}, isActive && { backgroundColor: bgColor }),
|
|
187
|
+
children: isCompleted ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_icon.Icon, { code: "check", color: theme.palette.surface.light, size: "s" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
188
|
+
import_react_typography.Typography,
|
|
189
|
+
{
|
|
190
|
+
color: color === "disabled" ? "content.light" : `${color}.default`,
|
|
191
|
+
element: "span",
|
|
192
|
+
fontStyles: "pXXSmall",
|
|
193
|
+
style: {
|
|
194
|
+
fontWeight: 700,
|
|
195
|
+
width: 24,
|
|
196
|
+
height: 24,
|
|
197
|
+
display: "flex",
|
|
198
|
+
alignItems: "center",
|
|
199
|
+
justifyContent: "center"
|
|
200
|
+
},
|
|
201
|
+
children
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
Step.Counter = StepCounter;
|
|
208
|
+
var labelColor = ({
|
|
209
|
+
isActive,
|
|
210
|
+
isError,
|
|
211
|
+
isDisabled,
|
|
212
|
+
isCompleted
|
|
213
|
+
}) => {
|
|
214
|
+
if (isError) {
|
|
215
|
+
return "error";
|
|
216
|
+
} else if (isActive || isCompleted) {
|
|
217
|
+
return "primary";
|
|
218
|
+
} else if (isDisabled) {
|
|
219
|
+
return "disabled";
|
|
220
|
+
} else {
|
|
221
|
+
return "secondary";
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
Step.Label = ({
|
|
225
|
+
children,
|
|
226
|
+
isActive = false,
|
|
227
|
+
isCompleted = false,
|
|
228
|
+
isDisabled = false,
|
|
229
|
+
isError = false
|
|
230
|
+
}) => {
|
|
231
|
+
const color = labelColor({ isActive, isError, isDisabled, isCompleted });
|
|
232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LabelStyled, { color, children });
|
|
233
|
+
};
|
|
234
|
+
var Step_default = Step;
|
|
235
|
+
|
|
236
|
+
// src/hooks/useStepper.ts
|
|
237
|
+
var import_react3 = require("react");
|
|
238
|
+
var useStepper = () => {
|
|
239
|
+
const [activeStep, setActiveStep] = (0, import_react3.useState)(0);
|
|
240
|
+
const handleNext = () => {
|
|
241
|
+
setActiveStep((activeStep2) => activeStep2 + 1);
|
|
242
|
+
};
|
|
243
|
+
const handleBack = () => {
|
|
244
|
+
setActiveStep((activeStep2) => activeStep2 - 1);
|
|
245
|
+
};
|
|
246
|
+
const handleChangeStep = (0, import_react3.useCallback)((step) => {
|
|
247
|
+
setActiveStep(step);
|
|
248
|
+
}, []);
|
|
249
|
+
return {
|
|
250
|
+
activeStep,
|
|
251
|
+
handleChangeStep,
|
|
252
|
+
handleNext,
|
|
253
|
+
handleBack
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
257
|
+
0 && (module.exports = {
|
|
258
|
+
Counter,
|
|
259
|
+
Step,
|
|
260
|
+
Stepper,
|
|
261
|
+
useStepper
|
|
262
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// src/Stepper.styled.ts
|
|
19
|
+
import styled from "@emotion/styled";
|
|
20
|
+
var StepperStyled = styled.ul`
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: 32px;
|
|
24
|
+
list-style: none;
|
|
25
|
+
|
|
26
|
+
${({ theme, orientation = "vertical" }) => `
|
|
27
|
+
@media only screen and (min-width: ${theme.breakpoints.md}px) {
|
|
28
|
+
flex-direction: ${orientation === "horizontal" ? "row" : "column"}
|
|
29
|
+
}
|
|
30
|
+
`}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
// src/Stepper.tsx
|
|
34
|
+
import { jsx } from "react/jsx-runtime";
|
|
35
|
+
var Stepper = ({
|
|
36
|
+
children,
|
|
37
|
+
dataTestId,
|
|
38
|
+
orientation
|
|
39
|
+
}) => {
|
|
40
|
+
const testId = dataTestId != null ? dataTestId : "default";
|
|
41
|
+
return /* @__PURE__ */ jsx(StepperStyled, { "data-testid": `${testId}-stepper`, orientation, children });
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// src/components/Step/Step.tsx
|
|
45
|
+
import { Icon } from "@dt-dds/react-icon";
|
|
46
|
+
import { Typography } from "@dt-dds/react-typography";
|
|
47
|
+
import { useTheme } from "@emotion/react";
|
|
48
|
+
import { Children, cloneElement, useMemo } from "react";
|
|
49
|
+
|
|
50
|
+
// src/components/Counter/Counter.styled.ts
|
|
51
|
+
import styled2 from "@emotion/styled";
|
|
52
|
+
var CounterStyled = styled2.span`
|
|
53
|
+
${({ theme, color, outlined, isLarge }) => `
|
|
54
|
+
${theme.fontStyles.tag}
|
|
55
|
+
color: ${theme.palette.content.contrast};
|
|
56
|
+
border: ${theme.spacing.none};
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
display: flex;
|
|
60
|
+
width: ${isLarge ? "24px" : "16px"};
|
|
61
|
+
height: ${isLarge ? "24px" : "16px"};
|
|
62
|
+
border-radius: 50%;
|
|
63
|
+
background-color: ${color === "disabled" ? theme.palette.content.default : theme.palette[color].default};
|
|
64
|
+
|
|
65
|
+
${outlined && `
|
|
66
|
+
border: 2px solid ${color === "disabled" ? theme.palette.content.light : theme.palette[color].default};
|
|
67
|
+
color: ${color === "disabled" ? theme.palette.content.light : theme.palette[color].default};
|
|
68
|
+
background-color: ${theme.palette.surface.contrast}
|
|
69
|
+
`};
|
|
70
|
+
`}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
// src/components/Counter/Counter.tsx
|
|
74
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
75
|
+
var Counter = ({
|
|
76
|
+
children,
|
|
77
|
+
color = "informative",
|
|
78
|
+
dataTestId,
|
|
79
|
+
style,
|
|
80
|
+
outlined = false,
|
|
81
|
+
isLarge = false
|
|
82
|
+
}) => {
|
|
83
|
+
return /* @__PURE__ */ jsx2(
|
|
84
|
+
CounterStyled,
|
|
85
|
+
{
|
|
86
|
+
color,
|
|
87
|
+
"data-testid": dataTestId != null ? dataTestId : "counter",
|
|
88
|
+
isLarge,
|
|
89
|
+
outlined,
|
|
90
|
+
style,
|
|
91
|
+
children
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// src/components/Step/Step.styled.ts
|
|
97
|
+
import styled3 from "@emotion/styled";
|
|
98
|
+
var StepStyled = styled3.li`
|
|
99
|
+
display: flex;
|
|
100
|
+
gap: 12px;
|
|
101
|
+
align-items: center;
|
|
102
|
+
`;
|
|
103
|
+
var LabelStyled = styled3.span`
|
|
104
|
+
${({ theme, color }) => `
|
|
105
|
+
${theme.fontStyles.pSmall};
|
|
106
|
+
color: ${color === "disabled" ? theme.palette.content.light : theme.palette[color].default};
|
|
107
|
+
`}
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
// src/components/Step/Step.tsx
|
|
111
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
112
|
+
var Step = ({
|
|
113
|
+
children,
|
|
114
|
+
isActive = false,
|
|
115
|
+
isCompleted = false,
|
|
116
|
+
isDisabled = false,
|
|
117
|
+
isError = false
|
|
118
|
+
}) => {
|
|
119
|
+
const clonedChildren = useMemo(
|
|
120
|
+
() => Children.map(children, (child) => {
|
|
121
|
+
return child && cloneElement(child, __spreadValues({
|
|
122
|
+
isActive,
|
|
123
|
+
isCompleted,
|
|
124
|
+
isDisabled,
|
|
125
|
+
isError
|
|
126
|
+
}, child.props));
|
|
127
|
+
}),
|
|
128
|
+
[children, isActive, isCompleted, isDisabled, isError]
|
|
129
|
+
);
|
|
130
|
+
return /* @__PURE__ */ jsx3(StepStyled, { children: clonedChildren });
|
|
131
|
+
};
|
|
132
|
+
var StepCounter = ({
|
|
133
|
+
children,
|
|
134
|
+
isActive = false,
|
|
135
|
+
isCompleted = false,
|
|
136
|
+
isDisabled = false,
|
|
137
|
+
isError = false
|
|
138
|
+
}) => {
|
|
139
|
+
const theme = useTheme();
|
|
140
|
+
const color = isError ? "error" : isDisabled ? "disabled" : "primary";
|
|
141
|
+
const bgColor = isError ? theme.palette.error.light : theme.palette.primary.light;
|
|
142
|
+
return /* @__PURE__ */ jsx3(
|
|
143
|
+
Counter,
|
|
144
|
+
{
|
|
145
|
+
color,
|
|
146
|
+
isLarge: true,
|
|
147
|
+
outlined: !isCompleted,
|
|
148
|
+
style: __spreadValues({
|
|
149
|
+
borderWidth: 1
|
|
150
|
+
}, isActive && { backgroundColor: bgColor }),
|
|
151
|
+
children: isCompleted ? /* @__PURE__ */ jsx3(Icon, { code: "check", color: theme.palette.surface.light, size: "s" }) : /* @__PURE__ */ jsx3(
|
|
152
|
+
Typography,
|
|
153
|
+
{
|
|
154
|
+
color: color === "disabled" ? "content.light" : `${color}.default`,
|
|
155
|
+
element: "span",
|
|
156
|
+
fontStyles: "pXXSmall",
|
|
157
|
+
style: {
|
|
158
|
+
fontWeight: 700,
|
|
159
|
+
width: 24,
|
|
160
|
+
height: 24,
|
|
161
|
+
display: "flex",
|
|
162
|
+
alignItems: "center",
|
|
163
|
+
justifyContent: "center"
|
|
164
|
+
},
|
|
165
|
+
children
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
Step.Counter = StepCounter;
|
|
172
|
+
var labelColor = ({
|
|
173
|
+
isActive,
|
|
174
|
+
isError,
|
|
175
|
+
isDisabled,
|
|
176
|
+
isCompleted
|
|
177
|
+
}) => {
|
|
178
|
+
if (isError) {
|
|
179
|
+
return "error";
|
|
180
|
+
} else if (isActive || isCompleted) {
|
|
181
|
+
return "primary";
|
|
182
|
+
} else if (isDisabled) {
|
|
183
|
+
return "disabled";
|
|
184
|
+
} else {
|
|
185
|
+
return "secondary";
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
Step.Label = ({
|
|
189
|
+
children,
|
|
190
|
+
isActive = false,
|
|
191
|
+
isCompleted = false,
|
|
192
|
+
isDisabled = false,
|
|
193
|
+
isError = false
|
|
194
|
+
}) => {
|
|
195
|
+
const color = labelColor({ isActive, isError, isDisabled, isCompleted });
|
|
196
|
+
return /* @__PURE__ */ jsx3(LabelStyled, { color, children });
|
|
197
|
+
};
|
|
198
|
+
var Step_default = Step;
|
|
199
|
+
|
|
200
|
+
// src/hooks/useStepper.ts
|
|
201
|
+
import { useCallback, useState } from "react";
|
|
202
|
+
var useStepper = () => {
|
|
203
|
+
const [activeStep, setActiveStep] = useState(0);
|
|
204
|
+
const handleNext = () => {
|
|
205
|
+
setActiveStep((activeStep2) => activeStep2 + 1);
|
|
206
|
+
};
|
|
207
|
+
const handleBack = () => {
|
|
208
|
+
setActiveStep((activeStep2) => activeStep2 - 1);
|
|
209
|
+
};
|
|
210
|
+
const handleChangeStep = useCallback((step) => {
|
|
211
|
+
setActiveStep(step);
|
|
212
|
+
}, []);
|
|
213
|
+
return {
|
|
214
|
+
activeStep,
|
|
215
|
+
handleChangeStep,
|
|
216
|
+
handleNext,
|
|
217
|
+
handleBack
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
export {
|
|
221
|
+
Counter,
|
|
222
|
+
Step_default as Step,
|
|
223
|
+
Stepper,
|
|
224
|
+
useStepper
|
|
225
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dt-dds/react-stepper",
|
|
3
|
+
"version": "1.0.0-beta.31",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.mjs",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/**"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsup",
|
|
16
|
+
"dev": "tsup --watch",
|
|
17
|
+
"lint": "eslint --cache .",
|
|
18
|
+
"test": "jest",
|
|
19
|
+
"test:report": "open ./jest-coverage/lcov-report/index.html",
|
|
20
|
+
"test:update:snapshot": "jest -u"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@dt-dds/react-core": "1.0.0-beta.41",
|
|
24
|
+
"@dt-dds/react-typography": "1.0.0-beta.32",
|
|
25
|
+
"@dt-dds/react-icon": "1.0.0-beta.42"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@babel/core": "^7.22.9",
|
|
29
|
+
"@babel/preset-env": "^7.22.9",
|
|
30
|
+
"@babel/preset-react": "^7.22.5",
|
|
31
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
32
|
+
"@emotion/babel-plugin": "^11.11.0",
|
|
33
|
+
"@emotion/css": "^11.7.1",
|
|
34
|
+
"@emotion/jest": "^11.10.0",
|
|
35
|
+
"@emotion/react": "^11.8.2",
|
|
36
|
+
"@emotion/styled": "^11.8.1",
|
|
37
|
+
"@types/react": "^18.0.9",
|
|
38
|
+
"@types/react-dom": "^18.0.4",
|
|
39
|
+
"babel-loader": "^8.3.0",
|
|
40
|
+
"eslint-config-custom": "*",
|
|
41
|
+
"eslint-plugin-storybook": "^9.1.0",
|
|
42
|
+
"jest-config": "*",
|
|
43
|
+
"react": "^18.1.0",
|
|
44
|
+
"react-dom": "^18.2.0",
|
|
45
|
+
"tsconfig": "*",
|
|
46
|
+
"tsup": "^6.6.3",
|
|
47
|
+
"typescript": "^4.5.3"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@emotion/css": "^11.7.1",
|
|
51
|
+
"@emotion/react": "^11.8.2",
|
|
52
|
+
"@emotion/styled": "^11.8.1",
|
|
53
|
+
"react": ">=17.0.2",
|
|
54
|
+
"react-dom": ">=17.0.2"
|
|
55
|
+
}
|
|
56
|
+
}
|