grommet 2.48.0 → 2.50.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/AccordionPanel/AccordionPanel.js +3 -6
- package/components/Anchor/StyledAnchor.js +1 -1
- package/components/Box/StyledBox.js +1 -1
- package/components/Button/BusyAnimation.js +5 -1
- package/components/Button/Button.js +3 -1
- package/components/Calendar/Calendar.js +7 -10
- package/components/Cards/Cards.js +3 -4
- package/components/Chart/Chart.js +11 -9
- package/components/Chart/calcs.js +21 -13
- package/components/CheckBox/CheckBox.js +1 -1
- package/components/CheckBoxGroup/CheckBoxGroup.js +2 -3
- package/components/Data/Data.js +5 -1
- package/components/Data/DataForm.js +6 -4
- package/components/Data/stories/Infinite.stories.js +10 -15
- package/components/Data/stories/OnSelect.stories.js +10 -15
- package/components/Data/stories/SpaceX.stories.js +10 -15
- package/components/Data/stories/StarWars.stories.js +6 -8
- package/components/DataChart/DataChart.js +14 -12
- package/components/DataChart/Detail.js +2 -2
- package/components/DataChart/Legend.js +8 -9
- package/components/DataChart/utils.js +15 -8
- package/components/DataFilter/DataFilter.js +10 -9
- package/components/DataFilters/DataFilters.js +9 -10
- package/components/DataSearch/DataSearch.js +5 -4
- package/components/DataSort/DataSort.js +4 -3
- package/components/DataSummary/DataSummary.js +6 -6
- package/components/DataTable/ExpanderCell.js +6 -3
- package/components/DataTable/Footer.js +6 -3
- package/components/DataTable/Header.js +6 -3
- package/components/DataTable/Resizer.js +22 -8
- package/components/DataTable/Searcher.js +5 -7
- package/components/DataTable/stories/ResizePinned.stories.js +321 -0
- package/components/DataTable/stories/SpaceX.stories.js +15 -16
- package/components/DataTable/stories/SpaceXUngrouped.stories.js +7 -7
- package/components/DataTable/stories/rowDetails.stories.js +6 -8
- package/components/DataTableColumns/DataTableColumns.js +24 -22
- package/components/DateInput/DateInput.js +7 -6
- package/components/Distribution/Distribution.js +8 -5
- package/components/FileInput/FileInput.js +41 -36
- package/components/Footer/Footer.js +5 -1
- package/components/Header/Header.js +2 -2
- package/components/Layer/Layer.js +10 -5
- package/components/Layer/StyledLayer.js +2 -2
- package/components/List/List.js +5 -4
- package/components/MaskedInput/MaskedInput.js +6 -1
- package/components/Menu/Menu.js +13 -1
- package/components/Meter/Bar.js +38 -17
- package/components/Meter/Circle.js +31 -46
- package/components/Meter/stories/Circle.stories.js +6 -8
- package/components/Meter/utils.js +15 -1
- package/components/Nav/Nav.js +5 -1
- package/components/Notification/Notification.js +6 -8
- package/components/Pagination/Pagination.js +5 -10
- package/components/Pagination/PaginationStep.js +2 -1
- package/components/Paragraph/ParagraphSkeleton.js +2 -1
- package/components/RadioButton/RadioButton.js +1 -1
- package/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
- package/components/RangeSelector/RangeSelector.js +2 -6
- package/components/Select/SelectContainer.js +2 -1
- package/components/SelectMultiple/SelectMultipleContainer.js +8 -4
- package/components/SelectMultiple/SelectMultipleValue.js +5 -7
- package/components/SelectMultiple/SelectionSummary.js +7 -8
- package/components/Sidebar/Sidebar.js +6 -3
- package/components/Spinner/Spinner.js +7 -4
- package/components/StarRating/StarRating.js +8 -5
- package/components/Tab/Tab.js +2 -1
- package/components/Table/StyledTable.js +2 -2
- package/components/Tabs/Tabs.js +8 -12
- package/components/Tag/StyledTag.js +9 -1
- package/components/TextInput/CopyButton.js +3 -2
- package/components/TextInput/TextInput.js +5 -0
- package/components/ThumbsRating/ThumbsRating.js +15 -10
- package/components/Toolbar/Toolbar.js +15 -11
- package/components/Video/Video.js +3 -5
- package/es6/components/AccordionPanel/AccordionPanel.js +3 -6
- package/es6/components/Anchor/StyledAnchor.js +2 -2
- package/es6/components/Box/StyledBox.js +1 -1
- package/es6/components/Button/BusyAnimation.js +5 -1
- package/es6/components/Button/Button.js +3 -1
- package/es6/components/Calendar/Calendar.js +7 -10
- package/es6/components/Cards/Cards.js +3 -4
- package/es6/components/Chart/Chart.js +11 -9
- package/es6/components/Chart/calcs.js +21 -13
- package/es6/components/CheckBox/CheckBox.js +1 -1
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +2 -3
- package/es6/components/Data/Data.js +5 -1
- package/es6/components/Data/DataForm.js +6 -4
- package/es6/components/Data/stories/Infinite.stories.js +10 -15
- package/es6/components/Data/stories/OnSelect.stories.js +10 -15
- package/es6/components/Data/stories/SpaceX.stories.js +10 -15
- package/es6/components/Data/stories/StarWars.stories.js +6 -8
- package/es6/components/DataChart/DataChart.js +14 -12
- package/es6/components/DataChart/Detail.js +2 -2
- package/es6/components/DataChart/Legend.js +8 -9
- package/es6/components/DataChart/utils.js +15 -8
- package/es6/components/DataFilter/DataFilter.js +10 -9
- package/es6/components/DataFilters/DataFilters.js +9 -10
- package/es6/components/DataSearch/DataSearch.js +5 -4
- package/es6/components/DataSort/DataSort.js +4 -3
- package/es6/components/DataSummary/DataSummary.js +6 -6
- package/es6/components/DataTable/ExpanderCell.js +4 -1
- package/es6/components/DataTable/Footer.js +4 -1
- package/es6/components/DataTable/Header.js +6 -3
- package/es6/components/DataTable/Resizer.js +22 -8
- package/es6/components/DataTable/Searcher.js +5 -7
- package/es6/components/DataTable/stories/ResizePinned.stories.js +316 -0
- package/es6/components/DataTable/stories/SpaceX.stories.js +15 -16
- package/es6/components/DataTable/stories/SpaceXUngrouped.stories.js +7 -7
- package/es6/components/DataTable/stories/rowDetails.stories.js +6 -8
- package/es6/components/DataTableColumns/DataTableColumns.js +23 -21
- package/es6/components/DateInput/DateInput.js +6 -5
- package/es6/components/Distribution/Distribution.js +8 -5
- package/es6/components/FileInput/FileInput.js +42 -37
- package/es6/components/Footer/Footer.js +5 -1
- package/es6/components/Header/Header.js +2 -2
- package/es6/components/Layer/Layer.js +10 -5
- package/es6/components/Layer/StyledLayer.js +3 -3
- package/es6/components/List/List.js +5 -4
- package/es6/components/MaskedInput/MaskedInput.js +6 -1
- package/es6/components/Menu/Menu.js +13 -1
- package/es6/components/Meter/Bar.js +39 -18
- package/es6/components/Meter/Circle.js +33 -48
- package/es6/components/Meter/stories/Circle.stories.js +7 -9
- package/es6/components/Meter/utils.js +14 -0
- package/es6/components/Nav/Nav.js +5 -1
- package/es6/components/Notification/Notification.js +6 -8
- package/es6/components/Pagination/Pagination.js +5 -10
- package/es6/components/Pagination/PaginationStep.js +2 -1
- package/es6/components/Paragraph/ParagraphSkeleton.js +2 -1
- package/es6/components/RadioButton/RadioButton.js +1 -1
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
- package/es6/components/RangeSelector/RangeSelector.js +2 -6
- package/es6/components/Select/SelectContainer.js +2 -1
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +8 -4
- package/es6/components/SelectMultiple/SelectMultipleValue.js +5 -7
- package/es6/components/SelectMultiple/SelectionSummary.js +7 -8
- package/es6/components/Sidebar/Sidebar.js +6 -3
- package/es6/components/Spinner/Spinner.js +6 -3
- package/es6/components/StarRating/StarRating.js +8 -5
- package/es6/components/Tab/Tab.js +2 -1
- package/es6/components/Table/StyledTable.js +2 -2
- package/es6/components/Tabs/Tabs.js +8 -12
- package/es6/components/Tag/StyledTag.js +10 -2
- package/es6/components/TextInput/CopyButton.js +3 -2
- package/es6/components/TextInput/TextInput.js +5 -0
- package/es6/components/ThumbsRating/ThumbsRating.js +15 -10
- package/es6/components/Toolbar/Toolbar.js +15 -11
- package/es6/components/Video/Video.js +3 -5
- package/es6/themes/base.d.ts +284 -4
- package/es6/themes/base.js +369 -21
- package/es6/utils/graphics.js +123 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +46 -46
- package/themes/base.d.ts +284 -4
- package/themes/base.js +369 -21
- package/utils/graphics.js +124 -1
|
@@ -23,6 +23,7 @@ var StyledStarRatingBox = (0, _styledComponents["default"])(_Box.Box).withConfig
|
|
|
23
23
|
return props.focus && (0, _utils.focusStyle)();
|
|
24
24
|
});
|
|
25
25
|
var StarRating = exports.StarRating = function StarRating(_ref) {
|
|
26
|
+
var _theme$starRating, _theme$starRating2;
|
|
26
27
|
var name = _ref.name,
|
|
27
28
|
defaultValue = _ref.defaultValue,
|
|
28
29
|
valueProp = _ref.value,
|
|
@@ -38,6 +39,8 @@ var StarRating = exports.StarRating = function StarRating(_ref) {
|
|
|
38
39
|
}),
|
|
39
40
|
value = _formContext$useFormI[0],
|
|
40
41
|
setValue = _formContext$useFormI[1];
|
|
42
|
+
var SelectedIcon = ((_theme$starRating = theme.starRating) == null || (_theme$starRating = _theme$starRating.icons) == null ? void 0 : _theme$starRating.selected) || _Star.Star;
|
|
43
|
+
var UnselectedIcon = ((_theme$starRating2 = theme.starRating) == null || (_theme$starRating2 = _theme$starRating2.icons) == null ? void 0 : _theme$starRating2.unselected) || _StarOutline.StarOutline;
|
|
41
44
|
var options = [];
|
|
42
45
|
for (var i = 1; i < 6; i += 1) {
|
|
43
46
|
options.push(i);
|
|
@@ -50,14 +53,14 @@ var StarRating = exports.StarRating = function StarRating(_ref) {
|
|
|
50
53
|
setValue(event.value);
|
|
51
54
|
}
|
|
52
55
|
}, rest), function (option, _ref2) {
|
|
53
|
-
var _theme$
|
|
56
|
+
var _theme$starRating3, _theme$starRating4;
|
|
54
57
|
var focus = _ref2.focus;
|
|
55
58
|
return /*#__PURE__*/_react["default"].createElement(StyledStarRatingBox, {
|
|
56
59
|
focus: focus && usingKeyboard
|
|
57
|
-
}, option <= value ? /*#__PURE__*/_react["default"].createElement(
|
|
58
|
-
color: (_theme$
|
|
59
|
-
}) : /*#__PURE__*/_react["default"].createElement(
|
|
60
|
-
color: (_theme$
|
|
60
|
+
}, option <= value ? /*#__PURE__*/_react["default"].createElement(SelectedIcon, {
|
|
61
|
+
color: (_theme$starRating3 = theme.starRating) == null ? void 0 : _theme$starRating3.color
|
|
62
|
+
}) : /*#__PURE__*/_react["default"].createElement(UnselectedIcon, {
|
|
63
|
+
color: (_theme$starRating4 = theme.starRating) == null ? void 0 : _theme$starRating4.color
|
|
61
64
|
}));
|
|
62
65
|
});
|
|
63
66
|
};
|
package/components/Tab/Tab.js
CHANGED
|
@@ -150,11 +150,12 @@ var Tab = exports.Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
150
150
|
var second = reverse ? normalizedIcon : normalizedTitle;
|
|
151
151
|
var withIconStyles;
|
|
152
152
|
if (first && second) {
|
|
153
|
+
var _theme$tab;
|
|
153
154
|
withIconStyles = {
|
|
154
155
|
direction: 'row',
|
|
155
156
|
align: 'center',
|
|
156
157
|
justify: 'center',
|
|
157
|
-
gap:
|
|
158
|
+
gap: (_theme$tab = theme.tab) == null ? void 0 : _theme$tab.gap
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
161
|
return /*#__PURE__*/_react["default"].createElement(_Button.Button, _extends({
|
|
@@ -46,8 +46,8 @@ var StyledTableCell = exports.StyledTableCell = _styledComponents["default"].td.
|
|
|
46
46
|
var StyledTableDataCaption = exports.StyledTableDataCaption = _styledComponents["default"].caption.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
47
47
|
displayName: "StyledTable__StyledTableDataCaption",
|
|
48
48
|
componentId: "sc-1m3u5g-1"
|
|
49
|
-
})(["
|
|
50
|
-
return props.theme.global.edgeSize.
|
|
49
|
+
})(["", ""], function (props) {
|
|
50
|
+
return (0, _utils.edgeStyle)('margin', props.theme.table.caption.margin, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
|
|
51
51
|
});
|
|
52
52
|
var StyledTableRow = exports.StyledTableRow = _styledComponents["default"].tr.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
53
53
|
displayName: "StyledTable__StyledTableRow",
|
package/components/Tabs/Tabs.js
CHANGED
|
@@ -21,7 +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 Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
24
|
-
var _theme$tabs$header;
|
|
24
|
+
var _theme$tabs$header, _theme$tabs$header2, _theme$tabs$header3, _theme$tabs$header4;
|
|
25
25
|
var alignControls = _ref.alignControls,
|
|
26
26
|
children = _ref.children,
|
|
27
27
|
flex = _ref.flex,
|
|
@@ -61,6 +61,8 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
61
61
|
setFocusIndex = _useState7[1];
|
|
62
62
|
var headerRef = (0, _react.useRef)();
|
|
63
63
|
var size = (0, _react.useContext)(_ResponsiveContext.ResponsiveContext);
|
|
64
|
+
var PreviousIcon = ((_theme$tabs$header = theme.tabs.header) == null || (_theme$tabs$header = _theme$tabs$header.previousButton) == null ? void 0 : _theme$tabs$header.icon) || _Previous.Previous;
|
|
65
|
+
var NextIcon = ((_theme$tabs$header2 = theme.tabs.header) == null || (_theme$tabs$header2 = _theme$tabs$header2.nextButton) == null ? void 0 : _theme$tabs$header2.icon) || _Next.Next;
|
|
64
66
|
var sendAnalytics = (0, _AnalyticsContext.useAnalytics)();
|
|
65
67
|
if (activeIndex !== propsActiveIndex && propsActiveIndex !== undefined) {
|
|
66
68
|
setActiveIndex(propsActiveIndex);
|
|
@@ -275,7 +277,7 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
275
277
|
}, passThemeFlag, rest, {
|
|
276
278
|
background: theme.tabs.background
|
|
277
279
|
}), /*#__PURE__*/_react["default"].createElement(_Box.Box, _extends({
|
|
278
|
-
alignSelf: alignControls || ((_theme$tabs$
|
|
280
|
+
alignSelf: alignControls || ((_theme$tabs$header3 = theme.tabs.header) == null ? void 0 : _theme$tabs$header3.alignSelf),
|
|
279
281
|
flex: false,
|
|
280
282
|
direction: overflow ? 'row' : 'column'
|
|
281
283
|
}, tabsHeaderStyles), overflow && /*#__PURE__*/_react["default"].createElement(_Button.Button, {
|
|
@@ -288,11 +290,8 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
288
290
|
return moveByArrowKey('previous');
|
|
289
291
|
}
|
|
290
292
|
}, /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
291
|
-
pad:
|
|
292
|
-
|
|
293
|
-
horizontal: 'small'
|
|
294
|
-
}
|
|
295
|
-
}, /*#__PURE__*/_react["default"].createElement(_Previous.Previous, {
|
|
293
|
+
pad: theme.tabs.header.previousButton.pad
|
|
294
|
+
}, /*#__PURE__*/_react["default"].createElement(PreviousIcon, {
|
|
296
295
|
color: disableLeftArrow ? theme.button.disabled.color : theme.global.colors.text
|
|
297
296
|
}))), /*#__PURE__*/_react["default"].createElement(_StyledTabs.StyledTabsHeader, _extends({
|
|
298
297
|
role: "tablist",
|
|
@@ -316,11 +315,8 @@ var Tabs = exports.Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
316
315
|
return moveByArrowKey('next');
|
|
317
316
|
}
|
|
318
317
|
}, /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
319
|
-
pad:
|
|
320
|
-
|
|
321
|
-
horizontal: 'small'
|
|
322
|
-
}
|
|
323
|
-
}, /*#__PURE__*/_react["default"].createElement(_Next.Next, {
|
|
318
|
+
pad: (_theme$tabs$header4 = theme.tabs.header) == null || (_theme$tabs$header4 = _theme$tabs$header4.nextButton) == null ? void 0 : _theme$tabs$header4.pad
|
|
319
|
+
}, /*#__PURE__*/_react["default"].createElement(NextIcon, {
|
|
324
320
|
color: disableRightArrow ? theme.button.disabled.color : theme.global.colors.text
|
|
325
321
|
})))), /*#__PURE__*/_react["default"].createElement(_StyledTabs.StyledTabPanel, _extends({
|
|
326
322
|
flex: flex,
|
|
@@ -9,10 +9,18 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
9
9
|
var StyledTagButton = exports.StyledTagButton = (0, _styledComponents["default"])(_Button.Button).withConfig({
|
|
10
10
|
displayName: "StyledTag__StyledTagButton",
|
|
11
11
|
componentId: "sc-cb9fl2-0"
|
|
12
|
-
})(["", " ", ""], function (props) {
|
|
12
|
+
})(["", " ", " ", " &:hover{", " ", "}"], function (props) {
|
|
13
|
+
return props.background && (0, _utils.backgroundStyle)(props.background, props.theme);
|
|
14
|
+
}, function (props) {
|
|
13
15
|
return props.border && (0, _utils.borderStyle)(props.border, true, props.theme);
|
|
14
16
|
}, function (props) {
|
|
15
17
|
return props.round && (0, _utils.roundStyle)(props.round, true, props.theme);
|
|
18
|
+
}, function (props) {
|
|
19
|
+
var _props$theme;
|
|
20
|
+
return props.background && props.onClick && ((_props$theme = props.theme) == null || (_props$theme = _props$theme.tag) == null || (_props$theme = _props$theme.hover) == null ? void 0 : _props$theme.background) && (0, _utils.backgroundStyle)(props.theme.tag.hover.background, props.theme);
|
|
21
|
+
}, function (props) {
|
|
22
|
+
var _props$theme2;
|
|
23
|
+
return props.border && props.onClick && ((_props$theme2 = props.theme) == null || (_props$theme2 = _props$theme2.tag) == null || (_props$theme2 = _props$theme2.hover) == null ? void 0 : _props$theme2.border) && (0, _utils.borderStyle)(props.theme.tag.hover.border, true, props.theme);
|
|
16
24
|
});
|
|
17
25
|
var StyledRemoveButton = exports.StyledRemoveButton = (0, _styledComponents["default"])(_Button.Button).withConfig({
|
|
18
26
|
displayName: "StyledTag__StyledRemoveButton",
|
|
@@ -22,7 +22,7 @@ var StyledButton = (0, _styledComponents["default"])(_Button.Button).withConfig(
|
|
|
22
22
|
return !props.theme.button["default"] ? (0, _styles.edgeStyle)('padding', props.pad, false, undefined, props.theme) : '';
|
|
23
23
|
});
|
|
24
24
|
var CopyButton = exports.CopyButton = function CopyButton(_ref) {
|
|
25
|
-
var _theme$global$input$p, _theme$global$input$p2, _theme$global$input$p3;
|
|
25
|
+
var _theme$textInput, _theme$global$input$p, _theme$global$input$p2, _theme$global$input$p3;
|
|
26
26
|
var disabled = _ref.disabled,
|
|
27
27
|
onClickCopy = _ref.onClickCopy,
|
|
28
28
|
onBlurCopy = _ref.onBlurCopy,
|
|
@@ -32,6 +32,7 @@ var CopyButton = exports.CopyButton = function CopyButton(_ref) {
|
|
|
32
32
|
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
33
33
|
theme = _useThemeValue.theme,
|
|
34
34
|
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
35
|
+
var CopyIcon = ((_theme$textInput = theme.textInput) == null || (_theme$textInput = _theme$textInput.icons) == null ? void 0 : _theme$textInput.copy) || _Copy.Copy;
|
|
35
36
|
return /*#__PURE__*/_react["default"].createElement(_Tip.Tip, {
|
|
36
37
|
dropProps: {
|
|
37
38
|
align: {
|
|
@@ -42,7 +43,7 @@ var CopyButton = exports.CopyButton = function CopyButton(_ref) {
|
|
|
42
43
|
}, /*#__PURE__*/_react["default"].createElement(StyledButton, _extends({
|
|
43
44
|
disabled: disabled,
|
|
44
45
|
onClick: onClickCopy,
|
|
45
|
-
icon: /*#__PURE__*/_react["default"].createElement(
|
|
46
|
+
icon: /*#__PURE__*/_react["default"].createElement(CopyIcon, null),
|
|
46
47
|
pad: {
|
|
47
48
|
horizontal: (_theme$global$input$p = theme.global.input.padding) == null ? void 0 : _theme$global$input$p.horizontal,
|
|
48
49
|
left: (_theme$global$input$p2 = theme.global.input.padding) == null ? void 0 : _theme$global$input$p2.left,
|
|
@@ -316,6 +316,11 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
316
316
|
// must be an element rendered by suggestions.label
|
|
317
317
|
child = renderedLabel;else if (!theme.button.option)
|
|
318
318
|
// don't have theme support, need to layout here
|
|
319
|
+
/*
|
|
320
|
+
Not adding a theme object now because this code path
|
|
321
|
+
is not used in the HPE theme, but we may add theme
|
|
322
|
+
support here in the future.
|
|
323
|
+
*/
|
|
319
324
|
child = /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
320
325
|
align: "start",
|
|
321
326
|
pad: "small"
|
|
@@ -22,33 +22,38 @@ var StyledThumbsRatingBox = (0, _styledComponents["default"])(_Box.Box).withConf
|
|
|
22
22
|
return props.focus && (0, _utils.focusStyle)();
|
|
23
23
|
});
|
|
24
24
|
var ThumbsRating = exports.ThumbsRating = function ThumbsRating(_ref) {
|
|
25
|
+
var _theme$thumbsRating, _theme$thumbsRating2, _theme$thumbsRating3, _theme$thumbsRating4;
|
|
25
26
|
var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
26
27
|
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
27
28
|
theme = _useThemeValue.theme;
|
|
28
29
|
var usingKeyboard = (0, _utils.useKeyboard)();
|
|
30
|
+
var LikeIcon = ((_theme$thumbsRating = theme.thumbsRating) == null || (_theme$thumbsRating = _theme$thumbsRating.icons) == null ? void 0 : _theme$thumbsRating.like) || _Like.Like;
|
|
31
|
+
var LikeSelectedIcon = ((_theme$thumbsRating2 = theme.thumbsRating) == null || (_theme$thumbsRating2 = _theme$thumbsRating2.icons) == null ? void 0 : _theme$thumbsRating2.likeSelected) || _LikeFill.LikeFill;
|
|
32
|
+
var DislikeIcon = ((_theme$thumbsRating3 = theme.thumbsRating) == null || (_theme$thumbsRating3 = _theme$thumbsRating3.icons) == null ? void 0 : _theme$thumbsRating3.dislike) || _Dislike.Dislike;
|
|
33
|
+
var DislikeSelectedIcon = ((_theme$thumbsRating4 = theme.thumbsRating) == null || (_theme$thumbsRating4 = _theme$thumbsRating4.icons) == null ? void 0 : _theme$thumbsRating4.dislikeSelected) || _DislikeFill.DislikeFill;
|
|
29
34
|
return /*#__PURE__*/_react["default"].createElement(_RadioButtonGroup.RadioButtonGroup, _extends({
|
|
30
35
|
direction: "row",
|
|
31
36
|
options: ['like', 'dislike']
|
|
32
37
|
}, rest), function (option, _ref2) {
|
|
33
|
-
var _theme$
|
|
38
|
+
var _theme$thumbsRating7, _theme$thumbsRating8;
|
|
34
39
|
var checked = _ref2.checked,
|
|
35
40
|
focus = _ref2.focus;
|
|
36
41
|
if (option === 'like') {
|
|
37
|
-
var _theme$
|
|
42
|
+
var _theme$thumbsRating5, _theme$thumbsRating6;
|
|
38
43
|
return /*#__PURE__*/_react["default"].createElement(StyledThumbsRatingBox, {
|
|
39
44
|
focus: focus && usingKeyboard
|
|
40
|
-
}, checked ? /*#__PURE__*/_react["default"].createElement(
|
|
41
|
-
color: (_theme$
|
|
42
|
-
}) : /*#__PURE__*/_react["default"].createElement(
|
|
43
|
-
color: (_theme$
|
|
45
|
+
}, checked ? /*#__PURE__*/_react["default"].createElement(LikeSelectedIcon, {
|
|
46
|
+
color: (_theme$thumbsRating5 = theme.thumbsRating) == null || (_theme$thumbsRating5 = _theme$thumbsRating5.like) == null ? void 0 : _theme$thumbsRating5.color
|
|
47
|
+
}) : /*#__PURE__*/_react["default"].createElement(LikeIcon, {
|
|
48
|
+
color: (_theme$thumbsRating6 = theme.thumbsRating) == null || (_theme$thumbsRating6 = _theme$thumbsRating6.like) == null ? void 0 : _theme$thumbsRating6.color
|
|
44
49
|
}));
|
|
45
50
|
}
|
|
46
51
|
return /*#__PURE__*/_react["default"].createElement(StyledThumbsRatingBox, {
|
|
47
52
|
focus: focus && usingKeyboard
|
|
48
|
-
}, checked ? /*#__PURE__*/_react["default"].createElement(
|
|
49
|
-
color: (_theme$
|
|
50
|
-
}) : /*#__PURE__*/_react["default"].createElement(
|
|
51
|
-
color: (_theme$
|
|
53
|
+
}, checked ? /*#__PURE__*/_react["default"].createElement(DislikeSelectedIcon, {
|
|
54
|
+
color: (_theme$thumbsRating7 = theme.thumbsRating) == null || (_theme$thumbsRating7 = _theme$thumbsRating7.dislike) == null ? void 0 : _theme$thumbsRating7.color
|
|
55
|
+
}) : /*#__PURE__*/_react["default"].createElement(DislikeIcon, {
|
|
56
|
+
color: (_theme$thumbsRating8 = theme.thumbsRating) == null || (_theme$thumbsRating8 = _theme$thumbsRating8.dislike) == null ? void 0 : _theme$thumbsRating8.color
|
|
52
57
|
}));
|
|
53
58
|
});
|
|
54
59
|
};
|
|
@@ -7,25 +7,29 @@ var _Box = require("../Box");
|
|
|
7
7
|
var _ResponsiveContext = require("../../contexts/ResponsiveContext");
|
|
8
8
|
var _propTypes = require("./propTypes");
|
|
9
9
|
var _responsive = require("../../utils/responsive");
|
|
10
|
+
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
10
11
|
var _excluded = ["children"];
|
|
11
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
12
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); }
|
|
13
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; }
|
|
14
|
-
var defaultLayoutProps = {
|
|
15
|
-
direction: 'row',
|
|
16
|
-
align: 'start',
|
|
17
|
-
gap: 'small'
|
|
18
|
-
};
|
|
19
|
-
var smallLayoutProps = {
|
|
20
|
-
direction: 'row',
|
|
21
|
-
wrap: true,
|
|
22
|
-
align: 'start',
|
|
23
|
-
gap: 'small'
|
|
24
|
-
};
|
|
25
15
|
var Toolbar = exports.Toolbar = function Toolbar(_ref) {
|
|
16
|
+
var _theme$toolbar, _theme$toolbar2;
|
|
26
17
|
var children = _ref.children,
|
|
27
18
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
28
19
|
var size = (0, _react.useContext)(_ResponsiveContext.ResponsiveContext);
|
|
20
|
+
var _useThemeValue = (0, _useThemeValue2.useThemeValue)(),
|
|
21
|
+
theme = _useThemeValue.theme;
|
|
22
|
+
var defaultLayoutProps = {
|
|
23
|
+
direction: 'row',
|
|
24
|
+
align: 'start',
|
|
25
|
+
gap: (_theme$toolbar = theme.toolbar) == null ? void 0 : _theme$toolbar.gap
|
|
26
|
+
};
|
|
27
|
+
var smallLayoutProps = {
|
|
28
|
+
direction: 'row',
|
|
29
|
+
wrap: true,
|
|
30
|
+
align: 'start',
|
|
31
|
+
gap: (_theme$toolbar2 = theme.toolbar) == null || (_theme$toolbar2 = _theme$toolbar2.small) == null ? void 0 : _theme$toolbar2.gap
|
|
32
|
+
};
|
|
29
33
|
var layoutProps = (0, _responsive.isSmall)(size) ? smallLayoutProps : defaultLayoutProps;
|
|
30
34
|
return /*#__PURE__*/_react["default"].createElement(_Box.Box, _extends({
|
|
31
35
|
flex: false,
|
|
@@ -281,7 +281,7 @@ var Video = exports.Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
|
|
|
281
281
|
}, [videoRef]);
|
|
282
282
|
var controlsElement;
|
|
283
283
|
if (controls != null && controls.position) {
|
|
284
|
-
var _controls$items;
|
|
284
|
+
var _controls$items, _theme$video, _theme$video2;
|
|
285
285
|
var over = controls.position === 'over';
|
|
286
286
|
var background = over ? theme.video.controls && theme.video.controls.background || {
|
|
287
287
|
color: 'background-back',
|
|
@@ -462,7 +462,7 @@ var Video = exports.Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
|
|
|
462
462
|
}),
|
|
463
463
|
background: over ? theme.video.scrubber && theme.video.scrubber.track && theme.video.scrubber.track.color || 'dark-3' : undefined,
|
|
464
464
|
size: "full",
|
|
465
|
-
thickness:
|
|
465
|
+
thickness: (_theme$video = theme.video) == null || (_theme$video = _theme$video.scrubber) == null ? void 0 : _theme$video.thickness,
|
|
466
466
|
values: [{
|
|
467
467
|
value: percentagePlayed || 0
|
|
468
468
|
}]
|
|
@@ -484,9 +484,7 @@ var Video = exports.Video = /*#__PURE__*/(0, _react.forwardRef)(function (_ref,
|
|
|
484
484
|
return setInteracting(true);
|
|
485
485
|
}
|
|
486
486
|
}, passThemeFlag)))), /*#__PURE__*/_react["default"].createElement(_Box.Box, {
|
|
487
|
-
pad:
|
|
488
|
-
horizontal: 'small'
|
|
489
|
-
}
|
|
487
|
+
pad: theme == null || (_theme$video2 = theme.video) == null || (_theme$video2 = _theme$video2.time) == null || (_theme$video2 = _theme$video2.container) == null ? void 0 : _theme$video2.pad
|
|
490
488
|
}, /*#__PURE__*/_react["default"].createElement(_Text.Text, {
|
|
491
489
|
margin: "none"
|
|
492
490
|
}, formattedTime))), /*#__PURE__*/_react["default"].createElement(_Menu.Menu, {
|
|
@@ -11,6 +11,7 @@ import { AccordionContext } from '../Accordion/AccordionContext';
|
|
|
11
11
|
import { AccordionPanelPropTypes } from './propTypes';
|
|
12
12
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
13
13
|
var AccordionPanel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
14
|
+
var _theme$accordion$labe, _theme$accordion$icon;
|
|
14
15
|
var children = _ref.children,
|
|
15
16
|
header = _ref.header,
|
|
16
17
|
id = _ref.id,
|
|
@@ -105,17 +106,13 @@ var AccordionPanel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
105
106
|
justify: "between",
|
|
106
107
|
id: id
|
|
107
108
|
}, rest), typeof label === 'string' ? /*#__PURE__*/React.createElement(Box, {
|
|
108
|
-
pad:
|
|
109
|
-
horizontal: 'xsmall'
|
|
110
|
-
}
|
|
109
|
+
pad: (_theme$accordion$labe = theme.accordion.label) == null || (_theme$accordion$labe = _theme$accordion$labe.container) == null ? void 0 : _theme$accordion$labe.pad
|
|
111
110
|
}, /*#__PURE__*/React.createElement(Heading, {
|
|
112
111
|
level: level || theme.accordion.heading && theme.accordion.heading.level || 4,
|
|
113
112
|
margin: theme.accordion.heading && theme.accordion.heading.margin || undefined,
|
|
114
113
|
color: hover
|
|
115
114
|
}, label)) : label, AccordionIcon && /*#__PURE__*/React.createElement(Box, {
|
|
116
|
-
pad:
|
|
117
|
-
horizontal: 'small'
|
|
118
|
-
},
|
|
115
|
+
pad: (_theme$accordion$icon = theme.accordion.icon) == null || (_theme$accordion$icon = _theme$accordion$icon.container) == null ? void 0 : _theme$accordion$icon.pad,
|
|
119
116
|
width: {
|
|
120
117
|
min: 'fit-content'
|
|
121
118
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { focusStyle, genericStyles, normalizeColor, styledComponentsConfig } from '../../utils';
|
|
2
|
+
import { edgeStyle, focusStyle, genericStyles, normalizeColor, styledComponentsConfig } from '../../utils';
|
|
3
3
|
var disabledStyle = "\n opacity: 0.3;\n cursor: default;\n text-decoration: none;\n";
|
|
4
4
|
var sizeStyle = function sizeStyle(props) {
|
|
5
5
|
if (props.size) {
|
|
@@ -26,7 +26,7 @@ var StyledAnchor = styled.a.withConfig(styledComponentsConfig).withConfig({
|
|
|
26
26
|
}, genericStyles, function (props) {
|
|
27
27
|
return !props.disabled && props.theme.anchor.hover && css(["&:hover{", " ", " ", "}"], props.theme.anchor.hover.textDecoration && "text-decoration: " + props.theme.anchor.hover.textDecoration + ";", props.theme.anchor.hover.fontWeight && "font-weight: " + props.theme.anchor.hover.fontWeight + ";", props.theme.anchor.hover.extend);
|
|
28
28
|
}, function (props) {
|
|
29
|
-
return props.hasIcon && !props.hasLabel &&
|
|
29
|
+
return props.hasIcon && !props.hasLabel && edgeStyle('padding', props.theme.anchor.iconOnly.pad, false, props.theme.global.edgeSize.responsiveBreakpoint, props.theme);
|
|
30
30
|
}, function (props) {
|
|
31
31
|
return props.disabled && disabledStyle;
|
|
32
32
|
}, function (props) {
|
|
@@ -243,7 +243,7 @@ var gapGapStyle = function gapGapStyle(directionProp, gap, responsive, border, t
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
if (border === 'between' || border && border.side === 'between') {
|
|
246
|
-
var borderSize = border.size ||
|
|
246
|
+
var borderSize = border.size || theme.box.border.offset;
|
|
247
247
|
var borderMetric = theme.global.borderSize[borderSize] || borderSize;
|
|
248
248
|
var borderOffset = parseMetricToNum(metric) / 2 - parseMetricToNum(borderMetric) / 2 + "px";
|
|
249
249
|
var responsiveBorderMetric = responsive && breakpoint && (breakpoint.borderSize[borderSize] || borderSize);
|
|
@@ -3,6 +3,7 @@ import styled, { css, keyframes } from 'styled-components';
|
|
|
3
3
|
import { Checkmark } from 'grommet-icons/icons/Checkmark';
|
|
4
4
|
import { Box } from '../Box';
|
|
5
5
|
import { styledComponentsConfig } from '../../utils/styles';
|
|
6
|
+
import { useThemeValue } from '../../utils/useThemeValue';
|
|
6
7
|
var bounceDelay = keyframes(["0%,80%,100%{transform:scale(0.4);}40%{transform:scale(0.8);}"]);
|
|
7
8
|
var bounceDelayRule = css(["animation:", " 1.4s infinite ease-in-out both;"], bounceDelay);
|
|
8
9
|
var Dot = styled(Box).withConfig({
|
|
@@ -12,6 +13,9 @@ var Dot = styled(Box).withConfig({
|
|
|
12
13
|
return props.delay && "animation-delay: " + props.delay + ";";
|
|
13
14
|
});
|
|
14
15
|
export var EllipsisAnimation = function EllipsisAnimation() {
|
|
16
|
+
var _theme$button;
|
|
17
|
+
var _useThemeValue = useThemeValue(),
|
|
18
|
+
theme = _useThemeValue.theme;
|
|
15
19
|
return /*#__PURE__*/React.createElement(Box, {
|
|
16
20
|
style: {
|
|
17
21
|
position: 'absolute'
|
|
@@ -22,7 +26,7 @@ export var EllipsisAnimation = function EllipsisAnimation() {
|
|
|
22
26
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
23
27
|
alignSelf: "center",
|
|
24
28
|
direction: "row",
|
|
25
|
-
gap:
|
|
29
|
+
gap: (_theme$button = theme.button) == null || (_theme$button = _theme$button.busy) == null ? void 0 : _theme$button.gap
|
|
26
30
|
}, /*#__PURE__*/React.createElement(Dot, {
|
|
27
31
|
delay: "-0.32s"
|
|
28
32
|
}), /*#__PURE__*/React.createElement(Dot, {
|
|
@@ -361,6 +361,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
361
361
|
}, contents);
|
|
362
362
|
}
|
|
363
363
|
if (busy || success) {
|
|
364
|
+
var _theme$button3;
|
|
364
365
|
// match what the label will use
|
|
365
366
|
var animationColor;
|
|
366
367
|
if (kind) {
|
|
@@ -385,7 +386,8 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
385
386
|
justify: "center"
|
|
386
387
|
}, /*#__PURE__*/React.createElement(GrowCheckmark, {
|
|
387
388
|
color: animationColor,
|
|
388
|
-
"aria-hidden": true
|
|
389
|
+
"aria-hidden": true,
|
|
390
|
+
as: (_theme$button3 = theme.button) == null || (_theme$button3 = _theme$button3.busy) == null || (_theme$button3 = _theme$button3.icons) == null ? void 0 : _theme$button3.success
|
|
389
391
|
})), /*#__PURE__*/React.createElement(StyledBusyContents, {
|
|
390
392
|
animating: busy || success
|
|
391
393
|
}, contents));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates", "daysOfWeek", "disabled", "initialFocus", "fill", "firstDayOfWeek", "header", "level", "locale", "messages", "onReference", "onSelect", "range", "reference", "responsive", "showAdjacentDays", "size", "timestamp"]
|
|
1
|
+
var _excluded = ["activeDate", "animate", "bounds", "children", "date", "dates", "daysOfWeek", "disabled", "initialFocus", "fill", "firstDayOfWeek", "header", "level", "locale", "messages", "onReference", "onSelect", "range", "reference", "responsive", "showAdjacentDays", "size", "timestamp"],
|
|
2
|
+
_excluded2 = ["container"];
|
|
2
3
|
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; }
|
|
3
4
|
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); }
|
|
4
5
|
import React, { forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -15,11 +16,6 @@ import { StyledCalendar, StyledDay, StyledDayButton, StyledDayContainer, StyledW
|
|
|
15
16
|
import { addDays, addMonths, betweenDates, daysApart, endOfMonth, handleOffset, sameDayOrAfter, sameDayOrBefore, startOfMonth, subtractDays, subtractMonths, withinDates } from './utils';
|
|
16
17
|
import { setHoursWithOffset } from '../../utils/dates';
|
|
17
18
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
18
|
-
var headingPadMap = {
|
|
19
|
-
small: 'xsmall',
|
|
20
|
-
medium: 'small',
|
|
21
|
-
large: 'medium'
|
|
22
|
-
};
|
|
23
19
|
var getLocaleString = function getLocaleString(value, locale) {
|
|
24
20
|
return value == null ? void 0 : value.toLocaleDateString(locale, {
|
|
25
21
|
month: 'long',
|
|
@@ -547,16 +543,17 @@ var Calendar = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
|
547
543
|
} else {
|
|
548
544
|
headingLevel = (theme.calendar.heading && theme.calendar.heading.level || 4) - 1;
|
|
549
545
|
}
|
|
546
|
+
var _ref5 = ((_theme$calendar$size = theme.calendar[size]) == null ? void 0 : _theme$calendar$size.title) || undefined,
|
|
547
|
+
containerTheme = _ref5.container,
|
|
548
|
+
textTheme = _objectWithoutPropertiesLoose(_ref5, _excluded2);
|
|
550
549
|
return /*#__PURE__*/React.createElement(Box, {
|
|
551
550
|
direction: "row",
|
|
552
551
|
justify: "between",
|
|
553
552
|
align: "center"
|
|
554
553
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
555
554
|
flex: true,
|
|
556
|
-
pad:
|
|
557
|
-
|
|
558
|
-
}
|
|
559
|
-
}, (_theme$calendar$size = theme.calendar[size]) != null && _theme$calendar$size.title ? /*#__PURE__*/React.createElement(Text, theme.calendar[size].title, monthAndYear) : /*#__PURE__*/React.createElement(Heading, {
|
|
555
|
+
pad: containerTheme.pad
|
|
556
|
+
}, Object.keys(textTheme).length !== 0 ? /*#__PURE__*/React.createElement(Text, textTheme, monthAndYear) : /*#__PURE__*/React.createElement(Heading, {
|
|
560
557
|
level: headingLevel,
|
|
561
558
|
size: size,
|
|
562
559
|
margin: "none",
|
|
@@ -23,8 +23,7 @@ var Cards = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
23
23
|
pad = _ref.pad,
|
|
24
24
|
paginate = _ref.paginate,
|
|
25
25
|
showProp = _ref.show,
|
|
26
|
-
|
|
27
|
-
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
26
|
+
size = _ref.size,
|
|
28
27
|
_ref$step = _ref.step,
|
|
29
28
|
step = _ref$step === void 0 ? paginate ? 50 : undefined : _ref$step,
|
|
30
29
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -48,8 +47,8 @@ var Cards = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
48
47
|
return /*#__PURE__*/React.createElement(Container, containerProps, /*#__PURE__*/React.createElement(Grid, _extends({
|
|
49
48
|
ref: ref,
|
|
50
49
|
as: as,
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
gap: theme.cards.grid.gap,
|
|
51
|
+
columns: size || theme.cards.grid.columns,
|
|
53
52
|
margin: !paginate && margin || 'none',
|
|
54
53
|
pad: !paginate && pad || 'none'
|
|
55
54
|
}, rest), /*#__PURE__*/React.createElement(InfiniteScroll, {
|
|
@@ -13,12 +13,9 @@ import { useThemeValue } from '../../utils/useThemeValue';
|
|
|
13
13
|
var gradientMaskColor = '#ffffff';
|
|
14
14
|
|
|
15
15
|
// use constants so re-renders don't re-trigger effects
|
|
16
|
-
var defaultSize = {
|
|
17
|
-
height: 'small',
|
|
18
|
-
width: 'medium'
|
|
19
|
-
};
|
|
20
16
|
var defaultValues = [];
|
|
21
17
|
var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
18
|
+
var _theme$chart, _theme$chart4, _theme$chart5;
|
|
22
19
|
var a11yTitle = _ref.a11yTitle,
|
|
23
20
|
boundsProp = _ref.bounds,
|
|
24
21
|
color = _ref.color,
|
|
@@ -37,8 +34,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
37
34
|
point = _ref.point,
|
|
38
35
|
round = _ref.round,
|
|
39
36
|
sizeProp = _ref.size,
|
|
40
|
-
|
|
41
|
-
thickness = _ref$thickness === void 0 ? 'medium' : _ref$thickness,
|
|
37
|
+
thickness = _ref.thickness,
|
|
42
38
|
_ref$type = _ref.type,
|
|
43
39
|
type = _ref$type === void 0 ? 'bar' : _ref$type,
|
|
44
40
|
_ref$values = _ref.values,
|
|
@@ -48,6 +44,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
48
44
|
var _useThemeValue = useThemeValue(),
|
|
49
45
|
theme = _useThemeValue.theme,
|
|
50
46
|
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
47
|
+
var thicknessValue = thickness || ((_theme$chart = theme.chart) == null ? void 0 : _theme$chart.thickness);
|
|
51
48
|
var values = useMemo(function () {
|
|
52
49
|
return normalizeValues(valuesProp);
|
|
53
50
|
}, [valuesProp]);
|
|
@@ -60,8 +57,8 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
60
57
|
return normalizeBounds(boundsProp, values, direction);
|
|
61
58
|
}, [direction, boundsProp, values]);
|
|
62
59
|
var strokeWidth = useMemo(function () {
|
|
63
|
-
return parseMetricToNum(theme.global.edgeSize[
|
|
64
|
-
}, [theme.global.edgeSize,
|
|
60
|
+
return parseMetricToNum(theme.global.edgeSize[thicknessValue] || thicknessValue);
|
|
61
|
+
}, [theme.global.edgeSize, thicknessValue]);
|
|
65
62
|
|
|
66
63
|
// inset is { top, left, bottom, right }
|
|
67
64
|
var inset = useMemo(function () {
|
|
@@ -117,6 +114,11 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
117
114
|
|
|
118
115
|
// size is { width, height }
|
|
119
116
|
var size = useMemo(function () {
|
|
117
|
+
var _theme$chart2, _theme$chart3;
|
|
118
|
+
var defaultSize = {
|
|
119
|
+
height: (_theme$chart2 = theme.chart) == null ? void 0 : _theme$chart2.height,
|
|
120
|
+
width: (_theme$chart3 = theme.chart) == null ? void 0 : _theme$chart3.width
|
|
121
|
+
};
|
|
120
122
|
var gapWidth = gap ? parseMetricToNum(theme.global.edgeSize[gap] || gap) : strokeWidth;
|
|
121
123
|
|
|
122
124
|
// autoSize is how wide or tall we'd pefer based on the number of values
|
|
@@ -143,7 +145,7 @@ var Chart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
143
145
|
width: width,
|
|
144
146
|
height: height
|
|
145
147
|
};
|
|
146
|
-
}, [containerSize, gap, horizontal, sizeProp, strokeWidth, theme.global.edgeSize, theme.global.size, values]);
|
|
148
|
+
}, [containerSize, gap, horizontal, sizeProp, strokeWidth, theme.global.edgeSize, theme.global.size, (_theme$chart4 = theme.chart) == null ? void 0 : _theme$chart4.height, (_theme$chart5 = theme.chart) == null ? void 0 : _theme$chart5.width, values]);
|
|
147
149
|
|
|
148
150
|
// scale is { x, y }
|
|
149
151
|
var scale = useMemo(function () {
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { calcMinMax, normalizeValues } from './utils';
|
|
2
|
-
var thicknessPad = {
|
|
3
|
-
xlarge: 'large',
|
|
4
|
-
large: 'medium',
|
|
5
|
-
medium: 'small',
|
|
6
|
-
small: 'xsmall',
|
|
7
|
-
xsmall: 'xxsmall'
|
|
8
|
-
};
|
|
9
2
|
export var round = function round(value, decimals) {
|
|
10
3
|
return Number(Math.round(value + "e" + decimals) + "e-" + decimals);
|
|
11
4
|
};
|
|
@@ -156,12 +149,14 @@ export var calcBounds = function calcBounds(valuesArg, options) {
|
|
|
156
149
|
// object structure. If options.direction is not present, the results are
|
|
157
150
|
// delivered in [x, y] array structure, for backwards compatibility
|
|
158
151
|
export var calcs = function calcs(values, options) {
|
|
152
|
+
var _theme$dataChart, _theme$dataChart2, _theme$dataChart3, _theme$dataChart4, _theme$dataChart5;
|
|
159
153
|
if (values === void 0) {
|
|
160
154
|
values = [];
|
|
161
155
|
}
|
|
162
156
|
if (options === void 0) {
|
|
163
157
|
options = {};
|
|
164
158
|
}
|
|
159
|
+
var theme = options.theme || {};
|
|
165
160
|
var horizontal = options.direction === 'horizontal';
|
|
166
161
|
|
|
167
162
|
// the number of steps is one less than the number of labels
|
|
@@ -223,6 +218,13 @@ export var calcs = function calcs(values, options) {
|
|
|
223
218
|
xAxis.push(round(x, 2));
|
|
224
219
|
x += xStepInterval;
|
|
225
220
|
}
|
|
221
|
+
var thicknessPad = {
|
|
222
|
+
xlarge: ((_theme$dataChart = theme.dataChart) == null || (_theme$dataChart = _theme$dataChart.thicknessPad) == null ? void 0 : _theme$dataChart.xlarge) || 'large',
|
|
223
|
+
large: ((_theme$dataChart2 = theme.dataChart) == null || (_theme$dataChart2 = _theme$dataChart2.thicknessPad) == null ? void 0 : _theme$dataChart2.large) || 'medium',
|
|
224
|
+
medium: ((_theme$dataChart3 = theme.dataChart) == null || (_theme$dataChart3 = _theme$dataChart3.thicknessPad) == null ? void 0 : _theme$dataChart3.medium) || 'small',
|
|
225
|
+
small: ((_theme$dataChart4 = theme.dataChart) == null || (_theme$dataChart4 = _theme$dataChart4.thicknessPad) == null ? void 0 : _theme$dataChart4.small) || 'xsmall',
|
|
226
|
+
xsmall: ((_theme$dataChart5 = theme.dataChart) == null || (_theme$dataChart5 = _theme$dataChart5.thicknessPad) == null ? void 0 : _theme$dataChart5.xsmall) || 'xxsmall'
|
|
227
|
+
};
|
|
226
228
|
var _options = options,
|
|
227
229
|
thickness = _options.thickness;
|
|
228
230
|
if (!thickness) {
|
|
@@ -231,17 +233,23 @@ export var calcs = function calcs(values, options) {
|
|
|
231
233
|
// These values were emirically determined, trying to balance visibility
|
|
232
234
|
// and overlap across resolutions.
|
|
233
235
|
if (values.length < 5) {
|
|
234
|
-
|
|
236
|
+
var _theme$dataChart6;
|
|
237
|
+
thickness = ((_theme$dataChart6 = theme.dataChart) == null || (_theme$dataChart6 = _theme$dataChart6.thickness) == null ? void 0 : _theme$dataChart6.sparse) || 'xlarge';
|
|
235
238
|
} else if (values.length < 11) {
|
|
236
|
-
|
|
239
|
+
var _theme$dataChart7;
|
|
240
|
+
thickness = ((_theme$dataChart7 = theme.dataChart) == null || (_theme$dataChart7 = _theme$dataChart7.thickness) == null ? void 0 : _theme$dataChart7.light) || 'large';
|
|
237
241
|
} else if (values.length < 21) {
|
|
238
|
-
|
|
242
|
+
var _theme$dataChart8;
|
|
243
|
+
thickness = ((_theme$dataChart8 = theme.dataChart) == null || (_theme$dataChart8 = _theme$dataChart8.thickness) == null ? void 0 : _theme$dataChart8.moderate) || 'medium';
|
|
239
244
|
} else if (values.length < 61) {
|
|
240
|
-
|
|
245
|
+
var _theme$dataChart9;
|
|
246
|
+
thickness = ((_theme$dataChart9 = theme.dataChart) == null || (_theme$dataChart9 = _theme$dataChart9.thickness) == null ? void 0 : _theme$dataChart9.heavy) || 'small';
|
|
241
247
|
} else if (values.length < 121) {
|
|
242
|
-
|
|
248
|
+
var _theme$dataChart0;
|
|
249
|
+
thickness = ((_theme$dataChart0 = theme.dataChart) == null || (_theme$dataChart0 = _theme$dataChart0.thickness) == null ? void 0 : _theme$dataChart0.dense) || 'xsmall';
|
|
243
250
|
} else {
|
|
244
|
-
|
|
251
|
+
var _theme$dataChart1;
|
|
252
|
+
thickness = ((_theme$dataChart1 = theme.dataChart) == null || (_theme$dataChart1 = _theme$dataChart1.thickness) == null ? void 0 : _theme$dataChart1.veryDense) || 'hair';
|
|
245
253
|
}
|
|
246
254
|
}
|
|
247
255
|
var pad = thicknessPad[thickness];
|
|
@@ -134,7 +134,7 @@ var CheckBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
134
134
|
var checkBoxNode = /*#__PURE__*/React.createElement(StyledCheckBox, _extends({
|
|
135
135
|
align: "center",
|
|
136
136
|
justify: "center",
|
|
137
|
-
margin: label && (_ref2 = {}, _ref2[side] = theme.checkBox.gap
|
|
137
|
+
margin: label && (_ref2 = {}, _ref2[side] = theme.checkBox.gap, _ref2)
|
|
138
138
|
}, themeableProps), /*#__PURE__*/React.createElement(StyledCheckBoxInput, _extends({
|
|
139
139
|
"aria-label": ariaLabel || a11yTitle
|
|
140
140
|
}, passThemeFlag, rest, {
|