@quen-ui/components 1.1.0 → 1.2.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.
- package/dist/Banner/Banner.cjs.js +96 -0
- package/dist/Banner/Banner.d.ts +4 -0
- package/dist/Banner/Banner.es.js +96 -0
- package/dist/Banner/index.d.ts +2 -0
- package/dist/Banner/styles.cjs.js +113 -0
- package/dist/Banner/styles.d.ts +12 -0
- package/dist/Banner/styles.es.js +113 -0
- package/dist/Banner/types.d.ts +40 -0
- package/dist/Dropdown/Dropdown.cjs.js +47 -43
- package/dist/Dropdown/Dropdown.d.ts +1 -1
- package/dist/Dropdown/Dropdown.es.js +48 -44
- package/dist/Dropdown/DropdownItem.cjs.js +10 -13
- package/dist/Dropdown/DropdownItem.es.js +10 -13
- package/dist/Dropdown/DropdownList.cjs.js +0 -2
- package/dist/Dropdown/DropdownList.es.js +0 -2
- package/dist/InputBase/InputBase.cjs.js +55 -12
- package/dist/InputBase/InputBase.d.ts +1 -1
- package/dist/InputBase/InputBase.es.js +57 -14
- package/dist/InputBase/styles.cjs.js +44 -4
- package/dist/InputBase/styles.d.ts +7 -1
- package/dist/InputBase/styles.es.js +45 -5
- package/dist/InputBase/types.d.ts +5 -1
- package/dist/InputDate/styles.d.ts +1 -1
- package/dist/InputNumber/styles.d.ts +1 -1
- package/dist/Select/Select.cjs.js +2 -5
- package/dist/Select/Select.es.js +2 -5
- package/dist/Select/helpers.d.ts +8 -0
- package/dist/Select/styles.d.ts +1 -1
- package/dist/Select/useSelect.d.ts +8 -0
- package/dist/Slider/Slider.cjs.js +122 -224
- package/dist/Slider/Slider.d.ts +1 -1
- package/dist/Slider/Slider.es.js +125 -227
- package/dist/Slider/styles.cjs.js +49 -32
- package/dist/Slider/styles.d.ts +1 -1
- package/dist/Slider/styles.es.js +49 -32
- package/dist/Slider/useSlider.cjs.js +194 -0
- package/dist/Slider/useSlider.d.ts +11 -0
- package/dist/Slider/useSlider.es.js +194 -0
- package/dist/Stepper/Step.cjs.js +114 -0
- package/dist/Stepper/Step.d.ts +2 -0
- package/dist/Stepper/Step.es.js +114 -0
- package/dist/Stepper/StepContent.cjs.js +10 -0
- package/dist/Stepper/StepContent.d.ts +4 -0
- package/dist/Stepper/StepContent.es.js +10 -0
- package/dist/Stepper/StepLabel.cjs.js +28 -0
- package/dist/Stepper/StepLabel.d.ts +2 -0
- package/dist/Stepper/StepLabel.es.js +28 -0
- package/dist/Stepper/Stepper.cjs.js +54 -0
- package/dist/Stepper/Stepper.d.ts +2 -0
- package/dist/Stepper/Stepper.es.js +54 -0
- package/dist/Stepper/StepperContext.cjs.js +13 -0
- package/dist/Stepper/StepperContext.d.ts +3 -0
- package/dist/Stepper/StepperContext.es.js +13 -0
- package/dist/Stepper/index.cjs.js +10 -0
- package/dist/Stepper/index.d.ts +12 -0
- package/dist/Stepper/index.es.js +11 -0
- package/dist/Stepper/styles.cjs.js +149 -0
- package/dist/Stepper/styles.d.ts +44 -0
- package/dist/Stepper/styles.es.js +149 -0
- package/dist/Stepper/types.d.ts +70 -0
- package/dist/TextField/TextField.cjs.js +4 -0
- package/dist/TextField/TextField.d.ts +1 -1
- package/dist/TextField/TextField.es.js +4 -0
- package/dist/TextField/styles.d.ts +1 -1
- package/dist/Textarea/styles.d.ts +1 -1
- package/dist/Tooltip/Tooltip.cjs.js +3 -1
- package/dist/Tooltip/Tooltip.es.js +4 -2
- package/dist/index.cjs.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StepLabelContainerStyled } from "./styles.es.js";
|
|
3
|
+
import { useStepperContext } from "./StepperContext.es.js";
|
|
4
|
+
import Text from "../typography/Text/Text.es.js";
|
|
5
|
+
const StepLabel = ({
|
|
6
|
+
children,
|
|
7
|
+
optional,
|
|
8
|
+
error,
|
|
9
|
+
className
|
|
10
|
+
}) => {
|
|
11
|
+
const context = useStepperContext();
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
StepLabelContainerStyled,
|
|
14
|
+
{
|
|
15
|
+
className,
|
|
16
|
+
orientation: context.orientation,
|
|
17
|
+
active: context.__stepActive,
|
|
18
|
+
completed: context.__stepCompleted,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Text, { size: "l", className: "step-label-text", type: error ? "danger" : void 0, children }),
|
|
21
|
+
optional && /* @__PURE__ */ jsx(Text, { size: "s", type: "secondary", children: optional })
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
StepLabel
|
|
28
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const styles = require("./styles.cjs.js");
|
|
6
|
+
const StepperContext = require("./StepperContext.cjs.js");
|
|
7
|
+
const Step = require("./Step.cjs.js");
|
|
8
|
+
const DefaultConnector = ({ orientation, completed, active }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9
|
+
styles.DefaultConnectorLineStyled,
|
|
10
|
+
{
|
|
11
|
+
orientation,
|
|
12
|
+
completed,
|
|
13
|
+
active
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
const Stepper = ({
|
|
17
|
+
children,
|
|
18
|
+
activeStep = 0,
|
|
19
|
+
orientation = "horizontal",
|
|
20
|
+
connector = /* @__PURE__ */ jsxRuntime.jsx(DefaultConnector, { orientation }),
|
|
21
|
+
className,
|
|
22
|
+
style
|
|
23
|
+
}) => {
|
|
24
|
+
const steps = React.useMemo(() => {
|
|
25
|
+
return React.Children.toArray(children).filter(
|
|
26
|
+
(child) => React.isValidElement(child) && child.type === Step.Step
|
|
27
|
+
);
|
|
28
|
+
}, [children]);
|
|
29
|
+
const contextValue = React.useMemo(
|
|
30
|
+
() => ({
|
|
31
|
+
activeStep,
|
|
32
|
+
orientation,
|
|
33
|
+
connector
|
|
34
|
+
}),
|
|
35
|
+
[activeStep, orientation, connector]
|
|
36
|
+
);
|
|
37
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StepperContext.StepperContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
|
+
styles.StepperContainerStyled,
|
|
39
|
+
{
|
|
40
|
+
className,
|
|
41
|
+
style,
|
|
42
|
+
orientation,
|
|
43
|
+
children: steps.map((step, index) => {
|
|
44
|
+
const additionalProps = {
|
|
45
|
+
index,
|
|
46
|
+
last: index === steps.length - 1,
|
|
47
|
+
active: activeStep === index
|
|
48
|
+
};
|
|
49
|
+
return React.cloneElement(step, additionalProps);
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
) });
|
|
53
|
+
};
|
|
54
|
+
exports.Stepper = Stepper;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, Children, isValidElement, cloneElement } from "react";
|
|
3
|
+
import { StepperContainerStyled, DefaultConnectorLineStyled } from "./styles.es.js";
|
|
4
|
+
import { StepperContext } from "./StepperContext.es.js";
|
|
5
|
+
import { Step } from "./Step.es.js";
|
|
6
|
+
const DefaultConnector = ({ orientation, completed, active }) => /* @__PURE__ */ jsx(
|
|
7
|
+
DefaultConnectorLineStyled,
|
|
8
|
+
{
|
|
9
|
+
orientation,
|
|
10
|
+
completed,
|
|
11
|
+
active
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
const Stepper = ({
|
|
15
|
+
children,
|
|
16
|
+
activeStep = 0,
|
|
17
|
+
orientation = "horizontal",
|
|
18
|
+
connector = /* @__PURE__ */ jsx(DefaultConnector, { orientation }),
|
|
19
|
+
className,
|
|
20
|
+
style
|
|
21
|
+
}) => {
|
|
22
|
+
const steps = useMemo(() => {
|
|
23
|
+
return Children.toArray(children).filter(
|
|
24
|
+
(child) => isValidElement(child) && child.type === Step
|
|
25
|
+
);
|
|
26
|
+
}, [children]);
|
|
27
|
+
const contextValue = useMemo(
|
|
28
|
+
() => ({
|
|
29
|
+
activeStep,
|
|
30
|
+
orientation,
|
|
31
|
+
connector
|
|
32
|
+
}),
|
|
33
|
+
[activeStep, orientation, connector]
|
|
34
|
+
);
|
|
35
|
+
return /* @__PURE__ */ jsx(StepperContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
36
|
+
StepperContainerStyled,
|
|
37
|
+
{
|
|
38
|
+
className,
|
|
39
|
+
style,
|
|
40
|
+
orientation,
|
|
41
|
+
children: steps.map((step, index) => {
|
|
42
|
+
const additionalProps = {
|
|
43
|
+
index,
|
|
44
|
+
last: index === steps.length - 1,
|
|
45
|
+
active: activeStep === index
|
|
46
|
+
};
|
|
47
|
+
return cloneElement(step, additionalProps);
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
) });
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
Stepper
|
|
54
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const StepperContext = React.createContext(null);
|
|
5
|
+
const useStepperContext = () => {
|
|
6
|
+
const context = React.useContext(StepperContext);
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error("StepperContext must be used within StepperContext");
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
};
|
|
12
|
+
exports.StepperContext = StepperContext;
|
|
13
|
+
exports.useStepperContext = useStepperContext;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const StepperContext = createContext(null);
|
|
3
|
+
const useStepperContext = () => {
|
|
4
|
+
const context = useContext(StepperContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("StepperContext must be used within StepperContext");
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
StepperContext,
|
|
12
|
+
useStepperContext
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const Stepper$1 = require("./Stepper.cjs.js");
|
|
3
|
+
const Step = require("./Step.cjs.js");
|
|
4
|
+
const StepLabel = require("./StepLabel.cjs.js");
|
|
5
|
+
const StepContent = require("./StepContent.cjs.js");
|
|
6
|
+
const Stepper = Stepper$1.Stepper;
|
|
7
|
+
Stepper.Step = Step.Step;
|
|
8
|
+
Stepper.Label = StepLabel.StepLabel;
|
|
9
|
+
Stepper.Content = StepContent.StepContent;
|
|
10
|
+
module.exports = Stepper;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Stepper as StepperComponent } from './Stepper';
|
|
2
|
+
import { Step } from './Step';
|
|
3
|
+
import { StepLabel } from './StepLabel';
|
|
4
|
+
import { StepContent } from './StepContent';
|
|
5
|
+
type TStepper = typeof StepperComponent & {
|
|
6
|
+
Step: typeof Step;
|
|
7
|
+
Label: typeof StepLabel;
|
|
8
|
+
Content: typeof StepContent;
|
|
9
|
+
};
|
|
10
|
+
declare const Stepper: TStepper;
|
|
11
|
+
export type { IStepProps, IStepLabelProps, IStepperProps } from './types';
|
|
12
|
+
export default Stepper;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Stepper as Stepper$1 } from "./Stepper.es.js";
|
|
2
|
+
import { Step } from "./Step.es.js";
|
|
3
|
+
import { StepLabel } from "./StepLabel.es.js";
|
|
4
|
+
import { StepContent } from "./StepContent.es.js";
|
|
5
|
+
const Stepper = Stepper$1;
|
|
6
|
+
Stepper.Step = Step;
|
|
7
|
+
Stepper.Label = StepLabel;
|
|
8
|
+
Stepper.Content = StepContent;
|
|
9
|
+
export {
|
|
10
|
+
Stepper as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const styled = require("styled-components");
|
|
4
|
+
const StepIconWrapper = styled.div.withConfig({
|
|
5
|
+
shouldForwardProp: (prop) => !["active", "completed", "error"].includes(prop)
|
|
6
|
+
})`
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
min-width: ${({ theme }) => theme.components.Stepper.iconSize};
|
|
11
|
+
width: ${({ theme }) => theme.components.Stepper.iconSize};
|
|
12
|
+
height: ${({ theme }) => theme.components.Stepper.iconSize};
|
|
13
|
+
border-radius: ${({ theme }) => theme.components.Stepper.iconRadius};
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
background-color: ${({ active, completed, error, theme }) => {
|
|
16
|
+
if (error) return theme.components.Stepper.iconBackground.error;
|
|
17
|
+
if (completed) return theme.components.Stepper.iconBackground.completed;
|
|
18
|
+
if (active) return theme.components.Stepper.iconBackground.active;
|
|
19
|
+
return theme.components.Stepper.iconBackground.default;
|
|
20
|
+
}};
|
|
21
|
+
color: ${({ active, completed, error, theme }) => active || completed || error ? theme.components.Stepper.iconColor.active : theme.components.Stepper.iconColor.default};
|
|
22
|
+
transition: background-color 0.2s;
|
|
23
|
+
`;
|
|
24
|
+
const StepMiddleBlock = styled.div.withConfig({
|
|
25
|
+
shouldForwardProp: (prop) => !["orientation"].includes(prop)
|
|
26
|
+
})`
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
flex: ${({ orientation }) => orientation === "horizontal" ? "0 1 auto" : 1};
|
|
30
|
+
min-width: 0;
|
|
31
|
+
|
|
32
|
+
margin-left: ${({ orientation, theme }) => orientation === "horizontal" ? theme.space.s : theme.space.m};
|
|
33
|
+
margin-right: ${({ orientation, theme }) => orientation === "horizontal" ? theme.space.s : theme.space.s};
|
|
34
|
+
`;
|
|
35
|
+
const StepLabelContainerStyled = styled.div.withConfig({
|
|
36
|
+
shouldForwardProp: (prop) => !["orientation", "active", "completed"].includes(prop)
|
|
37
|
+
})`
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
min-width: 0;
|
|
41
|
+
|
|
42
|
+
text-align: ${({ orientation }) => orientation === "horizontal" ? "left" : "left"};
|
|
43
|
+
align-items: flex-start;
|
|
44
|
+
|
|
45
|
+
.step-label-text {
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
const DefaultConnectorLineStyled = styled.span.withConfig({
|
|
53
|
+
shouldForwardProp: (prop) => !["orientation", "completed", "active"].includes(prop)
|
|
54
|
+
})`
|
|
55
|
+
display: block;
|
|
56
|
+
${({ orientation, theme, completed, active }) => {
|
|
57
|
+
const lineColor = completed || active ? theme.components.Stepper.connectorColor.active : theme.components.Stepper.connectorColor.default;
|
|
58
|
+
return orientation === "horizontal" ? styled.css`
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: ${theme.components.Stepper.connectorThickness};
|
|
61
|
+
background-color: ${lineColor};
|
|
62
|
+
` : styled.css`
|
|
63
|
+
width: ${theme.components.Stepper.connectorThickness};
|
|
64
|
+
height: 100%;
|
|
65
|
+
min-height: 24px;
|
|
66
|
+
background-color: ${lineColor};
|
|
67
|
+
`;
|
|
68
|
+
}}
|
|
69
|
+
`;
|
|
70
|
+
const ConnectorContainerStyled = styled.div.withConfig({
|
|
71
|
+
shouldForwardProp: (prop) => !["orientation"].includes(prop)
|
|
72
|
+
})`
|
|
73
|
+
${({ orientation, theme }) => orientation === "horizontal" ? styled.css`
|
|
74
|
+
flex: 1;
|
|
75
|
+
min-width: ${theme.components.Stepper.connectorMinWidth};
|
|
76
|
+
align-self: flex-start;
|
|
77
|
+
margin-top: calc(
|
|
78
|
+
(${theme.components.Stepper.iconSize} / 2) -
|
|
79
|
+
(${theme.components.Stepper.connectorThickness} / 2)
|
|
80
|
+
);
|
|
81
|
+
margin-right: ${theme.space.s};
|
|
82
|
+
` : styled.css`
|
|
83
|
+
flex: 1;
|
|
84
|
+
align-self: stretch;
|
|
85
|
+
min-height: ${theme.components.Stepper.connectorMinWidth};
|
|
86
|
+
margin-top: ${theme.space.s};
|
|
87
|
+
justify-content: center;
|
|
88
|
+
display: flex;
|
|
89
|
+
margin-bottom: ${theme.space.s};
|
|
90
|
+
`}
|
|
91
|
+
`;
|
|
92
|
+
const StepContainerStyled = styled.div.withConfig({
|
|
93
|
+
shouldForwardProp: (prop) => !["orientation", "alternativeLabel", "clickable", "disabled"].includes(prop)
|
|
94
|
+
})`
|
|
95
|
+
display: flex;
|
|
96
|
+
flex: ${({ orientation }) => orientation === "horizontal" ? 1 : "0 1 auto"};
|
|
97
|
+
flex-direction: row;
|
|
98
|
+
align-items: ${({ orientation }) => orientation === "vertical" ? "stretch" : "flex-start"};
|
|
99
|
+
position: relative;
|
|
100
|
+
min-width: ${({ orientation }) => orientation === "horizontal" ? "100px" : "auto"};
|
|
101
|
+
|
|
102
|
+
${({ clickable, disabled, theme }) => clickable && !disabled && styled.css`
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
&:hover ${StepIconWrapper} {
|
|
105
|
+
background-color: ${theme.components.Stepper.iconBackground.hover};
|
|
106
|
+
}
|
|
107
|
+
`}
|
|
108
|
+
|
|
109
|
+
${({ disabled, theme }) => disabled && styled.css`
|
|
110
|
+
opacity: ${theme.components.Stepper.disabledOpacity};
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
`}
|
|
113
|
+
`;
|
|
114
|
+
const StepperContainerStyled = styled.div.withConfig({
|
|
115
|
+
shouldForwardProp: (prop) => !["orientation"].includes(prop)
|
|
116
|
+
})`
|
|
117
|
+
display: flex;
|
|
118
|
+
${({ orientation }) => orientation === "horizontal" ? styled.css`
|
|
119
|
+
flex-direction: row;
|
|
120
|
+
justify-content: space-between;
|
|
121
|
+
` : styled.css`
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
align-items: flex-start;
|
|
124
|
+
`}
|
|
125
|
+
width: 100%;
|
|
126
|
+
padding: ${({ theme }) => theme.components.Stepper.padding};
|
|
127
|
+
`;
|
|
128
|
+
const StepContentContainerStyled = styled.div.withConfig({
|
|
129
|
+
shouldForwardProp: (prop) => !["orientation"].includes(prop)
|
|
130
|
+
})`
|
|
131
|
+
width: 100%;
|
|
132
|
+
padding-top: 8px;
|
|
133
|
+
`;
|
|
134
|
+
const LeftColumnStyled = styled.div`
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
align-items: center;
|
|
138
|
+
flex-shrink: 0;
|
|
139
|
+
width: ${({ theme }) => theme.components.Stepper.iconSize};
|
|
140
|
+
`;
|
|
141
|
+
exports.ConnectorContainerStyled = ConnectorContainerStyled;
|
|
142
|
+
exports.DefaultConnectorLineStyled = DefaultConnectorLineStyled;
|
|
143
|
+
exports.LeftColumnStyled = LeftColumnStyled;
|
|
144
|
+
exports.StepContainerStyled = StepContainerStyled;
|
|
145
|
+
exports.StepContentContainerStyled = StepContentContainerStyled;
|
|
146
|
+
exports.StepIconWrapper = StepIconWrapper;
|
|
147
|
+
exports.StepLabelContainerStyled = StepLabelContainerStyled;
|
|
148
|
+
exports.StepMiddleBlock = StepMiddleBlock;
|
|
149
|
+
exports.StepperContainerStyled = StepperContainerStyled;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TStepperOrientation } from './types';
|
|
2
|
+
interface IStepperContainerProps {
|
|
3
|
+
orientation: TStepperOrientation;
|
|
4
|
+
}
|
|
5
|
+
interface IStepContainerProps {
|
|
6
|
+
orientation: TStepperOrientation;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
completed?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
clickable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface IStepIconWrapperProps {
|
|
13
|
+
active?: boolean;
|
|
14
|
+
completed?: boolean;
|
|
15
|
+
error?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface IStepLabelContainerProps {
|
|
18
|
+
orientation: TStepperOrientation;
|
|
19
|
+
active?: boolean;
|
|
20
|
+
completed?: boolean;
|
|
21
|
+
error?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface IConnectorContainerProps {
|
|
24
|
+
orientation: TStepperOrientation;
|
|
25
|
+
}
|
|
26
|
+
interface IDefaultConnectorLineProps {
|
|
27
|
+
orientation: TStepperOrientation;
|
|
28
|
+
completed?: boolean;
|
|
29
|
+
active?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare const StepIconWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, IStepIconWrapperProps>> & string;
|
|
32
|
+
export declare const StepMiddleBlock: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
33
|
+
orientation: TStepperOrientation;
|
|
34
|
+
}>> & string;
|
|
35
|
+
export declare const StepLabelContainerStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, IStepLabelContainerProps>> & string;
|
|
36
|
+
export declare const DefaultConnectorLineStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, IDefaultConnectorLineProps>> & string;
|
|
37
|
+
export declare const ConnectorContainerStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, IConnectorContainerProps>> & string;
|
|
38
|
+
export declare const StepContainerStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, IStepContainerProps>> & string;
|
|
39
|
+
export declare const StepperContainerStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, IStepperContainerProps>> & string;
|
|
40
|
+
export declare const StepContentContainerStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
41
|
+
orientation: TStepperOrientation;
|
|
42
|
+
}>> & string;
|
|
43
|
+
export declare const LeftColumnStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
const StepIconWrapper = styled.div.withConfig({
|
|
3
|
+
shouldForwardProp: (prop) => !["active", "completed", "error"].includes(prop)
|
|
4
|
+
})`
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
min-width: ${({ theme }) => theme.components.Stepper.iconSize};
|
|
9
|
+
width: ${({ theme }) => theme.components.Stepper.iconSize};
|
|
10
|
+
height: ${({ theme }) => theme.components.Stepper.iconSize};
|
|
11
|
+
border-radius: ${({ theme }) => theme.components.Stepper.iconRadius};
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
background-color: ${({ active, completed, error, theme }) => {
|
|
14
|
+
if (error) return theme.components.Stepper.iconBackground.error;
|
|
15
|
+
if (completed) return theme.components.Stepper.iconBackground.completed;
|
|
16
|
+
if (active) return theme.components.Stepper.iconBackground.active;
|
|
17
|
+
return theme.components.Stepper.iconBackground.default;
|
|
18
|
+
}};
|
|
19
|
+
color: ${({ active, completed, error, theme }) => active || completed || error ? theme.components.Stepper.iconColor.active : theme.components.Stepper.iconColor.default};
|
|
20
|
+
transition: background-color 0.2s;
|
|
21
|
+
`;
|
|
22
|
+
const StepMiddleBlock = styled.div.withConfig({
|
|
23
|
+
shouldForwardProp: (prop) => !["orientation"].includes(prop)
|
|
24
|
+
})`
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
flex: ${({ orientation }) => orientation === "horizontal" ? "0 1 auto" : 1};
|
|
28
|
+
min-width: 0;
|
|
29
|
+
|
|
30
|
+
margin-left: ${({ orientation, theme }) => orientation === "horizontal" ? theme.space.s : theme.space.m};
|
|
31
|
+
margin-right: ${({ orientation, theme }) => orientation === "horizontal" ? theme.space.s : theme.space.s};
|
|
32
|
+
`;
|
|
33
|
+
const StepLabelContainerStyled = styled.div.withConfig({
|
|
34
|
+
shouldForwardProp: (prop) => !["orientation", "active", "completed"].includes(prop)
|
|
35
|
+
})`
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
min-width: 0;
|
|
39
|
+
|
|
40
|
+
text-align: ${({ orientation }) => orientation === "horizontal" ? "left" : "left"};
|
|
41
|
+
align-items: flex-start;
|
|
42
|
+
|
|
43
|
+
.step-label-text {
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
text-overflow: ellipsis;
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
const DefaultConnectorLineStyled = styled.span.withConfig({
|
|
51
|
+
shouldForwardProp: (prop) => !["orientation", "completed", "active"].includes(prop)
|
|
52
|
+
})`
|
|
53
|
+
display: block;
|
|
54
|
+
${({ orientation, theme, completed, active }) => {
|
|
55
|
+
const lineColor = completed || active ? theme.components.Stepper.connectorColor.active : theme.components.Stepper.connectorColor.default;
|
|
56
|
+
return orientation === "horizontal" ? css`
|
|
57
|
+
width: 100%;
|
|
58
|
+
height: ${theme.components.Stepper.connectorThickness};
|
|
59
|
+
background-color: ${lineColor};
|
|
60
|
+
` : css`
|
|
61
|
+
width: ${theme.components.Stepper.connectorThickness};
|
|
62
|
+
height: 100%;
|
|
63
|
+
min-height: 24px;
|
|
64
|
+
background-color: ${lineColor};
|
|
65
|
+
`;
|
|
66
|
+
}}
|
|
67
|
+
`;
|
|
68
|
+
const ConnectorContainerStyled = styled.div.withConfig({
|
|
69
|
+
shouldForwardProp: (prop) => !["orientation"].includes(prop)
|
|
70
|
+
})`
|
|
71
|
+
${({ orientation, theme }) => orientation === "horizontal" ? css`
|
|
72
|
+
flex: 1;
|
|
73
|
+
min-width: ${theme.components.Stepper.connectorMinWidth};
|
|
74
|
+
align-self: flex-start;
|
|
75
|
+
margin-top: calc(
|
|
76
|
+
(${theme.components.Stepper.iconSize} / 2) -
|
|
77
|
+
(${theme.components.Stepper.connectorThickness} / 2)
|
|
78
|
+
);
|
|
79
|
+
margin-right: ${theme.space.s};
|
|
80
|
+
` : css`
|
|
81
|
+
flex: 1;
|
|
82
|
+
align-self: stretch;
|
|
83
|
+
min-height: ${theme.components.Stepper.connectorMinWidth};
|
|
84
|
+
margin-top: ${theme.space.s};
|
|
85
|
+
justify-content: center;
|
|
86
|
+
display: flex;
|
|
87
|
+
margin-bottom: ${theme.space.s};
|
|
88
|
+
`}
|
|
89
|
+
`;
|
|
90
|
+
const StepContainerStyled = styled.div.withConfig({
|
|
91
|
+
shouldForwardProp: (prop) => !["orientation", "alternativeLabel", "clickable", "disabled"].includes(prop)
|
|
92
|
+
})`
|
|
93
|
+
display: flex;
|
|
94
|
+
flex: ${({ orientation }) => orientation === "horizontal" ? 1 : "0 1 auto"};
|
|
95
|
+
flex-direction: row;
|
|
96
|
+
align-items: ${({ orientation }) => orientation === "vertical" ? "stretch" : "flex-start"};
|
|
97
|
+
position: relative;
|
|
98
|
+
min-width: ${({ orientation }) => orientation === "horizontal" ? "100px" : "auto"};
|
|
99
|
+
|
|
100
|
+
${({ clickable, disabled, theme }) => clickable && !disabled && css`
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
&:hover ${StepIconWrapper} {
|
|
103
|
+
background-color: ${theme.components.Stepper.iconBackground.hover};
|
|
104
|
+
}
|
|
105
|
+
`}
|
|
106
|
+
|
|
107
|
+
${({ disabled, theme }) => disabled && css`
|
|
108
|
+
opacity: ${theme.components.Stepper.disabledOpacity};
|
|
109
|
+
pointer-events: none;
|
|
110
|
+
`}
|
|
111
|
+
`;
|
|
112
|
+
const StepperContainerStyled = styled.div.withConfig({
|
|
113
|
+
shouldForwardProp: (prop) => !["orientation"].includes(prop)
|
|
114
|
+
})`
|
|
115
|
+
display: flex;
|
|
116
|
+
${({ orientation }) => orientation === "horizontal" ? css`
|
|
117
|
+
flex-direction: row;
|
|
118
|
+
justify-content: space-between;
|
|
119
|
+
` : css`
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
align-items: flex-start;
|
|
122
|
+
`}
|
|
123
|
+
width: 100%;
|
|
124
|
+
padding: ${({ theme }) => theme.components.Stepper.padding};
|
|
125
|
+
`;
|
|
126
|
+
const StepContentContainerStyled = styled.div.withConfig({
|
|
127
|
+
shouldForwardProp: (prop) => !["orientation"].includes(prop)
|
|
128
|
+
})`
|
|
129
|
+
width: 100%;
|
|
130
|
+
padding-top: 8px;
|
|
131
|
+
`;
|
|
132
|
+
const LeftColumnStyled = styled.div`
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
align-items: center;
|
|
136
|
+
flex-shrink: 0;
|
|
137
|
+
width: ${({ theme }) => theme.components.Stepper.iconSize};
|
|
138
|
+
`;
|
|
139
|
+
export {
|
|
140
|
+
ConnectorContainerStyled,
|
|
141
|
+
DefaultConnectorLineStyled,
|
|
142
|
+
LeftColumnStyled,
|
|
143
|
+
StepContainerStyled,
|
|
144
|
+
StepContentContainerStyled,
|
|
145
|
+
StepIconWrapper,
|
|
146
|
+
StepLabelContainerStyled,
|
|
147
|
+
StepMiddleBlock,
|
|
148
|
+
StepperContainerStyled
|
|
149
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ReactNode, ReactElement, MouseEvent, CSSProperties } from 'react';
|
|
2
|
+
export type TStepperOrientation = "horizontal" | "vertical";
|
|
3
|
+
export interface IStepIconProps {
|
|
4
|
+
/** Step index */
|
|
5
|
+
index?: number;
|
|
6
|
+
/** Is the step active */
|
|
7
|
+
active?: boolean;
|
|
8
|
+
/** Is the step complete */
|
|
9
|
+
completed?: boolean;
|
|
10
|
+
/** Is there an error */
|
|
11
|
+
error?: boolean;
|
|
12
|
+
/** Custom icon */
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export interface IStepLabelProps {
|
|
16
|
+
/** Label text */
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
/** Optional text (displayed in small font) */
|
|
19
|
+
optional?: ReactNode;
|
|
20
|
+
/** Is there an error */
|
|
21
|
+
error?: boolean;
|
|
22
|
+
/** Additional class */
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IStepProps {
|
|
26
|
+
/** The content of the step (usually Stepper.Label) */
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
/** Step index (automatic if Stepper is used) */
|
|
29
|
+
index?: number;
|
|
30
|
+
/** Whether the step is manually completed (overrides logic based on activeStep) */
|
|
31
|
+
completed?: boolean;
|
|
32
|
+
/** Is the step disabled */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/** Error flag */
|
|
35
|
+
error?: boolean;
|
|
36
|
+
/** Custom icon */
|
|
37
|
+
icon?: ReactNode;
|
|
38
|
+
/** Is the step active (automatic) */
|
|
39
|
+
active?: boolean;
|
|
40
|
+
/** The last step (to hide the connector) */
|
|
41
|
+
last?: boolean;
|
|
42
|
+
/** Orientation */
|
|
43
|
+
orientation?: TStepperOrientation;
|
|
44
|
+
/** Connector component*/
|
|
45
|
+
connector?: ReactElement;
|
|
46
|
+
/** Click handler */
|
|
47
|
+
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
48
|
+
/** Additional class */
|
|
49
|
+
className?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface IStepperProps {
|
|
52
|
+
/** Child Elements of Step*/
|
|
53
|
+
children?: ReactNode;
|
|
54
|
+
/** Active step index (starting from 0) */
|
|
55
|
+
activeStep?: number;
|
|
56
|
+
/** Orientation */
|
|
57
|
+
orientation?: TStepperOrientation;
|
|
58
|
+
/** Connector component */
|
|
59
|
+
connector?: ReactElement;
|
|
60
|
+
/** Additional class */
|
|
61
|
+
className?: string;
|
|
62
|
+
/** Container styles */
|
|
63
|
+
style?: CSSProperties;
|
|
64
|
+
}
|
|
65
|
+
export interface IStepperContextValue {
|
|
66
|
+
activeStep: number;
|
|
67
|
+
orientation: TStepperOrientation;
|
|
68
|
+
connector: ReactElement;
|
|
69
|
+
onStepClick?: (step: number) => void;
|
|
70
|
+
}
|
|
@@ -26,6 +26,8 @@ const TextField = ({
|
|
|
26
26
|
classNameInput,
|
|
27
27
|
type,
|
|
28
28
|
style,
|
|
29
|
+
leftContentVariant,
|
|
30
|
+
rightContentVariant,
|
|
29
31
|
...props
|
|
30
32
|
}) => {
|
|
31
33
|
const [focus, setFocus] = React.useState(false);
|
|
@@ -62,6 +64,8 @@ const TextField = ({
|
|
|
62
64
|
id,
|
|
63
65
|
style,
|
|
64
66
|
label,
|
|
67
|
+
leftContentVariant,
|
|
68
|
+
rightContentVariant,
|
|
65
69
|
required,
|
|
66
70
|
children: [
|
|
67
71
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ITextFieldProps } from './types';
|
|
3
|
-
declare const TextField: ({ value, onBlur, onFocus, onChange, onClear, leftContent, rightContent, id, name, className, label, size, disabled, required, error, placeholder, clearable, classNameInput, type, style, ...props }: ITextFieldProps) => React.ReactElement;
|
|
3
|
+
declare const TextField: ({ value, onBlur, onFocus, onChange, onClear, leftContent, rightContent, id, name, className, label, size, disabled, required, error, placeholder, clearable, classNameInput, type, style, leftContentVariant, rightContentVariant, ...props }: ITextFieldProps) => React.ReactElement;
|
|
4
4
|
export default TextField;
|
|
@@ -25,6 +25,8 @@ const TextField = ({
|
|
|
25
25
|
classNameInput,
|
|
26
26
|
type,
|
|
27
27
|
style,
|
|
28
|
+
leftContentVariant,
|
|
29
|
+
rightContentVariant,
|
|
28
30
|
...props
|
|
29
31
|
}) => {
|
|
30
32
|
const [focus, setFocus] = useState(false);
|
|
@@ -61,6 +63,8 @@ const TextField = ({
|
|
|
61
63
|
id,
|
|
62
64
|
style,
|
|
63
65
|
label,
|
|
66
|
+
leftContentVariant,
|
|
67
|
+
rightContentVariant,
|
|
64
68
|
required,
|
|
65
69
|
children: [
|
|
66
70
|
/* @__PURE__ */ jsx(
|