@thecb/components 11.2.8 → 11.2.9-beta.1
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.cjs.js +10880 -11628
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +13201 -13949
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.js +3 -25
- package/src/components/atoms/layouts/Motion.js +25 -6
- package/src/components/atoms/layouts/Motion.styled.js +36 -0
- package/src/components/atoms/nav-footer/.DS_Store +0 -0
- package/src/components/atoms/toggle-switch/ToggleSwitch.js +17 -22
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/nav-menu/NavMenuMobile.js +11 -12
- package/src/components/molecules/obligation/.DS_Store +0 -0
- package/src/deprecated/spinner/Spinner.js +8 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thecb/components",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.9-beta.1",
|
|
4
4
|
"description": "Common lib for CityBase react components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
"@types/styled-components": "^5.1.34",
|
|
101
101
|
"core-js": "^3.22.5",
|
|
102
102
|
"formatted-input": "^1.0.0",
|
|
103
|
-
"framer-motion": "
|
|
103
|
+
"framer-motion": "7.0.0",
|
|
104
104
|
"numeral": "^2.0.6",
|
|
105
105
|
"polished": "^4.0.3",
|
|
106
106
|
"ramda": "^0.27.0",
|
|
107
107
|
"react-aria-modal": "^4.0.0",
|
|
108
|
-
"react-pose": "^4.0.10",
|
|
109
108
|
"redux-freeform": "6.2.1"
|
|
110
|
-
}
|
|
109
|
+
},
|
|
110
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
111
111
|
}
|
package/src/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
import React, { useContext, forwardRef } from "react";
|
|
2
2
|
import styled, { ThemeContext } from "styled-components";
|
|
3
|
-
import posed from "react-pose";
|
|
4
|
-
import { linear } from "@popmotion/easing";
|
|
5
3
|
import Text from "../text";
|
|
6
|
-
import { Box, Center } from "../layouts";
|
|
4
|
+
import { Box, Center, Motion } from "../layouts";
|
|
7
5
|
import { fallbackValues } from "./ButtonWithAction.theme";
|
|
8
6
|
|
|
9
7
|
import SpinnerIcon from "../../../deprecated/spinner";
|
|
10
8
|
import { noop } from "../../../util/general";
|
|
11
9
|
import { createThemeValues } from "../../../util/themeUtils";
|
|
12
10
|
|
|
13
|
-
const
|
|
14
|
-
fixed: {
|
|
15
|
-
rotate: "0deg"
|
|
16
|
-
},
|
|
17
|
-
rotate: {
|
|
18
|
-
rotate: "360deg",
|
|
19
|
-
transition: {
|
|
20
|
-
rotate: {
|
|
21
|
-
ease: linear,
|
|
22
|
-
duration: 1000,
|
|
23
|
-
loop: Infinity
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const SpinnerContainer = styled.div`
|
|
11
|
+
const SpinnerContainer = styled(Motion)`
|
|
30
12
|
width: 100%;
|
|
31
13
|
display: flex;
|
|
32
14
|
flex-direction: row;
|
|
@@ -34,13 +16,9 @@ const SpinnerContainer = styled.div`
|
|
|
34
16
|
justify-content: center;
|
|
35
17
|
`;
|
|
36
18
|
|
|
37
|
-
const SpinnerIconWrapper = styled(rotate)``;
|
|
38
|
-
|
|
39
19
|
const Spinner = ({ color, isMobile }) => (
|
|
40
20
|
<SpinnerContainer>
|
|
41
|
-
<
|
|
42
|
-
<SpinnerIcon color={color} isMobile={isMobile} />
|
|
43
|
-
</SpinnerIconWrapper>
|
|
21
|
+
<SpinnerIcon color={color} isMobile={isMobile} />
|
|
44
22
|
</SpinnerContainer>
|
|
45
23
|
);
|
|
46
24
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Fragment, forwardRef } from "react";
|
|
2
|
-
import { MotionWrapper } from "./Motion.styled";
|
|
2
|
+
import { MotionWrapper, MotionSpanWrapper } from "./Motion.styled";
|
|
3
3
|
import { safeChildren } from "../../../util/general";
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -38,11 +38,30 @@ import { safeChildren } from "../../../util/general";
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
export const Motion = forwardRef(
|
|
41
|
-
(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
(
|
|
42
|
+
{
|
|
43
|
+
position = "relative",
|
|
44
|
+
padding = "0",
|
|
45
|
+
children,
|
|
46
|
+
useSpan = false,
|
|
47
|
+
...rest
|
|
48
|
+
},
|
|
49
|
+
ref
|
|
50
|
+
) =>
|
|
51
|
+
useSpan ? (
|
|
52
|
+
<MotionSpanWrapper
|
|
53
|
+
position={position}
|
|
54
|
+
padding={padding}
|
|
55
|
+
ref={ref}
|
|
56
|
+
{...rest}
|
|
57
|
+
>
|
|
58
|
+
{safeChildren(children, <Fragment />)}
|
|
59
|
+
</MotionSpanWrapper>
|
|
60
|
+
) : (
|
|
61
|
+
<MotionWrapper position={position} padding={padding} ref={ref} {...rest}>
|
|
62
|
+
{safeChildren(children, <Fragment />)}
|
|
63
|
+
</MotionWrapper>
|
|
64
|
+
)
|
|
46
65
|
);
|
|
47
66
|
|
|
48
67
|
export default Motion;
|
|
@@ -36,3 +36,39 @@ export const MotionWrapper = styled(motion.div)`
|
|
|
36
36
|
|
|
37
37
|
${({ extraStyles }) => extraStyles};
|
|
38
38
|
`;
|
|
39
|
+
|
|
40
|
+
export const MotionSpanWrapper = styled(motion.span)`
|
|
41
|
+
position: ${({ position }) => position};
|
|
42
|
+
display: ${({ display }) => display};
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
padding: ${({ padding }) => padding};
|
|
45
|
+
border: ${({ borderShorthand }) => borderShorthand};
|
|
46
|
+
border-color: ${({ borderColor }) => borderColor};
|
|
47
|
+
border-size: ${({ borderSize }) => borderSize};
|
|
48
|
+
border-style: ${({ borderStyle }) => borderStyle};
|
|
49
|
+
border-width: ${({ borderWidth }) => borderWidth};
|
|
50
|
+
border-radius: ${({ borderRadius }) => borderRadius};
|
|
51
|
+
background-color: ${({ backgroundColor }) => backgroundColor};
|
|
52
|
+
box-shadow: ${({ boxShadow }) => boxShadow};
|
|
53
|
+
min-height: ${({ minHeight }) => minHeight};
|
|
54
|
+
min-width: ${({ minWidth }) => minWidth};
|
|
55
|
+
height: ${({ height }) => height};
|
|
56
|
+
width: ${({ width }) => width};
|
|
57
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
58
|
+
margin: ${({ margin }) => margin};
|
|
59
|
+
|
|
60
|
+
&:hover,
|
|
61
|
+
&:focus {
|
|
62
|
+
${({ hoverStyles }) => hoverStyles};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:active {
|
|
66
|
+
${({ activeStyles }) => activeStyles};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:disabled {
|
|
70
|
+
${({ disabledStyles }) => disabledStyles};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
${({ extraStyles }) => extraStyles};
|
|
74
|
+
`;
|
|
Binary file
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import posed from "react-pose";
|
|
4
3
|
import { fallbackValues } from "./ToggleSwitch.theme";
|
|
5
4
|
import { themeComponent } from "../../../util/themeUtils";
|
|
6
|
-
import { Box, Center, Cover, Cluster } from "../layouts";
|
|
5
|
+
import { Box, Center, Cover, Cluster, Motion } from "../layouts";
|
|
7
6
|
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
8
7
|
import { CHARADE_GREY } from "../../../constants/colors";
|
|
9
8
|
import { ENTER } from "../../../constants/keyboard";
|
|
@@ -18,7 +17,7 @@ const HiddenToggleSwitchBox = styled.input`
|
|
|
18
17
|
width: ${({ isMobile }) => (isMobile ? `40px` : `44px`)};
|
|
19
18
|
`;
|
|
20
19
|
|
|
21
|
-
const VisibleSwitchComponent = styled
|
|
20
|
+
const VisibleSwitchComponent = styled(Motion)`
|
|
22
21
|
width: ${({ isMobile }) => (isMobile ? `40px` : `44px`)};
|
|
23
22
|
height: ${({ isMobile }) => (isMobile ? `22px` : `24px`)};
|
|
24
23
|
border-radius: 12px;
|
|
@@ -38,7 +37,7 @@ const VisibleSwitchComponent = styled.span`
|
|
|
38
37
|
}
|
|
39
38
|
`;
|
|
40
39
|
|
|
41
|
-
const ToggleSwitchRingComponent = styled
|
|
40
|
+
const ToggleSwitchRingComponent = styled(Motion)`
|
|
42
41
|
position: absolute;
|
|
43
42
|
width: ${({ isMobile }) => (isMobile ? `14px` : `16px`)};
|
|
44
43
|
height: ${({ isMobile }) => (isMobile ? `14px` : `16px`)};
|
|
@@ -64,7 +63,7 @@ const ToggleSwitch = ({
|
|
|
64
63
|
extraStyles = ""
|
|
65
64
|
}) => {
|
|
66
65
|
const nameId = name.replace(/ /g, "-");
|
|
67
|
-
const
|
|
66
|
+
const toggleSwitchRingVariants = {
|
|
68
67
|
off: {
|
|
69
68
|
backgroundColor: disabled
|
|
70
69
|
? themeValues.disabledBackground
|
|
@@ -87,19 +86,9 @@ const ToggleSwitch = ({
|
|
|
87
86
|
ease: "backIn"
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
|
-
}
|
|
89
|
+
};
|
|
91
90
|
|
|
92
|
-
const
|
|
93
|
-
focusable: true,
|
|
94
|
-
hoverable: true,
|
|
95
|
-
pressable: true,
|
|
96
|
-
focus: {
|
|
97
|
-
outline: "0px ridge rgba(170, 50, 220, 0)",
|
|
98
|
-
boxShadow: "0px 2px 5px 0px rgba(0,0,0,0.5)"
|
|
99
|
-
},
|
|
100
|
-
hover: {
|
|
101
|
-
boxShadow: "0px 2px 5px 0px rgba(0,0,0,0.5)"
|
|
102
|
-
},
|
|
91
|
+
const visibleSwitchVariants = {
|
|
103
92
|
off: {
|
|
104
93
|
border: "1px solid",
|
|
105
94
|
backgroundColor: disabled
|
|
@@ -124,7 +113,7 @@ const ToggleSwitch = ({
|
|
|
124
113
|
ease: "easeIn"
|
|
125
114
|
}
|
|
126
115
|
}
|
|
127
|
-
}
|
|
116
|
+
};
|
|
128
117
|
|
|
129
118
|
const handleKeyDown = e => {
|
|
130
119
|
if (e.keyCode === ENTER) {
|
|
@@ -168,17 +157,23 @@ const ToggleSwitch = ({
|
|
|
168
157
|
id={`#${nameId}`}
|
|
169
158
|
isMobile={isMobile}
|
|
170
159
|
/>
|
|
171
|
-
<
|
|
160
|
+
<VisibleSwitchComponent
|
|
172
161
|
onClick={disabled ? noop : onToggle}
|
|
173
162
|
onKeyDown={disabled ? noop : handleKeyDown}
|
|
174
|
-
|
|
163
|
+
initial={isOn ? "on" : "off"}
|
|
164
|
+
animate={isOn ? "on" : "off"}
|
|
165
|
+
variants={visibleSwitchVariants}
|
|
175
166
|
tabIndex={disabled ? -1 : 0}
|
|
176
167
|
disabled={disabled}
|
|
177
168
|
isMobile={isMobile}
|
|
169
|
+
useSpan
|
|
178
170
|
tabindex="0"
|
|
179
171
|
>
|
|
180
|
-
<
|
|
181
|
-
|
|
172
|
+
<ToggleSwitchRingComponent
|
|
173
|
+
variants={toggleSwitchRingVariants}
|
|
174
|
+
isMobile={isMobile}
|
|
175
|
+
/>
|
|
176
|
+
</VisibleSwitchComponent>
|
|
182
177
|
</Box>
|
|
183
178
|
</Cover>
|
|
184
179
|
{label && (
|
|
Binary file
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import
|
|
4
|
-
import { easeIn, easeOut } from "@popmotion/easing";
|
|
5
|
-
import { Box } from "../../atoms/layouts";
|
|
3
|
+
import { Box, Motion } from "../../atoms/layouts";
|
|
6
4
|
import { fallbackValues } from "./NavMenu.theme.js";
|
|
7
5
|
import { themeComponent } from "../../../util/themeUtils";
|
|
8
6
|
|
|
9
|
-
const
|
|
7
|
+
const menuVariants = {
|
|
10
8
|
invisible: {
|
|
11
9
|
left: "-100vw",
|
|
12
10
|
right: "100vw",
|
|
13
11
|
transition: {
|
|
14
12
|
right: {
|
|
15
|
-
ease: easeOut,
|
|
13
|
+
ease: "easeOut",
|
|
16
14
|
duration: 500
|
|
17
15
|
},
|
|
18
16
|
left: {
|
|
19
|
-
ease: easeOut,
|
|
17
|
+
ease: "easeOut",
|
|
20
18
|
duration: 500
|
|
21
19
|
}
|
|
22
20
|
}
|
|
@@ -26,18 +24,18 @@ const menu = posed.div({
|
|
|
26
24
|
right: "0",
|
|
27
25
|
transition: {
|
|
28
26
|
left: {
|
|
29
|
-
ease: easeIn,
|
|
27
|
+
ease: "easeIn",
|
|
30
28
|
duration: 500
|
|
31
29
|
},
|
|
32
30
|
right: {
|
|
33
|
-
ease: easeIn,
|
|
31
|
+
ease: "easeIn",
|
|
34
32
|
duration: 500
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
|
-
}
|
|
36
|
+
};
|
|
39
37
|
|
|
40
|
-
const ImposterMenu = styled(
|
|
38
|
+
const ImposterMenu = styled(Motion)`
|
|
41
39
|
position: fixed;
|
|
42
40
|
top: ${({ headerSize }) => headerSize};
|
|
43
41
|
`;
|
|
@@ -52,8 +50,9 @@ const NavMenuMobile = ({
|
|
|
52
50
|
return (
|
|
53
51
|
<ImposterMenu
|
|
54
52
|
id={id}
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
variants={menuVariants}
|
|
54
|
+
initial="invisible"
|
|
55
|
+
animate={visible ? "visible" : "invisible"}
|
|
57
56
|
headerSize={headerSize}
|
|
58
57
|
>
|
|
59
58
|
<Box
|
|
Binary file
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import
|
|
4
|
-
import { linear } from "@popmotion/easing";
|
|
5
|
-
|
|
6
|
-
const rotate = posed.div({
|
|
7
|
-
fixed: {
|
|
8
|
-
rotate: "0deg"
|
|
9
|
-
},
|
|
10
|
-
rotate: {
|
|
11
|
-
rotate: "360deg",
|
|
12
|
-
transition: {
|
|
13
|
-
rotate: {
|
|
14
|
-
ease: linear,
|
|
15
|
-
duration: 1000,
|
|
16
|
-
loop: Infinity
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
3
|
+
import { Motion } from "../../components/atoms/layouts";
|
|
21
4
|
|
|
22
5
|
export const SpinnerContainer = styled.div`
|
|
23
6
|
width: 100%;
|
|
@@ -27,14 +10,19 @@ export const SpinnerContainer = styled.div`
|
|
|
27
10
|
justify-content: center;
|
|
28
11
|
`;
|
|
29
12
|
|
|
30
|
-
export const SpinnerIconWrapper = styled(
|
|
13
|
+
export const SpinnerIconWrapper = styled(Motion)`
|
|
31
14
|
width: ${({ isMobile }) => (isMobile ? "18" : "21")}px;
|
|
32
15
|
height: ${({ isMobile }) => (isMobile ? "18" : "21")}px;
|
|
33
16
|
`;
|
|
34
17
|
|
|
35
18
|
const SpinnerIcon = ({ color, isMobile }) => (
|
|
36
19
|
<SpinnerContainer>
|
|
37
|
-
<SpinnerIconWrapper
|
|
20
|
+
<SpinnerIconWrapper
|
|
21
|
+
initial={{ rotate: 0 }}
|
|
22
|
+
animate={{ rotate: 360 }}
|
|
23
|
+
transition={{ duration: 1, ease: "linear", repeat: Infinity }}
|
|
24
|
+
isMobile={isMobile}
|
|
25
|
+
>
|
|
38
26
|
<svg
|
|
39
27
|
viewBox={`0 0 24 24`}
|
|
40
28
|
height="100%"
|