@thecb/components 3.0.0 → 3.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -24,12 +24,10 @@ const Breadcrumbs = ({ breadcrumbsList = [] }) => {
24
24
  to={linkDestination}
25
25
  active={isActive.toString()}
26
26
  color={themeValues.color}
27
- activeStyles={themeValues.activeColor}
28
27
  fontSize={themeValues.fontSize}
29
28
  lineheight={themeValues.lineHeight}
30
29
  fontWeight={themeValues.fontWeight}
31
30
  margin={themeValues.margin}
32
- hoverStyles={themeValues.hover}
33
31
  extraStyles={`
34
32
  text-transform: uppercase;
35
33
  &:first-child {
@@ -88,12 +88,18 @@ const ButtonWithAction = ({
88
88
  background-color: ${themeValues.hoverBackgroundColor};
89
89
  border-color: ${themeValues.hoverBorderColor};
90
90
  color: ${themeValues.hoverColor};
91
+ text-decoration: ${
92
+ variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
93
+ };
91
94
  `;
92
95
  const activeStyles = `
93
96
  outline: none;
94
97
  background-color: ${themeValues.activeBackgroundColor};
95
98
  border-color: ${themeValues.activeBorderColor};
96
99
  color: ${themeValues.activeColor};
100
+ text-decoration: ${
101
+ variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
102
+ };
97
103
  `;
98
104
  const disabledStyles = `
99
105
  background-clor: #6E727E;
@@ -114,7 +120,6 @@ const ButtonWithAction = ({
114
120
  background={themeValues.backgroundColor}
115
121
  border={themeValues.border}
116
122
  hoverStyles={hoverStyles}
117
- focusStyles={hoverStyles}
118
123
  activeStyles={activeStyles}
119
124
  disabledStyles={disabledStyles}
120
125
  as="button"
@@ -23,7 +23,6 @@ const Box = ({
23
23
  border,
24
24
  textAlign,
25
25
  hoverStyles,
26
- focusStyles,
27
26
  activeStyles,
28
27
  disabledStyles,
29
28
  variant,
@@ -57,7 +56,6 @@ const Box = ({
57
56
  borderWidthOverride={borderWidthOverride}
58
57
  border={border}
59
58
  hoverStyles={hoverStyles}
60
- focusStyles={focusStyles}
61
59
  activeStyles={activeStyles}
62
60
  disabledStyles={disabledStyles}
63
61
  variant={variant}
@@ -13,7 +13,6 @@ import styled, { css } from "styled-components";
13
13
  export const BoxWrapper = styled(
14
14
  ({
15
15
  activeStyles,
16
- focusStyles,
17
16
  hoverStyles,
18
17
  disabledStyles,
19
18
  extraStyles,
@@ -48,7 +47,7 @@ export const BoxWrapper = styled(
48
47
  border: ${({ border }) => border};
49
48
  text-align: ${({ textAlign }) => textAlign};
50
49
 
51
- &:hover {
50
+ &:hover, &:focus {
52
51
  ${({ hoverStyles, as }) =>
53
52
  css`
54
53
  ${hoverStyles}
@@ -63,21 +62,6 @@ export const BoxWrapper = styled(
63
62
  `}
64
63
  }
65
64
 
66
- &:focus {
67
- ${({ focusStyles, as }) =>
68
- css`
69
- ${focusStyles}
70
- ${as === "button"
71
- ? `> * > span {
72
- ${focusStyles}
73
- border: none;
74
- outline: none;
75
- box-shadow: none;
76
- }`
77
- : ``}
78
- `}
79
- }
80
-
81
65
  &:active {
82
66
  ${({ activeStyles, as }) =>
83
67
  css`
@@ -21,7 +21,8 @@ export const MotionWrapper = styled(motion.div)`
21
21
  text-align: ${({ textAlign }) => textAlign};
22
22
  margin: ${({ margin }) => margin};
23
23
 
24
- &:hover {
24
+ &:hover,
25
+ &:focus {
25
26
  ${({ hoverStyles }) => hoverStyles};
26
27
  }
27
28
 
@@ -29,10 +30,6 @@ export const MotionWrapper = styled(motion.div)`
29
30
  ${({ activeStyles }) => activeStyles};
30
31
  }
31
32
 
32
- &:focus {
33
- ${({ focusStyles }) => focusStyles};
34
- }
35
-
36
33
  &:disabled {
37
34
  ${({ disabledStyles }) => disabledStyles};
38
35
  }
@@ -4,7 +4,7 @@ import { fallbackValues } from "./Link.theme";
4
4
  import { createThemeValues } from "../../../util/themeUtils";
5
5
  import { StyledExternalLink } from "./ExternalLink.styled";
6
6
  import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
7
- import { CONGRESS_BLUE, SCIENCE_BLUE } from "../../../constants/colors";
7
+ import { CONGRESS_BLUE } from "../../../constants/colors";
8
8
  import { safeChildren } from "../../../util/general";
9
9
 
10
10
  const ExternalLink = ({
@@ -14,7 +14,6 @@ const ExternalLink = ({
14
14
  size = "1rem",
15
15
  lineHeight = "1.5rem",
16
16
  weight = FONT_WEIGHT_REGULAR,
17
- hoverColor = SCIENCE_BLUE,
18
17
  extraStyles = ``,
19
18
  variant = "primary",
20
19
  tabIndex = "0",
@@ -36,7 +35,8 @@ const ExternalLink = ({
36
35
  size={size}
37
36
  lineheight={lineHeight}
38
37
  weight={weight}
39
- hovercolor={hoverColor}
38
+ hovercolor={themeValues.hoverColor}
39
+ activeColor={themeValues.activeColor}
40
40
  fontFamily={themeValues.fontFamily}
41
41
  tabIndex={tabIndex}
42
42
  extrastyles={extraStyles}
@@ -8,7 +8,7 @@ import styled from "styled-components";
8
8
 
9
9
  /* eslint-disable no-unused-vars */
10
10
  export const StyledExternalLink = styled(
11
- ({ hoverColor, extraStyles, ...props }) => <a {...props} />
11
+ ({ hoverColor, activeColor, extraStyles, ...props }) => <a {...props} />
12
12
  )`
13
13
  display: flex;
14
14
  font-size: ${({ size }) => size};
@@ -17,8 +17,15 @@ export const StyledExternalLink = styled(
17
17
  font-family: ${({ fontFamily }) => fontFamily};
18
18
  line-height: ${({ lineheight }) => lineheight};
19
19
 
20
- &:hover {
20
+ &:hover,
21
+ &:focus {
21
22
  color: ${({ hovercolor }) => hovercolor};
23
+ text-decoration: underline;
24
+ }
25
+
26
+ &:active {
27
+ text-decoration: underline;
28
+ color: ${({ activeColor }) => activeColor};
22
29
  }
23
30
 
24
31
  ${({ extrastyles }) => extrastyles}
@@ -9,14 +9,12 @@ const InternalLink = ({
9
9
  to = "",
10
10
  color,
11
11
  children,
12
- activeStyles,
13
12
  active,
14
13
  fontSize,
15
14
  lineheight,
16
15
  fontWeight,
17
16
  variant = "primary",
18
17
  margin,
19
- hoverStyles,
20
18
  tabIndex = "0",
21
19
  extraStyles = ``
22
20
  }) => {
@@ -33,13 +31,13 @@ const InternalLink = ({
33
31
  to={to}
34
32
  color={color}
35
33
  lineheight={lineheight}
36
- activeStyles={activeStyles}
37
34
  active={active}
38
35
  fontWeight={fontWeight}
39
36
  fontSize={fontSize}
40
37
  fontFamily={themeValues.fontFamily}
41
38
  margin={margin}
42
- hoverStyles={hoverStyles}
39
+ hoverColor={themeValues.hoverColor}
40
+ activeColor={themeValues.activeColor}
43
41
  tabIndex={tabIndex}
44
42
  extrastyles={extraStyles}
45
43
  >
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import styled, { css } from "styled-components";
2
+ import styled from "styled-components";
3
3
  import { Link } from "react-router-dom";
4
4
 
5
5
  /*
@@ -9,30 +9,28 @@ import { Link } from "react-router-dom";
9
9
 
10
10
  /* eslint-disable no-unused-vars */
11
11
  export const StyledInternalLink = styled(
12
- ({ hoverStyles, activeStyles, active, ...props }) => <Link {...props} />
12
+ ({ hoverColor, activeColor, active, ...props }) => <Link {...props} />
13
13
  )`
14
14
  display: flex;
15
- color: ${({ color }) => color};
15
+ color: ${({ color, active, activeColor }) =>
16
+ active === true ? activeColor : color};
16
17
  font-weight: ${({ fontWeight }) => fontWeight};
17
18
  line-height: ${({ lineheight }) => lineheight};
18
19
  font-size: ${({ fontSize }) => fontSize};
19
20
  font-family: ${({ fontFamily }) => fontFamily};
20
21
  margin: ${({ margin }) => margin};
22
+ text-decoration: ${({ active }) => (active === true ? "underline" : "none")};
21
23
 
22
- &:hover {
23
- ${({ hoverStyles }) =>
24
- css`
25
- ${hoverStyles}
26
- `}
24
+ &:hover,
25
+ &:focus {
26
+ color: ${({ hovercolor }) => hovercolor};
27
+ text-decoration: underline;
27
28
  }
28
29
 
29
- ${({ activeStyles, active }) =>
30
- active === "true" &&
31
- css`
32
- ${activeStyles}
33
- cursor: default;
34
- pointer-events: none;
35
- `}
30
+ &:active {
31
+ text-decoration: underline;
32
+ color: ${({ activeColor }) => activeColor};
33
+ }
36
34
 
37
35
  ${({ extrastyles }) => extrastyles}
38
36
  `;
@@ -3,6 +3,12 @@ const fontFamily = {
3
3
  secondary: "Open Sans"
4
4
  };
5
5
 
6
+ const hoverColor = "#116285";
7
+
8
+ const activeColor = "#0E506D";
9
+
6
10
  export const fallbackValues = {
7
- fontFamily
11
+ fontFamily,
12
+ hoverColor,
13
+ activeColor
8
14
  };
@@ -6,7 +6,7 @@ import { Box, Switcher, Center, Cluster } from "../layouts";
6
6
  import { fallbackValues } from "./Placeholder.theme";
7
7
  import { themeComponent } from "../../../util/themeUtils";
8
8
  import { IconAdd } from "../../../deprecated/icons";
9
- import { STORM_GREY } from "../../../constants/colors";
9
+ import { STORM_GREY, GRECIAN_GREY } from "../../../constants/colors";
10
10
  import { AccountsAddIcon, PropertiesAddIcon } from "../icons";
11
11
  import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
12
12
  import withWindowSize from "../../withWindowSize";
@@ -72,6 +72,7 @@ const Placeholder = ({
72
72
  display: flex;
73
73
  justify-content: center;
74
74
  align-items:center;`}
75
+ hoverStyles={`background-color: ${GRECIAN_GREY};`}
75
76
  >
76
77
  <PlaceholderContentWrapper
77
78
  isLink={isLink}
@@ -12,7 +12,6 @@ const Text = ({
12
12
  color = FIREFLY_GREY,
13
13
  extraStyles = ``,
14
14
  hoverStyles,
15
- focusStyles,
16
15
  onClick,
17
16
  dataQa,
18
17
  children,
@@ -25,7 +24,6 @@ const Text = ({
25
24
  fontFamily={themeValues.fontFamily}
26
25
  extraStyles={extraStyles}
27
26
  hoverStyles={hoverStyles}
28
- focusStyles={focusStyles}
29
27
  onClick={onClick}
30
28
  data-qa={dataQa}
31
29
  {...rest}
@@ -8,20 +8,14 @@ export const TextSpan = styled.span`
8
8
  font-family: ${({ fontFamily }) => fontFamily};
9
9
  color: ${({ color }) => color};
10
10
 
11
- &:hover {
11
+ &:hover,
12
+ &:focus {
12
13
  ${({ hoverStyles }) =>
13
14
  css`
14
15
  ${hoverStyles}
15
16
  `}
16
17
  }
17
18
 
18
- &:focus {
19
- ${({ focusStyles }) =>
20
- css`
21
- ${focusStyles}
22
- `}
23
- }
24
-
25
19
  ${({ disabled, disabledStyles }) =>
26
20
  disabled &&
27
21
  css`
@@ -159,7 +159,7 @@ const ToggleSwitch = ({
159
159
  extraStyles={
160
160
  labelLeft ? themeValues.leftLabelStyles : themeValues.rightLabelStyles
161
161
  }
162
- focusStyles={`outline: ${themeValues.onBackground} auto 5px`}
162
+ hoverStyles={`outline: ${themeValues.onBackground} auto 5px`}
163
163
  >
164
164
  <Center>
165
165
  <Cluster justify="stretch" align="center">
@@ -27,7 +27,6 @@ const AccountAndRoutingModal = ({
27
27
  color={themeValues.linkColor}
28
28
  weight={themeValues.fontWeight}
29
29
  hoverStyles={themeValues.modalLinkHoverFocus}
30
- focusStyles={themeValues.modalLinkHoverFocus}
31
30
  extraStyles={`cursor: pointer;`}
32
31
  tabIndex="0"
33
32
  onKeyPress={e => e.key === "Enter" && toggleOpen(true)}
@@ -63,7 +63,7 @@ const CollapsibleSection = ({
63
63
  padding="0"
64
64
  tabIndex="0"
65
65
  onKeyDown={handleKeyDown}
66
- focusStyles={themeValues.focusStyles}
66
+ hoverStyles={themeValues.focusStyles}
67
67
  animate={isOpen ? "open" : "closed"}
68
68
  positionTransition
69
69
  >
@@ -103,7 +103,7 @@ const RadioSection = ({
103
103
  onKeyDown={e => handleKeyDown(section.id, e)}
104
104
  onFocus={() => setFocused(section.id)}
105
105
  onBlur={() => setFocused(null)}
106
- focusStyles={themeValues.focusStyles}
106
+ hoverStyles={themeValues.focusStyles}
107
107
  animate={openSection === section.id ? "open" : "closed"}
108
108
  initial={initiallyOpen ? "open" : "closed"}
109
109
  key={`item-${section.id}`}
@@ -34,11 +34,16 @@ const TabSidebar = ({ links, isMobile, themeValues }) => (
34
34
  <InternalLink
35
35
  to={route}
36
36
  key={`${route}-${index}`}
37
- hoverStyles={
38
- active
39
- ? `> * {background-color: ${themeValues.activeTabHover};}`
40
- : `> * {background-color: rgba(8, 27, 43, 0.05);}`
41
- }
37
+ extraStyles={`&:hover, &:focus {
38
+ ${
39
+ active
40
+ ? `> * {
41
+ background-color: ${themeValues.activeTabHover};
42
+ }`
43
+ : `> * {
44
+ background-color: rgba(8, 27, 43, 0.05);
45
+ }`
46
+ }}`}
42
47
  >
43
48
  <Box
44
49
  padding={isMobile ? "6px 4px" : "18px 16px"}
@@ -24,7 +24,6 @@ const TermsAndConditionsModal = ({
24
24
  color={themeValues.linkColor}
25
25
  weight={themeValues.fontWeight}
26
26
  hoverStyles={themeValues.modalLinkHoverFocus}
27
- focusStyles={themeValues.modalLinkHoverFocus}
28
27
  extraStyles={`cursor: pointer;`}
29
28
  tabIndex="0"
30
29
  onKeyPress={e => e.key === "Enter" && toggleOpen(true)}
@@ -1,73 +0,0 @@
1
- name: Publish and Update
2
-
3
- on:
4
- release:
5
- types: [published]
6
-
7
- jobs:
8
- build:
9
- name: Build
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - name: Checkout repository
14
- uses: actions/checkout@v2
15
- with:
16
- ref: master
17
-
18
- - name: Set up Node.js
19
- uses: actions/setup-node@v1.2.0
20
- with:
21
- node-version: '10.x'
22
-
23
- - name: Install dependencies
24
- run: yarn install --silent
25
-
26
- - name: Compile build
27
- run: yarn build --silent
28
-
29
- - name: Commit changes
30
- uses: EndBug/add-and-commit@v2.1.0
31
- with:
32
- author_name: CB Feeps
33
- author_email: feeps@thecitybase.com
34
- message: "[auto] Update dist"
35
- path: dist
36
- pattern: "*.*"
37
- force: true
38
- ref: deploy
39
- env:
40
- GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
41
-
42
- publish:
43
- name: Publish to NPM Registry
44
- runs-on: ubuntu-latest
45
- needs: build
46
-
47
- steps:
48
- - name: Checkout repository
49
- uses: actions/checkout@v2
50
- with:
51
- ref: deploy
52
-
53
- - name: Set up Node.js for NPM
54
- if: steps.check.outputs.changed == 'true'
55
- uses: actions/setup-node@v1.2.0
56
- with:
57
- node-version: '10.x'
58
- registry-url: 'https://registry.npmjs.org'
59
- scope: '@thecb'
60
-
61
- - name: Install dependencies
62
- if: steps.check.outputs.changed == 'true'
63
- run: yarn install
64
-
65
- - name: Create build
66
- if: steps.check.outputs.changed == 'true'
67
- run: yarn build
68
-
69
- - name: Publish package to NPM
70
- if: steps.check.outputs.changed == 'true'
71
- run: yarn publish
72
- env:
73
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}