grommet 2.51.0 → 2.52.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/stories/Gap.stories.js +6 -0
- package/components/Box/Box.js +19 -0
- package/components/Button/Button.js +10 -1
- package/components/Calendar/Calendar.js +8 -5
- package/components/Meter/Meter.js +3 -6
- package/es6/components/Anchor/stories/Gap.stories.js +6 -0
- package/es6/components/Box/Box.js +19 -0
- package/es6/components/Button/Button.js +10 -1
- package/es6/components/Calendar/Calendar.js +8 -5
- package/es6/components/Meter/Meter.js +3 -6
- package/es6/themes/base.d.ts +8 -0
- package/es6/themes/base.js +27 -1
- package/es6/utils/colors.js +29 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +13 -13
- package/themes/base.d.ts +8 -0
- package/themes/base.js +27 -1
- package/utils/colors.js +29 -0
|
@@ -25,6 +25,11 @@ var GapAnchor = function GapAnchor() {
|
|
|
25
25
|
label: "Large Gap",
|
|
26
26
|
href: "#",
|
|
27
27
|
gap: "large"
|
|
28
|
+
}), /*#__PURE__*/_react["default"].createElement(_grommet.Anchor, {
|
|
29
|
+
icon: /*#__PURE__*/_react["default"].createElement(_grommetIcons.Upload, null),
|
|
30
|
+
label: "xLarge Gap",
|
|
31
|
+
href: "#",
|
|
32
|
+
gap: "xlarge"
|
|
28
33
|
}), /*#__PURE__*/_react["default"].createElement(_grommet.Anchor, {
|
|
29
34
|
icon: /*#__PURE__*/_react["default"].createElement(_grommetIcons.Upload, null),
|
|
30
35
|
label: "5px Gap",
|
|
@@ -35,6 +40,7 @@ var GapAnchor = function GapAnchor() {
|
|
|
35
40
|
var Gap = exports.Gap = function Gap() {
|
|
36
41
|
return /*#__PURE__*/_react["default"].createElement(GapAnchor, null);
|
|
37
42
|
};
|
|
43
|
+
Gap.tags = ['internal'];
|
|
38
44
|
var _default = exports["default"] = {
|
|
39
45
|
title: 'Controls/Anchor/Gap'
|
|
40
46
|
};
|
package/components/Box/Box.js
CHANGED
|
@@ -21,6 +21,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
21
21
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
22
22
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
23
23
|
var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, refProp) {
|
|
24
|
+
var _theme$global$depreca2;
|
|
24
25
|
var a11yTitle = _ref.a11yTitle,
|
|
25
26
|
backgroundProp = _ref.background,
|
|
26
27
|
border = _ref.border,
|
|
@@ -60,6 +61,24 @@ var Box = exports.Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, refP
|
|
|
60
61
|
var responsiveContainer = (0, _react.useContext)(_contexts.ResponsiveContainerContext);
|
|
61
62
|
var responsive = responsiveContainer && responsiveProp ? 'container' : responsiveProp;
|
|
62
63
|
var background = backgroundProp;
|
|
64
|
+
(0, _react.useEffect)(function () {
|
|
65
|
+
var _theme$global$depreca;
|
|
66
|
+
if (process.env.NODE_ENV !== 'production' && backgroundProp && (_theme$global$depreca = theme.global.deprecated) != null && _theme$global$depreca.backgrounds) {
|
|
67
|
+
var deprecatedBackground;
|
|
68
|
+
if (typeof backgroundProp === 'string') {
|
|
69
|
+
deprecatedBackground = theme.global.deprecated.backgrounds.find(function (item) {
|
|
70
|
+
return item.name === backgroundProp;
|
|
71
|
+
});
|
|
72
|
+
} else if (typeof backgroundProp === 'object') {
|
|
73
|
+
deprecatedBackground = theme.global.deprecated.backgrounds.find(function (item) {
|
|
74
|
+
return item.name === backgroundProp.image || item.name === backgroundProp.color;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (deprecatedBackground) {
|
|
78
|
+
console.warn(deprecatedBackground.message || "The background " + deprecatedBackground.name + " is deprecated.");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}, [backgroundProp, (_theme$global$depreca2 = theme.global.deprecated) == null ? void 0 : _theme$global$depreca2.backgrounds]);
|
|
63
82
|
var announce = (0, _react.useContext)(_AnnounceContext.AnnounceContext);
|
|
64
83
|
var containerRef = (0, _utils.useForwardedRef)(refProp);
|
|
65
84
|
|
|
@@ -145,7 +145,7 @@ var getPropertyColor = function getPropertyColor(property, paths, theme, kind, p
|
|
|
145
145
|
return result;
|
|
146
146
|
};
|
|
147
147
|
var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
148
|
-
var _theme$button$kind, _theme$button2;
|
|
148
|
+
var _theme$global$depreca2, _theme$button$kind, _theme$button2;
|
|
149
149
|
var active = _ref.active,
|
|
150
150
|
_ref$align = _ref.align,
|
|
151
151
|
align = _ref$align === void 0 ? 'center' : _ref$align,
|
|
@@ -212,6 +212,15 @@ var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
212
212
|
if ((icon || label) && children) {
|
|
213
213
|
console.warn('Button should not have children if icon or label is provided');
|
|
214
214
|
}
|
|
215
|
+
(0, _react.useEffect)(function () {
|
|
216
|
+
var _theme$global$depreca;
|
|
217
|
+
if (process.env.NODE_ENV !== 'production' && (_theme$global$depreca = theme.global.deprecated) != null && (_theme$global$depreca = _theme$global$depreca.button) != null && _theme$global$depreca.kind && kindArg) {
|
|
218
|
+
var deprecatedKind = theme.global.deprecated.button.kind.find(function (item) {
|
|
219
|
+
return item.name === kindArg;
|
|
220
|
+
});
|
|
221
|
+
if (deprecatedKind) console.warn(deprecatedKind.message || kindArg + " is deprecated.");
|
|
222
|
+
}
|
|
223
|
+
}, [kindArg, (_theme$global$depreca2 = theme.global.deprecated) == null || (_theme$global$depreca2 = _theme$global$depreca2.button) == null ? void 0 : _theme$global$depreca2.kind]);
|
|
215
224
|
var skeleton = (0, _Skeleton.useSkeleton)();
|
|
216
225
|
var sendAnalytics = (0, _AnalyticsContext.useAnalytics)();
|
|
217
226
|
var onClick = (0, _react.useCallback)(function (event) {
|
|
@@ -512,6 +512,8 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
512
512
|
return result;
|
|
513
513
|
}, [activeDate, value, range]);
|
|
514
514
|
var selectDate = (0, _react.useCallback)(function (selectedDate) {
|
|
515
|
+
// If no onSelect prop is provided, the calendar should be read-only
|
|
516
|
+
if (!onSelect) return;
|
|
515
517
|
var nextValue;
|
|
516
518
|
if (range || Array.isArray(value == null ? void 0 : value[0])) {
|
|
517
519
|
nextValue = handleRange(selectedDate);
|
|
@@ -706,9 +708,9 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
706
708
|
disabledProp: dayDisabled,
|
|
707
709
|
buttonProps: {
|
|
708
710
|
a11yTitle: day.toDateString(),
|
|
709
|
-
onClick: dayDisabled
|
|
711
|
+
onClick: !dayDisabled && !!onSelect ? function () {
|
|
710
712
|
return onClick(dateObject);
|
|
711
|
-
}
|
|
713
|
+
} : function () {}
|
|
712
714
|
},
|
|
713
715
|
isInRange: inRange,
|
|
714
716
|
isSelected: selected,
|
|
@@ -723,14 +725,15 @@ var Calendar = exports.Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
723
725
|
days.push(/*#__PURE__*/_react["default"].createElement(CalendarCustomDay, {
|
|
724
726
|
key: day.getTime(),
|
|
725
727
|
"aria-selected": selected,
|
|
726
|
-
buttonProps:
|
|
727
|
-
a11yTitle: day.toDateString()
|
|
728
|
+
buttonProps: _extends({
|
|
729
|
+
a11yTitle: day.toDateString()
|
|
730
|
+
}, onSelect ? {
|
|
728
731
|
active: active && active.getTime() === day.getTime(),
|
|
729
732
|
disabled: dayDisabled,
|
|
730
733
|
onClick: dayDisabled ? function () {} : function () {
|
|
731
734
|
return onClick(dateObject);
|
|
732
735
|
}
|
|
733
|
-
} :
|
|
736
|
+
} : {}),
|
|
734
737
|
size: size,
|
|
735
738
|
fill: fill,
|
|
736
739
|
responsive: responsive
|
|
@@ -13,13 +13,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
13
13
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
14
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
15
15
|
var Meter = exports.Meter = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
16
|
-
var _messages$meter;
|
|
16
|
+
var _theme$meter, _messages$meter;
|
|
17
17
|
var ariaLabel = _ref['aria-label'],
|
|
18
|
-
|
|
19
|
-
background = _ref$background === void 0 ? {
|
|
20
|
-
color: 'light-2',
|
|
21
|
-
opacity: 'medium'
|
|
22
|
-
} : _ref$background,
|
|
18
|
+
backgroundProp = _ref.background,
|
|
23
19
|
color = _ref.color,
|
|
24
20
|
_ref$direction = _ref.direction,
|
|
25
21
|
direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
|
|
@@ -39,6 +35,7 @@ var Meter = exports.Meter = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
|
|
|
39
35
|
theme = _useThemeValue.theme;
|
|
40
36
|
var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
|
|
41
37
|
format = _useContext.format;
|
|
38
|
+
var background = backgroundProp || ((_theme$meter = theme.meter) == null ? void 0 : _theme$meter.background);
|
|
42
39
|
|
|
43
40
|
// normalize values to an array of objects
|
|
44
41
|
var values = (0, _react.useMemo)(function () {
|
|
@@ -20,6 +20,11 @@ var GapAnchor = function GapAnchor() {
|
|
|
20
20
|
label: "Large Gap",
|
|
21
21
|
href: "#",
|
|
22
22
|
gap: "large"
|
|
23
|
+
}), /*#__PURE__*/React.createElement(Anchor, {
|
|
24
|
+
icon: /*#__PURE__*/React.createElement(Upload, null),
|
|
25
|
+
label: "xLarge Gap",
|
|
26
|
+
href: "#",
|
|
27
|
+
gap: "xlarge"
|
|
23
28
|
}), /*#__PURE__*/React.createElement(Anchor, {
|
|
24
29
|
icon: /*#__PURE__*/React.createElement(Upload, null),
|
|
25
30
|
label: "5px Gap",
|
|
@@ -30,6 +35,7 @@ var GapAnchor = function GapAnchor() {
|
|
|
30
35
|
export var Gap = function Gap() {
|
|
31
36
|
return /*#__PURE__*/React.createElement(GapAnchor, null);
|
|
32
37
|
};
|
|
38
|
+
Gap.tags = ['internal'];
|
|
33
39
|
export default {
|
|
34
40
|
title: 'Controls/Anchor/Gap'
|
|
35
41
|
};
|
|
@@ -16,6 +16,7 @@ import { ResponsiveContainerProvider } from './ResponsiveContainerProvider';
|
|
|
16
16
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
17
17
|
import { supportsContainerQueries } from '../../utils/responsive';
|
|
18
18
|
var Box = /*#__PURE__*/forwardRef(function (_ref, refProp) {
|
|
19
|
+
var _theme$global$depreca2;
|
|
19
20
|
var a11yTitle = _ref.a11yTitle,
|
|
20
21
|
backgroundProp = _ref.background,
|
|
21
22
|
border = _ref.border,
|
|
@@ -55,6 +56,24 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, refProp) {
|
|
|
55
56
|
var responsiveContainer = useContext(ResponsiveContainerContext);
|
|
56
57
|
var responsive = responsiveContainer && responsiveProp ? 'container' : responsiveProp;
|
|
57
58
|
var background = backgroundProp;
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
var _theme$global$depreca;
|
|
61
|
+
if (process.env.NODE_ENV !== 'production' && backgroundProp && (_theme$global$depreca = theme.global.deprecated) != null && _theme$global$depreca.backgrounds) {
|
|
62
|
+
var deprecatedBackground;
|
|
63
|
+
if (typeof backgroundProp === 'string') {
|
|
64
|
+
deprecatedBackground = theme.global.deprecated.backgrounds.find(function (item) {
|
|
65
|
+
return item.name === backgroundProp;
|
|
66
|
+
});
|
|
67
|
+
} else if (typeof backgroundProp === 'object') {
|
|
68
|
+
deprecatedBackground = theme.global.deprecated.backgrounds.find(function (item) {
|
|
69
|
+
return item.name === backgroundProp.image || item.name === backgroundProp.color;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (deprecatedBackground) {
|
|
73
|
+
console.warn(deprecatedBackground.message || "The background " + deprecatedBackground.name + " is deprecated.");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, [backgroundProp, (_theme$global$depreca2 = theme.global.deprecated) == null ? void 0 : _theme$global$depreca2.backgrounds]);
|
|
58
77
|
var announce = useContext(AnnounceContext);
|
|
59
78
|
var containerRef = useForwardedRef(refProp);
|
|
60
79
|
|
|
@@ -139,7 +139,7 @@ var getPropertyColor = function getPropertyColor(property, paths, theme, kind, p
|
|
|
139
139
|
return result;
|
|
140
140
|
};
|
|
141
141
|
var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
142
|
-
var _theme$button$kind, _theme$button2;
|
|
142
|
+
var _theme$global$depreca2, _theme$button$kind, _theme$button2;
|
|
143
143
|
var active = _ref.active,
|
|
144
144
|
_ref$align = _ref.align,
|
|
145
145
|
align = _ref$align === void 0 ? 'center' : _ref$align,
|
|
@@ -206,6 +206,15 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
206
206
|
if ((icon || label) && children) {
|
|
207
207
|
console.warn('Button should not have children if icon or label is provided');
|
|
208
208
|
}
|
|
209
|
+
useEffect(function () {
|
|
210
|
+
var _theme$global$depreca;
|
|
211
|
+
if (process.env.NODE_ENV !== 'production' && (_theme$global$depreca = theme.global.deprecated) != null && (_theme$global$depreca = _theme$global$depreca.button) != null && _theme$global$depreca.kind && kindArg) {
|
|
212
|
+
var deprecatedKind = theme.global.deprecated.button.kind.find(function (item) {
|
|
213
|
+
return item.name === kindArg;
|
|
214
|
+
});
|
|
215
|
+
if (deprecatedKind) console.warn(deprecatedKind.message || kindArg + " is deprecated.");
|
|
216
|
+
}
|
|
217
|
+
}, [kindArg, (_theme$global$depreca2 = theme.global.deprecated) == null || (_theme$global$depreca2 = _theme$global$depreca2.button) == null ? void 0 : _theme$global$depreca2.kind]);
|
|
209
218
|
var skeleton = useSkeleton();
|
|
210
219
|
var sendAnalytics = useAnalytics();
|
|
211
220
|
var onClick = useCallback(function (event) {
|
|
@@ -508,6 +508,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
|
508
508
|
return result;
|
|
509
509
|
}, [activeDate, value, range]);
|
|
510
510
|
var selectDate = useCallback(function (selectedDate) {
|
|
511
|
+
// If no onSelect prop is provided, the calendar should be read-only
|
|
512
|
+
if (!onSelect) return;
|
|
511
513
|
var nextValue;
|
|
512
514
|
if (range || Array.isArray(value == null ? void 0 : value[0])) {
|
|
513
515
|
nextValue = handleRange(selectedDate);
|
|
@@ -702,9 +704,9 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
|
702
704
|
disabledProp: dayDisabled,
|
|
703
705
|
buttonProps: {
|
|
704
706
|
a11yTitle: day.toDateString(),
|
|
705
|
-
onClick: dayDisabled
|
|
707
|
+
onClick: !dayDisabled && !!onSelect ? function () {
|
|
706
708
|
return onClick(dateObject);
|
|
707
|
-
}
|
|
709
|
+
} : function () {}
|
|
708
710
|
},
|
|
709
711
|
isInRange: inRange,
|
|
710
712
|
isSelected: selected,
|
|
@@ -719,14 +721,15 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
|
719
721
|
days.push(/*#__PURE__*/React.createElement(CalendarCustomDay, {
|
|
720
722
|
key: day.getTime(),
|
|
721
723
|
"aria-selected": selected,
|
|
722
|
-
buttonProps:
|
|
723
|
-
a11yTitle: day.toDateString()
|
|
724
|
+
buttonProps: _extends({
|
|
725
|
+
a11yTitle: day.toDateString()
|
|
726
|
+
}, onSelect ? {
|
|
724
727
|
active: active && active.getTime() === day.getTime(),
|
|
725
728
|
disabled: dayDisabled,
|
|
726
729
|
onClick: dayDisabled ? function () {} : function () {
|
|
727
730
|
return onClick(dateObject);
|
|
728
731
|
}
|
|
729
|
-
} :
|
|
732
|
+
} : {}),
|
|
730
733
|
size: size,
|
|
731
734
|
fill: fill,
|
|
732
735
|
responsive: responsive
|
|
@@ -8,13 +8,9 @@ import { MeterPropTypes } from './propTypes';
|
|
|
8
8
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
9
9
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
10
10
|
var Meter = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
11
|
-
var _messages$meter;
|
|
11
|
+
var _theme$meter, _messages$meter;
|
|
12
12
|
var ariaLabel = _ref['aria-label'],
|
|
13
|
-
|
|
14
|
-
background = _ref$background === void 0 ? {
|
|
15
|
-
color: 'light-2',
|
|
16
|
-
opacity: 'medium'
|
|
17
|
-
} : _ref$background,
|
|
13
|
+
backgroundProp = _ref.background,
|
|
18
14
|
color = _ref.color,
|
|
19
15
|
_ref$direction = _ref.direction,
|
|
20
16
|
direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
|
|
@@ -34,6 +30,7 @@ var Meter = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
34
30
|
theme = _useThemeValue.theme;
|
|
35
31
|
var _useContext = useContext(MessageContext),
|
|
36
32
|
format = _useContext.format;
|
|
33
|
+
var background = backgroundProp || ((_theme$meter = theme.meter) == null ? void 0 : _theme$meter.background);
|
|
37
34
|
|
|
38
35
|
// normalize values to an array of objects
|
|
39
36
|
var values = useMemo(function () {
|
package/es6/themes/base.d.ts
CHANGED
|
@@ -356,6 +356,13 @@ export interface ThemeType {
|
|
|
356
356
|
}
|
|
357
357
|
| undefined;
|
|
358
358
|
};
|
|
359
|
+
deprecated?: {
|
|
360
|
+
backgrounds?: { name: string; message?: string }[];
|
|
361
|
+
colors?: { name: string; message?: string }[];
|
|
362
|
+
button?: {
|
|
363
|
+
kind?: { name: string; message?: string }[];
|
|
364
|
+
};
|
|
365
|
+
};
|
|
359
366
|
deviceBreakpoints?: {
|
|
360
367
|
phone?: string;
|
|
361
368
|
tablet?: string;
|
|
@@ -1466,6 +1473,7 @@ export interface ThemeType {
|
|
|
1466
1473
|
};
|
|
1467
1474
|
};
|
|
1468
1475
|
meter?: {
|
|
1476
|
+
background?: BackgroundType;
|
|
1469
1477
|
color?: ColorType;
|
|
1470
1478
|
colors?: GraphColorsType;
|
|
1471
1479
|
extend?: ExtendType;
|
package/es6/themes/base.js
CHANGED
|
@@ -233,6 +233,28 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
233
233
|
// might be too long depending on how fast people type, and 200ms
|
|
234
234
|
// would be an eye blink
|
|
235
235
|
debounceDelay: 500,
|
|
236
|
+
// deprecated: {
|
|
237
|
+
// backgrounds: [
|
|
238
|
+
// {
|
|
239
|
+
// name: string,
|
|
240
|
+
// message: string,
|
|
241
|
+
// },
|
|
242
|
+
// ],
|
|
243
|
+
// colors: [
|
|
244
|
+
// {
|
|
245
|
+
// name: string,
|
|
246
|
+
// message: string,
|
|
247
|
+
// },
|
|
248
|
+
// ],
|
|
249
|
+
// button: {
|
|
250
|
+
// kind: [
|
|
251
|
+
// {
|
|
252
|
+
// name: string,
|
|
253
|
+
// message: string,
|
|
254
|
+
// },
|
|
255
|
+
// ],
|
|
256
|
+
// },
|
|
257
|
+
// },
|
|
236
258
|
drop: {
|
|
237
259
|
// intelligentMargin: undefined,
|
|
238
260
|
background: {
|
|
@@ -369,7 +391,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
369
391
|
}
|
|
370
392
|
},
|
|
371
393
|
// icon: {
|
|
372
|
-
//
|
|
394
|
+
// extend: undefined,
|
|
373
395
|
// matchSize: undefined,
|
|
374
396
|
// size: undefined,
|
|
375
397
|
// },
|
|
@@ -1595,6 +1617,10 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1595
1617
|
}
|
|
1596
1618
|
},
|
|
1597
1619
|
meter: {
|
|
1620
|
+
background: {
|
|
1621
|
+
color: 'light-2',
|
|
1622
|
+
opacity: 'medium'
|
|
1623
|
+
},
|
|
1598
1624
|
color: 'graph-0'
|
|
1599
1625
|
// colors: [] || colors: ['graph-0', 'graph-1', 'graph-2', 'graph-3'],
|
|
1600
1626
|
// extend: undefined,
|
package/es6/utils/colors.js
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
+
// Track which deprecated colors have already been warned about
|
|
2
|
+
var warnedColors = new Set();
|
|
3
|
+
var checkColorDeprecation = function checkColorDeprecation(color, theme, dark) {
|
|
4
|
+
var _theme$global$depreca;
|
|
5
|
+
if ((_theme$global$depreca = theme.global.deprecated) != null && _theme$global$depreca.colors && process.env.NODE_ENV !== 'production') {
|
|
6
|
+
var colorKey = color;
|
|
7
|
+
if (typeof color === 'object') {
|
|
8
|
+
if (dark === true || dark === undefined && theme.dark) colorKey = color.dark;else colorKey = color.light;
|
|
9
|
+
}
|
|
10
|
+
if (!warnedColors.has(colorKey)) {
|
|
11
|
+
var deprecatedColor;
|
|
12
|
+
if (typeof color === 'string') {
|
|
13
|
+
deprecatedColor = theme.global.deprecated.colors.find(function (item) {
|
|
14
|
+
return item.name === color;
|
|
15
|
+
});
|
|
16
|
+
} else if (typeof color === 'object') {
|
|
17
|
+
deprecatedColor = theme.global.deprecated.colors.find(function (item) {
|
|
18
|
+
return item.name === color.light || item.name === color.dark;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (deprecatedColor) {
|
|
22
|
+
warnedColors.add(colorKey);
|
|
23
|
+
console.warn(deprecatedColor.message || colorKey + " is deprecated.");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
1
29
|
// Returns the specific color that should be used according to the theme.
|
|
2
30
|
// If 'dark' is supplied, it takes precedence over 'theme.dark'.
|
|
3
31
|
// Can return undefined.
|
|
4
32
|
var _normalizeColor = function normalizeColor(color, theme, dark) {
|
|
33
|
+
checkColorDeprecation(color, theme, dark);
|
|
5
34
|
var colorSpec = theme.global && theme.global.colors[color] !== undefined ? theme.global.colors[color] : color;
|
|
6
35
|
// If the color has a light or dark object, use that
|
|
7
36
|
var result = colorSpec;
|