@sproutsocial/racine 7.4.1 → 7.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 7.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6700ead: This change allows consumers to specify whether or not a Link should be underlined. This work is part of our accessibility initiatives.
8
+
9
+ ## 7.4.2
10
+
11
+ ### Patch Changes
12
+
13
+ - da247d2: update whatsapp icon
14
+
3
15
  ## 7.4.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -23,7 +23,7 @@
23
23
 
24
24
  ## Installation
25
25
 
26
- Install Racine and its peer dependencies using npm or yarn:
26
+ Install Racine using npm or yarn:
27
27
 
28
28
  ```sh
29
29
  $ yarn add @sproutsocial/racine react styled-components
@@ -31,6 +31,23 @@ $ yarn add @sproutsocial/racine react styled-components
31
31
  $ npm install @sproutsocial/racine react styled-components
32
32
  ```
33
33
 
34
+ You may also require specific peer dependencies when starting a new project or sandbox environment:
35
+
36
+ ```js
37
+ @sproutsocial/seeds-border
38
+ @sproutsocial/seeds-color
39
+ @sproutsocial/seeds-depth
40
+ @sproutsocial/seeds-motion
41
+ @sproutsocial/seeds-networkcolor
42
+ @sproutsocial/seeds-space
43
+ @sproutsocial/seeds-typography
44
+ moment
45
+ prop-types
46
+ react
47
+ react-dates
48
+ styled-components
49
+ ```
50
+
34
51
  Then, wrap your app's React root in Racine's `ThemeProvider` component:
35
52
 
36
53
  ```js
@@ -14,6 +14,7 @@ type TypeProps = {
14
14
  /** Setting this prop will cause the component to be rendered as a button instead of an anchor) */
15
15
  onClick?: (e: SyntheticEvent<HTMLButtonElement>) => void,
16
16
  as?: $PropertyType<TypeStyledComponentsCommonProps, "as">,
17
+ underline?: boolean,
17
18
  qa?: Object,
18
19
  };
19
20
 
@@ -24,6 +25,7 @@ const Link = ({
24
25
  disabled,
25
26
  onClick,
26
27
  as,
28
+ underline,
27
29
  qa = {},
28
30
  ...rest
29
31
  }: TypeProps) => {
@@ -45,6 +47,7 @@ const Link = ({
45
47
  aria-disabled={disabled ? disabled : undefined}
46
48
  disabled={disabled}
47
49
  onClick={onClick}
50
+ underline={underline}
48
51
  data-qa-link={""}
49
52
  data-qa-link-isdisabled={disabled === true}
50
53
  {...qa}
@@ -145,3 +145,11 @@ export const differentFontSizes = () => (
145
145
  differentFontSizes.story = {
146
146
  name: "Different font sizes",
147
147
  };
148
+
149
+ export const underlinedLink = () => (
150
+ <Link underline>{text("children", "Underlined Link")}</Link>
151
+ );
152
+
153
+ underlinedLink.story = {
154
+ name: "Underlined Link",
155
+ };
@@ -99,4 +99,9 @@ describe("Racine Link", () => {
99
99
  expect(getByText("Link").type).toBeFalsy();
100
100
  expect(getByText("Link").type).not.toEqual("button");
101
101
  });
102
+
103
+ it("Can render with an underline", () => {
104
+ const { getByText } = render(<Link underline>Link</Link>);
105
+ expect(getByText("Link")).toHaveStyleRule("text-decoration", "underline");
106
+ });
102
107
  });
@@ -11,7 +11,7 @@ const Container = styled<typeof Text, TypeTheme, any>(Text)`
11
11
  font-family: ${(props) => props.theme.fontFamily};
12
12
  transition: all ${(props) => props.theme.duration.fast}
13
13
  ${(props) => props.theme.easing.ease_inout};
14
- text-decoration: none;
14
+ text-decoration: ${(props) => (props.underline ? "underline" : "none")};
15
15
  appearance: none;
16
16
  cursor: pointer;
17
17
  ${(props) =>
@@ -24,9 +24,10 @@ var Link = function Link(_ref) {
24
24
  disabled = _ref.disabled,
25
25
  onClick = _ref.onClick,
26
26
  as = _ref.as,
27
+ underline = _ref.underline,
27
28
  _ref$qa = _ref.qa,
28
29
  qa = _ref$qa === void 0 ? {} : _ref$qa,
29
- rest = _objectWithoutPropertiesLoose(_ref, ["href", "external", "children", "disabled", "onClick", "as", "qa"]);
30
+ rest = _objectWithoutPropertiesLoose(_ref, ["href", "external", "children", "disabled", "onClick", "as", "underline", "qa"]);
30
31
 
31
32
  if (!href && external) {
32
33
  console.warn("Warning: external prop cannot be set without a href declaration");
@@ -42,6 +43,7 @@ var Link = function Link(_ref) {
42
43
  "aria-disabled": disabled ? disabled : undefined,
43
44
  disabled: disabled,
44
45
  onClick: onClick,
46
+ underline: underline,
45
47
  "data-qa-link": "",
46
48
  "data-qa-link-isdisabled": disabled === true
47
49
  }, qa, rest), children);
@@ -20,12 +20,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
20
20
  var Container = (0, _styledComponents.default)(_Text.default).withConfig({
21
21
  displayName: "styles__Container",
22
22
  componentId: "adcw4a-0"
23
- })(["border:0;font-family:", ";transition:all ", " ", ";text-decoration:none;appearance:none;cursor:pointer;", " font-weight:", ";color:", ";&:hover{color:", ";text-decoration:underline;}&:active{color:", ";}&:focus{", "}&:focus:active{box-shadow:none;}", " ", " ", " ", ""], function (props) {
23
+ })(["border:0;font-family:", ";transition:all ", " ", ";text-decoration:", ";appearance:none;cursor:pointer;", " font-weight:", ";color:", ";&:hover{color:", ";text-decoration:underline;}&:active{color:", ";}&:focus{", "}&:focus:active{box-shadow:none;}", " ", " ", " ", ""], function (props) {
24
24
  return props.theme.fontFamily;
25
25
  }, function (props) {
26
26
  return props.theme.duration.fast;
27
27
  }, function (props) {
28
28
  return props.theme.easing.ease_inout;
29
+ }, function (props) {
30
+ return props.underline ? "underline" : "none";
29
31
  }, function (props) {
30
32
  return props.disabled && (0, _styledComponents.css)(["opacity:0.4;cursor:not-allowed;"]);
31
33
  }, function (props) {