@sproutsocial/racine 7.4.2 → 7.6.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 +12 -0
- package/README.md +18 -1
- package/__flow__/Link/index.js +3 -0
- package/__flow__/Link/index.stories.js +8 -0
- package/__flow__/Link/index.test.js +5 -0
- package/__flow__/Link/styles.js +1 -1
- package/__flow__/Token/styles.js +2 -0
- package/commonjs/Link/index.js +3 -1
- package/commonjs/Link/styles.js +3 -1
- package/commonjs/Token/styles.js +5 -1
- package/lib/Link/index.js +3 -1
- package/lib/Link/styles.js +3 -1
- package/lib/Token/styles.js +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 7.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b69f92a: fix(token) hover styling for invalid tokens
|
|
8
|
+
|
|
9
|
+
## 7.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 6700ead: This change allows consumers to specify whether or not a Link should be underlined. This work is part of our accessibility initiatives.
|
|
14
|
+
|
|
3
15
|
## 7.4.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
26
|
-
Install Racine
|
|
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
|
package/__flow__/Link/index.js
CHANGED
|
@@ -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
|
});
|
package/__flow__/Link/styles.js
CHANGED
|
@@ -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) =>
|
package/__flow__/Token/styles.js
CHANGED
|
@@ -57,6 +57,8 @@ const Container: StyledComponent<any, TypeTheme, *> = styled.button`
|
|
|
57
57
|
|
|
58
58
|
&:hover {
|
|
59
59
|
color: ${(props) => props.theme.colors.text.inverse};
|
|
60
|
+
border-color: ${(props) => props.theme.colors.red[900]};
|
|
61
|
+
background: ${(props) => props.theme.colors.red[900]};
|
|
60
62
|
}
|
|
61
63
|
`}
|
|
62
64
|
|
package/commonjs/Link/index.js
CHANGED
|
@@ -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);
|
package/commonjs/Link/styles.js
CHANGED
|
@@ -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:
|
|
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) {
|
package/commonjs/Token/styles.js
CHANGED
|
@@ -49,7 +49,7 @@ var Container = _styledComponents.default.button.withConfig({
|
|
|
49
49
|
}, function (props) {
|
|
50
50
|
return props.disabled && (0, _styledComponents.css)(["opacity:0.4;cursor:not-allowed;"]);
|
|
51
51
|
}, function (props) {
|
|
52
|
-
return !props.valid && (0, _styledComponents.css)(["color:", ";border-color:", ";background:", ";&:hover{color:", ";}"], function (props) {
|
|
52
|
+
return !props.valid && (0, _styledComponents.css)(["color:", ";border-color:", ";background:", ";&:hover{color:", ";border-color:", ";background:", ";}"], function (props) {
|
|
53
53
|
return props.theme.colors.text.inverse;
|
|
54
54
|
}, function (props) {
|
|
55
55
|
return props.theme.colors.error.color;
|
|
@@ -57,6 +57,10 @@ var Container = _styledComponents.default.button.withConfig({
|
|
|
57
57
|
return props.theme.colors.error.color;
|
|
58
58
|
}, function (props) {
|
|
59
59
|
return props.theme.colors.text.inverse;
|
|
60
|
+
}, function (props) {
|
|
61
|
+
return props.theme.colors.red[900];
|
|
62
|
+
}, function (props) {
|
|
63
|
+
return props.theme.colors.red[900];
|
|
60
64
|
});
|
|
61
65
|
}, _systemProps.COMMON);
|
|
62
66
|
|
package/lib/Link/index.js
CHANGED
|
@@ -12,9 +12,10 @@ var Link = function Link(_ref) {
|
|
|
12
12
|
disabled = _ref.disabled,
|
|
13
13
|
onClick = _ref.onClick,
|
|
14
14
|
as = _ref.as,
|
|
15
|
+
underline = _ref.underline,
|
|
15
16
|
_ref$qa = _ref.qa,
|
|
16
17
|
qa = _ref$qa === void 0 ? {} : _ref$qa,
|
|
17
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["href", "external", "children", "disabled", "onClick", "as", "qa"]);
|
|
18
|
+
rest = _objectWithoutPropertiesLoose(_ref, ["href", "external", "children", "disabled", "onClick", "as", "underline", "qa"]);
|
|
18
19
|
|
|
19
20
|
if (!href && external) {
|
|
20
21
|
console.warn("Warning: external prop cannot be set without a href declaration");
|
|
@@ -30,6 +31,7 @@ var Link = function Link(_ref) {
|
|
|
30
31
|
"aria-disabled": disabled ? disabled : undefined,
|
|
31
32
|
disabled: disabled,
|
|
32
33
|
onClick: onClick,
|
|
34
|
+
underline: underline,
|
|
33
35
|
"data-qa-link": "",
|
|
34
36
|
"data-qa-link-isdisabled": disabled === true
|
|
35
37
|
}, qa, rest), children);
|
package/lib/Link/styles.js
CHANGED
|
@@ -5,12 +5,14 @@ import { TYPOGRAPHY, COMMON } from "../utils/system-props";
|
|
|
5
5
|
var Container = styled(Text).withConfig({
|
|
6
6
|
displayName: "styles__Container",
|
|
7
7
|
componentId: "adcw4a-0"
|
|
8
|
-
})(["border:0;font-family:", ";transition:all ", " ", ";text-decoration:
|
|
8
|
+
})(["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) {
|
|
9
9
|
return props.theme.fontFamily;
|
|
10
10
|
}, function (props) {
|
|
11
11
|
return props.theme.duration.fast;
|
|
12
12
|
}, function (props) {
|
|
13
13
|
return props.theme.easing.ease_inout;
|
|
14
|
+
}, function (props) {
|
|
15
|
+
return props.underline ? "underline" : "none";
|
|
14
16
|
}, function (props) {
|
|
15
17
|
return props.disabled && css(["opacity:0.4;cursor:not-allowed;"]);
|
|
16
18
|
}, function (props) {
|
package/lib/Token/styles.js
CHANGED
|
@@ -37,7 +37,7 @@ var Container = styled.button.withConfig({
|
|
|
37
37
|
}, function (props) {
|
|
38
38
|
return props.disabled && css(["opacity:0.4;cursor:not-allowed;"]);
|
|
39
39
|
}, function (props) {
|
|
40
|
-
return !props.valid && css(["color:", ";border-color:", ";background:", ";&:hover{color:", ";}"], function (props) {
|
|
40
|
+
return !props.valid && css(["color:", ";border-color:", ";background:", ";&:hover{color:", ";border-color:", ";background:", ";}"], function (props) {
|
|
41
41
|
return props.theme.colors.text.inverse;
|
|
42
42
|
}, function (props) {
|
|
43
43
|
return props.theme.colors.error.color;
|
|
@@ -45,6 +45,10 @@ var Container = styled.button.withConfig({
|
|
|
45
45
|
return props.theme.colors.error.color;
|
|
46
46
|
}, function (props) {
|
|
47
47
|
return props.theme.colors.text.inverse;
|
|
48
|
+
}, function (props) {
|
|
49
|
+
return props.theme.colors.red[900];
|
|
50
|
+
}, function (props) {
|
|
51
|
+
return props.theme.colors.red[900];
|
|
48
52
|
});
|
|
49
53
|
}, COMMON);
|
|
50
54
|
export default Container;
|