@sproutsocial/racine 10.0.1-dependencies.0 → 11.0.0-mixin-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/__flow__/Avatar/index.test.js +5 -0
- package/__flow__/Badge/index.test.js +5 -0
- package/__flow__/Button/index.stories.js +67 -51
- package/__flow__/CharacterCounter/index.test.js +8 -0
- package/__flow__/ChartLegend/index.test.js +37 -0
- package/__flow__/EmptyState/index.test.js +3 -1
- package/__flow__/Link/index.test.js +10 -0
- package/__flow__/Listbox/__snapshots__/index.test.js.snap +13 -13
- package/__flow__/Loader/index.test.js +14 -0
- package/__flow__/Menu/__snapshots__/index.test.js.snap +5 -5
- package/__flow__/Modal/index.test.js +19 -0
- package/__flow__/Text/index.test.js +39 -0
- package/__flow__/themes/dark/_themed.scss +14 -29
- package/__flow__/themes/light/_themed.scss +14 -29
- package/dist/themes/dark/_themed.scss +14 -29
- package/dist/themes/light/_themed.scss +14 -29
- package/package.json +15 -18
|
@@ -14,4 +14,9 @@ describe("Avatar", () => {
|
|
|
14
14
|
const { container } = render(<Avatar name="Test User" />);
|
|
15
15
|
expect(container.textContent).toEqual("TU");
|
|
16
16
|
});
|
|
17
|
+
|
|
18
|
+
it("should set the correct font size", () => {
|
|
19
|
+
const { getByText } = render(<Avatar name="Test User" />);
|
|
20
|
+
expect(getByText("TU")).toHaveStyleRule("font-size", "16px");
|
|
21
|
+
});
|
|
17
22
|
});
|
|
@@ -10,6 +10,11 @@ describe("Racine Badge", () => {
|
|
|
10
10
|
expect(getByDataQaLabel({ "badge-type": "primary" })).toBeTruthy();
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
+
it("should render with correct size styling", () => {
|
|
14
|
+
const { getByText } = render(<Badge text="Test" size="small" />);
|
|
15
|
+
expect(getByText("Test")).toHaveStyleRule("padding", "4px 8px");
|
|
16
|
+
});
|
|
17
|
+
|
|
13
18
|
it("should render with secondary type", () => {
|
|
14
19
|
const { getByText, getByDataQaLabel } = render(
|
|
15
20
|
<Badge text="Test" type="secondary" />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { boolean, text, number } from "@storybook/addon-knobs";
|
|
2
3
|
import Button from "./index";
|
|
3
4
|
import Icon from "../Icon";
|
|
4
5
|
import Box from "../Box";
|
|
@@ -7,140 +8,155 @@ export default {
|
|
|
7
8
|
title: "Button",
|
|
8
9
|
};
|
|
9
10
|
|
|
10
|
-
export const defaultStory = (
|
|
11
|
-
<Button
|
|
11
|
+
export const defaultStory = () => (
|
|
12
|
+
<Button
|
|
13
|
+
appearance={text("appearance", "default")}
|
|
14
|
+
onClick={() => alert("Testing...")}
|
|
15
|
+
>
|
|
12
16
|
Default
|
|
13
17
|
</Button>
|
|
14
18
|
);
|
|
15
19
|
|
|
16
|
-
defaultStory.args = { appearance: "default" };
|
|
17
|
-
|
|
18
20
|
defaultStory.story = {
|
|
19
21
|
name: "Default",
|
|
20
22
|
};
|
|
21
23
|
|
|
22
|
-
export const primary = (
|
|
23
|
-
<Button
|
|
24
|
+
export const primary = () => (
|
|
25
|
+
<Button
|
|
26
|
+
appearance={text("appearance", "primary")}
|
|
27
|
+
onClick={() => alert("Testing...")}
|
|
28
|
+
>
|
|
24
29
|
Primary Button
|
|
25
30
|
</Button>
|
|
26
31
|
);
|
|
27
32
|
|
|
28
|
-
primary.args = { appearance: "primary" };
|
|
29
|
-
|
|
30
33
|
primary.story = {
|
|
31
34
|
name: "Primary",
|
|
32
35
|
};
|
|
33
36
|
|
|
34
|
-
export const secondary = (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
export const secondary = () => (
|
|
38
|
+
<Button appearance={text("appearance", "secondary")}>Secondary Button</Button>
|
|
39
|
+
);
|
|
37
40
|
|
|
38
41
|
secondary.story = {
|
|
39
42
|
name: "Secondary",
|
|
40
43
|
};
|
|
41
44
|
|
|
42
|
-
export const destructive = (
|
|
43
|
-
<Button {
|
|
45
|
+
export const destructive = () => (
|
|
46
|
+
<Button appearance={text("appearance", "destructive")}>
|
|
47
|
+
Destructive Button
|
|
48
|
+
</Button>
|
|
44
49
|
);
|
|
45
50
|
|
|
46
|
-
destructive.args = { appearance: "destructive" };
|
|
47
51
|
destructive.story = {
|
|
48
52
|
name: "Destructive",
|
|
49
53
|
};
|
|
50
54
|
|
|
51
|
-
export const placeholder = (
|
|
52
|
-
<Button {
|
|
55
|
+
export const placeholder = () => (
|
|
56
|
+
<Button appearance={text("appearance", "placeholder")}>
|
|
57
|
+
Placeholder Button
|
|
58
|
+
</Button>
|
|
53
59
|
);
|
|
54
60
|
|
|
55
|
-
placeholder.args = { appearance: "placeholder" };
|
|
56
61
|
placeholder.story = {
|
|
57
62
|
name: "Placeholder",
|
|
58
63
|
};
|
|
59
64
|
|
|
60
|
-
export const largeButton = (
|
|
61
|
-
|
|
65
|
+
export const largeButton = () => (
|
|
66
|
+
<Button
|
|
67
|
+
appearance={text("appearance", "primary")}
|
|
68
|
+
size={text("size", "large")}
|
|
69
|
+
>
|
|
70
|
+
Large Button
|
|
71
|
+
</Button>
|
|
72
|
+
);
|
|
62
73
|
|
|
63
74
|
largeButton.story = {
|
|
64
75
|
name: "Large button",
|
|
65
76
|
};
|
|
66
77
|
|
|
67
|
-
export const pillButton = (
|
|
78
|
+
export const pillButton = () => (
|
|
68
79
|
<Box bg="container.background.base" p={400}>
|
|
69
|
-
<Button {
|
|
80
|
+
<Button appearance={text("shape", "pill")}>
|
|
70
81
|
<Icon name="reply" mr={350} />
|
|
71
82
|
Pill Button
|
|
72
83
|
</Button>
|
|
73
84
|
</Box>
|
|
74
85
|
);
|
|
75
|
-
|
|
86
|
+
|
|
76
87
|
pillButton.story = {
|
|
77
88
|
name: "Pill button",
|
|
78
89
|
};
|
|
79
90
|
|
|
80
|
-
export const pillIconOnlyButton = (
|
|
91
|
+
export const pillIconOnlyButton = () => (
|
|
81
92
|
<Box bg="container.background.base" p={400}>
|
|
82
|
-
<Button {
|
|
93
|
+
<Button appearance={text("shape", "pill")} ariaLabel="This is a label">
|
|
83
94
|
<Icon name="circle-check-outline" />
|
|
84
95
|
</Button>
|
|
85
96
|
</Box>
|
|
86
97
|
);
|
|
87
98
|
|
|
88
|
-
pillIconOnlyButton.args = { appearance: "pill" };
|
|
89
99
|
pillIconOnlyButton.story = {
|
|
90
100
|
name: "Pill icon only button",
|
|
91
101
|
};
|
|
92
102
|
|
|
93
|
-
export const activeButton = (
|
|
103
|
+
export const activeButton = () => (
|
|
104
|
+
<Button
|
|
105
|
+
appearance={text("appearance", "secondary")}
|
|
106
|
+
active={boolean("active", true)}
|
|
107
|
+
>
|
|
108
|
+
Active Button
|
|
109
|
+
</Button>
|
|
110
|
+
);
|
|
94
111
|
|
|
95
|
-
activeButton.args = { appearance: "secondary", active: true };
|
|
96
112
|
activeButton.story = {
|
|
97
113
|
name: "Active button",
|
|
98
114
|
};
|
|
99
115
|
|
|
100
|
-
export const buttonAsALink = (
|
|
101
|
-
<Button
|
|
116
|
+
export const buttonAsALink = () => (
|
|
117
|
+
<Button
|
|
118
|
+
href={text("href", "http://sproutsocial.style")}
|
|
119
|
+
external={boolean("external", true)}
|
|
120
|
+
appearance={text("appearance", "primary")}
|
|
121
|
+
>
|
|
122
|
+
Button using anchor element
|
|
123
|
+
</Button>
|
|
102
124
|
);
|
|
103
|
-
|
|
104
|
-
appearance: "primary",
|
|
105
|
-
external: true,
|
|
106
|
-
href: "http://sproutsocial.style",
|
|
107
|
-
};
|
|
125
|
+
|
|
108
126
|
buttonAsALink.story = {
|
|
109
127
|
name: "Button as a link",
|
|
110
128
|
};
|
|
111
129
|
|
|
112
|
-
export const disabledButton = (
|
|
113
|
-
<Button
|
|
130
|
+
export const disabledButton = () => (
|
|
131
|
+
<Button
|
|
132
|
+
appearance={text("appearance", "primary")}
|
|
133
|
+
disabled={text("disabled", "true")}
|
|
134
|
+
>
|
|
135
|
+
This Button is disabled
|
|
136
|
+
</Button>
|
|
114
137
|
);
|
|
115
|
-
|
|
116
|
-
appearance: "primary",
|
|
117
|
-
disabled: true,
|
|
118
|
-
};
|
|
138
|
+
|
|
119
139
|
disabledButton.story = {
|
|
120
140
|
name: "Disabled button",
|
|
121
141
|
};
|
|
122
142
|
|
|
123
|
-
export const fullWidthButton = (
|
|
124
|
-
<Button {
|
|
143
|
+
export const fullWidthButton = () => (
|
|
144
|
+
<Button appearance={text("appearance", "primary")} width={number("width", 1)}>
|
|
145
|
+
Full-Width Button
|
|
146
|
+
</Button>
|
|
125
147
|
);
|
|
126
|
-
|
|
127
|
-
appearance: "primary",
|
|
128
|
-
width: 1,
|
|
129
|
-
};
|
|
148
|
+
|
|
130
149
|
fullWidthButton.story = {
|
|
131
150
|
name: "Full width button",
|
|
132
151
|
};
|
|
133
152
|
|
|
134
|
-
export const withIcon = (
|
|
135
|
-
<Button {
|
|
153
|
+
export const withIcon = () => (
|
|
154
|
+
<Button appearance={text("appearance", "secondary")}>
|
|
136
155
|
<Icon name="twitter" mr={350} />
|
|
137
156
|
Secondary Button
|
|
138
157
|
</Button>
|
|
139
158
|
);
|
|
140
159
|
|
|
141
|
-
withIcon.args = {
|
|
142
|
-
appearance: "secondary",
|
|
143
|
-
};
|
|
144
160
|
withIcon.story = {
|
|
145
161
|
name: "With icon",
|
|
146
162
|
};
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { render } from "../utils/react-testing-library";
|
|
3
3
|
import "jest-styled-components";
|
|
4
4
|
import CharacterCounter from "./";
|
|
5
|
+
import { COLOR_RED_800 } from "@sproutsocial/seeds-color";
|
|
5
6
|
|
|
6
7
|
describe.only("CharacterCounter", () => {
|
|
7
8
|
it("should render properly", () => {
|
|
@@ -12,4 +13,11 @@ describe.only("CharacterCounter", () => {
|
|
|
12
13
|
|
|
13
14
|
expect(getByText(remainingNumber.toString())).toBeTruthy();
|
|
14
15
|
});
|
|
16
|
+
|
|
17
|
+
it("should render properly with overlimit values", () => {
|
|
18
|
+
const { getByText } = render(
|
|
19
|
+
<CharacterCounter currentValue={2} maxValue={1} />
|
|
20
|
+
);
|
|
21
|
+
expect(getByText("-1")).toHaveStyleRule("color", COLOR_RED_800);
|
|
22
|
+
});
|
|
15
23
|
});
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { render } from "../utils/react-testing-library";
|
|
3
3
|
import "jest-styled-components";
|
|
4
4
|
import ChartLegend from "./";
|
|
5
|
+
import { CONTRAST_THEME, COMPARE_THEME } from "../utils/chartColors";
|
|
5
6
|
|
|
6
7
|
describe("ChartLegend", () => {
|
|
7
8
|
let legendLabelsArray = [{ name: "Label One" }, { name: "Label Two" }];
|
|
@@ -14,4 +15,40 @@ describe("ChartLegend", () => {
|
|
|
14
15
|
expect(getByText("Label One")).toBeTruthy();
|
|
15
16
|
expect(getByText("Label Two")).toBeTruthy();
|
|
16
17
|
});
|
|
18
|
+
|
|
19
|
+
it("should render the correct theme", () => {
|
|
20
|
+
const { getAllByDataQaLabel } = render(
|
|
21
|
+
<ChartLegend legendLabels={legendLabelsArray} theme="contrast" />
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
expect(getAllByDataQaLabel({ swatch: "" })[0]).toHaveStyleRule(
|
|
25
|
+
"background-color",
|
|
26
|
+
CONTRAST_THEME[0]
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
expect(getAllByDataQaLabel({ swatch: "" })[1]).toHaveStyleRule(
|
|
30
|
+
"background-color",
|
|
31
|
+
CONTRAST_THEME[1]
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should display a custom color", () => {
|
|
36
|
+
const newLegendLabelsArray = [
|
|
37
|
+
{ name: "Label One", color: "#000" },
|
|
38
|
+
{ name: "Label Two" },
|
|
39
|
+
];
|
|
40
|
+
const { getAllByDataQaLabel } = render(
|
|
41
|
+
<ChartLegend legendLabels={newLegendLabelsArray} />
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
expect(getAllByDataQaLabel({ swatch: "" })[0]).toHaveStyleRule(
|
|
45
|
+
"background-color",
|
|
46
|
+
"#000"
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
expect(getAllByDataQaLabel({ swatch: "" })[1]).toHaveStyleRule(
|
|
50
|
+
"background-color",
|
|
51
|
+
COMPARE_THEME[1]
|
|
52
|
+
);
|
|
53
|
+
});
|
|
17
54
|
});
|
|
@@ -97,6 +97,7 @@ describe("EmptyState", () => {
|
|
|
97
97
|
);
|
|
98
98
|
const element = getByText("Reload Page");
|
|
99
99
|
expect(element).toBeTruthy();
|
|
100
|
+
expect(element).toHaveStyleRule("color", "#FFFFFF");
|
|
100
101
|
});
|
|
101
102
|
|
|
102
103
|
it("should render a secondary button", async () => {
|
|
@@ -104,7 +105,7 @@ describe("EmptyState", () => {
|
|
|
104
105
|
<EmptyState
|
|
105
106
|
media={
|
|
106
107
|
<Image
|
|
107
|
-
alt="No assets matching your
|
|
108
|
+
alt="No assets matching your
search or filters"
|
|
108
109
|
src="https://cl.ly/db498c7682df/download/analytics.svg"
|
|
109
110
|
m={0}
|
|
110
111
|
/>
|
|
@@ -117,5 +118,6 @@ describe("EmptyState", () => {
|
|
|
117
118
|
);
|
|
118
119
|
const element = getByText("I'll do this later");
|
|
119
120
|
expect(element).toBeTruthy();
|
|
121
|
+
expect(element).toHaveStyleRule("color", "#515e5f");
|
|
120
122
|
});
|
|
121
123
|
});
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import "jest-styled-components";
|
|
3
3
|
import { render } from "../utils/react-testing-library";
|
|
4
4
|
import Link from "./";
|
|
5
|
+
import { TYPOGRAPHY_SIZE_600 } from "@sproutsocial/seeds-typography";
|
|
5
6
|
|
|
6
7
|
describe("Racine Link", () => {
|
|
7
8
|
it("should render in an anchor tag", () => {
|
|
@@ -82,6 +83,10 @@ describe("Racine Link", () => {
|
|
|
82
83
|
);
|
|
83
84
|
|
|
84
85
|
expect(getByText("Link as span").tagName).toEqual("SPAN");
|
|
86
|
+
expect(getByText("Link as span")).toHaveStyleRule(
|
|
87
|
+
"font-size",
|
|
88
|
+
TYPOGRAPHY_SIZE_600.fontSize
|
|
89
|
+
);
|
|
85
90
|
});
|
|
86
91
|
|
|
87
92
|
it("Has type attribute as button when rendered as a button element", () => {
|
|
@@ -94,4 +99,9 @@ describe("Racine Link", () => {
|
|
|
94
99
|
expect(getByText("Link").type).toBeFalsy();
|
|
95
100
|
expect(getByText("Link").type).not.toEqual("button");
|
|
96
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
|
+
});
|
|
97
107
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`Listbox AsListbox multiselect should match snapshot 1`] = `
|
|
4
|
-
|
|
4
|
+
<body>
|
|
5
|
+
.c5 {
|
|
5
6
|
display: inline-block;
|
|
6
7
|
color: inherit;
|
|
7
8
|
vertical-align: middle;
|
|
@@ -19,12 +20,12 @@ exports[`Listbox AsListbox multiselect should match snapshot 1`] = `
|
|
|
19
20
|
width: 16px;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
_:-ms-fullscreen .
|
|
23
|
+
_:-ms-fullscreen .c5,
|
|
23
24
|
html .c5 {
|
|
24
25
|
width: 16px;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
.pdf-page .
|
|
28
|
+
.pdf-page .c5 {
|
|
28
29
|
width: 16px;
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -130,8 +131,7 @@ html .c5 {
|
|
|
130
131
|
transform: none;
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
<
|
|
134
|
-
<div>
|
|
134
|
+
<div>
|
|
135
135
|
<div
|
|
136
136
|
class="c0"
|
|
137
137
|
>
|
|
@@ -185,12 +185,12 @@ exports[`Listbox AsListbox should match snapshot 1`] = `
|
|
|
185
185
|
fill: currentColor;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
_:-ms-fullscreen .
|
|
188
|
+
_:-ms-fullscreen .c6,
|
|
189
189
|
html .c6 {
|
|
190
190
|
width: 16px;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
.pdf-page .
|
|
193
|
+
.pdf-page .c6 {
|
|
194
194
|
width: 16px;
|
|
195
195
|
}
|
|
196
196
|
|
|
@@ -375,7 +375,8 @@ html .c6 {
|
|
|
375
375
|
`;
|
|
376
376
|
|
|
377
377
|
exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
|
|
378
|
-
|
|
378
|
+
<body>
|
|
379
|
+
.c0 {
|
|
379
380
|
box-sizing: border-box;
|
|
380
381
|
font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
|
381
382
|
margin: 0px;
|
|
@@ -549,8 +550,7 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
|
|
|
549
550
|
}
|
|
550
551
|
}
|
|
551
552
|
|
|
552
|
-
<
|
|
553
|
-
<div>
|
|
553
|
+
<div>
|
|
554
554
|
<ul
|
|
555
555
|
aria-activedescendant="MenuItem-28"
|
|
556
556
|
aria-multiselectable="true"
|
|
@@ -673,7 +673,8 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
|
|
|
673
673
|
`;
|
|
674
674
|
|
|
675
675
|
exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
676
|
-
|
|
676
|
+
<body>
|
|
677
|
+
.c0 {
|
|
677
678
|
box-sizing: border-box;
|
|
678
679
|
font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
|
679
680
|
margin: 0px;
|
|
@@ -904,8 +905,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
904
905
|
}
|
|
905
906
|
}
|
|
906
907
|
|
|
907
|
-
<
|
|
908
|
-
<div>
|
|
908
|
+
<div>
|
|
909
909
|
<ul
|
|
910
910
|
aria-activedescendant="MenuItem-34"
|
|
911
911
|
aria-multiselectable="true"
|
|
@@ -8,4 +8,18 @@ describe("Loader", () => {
|
|
|
8
8
|
const { getByText } = render(<Loader />);
|
|
9
9
|
expect(getByText("Loading")).toBeTruthy();
|
|
10
10
|
});
|
|
11
|
+
|
|
12
|
+
it("should render with small size class", () => {
|
|
13
|
+
const { getByDataQaLabel } = render(<Loader size="small" />);
|
|
14
|
+
expect(getByDataQaLabel({ loader: "" })).toHaveStyleRule("width", "20px");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should render with light theme", () => {
|
|
18
|
+
const { getByDataQaLabel } = render(<Loader color="light" />);
|
|
19
|
+
expect(getByDataQaLabel({ loader: "" })).toHaveStyleRule(
|
|
20
|
+
"border-color",
|
|
21
|
+
"rgba(255,255,255,0.3) rgba(255,255,255,0.3) rgba(255,255,255,0.7) rgba(255,255,255,0.7)",
|
|
22
|
+
{ modifier: ":after" }
|
|
23
|
+
);
|
|
24
|
+
});
|
|
11
25
|
});
|
|
@@ -270,7 +270,8 @@ exports[`Menu AsMenu should match snapshot 1`] = `
|
|
|
270
270
|
`;
|
|
271
271
|
|
|
272
272
|
exports[`Menu AsMenuButton should match snapshot 1`] = `
|
|
273
|
-
|
|
273
|
+
<body>
|
|
274
|
+
.c3 {
|
|
274
275
|
display: inline-block;
|
|
275
276
|
color: inherit;
|
|
276
277
|
vertical-align: middle;
|
|
@@ -283,12 +284,12 @@ exports[`Menu AsMenuButton should match snapshot 1`] = `
|
|
|
283
284
|
fill: currentColor;
|
|
284
285
|
}
|
|
285
286
|
|
|
286
|
-
_:-ms-fullscreen .
|
|
287
|
+
_:-ms-fullscreen .c3,
|
|
287
288
|
html .c3 {
|
|
288
289
|
width: 16px;
|
|
289
290
|
}
|
|
290
291
|
|
|
291
|
-
.pdf-page .
|
|
292
|
+
.pdf-page .c3 {
|
|
292
293
|
width: 16px;
|
|
293
294
|
}
|
|
294
295
|
|
|
@@ -356,8 +357,7 @@ html .c3 {
|
|
|
356
357
|
display: inline-block;
|
|
357
358
|
}
|
|
358
359
|
|
|
359
|
-
<
|
|
360
|
-
<div>
|
|
360
|
+
<div>
|
|
361
361
|
<div
|
|
362
362
|
class="c0"
|
|
363
363
|
>
|
|
@@ -7,6 +7,25 @@ import { COLOR_PURPLE_300 } from "@sproutsocial/seeds-color";
|
|
|
7
7
|
afterEach(() => cleanup());
|
|
8
8
|
|
|
9
9
|
describe("Modal", () => {
|
|
10
|
+
it("renders a custom background color", () => {
|
|
11
|
+
// Use baseElement since it renders in a Portal
|
|
12
|
+
const { baseElement } = render(
|
|
13
|
+
<Modal
|
|
14
|
+
isOpen={true}
|
|
15
|
+
label="Label"
|
|
16
|
+
bg={COLOR_PURPLE_300}
|
|
17
|
+
onClose={() => {}}
|
|
18
|
+
closeButtonLabel="Close this dialog"
|
|
19
|
+
>
|
|
20
|
+
ajdsfljasdlfjlasdjf
|
|
21
|
+
</Modal>
|
|
22
|
+
);
|
|
23
|
+
expect(baseElement.querySelector(".ReactModal__Content")).toHaveStyleRule(
|
|
24
|
+
"background-color",
|
|
25
|
+
COLOR_PURPLE_300
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
10
29
|
it("should close on overlay click and esc", () => {
|
|
11
30
|
const onClose = jest.fn();
|
|
12
31
|
const { baseElement, getByText, getByLabelText } = render(
|
|
@@ -4,10 +4,49 @@ import "jest-styled-components";
|
|
|
4
4
|
import Text from "./";
|
|
5
5
|
|
|
6
6
|
describe("Text", () => {
|
|
7
|
+
it("does not set word break or truncated styles by default", () => {
|
|
8
|
+
const { getByDataQaLabel } = render(<Text children="Default" />);
|
|
9
|
+
const component = getByDataQaLabel({ text: "Default" });
|
|
10
|
+
expect(component).not.toHaveStyleRule("word-break", "break-word");
|
|
11
|
+
expect(component).not.toHaveStyleRule("text-overflow", "ellipsis");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("sets word break styles when breakWord is true", () => {
|
|
15
|
+
const { getByDataQaLabel } = render(
|
|
16
|
+
<Text breakWord children="Word Break" />
|
|
17
|
+
);
|
|
18
|
+
const component = getByDataQaLabel({ text: "Word Break" });
|
|
19
|
+
expect(component).toHaveStyleRule("word-break", "break-word");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("sets truncated styles when truncated is true", () => {
|
|
23
|
+
const { getByDataQaLabel } = render(
|
|
24
|
+
<Text truncated children="Truncated" />
|
|
25
|
+
);
|
|
26
|
+
const component = getByDataQaLabel({ text: "Truncated" });
|
|
27
|
+
expect(component).toHaveStyleRule("text-overflow", "ellipsis");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("is italic when isItalicized is true", () => {
|
|
31
|
+
const { getByDataQaLabel } = render(
|
|
32
|
+
<Text isItalicized children="Italicized" />
|
|
33
|
+
);
|
|
34
|
+
const component = getByDataQaLabel({ text: "Italicized" });
|
|
35
|
+
expect(component).toHaveStyleRule("font-style", "italic");
|
|
36
|
+
});
|
|
37
|
+
|
|
7
38
|
it("outputs the correct string/content", () => {
|
|
8
39
|
const { getByText } = render(
|
|
9
40
|
<Text children="Supercalifragilisticexpialidocious" />
|
|
10
41
|
);
|
|
11
42
|
expect(getByText("Supercalifragilisticexpialidocious")).toBeTruthy();
|
|
12
43
|
});
|
|
44
|
+
|
|
45
|
+
it("displays a custom size if using fontSize", () => {
|
|
46
|
+
const { getByText } = render(
|
|
47
|
+
<Text children="Custom sized text!" fontSize={1000} />
|
|
48
|
+
);
|
|
49
|
+
const component = getByText("Custom sized text!");
|
|
50
|
+
expect(component).toHaveStyleRule("font-size", "76px");
|
|
51
|
+
});
|
|
13
52
|
});
|
|
@@ -7,90 +7,75 @@
|
|
|
7
7
|
|
|
8
8
|
// In the JS theme file, the theme object is exported as "default" (i.e., using "export default"),
|
|
9
9
|
// so we need to map-get "default" to access it.
|
|
10
|
-
$theme: map-get($dark,
|
|
11
|
-
|
|
12
|
-
// MIXIN
|
|
13
|
-
// CSS properties that are theme-dependent must be wrapped in this mixin.
|
|
14
|
-
// It will convert semantic tokens to the appropriate theme-dependent CSS property.
|
|
15
|
-
@mixin themed() {
|
|
16
|
-
& {
|
|
17
|
-
$theme-map: () !global;
|
|
18
|
-
@each $key, $submap in $theme {
|
|
19
|
-
$value: map-get($theme, "#{$key}");
|
|
20
|
-
$theme-map: map-merge($theme-map, ($key: $value)) !global;
|
|
21
|
-
}
|
|
22
|
-
@content;
|
|
23
|
-
$theme-map: null !global;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
10
|
+
$theme: map-get($dark, "default");
|
|
26
11
|
|
|
27
12
|
// FUNCTIONS
|
|
28
13
|
// This function will allow you to get any value from the theme.
|
|
29
14
|
// @param {string} $key - the period-separated path to the value in the theme object. e.g., "colors.text.body"
|
|
30
15
|
@function t($key) {
|
|
31
16
|
$keys: _str-split($key, ".");
|
|
32
|
-
@return _map-deep-get($theme
|
|
17
|
+
@return _map-deep-get($theme, $keys);
|
|
33
18
|
}
|
|
34
19
|
|
|
35
20
|
// The rest of the functions are convenience methods to get theme values for subsets of the theme.
|
|
36
21
|
// @param {string} $key - the period-separated path to the value in the theme object, with "colors." omitted. e.g., "text.body"
|
|
37
22
|
@function colors($key) {
|
|
38
23
|
$keys: _str-split($key, ".");
|
|
39
|
-
@return _map-deep-get($theme
|
|
24
|
+
@return _map-deep-get($theme, join("colors", $keys));
|
|
40
25
|
}
|
|
41
26
|
|
|
42
27
|
// @param {string} $key - the period-separated path to the value in the theme object, with "typography." omitted. e.g., "100.fontSize"
|
|
43
28
|
@function typography($key) {
|
|
44
29
|
$keys: _str-split($key, ".");
|
|
45
|
-
@return _map-deep-get($theme
|
|
30
|
+
@return _map-deep-get($theme, join("typography", $keys));
|
|
46
31
|
}
|
|
47
32
|
|
|
48
33
|
// @param {string} $key - the period-separated path to the value in the theme object, with "fontWeights." omitted. e.g., "normal"
|
|
49
34
|
@function fontWeights($key) {
|
|
50
35
|
$keys: _str-split($key, ".");
|
|
51
|
-
@return _map-deep-get($theme
|
|
36
|
+
@return _map-deep-get($theme, join("fontWeights", $keys));
|
|
52
37
|
}
|
|
53
38
|
|
|
54
39
|
// @param {string} $key - the period-separated path to the value in the theme object, with "space." omitted. e.g., "100"
|
|
55
40
|
@function space($key) {
|
|
56
41
|
$keys: _str-split($key, ".");
|
|
57
|
-
@return _map-deep-get($theme
|
|
42
|
+
@return _map-deep-get($theme, join("space", $keys));
|
|
58
43
|
}
|
|
59
44
|
|
|
60
45
|
// @param {string} $key - the period-separated path to the value in the theme object, with "radii." omitted. e.g., "inner"
|
|
61
46
|
@function radii($key) {
|
|
62
47
|
$keys: _str-split($key, ".");
|
|
63
|
-
@return _map-deep-get($theme
|
|
48
|
+
@return _map-deep-get($theme, join("radii", $keys));
|
|
64
49
|
}
|
|
65
50
|
|
|
66
51
|
// @param {string} $key - the period-separated path to the value in the theme object, with "borders." omitted. e.g., "500"
|
|
67
52
|
@function borders($key) {
|
|
68
53
|
$keys: _str-split($key, ".");
|
|
69
|
-
@return _map-deep-get($theme
|
|
54
|
+
@return _map-deep-get($theme, join("borders", $keys));
|
|
70
55
|
}
|
|
71
56
|
|
|
72
57
|
// @param {string} $key - the period-separated path to the value in the theme object, with "borderWidths." omitted. e.g., "500"
|
|
73
58
|
@function borderWidths($key) {
|
|
74
59
|
$keys: _str-split($key, ".");
|
|
75
|
-
@return _map-deep-get($theme
|
|
60
|
+
@return _map-deep-get($theme, join("borderWidths", $keys));
|
|
76
61
|
}
|
|
77
62
|
|
|
78
63
|
// @param {string} $key - the period-separated path to the value in the theme object, with "shadows." omitted. e.g., "low"
|
|
79
64
|
@function shadows($key) {
|
|
80
65
|
$keys: _str-split($key, ".");
|
|
81
|
-
@return _map-deep-get($theme
|
|
66
|
+
@return _map-deep-get($theme, join("shadows", $keys));
|
|
82
67
|
}
|
|
83
68
|
|
|
84
69
|
// @param {string} $key - the period-separated path to the value in the theme object, with "easing." omitted. e.g., "ease_in"
|
|
85
70
|
@function easing($key) {
|
|
86
71
|
$keys: _str-split($key, ".");
|
|
87
|
-
@return _map-deep-get($theme
|
|
72
|
+
@return _map-deep-get($theme, join("easing", $keys));
|
|
88
73
|
}
|
|
89
74
|
|
|
90
75
|
// @param {string} $key - the period-separated path to the value in the theme object, with "duration." omitted. e.g., "fast"
|
|
91
76
|
@function duration($key) {
|
|
92
77
|
$keys: _str-split($key, ".");
|
|
93
|
-
@return _map-deep-get($theme
|
|
78
|
+
@return _map-deep-get($theme, join("duration", $keys));
|
|
94
79
|
}
|
|
95
80
|
|
|
96
81
|
// UTILITIES
|
|
@@ -104,7 +89,7 @@ $theme: map-get($dark, 'default');
|
|
|
104
89
|
// empty array/list
|
|
105
90
|
$split-arr: ();
|
|
106
91
|
// first index of separator in string
|
|
107
|
-
$index
|
|
92
|
+
$index: str-index($string, $separator);
|
|
108
93
|
// loop through string
|
|
109
94
|
@while $index != null {
|
|
110
95
|
// get the substring from the first character to the separator
|
|
@@ -114,7 +99,7 @@ $theme: map-get($dark, 'default');
|
|
|
114
99
|
// remove item and separator from string
|
|
115
100
|
$string: str-slice($string, $index + 1);
|
|
116
101
|
// find new index of separator
|
|
117
|
-
$index
|
|
102
|
+
$index: str-index($string, $separator);
|
|
118
103
|
}
|
|
119
104
|
// add the remaining string to list (the last item)
|
|
120
105
|
$split-arr: append($split-arr, $string);
|
|
@@ -7,90 +7,75 @@
|
|
|
7
7
|
|
|
8
8
|
// In the JS theme file, the theme object is exported as "default" (i.e., using "export default"),
|
|
9
9
|
// so we need to map-get "default" to access it.
|
|
10
|
-
$theme: map-get($light,
|
|
11
|
-
|
|
12
|
-
// MIXIN
|
|
13
|
-
// CSS properties that are theme-dependent must be wrapped in this mixin.
|
|
14
|
-
// It will convert semantic tokens to the appropriate theme-dependent CSS property.
|
|
15
|
-
@mixin themed() {
|
|
16
|
-
& {
|
|
17
|
-
$theme-map: () !global;
|
|
18
|
-
@each $key, $submap in $theme {
|
|
19
|
-
$value: map-get($theme, "#{$key}");
|
|
20
|
-
$theme-map: map-merge($theme-map, ($key: $value)) !global;
|
|
21
|
-
}
|
|
22
|
-
@content;
|
|
23
|
-
$theme-map: null !global;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
10
|
+
$theme: map-get($light, "default");
|
|
26
11
|
|
|
27
12
|
// FUNCTIONS
|
|
28
13
|
// This function will allow you to get any value from the theme.
|
|
29
14
|
// @param {string} $key - the period-separated path to the value in the theme object. e.g., "colors.text.body"
|
|
30
15
|
@function t($key) {
|
|
31
16
|
$keys: _str-split($key, ".");
|
|
32
|
-
@return _map-deep-get($theme
|
|
17
|
+
@return _map-deep-get($theme, $keys);
|
|
33
18
|
}
|
|
34
19
|
|
|
35
20
|
// The rest of the functions are convenience methods to get theme values for subsets of the theme.
|
|
36
21
|
// @param {string} $key - the period-separated path to the value in the theme object, with "colors." omitted. e.g., "text.body"
|
|
37
22
|
@function colors($key) {
|
|
38
23
|
$keys: _str-split($key, ".");
|
|
39
|
-
@return _map-deep-get($theme
|
|
24
|
+
@return _map-deep-get($theme, join("colors", $keys));
|
|
40
25
|
}
|
|
41
26
|
|
|
42
27
|
// @param {string} $key - the period-separated path to the value in the theme object, with "typography." omitted. e.g., "100.fontSize"
|
|
43
28
|
@function typography($key) {
|
|
44
29
|
$keys: _str-split($key, ".");
|
|
45
|
-
@return _map-deep-get($theme
|
|
30
|
+
@return _map-deep-get($theme, join("typography", $keys));
|
|
46
31
|
}
|
|
47
32
|
|
|
48
33
|
// @param {string} $key - the period-separated path to the value in the theme object, with "fontWeights." omitted. e.g., "normal"
|
|
49
34
|
@function fontWeights($key) {
|
|
50
35
|
$keys: _str-split($key, ".");
|
|
51
|
-
@return _map-deep-get($theme
|
|
36
|
+
@return _map-deep-get($theme, join("fontWeights", $keys));
|
|
52
37
|
}
|
|
53
38
|
|
|
54
39
|
// @param {string} $key - the period-separated path to the value in the theme object, with "space." omitted. e.g., "100"
|
|
55
40
|
@function space($key) {
|
|
56
41
|
$keys: _str-split($key, ".");
|
|
57
|
-
@return _map-deep-get($theme
|
|
42
|
+
@return _map-deep-get($theme, join("space", $keys));
|
|
58
43
|
}
|
|
59
44
|
|
|
60
45
|
// @param {string} $key - the period-separated path to the value in the theme object, with "radii." omitted. e.g., "inner"
|
|
61
46
|
@function radii($key) {
|
|
62
47
|
$keys: _str-split($key, ".");
|
|
63
|
-
@return _map-deep-get($theme
|
|
48
|
+
@return _map-deep-get($theme, join("radii", $keys));
|
|
64
49
|
}
|
|
65
50
|
|
|
66
51
|
// @param {string} $key - the period-separated path to the value in the theme object, with "borders." omitted. e.g., "500"
|
|
67
52
|
@function borders($key) {
|
|
68
53
|
$keys: _str-split($key, ".");
|
|
69
|
-
@return _map-deep-get($theme
|
|
54
|
+
@return _map-deep-get($theme, join("borders", $keys));
|
|
70
55
|
}
|
|
71
56
|
|
|
72
57
|
// @param {string} $key - the period-separated path to the value in the theme object, with "borderWidths." omitted. e.g., "500"
|
|
73
58
|
@function borderWidths($key) {
|
|
74
59
|
$keys: _str-split($key, ".");
|
|
75
|
-
@return _map-deep-get($theme
|
|
60
|
+
@return _map-deep-get($theme, join("borderWidths", $keys));
|
|
76
61
|
}
|
|
77
62
|
|
|
78
63
|
// @param {string} $key - the period-separated path to the value in the theme object, with "shadows." omitted. e.g., "low"
|
|
79
64
|
@function shadows($key) {
|
|
80
65
|
$keys: _str-split($key, ".");
|
|
81
|
-
@return _map-deep-get($theme
|
|
66
|
+
@return _map-deep-get($theme, join("shadows", $keys));
|
|
82
67
|
}
|
|
83
68
|
|
|
84
69
|
// @param {string} $key - the period-separated path to the value in the theme object, with "easing." omitted. e.g., "ease_in"
|
|
85
70
|
@function easing($key) {
|
|
86
71
|
$keys: _str-split($key, ".");
|
|
87
|
-
@return _map-deep-get($theme
|
|
72
|
+
@return _map-deep-get($theme, join("easing", $keys));
|
|
88
73
|
}
|
|
89
74
|
|
|
90
75
|
// @param {string} $key - the period-separated path to the value in the theme object, with "duration." omitted. e.g., "fast"
|
|
91
76
|
@function duration($key) {
|
|
92
77
|
$keys: _str-split($key, ".");
|
|
93
|
-
@return _map-deep-get($theme
|
|
78
|
+
@return _map-deep-get($theme, join("duration", $keys));
|
|
94
79
|
}
|
|
95
80
|
|
|
96
81
|
// UTILITIES
|
|
@@ -104,7 +89,7 @@ $theme: map-get($light, 'default');
|
|
|
104
89
|
// empty array/list
|
|
105
90
|
$split-arr: ();
|
|
106
91
|
// first index of separator in string
|
|
107
|
-
$index
|
|
92
|
+
$index: str-index($string, $separator);
|
|
108
93
|
// loop through string
|
|
109
94
|
@while $index != null {
|
|
110
95
|
// get the substring from the first character to the separator
|
|
@@ -114,7 +99,7 @@ $theme: map-get($light, 'default');
|
|
|
114
99
|
// remove item and separator from string
|
|
115
100
|
$string: str-slice($string, $index + 1);
|
|
116
101
|
// find new index of separator
|
|
117
|
-
$index
|
|
102
|
+
$index: str-index($string, $separator);
|
|
118
103
|
}
|
|
119
104
|
// add the remaining string to list (the last item)
|
|
120
105
|
$split-arr: append($split-arr, $string);
|
|
@@ -7,90 +7,75 @@
|
|
|
7
7
|
|
|
8
8
|
// In the JS theme file, the theme object is exported as "default" (i.e., using "export default"),
|
|
9
9
|
// so we need to map-get "default" to access it.
|
|
10
|
-
$theme: map-get($dark,
|
|
11
|
-
|
|
12
|
-
// MIXIN
|
|
13
|
-
// CSS properties that are theme-dependent must be wrapped in this mixin.
|
|
14
|
-
// It will convert semantic tokens to the appropriate theme-dependent CSS property.
|
|
15
|
-
@mixin themed() {
|
|
16
|
-
& {
|
|
17
|
-
$theme-map: () !global;
|
|
18
|
-
@each $key, $submap in $theme {
|
|
19
|
-
$value: map-get($theme, "#{$key}");
|
|
20
|
-
$theme-map: map-merge($theme-map, ($key: $value)) !global;
|
|
21
|
-
}
|
|
22
|
-
@content;
|
|
23
|
-
$theme-map: null !global;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
10
|
+
$theme: map-get($dark, "default");
|
|
26
11
|
|
|
27
12
|
// FUNCTIONS
|
|
28
13
|
// This function will allow you to get any value from the theme.
|
|
29
14
|
// @param {string} $key - the period-separated path to the value in the theme object. e.g., "colors.text.body"
|
|
30
15
|
@function t($key) {
|
|
31
16
|
$keys: _str-split($key, ".");
|
|
32
|
-
@return _map-deep-get($theme
|
|
17
|
+
@return _map-deep-get($theme, $keys);
|
|
33
18
|
}
|
|
34
19
|
|
|
35
20
|
// The rest of the functions are convenience methods to get theme values for subsets of the theme.
|
|
36
21
|
// @param {string} $key - the period-separated path to the value in the theme object, with "colors." omitted. e.g., "text.body"
|
|
37
22
|
@function colors($key) {
|
|
38
23
|
$keys: _str-split($key, ".");
|
|
39
|
-
@return _map-deep-get($theme
|
|
24
|
+
@return _map-deep-get($theme, join("colors", $keys));
|
|
40
25
|
}
|
|
41
26
|
|
|
42
27
|
// @param {string} $key - the period-separated path to the value in the theme object, with "typography." omitted. e.g., "100.fontSize"
|
|
43
28
|
@function typography($key) {
|
|
44
29
|
$keys: _str-split($key, ".");
|
|
45
|
-
@return _map-deep-get($theme
|
|
30
|
+
@return _map-deep-get($theme, join("typography", $keys));
|
|
46
31
|
}
|
|
47
32
|
|
|
48
33
|
// @param {string} $key - the period-separated path to the value in the theme object, with "fontWeights." omitted. e.g., "normal"
|
|
49
34
|
@function fontWeights($key) {
|
|
50
35
|
$keys: _str-split($key, ".");
|
|
51
|
-
@return _map-deep-get($theme
|
|
36
|
+
@return _map-deep-get($theme, join("fontWeights", $keys));
|
|
52
37
|
}
|
|
53
38
|
|
|
54
39
|
// @param {string} $key - the period-separated path to the value in the theme object, with "space." omitted. e.g., "100"
|
|
55
40
|
@function space($key) {
|
|
56
41
|
$keys: _str-split($key, ".");
|
|
57
|
-
@return _map-deep-get($theme
|
|
42
|
+
@return _map-deep-get($theme, join("space", $keys));
|
|
58
43
|
}
|
|
59
44
|
|
|
60
45
|
// @param {string} $key - the period-separated path to the value in the theme object, with "radii." omitted. e.g., "inner"
|
|
61
46
|
@function radii($key) {
|
|
62
47
|
$keys: _str-split($key, ".");
|
|
63
|
-
@return _map-deep-get($theme
|
|
48
|
+
@return _map-deep-get($theme, join("radii", $keys));
|
|
64
49
|
}
|
|
65
50
|
|
|
66
51
|
// @param {string} $key - the period-separated path to the value in the theme object, with "borders." omitted. e.g., "500"
|
|
67
52
|
@function borders($key) {
|
|
68
53
|
$keys: _str-split($key, ".");
|
|
69
|
-
@return _map-deep-get($theme
|
|
54
|
+
@return _map-deep-get($theme, join("borders", $keys));
|
|
70
55
|
}
|
|
71
56
|
|
|
72
57
|
// @param {string} $key - the period-separated path to the value in the theme object, with "borderWidths." omitted. e.g., "500"
|
|
73
58
|
@function borderWidths($key) {
|
|
74
59
|
$keys: _str-split($key, ".");
|
|
75
|
-
@return _map-deep-get($theme
|
|
60
|
+
@return _map-deep-get($theme, join("borderWidths", $keys));
|
|
76
61
|
}
|
|
77
62
|
|
|
78
63
|
// @param {string} $key - the period-separated path to the value in the theme object, with "shadows." omitted. e.g., "low"
|
|
79
64
|
@function shadows($key) {
|
|
80
65
|
$keys: _str-split($key, ".");
|
|
81
|
-
@return _map-deep-get($theme
|
|
66
|
+
@return _map-deep-get($theme, join("shadows", $keys));
|
|
82
67
|
}
|
|
83
68
|
|
|
84
69
|
// @param {string} $key - the period-separated path to the value in the theme object, with "easing." omitted. e.g., "ease_in"
|
|
85
70
|
@function easing($key) {
|
|
86
71
|
$keys: _str-split($key, ".");
|
|
87
|
-
@return _map-deep-get($theme
|
|
72
|
+
@return _map-deep-get($theme, join("easing", $keys));
|
|
88
73
|
}
|
|
89
74
|
|
|
90
75
|
// @param {string} $key - the period-separated path to the value in the theme object, with "duration." omitted. e.g., "fast"
|
|
91
76
|
@function duration($key) {
|
|
92
77
|
$keys: _str-split($key, ".");
|
|
93
|
-
@return _map-deep-get($theme
|
|
78
|
+
@return _map-deep-get($theme, join("duration", $keys));
|
|
94
79
|
}
|
|
95
80
|
|
|
96
81
|
// UTILITIES
|
|
@@ -104,7 +89,7 @@ $theme: map-get($dark, 'default');
|
|
|
104
89
|
// empty array/list
|
|
105
90
|
$split-arr: ();
|
|
106
91
|
// first index of separator in string
|
|
107
|
-
$index
|
|
92
|
+
$index: str-index($string, $separator);
|
|
108
93
|
// loop through string
|
|
109
94
|
@while $index != null {
|
|
110
95
|
// get the substring from the first character to the separator
|
|
@@ -114,7 +99,7 @@ $theme: map-get($dark, 'default');
|
|
|
114
99
|
// remove item and separator from string
|
|
115
100
|
$string: str-slice($string, $index + 1);
|
|
116
101
|
// find new index of separator
|
|
117
|
-
$index
|
|
102
|
+
$index: str-index($string, $separator);
|
|
118
103
|
}
|
|
119
104
|
// add the remaining string to list (the last item)
|
|
120
105
|
$split-arr: append($split-arr, $string);
|
|
@@ -7,90 +7,75 @@
|
|
|
7
7
|
|
|
8
8
|
// In the JS theme file, the theme object is exported as "default" (i.e., using "export default"),
|
|
9
9
|
// so we need to map-get "default" to access it.
|
|
10
|
-
$theme: map-get($light,
|
|
11
|
-
|
|
12
|
-
// MIXIN
|
|
13
|
-
// CSS properties that are theme-dependent must be wrapped in this mixin.
|
|
14
|
-
// It will convert semantic tokens to the appropriate theme-dependent CSS property.
|
|
15
|
-
@mixin themed() {
|
|
16
|
-
& {
|
|
17
|
-
$theme-map: () !global;
|
|
18
|
-
@each $key, $submap in $theme {
|
|
19
|
-
$value: map-get($theme, "#{$key}");
|
|
20
|
-
$theme-map: map-merge($theme-map, ($key: $value)) !global;
|
|
21
|
-
}
|
|
22
|
-
@content;
|
|
23
|
-
$theme-map: null !global;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
10
|
+
$theme: map-get($light, "default");
|
|
26
11
|
|
|
27
12
|
// FUNCTIONS
|
|
28
13
|
// This function will allow you to get any value from the theme.
|
|
29
14
|
// @param {string} $key - the period-separated path to the value in the theme object. e.g., "colors.text.body"
|
|
30
15
|
@function t($key) {
|
|
31
16
|
$keys: _str-split($key, ".");
|
|
32
|
-
@return _map-deep-get($theme
|
|
17
|
+
@return _map-deep-get($theme, $keys);
|
|
33
18
|
}
|
|
34
19
|
|
|
35
20
|
// The rest of the functions are convenience methods to get theme values for subsets of the theme.
|
|
36
21
|
// @param {string} $key - the period-separated path to the value in the theme object, with "colors." omitted. e.g., "text.body"
|
|
37
22
|
@function colors($key) {
|
|
38
23
|
$keys: _str-split($key, ".");
|
|
39
|
-
@return _map-deep-get($theme
|
|
24
|
+
@return _map-deep-get($theme, join("colors", $keys));
|
|
40
25
|
}
|
|
41
26
|
|
|
42
27
|
// @param {string} $key - the period-separated path to the value in the theme object, with "typography." omitted. e.g., "100.fontSize"
|
|
43
28
|
@function typography($key) {
|
|
44
29
|
$keys: _str-split($key, ".");
|
|
45
|
-
@return _map-deep-get($theme
|
|
30
|
+
@return _map-deep-get($theme, join("typography", $keys));
|
|
46
31
|
}
|
|
47
32
|
|
|
48
33
|
// @param {string} $key - the period-separated path to the value in the theme object, with "fontWeights." omitted. e.g., "normal"
|
|
49
34
|
@function fontWeights($key) {
|
|
50
35
|
$keys: _str-split($key, ".");
|
|
51
|
-
@return _map-deep-get($theme
|
|
36
|
+
@return _map-deep-get($theme, join("fontWeights", $keys));
|
|
52
37
|
}
|
|
53
38
|
|
|
54
39
|
// @param {string} $key - the period-separated path to the value in the theme object, with "space." omitted. e.g., "100"
|
|
55
40
|
@function space($key) {
|
|
56
41
|
$keys: _str-split($key, ".");
|
|
57
|
-
@return _map-deep-get($theme
|
|
42
|
+
@return _map-deep-get($theme, join("space", $keys));
|
|
58
43
|
}
|
|
59
44
|
|
|
60
45
|
// @param {string} $key - the period-separated path to the value in the theme object, with "radii." omitted. e.g., "inner"
|
|
61
46
|
@function radii($key) {
|
|
62
47
|
$keys: _str-split($key, ".");
|
|
63
|
-
@return _map-deep-get($theme
|
|
48
|
+
@return _map-deep-get($theme, join("radii", $keys));
|
|
64
49
|
}
|
|
65
50
|
|
|
66
51
|
// @param {string} $key - the period-separated path to the value in the theme object, with "borders." omitted. e.g., "500"
|
|
67
52
|
@function borders($key) {
|
|
68
53
|
$keys: _str-split($key, ".");
|
|
69
|
-
@return _map-deep-get($theme
|
|
54
|
+
@return _map-deep-get($theme, join("borders", $keys));
|
|
70
55
|
}
|
|
71
56
|
|
|
72
57
|
// @param {string} $key - the period-separated path to the value in the theme object, with "borderWidths." omitted. e.g., "500"
|
|
73
58
|
@function borderWidths($key) {
|
|
74
59
|
$keys: _str-split($key, ".");
|
|
75
|
-
@return _map-deep-get($theme
|
|
60
|
+
@return _map-deep-get($theme, join("borderWidths", $keys));
|
|
76
61
|
}
|
|
77
62
|
|
|
78
63
|
// @param {string} $key - the period-separated path to the value in the theme object, with "shadows." omitted. e.g., "low"
|
|
79
64
|
@function shadows($key) {
|
|
80
65
|
$keys: _str-split($key, ".");
|
|
81
|
-
@return _map-deep-get($theme
|
|
66
|
+
@return _map-deep-get($theme, join("shadows", $keys));
|
|
82
67
|
}
|
|
83
68
|
|
|
84
69
|
// @param {string} $key - the period-separated path to the value in the theme object, with "easing." omitted. e.g., "ease_in"
|
|
85
70
|
@function easing($key) {
|
|
86
71
|
$keys: _str-split($key, ".");
|
|
87
|
-
@return _map-deep-get($theme
|
|
72
|
+
@return _map-deep-get($theme, join("easing", $keys));
|
|
88
73
|
}
|
|
89
74
|
|
|
90
75
|
// @param {string} $key - the period-separated path to the value in the theme object, with "duration." omitted. e.g., "fast"
|
|
91
76
|
@function duration($key) {
|
|
92
77
|
$keys: _str-split($key, ".");
|
|
93
|
-
@return _map-deep-get($theme
|
|
78
|
+
@return _map-deep-get($theme, join("duration", $keys));
|
|
94
79
|
}
|
|
95
80
|
|
|
96
81
|
// UTILITIES
|
|
@@ -104,7 +89,7 @@ $theme: map-get($light, 'default');
|
|
|
104
89
|
// empty array/list
|
|
105
90
|
$split-arr: ();
|
|
106
91
|
// first index of separator in string
|
|
107
|
-
$index
|
|
92
|
+
$index: str-index($string, $separator);
|
|
108
93
|
// loop through string
|
|
109
94
|
@while $index != null {
|
|
110
95
|
// get the substring from the first character to the separator
|
|
@@ -114,7 +99,7 @@ $theme: map-get($light, 'default');
|
|
|
114
99
|
// remove item and separator from string
|
|
115
100
|
$string: str-slice($string, $index + 1);
|
|
116
101
|
// find new index of separator
|
|
117
|
-
$index
|
|
102
|
+
$index: str-index($string, $separator);
|
|
118
103
|
}
|
|
119
104
|
// add the remaining string to list (the last item)
|
|
120
105
|
$split-arr: append($split-arr, $string);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/racine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-mixin-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"__flow__",
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@storybook/addon-controls": "^6.4.19",
|
|
66
65
|
"@styled-system/theme-get": "^5.1.2",
|
|
67
66
|
"classnames": "^2.2.6",
|
|
68
67
|
"lodash.curry": "^4.1.1",
|
|
@@ -76,14 +75,14 @@
|
|
|
76
75
|
"react-popper": "^1.3.3",
|
|
77
76
|
"react-spring": "^8.0.25",
|
|
78
77
|
"react-toastify": "^6.0.5",
|
|
79
|
-
"react-virtualized": "9.
|
|
78
|
+
"react-virtualized": "9.18.5",
|
|
80
79
|
"scroll-into-view-if-needed": "1.1.0",
|
|
81
80
|
"styled-system": "^5.1.5",
|
|
82
81
|
"use-measure": "^0.2.2"
|
|
83
82
|
},
|
|
84
83
|
"devDependencies": {
|
|
85
84
|
"@babel/cli": "^7.5.5",
|
|
86
|
-
"@babel/core": "^7.
|
|
85
|
+
"@babel/core": "^7.4.5",
|
|
87
86
|
"@babel/plugin-proposal-class-properties": "^7.4.4",
|
|
88
87
|
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
|
89
88
|
"@babel/preset-env": "^7.8.0",
|
|
@@ -98,21 +97,20 @@
|
|
|
98
97
|
"@sproutsocial/seeds-networkcolor": "^2.9.0",
|
|
99
98
|
"@sproutsocial/seeds-space": "^0.4.7",
|
|
100
99
|
"@sproutsocial/seeds-typography": "^3.0.1",
|
|
101
|
-
"@storybook/addon-a11y": "^6.
|
|
102
|
-
"@storybook/addon-actions": "^6.
|
|
103
|
-
"@storybook/addon-
|
|
104
|
-
"@storybook/addon-
|
|
105
|
-
"@storybook/addon-
|
|
106
|
-
"@storybook/
|
|
107
|
-
"@storybook/addons": "^6.4.19",
|
|
100
|
+
"@storybook/addon-a11y": "^6.1.11",
|
|
101
|
+
"@storybook/addon-actions": "^6.3.8",
|
|
102
|
+
"@storybook/addon-knobs": "^6.1.11",
|
|
103
|
+
"@storybook/addon-storysource": "^6.1.11",
|
|
104
|
+
"@storybook/addon-viewport": "^6.1.11",
|
|
105
|
+
"@storybook/addons": "^6.1.11",
|
|
108
106
|
"@storybook/react": "^6.4.19",
|
|
109
|
-
"@storybook/theming": "^6.
|
|
107
|
+
"@storybook/theming": "^6.1.11",
|
|
110
108
|
"@testing-library/react": "^11.2.2",
|
|
111
109
|
"@testing-library/user-event": "^13.0.0",
|
|
112
110
|
"babel-core": "^7.0.0-bridge",
|
|
113
111
|
"babel-eslint": "10.1.0",
|
|
114
112
|
"babel-jest": "26.1.0",
|
|
115
|
-
"babel-loader": "8.
|
|
113
|
+
"babel-loader": "8.0.6",
|
|
116
114
|
"babel-plugin-inline-import": "^3.0.0",
|
|
117
115
|
"babel-plugin-polished": "^1.1.0",
|
|
118
116
|
"babel-plugin-styled-components": "^1.10.0",
|
|
@@ -140,7 +138,7 @@
|
|
|
140
138
|
"jest": "26.1.0",
|
|
141
139
|
"jest-axe": "3.4.0",
|
|
142
140
|
"jest-dom": "^3.5.0",
|
|
143
|
-
"jest-styled-components": "7.0.
|
|
141
|
+
"jest-styled-components": "7.0.0-beta.1",
|
|
144
142
|
"jscodeshift": "^0.6.4",
|
|
145
143
|
"json-to-scss": "^1.6.2",
|
|
146
144
|
"lint-staged": "^10.2.11",
|
|
@@ -148,15 +146,15 @@
|
|
|
148
146
|
"npm-run-all": "^4.1.2",
|
|
149
147
|
"outdent": "^0.7.0",
|
|
150
148
|
"pify": "^4.0.1",
|
|
151
|
-
"playroom": "^0.
|
|
149
|
+
"playroom": "^0.22.2",
|
|
152
150
|
"prettier": "^2.0.5",
|
|
153
151
|
"prop-types": "^15.6.1",
|
|
154
152
|
"react": "16.12.0",
|
|
155
153
|
"react-dates": "^21.8.0",
|
|
156
154
|
"react-dom": "16.12.0",
|
|
157
155
|
"rimraf": "^2.6.3",
|
|
158
|
-
"storybook-dark-mode": "^1.0.
|
|
159
|
-
"styled-components": "5.
|
|
156
|
+
"storybook-dark-mode": "^1.0.7",
|
|
157
|
+
"styled-components": "5.0.0-rc.2",
|
|
160
158
|
"stylelint": "^13.8.0",
|
|
161
159
|
"stylelint-config-recommended": "^2.2.0",
|
|
162
160
|
"stylelint-config-styled-components": "^0.1.1",
|
|
@@ -181,7 +179,6 @@
|
|
|
181
179
|
"styled-components": "^5.0.0-rc.2"
|
|
182
180
|
},
|
|
183
181
|
"resolutions": {
|
|
184
|
-
"**/eslint-import-resolver-node": "0.3.4",
|
|
185
182
|
"lodash": "^4.17.21",
|
|
186
183
|
"react-popper/create-react-context": "^0.3.0"
|
|
187
184
|
},
|