grommet 2.52.0 → 2.54.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/DataChart/DataChart.js +9 -4
- package/components/DataTable/stories/ResizePinned.stories.js +1 -1
- package/components/DataTableColumns/DataTableColumns.js +47 -26
- package/components/DataTableColumns/index.d.ts +1 -0
- package/components/DataTableColumns/propTypes.js +1 -0
- package/components/DataTableColumns/stories/OrderColumns.stories.js +48 -0
- package/components/DataTableColumns/stories/SelectColumns.stories.js +48 -0
- package/components/DateInput/DateInput.js +1 -1
- package/components/Header/stories/Sticky.stories.js +1 -1
- package/components/List/List.js +6 -4
- package/components/Menu/Menu.js +7 -5
- package/components/Tab/Tab.js +1 -1
- package/components/TextInput/TextInput.js +3 -3
- package/es6/components/DataChart/DataChart.js +9 -4
- package/es6/components/DataTable/stories/ResizePinned.stories.js +1 -1
- package/es6/components/DataTableColumns/DataTableColumns.js +47 -26
- package/es6/components/DataTableColumns/index.d.ts +1 -0
- package/es6/components/DataTableColumns/propTypes.js +1 -0
- package/es6/components/DataTableColumns/stories/OrderColumns.stories.js +44 -0
- package/es6/components/DataTableColumns/stories/SelectColumns.stories.js +44 -0
- package/es6/components/DateInput/DateInput.js +1 -1
- package/es6/components/Header/stories/Sticky.stories.js +1 -1
- package/es6/components/List/List.js +6 -4
- package/es6/components/Menu/Menu.js +7 -5
- package/es6/components/Tab/Tab.js +2 -2
- package/es6/components/TextInput/TextInput.js +3 -3
- package/es6/themes/base.d.ts +9 -1
- package/es6/themes/base.js +6 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +45 -45
- package/themes/base.d.ts +9 -1
- package/themes/base.js +6 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Data, DataSearch, DataSummary, DataTable, DataTableColumns, Toolbar } from 'grommet';
|
|
3
|
+
import { columns, DATA } from '../../DataTable/stories/data';
|
|
4
|
+
|
|
5
|
+
// simplify option label for name property
|
|
6
|
+
var options = columns.map(function (_ref) {
|
|
7
|
+
var header = _ref.header,
|
|
8
|
+
property = _ref.property;
|
|
9
|
+
return {
|
|
10
|
+
property: property,
|
|
11
|
+
label: property === 'name' ? 'Name' : header
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
export var OrderColumns = function OrderColumns() {
|
|
15
|
+
return (
|
|
16
|
+
/*#__PURE__*/
|
|
17
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
18
|
+
// <Grommet theme={...}>
|
|
19
|
+
React.createElement(Box, {
|
|
20
|
+
align: "center",
|
|
21
|
+
justify: "start",
|
|
22
|
+
pad: "large",
|
|
23
|
+
gap: "medium"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Data, {
|
|
25
|
+
data: DATA
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Toolbar, null, /*#__PURE__*/React.createElement(DataSearch, null), /*#__PURE__*/React.createElement(DataTableColumns, {
|
|
27
|
+
drop: true,
|
|
28
|
+
options: options,
|
|
29
|
+
activePanel: "orderColumns"
|
|
30
|
+
})), /*#__PURE__*/React.createElement(DataSummary, null), /*#__PURE__*/React.createElement(DataTable, {
|
|
31
|
+
columns: columns,
|
|
32
|
+
primaryKey: "name"
|
|
33
|
+
})))
|
|
34
|
+
// </Grommet>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
OrderColumns.parameters = {
|
|
38
|
+
chromatic: {
|
|
39
|
+
disable: true
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export default {
|
|
43
|
+
title: 'Data/DataTableColumns/OrderColumns'
|
|
44
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Data, DataSearch, DataSummary, DataTable, DataTableColumns, Toolbar } from 'grommet';
|
|
3
|
+
import { columns, DATA } from '../../DataTable/stories/data';
|
|
4
|
+
|
|
5
|
+
// simplify option label for name property
|
|
6
|
+
var options = columns.map(function (_ref) {
|
|
7
|
+
var header = _ref.header,
|
|
8
|
+
property = _ref.property;
|
|
9
|
+
return {
|
|
10
|
+
property: property,
|
|
11
|
+
label: property === 'name' ? 'Name' : header
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
export var SelectColumns = function SelectColumns() {
|
|
15
|
+
return (
|
|
16
|
+
/*#__PURE__*/
|
|
17
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
18
|
+
// <Grommet theme={...}>
|
|
19
|
+
React.createElement(Box, {
|
|
20
|
+
align: "center",
|
|
21
|
+
justify: "start",
|
|
22
|
+
pad: "large",
|
|
23
|
+
gap: "medium"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Data, {
|
|
25
|
+
data: DATA
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Toolbar, null, /*#__PURE__*/React.createElement(DataSearch, null), /*#__PURE__*/React.createElement(DataTableColumns, {
|
|
27
|
+
drop: true,
|
|
28
|
+
options: options,
|
|
29
|
+
activePanel: "selectColumns"
|
|
30
|
+
})), /*#__PURE__*/React.createElement(DataSummary, null), /*#__PURE__*/React.createElement(DataTable, {
|
|
31
|
+
columns: columns,
|
|
32
|
+
primaryKey: "name"
|
|
33
|
+
})))
|
|
34
|
+
// </Grommet>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
SelectColumns.parameters = {
|
|
38
|
+
chromatic: {
|
|
39
|
+
disable: true
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export default {
|
|
43
|
+
title: 'Data/DataTableColumns/SelectColumns'
|
|
44
|
+
};
|
|
@@ -269,7 +269,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
|
269
269
|
}, buttonProps));
|
|
270
270
|
}
|
|
271
271
|
var onClickCopy = function onClickCopy() {
|
|
272
|
-
|
|
272
|
+
navigator.clipboard.writeText(textValue);
|
|
273
273
|
announce(readOnlyCopyValidation, 'assertive');
|
|
274
274
|
setTip(readOnlyCopyValidation);
|
|
275
275
|
};
|
|
@@ -406,6 +406,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
406
406
|
isDisabled = disabledItems == null ? void 0 : disabledItems.includes(key);
|
|
407
407
|
}
|
|
408
408
|
if (action) {
|
|
409
|
+
var _theme$list2;
|
|
409
410
|
content = [/*#__PURE__*/React.createElement(Box, {
|
|
410
411
|
align: "start",
|
|
411
412
|
key: "actionContainer" + index
|
|
@@ -414,7 +415,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
414
415
|
direction: 'row',
|
|
415
416
|
align: secondaryKey ? 'start' : 'center',
|
|
416
417
|
justify: 'between',
|
|
417
|
-
gap: theme.list.item.gap
|
|
418
|
+
gap: (_theme$list2 = theme.list) == null || (_theme$list2 = _theme$list2.item) == null ? void 0 : _theme$list2.gap
|
|
418
419
|
};
|
|
419
420
|
}
|
|
420
421
|
var adjustedBackground = background || theme.list.item.background;
|
|
@@ -469,6 +470,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
469
470
|
var orderProps;
|
|
470
471
|
var orderControls;
|
|
471
472
|
if (onOrder && !isPinned) {
|
|
473
|
+
var _theme$list3;
|
|
472
474
|
orderProps = {
|
|
473
475
|
draggable: true,
|
|
474
476
|
onDragStart: function onDragStart(event) {
|
|
@@ -567,7 +569,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
567
569
|
boxProps = {
|
|
568
570
|
direction: 'row',
|
|
569
571
|
align: defaultItemProps && defaultItemProps.align || 'center',
|
|
570
|
-
gap: theme.list.item.gap
|
|
572
|
+
gap: (_theme$list3 = theme.list) == null || (_theme$list3 = _theme$list3.item) == null ? void 0 : _theme$list3.gap
|
|
571
573
|
};
|
|
572
574
|
}
|
|
573
575
|
var itemAriaProps;
|
|
@@ -583,7 +585,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
583
585
|
}
|
|
584
586
|
var displayPinned;
|
|
585
587
|
if (isPinned) {
|
|
586
|
-
var _pinIcon$props;
|
|
588
|
+
var _pinIcon$props, _theme$list4;
|
|
587
589
|
var pinSize = theme.list.item.pinned.icon.size;
|
|
588
590
|
var pinPad = theme.list.item.pinned.icon.pad;
|
|
589
591
|
var Icon = (pinned == null ? void 0 : pinned.icon) || theme.list.icons.pin;
|
|
@@ -600,7 +602,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
600
602
|
boxProps = {
|
|
601
603
|
direction: 'row',
|
|
602
604
|
align: defaultItemProps && defaultItemProps.align || 'center',
|
|
603
|
-
gap: theme.list.item.gap
|
|
605
|
+
gap: (_theme$list4 = theme.list) == null || (_theme$list4 = _theme$list4.item) == null ? void 0 : _theme$list4.gap
|
|
604
606
|
};
|
|
605
607
|
displayPinned = /*#__PURE__*/React.createElement(Box, {
|
|
606
608
|
direction: "row",
|
|
@@ -43,6 +43,7 @@ To make a selection:
|
|
|
43
43
|
|
|
44
44
|
var defaultItems = [];
|
|
45
45
|
var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
46
|
+
var _theme$menu$disabled;
|
|
46
47
|
var a11yTitle = props.a11yTitle,
|
|
47
48
|
ariaLabel = props['aria-label'],
|
|
48
49
|
children = props.children,
|
|
@@ -69,6 +70,7 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
70
|
var _useContext = useContext(MessageContext),
|
|
70
71
|
format = _useContext.format;
|
|
71
72
|
var iconColor = normalizeColor(theme.menu.icons.color || 'control', theme);
|
|
73
|
+
var iconDisabledColor = normalizeColor(((_theme$menu$disabled = theme.menu.disabled) == null || (_theme$menu$disabled = _theme$menu$disabled.icons) == null ? void 0 : _theme$menu$disabled.color) || theme.menu.icons.color || 'control', theme);
|
|
72
74
|
// need to destructure the align otherwise it will get passed through
|
|
73
75
|
// to DropButton and override prop values
|
|
74
76
|
var _theme$menu$drop = theme.menu.drop,
|
|
@@ -210,7 +212,7 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
210
212
|
}
|
|
211
213
|
};
|
|
212
214
|
var menuIcon = icon !== false ? icon !== true && icon || /*#__PURE__*/React.createElement(MenuIcon, {
|
|
213
|
-
color: iconColor,
|
|
215
|
+
color: disabled ? iconDisabledColor : iconColor,
|
|
214
216
|
size: size
|
|
215
217
|
}) : null;
|
|
216
218
|
var buttonProps = {
|
|
@@ -282,10 +284,10 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
282
284
|
var child = !theme.button.option ?
|
|
283
285
|
/*#__PURE__*/
|
|
284
286
|
/*
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
Not adding a theme object now because this code path
|
|
288
|
+
is not used in the HPE theme, but we may add theme
|
|
289
|
+
support here in the future.
|
|
290
|
+
*/
|
|
289
291
|
React.createElement(Box, {
|
|
290
292
|
align: ((_theme$menu$item = theme.menu.item) == null ? void 0 : _theme$menu$item.align) || 'start',
|
|
291
293
|
pad: "small",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["active", "disabled", "children", "icon", "plain", "title", "onBlur", "onFocus", "onMouseOver", "onMouseOut", "reverse", "onClick"];
|
|
2
2
|
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); }
|
|
3
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; }
|
|
4
|
-
import React, { forwardRef, useContext,
|
|
4
|
+
import React, { forwardRef, useContext, useState } from 'react';
|
|
5
5
|
import { Button } from '../Button';
|
|
6
6
|
import { Text } from '../Text';
|
|
7
7
|
import { TabsContext } from '../Tabs/TabsContext';
|
|
@@ -47,7 +47,7 @@ var Tab = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
47
47
|
tabsContextRef.current = tabRef.current;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
|
|
50
|
+
useLayoutEffect(function () {
|
|
51
51
|
if (active) {
|
|
52
52
|
setActiveContent(children);
|
|
53
53
|
var activeTitle = typeof title === 'string' ? title : activeIndex + 1;
|
|
@@ -122,7 +122,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
122
122
|
tip = _useState4[0],
|
|
123
123
|
setTip = _useState4[1];
|
|
124
124
|
var onClickCopy = function onClickCopy() {
|
|
125
|
-
|
|
125
|
+
navigator.clipboard.writeText(value);
|
|
126
126
|
announce(readOnlyCopyValidation, 'assertive');
|
|
127
127
|
setTip(readOnlyCopyValidation);
|
|
128
128
|
};
|
|
@@ -402,7 +402,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
402
402
|
onMouseMove: function onMouseMove() {
|
|
403
403
|
return setMouseMovedSinceLastKey(true);
|
|
404
404
|
}
|
|
405
|
-
}, passThemeFlag), reverse && readOnlyCopy && ReadOnlyCopyButton, showStyledPlaceholder && /*#__PURE__*/React.createElement(StyledPlaceholder, passThemeFlag, placeholder), textInputIcon && !
|
|
405
|
+
}, passThemeFlag), reverse && readOnlyCopy && ReadOnlyCopyButton, showStyledPlaceholder && /*#__PURE__*/React.createElement(StyledPlaceholder, passThemeFlag, placeholder), textInputIcon && !readOnlyCopy && /*#__PURE__*/React.createElement(StyledIcon, {
|
|
406
406
|
reverse: reverse,
|
|
407
407
|
theme: theme
|
|
408
408
|
}, textInputIcon), /*#__PURE__*/React.createElement(Keyboard, _extends({
|
|
@@ -416,7 +416,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
416
416
|
disabled: disabled,
|
|
417
417
|
plain: plain,
|
|
418
418
|
placeholder: typeof placeholder === 'string' ? placeholder : undefined,
|
|
419
|
-
icon: !
|
|
419
|
+
icon: !readOnlyCopy && icon,
|
|
420
420
|
reverse: reverse,
|
|
421
421
|
focus: focus,
|
|
422
422
|
focusIndicator: focusIndicator,
|
package/es6/themes/base.d.ts
CHANGED
|
@@ -468,6 +468,8 @@ export interface ThemeType {
|
|
|
468
468
|
variant?: string;
|
|
469
469
|
};
|
|
470
470
|
graph?: {
|
|
471
|
+
// remove in v3. Should have been removed in
|
|
472
|
+
// https://github.com/grommet/grommet/pull/3608/
|
|
471
473
|
colors?: GraphColorsType;
|
|
472
474
|
};
|
|
473
475
|
hover?: {
|
|
@@ -886,6 +888,7 @@ export interface ThemeType {
|
|
|
886
888
|
};
|
|
887
889
|
};
|
|
888
890
|
dataChart?: {
|
|
891
|
+
colors?: string[];
|
|
889
892
|
gap?: GapType;
|
|
890
893
|
granularity?: {
|
|
891
894
|
y?: {
|
|
@@ -1422,7 +1425,7 @@ export interface ThemeType {
|
|
|
1422
1425
|
color?: ColorType;
|
|
1423
1426
|
cursor?: string;
|
|
1424
1427
|
};
|
|
1425
|
-
gap
|
|
1428
|
+
gap?: GapType;
|
|
1426
1429
|
pinned?: {
|
|
1427
1430
|
background?: BackgroundType;
|
|
1428
1431
|
icon?: {
|
|
@@ -1471,6 +1474,11 @@ export interface ThemeType {
|
|
|
1471
1474
|
up?: any;
|
|
1472
1475
|
color?: ColorType;
|
|
1473
1476
|
};
|
|
1477
|
+
disabled?: {
|
|
1478
|
+
icons?: {
|
|
1479
|
+
color?: ColorType;
|
|
1480
|
+
};
|
|
1481
|
+
};
|
|
1474
1482
|
};
|
|
1475
1483
|
meter?: {
|
|
1476
1484
|
background?: BackgroundType;
|
package/es6/themes/base.js
CHANGED
|
@@ -1030,6 +1030,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
},
|
|
1032
1032
|
dataChart: {
|
|
1033
|
+
// colors: [],
|
|
1033
1034
|
gap: 'small',
|
|
1034
1035
|
// granularity: {
|
|
1035
1036
|
// y: {},
|
|
@@ -1615,6 +1616,11 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1615
1616
|
// up: undefined,
|
|
1616
1617
|
// color: { dark: undefined, light: undefined },
|
|
1617
1618
|
}
|
|
1619
|
+
// disabled: {
|
|
1620
|
+
// icons: {
|
|
1621
|
+
// color: undefined,
|
|
1622
|
+
// },
|
|
1623
|
+
// },
|
|
1618
1624
|
},
|
|
1619
1625
|
meter: {
|
|
1620
1626
|
background: {
|