@sproutsocial/racine 9.1.0-token-beta.0 → 9.1.1-theme-extension.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 (64) hide show
  1. package/CHANGELOG.md +0 -28
  2. package/__flow__/Breadcrumb/styles.js +5 -0
  3. package/__flow__/Button/styles.js +1 -1
  4. package/__flow__/Card/index.stories.js +1 -0
  5. package/__flow__/Card/styles.js +1 -1
  6. package/__flow__/CustomThemeProvider/index.js +16 -0
  7. package/__flow__/Drawer/index.stories.js +3 -3
  8. package/__flow__/Drawer/styles.js +1 -1
  9. package/__flow__/KeyboardKey/styles.js +1 -1
  10. package/__flow__/Menu/index.stories.js +1 -1
  11. package/__flow__/Modal/__snapshots__/index.test.js.snap +1 -1
  12. package/__flow__/Modal/styles.js +1 -1
  13. package/__flow__/Popout/index.js +1 -1
  14. package/__flow__/ThemeProvider/index.js +2 -2
  15. package/__flow__/Token/index.js +1 -4
  16. package/__flow__/Token/index.stories.js +0 -11
  17. package/__flow__/Token/styles.js +33 -43
  18. package/__flow__/Tooltip/index.js +1 -1
  19. package/__flow__/index.js +1 -0
  20. package/__flow__/themes/dark/theme.js +156 -180
  21. package/__flow__/themes/default/theme.js +8 -19
  22. package/__flow__/themes/sprout/theme.js +22 -0
  23. package/__flow__/types/system-props.flow.js +2 -1
  24. package/__flow__/utils/extendTheme.js +17 -0
  25. package/commonjs/Breadcrumb/styles.js +1 -1
  26. package/commonjs/Button/styles.js +1 -1
  27. package/commonjs/Card/styles.js +1 -1
  28. package/commonjs/CustomThemeProvider/index.js +23 -0
  29. package/commonjs/Drawer/styles.js +1 -1
  30. package/commonjs/KeyboardKey/styles.js +1 -1
  31. package/commonjs/Modal/styles.js +1 -1
  32. package/commonjs/Popout/index.js +1 -1
  33. package/commonjs/Token/index.js +2 -5
  34. package/commonjs/Token/styles.js +50 -19
  35. package/commonjs/Tooltip/index.js +1 -1
  36. package/commonjs/index.js +5 -1
  37. package/commonjs/themes/dark/theme.js +154 -179
  38. package/commonjs/themes/default/theme.js +8 -19
  39. package/commonjs/themes/sprout/theme.js +29 -0
  40. package/commonjs/utils/extendTheme.js +22 -0
  41. package/lib/Breadcrumb/styles.js +1 -1
  42. package/lib/Button/styles.js +1 -1
  43. package/lib/Card/styles.js +1 -1
  44. package/lib/CustomThemeProvider/index.js +12 -0
  45. package/lib/Drawer/styles.js +1 -1
  46. package/lib/KeyboardKey/styles.js +1 -1
  47. package/lib/Modal/styles.js +1 -1
  48. package/lib/Popout/index.js +1 -1
  49. package/lib/Token/index.js +2 -5
  50. package/lib/Token/styles.js +50 -19
  51. package/lib/Tooltip/index.js +1 -1
  52. package/lib/index.js +1 -0
  53. package/lib/themes/dark/theme.js +153 -174
  54. package/lib/themes/default/theme.js +8 -18
  55. package/lib/themes/sprout/theme.js +19 -0
  56. package/lib/utils/extendTheme.js +12 -0
  57. package/package.json +9 -6
  58. package/__flow__/themes/_themes.scss +0 -138
  59. package/__flow__/themes/utils/interact.js +0 -12
  60. package/commonjs/themes/utils/interact.js +0 -19
  61. package/dist/themes/_themes.scss +0 -138
  62. package/dist/themes/dark.scss +0 -601
  63. package/dist/themes/default.scss +0 -692
  64. package/lib/themes/utils/interact.js +0 -13
@@ -1,138 +0,0 @@
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
- light: 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
- .theme--#{$theme} & {
21
- $theme-map: () !global;
22
- @each $key, $submap in $map {
23
- $value: map-get(map-get($themes, $theme), "#{$key}");
24
- $theme-map: map-merge($theme-map, ($key: $value)) !global;
25
- }
26
- @content;
27
- $theme-map: null !global;
28
- }
29
- }
30
- }
31
-
32
- // FUNCTIONS
33
- // This function will allow you to get any value from the theme.
34
- // @param {string} $key - the period-separated path to the value in the theme object. e.g., "colors.text.body"
35
- @function t($key) {
36
- $keys: _str-split($key, ".");
37
- @return _map-deep-get($theme-map, $keys);
38
- }
39
-
40
- // The rest of the functions are convenience methods to get theme values for subsets of the theme.
41
- // @param {string} $key - the period-separated path to the value in the theme object, with "colors." omitted. e.g., "text.body"
42
- @function colors($key) {
43
- $keys: _str-split($key, ".");
44
- @return _map-deep-get($theme-map, join("colors", $keys));
45
- }
46
-
47
- // @param {string} $key - the period-separated path to the value in the theme object, with "typography." omitted. e.g., "100.fontSize"
48
- @function typography($key) {
49
- $keys: _str-split($key, ".");
50
- @return _map-deep-get($theme-map, join("typography", $keys));
51
- }
52
-
53
- // @param {string} $key - the period-separated path to the value in the theme object, with "fontWeights." omitted. e.g., "normal"
54
- @function fontWeights($key) {
55
- $keys: _str-split($key, ".");
56
- @return _map-deep-get($theme-map, join("fontWeights", $keys));
57
- }
58
-
59
- // @param {string} $key - the period-separated path to the value in the theme object, with "space." omitted. e.g., "100"
60
- @function space($key) {
61
- $keys: _str-split($key, ".");
62
- @return _map-deep-get($theme-map, join("space", $keys));
63
- }
64
-
65
- // @param {string} $key - the period-separated path to the value in the theme object, with "radii." omitted. e.g., "inner"
66
- @function radii($key) {
67
- $keys: _str-split($key, ".");
68
- @return _map-deep-get($theme-map, join("radii", $keys));
69
- }
70
-
71
- // @param {string} $key - the period-separated path to the value in the theme object, with "borders." omitted. e.g., "500"
72
- @function borders($key) {
73
- $keys: _str-split($key, ".");
74
- @return _map-deep-get($theme-map, join("borders", $keys));
75
- }
76
-
77
- // @param {string} $key - the period-separated path to the value in the theme object, with "borderWidths." omitted. e.g., "500"
78
- @function borderWidths($key) {
79
- $keys: _str-split($key, ".");
80
- @return _map-deep-get($theme-map, join("borderWidths", $keys));
81
- }
82
-
83
- // @param {string} $key - the period-separated path to the value in the theme object, with "shadows." omitted. e.g., "low"
84
- @function shadows($key) {
85
- $keys: _str-split($key, ".");
86
- @return _map-deep-get($theme-map, join("shadows", $keys));
87
- }
88
-
89
- // @param {string} $key - the period-separated path to the value in the theme object, with "easing." omitted. e.g., "ease_in"
90
- @function easing($key) {
91
- $keys: _str-split($key, ".");
92
- @return _map-deep-get($theme-map, join("easing", $keys));
93
- }
94
-
95
- // @param {string} $key - the period-separated path to the value in the theme object, with "duration." omitted. e.g., "fast"
96
- @function duration($key) {
97
- $keys: _str-split($key, ".");
98
- @return _map-deep-get($theme-map, join("duration", $keys));
99
- }
100
-
101
- // UTILITIES
102
- // Helper functions that power the functions above. Not relevant to the theme.
103
- // If you import this file with @use, these functions will be excluded because they are private.
104
-
105
- // Via https://stackoverflow.com/a/42295154
106
- // Used to split period-separated object keys, e.g. "colors.text.body" => ["colors", "text", "body"]
107
- // Only works with a single-character separator.
108
- @function _str-split($string, $separator) {
109
- // empty array/list
110
- $split-arr: ();
111
- // first index of separator in string
112
- $index : str-index($string, $separator);
113
- // loop through string
114
- @while $index != null {
115
- // get the substring from the first character to the separator
116
- $item: str-slice($string, 1, $index - 1);
117
- // push item to array
118
- $split-arr: append($split-arr, $item);
119
- // remove item and separator from string
120
- $string: str-slice($string, $index + 1);
121
- // find new index of separator
122
- $index : str-index($string, $separator);
123
- }
124
- // add the remaining string to list (the last item)
125
- $split-arr: append($split-arr, $string);
126
-
127
- @return $split-arr;
128
- }
129
-
130
- // Adapted from https://css-tricks.com/snippets/sass/deep-getset-maps/
131
- // Iterates over a list of keys to read multi-level maps.
132
- // e.g., _map-deep-get((colors: (text: (body: "#364141"))), ["colors", "text", "body"]) => "#364141"
133
- @function _map-deep-get($map, $keys) {
134
- @each $key in $keys {
135
- $map: map-get($map, $key);
136
- }
137
- @return $map;
138
- }
@@ -1,12 +0,0 @@
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;
@@ -1,19 +0,0 @@
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;
@@ -1,138 +0,0 @@
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
- light: 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
- .theme--#{$theme} & {
21
- $theme-map: () !global;
22
- @each $key, $submap in $map {
23
- $value: map-get(map-get($themes, $theme), "#{$key}");
24
- $theme-map: map-merge($theme-map, ($key: $value)) !global;
25
- }
26
- @content;
27
- $theme-map: null !global;
28
- }
29
- }
30
- }
31
-
32
- // FUNCTIONS
33
- // This function will allow you to get any value from the theme.
34
- // @param {string} $key - the period-separated path to the value in the theme object. e.g., "colors.text.body"
35
- @function t($key) {
36
- $keys: _str-split($key, ".");
37
- @return _map-deep-get($theme-map, $keys);
38
- }
39
-
40
- // The rest of the functions are convenience methods to get theme values for subsets of the theme.
41
- // @param {string} $key - the period-separated path to the value in the theme object, with "colors." omitted. e.g., "text.body"
42
- @function colors($key) {
43
- $keys: _str-split($key, ".");
44
- @return _map-deep-get($theme-map, join("colors", $keys));
45
- }
46
-
47
- // @param {string} $key - the period-separated path to the value in the theme object, with "typography." omitted. e.g., "100.fontSize"
48
- @function typography($key) {
49
- $keys: _str-split($key, ".");
50
- @return _map-deep-get($theme-map, join("typography", $keys));
51
- }
52
-
53
- // @param {string} $key - the period-separated path to the value in the theme object, with "fontWeights." omitted. e.g., "normal"
54
- @function fontWeights($key) {
55
- $keys: _str-split($key, ".");
56
- @return _map-deep-get($theme-map, join("fontWeights", $keys));
57
- }
58
-
59
- // @param {string} $key - the period-separated path to the value in the theme object, with "space." omitted. e.g., "100"
60
- @function space($key) {
61
- $keys: _str-split($key, ".");
62
- @return _map-deep-get($theme-map, join("space", $keys));
63
- }
64
-
65
- // @param {string} $key - the period-separated path to the value in the theme object, with "radii." omitted. e.g., "inner"
66
- @function radii($key) {
67
- $keys: _str-split($key, ".");
68
- @return _map-deep-get($theme-map, join("radii", $keys));
69
- }
70
-
71
- // @param {string} $key - the period-separated path to the value in the theme object, with "borders." omitted. e.g., "500"
72
- @function borders($key) {
73
- $keys: _str-split($key, ".");
74
- @return _map-deep-get($theme-map, join("borders", $keys));
75
- }
76
-
77
- // @param {string} $key - the period-separated path to the value in the theme object, with "borderWidths." omitted. e.g., "500"
78
- @function borderWidths($key) {
79
- $keys: _str-split($key, ".");
80
- @return _map-deep-get($theme-map, join("borderWidths", $keys));
81
- }
82
-
83
- // @param {string} $key - the period-separated path to the value in the theme object, with "shadows." omitted. e.g., "low"
84
- @function shadows($key) {
85
- $keys: _str-split($key, ".");
86
- @return _map-deep-get($theme-map, join("shadows", $keys));
87
- }
88
-
89
- // @param {string} $key - the period-separated path to the value in the theme object, with "easing." omitted. e.g., "ease_in"
90
- @function easing($key) {
91
- $keys: _str-split($key, ".");
92
- @return _map-deep-get($theme-map, join("easing", $keys));
93
- }
94
-
95
- // @param {string} $key - the period-separated path to the value in the theme object, with "duration." omitted. e.g., "fast"
96
- @function duration($key) {
97
- $keys: _str-split($key, ".");
98
- @return _map-deep-get($theme-map, join("duration", $keys));
99
- }
100
-
101
- // UTILITIES
102
- // Helper functions that power the functions above. Not relevant to the theme.
103
- // If you import this file with @use, these functions will be excluded because they are private.
104
-
105
- // Via https://stackoverflow.com/a/42295154
106
- // Used to split period-separated object keys, e.g. "colors.text.body" => ["colors", "text", "body"]
107
- // Only works with a single-character separator.
108
- @function _str-split($string, $separator) {
109
- // empty array/list
110
- $split-arr: ();
111
- // first index of separator in string
112
- $index : str-index($string, $separator);
113
- // loop through string
114
- @while $index != null {
115
- // get the substring from the first character to the separator
116
- $item: str-slice($string, 1, $index - 1);
117
- // push item to array
118
- $split-arr: append($split-arr, $item);
119
- // remove item and separator from string
120
- $string: str-slice($string, $index + 1);
121
- // find new index of separator
122
- $index : str-index($string, $separator);
123
- }
124
- // add the remaining string to list (the last item)
125
- $split-arr: append($split-arr, $string);
126
-
127
- @return $split-arr;
128
- }
129
-
130
- // Adapted from https://css-tricks.com/snippets/sass/deep-getset-maps/
131
- // Iterates over a list of keys to read multi-level maps.
132
- // e.g., _map-deep-get((colors: (text: (body: "#364141"))), ["colors", "text", "body"]) => "#364141"
133
- @function _map-deep-get($map, $keys) {
134
- @each $key in $keys {
135
- $map: map-get($map, $key);
136
- }
137
- @return $map;
138
- }