@thecb/components 11.2.6-beta.5 → 11.2.7-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.2.6-beta.5",
3
+ "version": "11.2.7-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -105,7 +105,7 @@
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,16 +1,15 @@
1
1
  import React, { useContext, forwardRef } from "react";
2
2
  import styled, { ThemeContext } from "styled-components";
3
- import posed from "react-pose";
4
3
  import { linear } from "@popmotion/easing";
5
4
  import Text from "../text";
6
- import { Box, Center } from "../layouts";
5
+ import { Box, Center, Motion } from "../layouts";
7
6
  import { fallbackValues } from "./ButtonWithAction.theme";
8
7
 
9
8
  import SpinnerIcon from "../../../deprecated/spinner";
10
9
  import { noop } from "../../../util/general";
11
10
  import { createThemeValues } from "../../../util/themeUtils";
12
11
 
13
- const rotate = posed.div({
12
+ const variants = {
14
13
  fixed: {
15
14
  rotate: "0deg"
16
15
  },
@@ -24,7 +23,7 @@ const rotate = posed.div({
24
23
  }
25
24
  }
26
25
  }
27
- });
26
+ };
28
27
 
29
28
  const SpinnerContainer = styled.div`
30
29
  width: 100%;
@@ -34,11 +33,16 @@ const SpinnerContainer = styled.div`
34
33
  justify-content: center;
35
34
  `;
36
35
 
37
- const SpinnerIconWrapper = styled(rotate)``;
36
+ const SpinnerIconWrapper = styled(Motion)``;
38
37
 
39
38
  const Spinner = ({ color, isMobile }) => (
40
39
  <SpinnerContainer>
41
- <SpinnerIconWrapper initialPose="fixed" pose="rotate">
40
+ <SpinnerIconWrapper
41
+ padding="0"
42
+ variants={variants}
43
+ initial="fixed"
44
+ animate="rotate"
45
+ >
42
46
  <SpinnerIcon color={color} isMobile={isMobile} />
43
47
  </SpinnerIconWrapper>
44
48
  </SpinnerContainer>
@@ -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
- ({ position = "relative", padding = "0", children, ...rest }, ref) => (
42
- <MotionWrapper position={position} padding={padding} ref={ref} {...rest}>
43
- {safeChildren(children, <Fragment />)}
44
- </MotionWrapper>
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
+ `;
@@ -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.span`
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.span`
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 ToggleSwitchRing = posed(ToggleSwitchRingComponent)({
66
+ const toggleSwitchRingVariants = {
68
67
  off: {
69
68
  backgroundColor: disabled
70
69
  ? themeValues.disabledBackground
@@ -87,12 +86,9 @@ const ToggleSwitch = ({
87
86
  ease: "backIn"
88
87
  }
89
88
  }
90
- });
89
+ };
91
90
 
92
- const VisibleSwitch = posed(VisibleSwitchComponent)({
93
- focusable: true,
94
- hoverable: true,
95
- pressable: true,
91
+ const visibleSwitchVariants = {
96
92
  focus: {
97
93
  outline: "0px ridge rgba(170, 50, 220, 0)",
98
94
  boxShadow: "0px 2px 5px 0px rgba(0,0,0,0.5)"
@@ -124,7 +120,7 @@ const ToggleSwitch = ({
124
120
  ease: "easeIn"
125
121
  }
126
122
  }
127
- });
123
+ };
128
124
 
129
125
  const handleKeyDown = e => {
130
126
  if (e.keyCode === ENTER) {
@@ -168,17 +164,25 @@ const ToggleSwitch = ({
168
164
  id={`#${nameId}`}
169
165
  isMobile={isMobile}
170
166
  />
171
- <VisibleSwitch
167
+ <VisibleSwitchComponent
172
168
  onClick={disabled ? noop : onToggle}
173
169
  onKeyDown={disabled ? noop : handleKeyDown}
174
- pose={isOn ? "on" : "off"}
170
+ initial={isOn ? "on" : "off"}
171
+ animate={isOn ? "on" : "off"}
172
+ variants={visibleSwitchVariants}
173
+ whileFocus="focus"
174
+ whileHover="hover"
175
175
  tabIndex={disabled ? -1 : 0}
176
176
  disabled={disabled}
177
177
  isMobile={isMobile}
178
+ useSpan
178
179
  tabindex="0"
179
180
  >
180
- <ToggleSwitchRing isMobile={isMobile} />
181
- </VisibleSwitch>
181
+ <ToggleSwitchRingComponent
182
+ variants={toggleSwitchRingVariants}
183
+ isMobile={isMobile}
184
+ />
185
+ </VisibleSwitchComponent>
182
186
  </Box>
183
187
  </Cover>
184
188
  {label && (
@@ -114,7 +114,7 @@ export const DesktopV1 = {
114
114
  minWidth: "1000px",
115
115
  minHeight: "274px",
116
116
  imageUrl:
117
- "https://cb-public-assets.s3-us-west-2.amazonaws.com/cityville/hero.png"
117
+ "https://cb-public-assets.s3-us-west-2.amazonaws.com/cityville/hero.jpg"
118
118
  }
119
119
  };
120
120
 
@@ -1,12 +1,11 @@
1
1
  import React from "react";
2
2
  import styled from "styled-components";
3
- import posed from "react-pose";
4
3
  import { easeIn, easeOut } from "@popmotion/easing";
5
- import { Box } from "../../atoms/layouts";
4
+ import { Box, Motion } from "../../atoms/layouts";
6
5
  import { fallbackValues } from "./NavMenu.theme.js";
7
6
  import { themeComponent } from "../../../util/themeUtils";
8
7
 
9
- const menu = posed.div({
8
+ const menuVariants = {
10
9
  invisible: {
11
10
  left: "-100vw",
12
11
  right: "100vw",
@@ -35,9 +34,9 @@ const menu = posed.div({
35
34
  }
36
35
  }
37
36
  }
38
- });
37
+ };
39
38
 
40
- const ImposterMenu = styled(menu)`
39
+ const ImposterMenu = styled(Motion)`
41
40
  position: fixed;
42
41
  top: ${({ headerSize }) => headerSize};
43
42
  `;
@@ -52,8 +51,9 @@ const NavMenuMobile = ({
52
51
  return (
53
52
  <ImposterMenu
54
53
  id={id}
55
- initialPose="invisible"
56
- pose={visible ? "visible" : "invisible"}
54
+ variants={menuVariants}
55
+ initial="invisible"
56
+ animate={visible ? "visible" : "invisible"}
57
57
  headerSize={headerSize}
58
58
  >
59
59
  <Box
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import styled from "styled-components";
3
- import posed from "react-pose";
3
+ import { Motion } from "../../components/atoms/layouts";
4
4
  import { linear } from "@popmotion/easing";
5
5
 
6
- const rotate = posed.div({
6
+ const rotateVariants = {
7
7
  fixed: {
8
8
  rotate: "0deg"
9
9
  },
@@ -17,7 +17,7 @@ const rotate = posed.div({
17
17
  }
18
18
  }
19
19
  }
20
- });
20
+ };
21
21
 
22
22
  export const SpinnerContainer = styled.div`
23
23
  width: 100%;
@@ -27,14 +27,19 @@ export const SpinnerContainer = styled.div`
27
27
  justify-content: center;
28
28
  `;
29
29
 
30
- export const SpinnerIconWrapper = styled(rotate)`
30
+ export const SpinnerIconWrapper = styled(Motion)`
31
31
  width: ${({ isMobile }) => (isMobile ? "18" : "21")}px;
32
32
  height: ${({ isMobile }) => (isMobile ? "18" : "21")}px;
33
33
  `;
34
34
 
35
35
  const SpinnerIcon = ({ color, isMobile }) => (
36
36
  <SpinnerContainer>
37
- <SpinnerIconWrapper initialPose="fixed" pose="rotate" isMobile={isMobile}>
37
+ <SpinnerIconWrapper
38
+ initial="fixed"
39
+ animate="rotate"
40
+ isMobile={isMobile}
41
+ variants={rotateVariants}
42
+ >
38
43
  <svg
39
44
  viewBox={`0 0 24 24`}
40
45
  height="100%"