grommet 2.25.3 → 2.27.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 (160) hide show
  1. package/all/stories/AllComponents.js +19 -126
  2. package/components/Accordion/stories/CustomHeader.js +3 -1
  3. package/components/Avatar/Avatar.js +22 -9
  4. package/components/Box/stories/BackgroundThemed.js +54 -0
  5. package/components/Box/stories/CustomThemed/ThemedBackground.tsx +176 -0
  6. package/components/Calendar/Calendar.js +2 -1
  7. package/components/CheckBox/StyledCheckBox.js +9 -5
  8. package/components/CheckBoxGroup/CheckBoxGroup.js +3 -2
  9. package/components/CheckBoxGroup/index.d.ts +2 -1
  10. package/components/CheckBoxGroup/propTypes.js +1 -0
  11. package/components/DataChart/Detail.js +3 -1
  12. package/components/DataTable/index.d.ts +6 -6
  13. package/components/DateInput/DateInput.js +1 -1
  14. package/components/Diagram/Diagram.js +2 -1
  15. package/components/Drop/stories/Inline.js +1 -1
  16. package/components/Drop/stories/Overflow.js +1 -1
  17. package/components/Drop/stories/Plain.js +1 -1
  18. package/components/Drop/stories/Simple.js +1 -1
  19. package/components/Drop/stories/Styled.js +1 -1
  20. package/components/FormField/FormField.js +1 -1
  21. package/components/Heading/Heading.js +31 -2
  22. package/components/Heading/StyledHeading.js +1 -1
  23. package/components/Heading/index.d.ts +1 -0
  24. package/components/Heading/propTypes.js +1 -0
  25. package/components/Heading/stories/All.js +4 -1
  26. package/components/List/List.js +125 -41
  27. package/components/List/index.d.ts +1 -0
  28. package/components/List/propTypes.js +1 -0
  29. package/components/List/stories/Order.js +1 -0
  30. package/components/List/stories/Pinned.js +37 -0
  31. package/components/List/stories/Selection.js +1 -0
  32. package/components/List/stories/onClickItem.js +1 -0
  33. package/components/Notification/Notification.js +2 -2
  34. package/components/Notification/index.d.ts +1 -1
  35. package/components/Notification/propTypes.js +1 -1
  36. package/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -2
  37. package/components/RadioButton/README.md +1 -279
  38. package/components/RadioButton/RadioButton.js +1 -0
  39. package/components/Select/DefaultSelectTextInput.js +43 -0
  40. package/components/Select/EmptySearchOption.js +34 -0
  41. package/components/Select/Select.js +38 -99
  42. package/components/Select/SelectContainer.js +20 -60
  43. package/components/Select/StyledSelect.js +58 -2
  44. package/components/Select/index.d.ts +11 -9
  45. package/components/Select/propTypes.js +44 -40
  46. package/components/Select/utils.js +129 -3
  47. package/components/SelectMultiple/README.md +2 -0
  48. package/components/SelectMultiple/SelectMultiple.js +476 -0
  49. package/components/SelectMultiple/SelectMultipleContainer.js +483 -0
  50. package/components/SelectMultiple/SelectMultipleValue.js +163 -0
  51. package/components/SelectMultiple/SelectionSummary.js +104 -0
  52. package/components/SelectMultiple/index.d.ts +21 -0
  53. package/components/SelectMultiple/index.js +8 -0
  54. package/components/SelectMultiple/propTypes.js +28 -0
  55. package/components/SelectMultiple/stories/Default.js +76 -0
  56. package/components/SelectMultiple/stories/Disabled.js +84 -0
  57. package/components/SelectMultiple/stories/FormField.js +66 -0
  58. package/components/SelectMultiple/stories/Limited.js +68 -0
  59. package/components/SelectMultiple/stories/LongList.js +76 -0
  60. package/components/SelectMultiple/stories/ObjectOptions.js +104 -0
  61. package/components/SelectMultiple/stories/ShowSelectedInline.js +76 -0
  62. package/components/SelectMultiple/stories/typescript/Children.tsx +106 -0
  63. package/components/Sidebar/stories/Labels.js +4 -1
  64. package/components/TextArea/stories/NonResizable.js +1 -0
  65. package/components/TextArea/stories/Simple.js +1 -0
  66. package/components/index.d.ts +1 -0
  67. package/components/index.js +8 -0
  68. package/es6/all/stories/AllComponents.js +21 -121
  69. package/es6/components/Accordion/stories/CustomHeader.js +3 -1
  70. package/es6/components/Avatar/Avatar.js +21 -9
  71. package/es6/components/Box/stories/BackgroundThemed.js +39 -0
  72. package/es6/components/Box/stories/CustomThemed/ThemedBackground.tsx +176 -0
  73. package/es6/components/Calendar/Calendar.js +2 -1
  74. package/es6/components/CheckBox/StyledCheckBox.js +9 -5
  75. package/es6/components/CheckBoxGroup/CheckBoxGroup.js +3 -2
  76. package/es6/components/CheckBoxGroup/index.d.ts +2 -1
  77. package/es6/components/CheckBoxGroup/propTypes.js +1 -0
  78. package/es6/components/DataChart/Detail.js +3 -1
  79. package/es6/components/DataTable/index.d.ts +6 -6
  80. package/es6/components/DateInput/DateInput.js +1 -1
  81. package/es6/components/Diagram/Diagram.js +2 -1
  82. package/es6/components/Drop/stories/Inline.js +1 -1
  83. package/es6/components/Drop/stories/Overflow.js +1 -1
  84. package/es6/components/Drop/stories/Plain.js +1 -1
  85. package/es6/components/Drop/stories/Simple.js +1 -1
  86. package/es6/components/Drop/stories/Styled.js +1 -1
  87. package/es6/components/FormField/FormField.js +1 -1
  88. package/es6/components/Heading/Heading.js +30 -3
  89. package/es6/components/Heading/StyledHeading.js +1 -1
  90. package/es6/components/Heading/index.d.ts +1 -0
  91. package/es6/components/Heading/propTypes.js +1 -0
  92. package/es6/components/Heading/stories/All.js +4 -1
  93. package/es6/components/List/List.js +126 -42
  94. package/es6/components/List/index.d.ts +1 -0
  95. package/es6/components/List/propTypes.js +1 -0
  96. package/es6/components/List/stories/Order.js +1 -0
  97. package/es6/components/List/stories/Pinned.js +22 -0
  98. package/es6/components/List/stories/Selection.js +1 -0
  99. package/es6/components/List/stories/onClickItem.js +1 -0
  100. package/es6/components/Notification/Notification.js +2 -2
  101. package/es6/components/Notification/index.d.ts +1 -1
  102. package/es6/components/Notification/propTypes.js +1 -1
  103. package/es6/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -2
  104. package/es6/components/RadioButton/README.md +1 -279
  105. package/es6/components/RadioButton/RadioButton.js +1 -0
  106. package/es6/components/Select/DefaultSelectTextInput.js +31 -0
  107. package/es6/components/Select/EmptySearchOption.js +21 -0
  108. package/es6/components/Select/Select.js +34 -93
  109. package/es6/components/Select/SelectContainer.js +20 -59
  110. package/es6/components/Select/StyledSelect.js +45 -1
  111. package/es6/components/Select/index.d.ts +11 -9
  112. package/es6/components/Select/propTypes.js +41 -39
  113. package/es6/components/Select/utils.js +95 -1
  114. package/es6/components/SelectMultiple/README.md +2 -0
  115. package/es6/components/SelectMultiple/SelectMultiple.js +447 -0
  116. package/es6/components/SelectMultiple/SelectMultipleContainer.js +455 -0
  117. package/es6/components/SelectMultiple/SelectMultipleValue.js +149 -0
  118. package/es6/components/SelectMultiple/SelectionSummary.js +91 -0
  119. package/es6/components/SelectMultiple/index.d.ts +21 -0
  120. package/es6/components/SelectMultiple/index.js +1 -0
  121. package/es6/components/SelectMultiple/propTypes.js +18 -0
  122. package/es6/components/SelectMultiple/stories/Default.js +60 -0
  123. package/es6/components/SelectMultiple/stories/Disabled.js +68 -0
  124. package/es6/components/SelectMultiple/stories/FormField.js +50 -0
  125. package/es6/components/SelectMultiple/stories/Limited.js +53 -0
  126. package/es6/components/SelectMultiple/stories/LongList.js +63 -0
  127. package/es6/components/SelectMultiple/stories/ObjectOptions.js +88 -0
  128. package/es6/components/SelectMultiple/stories/ShowSelectedInline.js +61 -0
  129. package/es6/components/SelectMultiple/stories/typescript/Children.tsx +106 -0
  130. package/es6/components/Sidebar/stories/Labels.js +4 -1
  131. package/es6/components/TextArea/stories/NonResizable.js +1 -0
  132. package/es6/components/TextArea/stories/Simple.js +1 -0
  133. package/es6/components/index.d.ts +1 -0
  134. package/es6/components/index.js +1 -0
  135. package/es6/index.d.ts +1 -0
  136. package/es6/themes/base.d.ts +16 -5
  137. package/es6/themes/base.js +60 -39
  138. package/es6/themes/grommet.js +15 -0
  139. package/es6/themes/hacktoberfest2022.js +129 -0
  140. package/es6/themes/index.js +2 -1
  141. package/es6/utils/background.js +65 -12
  142. package/es6/utils/general-prop-types.js +2 -0
  143. package/es6/utils/index.d.ts +2 -0
  144. package/es6/utils/styles.js +3 -1
  145. package/grommet.min.js +1 -1
  146. package/grommet.min.js.map +1 -1
  147. package/index.d.ts +1 -0
  148. package/package.json +44 -41
  149. package/themes/base.d.ts +16 -5
  150. package/themes/base.js +61 -39
  151. package/themes/grommet.js +15 -0
  152. package/themes/hacktoberfest2022.js +137 -0
  153. package/themes/index.js +6 -2
  154. package/tools/grommet-babel-preset-es2015.js +1 -12
  155. package/tools/pack.js +1 -94
  156. package/tools/release-stable.js +1 -27
  157. package/utils/background.js +64 -12
  158. package/utils/general-prop-types.js +2 -0
  159. package/utils/index.d.ts +2 -0
  160. package/utils/styles.js +3 -1
@@ -278,6 +278,9 @@ export interface ThemeType {
278
278
  duration?: string;
279
279
  };
280
280
  };
281
+ backgrounds?: {
282
+ [x: string]: BackgroundType | { dark?: string; light?: string };
283
+ };
281
284
  borderSize?: {
282
285
  xsmall?: string;
283
286
  small?: string;
@@ -392,6 +395,7 @@ export interface ThemeType {
392
395
  maxWidth?: string;
393
396
  size?: string;
394
397
  weight?: number | string;
398
+ variant?: string;
395
399
  };
396
400
  graph?: {
397
401
  colors?: GraphColorsType;
@@ -591,13 +595,14 @@ export interface ThemeType {
591
595
  background?: {
592
596
  color?: ColorType;
593
597
  };
598
+ extend?: ExtendType;
594
599
  };
595
600
  icon?: {
596
601
  size?: string;
597
602
  extend?: ExtendType;
598
603
  };
599
604
  icons?: {
600
- checked?: any;
605
+ checked?: React.ReactNode | Icon;
601
606
  indeterminate?: any;
602
607
  };
603
608
  pad?: PadType;
@@ -659,6 +664,9 @@ export interface ThemeType {
659
664
  baseline?: number;
660
665
  };
661
666
  dateInput?: {
667
+ container?: {
668
+ round?: RoundType;
669
+ };
662
670
  icon?: {
663
671
  size?: string;
664
672
  };
@@ -782,8 +790,8 @@ export interface ThemeType {
782
790
  margin?: MarginType;
783
791
  pad?: PadType;
784
792
  };
785
- checkBox: {
786
- pad: PadType;
793
+ checkBox?: {
794
+ pad?: PadType;
787
795
  };
788
796
  disabled?: {
789
797
  background?: BackgroundType;
@@ -1289,7 +1297,7 @@ export interface ThemeType {
1289
1297
  size?: string;
1290
1298
  };
1291
1299
  icons?: {
1292
- circle?: string;
1300
+ circle?: React.ReactNode | Icon;
1293
1301
  };
1294
1302
  gap?: string;
1295
1303
  size?: string;
@@ -1395,6 +1403,9 @@ export interface ThemeType {
1395
1403
  searchInput?: ReactComponentElement<any>;
1396
1404
  step?: number;
1397
1405
  };
1406
+ selectMultiple?: {
1407
+ maxInline?: number;
1408
+ };
1398
1409
  skipLinks?: {
1399
1410
  position?: LayerPositionType;
1400
1411
  container?: BoxProps;
@@ -1644,7 +1655,7 @@ export interface ThemeType {
1644
1655
  };
1645
1656
  scrubber?: {
1646
1657
  color?: ColorType;
1647
- interval: number;
1658
+ interval?: number;
1648
1659
  track?: {
1649
1660
  color?: ColorType;
1650
1661
  };
@@ -13,6 +13,7 @@ import { FormUp } from 'grommet-icons/icons/FormUp';
13
13
  import { Next } from 'grommet-icons/icons/Next';
14
14
  import { Pause } from 'grommet-icons/icons/Pause';
15
15
  import { Play } from 'grommet-icons/icons/Play';
16
+ import { FormPin } from 'grommet-icons/icons/FormPin';
16
17
  import { Previous } from 'grommet-icons/icons/Previous';
17
18
  import { StatusCriticalSmall } from 'grommet-icons/icons/StatusCriticalSmall';
18
19
  import { StatusGoodSmall } from 'grommet-icons/icons/StatusGoodSmall';
@@ -154,6 +155,7 @@ export var generate = function generate(baseSpacing, scale) {
154
155
  duration: '0.1s'
155
156
  }
156
157
  },
158
+ // backgrounds: undefined,
157
159
  borderSize: {
158
160
  xsmall: '1px',
159
161
  small: '2px',
@@ -708,6 +710,7 @@ export var generate = function generate(baseSpacing, scale) {
708
710
  light: 'black'
709
711
  }
710
712
  } // background: undefined,
713
+ // extend: undefined,
711
714
 
712
715
  },
713
716
  icon: {// size: undefined,
@@ -810,9 +813,13 @@ export var generate = function generate(baseSpacing, scale) {
810
813
  minSpeed: 200,
811
814
  baseline: 500
812
815
  },
813
- dateInput: {// icon: {
816
+ dateInput: {
817
+ container: {
818
+ round: 'xxsmall'
819
+ } // icon: {
814
820
  // size: undefined,
815
821
  // },
822
+
816
823
  },
817
824
  dataTable: {
818
825
  // body: {
@@ -1133,6 +1140,13 @@ export var generate = function generate(baseSpacing, scale) {
1133
1140
  color: 'status-disabled',
1134
1141
  cursor: 'default'
1135
1142
  },
1143
+ pinned: {
1144
+ background: 'background-contrast',
1145
+ icon: {
1146
+ size: 'medium',
1147
+ pad: 'small'
1148
+ }
1149
+ },
1136
1150
  pad: {
1137
1151
  horizontal: 'medium',
1138
1152
  vertical: 'small'
@@ -1141,7 +1155,8 @@ export var generate = function generate(baseSpacing, scale) {
1141
1155
  },
1142
1156
  icons: {
1143
1157
  down: FormDown,
1144
- up: FormUp
1158
+ up: FormUp,
1159
+ pin: FormPin
1145
1160
  } // extend: undefined,
1146
1161
 
1147
1162
  },
@@ -1227,6 +1242,7 @@ export var generate = function generate(baseSpacing, scale) {
1227
1242
  direction: 'column',
1228
1243
  container: {
1229
1244
  // any box props
1245
+ round: 'xsmall',
1230
1246
  pad: {
1231
1247
  horizontal: 'small',
1232
1248
  vertical: 'xsmall'
@@ -1239,6 +1255,7 @@ export var generate = function generate(baseSpacing, scale) {
1239
1255
  direction: 'row',
1240
1256
  container: {
1241
1257
  // any box props
1258
+ round: 'none',
1242
1259
  pad: {
1243
1260
  horizontal: 'large',
1244
1261
  vertical: 'xsmall'
@@ -1250,7 +1267,6 @@ export var generate = function generate(baseSpacing, scale) {
1250
1267
  container: {
1251
1268
  // any box props
1252
1269
  elevation: 'medium',
1253
- round: 'xsmall',
1254
1270
  width: 'medium'
1255
1271
  },
1256
1272
  layer: {
@@ -1283,58 +1299,60 @@ export var generate = function generate(baseSpacing, scale) {
1283
1299
  },
1284
1300
  critical: {
1285
1301
  icon: StatusCriticalSmall,
1286
- // background: undefined,
1302
+ background: {
1303
+ color: 'status-critical',
1304
+ opacity: 'weak'
1305
+ },
1287
1306
  color: 'status-critical',
1288
- global: {
1289
- background: {
1290
- color: 'status-critical',
1291
- opacity: 'weak'
1292
- }
1293
- } // toast: {},
1294
-
1307
+ // global: {},
1308
+ toast: {
1309
+ background: 'background-front'
1310
+ }
1295
1311
  },
1296
1312
  warning: {
1297
1313
  icon: StatusWarningSmall,
1298
- // background: undefined,
1314
+ background: {
1315
+ color: 'status-warning',
1316
+ opacity: 'weak'
1317
+ },
1299
1318
  color: 'status-warning',
1300
- global: {
1301
- background: {
1302
- color: 'status-warning',
1303
- opacity: 'weak'
1304
- }
1305
- } // toast: {},
1306
-
1319
+ // global: {},
1320
+ toast: {
1321
+ background: 'background-front'
1322
+ }
1307
1323
  },
1308
1324
  normal: {
1309
1325
  icon: StatusGoodSmall,
1310
- // background: undefined,
1326
+ background: {
1327
+ color: 'status-ok',
1328
+ opacity: 'weak'
1329
+ },
1311
1330
  color: 'status-ok',
1312
- global: {
1313
- background: {
1314
- color: 'status-ok',
1315
- opacity: 'weak'
1316
- }
1317
- } // toast: {},
1318
-
1331
+ // global: {},
1332
+ toast: {
1333
+ background: 'background-front'
1334
+ }
1319
1335
  },
1320
1336
  info: {
1321
1337
  icon: CircleInformation,
1322
- // background: undefined,
1323
- color: 'text-strong' // global: {},
1324
- // toast: {},
1325
-
1338
+ background: 'background-contrast',
1339
+ color: 'text-strong',
1340
+ // global: {},
1341
+ toast: {
1342
+ background: 'background-front'
1343
+ }
1326
1344
  },
1327
1345
  unknown: {
1328
1346
  icon: StatusUnknownSmall,
1329
- // background: undefined,
1347
+ background: {
1348
+ color: 'status-unknown',
1349
+ opacity: 'weak'
1350
+ },
1330
1351
  color: 'status-unknown',
1331
- global: {
1332
- background: {
1333
- color: 'status-unknown',
1334
- opacity: 'weak'
1335
- }
1336
- } // toast: {},
1337
-
1352
+ // global: {},
1353
+ toast: {
1354
+ background: 'background-front'
1355
+ }
1338
1356
  },
1339
1357
  // deprecate "undefined" in v3
1340
1358
  // and if undefined, no icon
@@ -1731,6 +1749,9 @@ export var generate = function generate(baseSpacing, scale) {
1731
1749
  // searchInput: undefined,
1732
1750
  step: 20
1733
1751
  },
1752
+ selectMultiple: {
1753
+ maxInline: 5
1754
+ },
1734
1755
  skipLinks: {
1735
1756
  position: 'top',
1736
1757
  container: {
@@ -8,6 +8,21 @@ export var grommet = deepFreeze({
8
8
  dark: '#000000'
9
9
  }
10
10
  },
11
+ backgrounds: {
12
+ stack: {
13
+ color: 'light-1',
14
+ image: "url(https://v2.grommet.io/img/stak-hurrah.svg)"
15
+ },
16
+ 'gradient-purple-blue': {
17
+ color: 'neutral-3',
18
+ image: "linear-gradient(\n #3D138D 0%, /* neutral-2 */\n #00739D 100% /* neutral-3 */\n );",
19
+ rotate: 145
20
+ },
21
+ 'gradient-purple-gold': {
22
+ color: 'neutral-2',
23
+ image: "linear-gradient(\n #3D138D 0%, /* neutral-2 */\n #EB0F79 75%,\n #FFCA58 100% /* accent-4 */\n );"
24
+ }
25
+ },
11
26
  font: {
12
27
  family: "-apple-system,\n BlinkMacSystemFont, \n \"Segoe UI\", \n Roboto, \n Oxygen, \n Ubuntu, \n Cantarell, \n \"Fira Sans\", \n \"Droid Sans\", \n \"Helvetica Neue\", \n Arial, sans-serif, \n \"Apple Color Emoji\", \n \"Segoe UI Emoji\", \n \"Segoe UI Symbol\""
13
28
  }
@@ -0,0 +1,129 @@
1
+ import { css } from 'styled-components';
2
+ import { deepFreeze } from '../utils/object';
3
+ export var hacktoberfest2022 = deepFreeze({
4
+ defaultMode: 'dark',
5
+ global: {
6
+ colors: {
7
+ background: '#160F1D',
8
+ 'background-back': '#000000',
9
+ 'background-front': '#160F1D',
10
+ 'text-strong': '#FFFFFF',
11
+ text: '#E4E1E6',
12
+ 'text-weak': '#76717A',
13
+ grey: '#AFACB2',
14
+ lime: '#C6FC60',
15
+ pink: '#D856A7',
16
+ purple: '#7C7EF4',
17
+ teal: '#73DAFB',
18
+ yellow: '#EDD063',
19
+ darkPurple: '#291E40',
20
+ active: 'purple',
21
+ focus: '#233670',
22
+ brand: 'lime',
23
+ control: 'teal',
24
+ 'graph-0': 'yellow',
25
+ 'graph-1': 'purple',
26
+ 'graph-2': 'teal',
27
+ 'graph-3': 'pink',
28
+ 'graph-4': 'lime',
29
+ // clear unused colors
30
+ icon: undefined,
31
+ 'accent-1': undefined,
32
+ 'accent-2': undefined,
33
+ 'accent-3': undefined,
34
+ 'accent-4': undefined,
35
+ 'neutral-1': undefined,
36
+ 'neutral-2': undefined,
37
+ 'neutral-3': undefined,
38
+ 'neutral-4': undefined,
39
+ 'neutral-5': undefined,
40
+ 'light-1': undefined,
41
+ 'light-2': undefined,
42
+ 'light-3': undefined,
43
+ 'light-4': undefined,
44
+ 'light-5': undefined,
45
+ 'light-6': undefined,
46
+ 'dark-1': undefined,
47
+ 'dark-2': undefined,
48
+ 'dark-3': undefined,
49
+ 'dark-4': undefined,
50
+ 'dark-5': undefined,
51
+ 'dark-6': undefined
52
+ },
53
+ backgrounds: {
54
+ 'gradient-purple-teal': {
55
+ image: "linear-gradient(\n #7C7EF4 0%,\n #73DAFB 100%\n );"
56
+ },
57
+ 'gradient-teal-purple': {
58
+ image: "linear-gradient(\n #73DAFB 0%,\n #7C7EF4 100%\n );"
59
+ },
60
+ 'gradient-yellow-teal-purple': {
61
+ image: "linear-gradient(\n #EDD063 0%,\n #73DAFB 50%,\n #7C7EF4 100%\n );",
62
+ rotate: 90
63
+ },
64
+ 'gradient-yellow-teal': {
65
+ image: "linear-gradient(\n #EDD063 0%,\n #73DAFB 100%\n );",
66
+ rotate: 90
67
+ }
68
+ },
69
+ focus: {
70
+ shadow: {
71
+ color: 'focus',
72
+ size: '3px'
73
+ }
74
+ },
75
+ font: {
76
+ family: '"JetBrains Mono", monospace',
77
+ face: "/* latin */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n src: url(https://fonts.gstatic.com/s/jetbrainsmono/v13/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOTk6OThhvA.woff) format('woff');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}"
78
+ }
79
+ },
80
+ grommet: {
81
+ extend: css(["text-transform:uppercase;"])
82
+ },
83
+ anchor: {
84
+ color: 'text',
85
+ hover: {
86
+ color: 'text-strong'
87
+ }
88
+ },
89
+ button: {
90
+ border: {
91
+ width: '0px',
92
+ radius: '0px'
93
+ },
94
+ padding: {
95
+ horizontal: '20px',
96
+ vertical: '10px'
97
+ },
98
+ color: 'text-strong',
99
+ size: {
100
+ small: {
101
+ pad: {
102
+ horizontal: '16px',
103
+ vertical: '8px'
104
+ }
105
+ },
106
+ medium: {
107
+ pad: {
108
+ horizontal: '20px',
109
+ vertical: '10px'
110
+ }
111
+ }
112
+ },
113
+ "default": {
114
+ color: 'text-strong'
115
+ },
116
+ primary: {
117
+ border: false,
118
+ background: 'gradient-yellow-teal-purple',
119
+ color: 'text'
120
+ },
121
+ hover: {
122
+ border: false
123
+ },
124
+ extend: css(["clip-path:polygon( 12px 0px,100% 0px,100% 72%,calc(100% - 12px) 100%,0px 100%,0px 12px );text-transform:uppercase;&:focus{clip-path:none;}"])
125
+ },
126
+ heading: {
127
+ extend: css(["text-shadow:rgba(255,215,77,0.6) -1px -1px 6px,rgba(124,127,255,0.6) 1px 1px 6px;"])
128
+ }
129
+ });
@@ -1,3 +1,4 @@
1
1
  export { base, generate } from './base';
2
2
  export { grommet } from './grommet';
3
- export { dark } from './dark';
3
+ export { dark } from './dark';
4
+ export { hacktoberfest2022 } from './hacktoberfest2022';
@@ -11,9 +11,11 @@ var evalStyle = function evalStyle(arg, theme) {
11
11
  return arg;
12
12
  };
13
13
 
14
- export var normalizeBackground = function normalizeBackground(background, theme) {
15
- // If the background has a light or dark object, use that
16
- var result = background;
14
+ export var normalizeBackground = function normalizeBackground(backgroundArg, theme) {
15
+ var _theme$global$backgro;
16
+
17
+ var background = ((_theme$global$backgro = theme.global.backgrounds) == null ? void 0 : _theme$global$backgro[backgroundArg]) || backgroundArg;
18
+ var result = background; // If the background has a light or dark object, use that
17
19
 
18
20
  if (background) {
19
21
  if (theme.dark && background.dark && typeof background.dark !== 'boolean') {
@@ -27,6 +29,50 @@ export var normalizeBackground = function normalizeBackground(background, theme)
27
29
 
28
30
  return result;
29
31
  };
32
+
33
+ var normalizeBackgroundColor = function normalizeBackgroundColor(backgroundArg, theme) {
34
+ var _theme$global$backgro2;
35
+
36
+ var background = backgroundArg.color || backgroundArg;
37
+ var result = normalizeColor( // Background color may be defined by theme.global.backgrounds or
38
+ // theme.global.colors.
39
+ ((_theme$global$backgro2 = theme.global.backgrounds) == null ? void 0 : _theme$global$backgro2[background]) || background, theme, backgroundArg.dark);
40
+ return result;
41
+ };
42
+
43
+ var normalizeBackgroundImage = function normalizeBackgroundImage(background, theme) {
44
+ var result;
45
+
46
+ if (background.image) {
47
+ var _theme$global$backgro3, _theme$global$backgro4, _theme$global$backgro5;
48
+
49
+ result = normalizeBackground(background.dark ? (_theme$global$backgro3 = theme.global.backgrounds) == null ? void 0 : (_theme$global$backgro4 = _theme$global$backgro3[background.image]) == null ? void 0 : _theme$global$backgro4.dark : (_theme$global$backgro5 = theme.global.backgrounds) == null ? void 0 : _theme$global$backgro5[background.image], theme) || background.image;
50
+ } else {
51
+ var _theme$global$backgro6;
52
+
53
+ var normalized = normalizeBackground((_theme$global$backgro6 = theme.global.backgrounds) == null ? void 0 : _theme$global$backgro6[background], theme);
54
+ result = typeof normalized === 'object' ? normalizeBackgroundImage(normalized, theme) : normalized;
55
+ }
56
+
57
+ return result;
58
+ };
59
+
60
+ var rotateBackground = function rotateBackground(background, theme) {
61
+ var backgroundImage = normalizeBackgroundImage(background, theme);
62
+ var result = backgroundImage;
63
+
64
+ if (backgroundImage.lastIndexOf('linear-gradient', 0) === 0) {
65
+ var regex = /\d{1,}deg\b,/gm; // Contains rotation specified in degrees. Only targets 'deg' string with a trailing comma. Do not match 'deg' string for hsl, etc..
66
+
67
+ result = backgroundImage.lastIndexOf('deg,') >= 0 ? backgroundImage.replace(regex, background.rotate + "deg,") : backgroundImage.replace('linear-gradient(', "linear-gradient(" + background.rotate + "deg, ");
68
+ } else {
69
+ console.warn( // eslint-disable-next-line max-len
70
+ "'background.rotate' property only supports 'background.image' containing a linear-gradient string.");
71
+ }
72
+
73
+ return result;
74
+ };
75
+
30
76
  export var backgroundIsDark = function backgroundIsDark(backgroundArg, theme) {
31
77
  var background = normalizeBackground(backgroundArg, theme);
32
78
  var result;
@@ -84,7 +130,7 @@ export var backgroundAndTextColors = function backgroundAndTextColors(background
84
130
  }
85
131
 
86
132
  if (background.color) {
87
- var color = normalizeColor(background.color, theme, background.dark);
133
+ var color = normalizeBackgroundColor(background, theme);
88
134
  var opacity = background.opacity === true ? global.opacity.medium : global.opacity[background.opacity] || background.opacity;
89
135
  backgroundColor = getRGBA(color, opacity) || color; // If we don't have a textColor already, and we aren't too translucent,
90
136
  // set the textColor to have the best contrast against the background
@@ -96,7 +142,7 @@ export var backgroundAndTextColors = function backgroundAndTextColors(background
96
142
  }
97
143
  }
98
144
  } else {
99
- backgroundColor = normalizeColor(background, theme);
145
+ backgroundColor = normalizeBackgroundColor(background, theme);
100
146
 
101
147
  var _shade = darkContext(backgroundColor, theme);
102
148
 
@@ -119,21 +165,28 @@ export var backgroundStyle = function backgroundStyle(backgroundArg, theme, text
119
165
  if (backgroundArg === undefined) return undefined;
120
166
  var background = normalizeBackground(backgroundArg, theme);
121
167
 
122
- if (typeof background === 'string' && background.lastIndexOf('url', 0) === 0) {
123
- return css(["background:", " no-repeat center center;background-size:cover;"], background);
124
- }
125
-
126
168
  var _backgroundAndTextCol = backgroundAndTextColors(background, textColorArg, theme),
127
169
  backgroundColor = _backgroundAndTextCol[0],
128
170
  textColor = _backgroundAndTextCol[1];
129
171
 
130
- if (background.image) {
131
- var backgroundStyles = "\n " + (backgroundColor ? "background-color: " + backgroundColor + ";" : '') + "\n background-image: " + background.image + ";\n background-repeat: " + (background.repeat || 'no-repeat') + ";\n background-position: " + (background.position || 'center center') + ";\n background-size: " + (background.size || 'cover') + ";\n "; // allow both background color and image, in case the image doesn't fill
172
+ var backgroundImage = background.rotate ? rotateBackground(background, theme) : normalizeBackgroundImage(background, theme);
173
+ var backgroundClipStyle = '';
174
+
175
+ if (background.clip) {
176
+ backgroundClipStyle = background.clip === 'text' ? "-webkit-text-fill-color: transparent; \n -webkit-background-clip: text; \n background-clip: text;" : "background-clip: " + background.clip + ";";
177
+ }
178
+
179
+ if (typeof background === 'string' && background.lastIndexOf('url', 0) === 0) {
180
+ return css(["background:", " no-repeat center center;background-size:cover;"], background);
181
+ }
182
+
183
+ if (backgroundImage) {
184
+ var backgroundStyles = "\n " + (backgroundColor ? "background-color: " + backgroundColor + ";" : '') + "\n background-image: " + backgroundImage + ";\n background-repeat: " + (typeof background === 'object' && background.repeat || 'no-repeat') + ";\n background-position: " + (background.position || 'center center') + ";\n background-size: " + (background.size || 'cover') + ";\n " + backgroundClipStyle + "\n "; // allow both background color and image, in case the image doesn't fill
132
185
  // when image and opacity are used together, we need to use pseudo :before
133
186
  // to ensure that only image and background color are affected by opacity
134
187
  // but not the container contents
135
188
 
136
- return css(["", " ", ""], textColor ? "color: " + textColor + ";" : '', !background.opacity ? backgroundStyles : "position: relative;\n z-index: 0;\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: -1;\n " + backgroundStyles + "\n opacity: " + (background.opacity === true ? theme.global.opacity.medium : theme.global.opacity[background.opacity] || background.opacity) + ";\n }");
189
+ return css(["", " ", ""], textColor ? "color: " + textColor + ";" : '', !background.opacity ? backgroundStyles : "position: relative;\n z-index: 0;\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: -1;\n border-radius: inherit;\n " + backgroundStyles + "\n opacity: " + (background.opacity === true ? theme.global.opacity.medium : theme.global.opacity[background.opacity] || background.opacity) + ";\n }");
137
190
  }
138
191
 
139
192
  if (backgroundColor) {
@@ -6,12 +6,14 @@ export var colorPropType = PropTypes.oneOfType([PropTypes.string, PropTypes.shap
6
6
  light: PropTypes.string
7
7
  })]);
8
8
  export var backgroundPropType = PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
9
+ clip: PropTypes.oneOfType([PropTypes.oneOf(['text']), PropTypes.string]),
9
10
  color: colorPropType,
10
11
  dark: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
11
12
  image: PropTypes.string,
12
13
  position: PropTypes.string,
13
14
  opacity: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number, PropTypes.oneOf(['weak', 'medium', 'strong'])]),
14
15
  repeat: PropTypes.oneOfType([PropTypes.oneOf(['no-repeat', 'repeat']), PropTypes.string]),
16
+ rotate: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
15
17
  size: PropTypes.oneOfType([PropTypes.oneOf(['cover', 'contain']), PropTypes.string]),
16
18
  light: PropTypes.string
17
19
  })]);
@@ -139,6 +139,8 @@ export interface BackgroundObject {
139
139
  repeat?: 'no-repeat' | 'repeat' | string;
140
140
  size?: 'cover' | 'contain' | string;
141
141
  light?: string;
142
+ clip?: 'text' | string;
143
+ rotate?: number | string;
142
144
  }
143
145
  export type BackgroundType = string | BackgroundObject;
144
146
  export type HoverIndicatorType =
@@ -3,7 +3,7 @@ import { backgroundStyle } from './background';
3
3
  import { normalizeColor } from './colors';
4
4
  import { getBreakpointStyle } from './responsive';
5
5
  import { breakpointStyle, parseMetricToNum } from './mixins';
6
- export var baseStyle = css(["font-family:", ";font-size:", ";line-height:", ";font-weight:", ";", " box-sizing:border-box;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;"], function (props) {
6
+ export var baseStyle = css(["font-family:", ";font-size:", ";line-height:", ";font-weight:", ";", " ", " box-sizing:border-box;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;"], function (props) {
7
7
  return props.theme.global.font.family;
8
8
  }, function (props) {
9
9
  return props.theme.global.font.size;
@@ -11,6 +11,8 @@ export var baseStyle = css(["font-family:", ";font-size:", ";line-height:", ";fo
11
11
  return props.theme.global.font.height;
12
12
  }, function (props) {
13
13
  return props.theme.global.font.weight;
14
+ }, function (props) {
15
+ return props.theme.global.font.variant && "\n font-variant:" + props.theme.global.font.variant + ";\n ";
14
16
  }, function (props) {
15
17
  return !props.plain && backgroundStyle(props.theme.baseBackground, props.theme);
16
18
  });