@sproutsocial/racine 10.0.3-menuhotfix.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__/Listbox/__snapshots__/index.test.js.snap +2 -0
- package/__flow__/Menu/__snapshots__/index.test.js.snap +1 -0
- package/__flow__/Menu/index.js +1 -1
- package/__flow__/themes/dark/_themed.scss +14 -29
- package/__flow__/themes/light/_themed.scss +14 -29
- package/commonjs/Menu/index.js +1 -0
- package/dist/themes/dark/_themed.scss +14 -29
- package/dist/themes/light/_themed.scss +14 -29
- package/lib/Menu/index.js +1 -0
- package/package.json +1 -1
|
@@ -388,6 +388,7 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
|
|
|
388
388
|
.c2 {
|
|
389
389
|
box-sizing: border-box;
|
|
390
390
|
font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
|
391
|
+
margin: 8px;
|
|
391
392
|
padding: 8px;
|
|
392
393
|
}
|
|
393
394
|
|
|
@@ -685,6 +686,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
685
686
|
.c2 {
|
|
686
687
|
box-sizing: border-box;
|
|
687
688
|
font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
|
689
|
+
margin: 8px;
|
|
688
690
|
padding: 8px;
|
|
689
691
|
}
|
|
690
692
|
|
|
@@ -22,6 +22,7 @@ exports[`Menu AsMenu should match snapshot 1`] = `
|
|
|
22
22
|
.c4 {
|
|
23
23
|
box-sizing: border-box;
|
|
24
24
|
font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
|
25
|
+
margin: 8px;
|
|
25
26
|
padding: 8px;
|
|
26
27
|
}
|
|
27
28
|
|
package/__flow__/Menu/index.js
CHANGED
|
@@ -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/commonjs/Menu/index.js
CHANGED
|
@@ -278,6 +278,7 @@ var MenuGroup = function MenuGroup(_ref2) {
|
|
|
278
278
|
color: "text.headline",
|
|
279
279
|
_css: isDisabled && _mixins.disabled
|
|
280
280
|
}, title)), /*#__PURE__*/React.createElement(_Box.default, _extends({}, props, {
|
|
281
|
+
m: 300,
|
|
281
282
|
p: 300,
|
|
282
283
|
role: "group"
|
|
283
284
|
}), children));
|
|
@@ -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/lib/Menu/index.js
CHANGED