grommet 2.25.2 → 2.26.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/components/Anchor/Anchor.js +1 -1
- package/components/Box/stories/BackgroundThemed.js +54 -0
- package/components/Box/stories/CustomThemed/ThemedBackground.tsx +176 -0
- package/components/Button/Button.js +2 -2
- package/components/Calendar/Calendar.js +2 -1
- package/components/CheckBoxGroup/CheckBoxGroup.js +3 -2
- package/components/CheckBoxGroup/index.d.ts +2 -1
- package/components/CheckBoxGroup/propTypes.js +1 -0
- package/components/FormField/FormField.js +1 -1
- package/components/Heading/Heading.js +31 -2
- package/components/Heading/StyledHeading.js +1 -1
- package/components/Heading/index.d.ts +1 -0
- package/components/Heading/propTypes.js +1 -0
- package/components/Heading/stories/All.js +4 -1
- package/components/Layer/LayerContainer.js +16 -9
- package/components/List/List.js +131 -33
- package/components/List/index.d.ts +1 -0
- package/components/List/propTypes.js +1 -0
- package/components/List/stories/Pinned.js +36 -0
- package/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -2
- package/components/Select/DefaultSelectTextInput.js +43 -0
- package/components/Select/EmptySearchOption.js +34 -0
- package/components/Select/Select.js +30 -95
- package/components/Select/SelectContainer.js +19 -59
- package/components/Select/StyledSelect.js +58 -2
- package/components/Select/index.d.ts +11 -9
- package/components/Select/propTypes.js +44 -40
- package/components/Select/utils.js +103 -3
- package/components/SelectMultiple/README.md +2 -0
- package/components/SelectMultiple/SelectMultiple.js +476 -0
- package/components/SelectMultiple/SelectMultipleContainer.js +481 -0
- package/components/SelectMultiple/SelectMultipleValue.js +166 -0
- package/components/SelectMultiple/SelectionSummary.js +104 -0
- package/components/SelectMultiple/index.d.ts +21 -0
- package/components/SelectMultiple/index.js +8 -0
- package/components/SelectMultiple/propTypes.js +28 -0
- package/components/SelectMultiple/stories/Default.js +76 -0
- package/components/SelectMultiple/stories/Disabled.js +84 -0
- package/components/SelectMultiple/stories/FormField.js +66 -0
- package/components/SelectMultiple/stories/Limited.js +68 -0
- package/components/SelectMultiple/stories/LongList.js +76 -0
- package/components/SelectMultiple/stories/ObjectOptions.js +80 -0
- package/components/SelectMultiple/stories/ShowSelectedInline.js +76 -0
- package/components/SelectMultiple/stories/typescript/Children.tsx +106 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +8 -0
- package/es6/components/Anchor/Anchor.js +2 -2
- package/es6/components/Box/stories/BackgroundThemed.js +39 -0
- package/es6/components/Box/stories/CustomThemed/ThemedBackground.tsx +176 -0
- package/es6/components/Button/Button.js +3 -3
- package/es6/components/Calendar/Calendar.js +2 -1
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +3 -2
- package/es6/components/CheckBoxGroup/index.d.ts +2 -1
- package/es6/components/CheckBoxGroup/propTypes.js +1 -0
- package/es6/components/FormField/FormField.js +1 -1
- package/es6/components/Heading/Heading.js +30 -3
- package/es6/components/Heading/StyledHeading.js +1 -1
- package/es6/components/Heading/index.d.ts +1 -0
- package/es6/components/Heading/propTypes.js +1 -0
- package/es6/components/Heading/stories/All.js +4 -1
- package/es6/components/Layer/LayerContainer.js +16 -9
- package/es6/components/List/List.js +131 -34
- package/es6/components/List/index.d.ts +1 -0
- package/es6/components/List/propTypes.js +1 -0
- package/es6/components/List/stories/Pinned.js +21 -0
- package/es6/components/Notification/stories/CustomThemed/ThemedNotification.tsx +2 -2
- package/es6/components/Select/DefaultSelectTextInput.js +31 -0
- package/es6/components/Select/EmptySearchOption.js +21 -0
- package/es6/components/Select/Select.js +26 -89
- package/es6/components/Select/SelectContainer.js +19 -58
- package/es6/components/Select/StyledSelect.js +45 -1
- package/es6/components/Select/index.d.ts +11 -9
- package/es6/components/Select/propTypes.js +41 -39
- package/es6/components/Select/utils.js +75 -1
- package/es6/components/SelectMultiple/README.md +2 -0
- package/es6/components/SelectMultiple/SelectMultiple.js +447 -0
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +453 -0
- package/es6/components/SelectMultiple/SelectMultipleValue.js +152 -0
- package/es6/components/SelectMultiple/SelectionSummary.js +91 -0
- package/es6/components/SelectMultiple/index.d.ts +21 -0
- package/es6/components/SelectMultiple/index.js +1 -0
- package/es6/components/SelectMultiple/propTypes.js +18 -0
- package/es6/components/SelectMultiple/stories/Default.js +60 -0
- package/es6/components/SelectMultiple/stories/Disabled.js +68 -0
- package/es6/components/SelectMultiple/stories/FormField.js +50 -0
- package/es6/components/SelectMultiple/stories/Limited.js +53 -0
- package/es6/components/SelectMultiple/stories/LongList.js +63 -0
- package/es6/components/SelectMultiple/stories/ObjectOptions.js +64 -0
- package/es6/components/SelectMultiple/stories/ShowSelectedInline.js +61 -0
- package/es6/components/SelectMultiple/stories/typescript/Children.tsx +106 -0
- package/es6/components/index.d.ts +1 -0
- package/es6/components/index.js +1 -0
- package/es6/index.d.ts +1 -0
- package/es6/themes/base.d.ts +8 -2
- package/es6/themes/base.js +54 -38
- package/es6/themes/grommet.js +15 -0
- package/es6/utils/DOM.js +4 -0
- package/es6/utils/background.js +65 -12
- package/es6/utils/general-prop-types.js +2 -0
- package/es6/utils/index.d.ts +2 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +7 -6
- package/themes/base.d.ts +8 -2
- package/themes/base.js +55 -38
- package/themes/grommet.js +15 -0
- package/utils/DOM.js +9 -2
- package/utils/background.js +64 -12
- package/utils/general-prop-types.js +2 -0
- package/utils/index.d.ts +2 -0
package/es6/themes/base.js
CHANGED
|
@@ -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',
|
|
@@ -1133,6 +1135,13 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1133
1135
|
color: 'status-disabled',
|
|
1134
1136
|
cursor: 'default'
|
|
1135
1137
|
},
|
|
1138
|
+
pinned: {
|
|
1139
|
+
background: 'background-contrast',
|
|
1140
|
+
icon: {
|
|
1141
|
+
size: 'medium',
|
|
1142
|
+
pad: 'small'
|
|
1143
|
+
}
|
|
1144
|
+
},
|
|
1136
1145
|
pad: {
|
|
1137
1146
|
horizontal: 'medium',
|
|
1138
1147
|
vertical: 'small'
|
|
@@ -1141,7 +1150,8 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1141
1150
|
},
|
|
1142
1151
|
icons: {
|
|
1143
1152
|
down: FormDown,
|
|
1144
|
-
up: FormUp
|
|
1153
|
+
up: FormUp,
|
|
1154
|
+
pin: FormPin
|
|
1145
1155
|
} // extend: undefined,
|
|
1146
1156
|
|
|
1147
1157
|
},
|
|
@@ -1227,6 +1237,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1227
1237
|
direction: 'column',
|
|
1228
1238
|
container: {
|
|
1229
1239
|
// any box props
|
|
1240
|
+
round: 'xsmall',
|
|
1230
1241
|
pad: {
|
|
1231
1242
|
horizontal: 'small',
|
|
1232
1243
|
vertical: 'xsmall'
|
|
@@ -1239,6 +1250,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1239
1250
|
direction: 'row',
|
|
1240
1251
|
container: {
|
|
1241
1252
|
// any box props
|
|
1253
|
+
round: 'none',
|
|
1242
1254
|
pad: {
|
|
1243
1255
|
horizontal: 'large',
|
|
1244
1256
|
vertical: 'xsmall'
|
|
@@ -1250,7 +1262,6 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1250
1262
|
container: {
|
|
1251
1263
|
// any box props
|
|
1252
1264
|
elevation: 'medium',
|
|
1253
|
-
round: 'xsmall',
|
|
1254
1265
|
width: 'medium'
|
|
1255
1266
|
},
|
|
1256
1267
|
layer: {
|
|
@@ -1283,58 +1294,60 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1283
1294
|
},
|
|
1284
1295
|
critical: {
|
|
1285
1296
|
icon: StatusCriticalSmall,
|
|
1286
|
-
|
|
1297
|
+
background: {
|
|
1298
|
+
color: 'status-critical',
|
|
1299
|
+
opacity: 'weak'
|
|
1300
|
+
},
|
|
1287
1301
|
color: 'status-critical',
|
|
1288
|
-
global: {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
}
|
|
1293
|
-
} // toast: {},
|
|
1294
|
-
|
|
1302
|
+
// global: {},
|
|
1303
|
+
toast: {
|
|
1304
|
+
background: 'background-front'
|
|
1305
|
+
}
|
|
1295
1306
|
},
|
|
1296
1307
|
warning: {
|
|
1297
1308
|
icon: StatusWarningSmall,
|
|
1298
|
-
|
|
1309
|
+
background: {
|
|
1310
|
+
color: 'status-warning',
|
|
1311
|
+
opacity: 'weak'
|
|
1312
|
+
},
|
|
1299
1313
|
color: 'status-warning',
|
|
1300
|
-
global: {
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
}
|
|
1305
|
-
} // toast: {},
|
|
1306
|
-
|
|
1314
|
+
// global: {},
|
|
1315
|
+
toast: {
|
|
1316
|
+
background: 'background-front'
|
|
1317
|
+
}
|
|
1307
1318
|
},
|
|
1308
1319
|
normal: {
|
|
1309
1320
|
icon: StatusGoodSmall,
|
|
1310
|
-
|
|
1321
|
+
background: {
|
|
1322
|
+
color: 'status-ok',
|
|
1323
|
+
opacity: 'weak'
|
|
1324
|
+
},
|
|
1311
1325
|
color: 'status-ok',
|
|
1312
|
-
global: {
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
}
|
|
1317
|
-
} // toast: {},
|
|
1318
|
-
|
|
1326
|
+
// global: {},
|
|
1327
|
+
toast: {
|
|
1328
|
+
background: 'background-front'
|
|
1329
|
+
}
|
|
1319
1330
|
},
|
|
1320
1331
|
info: {
|
|
1321
1332
|
icon: CircleInformation,
|
|
1322
|
-
|
|
1323
|
-
color: 'text-strong'
|
|
1324
|
-
//
|
|
1325
|
-
|
|
1333
|
+
background: 'background-contrast',
|
|
1334
|
+
color: 'text-strong',
|
|
1335
|
+
// global: {},
|
|
1336
|
+
toast: {
|
|
1337
|
+
background: 'background-front'
|
|
1338
|
+
}
|
|
1326
1339
|
},
|
|
1327
1340
|
unknown: {
|
|
1328
1341
|
icon: StatusUnknownSmall,
|
|
1329
|
-
|
|
1342
|
+
background: {
|
|
1343
|
+
color: 'status-unknown',
|
|
1344
|
+
opacity: 'weak'
|
|
1345
|
+
},
|
|
1330
1346
|
color: 'status-unknown',
|
|
1331
|
-
global: {
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
}
|
|
1336
|
-
} // toast: {},
|
|
1337
|
-
|
|
1347
|
+
// global: {},
|
|
1348
|
+
toast: {
|
|
1349
|
+
background: 'background-front'
|
|
1350
|
+
}
|
|
1338
1351
|
},
|
|
1339
1352
|
// deprecate "undefined" in v3
|
|
1340
1353
|
// and if undefined, no icon
|
|
@@ -1731,6 +1744,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1731
1744
|
// searchInput: undefined,
|
|
1732
1745
|
step: 20
|
|
1733
1746
|
},
|
|
1747
|
+
selectMultiple: {
|
|
1748
|
+
maxInline: 5
|
|
1749
|
+
},
|
|
1734
1750
|
skipLinks: {
|
|
1735
1751
|
position: 'top',
|
|
1736
1752
|
container: {
|
package/es6/themes/grommet.js
CHANGED
|
@@ -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
|
}
|
package/es6/utils/DOM.js
CHANGED
|
@@ -199,4 +199,8 @@ export var isNodeBeforeScroll = function isNodeBeforeScroll(node, target) {
|
|
|
199
199
|
targetTop = _ref2.top;
|
|
200
200
|
|
|
201
201
|
return top <= targetTop;
|
|
202
|
+
};
|
|
203
|
+
export var findButtonParent = function findButtonParent(element) {
|
|
204
|
+
if (element && element.nodeName !== 'BUTTON' && element.nodeName !== 'A') return findButtonParent(element.parentElement);
|
|
205
|
+
return element;
|
|
202
206
|
};
|
package/es6/utils/background.js
CHANGED
|
@@ -11,9 +11,11 @@ var evalStyle = function evalStyle(arg, theme) {
|
|
|
11
11
|
return arg;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export var normalizeBackground = function normalizeBackground(
|
|
15
|
-
|
|
16
|
-
|
|
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;
|
|
48
|
+
|
|
49
|
+
result = normalizeBackground(background.dark ? (_theme$global$backgro3 = theme.global.backgrounds) == null ? void 0 : _theme$global$backgro3[background.image].dark : (_theme$global$backgro4 = theme.global.backgrounds) == null ? void 0 : _theme$global$backgro4[background.image], theme) || background.image;
|
|
50
|
+
} else {
|
|
51
|
+
var _theme$global$backgro5;
|
|
52
|
+
|
|
53
|
+
var normalized = normalizeBackground((_theme$global$backgro5 = theme.global.backgrounds) == null ? void 0 : _theme$global$backgro5[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 =
|
|
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 =
|
|
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
|
-
|
|
131
|
-
|
|
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
|
})]);
|
package/es6/utils/index.d.ts
CHANGED
|
@@ -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 =
|