@sproutsocial/racine 9.0.0 → 9.1.0-token-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__/Token/index.js +4 -1
- package/__flow__/Token/index.stories.js +11 -0
- package/__flow__/Token/styles.js +43 -33
- package/__flow__/themes/dark/theme.js +8 -1
- package/__flow__/themes/default/theme.js +8 -0
- package/__flow__/themes/utils/interact.js +12 -0
- package/commonjs/Token/index.js +5 -2
- package/commonjs/Token/styles.js +19 -50
- package/commonjs/themes/dark/theme.js +7 -1
- package/commonjs/themes/default/theme.js +8 -1
- package/commonjs/themes/utils/interact.js +19 -0
- package/dist/themes/dark.scss +13 -7
- package/dist/themes/default.scss +11 -7
- package/lib/Token/index.js +5 -2
- package/lib/Token/styles.js +19 -50
- package/lib/themes/dark/theme.js +6 -1
- package/lib/themes/default/theme.js +7 -1
- package/lib/themes/utils/interact.js +13 -0
- package/package.json +1 -1
package/__flow__/Token/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export type TypeProps = {
|
|
|
15
15
|
valid?: boolean,
|
|
16
16
|
/** Indicates whether the token is disabled */
|
|
17
17
|
disabled?: boolean,
|
|
18
|
+
palette?: "neutral" | "blue",
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const Token = ({
|
|
@@ -24,6 +25,7 @@ const Token = ({
|
|
|
24
25
|
qa,
|
|
25
26
|
valid = true,
|
|
26
27
|
disabled = false,
|
|
28
|
+
palette = "neutral",
|
|
27
29
|
...rest
|
|
28
30
|
}: TypeProps) => {
|
|
29
31
|
const textContainer = useTextContent("");
|
|
@@ -32,8 +34,9 @@ const Token = ({
|
|
|
32
34
|
<Container
|
|
33
35
|
ref={textContainer}
|
|
34
36
|
valid={valid}
|
|
35
|
-
|
|
37
|
+
palette={palette}
|
|
36
38
|
type={closeable || onClick ? "button" : undefined}
|
|
39
|
+
as={closeable || onClick ? "button" : "div"}
|
|
37
40
|
closeable={closeable || onClick}
|
|
38
41
|
disabled={disabled}
|
|
39
42
|
onClick={onClick}
|
|
@@ -80,3 +80,14 @@ export const staticWithIcon = () => (
|
|
|
80
80
|
staticWithIcon.story = {
|
|
81
81
|
name: "Static with icon",
|
|
82
82
|
};
|
|
83
|
+
|
|
84
|
+
export const bluePalette = () => (
|
|
85
|
+
<Token palette="blue" closeable={boolean("closeable", false)}>
|
|
86
|
+
<Icon size="mini" name="twitter" pr={300} />
|
|
87
|
+
<span>I'm blue</span>
|
|
88
|
+
</Token>
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
bluePalette.story = {
|
|
92
|
+
name: "Palette Variation",
|
|
93
|
+
};
|
package/__flow__/Token/styles.js
CHANGED
|
@@ -6,68 +6,78 @@ import { focusRing } from "../utils/mixins";
|
|
|
6
6
|
import type { TypeTheme } from "../types/theme.flow";
|
|
7
7
|
|
|
8
8
|
const Container: StyledComponent<any, TypeTheme, *> = styled.button`
|
|
9
|
-
font-family: ${(props) => props.theme.fontFamily};
|
|
10
|
-
${(props) => props.theme.typography[200]};
|
|
11
9
|
position: relative;
|
|
12
10
|
display: inline-block;
|
|
13
|
-
padding: ${(props) => props.theme.space[200]}
|
|
14
|
-
${(props) => props.theme.space[300]};
|
|
15
11
|
margin: 0;
|
|
16
|
-
color: ${(props) => props.theme.colors.text.body};
|
|
17
|
-
background: ${(props) => props.theme.colors.container.background.base};
|
|
18
|
-
border: 1px solid ${(props) => props.theme.colors.container.border.base};
|
|
19
|
-
font-weight: ${(props) => props.theme.fontWeights.normal};
|
|
20
12
|
line-height: 1;
|
|
21
13
|
vertical-align: middle;
|
|
22
|
-
border-radius: ${(props) => props.theme.radii[500]};
|
|
23
14
|
outline: none;
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
/* Theme Properties */
|
|
16
|
+
${({ theme }) => css`
|
|
17
|
+
${theme.typography[200]}
|
|
18
|
+
font-family: ${theme.fontFamily};
|
|
19
|
+
font-weight: ${theme.fontWeights.normal};
|
|
20
|
+
border: 1px solid ${theme.colors.container.border.base};
|
|
21
|
+
border-radius: ${theme.radii[500]};
|
|
22
|
+
color: ${theme.colors.text.body};
|
|
23
|
+
background: ${theme.colors.container.background.base};
|
|
24
|
+
padding: ${theme.space[200]} ${theme.space[300]};
|
|
25
|
+
transition: all ${theme.duration.fast} ${theme.easing.ease_inout};
|
|
26
|
+
`}
|
|
26
27
|
|
|
27
28
|
&:focus {
|
|
28
29
|
${focusRing}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
${(
|
|
32
|
-
|
|
32
|
+
${({ theme, palette }) =>
|
|
33
|
+
palette === "blue" &&
|
|
33
34
|
css`
|
|
34
|
-
|
|
35
|
+
color: ${theme.colors.text.body};
|
|
36
|
+
background: ${theme.colors.container.background.decorative.blue};
|
|
37
|
+
border: 1px solid ${theme.colors.container.border.decorative.blue};
|
|
38
|
+
&:hover,
|
|
39
|
+
&:active {
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
box-shadow: ${theme.shadows.low};
|
|
42
|
+
border: 1px solid
|
|
43
|
+
${theme.utils.interact(theme.colors.container.border.decorative.blue)};
|
|
44
|
+
}
|
|
45
|
+
`}
|
|
35
46
|
|
|
47
|
+
${({ closeable, theme }) =>
|
|
48
|
+
closeable &&
|
|
49
|
+
css`
|
|
50
|
+
cursor: pointer;
|
|
36
51
|
&:hover,
|
|
37
52
|
&:active {
|
|
38
|
-
|
|
53
|
+
box-shadow: ${theme.shadows.low};
|
|
39
54
|
border: 1px solid
|
|
40
|
-
${(
|
|
41
|
-
background-color: ${(props) =>
|
|
42
|
-
props.theme.colors.container.background.decorative.neutral};
|
|
55
|
+
${theme.utils.interact(theme.colors.container.border.base)};
|
|
43
56
|
}
|
|
44
57
|
`}
|
|
45
58
|
|
|
46
|
-
${(
|
|
47
|
-
|
|
59
|
+
${({ disabled, theme }) =>
|
|
60
|
+
disabled &&
|
|
48
61
|
css`
|
|
49
62
|
opacity: 0.4;
|
|
50
63
|
cursor: not-allowed;
|
|
51
64
|
&:hover,
|
|
52
65
|
&:active {
|
|
53
|
-
|
|
54
|
-
border: 1px solid ${
|
|
66
|
+
box-shadow: none;
|
|
67
|
+
border: 1px solid ${theme.colors.container.border.base};
|
|
55
68
|
}
|
|
56
69
|
`}
|
|
57
|
-
|
|
58
|
-
${(
|
|
59
|
-
!
|
|
70
|
+
|
|
71
|
+
${({ valid, theme }) =>
|
|
72
|
+
!valid &&
|
|
60
73
|
css`
|
|
61
|
-
color: ${
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
color: ${theme.colors.text.error};
|
|
75
|
+
background: ${theme.colors.container.background.error};
|
|
76
|
+
border: 1px solid ${theme.colors.container.border.error};
|
|
65
77
|
&:hover {
|
|
66
|
-
|
|
78
|
+
box-shadow: ${theme.shadows.low};
|
|
67
79
|
border: 1px solid
|
|
68
|
-
${(
|
|
69
|
-
background-color: ${(props) =>
|
|
70
|
-
props.theme.colors.container.background.error};
|
|
80
|
+
${theme.utils.interact(theme.colors.container.border.error)};
|
|
71
81
|
}
|
|
72
82
|
`}
|
|
73
83
|
|
|
@@ -14,6 +14,10 @@ import {
|
|
|
14
14
|
neutral,
|
|
15
15
|
} from "./decorative-palettes";
|
|
16
16
|
|
|
17
|
+
import interact from "../utils/interact";
|
|
18
|
+
|
|
19
|
+
const MODE = "default-dark";
|
|
20
|
+
|
|
17
21
|
export const shadows = {
|
|
18
22
|
low: `${DEPTH.ELEVATION_LEVEL_100} ${COLORS.COLOR_NEUTRAL_1100}FF`,
|
|
19
23
|
medium: `${DEPTH.ELEVATION_LEVEL_300} ${COLORS.COLOR_NEUTRAL_1100}FF`,
|
|
@@ -22,6 +26,9 @@ export const shadows = {
|
|
|
22
26
|
|
|
23
27
|
const colors = {
|
|
24
28
|
...defaultTheme.colors,
|
|
29
|
+
utils: {
|
|
30
|
+
interact: interact(MODE),
|
|
31
|
+
},
|
|
25
32
|
app: {
|
|
26
33
|
background: {
|
|
27
34
|
base: COLORS.COLOR_NEUTRAL_1000,
|
|
@@ -208,7 +215,7 @@ const darkTheme = {
|
|
|
208
215
|
...defaultTheme,
|
|
209
216
|
colors,
|
|
210
217
|
shadows,
|
|
211
|
-
mode:
|
|
218
|
+
mode: MODE,
|
|
212
219
|
};
|
|
213
220
|
|
|
214
221
|
export default darkTheme;
|
|
@@ -19,8 +19,12 @@ import DEPTH from "@sproutsocial/seeds-depth";
|
|
|
19
19
|
import MOTION from "@sproutsocial/seeds-motion";
|
|
20
20
|
import BORDER from "@sproutsocial/seeds-border";
|
|
21
21
|
|
|
22
|
+
import interact from "../utils/interact";
|
|
23
|
+
|
|
22
24
|
export const breakpoints = ["900px", "1200px", "1500px", "1800px"];
|
|
23
25
|
|
|
26
|
+
const MODE = "default-light";
|
|
27
|
+
|
|
24
28
|
const colors = {
|
|
25
29
|
app: {
|
|
26
30
|
background: {
|
|
@@ -321,6 +325,9 @@ export const duration = {
|
|
|
321
325
|
};
|
|
322
326
|
|
|
323
327
|
const theme = {
|
|
328
|
+
utils: {
|
|
329
|
+
interact: interact(MODE),
|
|
330
|
+
},
|
|
324
331
|
breakpoints,
|
|
325
332
|
colors,
|
|
326
333
|
typography: {
|
|
@@ -347,6 +354,7 @@ const theme = {
|
|
|
347
354
|
shadows,
|
|
348
355
|
easing,
|
|
349
356
|
duration,
|
|
357
|
+
mode: MODE,
|
|
350
358
|
};
|
|
351
359
|
|
|
352
360
|
export default theme;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//@flow strict-local
|
|
2
|
+
import { darken, lighten } from "polished";
|
|
3
|
+
|
|
4
|
+
const interact = (mode: string) => (themeValue: string) => {
|
|
5
|
+
if (mode === "default-dark") {
|
|
6
|
+
return lighten(0.2, themeValue);
|
|
7
|
+
} else {
|
|
8
|
+
return darken(0.2, themeValue);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default interact;
|
package/commonjs/Token/index.js
CHANGED
|
@@ -33,14 +33,17 @@ var Token = function Token(_ref) {
|
|
|
33
33
|
valid = _ref$valid === void 0 ? true : _ref$valid,
|
|
34
34
|
_ref$disabled = _ref.disabled,
|
|
35
35
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
36
|
-
|
|
36
|
+
_ref$palette = _ref.palette,
|
|
37
|
+
palette = _ref$palette === void 0 ? "neutral" : _ref$palette,
|
|
38
|
+
rest = _objectWithoutPropertiesLoose(_ref, ["children", "closeable", "onClick", "qa", "valid", "disabled", "palette"]);
|
|
37
39
|
|
|
38
40
|
var textContainer = (0, _hooks.useTextContent)("");
|
|
39
41
|
return /*#__PURE__*/React.createElement(_styles.default, _extends({
|
|
40
42
|
ref: textContainer,
|
|
41
43
|
valid: valid,
|
|
42
|
-
|
|
44
|
+
palette: palette,
|
|
43
45
|
type: closeable || onClick ? "button" : undefined,
|
|
46
|
+
as: closeable || onClick ? "button" : "div",
|
|
44
47
|
closeable: closeable || onClick,
|
|
45
48
|
disabled: disabled,
|
|
46
49
|
onClick: onClick,
|
package/commonjs/Token/styles.js
CHANGED
|
@@ -16,56 +16,25 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
16
16
|
var Container = _styledComponents.default.button.withConfig({
|
|
17
17
|
displayName: "styles__Container",
|
|
18
18
|
componentId: "nyn5zy-0"
|
|
19
|
-
})(["
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
return props.theme.duration.fast;
|
|
39
|
-
}, function (props) {
|
|
40
|
-
return props.theme.easing.ease_inout;
|
|
41
|
-
}, _mixins.focusRing, function (props) {
|
|
42
|
-
return props.closeable && (0, _styledComponents.css)(["cursor:pointer;&:hover,&:active{color:", ";border:1px solid ", ";background-color:", ";}"], function (props) {
|
|
43
|
-
return props.theme.colors.text.body;
|
|
44
|
-
}, function (props) {
|
|
45
|
-
return props.theme.colors.container.border.decorative.neutral;
|
|
46
|
-
}, function (props) {
|
|
47
|
-
return props.theme.colors.container.background.decorative.neutral;
|
|
48
|
-
});
|
|
49
|
-
}, function (props) {
|
|
50
|
-
return props.disabled && (0, _styledComponents.css)(["opacity:0.4;cursor:not-allowed;&:hover,&:active{background:", ";border:1px solid ", ";}"], function (props) {
|
|
51
|
-
return props.theme.colors.container.background.base;
|
|
52
|
-
}, function (props) {
|
|
53
|
-
return props.theme.colors.container.border.base;
|
|
54
|
-
});
|
|
55
|
-
}, function (props) {
|
|
56
|
-
return !props.valid && (0, _styledComponents.css)(["color:", ";border-color:", ";background:", ";&:hover{color:", ";border:1px solid ", ";background-color:", ";}"], function (props) {
|
|
57
|
-
return props.theme.colors.text.body;
|
|
58
|
-
}, function (props) {
|
|
59
|
-
return props.theme.colors.container.border.error;
|
|
60
|
-
}, function (props) {
|
|
61
|
-
return props.theme.colors.container.background.error;
|
|
62
|
-
}, function (props) {
|
|
63
|
-
return props.theme.colors.text.body;
|
|
64
|
-
}, function (props) {
|
|
65
|
-
return props.theme.colors.container.border.error;
|
|
66
|
-
}, function (props) {
|
|
67
|
-
return props.theme.colors.container.background.error;
|
|
68
|
-
});
|
|
19
|
+
})(["position:relative;display:inline-block;margin:0;line-height:1;vertical-align:middle;outline:none;", " &:focus{", "}", " ", " ", " ", " ", ""], function (_ref) {
|
|
20
|
+
var theme = _ref.theme;
|
|
21
|
+
return (0, _styledComponents.css)(["", " font-family:", ";font-weight:", ";border:1px solid ", ";border-radius:", ";color:", ";background:", ";padding:", " ", ";transition:all ", " ", ";"], theme.typography[200], theme.fontFamily, theme.fontWeights.normal, theme.colors.container.border.base, theme.radii[500], theme.colors.text.body, theme.colors.container.background.base, theme.space[200], theme.space[300], theme.duration.fast, theme.easing.ease_inout);
|
|
22
|
+
}, _mixins.focusRing, function (_ref2) {
|
|
23
|
+
var theme = _ref2.theme,
|
|
24
|
+
palette = _ref2.palette;
|
|
25
|
+
return palette === "blue" && (0, _styledComponents.css)(["color:", ";background:", ";border:1px solid ", ";&:hover,&:active{cursor:pointer;box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.body, theme.colors.container.background.decorative.blue, theme.colors.container.border.decorative.blue, theme.shadows.low, theme.utils.interact(theme.colors.container.border.decorative.blue));
|
|
26
|
+
}, function (_ref3) {
|
|
27
|
+
var closeable = _ref3.closeable,
|
|
28
|
+
theme = _ref3.theme;
|
|
29
|
+
return closeable && (0, _styledComponents.css)(["cursor:pointer;&:hover,&:active{box-shadow:", ";border:1px solid ", ";}"], theme.shadows.low, theme.utils.interact(theme.colors.container.border.base));
|
|
30
|
+
}, function (_ref4) {
|
|
31
|
+
var disabled = _ref4.disabled,
|
|
32
|
+
theme = _ref4.theme;
|
|
33
|
+
return disabled && (0, _styledComponents.css)(["opacity:0.4;cursor:not-allowed;&:hover,&:active{box-shadow:none;border:1px solid ", ";}"], theme.colors.container.border.base);
|
|
34
|
+
}, function (_ref5) {
|
|
35
|
+
var valid = _ref5.valid,
|
|
36
|
+
theme = _ref5.theme;
|
|
37
|
+
return !valid && (0, _styledComponents.css)(["color:", ";background:", ";border:1px solid ", ";&:hover{box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.error, theme.colors.container.background.error, theme.colors.container.border.error, theme.shadows.low, theme.utils.interact(theme.colors.container.border.error));
|
|
69
38
|
}, _systemProps.COMMON);
|
|
70
39
|
|
|
71
40
|
var _default = Container;
|
|
@@ -13,10 +13,13 @@ var _datavizPalette = require("./dataviz-palette");
|
|
|
13
13
|
|
|
14
14
|
var _decorativePalettes = require("./decorative-palettes");
|
|
15
15
|
|
|
16
|
+
var _interact = _interopRequireDefault(require("../utils/interact"));
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
21
|
|
|
22
|
+
var MODE = "default-dark";
|
|
20
23
|
var shadows = {
|
|
21
24
|
low: _seedsDepth.default.ELEVATION_LEVEL_100 + " " + _seedsColor.default.COLOR_NEUTRAL_1100 + "FF",
|
|
22
25
|
medium: _seedsDepth.default.ELEVATION_LEVEL_300 + " " + _seedsColor.default.COLOR_NEUTRAL_1100 + "FF",
|
|
@@ -25,6 +28,9 @@ var shadows = {
|
|
|
25
28
|
exports.shadows = shadows;
|
|
26
29
|
|
|
27
30
|
var colors = _extends({}, _theme.default.colors, {
|
|
31
|
+
utils: {
|
|
32
|
+
interact: (0, _interact.default)(MODE)
|
|
33
|
+
},
|
|
28
34
|
app: {
|
|
29
35
|
background: {
|
|
30
36
|
base: _seedsColor.default.COLOR_NEUTRAL_1000
|
|
@@ -209,7 +215,7 @@ var colors = _extends({}, _theme.default.colors, {
|
|
|
209
215
|
var darkTheme = _extends({}, _theme.default, {
|
|
210
216
|
colors: colors,
|
|
211
217
|
shadows: shadows,
|
|
212
|
-
mode:
|
|
218
|
+
mode: MODE
|
|
213
219
|
});
|
|
214
220
|
|
|
215
221
|
var _default = darkTheme;
|
|
@@ -23,12 +23,15 @@ var _seedsMotion = _interopRequireDefault(require("@sproutsocial/seeds-motion"))
|
|
|
23
23
|
|
|
24
24
|
var _seedsBorder = _interopRequireDefault(require("@sproutsocial/seeds-border"));
|
|
25
25
|
|
|
26
|
+
var _interact = _interopRequireDefault(require("../utils/interact"));
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
31
|
|
|
30
32
|
var breakpoints = ["900px", "1200px", "1500px", "1800px"];
|
|
31
33
|
exports.breakpoints = breakpoints;
|
|
34
|
+
var MODE = "default-light";
|
|
32
35
|
|
|
33
36
|
var colors = _extends({
|
|
34
37
|
app: {
|
|
@@ -312,6 +315,9 @@ var duration = {
|
|
|
312
315
|
};
|
|
313
316
|
exports.duration = duration;
|
|
314
317
|
var theme = {
|
|
318
|
+
utils: {
|
|
319
|
+
interact: (0, _interact.default)(MODE)
|
|
320
|
+
},
|
|
315
321
|
breakpoints: breakpoints,
|
|
316
322
|
colors: colors,
|
|
317
323
|
typography: _extends({}, typography, {
|
|
@@ -334,7 +340,8 @@ var theme = {
|
|
|
334
340
|
borderWidths: borderWidths,
|
|
335
341
|
shadows: shadows,
|
|
336
342
|
easing: easing,
|
|
337
|
-
duration: duration
|
|
343
|
+
duration: duration,
|
|
344
|
+
mode: MODE
|
|
338
345
|
};
|
|
339
346
|
var _default = theme;
|
|
340
347
|
exports.default = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _polished = require("polished");
|
|
7
|
+
|
|
8
|
+
var interact = function interact(mode) {
|
|
9
|
+
return function (themeValue) {
|
|
10
|
+
if (mode === "default-dark") {
|
|
11
|
+
return (0, _polished.lighten)(0.2, themeValue);
|
|
12
|
+
} else {
|
|
13
|
+
return (0, _polished.darken)(0.2, themeValue);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
var _default = interact;
|
|
19
|
+
exports.default = _default;
|
package/dist/themes/dark.scss
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
$dark: (
|
|
2
2
|
__esModule: true,
|
|
3
3
|
shadows: (
|
|
4
|
-
low: 0px 2px 4px #040404FF,
|
|
5
|
-
medium: 0px 8px 16px #040404FF,
|
|
6
|
-
high: 0px 16px 32px #040404FF
|
|
4
|
+
low: 0px 2px 4px rgba(39,51,51,.24) #040404FF,
|
|
5
|
+
medium: 0px 8px 16px rgba(39,51,51,.24) #040404FF,
|
|
6
|
+
high: 0px 16px 32px rgba(39,51,51,.24) #040404FF
|
|
7
7
|
),
|
|
8
8
|
default: (
|
|
9
|
+
utils: (
|
|
10
|
+
|
|
11
|
+
),
|
|
9
12
|
breakpoints: (900px, 1200px, 1500px, 1800px),
|
|
10
13
|
colors: (
|
|
11
14
|
app: (
|
|
@@ -409,6 +412,9 @@ $dark: (
|
|
|
409
412
|
18: #ff7f6e,
|
|
410
413
|
19: #c2f2bd,
|
|
411
414
|
20: #ffe99a
|
|
415
|
+
),
|
|
416
|
+
utils: (
|
|
417
|
+
|
|
412
418
|
)
|
|
413
419
|
),
|
|
414
420
|
typography: (
|
|
@@ -576,9 +582,9 @@ $dark: (
|
|
|
576
582
|
500: 1px
|
|
577
583
|
),
|
|
578
584
|
shadows: (
|
|
579
|
-
low: 0px 2px 4px #040404FF,
|
|
580
|
-
medium: 0px 8px 16px #040404FF,
|
|
581
|
-
high: 0px 16px 32px #040404FF
|
|
585
|
+
low: 0px 2px 4px rgba(39,51,51,.24) #040404FF,
|
|
586
|
+
medium: 0px 8px 16px rgba(39,51,51,.24) #040404FF,
|
|
587
|
+
high: 0px 16px 32px rgba(39,51,51,.24) #040404FF
|
|
582
588
|
),
|
|
583
589
|
easing: (
|
|
584
590
|
ease_in: cubic-bezier(.4, 0, .7, .2),
|
|
@@ -590,6 +596,6 @@ $dark: (
|
|
|
590
596
|
medium: .3s,
|
|
591
597
|
slow: .6s
|
|
592
598
|
),
|
|
593
|
-
mode: dark
|
|
599
|
+
mode: default-dark
|
|
594
600
|
)
|
|
595
601
|
);
|
package/dist/themes/default.scss
CHANGED
|
@@ -85,9 +85,9 @@ $default: (
|
|
|
85
85
|
500: 1px
|
|
86
86
|
),
|
|
87
87
|
shadows: (
|
|
88
|
-
low: 0px 2px 4px #2733333D,
|
|
89
|
-
medium: 0px 8px 16px #2733333D,
|
|
90
|
-
high: 0px 16px 32px #2733333D
|
|
88
|
+
low: 0px 2px 4px rgba(39,51,51,.24) #2733333D,
|
|
89
|
+
medium: 0px 8px 16px rgba(39,51,51,.24) #2733333D,
|
|
90
|
+
high: 0px 16px 32px rgba(39,51,51,.24) #2733333D
|
|
91
91
|
),
|
|
92
92
|
easing: (
|
|
93
93
|
ease_in: cubic-bezier(.4, 0, .7, .2),
|
|
@@ -100,6 +100,9 @@ $default: (
|
|
|
100
100
|
slow: .6s
|
|
101
101
|
),
|
|
102
102
|
default: (
|
|
103
|
+
utils: (
|
|
104
|
+
|
|
105
|
+
),
|
|
103
106
|
breakpoints: (900px, 1200px, 1500px, 1800px),
|
|
104
107
|
colors: (
|
|
105
108
|
app: (
|
|
@@ -670,9 +673,9 @@ $default: (
|
|
|
670
673
|
500: 1px
|
|
671
674
|
),
|
|
672
675
|
shadows: (
|
|
673
|
-
low: 0px 2px 4px #2733333D,
|
|
674
|
-
medium: 0px 8px 16px #2733333D,
|
|
675
|
-
high: 0px 16px 32px #2733333D
|
|
676
|
+
low: 0px 2px 4px rgba(39,51,51,.24) #2733333D,
|
|
677
|
+
medium: 0px 8px 16px rgba(39,51,51,.24) #2733333D,
|
|
678
|
+
high: 0px 16px 32px rgba(39,51,51,.24) #2733333D
|
|
676
679
|
),
|
|
677
680
|
easing: (
|
|
678
681
|
ease_in: cubic-bezier(.4, 0, .7, .2),
|
|
@@ -683,6 +686,7 @@ $default: (
|
|
|
683
686
|
fast: .15s,
|
|
684
687
|
medium: .3s,
|
|
685
688
|
slow: .6s
|
|
686
|
-
)
|
|
689
|
+
),
|
|
690
|
+
mode: default-light
|
|
687
691
|
)
|
|
688
692
|
);
|
package/lib/Token/index.js
CHANGED
|
@@ -18,14 +18,17 @@ var Token = function Token(_ref) {
|
|
|
18
18
|
valid = _ref$valid === void 0 ? true : _ref$valid,
|
|
19
19
|
_ref$disabled = _ref.disabled,
|
|
20
20
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
21
|
-
|
|
21
|
+
_ref$palette = _ref.palette,
|
|
22
|
+
palette = _ref$palette === void 0 ? "neutral" : _ref$palette,
|
|
23
|
+
rest = _objectWithoutPropertiesLoose(_ref, ["children", "closeable", "onClick", "qa", "valid", "disabled", "palette"]);
|
|
22
24
|
|
|
23
25
|
var textContainer = useTextContent("");
|
|
24
26
|
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
25
27
|
ref: textContainer,
|
|
26
28
|
valid: valid,
|
|
27
|
-
|
|
29
|
+
palette: palette,
|
|
28
30
|
type: closeable || onClick ? "button" : undefined,
|
|
31
|
+
as: closeable || onClick ? "button" : "div",
|
|
29
32
|
closeable: closeable || onClick,
|
|
30
33
|
disabled: disabled,
|
|
31
34
|
onClick: onClick,
|
package/lib/Token/styles.js
CHANGED
|
@@ -4,55 +4,24 @@ import { focusRing } from "../utils/mixins";
|
|
|
4
4
|
var Container = styled.button.withConfig({
|
|
5
5
|
displayName: "styles__Container",
|
|
6
6
|
componentId: "nyn5zy-0"
|
|
7
|
-
})(["
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
return props.theme.duration.fast;
|
|
27
|
-
}, function (props) {
|
|
28
|
-
return props.theme.easing.ease_inout;
|
|
29
|
-
}, focusRing, function (props) {
|
|
30
|
-
return props.closeable && css(["cursor:pointer;&:hover,&:active{color:", ";border:1px solid ", ";background-color:", ";}"], function (props) {
|
|
31
|
-
return props.theme.colors.text.body;
|
|
32
|
-
}, function (props) {
|
|
33
|
-
return props.theme.colors.container.border.decorative.neutral;
|
|
34
|
-
}, function (props) {
|
|
35
|
-
return props.theme.colors.container.background.decorative.neutral;
|
|
36
|
-
});
|
|
37
|
-
}, function (props) {
|
|
38
|
-
return props.disabled && css(["opacity:0.4;cursor:not-allowed;&:hover,&:active{background:", ";border:1px solid ", ";}"], function (props) {
|
|
39
|
-
return props.theme.colors.container.background.base;
|
|
40
|
-
}, function (props) {
|
|
41
|
-
return props.theme.colors.container.border.base;
|
|
42
|
-
});
|
|
43
|
-
}, function (props) {
|
|
44
|
-
return !props.valid && css(["color:", ";border-color:", ";background:", ";&:hover{color:", ";border:1px solid ", ";background-color:", ";}"], function (props) {
|
|
45
|
-
return props.theme.colors.text.body;
|
|
46
|
-
}, function (props) {
|
|
47
|
-
return props.theme.colors.container.border.error;
|
|
48
|
-
}, function (props) {
|
|
49
|
-
return props.theme.colors.container.background.error;
|
|
50
|
-
}, function (props) {
|
|
51
|
-
return props.theme.colors.text.body;
|
|
52
|
-
}, function (props) {
|
|
53
|
-
return props.theme.colors.container.border.error;
|
|
54
|
-
}, function (props) {
|
|
55
|
-
return props.theme.colors.container.background.error;
|
|
56
|
-
});
|
|
7
|
+
})(["position:relative;display:inline-block;margin:0;line-height:1;vertical-align:middle;outline:none;", " &:focus{", "}", " ", " ", " ", " ", ""], function (_ref) {
|
|
8
|
+
var theme = _ref.theme;
|
|
9
|
+
return css(["", " font-family:", ";font-weight:", ";border:1px solid ", ";border-radius:", ";color:", ";background:", ";padding:", " ", ";transition:all ", " ", ";"], theme.typography[200], theme.fontFamily, theme.fontWeights.normal, theme.colors.container.border.base, theme.radii[500], theme.colors.text.body, theme.colors.container.background.base, theme.space[200], theme.space[300], theme.duration.fast, theme.easing.ease_inout);
|
|
10
|
+
}, focusRing, function (_ref2) {
|
|
11
|
+
var theme = _ref2.theme,
|
|
12
|
+
palette = _ref2.palette;
|
|
13
|
+
return palette === "blue" && css(["color:", ";background:", ";border:1px solid ", ";&:hover,&:active{cursor:pointer;box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.body, theme.colors.container.background.decorative.blue, theme.colors.container.border.decorative.blue, theme.shadows.low, theme.utils.interact(theme.colors.container.border.decorative.blue));
|
|
14
|
+
}, function (_ref3) {
|
|
15
|
+
var closeable = _ref3.closeable,
|
|
16
|
+
theme = _ref3.theme;
|
|
17
|
+
return closeable && css(["cursor:pointer;&:hover,&:active{box-shadow:", ";border:1px solid ", ";}"], theme.shadows.low, theme.utils.interact(theme.colors.container.border.base));
|
|
18
|
+
}, function (_ref4) {
|
|
19
|
+
var disabled = _ref4.disabled,
|
|
20
|
+
theme = _ref4.theme;
|
|
21
|
+
return disabled && css(["opacity:0.4;cursor:not-allowed;&:hover,&:active{box-shadow:none;border:1px solid ", ";}"], theme.colors.container.border.base);
|
|
22
|
+
}, function (_ref5) {
|
|
23
|
+
var valid = _ref5.valid,
|
|
24
|
+
theme = _ref5.theme;
|
|
25
|
+
return !valid && css(["color:", ";background:", ";border:1px solid ", ";&:hover{box-shadow:", ";border:1px solid ", ";}"], theme.colors.text.error, theme.colors.container.background.error, theme.colors.container.border.error, theme.shadows.low, theme.utils.interact(theme.colors.container.border.error));
|
|
57
26
|
}, COMMON);
|
|
58
27
|
export default Container;
|
package/lib/themes/dark/theme.js
CHANGED
|
@@ -5,6 +5,8 @@ import DEPTH from "@sproutsocial/seeds-depth";
|
|
|
5
5
|
import defaultTheme from "../default/theme";
|
|
6
6
|
import { datavizPalette } from "./dataviz-palette";
|
|
7
7
|
import { green, blue, purple, yellow, orange, red, neutral } from "./decorative-palettes";
|
|
8
|
+
import interact from "../utils/interact";
|
|
9
|
+
var MODE = "default-dark";
|
|
8
10
|
export var shadows = {
|
|
9
11
|
low: DEPTH.ELEVATION_LEVEL_100 + " " + COLORS.COLOR_NEUTRAL_1100 + "FF",
|
|
10
12
|
medium: DEPTH.ELEVATION_LEVEL_300 + " " + COLORS.COLOR_NEUTRAL_1100 + "FF",
|
|
@@ -12,6 +14,9 @@ export var shadows = {
|
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
var colors = _extends({}, defaultTheme.colors, {
|
|
17
|
+
utils: {
|
|
18
|
+
interact: interact(MODE)
|
|
19
|
+
},
|
|
15
20
|
app: {
|
|
16
21
|
background: {
|
|
17
22
|
base: COLORS.COLOR_NEUTRAL_1000
|
|
@@ -196,7 +201,7 @@ var colors = _extends({}, defaultTheme.colors, {
|
|
|
196
201
|
var darkTheme = _extends({}, defaultTheme, {
|
|
197
202
|
colors: colors,
|
|
198
203
|
shadows: shadows,
|
|
199
|
-
mode:
|
|
204
|
+
mode: MODE
|
|
200
205
|
});
|
|
201
206
|
|
|
202
207
|
export default darkTheme;
|
|
@@ -10,7 +10,9 @@ import SPACE from "@sproutsocial/seeds-space";
|
|
|
10
10
|
import DEPTH from "@sproutsocial/seeds-depth";
|
|
11
11
|
import MOTION from "@sproutsocial/seeds-motion";
|
|
12
12
|
import BORDER from "@sproutsocial/seeds-border";
|
|
13
|
+
import interact from "../utils/interact";
|
|
13
14
|
export var breakpoints = ["900px", "1200px", "1500px", "1800px"];
|
|
15
|
+
var MODE = "default-light";
|
|
14
16
|
|
|
15
17
|
var colors = _extends({
|
|
16
18
|
app: {
|
|
@@ -284,6 +286,9 @@ export var duration = {
|
|
|
284
286
|
slow: MOTION.MOTION_DURATION_SLOW
|
|
285
287
|
};
|
|
286
288
|
var theme = {
|
|
289
|
+
utils: {
|
|
290
|
+
interact: interact(MODE)
|
|
291
|
+
},
|
|
287
292
|
breakpoints: breakpoints,
|
|
288
293
|
colors: colors,
|
|
289
294
|
typography: _extends({}, typography, {
|
|
@@ -306,6 +311,7 @@ var theme = {
|
|
|
306
311
|
borderWidths: borderWidths,
|
|
307
312
|
shadows: shadows,
|
|
308
313
|
easing: easing,
|
|
309
|
-
duration: duration
|
|
314
|
+
duration: duration,
|
|
315
|
+
mode: MODE
|
|
310
316
|
};
|
|
311
317
|
export default theme;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { darken, lighten } from "polished";
|
|
2
|
+
|
|
3
|
+
var interact = function interact(mode) {
|
|
4
|
+
return function (themeValue) {
|
|
5
|
+
if (mode === "default-dark") {
|
|
6
|
+
return lighten(0.2, themeValue);
|
|
7
|
+
} else {
|
|
8
|
+
return darken(0.2, themeValue);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default interact;
|