@xaypay/tui 0.0.9 → 0.0.12
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/dist/index.es.js +142 -248
- package/dist/index.js +107 -236
- package/package.json +1 -1
- package/src/components/stepper/index.js +45 -0
- package/src/components/stepper/stepper.module.css +48 -0
- package/src/components/stepper/stepper.stories.js +17 -0
- package/src/index.js +2 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import styles from "./stepper.module.css";
|
|
5
|
+
|
|
6
|
+
export const Stepper = ({ className, onChange, stepLength, activeSteps }) => {
|
|
7
|
+
const classProps = classNames(className);
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
{(() => {
|
|
11
|
+
let steppers = [];
|
|
12
|
+
for (let step = 1; step <= stepLength; step++) {
|
|
13
|
+
steppers.push(
|
|
14
|
+
<div
|
|
15
|
+
className={classNames(
|
|
16
|
+
`${step <= activeSteps ? styles.activeRing : styles.bigRing}`
|
|
17
|
+
)}
|
|
18
|
+
key={step}
|
|
19
|
+
>
|
|
20
|
+
<div
|
|
21
|
+
className={classNames(
|
|
22
|
+
`${
|
|
23
|
+
step <= activeSteps
|
|
24
|
+
? styles.smallActiveRing
|
|
25
|
+
: styles.smallRing
|
|
26
|
+
}`
|
|
27
|
+
)}
|
|
28
|
+
>
|
|
29
|
+
{step <= activeSteps ? step : ""}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return steppers;
|
|
35
|
+
})()}
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
Stepper.propTypes = {
|
|
41
|
+
className: PropTypes.string,
|
|
42
|
+
onChange: PropTypes.func,
|
|
43
|
+
stepLength: PropTypes.number,
|
|
44
|
+
activeSteps: PropTypes.number,
|
|
45
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.bigRing {
|
|
2
|
+
width: 30px;
|
|
3
|
+
height: 30px;
|
|
4
|
+
border: 1px solid gray;
|
|
5
|
+
border-radius: 50%;
|
|
6
|
+
position: relative;
|
|
7
|
+
margin: 10px;
|
|
8
|
+
cursor:pointer;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.smallRing {
|
|
12
|
+
position: absolute;
|
|
13
|
+
width: 50%;
|
|
14
|
+
height: 50%;
|
|
15
|
+
border-radius: 50%;
|
|
16
|
+
background-color: gray;
|
|
17
|
+
top: 50%;
|
|
18
|
+
left: 50%;
|
|
19
|
+
transform: translate(-50%, -50%);
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
color: white;
|
|
22
|
+
text-align: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
.activeRing {
|
|
27
|
+
width: 30px;
|
|
28
|
+
height: 30px;
|
|
29
|
+
border: 1px solid blue;
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
position: relative;
|
|
32
|
+
margin: 10px;
|
|
33
|
+
cursor:pointer;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.smallActiveRing {
|
|
37
|
+
position: absolute;
|
|
38
|
+
width: 50%;
|
|
39
|
+
height: 50%;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
background-color: blue;
|
|
42
|
+
top: 50%;
|
|
43
|
+
left: 50%;
|
|
44
|
+
transform: translate(-50%, -50%);
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
color: white;
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Stepper } from "./index";
|
|
3
|
+
export default {
|
|
4
|
+
component: Stepper,
|
|
5
|
+
title: "Components/Stepper",
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const Template = ({ stepLength, activeSteps }) => {
|
|
9
|
+
return <Stepper stepLength={stepLength} activeSteps={activeSteps} />;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Default = Template.bind({});
|
|
13
|
+
|
|
14
|
+
Default.args = {
|
|
15
|
+
stepLength: 5,
|
|
16
|
+
activeSteps: 3,
|
|
17
|
+
};
|
package/src/index.js
CHANGED
|
@@ -2,9 +2,10 @@ export * from './components/button';
|
|
|
2
2
|
export * from './components/typography';
|
|
3
3
|
export * from './components/autocomplate';
|
|
4
4
|
export * from './components/checkbox';
|
|
5
|
-
export * from './components/icon';
|
|
5
|
+
export * from './components/icon/Icon';
|
|
6
6
|
export * from './components/input';
|
|
7
7
|
export * from './components/pagination';
|
|
8
8
|
export * from './components/radio';
|
|
9
9
|
export * from './components/captcha';
|
|
10
|
+
export * from './components/stepper';
|
|
10
11
|
// export * from './components/select';
|