@sproutsocial/racine 9.0.0 → 9.0.1
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/CHANGELOG.md +8 -0
- package/__flow__/Listbox/__snapshots__/index.test.js.snap +40 -34
- package/__flow__/Menu/__snapshots__/index.test.js.snap +15 -12
- package/__flow__/Menu/index.js +3 -7
- package/__flow__/Menu/styles.js +1 -18
- package/__flow__/Modal/index.test.js +0 -16
- 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/Menu/index.js +3 -1
- package/commonjs/Menu/styles.js +3 -16
- 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 +7 -1
- package/dist/themes/default.scss +5 -1
- package/lib/Menu/index.js +4 -2
- package/lib/Menu/styles.js +2 -13
- 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 +2 -2
- package/__flow__/Modal/__snapshots__/index.test.js.snap +0 -80
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 52052ae: Update MenuGroupContainer so that it takes system props instead of css styling
|
|
8
|
+
- 2fc4f88: Adds a `palette` prop to Token and uses the proper accessible color tokens
|
|
9
|
+
- 7a87944: Update @storybook/react to resolve a vulnerability in one of its sub-dependencies (immer)
|
|
10
|
+
|
|
3
11
|
## 9.0.0
|
|
4
12
|
|
|
5
13
|
### Major Changes
|
|
@@ -388,6 +388,13 @@ 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;
|
|
392
|
+
padding: 8px;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.c3 {
|
|
396
|
+
box-sizing: border-box;
|
|
397
|
+
font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
|
391
398
|
}
|
|
392
399
|
|
|
393
400
|
.c6 {
|
|
@@ -460,10 +467,6 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
|
|
|
460
467
|
cursor: pointer;
|
|
461
468
|
}
|
|
462
469
|
|
|
463
|
-
.c3 {
|
|
464
|
-
padding: 8px;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
470
|
.c1 {
|
|
468
471
|
list-style-type: none;
|
|
469
472
|
outline: 0;
|
|
@@ -558,12 +561,12 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
|
|
|
558
561
|
width="200px"
|
|
559
562
|
>
|
|
560
563
|
<div
|
|
561
|
-
class="c2
|
|
564
|
+
class="c2"
|
|
562
565
|
role="group"
|
|
563
566
|
>
|
|
564
567
|
<li
|
|
565
568
|
aria-checked="false"
|
|
566
|
-
class="
|
|
569
|
+
class="c3 c4"
|
|
567
570
|
data-qa-menu-item="Apple"
|
|
568
571
|
data-value="Apple"
|
|
569
572
|
id="MenuItem-28"
|
|
@@ -597,7 +600,7 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
|
|
|
597
600
|
</li>
|
|
598
601
|
<li
|
|
599
602
|
aria-checked="false"
|
|
600
|
-
class="
|
|
603
|
+
class="c3 c6"
|
|
601
604
|
data-qa-menu-item="Banana"
|
|
602
605
|
data-value="Banana"
|
|
603
606
|
id="MenuItem-29"
|
|
@@ -631,7 +634,7 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
|
|
|
631
634
|
</li>
|
|
632
635
|
<li
|
|
633
636
|
aria-checked="false"
|
|
634
|
-
class="
|
|
637
|
+
class="c3 c6"
|
|
635
638
|
data-qa-menu-item="Orange"
|
|
636
639
|
data-value="Orange"
|
|
637
640
|
id="MenuItem-30"
|
|
@@ -683,6 +686,13 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
683
686
|
.c2 {
|
|
684
687
|
box-sizing: border-box;
|
|
685
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;
|
|
690
|
+
padding: 8px;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
.c4 {
|
|
694
|
+
box-sizing: border-box;
|
|
695
|
+
font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
|
686
696
|
}
|
|
687
697
|
|
|
688
698
|
.c7 {
|
|
@@ -755,10 +765,6 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
755
765
|
cursor: pointer;
|
|
756
766
|
}
|
|
757
767
|
|
|
758
|
-
.c3 {
|
|
759
|
-
padding: 8px;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
768
|
.c1 {
|
|
763
769
|
list-style-type: none;
|
|
764
770
|
outline: 0;
|
|
@@ -780,12 +786,12 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
780
786
|
margin-right: 8px;
|
|
781
787
|
}
|
|
782
788
|
|
|
783
|
-
.
|
|
789
|
+
.c3 {
|
|
784
790
|
box-sizing: border-box;
|
|
785
791
|
position: relative;
|
|
786
792
|
}
|
|
787
793
|
|
|
788
|
-
.
|
|
794
|
+
.c3 input {
|
|
789
795
|
box-sizing: border-box;
|
|
790
796
|
width: 100%;
|
|
791
797
|
border: 1px solid transparent;
|
|
@@ -806,34 +812,34 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
806
812
|
font-size: 13px;
|
|
807
813
|
}
|
|
808
814
|
|
|
809
|
-
.
|
|
815
|
+
.c3 input::-ms-clear {
|
|
810
816
|
display: none;
|
|
811
817
|
}
|
|
812
818
|
|
|
813
|
-
.
|
|
819
|
+
.c3 input::-webkit-search-cancel-button {
|
|
814
820
|
-webkit-appearance: none;
|
|
815
821
|
-moz-appearance: none;
|
|
816
822
|
appearance: none;
|
|
817
823
|
}
|
|
818
824
|
|
|
819
|
-
.
|
|
825
|
+
.c3 input:focus {
|
|
820
826
|
box-shadow: 0 0 0 1px #2079c3,0 0px 0px 4px rgba(32,121,195,0.3);
|
|
821
827
|
outline: none;
|
|
822
828
|
}
|
|
823
829
|
|
|
824
|
-
.
|
|
830
|
+
.c3 input:focus::-moz-focus-inner {
|
|
825
831
|
border: 0;
|
|
826
832
|
}
|
|
827
833
|
|
|
828
|
-
.
|
|
834
|
+
.c3 input:not(output):not(:focus):-moz-ui-invalid {
|
|
829
835
|
box-shadow: none;
|
|
830
836
|
}
|
|
831
837
|
|
|
832
|
-
.
|
|
838
|
+
.c3 input:placeholder {
|
|
833
839
|
color: #6e797a;
|
|
834
840
|
}
|
|
835
841
|
|
|
836
|
-
.
|
|
842
|
+
.c3 input {
|
|
837
843
|
border: 1px solid #b0b6b7;
|
|
838
844
|
}
|
|
839
845
|
|
|
@@ -910,11 +916,11 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
910
916
|
width="200px"
|
|
911
917
|
>
|
|
912
918
|
<div
|
|
913
|
-
class="c2
|
|
919
|
+
class="c2"
|
|
914
920
|
role="group"
|
|
915
921
|
>
|
|
916
922
|
<div
|
|
917
|
-
class="
|
|
923
|
+
class="c3"
|
|
918
924
|
>
|
|
919
925
|
<input
|
|
920
926
|
aria-invalid="false"
|
|
@@ -931,7 +937,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
931
937
|
</div>
|
|
932
938
|
<li
|
|
933
939
|
aria-checked="false"
|
|
934
|
-
class="
|
|
940
|
+
class="c4 c5"
|
|
935
941
|
data-qa-menu-item="Apple"
|
|
936
942
|
data-value="Apple"
|
|
937
943
|
id="MenuItem-34"
|
|
@@ -965,7 +971,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
965
971
|
</li>
|
|
966
972
|
<li
|
|
967
973
|
aria-checked="false"
|
|
968
|
-
class="
|
|
974
|
+
class="c4 c7"
|
|
969
975
|
data-qa-menu-item="Banana"
|
|
970
976
|
data-value="Banana"
|
|
971
977
|
id="MenuItem-35"
|
|
@@ -999,7 +1005,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
999
1005
|
</li>
|
|
1000
1006
|
<li
|
|
1001
1007
|
aria-checked="false"
|
|
1002
|
-
class="
|
|
1008
|
+
class="c4 c7"
|
|
1003
1009
|
data-qa-menu-item="Orange"
|
|
1004
1010
|
data-value="Orange"
|
|
1005
1011
|
id="MenuItem-36"
|
|
@@ -1033,7 +1039,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
1033
1039
|
</li>
|
|
1034
1040
|
<li
|
|
1035
1041
|
aria-checked="false"
|
|
1036
|
-
class="
|
|
1042
|
+
class="c4 c7"
|
|
1037
1043
|
data-qa-menu-item="Tomato"
|
|
1038
1044
|
data-value="Tomato"
|
|
1039
1045
|
id="MenuItem-37"
|
|
@@ -1067,7 +1073,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
1067
1073
|
</li>
|
|
1068
1074
|
<li
|
|
1069
1075
|
aria-checked="false"
|
|
1070
|
-
class="
|
|
1076
|
+
class="c4 c7"
|
|
1071
1077
|
data-qa-menu-item="Cucumber"
|
|
1072
1078
|
data-value="Cucumber"
|
|
1073
1079
|
id="MenuItem-38"
|
|
@@ -1101,7 +1107,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
1101
1107
|
</li>
|
|
1102
1108
|
<li
|
|
1103
1109
|
aria-checked="false"
|
|
1104
|
-
class="
|
|
1110
|
+
class="c4 c7"
|
|
1105
1111
|
data-qa-menu-item="Squash"
|
|
1106
1112
|
data-value="Squash"
|
|
1107
1113
|
id="MenuItem-39"
|
|
@@ -1135,7 +1141,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
1135
1141
|
</li>
|
|
1136
1142
|
<li
|
|
1137
1143
|
aria-checked="false"
|
|
1138
|
-
class="
|
|
1144
|
+
class="c4 c7"
|
|
1139
1145
|
data-qa-menu-item="Cantaloupe"
|
|
1140
1146
|
data-value="Cantaloupe"
|
|
1141
1147
|
id="MenuItem-40"
|
|
@@ -1169,7 +1175,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
1169
1175
|
</li>
|
|
1170
1176
|
<li
|
|
1171
1177
|
aria-checked="false"
|
|
1172
|
-
class="
|
|
1178
|
+
class="c4 c7"
|
|
1173
1179
|
data-qa-menu-item="Jackalope"
|
|
1174
1180
|
data-value="Jackalope"
|
|
1175
1181
|
id="MenuItem-41"
|
|
@@ -1203,7 +1209,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
1203
1209
|
</li>
|
|
1204
1210
|
<li
|
|
1205
1211
|
aria-checked="false"
|
|
1206
|
-
class="
|
|
1212
|
+
class="c4 c7"
|
|
1207
1213
|
data-qa-menu-item="Lingonberry"
|
|
1208
1214
|
data-value="Lingonberry"
|
|
1209
1215
|
id="MenuItem-42"
|
|
@@ -1237,7 +1243,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
1237
1243
|
</li>
|
|
1238
1244
|
<li
|
|
1239
1245
|
aria-checked="false"
|
|
1240
|
-
class="
|
|
1246
|
+
class="c4 c7"
|
|
1241
1247
|
data-qa-menu-item="Dingleberry"
|
|
1242
1248
|
data-value="Dingleberry"
|
|
1243
1249
|
id="MenuItem-43"
|
|
@@ -1271,7 +1277,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
|
|
|
1271
1277
|
</li>
|
|
1272
1278
|
<li
|
|
1273
1279
|
aria-checked="false"
|
|
1274
|
-
class="
|
|
1280
|
+
class="c4 c7"
|
|
1275
1281
|
data-qa-menu-item="Kaffir Lime"
|
|
1276
1282
|
data-value="Kaffir Lime"
|
|
1277
1283
|
id="MenuItem-44"
|
|
@@ -22,6 +22,13 @@ 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;
|
|
26
|
+
padding: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.c5 {
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
.c7 {
|
|
@@ -94,10 +101,6 @@ exports[`Menu AsMenu should match snapshot 1`] = `
|
|
|
94
101
|
cursor: pointer;
|
|
95
102
|
}
|
|
96
103
|
|
|
97
|
-
.c5 {
|
|
98
|
-
padding: 8px;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
104
|
.c1 {
|
|
102
105
|
list-style-type: none;
|
|
103
106
|
outline: 0;
|
|
@@ -138,11 +141,11 @@ exports[`Menu AsMenu should match snapshot 1`] = `
|
|
|
138
141
|
</div>
|
|
139
142
|
</div>
|
|
140
143
|
<div
|
|
141
|
-
class="c4
|
|
144
|
+
class="c4"
|
|
142
145
|
role="group"
|
|
143
146
|
>
|
|
144
147
|
<li
|
|
145
|
-
class="
|
|
148
|
+
class="c5 c6"
|
|
146
149
|
data-qa-menu-item="Apple"
|
|
147
150
|
id="MenuItem-1"
|
|
148
151
|
role="menuitem"
|
|
@@ -159,7 +162,7 @@ exports[`Menu AsMenu should match snapshot 1`] = `
|
|
|
159
162
|
</div>
|
|
160
163
|
</li>
|
|
161
164
|
<li
|
|
162
|
-
class="
|
|
165
|
+
class="c5 c7"
|
|
163
166
|
data-qa-menu-item="Banana"
|
|
164
167
|
id="MenuItem-2"
|
|
165
168
|
role="menuitem"
|
|
@@ -176,7 +179,7 @@ exports[`Menu AsMenu should match snapshot 1`] = `
|
|
|
176
179
|
</div>
|
|
177
180
|
</li>
|
|
178
181
|
<li
|
|
179
|
-
class="
|
|
182
|
+
class="c5 c7"
|
|
180
183
|
data-qa-menu-item="Orange"
|
|
181
184
|
id="MenuItem-3"
|
|
182
185
|
role="menuitem"
|
|
@@ -206,11 +209,11 @@ exports[`Menu AsMenu should match snapshot 1`] = `
|
|
|
206
209
|
</div>
|
|
207
210
|
</div>
|
|
208
211
|
<div
|
|
209
|
-
class="c4
|
|
212
|
+
class="c4"
|
|
210
213
|
role="group"
|
|
211
214
|
>
|
|
212
215
|
<li
|
|
213
|
-
class="
|
|
216
|
+
class="c5 c7"
|
|
214
217
|
data-qa-menu-item="Tomato"
|
|
215
218
|
id="MenuItem-4"
|
|
216
219
|
role="menuitem"
|
|
@@ -227,7 +230,7 @@ exports[`Menu AsMenu should match snapshot 1`] = `
|
|
|
227
230
|
</div>
|
|
228
231
|
</li>
|
|
229
232
|
<li
|
|
230
|
-
class="
|
|
233
|
+
class="c5 c7"
|
|
231
234
|
data-qa-menu-item="Cucumber"
|
|
232
235
|
id="MenuItem-5"
|
|
233
236
|
role="menuitem"
|
|
@@ -244,7 +247,7 @@ exports[`Menu AsMenu should match snapshot 1`] = `
|
|
|
244
247
|
</div>
|
|
245
248
|
</li>
|
|
246
249
|
<li
|
|
247
|
-
class="
|
|
250
|
+
class="c5 c7"
|
|
248
251
|
data-qa-menu-item="Squash"
|
|
249
252
|
id="MenuItem-6"
|
|
250
253
|
role="menuitem"
|
package/__flow__/Menu/index.js
CHANGED
|
@@ -10,11 +10,7 @@ import {
|
|
|
10
10
|
useState,
|
|
11
11
|
} from "react";
|
|
12
12
|
import uniqueId from "lodash.uniqueid";
|
|
13
|
-
import {
|
|
14
|
-
MenuGroupContainer,
|
|
15
|
-
MenuItemContainer,
|
|
16
|
-
MenuItemsContainer,
|
|
17
|
-
} from "./styles";
|
|
13
|
+
import { MenuItemContainer, MenuItemsContainer } from "./styles";
|
|
18
14
|
import { MENU_ITEM_ROLES, MENU_ROLES } from "./constants";
|
|
19
15
|
|
|
20
16
|
import Box from "../Box";
|
|
@@ -291,9 +287,9 @@ export const MenuGroup = ({
|
|
|
291
287
|
</Text>
|
|
292
288
|
</Box>
|
|
293
289
|
)}
|
|
294
|
-
<
|
|
290
|
+
<Box {...props} m={300} p={300} role="group">
|
|
295
291
|
{children}
|
|
296
|
-
</
|
|
292
|
+
</Box>
|
|
297
293
|
</>
|
|
298
294
|
);
|
|
299
295
|
|
package/__flow__/Menu/styles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import styled, { css } from "styled-components";
|
|
3
3
|
import Box from "../Box";
|
|
4
|
-
import type {
|
|
4
|
+
import type { TypeMenuItemProps } from "./index.flow";
|
|
5
5
|
import type { TypeTheme } from "../types/theme.flow";
|
|
6
6
|
import { disabled } from "../utils/mixins";
|
|
7
7
|
|
|
@@ -84,24 +84,7 @@ export const MenuItemContainer = styled<
|
|
|
84
84
|
${(props) => props.disabled && disabled}
|
|
85
85
|
`;
|
|
86
86
|
|
|
87
|
-
export const MenuGroupContainer = styled<
|
|
88
|
-
typeof Box,
|
|
89
|
-
TypeTheme,
|
|
90
|
-
TypeMenuGroupProps
|
|
91
|
-
>(Box)`
|
|
92
|
-
${(props) =>
|
|
93
|
-
props.appearance === "flush"
|
|
94
|
-
? css`
|
|
95
|
-
margin: 0 -${(props) => props.theme.space[300]};
|
|
96
|
-
`
|
|
97
|
-
: css`
|
|
98
|
-
padding: ${(props) => props.theme.space[300]};
|
|
99
|
-
`};
|
|
100
|
-
`;
|
|
101
|
-
|
|
102
87
|
export const MenuItemsContainer = styled<typeof Box, TypeTheme>(Box)`
|
|
103
88
|
list-style-type: none;
|
|
104
89
|
outline: 0;
|
|
105
90
|
`;
|
|
106
|
-
|
|
107
|
-
export default MenuGroupContainer;
|
|
@@ -7,22 +7,6 @@ import { COLOR_PURPLE_300 } from "@sproutsocial/seeds-color";
|
|
|
7
7
|
afterEach(() => cleanup());
|
|
8
8
|
|
|
9
9
|
describe("Modal", () => {
|
|
10
|
-
it("should render properly", () => {
|
|
11
|
-
// Use baseElement since it renders in a Portal
|
|
12
|
-
const { baseElement } = render(
|
|
13
|
-
<Modal
|
|
14
|
-
isOpen={true}
|
|
15
|
-
label="Label"
|
|
16
|
-
bg={COLOR_PURPLE_300}
|
|
17
|
-
onClose={() => {}}
|
|
18
|
-
closeButtonLabel="Close this dialog"
|
|
19
|
-
>
|
|
20
|
-
ajdsfljasdlfjlasdjf
|
|
21
|
-
</Modal>
|
|
22
|
-
);
|
|
23
|
-
expect(baseElement.querySelector(".ReactModal__Overlay")).toMatchSnapshot();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
10
|
it("renders a custom background color", () => {
|
|
27
11
|
// Use baseElement since it renders in a Portal
|
|
28
12
|
const { baseElement } = render(
|
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/Menu/index.js
CHANGED
|
@@ -277,7 +277,9 @@ var MenuGroup = function MenuGroup(_ref2) {
|
|
|
277
277
|
mt: 350,
|
|
278
278
|
color: "text.headline",
|
|
279
279
|
_css: isDisabled && _mixins.disabled
|
|
280
|
-
}, title)), /*#__PURE__*/React.createElement(
|
|
280
|
+
}, title)), /*#__PURE__*/React.createElement(_Box.default, _extends({}, props, {
|
|
281
|
+
m: 300,
|
|
282
|
+
p: 300,
|
|
281
283
|
role: "group"
|
|
282
284
|
}), children));
|
|
283
285
|
};
|
package/commonjs/Menu/styles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.MenuItemsContainer = exports.MenuItemContainer = void 0;
|
|
5
5
|
|
|
6
6
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
7
7
|
|
|
@@ -56,21 +56,8 @@ var MenuItemContainer = (0, _styledComponents.default)(_Box.default).withConfig(
|
|
|
56
56
|
return props.disabled && _mixins.disabled;
|
|
57
57
|
});
|
|
58
58
|
exports.MenuItemContainer = MenuItemContainer;
|
|
59
|
-
var MenuGroupContainer = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
60
|
-
displayName: "styles__MenuGroupContainer",
|
|
61
|
-
componentId: "fjvae4-1"
|
|
62
|
-
})(["", ";"], function (props) {
|
|
63
|
-
return props.appearance === "flush" ? (0, _styledComponents.css)(["margin:0 -", ";"], function (props) {
|
|
64
|
-
return props.theme.space[300];
|
|
65
|
-
}) : (0, _styledComponents.css)(["padding:", ";"], function (props) {
|
|
66
|
-
return props.theme.space[300];
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
exports.MenuGroupContainer = MenuGroupContainer;
|
|
70
59
|
var MenuItemsContainer = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
71
60
|
displayName: "styles__MenuItemsContainer",
|
|
72
|
-
componentId: "fjvae4-
|
|
61
|
+
componentId: "fjvae4-1"
|
|
73
62
|
})(["list-style-type:none;outline:0;"]);
|
|
74
|
-
exports.MenuItemsContainer = MenuItemsContainer;
|
|
75
|
-
var _default = MenuGroupContainer;
|
|
76
|
-
exports.default = _default;
|
|
63
|
+
exports.MenuItemsContainer = MenuItemsContainer;
|
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
|
@@ -6,6 +6,9 @@ $dark: (
|
|
|
6
6
|
high: 0px 16px 32px #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: (
|
|
@@ -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
|
@@ -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: (
|
|
@@ -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/Menu/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import * as React from "react";
|
|
|
8
8
|
import styled from "styled-components";
|
|
9
9
|
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import uniqueId from "lodash.uniqueid";
|
|
11
|
-
import {
|
|
11
|
+
import { MenuItemContainer, MenuItemsContainer } from "./styles";
|
|
12
12
|
import { MENU_ITEM_ROLES, MENU_ROLES } from "./constants";
|
|
13
13
|
import Box from "../Box";
|
|
14
14
|
import Button from "../Button";
|
|
@@ -244,7 +244,9 @@ export var MenuGroup = function MenuGroup(_ref2) {
|
|
|
244
244
|
mt: 350,
|
|
245
245
|
color: "text.headline",
|
|
246
246
|
_css: isDisabled && disabled
|
|
247
|
-
}, title)), /*#__PURE__*/React.createElement(
|
|
247
|
+
}, title)), /*#__PURE__*/React.createElement(Box, _extends({}, props, {
|
|
248
|
+
m: 300,
|
|
249
|
+
p: 300,
|
|
248
250
|
role: "group"
|
|
249
251
|
}), children));
|
|
250
252
|
};
|
package/lib/Menu/styles.js
CHANGED
|
@@ -41,18 +41,7 @@ export var MenuItemContainer = styled(Box).withConfig({
|
|
|
41
41
|
}, function (props) {
|
|
42
42
|
return props.disabled && disabled;
|
|
43
43
|
});
|
|
44
|
-
export var MenuGroupContainer = styled(Box).withConfig({
|
|
45
|
-
displayName: "styles__MenuGroupContainer",
|
|
46
|
-
componentId: "fjvae4-1"
|
|
47
|
-
})(["", ";"], function (props) {
|
|
48
|
-
return props.appearance === "flush" ? css(["margin:0 -", ";"], function (props) {
|
|
49
|
-
return props.theme.space[300];
|
|
50
|
-
}) : css(["padding:", ";"], function (props) {
|
|
51
|
-
return props.theme.space[300];
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
44
|
export var MenuItemsContainer = styled(Box).withConfig({
|
|
55
45
|
displayName: "styles__MenuItemsContainer",
|
|
56
|
-
componentId: "fjvae4-
|
|
57
|
-
})(["list-style-type:none;outline:0;"]);
|
|
58
|
-
export default MenuGroupContainer;
|
|
46
|
+
componentId: "fjvae4-1"
|
|
47
|
+
})(["list-style-type:none;outline:0;"]);
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/racine",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"__flow__",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"@storybook/addon-storysource": "^6.1.11",
|
|
104
104
|
"@storybook/addon-viewport": "^6.1.11",
|
|
105
105
|
"@storybook/addons": "^6.1.11",
|
|
106
|
-
"@storybook/react": "^6.
|
|
106
|
+
"@storybook/react": "^6.4.19",
|
|
107
107
|
"@storybook/theming": "^6.1.11",
|
|
108
108
|
"@testing-library/react": "^11.2.2",
|
|
109
109
|
"@testing-library/user-event": "^13.0.0",
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Modal should render properly 1`] = `
|
|
4
|
-
.c0__Overlay {
|
|
5
|
-
position: fixed;
|
|
6
|
-
top: 0px;
|
|
7
|
-
left: 0px;
|
|
8
|
-
right: 0px;
|
|
9
|
-
bottom: 0px;
|
|
10
|
-
display: -webkit-box;
|
|
11
|
-
display: -webkit-flex;
|
|
12
|
-
display: -ms-flexbox;
|
|
13
|
-
display: flex;
|
|
14
|
-
-webkit-align-items: center;
|
|
15
|
-
-webkit-box-align: center;
|
|
16
|
-
-ms-flex-align: center;
|
|
17
|
-
align-items: center;
|
|
18
|
-
-webkit-box-pack: center;
|
|
19
|
-
-webkit-justify-content: center;
|
|
20
|
-
-ms-flex-pack: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
background-color: rgba(22,32,32,0.68);
|
|
23
|
-
opacity: 0;
|
|
24
|
-
will-change: opacity;
|
|
25
|
-
-webkit-transition: opacity .3s cubic-bezier(.4,0,.2,1);
|
|
26
|
-
transition: opacity .3s cubic-bezier(.4,0,.2,1);
|
|
27
|
-
z-index: 6;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.c0__Overlay.ReactModal__Overlay--after-open {
|
|
31
|
-
opacity: 1;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.c0__Overlay.ReactModal__Overlay--before-close {
|
|
35
|
-
opacity: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.c0__Content {
|
|
39
|
-
display: -webkit-box;
|
|
40
|
-
display: -webkit-flex;
|
|
41
|
-
display: -ms-flexbox;
|
|
42
|
-
display: flex;
|
|
43
|
-
-webkit-flex-direction: column;
|
|
44
|
-
-ms-flex-direction: column;
|
|
45
|
-
flex-direction: column;
|
|
46
|
-
background: #FFFFFF;
|
|
47
|
-
border-radius: 6px;
|
|
48
|
-
box-shadow: 0px 8px 16px #2733333D;
|
|
49
|
-
-webkit-filter: blur(0);
|
|
50
|
-
filter: blur(0);
|
|
51
|
-
color: #364141;
|
|
52
|
-
outline: none;
|
|
53
|
-
max-width: calc(100vw - 64px);
|
|
54
|
-
max-height: calc(100vh - 64px);
|
|
55
|
-
width: 800px;
|
|
56
|
-
background-color: #c1c1f7;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none) {
|
|
60
|
-
.c0__Content {
|
|
61
|
-
height: calc(100vh - 64px);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
<div
|
|
66
|
-
class="ReactModal__Overlay ReactModal__Overlay--after-open styles__Container-sc-9lom4g-0__Overlay c0 c0__Overlay"
|
|
67
|
-
>
|
|
68
|
-
<div
|
|
69
|
-
aria-label="Label"
|
|
70
|
-
aria-modal="true"
|
|
71
|
-
class="ReactModal__Content ReactModal__Content--after-open styles__Container-sc-9lom4g-0__Content c0 c0__Content"
|
|
72
|
-
data-qa-modal=""
|
|
73
|
-
data-qa-modal-isopen="true"
|
|
74
|
-
role="dialog"
|
|
75
|
-
tabindex="-1"
|
|
76
|
-
>
|
|
77
|
-
ajdsfljasdlfjlasdjf
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
`;
|