grommet 2.32.1 → 2.33.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/all/stories/CustomThemed/ExtendTheme.tsx +2 -4
- package/components/Chart/Chart.js +20 -20
- package/components/Chart/calcs.js +163 -92
- package/components/Chart/index.d.ts +10 -4
- package/components/Chart/propTypes.js +10 -1
- package/components/Chart/stories/{Vertical.js → Horizontal.js} +34 -6
- package/components/Chart/utils.js +68 -64
- package/components/CheckBox/StyledCheckBox.js +2 -2
- package/components/DataChart/DataChart.js +114 -68
- package/components/DataChart/Detail.js +55 -21
- package/components/DataChart/XAxis.js +33 -6
- package/components/DataChart/XGuide.js +14 -1
- package/components/DataChart/YAxis.js +58 -39
- package/components/DataChart/YGuide.js +13 -10
- package/components/DataChart/index.d.ts +2 -0
- package/components/DataChart/propTypes.js +3 -1
- package/components/DataChart/stories/Horizontal.js +63 -0
- package/components/DataChart/utils.js +27 -2
- package/components/DataFilter/DataFilter.js +25 -2
- package/components/DataSort/DataSort.js +1 -1
- package/components/DataTable/buildState.js +6 -1
- package/components/DateInput/DateInput.js +22 -2
- package/components/Footer/stories/DoubleFooter.js +6 -2
- package/components/Footer/stories/Sitemap.js +0 -2
- package/components/Footer/stories/Social.js +2 -2
- package/components/Layer/LayerContainer.js +1 -1
- package/components/Menu/Menu.js +9 -6
- package/components/Meter/Bar.js +5 -2
- package/components/Meter/Meter.js +11 -3
- package/components/Meter/StyledMeter.js +3 -1
- package/components/Meter/index.d.ts +1 -0
- package/components/Meter/propTypes.js +1 -0
- package/components/Meter/stories/ReverseBar.js +29 -0
- package/components/Pagination/Pagination.js +3 -1
- package/components/Select/EmptySearchOption.js +3 -9
- package/components/Select/Select.js +1 -1
- package/components/Select/SelectContainer.js +4 -4
- package/components/Select/index.d.ts +1 -1
- package/components/Select/propTypes.js +1 -1
- package/components/SelectMultiple/SelectMultipleContainer.js +4 -4
- package/components/Text/Text.js +3 -1
- package/es6/all/stories/CustomThemed/ExtendTheme.tsx +2 -4
- package/es6/components/Chart/Chart.js +20 -20
- package/es6/components/Chart/calcs.js +164 -93
- package/es6/components/Chart/index.d.ts +10 -4
- package/es6/components/Chart/propTypes.js +10 -1
- package/es6/components/Chart/stories/{Vertical.js → Horizontal.js} +32 -4
- package/es6/components/Chart/utils.js +66 -63
- package/es6/components/CheckBox/StyledCheckBox.js +2 -2
- package/es6/components/DataChart/DataChart.js +115 -69
- package/es6/components/DataChart/Detail.js +55 -21
- package/es6/components/DataChart/XAxis.js +33 -6
- package/es6/components/DataChart/XGuide.js +14 -1
- package/es6/components/DataChart/YAxis.js +59 -40
- package/es6/components/DataChart/YGuide.js +13 -10
- package/es6/components/DataChart/index.d.ts +2 -0
- package/es6/components/DataChart/propTypes.js +3 -1
- package/es6/components/DataChart/stories/Horizontal.js +57 -0
- package/es6/components/DataChart/utils.js +22 -0
- package/es6/components/DataFilter/DataFilter.js +27 -3
- package/es6/components/DataSort/DataSort.js +1 -1
- package/es6/components/DataTable/buildState.js +6 -1
- package/es6/components/DateInput/DateInput.js +22 -2
- package/es6/components/Footer/stories/DoubleFooter.js +6 -2
- package/es6/components/Footer/stories/Sitemap.js +0 -2
- package/es6/components/Footer/stories/Social.js +2 -2
- package/es6/components/Layer/LayerContainer.js +1 -1
- package/es6/components/Menu/Menu.js +9 -6
- package/es6/components/Meter/Bar.js +5 -2
- package/es6/components/Meter/Meter.js +12 -4
- package/es6/components/Meter/StyledMeter.js +3 -1
- package/es6/components/Meter/index.d.ts +1 -0
- package/es6/components/Meter/propTypes.js +1 -0
- package/es6/components/Meter/stories/ReverseBar.js +23 -0
- package/es6/components/Pagination/Pagination.js +3 -1
- package/es6/components/Select/EmptySearchOption.js +3 -9
- package/es6/components/Select/Select.js +1 -1
- package/es6/components/Select/SelectContainer.js +4 -4
- package/es6/components/Select/index.d.ts +1 -1
- package/es6/components/Select/propTypes.js +1 -1
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +4 -4
- package/es6/components/Text/Text.js +3 -1
- package/es6/themes/base.d.ts +9 -1
- package/es6/themes/base.js +4 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +39 -39
- package/themes/base.d.ts +9 -1
- package/themes/base.js +4 -0
package/components/Meter/Bar.js
CHANGED
|
@@ -8,7 +8,7 @@ var _defaultProps = require("../../default-props");
|
|
|
8
8
|
var _utils = require("../../utils");
|
|
9
9
|
var _StyledMeter = require("./StyledMeter");
|
|
10
10
|
var _utils2 = require("./utils");
|
|
11
|
-
var _excluded = ["background", "max", "round", "size", "thickness", "direction", "values"],
|
|
11
|
+
var _excluded = ["background", "max", "round", "size", "thickness", "direction", "values", "reverse"],
|
|
12
12
|
_excluded2 = ["color", "highlight", "label", "onHover", "value"];
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -22,6 +22,7 @@ var Bar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
22
22
|
thicknessProp = props.thickness,
|
|
23
23
|
direction = props.direction,
|
|
24
24
|
values = props.values,
|
|
25
|
+
reverse = props.reverse,
|
|
25
26
|
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
26
27
|
var theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _defaultProps.defaultProps.theme;
|
|
27
28
|
var length = size === 'full' ? 288 : (0, _utils.parseMetricToNum)(theme.global.size[size] || size);
|
|
@@ -90,7 +91,9 @@ var Bar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
90
91
|
round: round ? {
|
|
91
92
|
size: thicknessProp
|
|
92
93
|
} : undefined
|
|
93
|
-
}, rest
|
|
94
|
+
}, rest, {
|
|
95
|
+
reverse: reverse
|
|
96
|
+
}), /*#__PURE__*/_react["default"].createElement("path", _extends({
|
|
94
97
|
d: backgroundPath,
|
|
95
98
|
fill: "none"
|
|
96
99
|
}, (0, _utils2.strokeProps)(background, theme), {
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.Meter = void 0;
|
|
5
5
|
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _styledComponents = require("styled-components");
|
|
7
|
+
var _defaultProps = require("../../default-props");
|
|
6
8
|
var _Bar = require("./Bar");
|
|
7
9
|
var _Circle = require("./Circle");
|
|
8
10
|
var _propTypes = require("./propTypes");
|
|
9
|
-
var _excluded = ["background", "color", "direction", "size", "thickness", "type", "value", "values"];
|
|
11
|
+
var _excluded = ["background", "color", "direction", "size", "thickness", "type", "reverse", "value", "values"];
|
|
10
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
@@ -36,9 +38,12 @@ var Meter = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
36
38
|
thickness = _ref$thickness === void 0 ? 'medium' : _ref$thickness,
|
|
37
39
|
_ref$type = _ref.type,
|
|
38
40
|
type = _ref$type === void 0 ? 'bar' : _ref$type,
|
|
41
|
+
reverseProp = _ref.reverse,
|
|
39
42
|
value = _ref.value,
|
|
40
43
|
valuesProp = _ref.values,
|
|
41
44
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
45
|
+
var theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _defaultProps.defaultProps.theme;
|
|
46
|
+
|
|
42
47
|
// normalize values to an array of objects
|
|
43
48
|
var values = (0, _react.useMemo)(function () {
|
|
44
49
|
if (valuesProp) return valuesProp;
|
|
@@ -48,6 +53,7 @@ var Meter = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
48
53
|
}];
|
|
49
54
|
return [];
|
|
50
55
|
}, [color, value, valuesProp]);
|
|
56
|
+
var reverse = direction === 'horizontal' && (theme.dir === 'rtl' || reverseProp) && !(theme.dir === 'rtl' && reverseProp);
|
|
51
57
|
var memoizedMax = (0, _react.useMemo)(function () {
|
|
52
58
|
return deriveMax(values);
|
|
53
59
|
}, [values]);
|
|
@@ -60,7 +66,8 @@ var Meter = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
60
66
|
size: size,
|
|
61
67
|
thickness: thickness,
|
|
62
68
|
background: background,
|
|
63
|
-
direction: direction
|
|
69
|
+
direction: direction,
|
|
70
|
+
reverse: reverse
|
|
64
71
|
}, rest));
|
|
65
72
|
} else if (type === 'circle' || type === 'pie' || type === 'semicircle') {
|
|
66
73
|
content = /*#__PURE__*/_react["default"].createElement(_Circle.Circle, _extends({
|
|
@@ -70,7 +77,8 @@ var Meter = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
70
77
|
size: size,
|
|
71
78
|
thickness: thickness,
|
|
72
79
|
type: type,
|
|
73
|
-
background: background
|
|
80
|
+
background: background,
|
|
81
|
+
reverse: reverse
|
|
74
82
|
}, rest));
|
|
75
83
|
}
|
|
76
84
|
return content;
|
|
@@ -15,7 +15,9 @@ var roundStyle = (0, _styledComponents.css)(["border-radius:", ";"], function (p
|
|
|
15
15
|
var StyledMeter = _styledComponents["default"].svg.withConfig({
|
|
16
16
|
displayName: "StyledMeter",
|
|
17
17
|
componentId: "sc-nsxarx-0"
|
|
18
|
-
})(["max-width:100%;overflow:hidden;", " ", " path{transition:stroke 0.3s,stroke-width 0.3s;}", ";"],
|
|
18
|
+
})(["max-width:100%;overflow:hidden;", " ", " ", " path{transition:stroke 0.3s,stroke-width 0.3s;}", ";"], function (props) {
|
|
19
|
+
return props.reverse && (0, _styledComponents.css)(["transform:scale(-1,1);"]);
|
|
20
|
+
}, _utils.genericStyles, function (props) {
|
|
19
21
|
return props.round && roundStyle;
|
|
20
22
|
}, function (props) {
|
|
21
23
|
return props.theme.meter && props.theme.meter.extend;
|
|
@@ -16,6 +16,7 @@ export interface MeterProps {
|
|
|
16
16
|
gridArea?: GridAreaType;
|
|
17
17
|
margin?: MarginType;
|
|
18
18
|
max?: number;
|
|
19
|
+
reverse?: boolean;
|
|
19
20
|
round?: boolean;
|
|
20
21
|
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'full' | string;
|
|
21
22
|
thickness?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string;
|
|
@@ -15,6 +15,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
15
15
|
})]),
|
|
16
16
|
color: _propTypes["default"].string,
|
|
17
17
|
max: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].string]),
|
|
18
|
+
reverse: _propTypes["default"].bool,
|
|
18
19
|
round: _propTypes["default"].bool,
|
|
19
20
|
size: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'full']), _propTypes["default"].string]),
|
|
20
21
|
thickness: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge']), _propTypes["default"].string]),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.ReverseBar = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _grommet = require("grommet");
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
var ReverseBar = function ReverseBar() {
|
|
9
|
+
var value = 30;
|
|
10
|
+
return (
|
|
11
|
+
/*#__PURE__*/
|
|
12
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
13
|
+
// <Grommet theme={grommet}>
|
|
14
|
+
_react["default"].createElement(_grommet.Box, {
|
|
15
|
+
align: "center",
|
|
16
|
+
pad: "large"
|
|
17
|
+
}, /*#__PURE__*/_react["default"].createElement(_grommet.Meter, {
|
|
18
|
+
type: "bar",
|
|
19
|
+
reverse: true,
|
|
20
|
+
value: value
|
|
21
|
+
}))
|
|
22
|
+
// </Grommet>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
exports.ReverseBar = ReverseBar;
|
|
26
|
+
var _default = {
|
|
27
|
+
title: 'Visualizations/Meter/ReverseBar'
|
|
28
|
+
};
|
|
29
|
+
exports["default"] = _default;
|
|
@@ -57,7 +57,9 @@ var Pagination = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
57
57
|
activePage = _useState[0],
|
|
58
58
|
setActivePage = _useState[1];
|
|
59
59
|
(0, _react.useEffect)(function () {
|
|
60
|
-
|
|
60
|
+
setActivePage(page);
|
|
61
|
+
var pageEvent = new Event('pagechange');
|
|
62
|
+
window.dispatchEvent(pageEvent);
|
|
61
63
|
}, [page]);
|
|
62
64
|
(0, _react.useEffect)(function () {
|
|
63
65
|
// if we are getting the step or page from outside the view,
|
|
@@ -5,22 +5,16 @@ exports.EmptySearchOption = void 0;
|
|
|
5
5
|
var _react = _interopRequireDefault(require("react"));
|
|
6
6
|
var _Box = require("../Box");
|
|
7
7
|
var _Text = require("../Text");
|
|
8
|
-
var _StyledSelect = require("./StyledSelect");
|
|
9
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
9
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
11
10
|
var EmptySearchOption = function EmptySearchOption(_ref) {
|
|
11
|
+
var _theme$select, _theme$select$emptySe, _theme$select2, _theme$select2$emptyS, _theme$select3, _theme$select3$option;
|
|
12
12
|
var emptySearchMessage = _ref.emptySearchMessage,
|
|
13
13
|
selectOptionsStyle = _ref.selectOptionsStyle,
|
|
14
14
|
theme = _ref.theme;
|
|
15
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
16
|
-
key: "search_empty",
|
|
17
|
-
tabIndex: "0",
|
|
18
|
-
role: "menuitem",
|
|
19
|
-
hoverIndicator: "background",
|
|
20
|
-
disabled: true
|
|
21
|
-
}, /*#__PURE__*/_react["default"].createElement(_Box.Box, selectOptionsStyle, /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({
|
|
15
|
+
return /*#__PURE__*/_react["default"].createElement(_Box.Box, (theme == null ? void 0 : (_theme$select = theme.select) == null ? void 0 : (_theme$select$emptySe = _theme$select.emptySearchMessage) == null ? void 0 : _theme$select$emptySe.container) || selectOptionsStyle, /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({
|
|
22
16
|
"aria-live": "polite",
|
|
23
17
|
role: "alert"
|
|
24
|
-
}, theme.select.
|
|
18
|
+
}, (theme == null ? void 0 : (_theme$select2 = theme.select) == null ? void 0 : (_theme$select2$emptyS = _theme$select2.emptySearchMessage) == null ? void 0 : _theme$select2$emptyS.text) || ((_theme$select3 = theme.select) == null ? void 0 : (_theme$select3$option = _theme$select3.options) == null ? void 0 : _theme$select3$option.text)), emptySearchMessage));
|
|
25
19
|
};
|
|
26
20
|
exports.EmptySearchOption = EmptySearchOption;
|
|
@@ -223,7 +223,7 @@ var Select = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
223
223
|
// element to show, trumps inputValue
|
|
224
224
|
var selectValue = (0, _react.useMemo)(function () {
|
|
225
225
|
if (valueLabel instanceof Function) {
|
|
226
|
-
if (value) return valueLabel(value);
|
|
226
|
+
if (value || value === 0 || value === false) return valueLabel(value);
|
|
227
227
|
} else if (valueLabel) return valueLabel;else if ( /*#__PURE__*/_react["default"].isValidElement(value)) return value; // deprecated
|
|
228
228
|
return undefined;
|
|
229
229
|
}, [value, valueLabel]);
|
|
@@ -301,7 +301,7 @@ var SelectContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
|
|
|
301
301
|
return setActiveIndex(-1);
|
|
302
302
|
},
|
|
303
303
|
theme: theme
|
|
304
|
-
}), /*#__PURE__*/_react["default"].createElement(_StyledSelect.OptionsContainer, {
|
|
304
|
+
}), options.length > 0 ? /*#__PURE__*/_react["default"].createElement(_StyledSelect.OptionsContainer, {
|
|
305
305
|
role: "listbox",
|
|
306
306
|
tabIndex: "-1",
|
|
307
307
|
ref: optionsRef,
|
|
@@ -309,7 +309,7 @@ var SelectContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
|
|
|
309
309
|
onMouseMove: function onMouseMove() {
|
|
310
310
|
return setKeyboardNavigation(false);
|
|
311
311
|
}
|
|
312
|
-
},
|
|
312
|
+
}, /*#__PURE__*/_react["default"].createElement(_InfiniteScroll.InfiniteScroll, {
|
|
313
313
|
items: options,
|
|
314
314
|
step: theme.select.step,
|
|
315
315
|
onMore: onMore,
|
|
@@ -371,11 +371,11 @@ var SelectContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref)
|
|
|
371
371
|
onClick: !optionDisabled ? selectOption(index) : undefined,
|
|
372
372
|
textComponent: textComponent
|
|
373
373
|
}, child);
|
|
374
|
-
}) : /*#__PURE__*/_react["default"].createElement(_EmptySearchOption.EmptySearchOption, {
|
|
374
|
+
})) : /*#__PURE__*/_react["default"].createElement(_EmptySearchOption.EmptySearchOption, {
|
|
375
375
|
emptySearchMessage: emptySearchMessage,
|
|
376
376
|
selectOptionsStyle: selectOptionsStyle,
|
|
377
377
|
theme: theme
|
|
378
|
-
})
|
|
378
|
+
}), shouldShowClearButton('bottom') && /*#__PURE__*/_react["default"].createElement(ClearButton, {
|
|
379
379
|
ref: clearRef,
|
|
380
380
|
clear: clear,
|
|
381
381
|
name: name,
|
|
@@ -42,7 +42,7 @@ export interface BasicSelectProps {
|
|
|
42
42
|
placeholder?: PlaceHolderType;
|
|
43
43
|
plain?: boolean;
|
|
44
44
|
replace?: boolean;
|
|
45
|
-
searchPlaceholder?:
|
|
45
|
+
searchPlaceholder?: PlaceHolderType;
|
|
46
46
|
size?: 'small' | 'medium' | 'large' | 'xlarge' | string;
|
|
47
47
|
valueKey?:
|
|
48
48
|
| string
|
|
@@ -37,7 +37,7 @@ var genericSelectProps = _extends({}, _generalPropTypes.genericProps, {
|
|
|
37
37
|
placeholder: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].element, _propTypes["default"].node]),
|
|
38
38
|
plain: _propTypes["default"].bool,
|
|
39
39
|
replace: _propTypes["default"].bool,
|
|
40
|
-
searchPlaceholder: _propTypes["default"].string,
|
|
40
|
+
searchPlaceholder: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].element, _propTypes["default"].node]),
|
|
41
41
|
size: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['small', 'medium', 'large', 'xlarge']), _propTypes["default"].string]),
|
|
42
42
|
valueLabel: _propTypes["default"].oneOfType([_propTypes["default"].node, _propTypes["default"].func]),
|
|
43
43
|
valueKey: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].func, _propTypes["default"].shape({
|
|
@@ -318,7 +318,7 @@ var SelectMultipleContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
318
318
|
setActiveIndex(-1);
|
|
319
319
|
onSearch(nextSearch);
|
|
320
320
|
}
|
|
321
|
-
}))), helpContent, /*#__PURE__*/_react["default"].createElement(_StyledSelect.OptionsContainer, {
|
|
321
|
+
}))), helpContent, options.length > 0 ? /*#__PURE__*/_react["default"].createElement(_StyledSelect.OptionsContainer, {
|
|
322
322
|
role: "listbox",
|
|
323
323
|
tabIndex: "0",
|
|
324
324
|
ref: optionsRef,
|
|
@@ -327,7 +327,7 @@ var SelectMultipleContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
327
327
|
return setKeyboardNavigation(false);
|
|
328
328
|
},
|
|
329
329
|
"aria-activedescendant": optionsRef == null ? void 0 : (_optionsRef$current = optionsRef.current) == null ? void 0 : _optionsRef$current.children[activeIndex]
|
|
330
|
-
},
|
|
330
|
+
}, /*#__PURE__*/_react["default"].createElement(_InfiniteScroll.InfiniteScroll, {
|
|
331
331
|
items: options,
|
|
332
332
|
step: theme.select.step,
|
|
333
333
|
onMore: onMore,
|
|
@@ -420,11 +420,11 @@ var SelectMultipleContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
420
420
|
},
|
|
421
421
|
textComponent: textComponent
|
|
422
422
|
}, child);
|
|
423
|
-
}) : /*#__PURE__*/_react["default"].createElement(_EmptySearchOption.EmptySearchOption, {
|
|
423
|
+
})) : /*#__PURE__*/_react["default"].createElement(_EmptySearchOption.EmptySearchOption, {
|
|
424
424
|
emptySearchMessage: emptySearchMessage,
|
|
425
425
|
selectOptionsStyle: selectOptionsStyle,
|
|
426
426
|
theme: theme
|
|
427
|
-
})
|
|
427
|
+
}), usingKeyboard && showA11yLimit && /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
428
428
|
height: "0px",
|
|
429
429
|
width: "0px",
|
|
430
430
|
overflow: "hidden"
|
package/components/Text/Text.js
CHANGED
|
@@ -46,9 +46,11 @@ var Text = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
window.addEventListener('resize', updateTip);
|
|
49
|
+
window.addEventListener('pagechange', updateTip);
|
|
49
50
|
updateTip();
|
|
50
51
|
return function () {
|
|
51
|
-
|
|
52
|
+
window.removeEventListener('resize', updateTip);
|
|
53
|
+
window.removeEventListener('pagechange', updateTip);
|
|
52
54
|
};
|
|
53
55
|
}, [textRef, truncate]);
|
|
54
56
|
if (skeleton) {
|
|
@@ -13,7 +13,7 @@ const custom: ThemeType = {
|
|
|
13
13
|
},
|
|
14
14
|
anchor: {
|
|
15
15
|
extend: (props) => css`
|
|
16
|
-
color: ${props
|
|
16
|
+
color: ${props['href'] ? 'green' : 'red'};
|
|
17
17
|
`,
|
|
18
18
|
},
|
|
19
19
|
button: {
|
|
@@ -44,7 +44,7 @@ const custom: ThemeType = {
|
|
|
44
44
|
|
|
45
45
|
// Type annotations can only be used in TypeScript files.
|
|
46
46
|
// Remove ': TReact.FC' is you are not using TypeScript.
|
|
47
|
-
const
|
|
47
|
+
export const Extend = () => {
|
|
48
48
|
return (
|
|
49
49
|
<Grommet theme={custom}>
|
|
50
50
|
<Box pad="small" gap="medium" width="medium">
|
|
@@ -62,8 +62,6 @@ const ExtendTheme: React.FC = () => {
|
|
|
62
62
|
);
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
export const Extend = () => <ExtendTheme />;
|
|
66
|
-
|
|
67
65
|
export default {
|
|
68
66
|
title: 'Utilities/Theme/Custom Themed/Extend',
|
|
69
67
|
};
|
|
@@ -24,7 +24,8 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24
24
|
boundsProp = _ref.bounds,
|
|
25
25
|
color = _ref.color,
|
|
26
26
|
dash = _ref.dash,
|
|
27
|
-
direction = _ref.direction,
|
|
27
|
+
_ref$direction = _ref.direction,
|
|
28
|
+
direction = _ref$direction === void 0 ? 'vertical' : _ref$direction,
|
|
28
29
|
gap = _ref.gap,
|
|
29
30
|
id = _ref.id,
|
|
30
31
|
onClick = _ref.onClick,
|
|
@@ -36,8 +37,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
36
37
|
pattern = _ref.pattern,
|
|
37
38
|
point = _ref.point,
|
|
38
39
|
round = _ref.round,
|
|
39
|
-
|
|
40
|
-
sizeProp = _ref$size === void 0 ? defaultSize : _ref$size,
|
|
40
|
+
sizeProp = _ref.size,
|
|
41
41
|
_ref$thickness = _ref.thickness,
|
|
42
42
|
thickness = _ref$thickness === void 0 ? 'medium' : _ref$thickness,
|
|
43
43
|
_ref$type = _ref.type,
|
|
@@ -50,11 +50,11 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
50
50
|
var values = useMemo(function () {
|
|
51
51
|
return normalizeValues(valuesProp);
|
|
52
52
|
}, [valuesProp]);
|
|
53
|
-
var
|
|
54
|
-
return direction === '
|
|
53
|
+
var horizontal = useMemo(function () {
|
|
54
|
+
return direction === 'horizontal';
|
|
55
55
|
}, [direction]);
|
|
56
56
|
|
|
57
|
-
// bounds is { x: { min, max }, y: { min, max } }
|
|
57
|
+
// bounds is { x: { min, max }, y: { min, max } }
|
|
58
58
|
var bounds = useMemo(function () {
|
|
59
59
|
return normalizeBounds(boundsProp, values, direction);
|
|
60
60
|
}, [direction, boundsProp, values]);
|
|
@@ -120,7 +120,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
120
120
|
|
|
121
121
|
// autoSize is how wide or tall we'd pefer based on the number of values
|
|
122
122
|
var autoSize = strokeWidth * values.length + (values.length - 1) * gapWidth;
|
|
123
|
-
var sizeWidth = typeof sizeProp === 'string' ? sizeProp : sizeProp.width || defaultSize.width;
|
|
123
|
+
var sizeWidth = typeof sizeProp === 'string' ? sizeProp : (sizeProp == null ? void 0 : sizeProp.width) || horizontal && defaultSize.height || defaultSize.width;
|
|
124
124
|
var width;
|
|
125
125
|
if (sizeWidth === 'full' || sizeWidth === 'fill') {
|
|
126
126
|
width = containerSize[0];
|
|
@@ -129,7 +129,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
129
129
|
} else {
|
|
130
130
|
width = parseMetricToNum(theme.global.size[sizeWidth] || sizeWidth);
|
|
131
131
|
}
|
|
132
|
-
var sizeHeight = typeof sizeProp === 'string' ? sizeProp : sizeProp.height || defaultSize.height;
|
|
132
|
+
var sizeHeight = typeof sizeProp === 'string' ? sizeProp : (sizeProp == null ? void 0 : sizeProp.height) || horizontal && defaultSize.width || defaultSize.height;
|
|
133
133
|
var height;
|
|
134
134
|
if (sizeHeight === 'full' || sizeHeight === 'fill') {
|
|
135
135
|
height = containerSize[1];
|
|
@@ -142,7 +142,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
142
142
|
width: width,
|
|
143
143
|
height: height
|
|
144
144
|
};
|
|
145
|
-
}, [containerSize, gap, sizeProp, strokeWidth, theme.global.edgeSize, theme.global.size, values]);
|
|
145
|
+
}, [containerSize, gap, horizontal, sizeProp, strokeWidth, theme.global.edgeSize, theme.global.size, values]);
|
|
146
146
|
|
|
147
147
|
// scale is { x, y }
|
|
148
148
|
var scale = useMemo(function () {
|
|
@@ -193,7 +193,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
193
193
|
// rendering helpers, to make rendering code easier to understand
|
|
194
194
|
|
|
195
195
|
var valueCoords = function valueCoords(x, y) {
|
|
196
|
-
return
|
|
196
|
+
return horizontal ? [y, x] : [x, y];
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
// Converts values to drawing coordinates.
|
|
@@ -201,8 +201,8 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
201
201
|
var valueToCoordinate = function valueToCoordinate(xValue, yValue) {
|
|
202
202
|
var y = (yValue - bounds.y.min) * scale.y + inset.top;
|
|
203
203
|
return [(xValue - bounds.x.min) * scale.x + inset.left,
|
|
204
|
-
//
|
|
205
|
-
|
|
204
|
+
// horizontal grows y top down, vertical grows y bottom up
|
|
205
|
+
horizontal ? y : size.height - y];
|
|
206
206
|
};
|
|
207
207
|
var useGradient = color && Array.isArray(color);
|
|
208
208
|
var patternId;
|
|
@@ -225,10 +225,10 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
225
225
|
valueRest = _objectWithoutPropertiesLoose(valueArg, _excluded2);
|
|
226
226
|
var key = "p-" + index;
|
|
227
227
|
// Math.min/max are to handle negative values
|
|
228
|
-
var _valueCoords = valueCoords(value[0], value.length === 2 ? Math.min(Math.max(0,
|
|
228
|
+
var _valueCoords = valueCoords(value[0], value.length === 2 ? Math.min(Math.max(0, horizontal ? bounds.x.min : bounds.y.min), value[1]) : Math.min(value[1], value[2])),
|
|
229
229
|
startX = _valueCoords[0],
|
|
230
230
|
startY = _valueCoords[1];
|
|
231
|
-
var _valueCoords2 = valueCoords(value[0], value.length === 2 ? Math.max(Math.min(0,
|
|
231
|
+
var _valueCoords2 = valueCoords(value[0], value.length === 2 ? Math.max(Math.min(0, horizontal ? bounds.x.max : bounds.y.max), value[1]) : Math.max(value[1], value[2])),
|
|
232
232
|
endX = _valueCoords2[0],
|
|
233
233
|
endY = _valueCoords2[1];
|
|
234
234
|
var d = "M " + valueToCoordinate(startX, startY).join(',') + (" L " + valueToCoordinate(endX, endY).join(','));
|
|
@@ -331,7 +331,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
331
331
|
var value = _ref8.value;
|
|
332
332
|
var _valueCoords6 = valueCoords(value[0],
|
|
333
333
|
// Math.max() is to account for value[1] being negative
|
|
334
|
-
value.length === 2 ? Math.max(0,
|
|
334
|
+
value.length === 2 ? Math.max(0, horizontal ? bounds.x.min : bounds.y.min) : value[1]),
|
|
335
335
|
x = _valueCoords6[0],
|
|
336
336
|
y = _valueCoords6[1];
|
|
337
337
|
d += " L " + valueToCoordinate(x, y).join(',');
|
|
@@ -468,7 +468,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
468
468
|
}, contents);
|
|
469
469
|
var defs = [];
|
|
470
470
|
var gradientRect;
|
|
471
|
-
if (useGradient && size.height) {
|
|
471
|
+
if (useGradient && (horizontal && size.width || size.height)) {
|
|
472
472
|
var uniqueGradientId = color.map(function (element) {
|
|
473
473
|
return element.color;
|
|
474
474
|
}).join('-');
|
|
@@ -479,16 +479,16 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
479
479
|
id: gradientId,
|
|
480
480
|
x1: 0,
|
|
481
481
|
y1: 0,
|
|
482
|
-
x2: 0,
|
|
483
|
-
y2: 1
|
|
482
|
+
x2: horizontal ? 1 : 0,
|
|
483
|
+
y2: horizontal ? 0 : 1
|
|
484
484
|
}, color.slice(0).sort(function (c1, c2) {
|
|
485
|
-
return c2.value - c1.value;
|
|
485
|
+
return horizontal ? c1.value - c2.value : c2.value - c1.value;
|
|
486
486
|
}).map(function (_ref10) {
|
|
487
487
|
var value = _ref10.value,
|
|
488
488
|
gradientColor = _ref10.color;
|
|
489
489
|
return /*#__PURE__*/React.createElement("stop", {
|
|
490
490
|
key: value,
|
|
491
|
-
offset: (size.height - (value - bounds.y.min) * scale.y) / size.height,
|
|
491
|
+
offset: horizontal ? (value - bounds.x.min) * scale.x / size.width : (size.height - (value - bounds.y.min) * scale.y) / size.height,
|
|
492
492
|
stopColor: normalizeColor(gradientColor, theme)
|
|
493
493
|
});
|
|
494
494
|
})));
|