@sproutsocial/racine 8.8.0-beta-shadows.0 → 8.8.0-dar35-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.
Files changed (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/__flow__/Breadcrumb/styles.js +0 -5
  3. package/__flow__/Button/styles.js +1 -1
  4. package/__flow__/Card/styles.js +1 -1
  5. package/__flow__/Drawer/styles.js +1 -1
  6. package/__flow__/KeyboardKey/styles.js +1 -1
  7. package/__flow__/Menu/index.stories.js +1 -1
  8. package/__flow__/Modal/__snapshots__/index.test.js.snap +1 -1
  9. package/__flow__/Modal/styles.js +1 -1
  10. package/__flow__/Popout/index.js +1 -1
  11. package/__flow__/Tooltip/index.js +1 -1
  12. package/__flow__/themes/_themes.scss +140 -0
  13. package/__flow__/themes/dark/theme.js +158 -171
  14. package/__flow__/themes/default/theme.js +8 -7
  15. package/__flow__/types/system-props.flow.js +2 -1
  16. package/commonjs/Breadcrumb/styles.js +1 -1
  17. package/commonjs/Button/styles.js +1 -1
  18. package/commonjs/Card/styles.js +1 -1
  19. package/commonjs/Drawer/styles.js +1 -1
  20. package/commonjs/KeyboardKey/styles.js +1 -1
  21. package/commonjs/Modal/styles.js +1 -1
  22. package/commonjs/Popout/index.js +1 -1
  23. package/commonjs/Tooltip/index.js +1 -1
  24. package/commonjs/themes/dark/theme.js +156 -171
  25. package/commonjs/themes/default/theme.js +7 -7
  26. package/dist/themes/_themes.scss +140 -0
  27. package/dist/themes/dark.scss +10 -11
  28. package/dist/themes/default.scss +14 -9
  29. package/lib/Breadcrumb/styles.js +1 -1
  30. package/lib/Button/styles.js +1 -1
  31. package/lib/Card/styles.js +1 -1
  32. package/lib/Drawer/styles.js +1 -1
  33. package/lib/KeyboardKey/styles.js +1 -1
  34. package/lib/Modal/styles.js +1 -1
  35. package/lib/Popout/index.js +1 -1
  36. package/lib/Tooltip/index.js +1 -1
  37. package/lib/themes/dark/theme.js +155 -167
  38. package/lib/themes/default/theme.js +7 -7
  39. package/package.json +2 -2
@@ -47,7 +47,7 @@ var Container = _styledComponents.default.button.withConfig({
47
47
  }, function (props) {
48
48
  return props.theme.colors.button[props.appearance].background.hover;
49
49
  }, function (props) {
50
- return props.appearance === "placeholder" ? props.theme.shadows.low : "none";
50
+ return props.appearance === "placeholder" ? props.theme.shadows[100] : "none";
51
51
  }, function (props) {
52
52
  return props.theme.colors.button[props.appearance].text.hover;
53
53
  }, function (props) {
@@ -19,7 +19,7 @@ var Container = (0, _styledComponents.default)(_Box.default).withConfig({
19
19
  }, function (props) {
20
20
  return props.theme.radii[500];
21
21
  }, function (props) {
22
- return props.theme.shadows.low;
22
+ return props.theme.shadows[100];
23
23
  }, function (props) {
24
24
  return props.theme.duration.medium;
25
25
  }, function (props) {
@@ -29,7 +29,7 @@ var Container = _styledComponents.default.div.withConfig({
29
29
  }, function (props) {
30
30
  return props.theme.colors.container.background.base;
31
31
  }, function (props) {
32
- return props.theme.shadows.high;
32
+ return props.theme.shadows[400];
33
33
  }, function (props) {
34
34
  return (0, _styledComponents.css)(["", ":", "px;"], props.direction, props.offset);
35
35
  }, _systemProps.COMMON);
@@ -21,7 +21,7 @@ var Container = _styledComponents.default.div.withConfig({
21
21
  }, function (props) {
22
22
  return props.theme.radii[500];
23
23
  }, function (props) {
24
- return props.theme.shadows.low;
24
+ return props.theme.shadows[100];
25
25
  }, function (props) {
26
26
  return props.theme.space[200];
27
27
  }, _systemProps.COMMON);
@@ -72,7 +72,7 @@ var Container = (0, _styledComponents.default)(ReactModalAdapter).withConfig({
72
72
  }, function (props) {
73
73
  return props.theme.radii[500];
74
74
  }, function (props) {
75
- return props.theme.shadows.medium;
75
+ return props.theme.shadows[300];
76
76
  }, function (props) {
77
77
  return props.theme.colors.text.body;
78
78
  }, BODY_PADDING, BODY_PADDING, BODY_PADDING, _styledSystem.width, _systemProps.COMMON);
@@ -290,7 +290,7 @@ Popout.Content = function (_ref4) {
290
290
  border: 500,
291
291
  borderColor: "container.border.base",
292
292
  borderRadius: "outer",
293
- boxShadow: "medium",
293
+ boxShadow: 300,
294
294
  p: 400,
295
295
  m: 300
296
296
  }, rest), children);
@@ -132,7 +132,7 @@ var Content = function Content(_ref2) {
132
132
  m: 200,
133
133
  color: "text.body",
134
134
  bg: "container.background.base",
135
- boxShadow: "medium",
135
+ boxShadow: 300,
136
136
  border: 500,
137
137
  borderColor: "container.border.base" // $FlowIssue - upgrade v0.112.0
138
138
 
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.default = exports.shadows = void 0;
4
+ exports.default = void 0;
5
5
 
6
6
  var _seedsColor = _interopRequireDefault(require("@sproutsocial/seeds-color"));
7
7
 
8
- var _seedsDepth = _interopRequireDefault(require("@sproutsocial/seeds-depth"));
9
-
10
8
  var _theme = _interopRequireDefault(require("../default/theme"));
11
9
 
12
10
  var _datavizPalette = require("./dataviz-palette");
@@ -17,198 +15,185 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
15
 
18
16
  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
17
 
20
- var shadows = {
21
- low: _seedsDepth.default.ELEVATION_LEVEL_100 + " " + _seedsColor.default.COLOR_NEUTRAL_1100 + "FF",
22
- medium: _seedsDepth.default.ELEVATION_LEVEL_300 + " " + _seedsColor.default.COLOR_NEUTRAL_1100 + "FF",
23
- high: _seedsDepth.default.ELEVATION_LEVEL_400 + " " + _seedsColor.default.COLOR_NEUTRAL_1100 + "FF"
24
- };
25
- exports.shadows = shadows;
26
-
27
- var colors = _extends({}, _theme.default.colors, {
28
- app: {
29
- background: {
30
- base: _seedsColor.default.COLOR_NEUTRAL_1000
31
- }
32
- },
33
- container: {
34
- background: {
35
- base: _seedsColor.default.COLOR_NEUTRAL_900,
36
- success: _decorativePalettes.green.background,
37
- warning: _decorativePalettes.yellow.background,
38
- error: _decorativePalettes.red.background,
39
- info: _decorativePalettes.blue.background,
40
- opportunity: _decorativePalettes.purple.background,
41
- danger: _decorativePalettes.red.background,
42
- decorative: {
43
- green: _decorativePalettes.green.background,
44
- blue: _decorativePalettes.blue.background,
45
- purple: _decorativePalettes.purple.background,
46
- yellow: _decorativePalettes.yellow.background,
47
- orange: _decorativePalettes.orange.background,
48
- red: _decorativePalettes.red.background,
49
- neutral: _decorativePalettes.neutral.background
50
- },
51
- selected: _seedsColor.default.COLOR_NEUTRAL_0
52
- },
53
- border: {
54
- base: _seedsColor.default.COLOR_NEUTRAL_1100,
55
- success: _decorativePalettes.green.highlight,
56
- warning: _decorativePalettes.yellow.highlight,
57
- error: _decorativePalettes.red.highlight,
58
- danger: _decorativePalettes.red.highlight,
59
- info: _decorativePalettes.blue.highlight,
60
- opportunity: _decorativePalettes.purple.highlight,
61
- decorative: {
62
- green: _decorativePalettes.green.highlight,
63
- blue: _decorativePalettes.blue.highlight,
64
- purple: _decorativePalettes.purple.highlight,
65
- yellow: _decorativePalettes.yellow.highlight,
66
- orange: _decorativePalettes.orange.highlight,
67
- red: _decorativePalettes.red.highlight,
68
- neutral: _decorativePalettes.neutral.highlight
69
- },
70
- selected: _seedsColor.default.COLOR_NEUTRAL_0
71
- }
72
- },
73
- button: {
74
- primary: {
18
+ var darkTheme = _extends({}, _theme.default, {
19
+ colors: _extends({}, _theme.default.colors, {
20
+ app: {
75
21
  background: {
76
- base: _seedsColor.default.COLOR_BLUE_400,
77
- hover: _seedsColor.default.COLOR_BLUE_300,
78
- active: _seedsColor.default.COLOR_BLUE_200
79
- },
80
- border: {
81
- base: "transparent"
82
- },
83
- text: {
84
- base: _seedsColor.default.COLOR_NEUTRAL_900,
85
- hover: _seedsColor.default.COLOR_NEUTRAL_1000
22
+ base: _seedsColor.default.COLOR_NEUTRAL_1000
86
23
  }
87
24
  },
88
- secondary: {
25
+ container: {
89
26
  background: {
90
- base: "transparent",
91
- hover: _seedsColor.default.COLOR_NEUTRAL_100,
92
- active: _seedsColor.default.COLOR_NEUTRAL_0
27
+ base: _seedsColor.default.COLOR_NEUTRAL_900,
28
+ success: _decorativePalettes.green.background,
29
+ warning: _decorativePalettes.yellow.background,
30
+ error: _decorativePalettes.red.background,
31
+ info: _decorativePalettes.blue.background,
32
+ opportunity: _decorativePalettes.purple.background,
33
+ danger: _decorativePalettes.red.background,
34
+ decorative: {
35
+ green: _decorativePalettes.green.background,
36
+ blue: _decorativePalettes.blue.background,
37
+ purple: _decorativePalettes.purple.background,
38
+ yellow: _decorativePalettes.yellow.background,
39
+ orange: _decorativePalettes.orange.background,
40
+ red: _decorativePalettes.red.background,
41
+ neutral: _decorativePalettes.neutral.background
42
+ },
43
+ selected: _seedsColor.default.COLOR_NEUTRAL_0
93
44
  },
94
45
  border: {
95
- base: _seedsColor.default.COLOR_NEUTRAL_0
96
- },
97
- text: {
98
- base: _seedsColor.default.COLOR_NEUTRAL_0,
99
- hover: _seedsColor.default.COLOR_NEUTRAL_800
46
+ base: _seedsColor.default.COLOR_NEUTRAL_1100,
47
+ success: _decorativePalettes.green.highlight,
48
+ warning: _decorativePalettes.yellow.highlight,
49
+ error: _decorativePalettes.red.highlight,
50
+ danger: _decorativePalettes.red.highlight,
51
+ info: _decorativePalettes.blue.highlight,
52
+ opportunity: _decorativePalettes.purple.highlight,
53
+ decorative: {
54
+ green: _decorativePalettes.green.highlight,
55
+ blue: _decorativePalettes.blue.highlight,
56
+ purple: _decorativePalettes.purple.highlight,
57
+ yellow: _decorativePalettes.yellow.highlight,
58
+ orange: _decorativePalettes.orange.highlight,
59
+ red: _decorativePalettes.red.highlight,
60
+ neutral: _decorativePalettes.neutral.highlight
61
+ },
62
+ selected: _seedsColor.default.COLOR_NEUTRAL_0
100
63
  }
101
64
  },
102
- pill: {
103
- background: {
104
- base: "transparent",
105
- hover: _seedsColor.default.COLOR_NEUTRAL_1000,
106
- active: _seedsColor.default.COLOR_NEUTRAL_900
65
+ button: {
66
+ primary: {
67
+ background: {
68
+ base: _seedsColor.default.COLOR_BLUE_400,
69
+ hover: _seedsColor.default.COLOR_BLUE_300,
70
+ active: _seedsColor.default.COLOR_BLUE_200
71
+ },
72
+ border: {
73
+ base: "transparent"
74
+ },
75
+ text: {
76
+ base: _seedsColor.default.COLOR_NEUTRAL_900,
77
+ hover: _seedsColor.default.COLOR_NEUTRAL_1000
78
+ }
107
79
  },
108
- border: {
109
- base: "transparent"
80
+ secondary: {
81
+ background: {
82
+ base: "transparent",
83
+ hover: _seedsColor.default.COLOR_NEUTRAL_100,
84
+ active: _seedsColor.default.COLOR_NEUTRAL_0
85
+ },
86
+ border: {
87
+ base: _seedsColor.default.COLOR_NEUTRAL_0
88
+ },
89
+ text: {
90
+ base: _seedsColor.default.COLOR_NEUTRAL_0,
91
+ hover: _seedsColor.default.COLOR_NEUTRAL_800
92
+ }
110
93
  },
111
- text: {
112
- base: _seedsColor.default.COLOR_NEUTRAL_100,
113
- hover: _seedsColor.default.COLOR_NEUTRAL_0
114
- }
115
- },
116
- destructive: {
117
- background: {
118
- base: _seedsColor.default.COLOR_RED_400,
119
- hover: _seedsColor.default.COLOR_RED_300,
120
- active: _seedsColor.default.COLOR_RED_200
94
+ pill: {
95
+ background: {
96
+ base: "transparent",
97
+ hover: _seedsColor.default.COLOR_NEUTRAL_1000,
98
+ active: _seedsColor.default.COLOR_NEUTRAL_900
99
+ },
100
+ border: {
101
+ base: "transparent"
102
+ },
103
+ text: {
104
+ base: _seedsColor.default.COLOR_NEUTRAL_100,
105
+ hover: _seedsColor.default.COLOR_NEUTRAL_0
106
+ }
121
107
  },
122
- border: {
123
- base: "transparent"
108
+ destructive: {
109
+ background: {
110
+ base: _seedsColor.default.COLOR_RED_400,
111
+ hover: _seedsColor.default.COLOR_RED_300,
112
+ active: _seedsColor.default.COLOR_RED_200
113
+ },
114
+ border: {
115
+ base: "transparent"
116
+ },
117
+ text: {
118
+ base: _seedsColor.default.COLOR_NEUTRAL_900,
119
+ hover: _seedsColor.default.COLOR_NEUTRAL_1000
120
+ }
124
121
  },
125
- text: {
126
- base: _seedsColor.default.COLOR_NEUTRAL_900,
127
- hover: _seedsColor.default.COLOR_NEUTRAL_1000
122
+ placeholder: {
123
+ background: {
124
+ base: "transparent",
125
+ hover: _seedsColor.default.COLOR_NEUTRAL_1100,
126
+ active: _seedsColor.default.COLOR_NEUTRAL_1100
127
+ },
128
+ border: {
129
+ base: _seedsColor.default.COLOR_NEUTRAL_500
130
+ },
131
+ text: {
132
+ base: _seedsColor.default.COLOR_BLUE_400,
133
+ hover: _seedsColor.default.COLOR_BLUE_300
134
+ }
135
+ },
136
+ unstyled: {
137
+ background: {
138
+ base: "transparent"
139
+ },
140
+ border: {
141
+ base: "transparent"
142
+ },
143
+ text: {
144
+ base: _seedsColor.default.COLOR_NEUTRAL_300,
145
+ hover: _seedsColor.default.COLOR_NEUTRAL_200
146
+ }
128
147
  }
129
148
  },
130
- placeholder: {
149
+ link: {
150
+ base: _seedsColor.default.COLOR_BLUE_400,
151
+ hover: _seedsColor.default.COLOR_BLUE_300
152
+ },
153
+ text: {
154
+ headline: _seedsColor.default.COLOR_NEUTRAL_0,
155
+ subtext: _seedsColor.default.COLOR_NEUTRAL_300,
156
+ body: _seedsColor.default.COLOR_NEUTRAL_100,
157
+ inverse: _seedsColor.default.COLOR_NEUTRAL_900,
158
+ error: _seedsColor.default.COLOR_RED_400
159
+ },
160
+ icon: {
161
+ base: _seedsColor.default.COLOR_NEUTRAL_100,
162
+ inverse: _seedsColor.default.COLOR_NEUTRAL_900,
163
+ success: _decorativePalettes.green.foreground,
164
+ warning: _decorativePalettes.yellow.foreground,
165
+ error: _decorativePalettes.red.foreground,
166
+ danger: _decorativePalettes.red.foreground,
167
+ info: _decorativePalettes.blue.foreground,
168
+ opportunity: _decorativePalettes.purple.foreground
169
+ },
170
+ form: {
131
171
  background: {
132
- base: "transparent",
133
- hover: _seedsColor.default.COLOR_NEUTRAL_1100,
134
- active: _seedsColor.default.COLOR_NEUTRAL_1100
172
+ base: _seedsColor.default.COLOR_NEUTRAL_900,
173
+ selected: _seedsColor.default.COLOR_NEUTRAL_0
135
174
  },
136
175
  border: {
137
- base: _seedsColor.default.COLOR_NEUTRAL_500
176
+ base: _seedsColor.default.COLOR_NEUTRAL_500,
177
+ error: _decorativePalettes.red.highlight,
178
+ warning: _decorativePalettes.yellow.highlight,
179
+ selected: _seedsColor.default.COLOR_NEUTRAL_0
138
180
  },
139
- text: {
140
- base: _seedsColor.default.COLOR_BLUE_400,
141
- hover: _seedsColor.default.COLOR_BLUE_300
181
+ placeholder: {
182
+ base: _seedsColor.default.COLOR_NEUTRAL_500
142
183
  }
143
184
  },
144
- unstyled: {
185
+ listItem: {
145
186
  background: {
146
- base: "transparent"
147
- },
148
- border: {
149
- base: "transparent"
150
- },
151
- text: {
152
- base: _seedsColor.default.COLOR_NEUTRAL_300,
153
- hover: _seedsColor.default.COLOR_NEUTRAL_200
187
+ base: "transparent",
188
+ hover: _seedsColor.default.COLOR_NEUTRAL_800,
189
+ selected: _seedsColor.default.COLOR_NEUTRAL_0
154
190
  }
155
- }
156
- },
157
- link: {
158
- base: _seedsColor.default.COLOR_BLUE_400,
159
- hover: _seedsColor.default.COLOR_BLUE_300
160
- },
161
- text: {
162
- headline: _seedsColor.default.COLOR_NEUTRAL_0,
163
- subtext: _seedsColor.default.COLOR_NEUTRAL_300,
164
- body: _seedsColor.default.COLOR_NEUTRAL_100,
165
- inverse: _seedsColor.default.COLOR_NEUTRAL_900,
166
- error: _seedsColor.default.COLOR_RED_400
167
- },
168
- icon: {
169
- base: _seedsColor.default.COLOR_NEUTRAL_100,
170
- inverse: _seedsColor.default.COLOR_NEUTRAL_900,
171
- success: _decorativePalettes.green.foreground,
172
- warning: _decorativePalettes.yellow.foreground,
173
- error: _decorativePalettes.red.foreground,
174
- danger: _decorativePalettes.red.foreground,
175
- info: _decorativePalettes.blue.foreground,
176
- opportunity: _decorativePalettes.purple.foreground
177
- },
178
- form: {
179
- background: {
180
- base: _seedsColor.default.COLOR_NEUTRAL_900,
181
- selected: _seedsColor.default.COLOR_NEUTRAL_0
182
- },
183
- border: {
184
- base: _seedsColor.default.COLOR_NEUTRAL_500,
185
- error: _decorativePalettes.red.highlight,
186
- warning: _decorativePalettes.yellow.highlight,
187
- selected: _seedsColor.default.COLOR_NEUTRAL_0
188
191
  },
189
- placeholder: {
190
- base: _seedsColor.default.COLOR_NEUTRAL_500
191
- }
192
- },
193
- listItem: {
194
- background: {
195
- base: "transparent",
196
- hover: _seedsColor.default.COLOR_NEUTRAL_800,
197
- selected: _seedsColor.default.COLOR_NEUTRAL_0
192
+ dataviz: {
193
+ map: _datavizPalette.datavizPalette.DATAVIZ_COLORS_MAP,
194
+ list: _datavizPalette.datavizPalette.DATAVIZ_COLORS_LIST
198
195
  }
199
- },
200
- elevation: {
201
- base: _seedsColor.default.COLOR_NEUTRAL_1100
202
- },
203
- dataviz: {
204
- map: _datavizPalette.datavizPalette.DATAVIZ_COLORS_MAP,
205
- list: _datavizPalette.datavizPalette.DATAVIZ_COLORS_LIST
206
- }
207
- }, _datavizPalette.datavizPalette);
208
-
209
- var darkTheme = _extends({}, _theme.default, {
210
- colors: colors,
211
- shadows: shadows,
196
+ }, _datavizPalette.datavizPalette),
212
197
  mode: "dark"
213
198
  });
214
199
 
@@ -203,9 +203,6 @@ var colors = _extends({
203
203
  selected: _seedsColor.default.COLOR_NEUTRAL_800
204
204
  }
205
205
  },
206
- elevation: {
207
- base: _seedsColor.default.COLOR_NEUTRAL_900 + "3D"
208
- },
209
206
  network: {
210
207
  twitter: _seedsNetworkcolor.default.NETWORK_COLOR_TWITTER,
211
208
  twitter_like: _seedsNetworkcolor.default.NETWORK_COLOR_TWITTER_LIKE,
@@ -294,9 +291,10 @@ var borderWidths = {
294
291
  };
295
292
  exports.borderWidths = borderWidths;
296
293
  var shadows = {
297
- low: _seedsDepth.default.ELEVATION_LEVEL_100 + " " + _seedsColor.default.COLOR_NEUTRAL_900 + "3D",
298
- medium: _seedsDepth.default.ELEVATION_LEVEL_300 + " " + _seedsColor.default.COLOR_NEUTRAL_900 + "3D",
299
- high: _seedsDepth.default.ELEVATION_LEVEL_400 + " " + _seedsColor.default.COLOR_NEUTRAL_900 + "3D"
294
+ "100": _seedsDepth.default.ELEVATION_LEVEL_100,
295
+ "200": _seedsDepth.default.ELEVATION_LEVEL_200,
296
+ "300": _seedsDepth.default.ELEVATION_LEVEL_300,
297
+ "400": _seedsDepth.default.ELEVATION_LEVEL_400
300
298
  };
301
299
  exports.shadows = shadows;
302
300
  var easing = {
@@ -332,7 +330,9 @@ var theme = {
332
330
  }),
333
331
  borders: borders,
334
332
  borderWidths: borderWidths,
335
- shadows: shadows,
333
+ shadows: _extends({}, shadows, {
334
+ shadows: shadows
335
+ }),
336
336
  easing: easing,
337
337
  duration: duration
338
338
  };
@@ -0,0 +1,140 @@
1
+ // Inspired by https://medium.com/@katiemctigue/how-to-create-a-dark-mode-in-sass-609f131a3995
2
+ // This file is excluded from stylelint, because stylelint is only set up to lint styled-components at the moment.
3
+
4
+ // SET-UP
5
+ // These files are auto-generated based on JS theme files, ensuring our SCSS theme variables stay in sync.
6
+ @import "dist/themes/default.scss";
7
+ @import "dist/themes/dark.scss";
8
+
9
+ // In the JS theme files, the theme object is exported as "default" (i.e., using "export default"),
10
+ // so we need to map-get "default" to access it.
11
+ $themes: (
12
+ default: map-get($default, "default"),
13
+ dark: map-get($dark, "default")
14
+ );
15
+
16
+ // MIXIN
17
+ // CSS properties that are theme-dependent must be wrapped in this mixin
18
+ @mixin themed() {
19
+ @each $theme, $map in $themes {
20
+ // ~ selects siblings to the specified selector, * selects all children of those siblings,
21
+ // which makes ~ * a kind of nephew selector. Thus we can target all elements on the page even if they are
22
+ // not a direct descendent of the element that we apply the theme classname to.
23
+ // This is important for pop-ups and modals, since they are often mounted directly to the body.
24
+ .theme--#{$theme} ~ * & {
25
+ $theme-map: () !global;
26
+ @each $key, $submap in $map {
27
+ $value: map-get(map-get($themes, $theme), "#{$key}");
28
+ $theme-map: map-merge($theme-map, ($key: $value)) !global;
29
+ }
30
+ @content;
31
+ $theme-map: null !global;
32
+ }
33
+ }
34
+ }
35
+
36
+ // FUNCTIONS
37
+ // This function will allow you to get any value from the theme.
38
+ // @param {string} $key - the period-separated path to the value in the theme object. e.g., "colors.text.body"
39
+ @function t($key) {
40
+ $keys: _string-split($key, ".");
41
+ @return _map-deep-get($theme-map, $keys);
42
+ }
43
+
44
+ // These functions are convenience methods to get theme values for subsets of the theme.
45
+ // @param {string} $key - the period-separated path to the value in the theme object, with "colors." omitted. e.g., "text.body"
46
+ @function colors($key) {
47
+ $keys: _string-split($key, ".");
48
+ @return _map-deep-get($theme-map, join("colors", $keys));
49
+ }
50
+
51
+ // @param {string} $key - the period-separated path to the value in the theme object, with "typography." omitted. e.g., "100.fontSize"
52
+ @function typography($key) {
53
+ $keys: _string-split($key, ".");
54
+ @return _map-deep-get($theme-map, join("typography", $keys));
55
+ }
56
+
57
+ // @param {string} $key - the period-separated path to the value in the theme object, with "fontWeights." omitted. e.g., "normal"
58
+ @function fontWeights($key) {
59
+ $keys: _string-split($key, ".");
60
+ @return _map-deep-get($theme-map, join("fontWeights", $keys));
61
+ }
62
+
63
+ // @param {string} $key - the period-separated path to the value in the theme object, with "space." omitted. e.g., "100"
64
+ @function space($key) {
65
+ $keys: _string-split($key, ".");
66
+ @return _map-deep-get($theme-map, join("space", $keys));
67
+ }
68
+
69
+ // @param {string} $key - the period-separated path to the value in the theme object, with "radii." omitted. e.g., "inner"
70
+ @function radii($key) {
71
+ $keys: _string-split($key, ".");
72
+ @return _map-deep-get($theme-map, join("radii", $keys));
73
+ }
74
+
75
+ // @param {string} $key - the period-separated path to the value in the theme object, with "borders." omitted. e.g., "500"
76
+ @function borders($key) {
77
+ $keys: _string-split($key, ".");
78
+ @return _map-deep-get($theme-map, join("borders", $keys));
79
+ }
80
+
81
+ // @param {string} $key - the period-separated path to the value in the theme object, with "borderWidths." omitted. e.g., "500"
82
+ @function borderWidths($key) {
83
+ $keys: _string-split($key, ".");
84
+ @return _map-deep-get($theme-map, join("borderWidths", $keys));
85
+ }
86
+
87
+ // @param {string} $key - the period-separated path to the value in the theme object, with "shadows." omitted. e.g., "low"
88
+ @function shadows($key) {
89
+ $keys: _string-split($key, ".");
90
+ @return _map-deep-get($theme-map, join("shadows", $keys));
91
+ }
92
+
93
+ // @param {string} $key - the period-separated path to the value in the theme object, with "easing." omitted. e.g., "ease_in"
94
+ @function easing($key) {
95
+ $keys: _string-split($key, ".");
96
+ @return _map-deep-get($theme-map, join("easing", $keys));
97
+ }
98
+
99
+ // @param {string} $key - the period-separated path to the value in the theme object, with "duration." omitted. e.g., "fast"
100
+ @function duration($key) {
101
+ $keys: _string-split($key, ".");
102
+ @return _map-deep-get($theme-map, join("duration", $keys));
103
+ }
104
+
105
+ // UTILITIES
106
+ // Helper functions that power the functions above. Not relevant to the theme.
107
+ // If you import this file with @use, they will not be included.
108
+
109
+ // Via https://stackoverflow.com/a/42295154
110
+ // Only works with a single-character separator
111
+ @function _string-split($string, $separator) {
112
+ // empty array/list
113
+ $split-arr: ();
114
+ // first index of separator in string
115
+ $index : str-index($string, $separator);
116
+ // loop through string
117
+ @while $index != null {
118
+ // get the substring from the first character to the separator
119
+ $item: str-slice($string, 1, $index - 1);
120
+ // push item to array
121
+ $split-arr: append($split-arr, $item);
122
+ // remove item and separator from string
123
+ $string: str-slice($string, $index + 1);
124
+ // find new index of separator
125
+ $index : str-index($string, $separator);
126
+ }
127
+ // add the remaining string to list (the last item)
128
+ $split-arr: append($split-arr, $string);
129
+
130
+ @return $split-arr;
131
+ }
132
+
133
+ // Adapted from https://css-tricks.com/snippets/sass/deep-getset-maps/
134
+ // Iterates over a list of keys to read multi-level maps
135
+ @function _map-deep-get($map, $keys) {
136
+ @each $key in $keys {
137
+ $map: map-get($map, $key);
138
+ }
139
+ @return $map;
140
+ }
@@ -1,10 +1,5 @@
1
1
  $dark: (
2
2
  __esModule: true,
3
- shadows: (
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
- ),
8
3
  default: (
9
4
  breakpoints: (900px, 1200px, 1500px, 1800px),
10
5
  colors: (
@@ -180,9 +175,6 @@ $dark: (
180
175
  selected: #FFFFFF
181
176
  )
182
177
  ),
183
- elevation: (
184
- base: #040404
185
- ),
186
178
  network: (
187
179
  twitter: #1da1f2,
188
180
  twitter_like: #e0245e,
@@ -576,9 +568,16 @@ $dark: (
576
568
  500: 1px
577
569
  ),
578
570
  shadows: (
579
- low: 0px 2px 4px rgba(39,51,51,.24) #040404FF,
580
- medium: 0px 8px 16px rgba(39,51,51,.24) #040404FF,
581
- high: 0px 16px 32px rgba(39,51,51,.24) #040404FF
571
+ 100: 0px 2px 4px rgba(39,51,51,.24),
572
+ 200: 0px 4px 8px rgba(39,51,51,.24),
573
+ 300: 0px 8px 16px rgba(39,51,51,.24),
574
+ 400: 0px 16px 32px rgba(39,51,51,.24),
575
+ shadows: (
576
+ 100: 0px 2px 4px rgba(39,51,51,.24),
577
+ 200: 0px 4px 8px rgba(39,51,51,.24),
578
+ 300: 0px 8px 16px rgba(39,51,51,.24),
579
+ 400: 0px 16px 32px rgba(39,51,51,.24)
580
+ )
582
581
  ),
583
582
  easing: (
584
583
  ease_in: cubic-bezier(.4, 0, .7, .2),