grommet 2.22.0 → 2.23.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/Box/propTypes.js +1 -1
- package/components/Button/index.d.ts +15 -16
- package/components/CheckBox/CheckBox.js +1 -1
- package/components/CheckBox/StyledCheckBox.js +6 -2
- package/components/CheckBox/index.d.ts +2 -1
- package/components/DataChart/DataChart.js +26 -15
- package/components/DataChart/XAxis.js +18 -6
- package/components/DataChart/index.d.ts +1 -1
- package/components/DataChart/propTypes.js +3 -1
- package/components/DataChart/stories/Offset.js +6 -1
- package/components/DataTable/Body.js +76 -24
- package/components/DataTable/Cell.js +10 -4
- package/components/DataTable/DataTable.js +14 -5
- package/components/DataTable/Footer.js +6 -3
- package/components/DataTable/GroupedBody.js +22 -6
- package/components/DataTable/Header.js +85 -40
- package/components/DataTable/StyledDataTable.js +2 -2
- package/components/DataTable/index.d.ts +14 -2
- package/components/DataTable/propTypes.js +9 -2
- package/components/DataTable/stories/Units.js +41 -2
- package/components/DataTable/stories/VerticalAlign.js +51 -0
- package/components/DataTable/stories/typescript/Clickable.tsx +1 -0
- package/components/DataTable/stories/typescript/OnSelect.tsx +5 -10
- package/components/Drop/DropContainer.js +5 -2
- package/components/Drop/index.d.ts +2 -0
- package/components/Footer/index.d.ts +2 -2
- package/components/FormField/index.d.ts +4 -1
- package/components/Header/Header.js +62 -7
- package/components/Header/index.d.ts +8 -2
- package/components/Header/propTypes.js +19 -0
- package/components/Header/stories/Sticky.js +134 -0
- package/components/InfiniteScroll/index.d.ts +1 -0
- package/components/Keyboard/index.d.ts +1 -0
- package/components/List/List.js +5 -2
- package/components/List/index.d.ts +1 -0
- package/components/List/stories/Basic.js +1 -0
- package/components/Main/index.d.ts +2 -2
- package/components/Menu/Menu.js +4 -3
- package/components/Menu/index.d.ts +2 -1
- package/components/Menu/stories/Simple.js +1 -0
- package/components/Menu/stories/typescript/Children.tsx +1 -1
- package/components/NameValueList/index.d.ts +4 -1
- package/components/Nav/index.d.ts +2 -2
- package/components/Page/index.d.ts +2 -2
- package/components/PageContent/index.d.ts +2 -2
- package/components/RadioButton/index.d.ts +2 -1
- package/components/RangeSelector/stories/Thin.js +1 -9
- package/components/Select/SelectContainer.js +17 -10
- package/components/Select/stories/Clear.js +27 -2
- package/components/Spinner/index.d.ts +2 -1
- package/components/TableCell/TableCell.js +8 -4
- package/components/Tip/index.d.ts +1 -0
- package/components/Video/StyledVideo.js +1 -1
- package/components/Video/Video.js +72 -20
- package/components/Video/index.d.ts +14 -8
- package/components/Video/propTypes.js +7 -5
- package/components/Video/stories/typescript/ControlsBelow.tsx +6 -4
- package/components/Video/stories/typescript/Simple.tsx +1 -1
- package/components/Video/stories/typescript/TheaterMode.tsx +1 -2
- package/contexts/ThemeContext/index.d.ts +4 -1
- package/es6/components/Box/propTypes.js +1 -1
- package/es6/components/Button/index.d.ts +15 -16
- package/es6/components/CheckBox/CheckBox.js +1 -1
- package/es6/components/CheckBox/StyledCheckBox.js +6 -2
- package/es6/components/CheckBox/index.d.ts +2 -1
- package/es6/components/DataChart/DataChart.js +26 -15
- package/es6/components/DataChart/XAxis.js +18 -6
- package/es6/components/DataChart/index.d.ts +1 -1
- package/es6/components/DataChart/propTypes.js +3 -1
- package/es6/components/DataChart/stories/Offset.js +6 -1
- package/es6/components/DataTable/Body.js +76 -24
- package/es6/components/DataTable/Cell.js +11 -4
- package/es6/components/DataTable/DataTable.js +14 -5
- package/es6/components/DataTable/Footer.js +6 -3
- package/es6/components/DataTable/GroupedBody.js +22 -6
- package/es6/components/DataTable/Header.js +85 -40
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DataTable/index.d.ts +14 -2
- package/es6/components/DataTable/propTypes.js +9 -2
- package/es6/components/DataTable/stories/Units.js +41 -2
- package/es6/components/DataTable/stories/VerticalAlign.js +38 -0
- package/es6/components/DataTable/stories/typescript/Clickable.tsx +1 -0
- package/es6/components/DataTable/stories/typescript/OnSelect.tsx +5 -10
- package/es6/components/Drop/DropContainer.js +5 -2
- package/es6/components/Drop/index.d.ts +2 -0
- package/es6/components/Footer/index.d.ts +2 -2
- package/es6/components/FormField/index.d.ts +4 -1
- package/es6/components/Header/Header.js +57 -6
- package/es6/components/Header/index.d.ts +8 -2
- package/es6/components/Header/propTypes.js +10 -0
- package/es6/components/Header/stories/Sticky.js +121 -0
- package/es6/components/InfiniteScroll/index.d.ts +1 -0
- package/es6/components/Keyboard/index.d.ts +1 -0
- package/es6/components/List/List.js +5 -2
- package/es6/components/List/index.d.ts +1 -0
- package/es6/components/List/stories/Basic.js +1 -0
- package/es6/components/Main/index.d.ts +2 -2
- package/es6/components/Menu/Menu.js +4 -3
- package/es6/components/Menu/index.d.ts +2 -1
- package/es6/components/Menu/stories/Simple.js +1 -0
- package/es6/components/Menu/stories/typescript/Children.tsx +1 -1
- package/es6/components/NameValueList/index.d.ts +4 -1
- package/es6/components/Nav/index.d.ts +2 -2
- package/es6/components/Page/index.d.ts +2 -2
- package/es6/components/PageContent/index.d.ts +2 -2
- package/es6/components/RadioButton/index.d.ts +2 -1
- package/es6/components/RangeSelector/stories/Thin.js +1 -7
- package/es6/components/Select/SelectContainer.js +17 -10
- package/es6/components/Select/stories/Clear.js +27 -2
- package/es6/components/Spinner/index.d.ts +2 -1
- package/es6/components/TableCell/TableCell.js +7 -4
- package/es6/components/Tip/index.d.ts +1 -0
- package/es6/components/Video/StyledVideo.js +2 -2
- package/es6/components/Video/Video.js +71 -20
- package/es6/components/Video/index.d.ts +14 -8
- package/es6/components/Video/propTypes.js +7 -5
- package/es6/components/Video/stories/typescript/ControlsBelow.tsx +6 -4
- package/es6/components/Video/stories/typescript/Simple.tsx +1 -1
- package/es6/components/Video/stories/typescript/TheaterMode.tsx +1 -2
- package/es6/contexts/ThemeContext/index.d.ts +4 -1
- package/es6/themes/base.d.ts +21 -14
- package/es6/themes/base.js +10 -3
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +40 -40
- package/themes/base.d.ts +21 -14
- package/themes/base.js +10 -3
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Avatar, Nav, Anchor, Menu, Button, Box, Header, Heading, Layer, Paragraph, Page, PageContent, Grid, Card } from 'grommet';
|
|
3
|
+
import { FormClose } from "grommet-icons/es6/icons/FormClose";
|
|
4
|
+
import { Power } from "grommet-icons/es6/icons/Power";
|
|
5
|
+
import { User } from "grommet-icons/es6/icons/User";
|
|
6
|
+
export var Sticky = function Sticky() {
|
|
7
|
+
var _useState = useState(false),
|
|
8
|
+
open = _useState[0],
|
|
9
|
+
setOpen = _useState[1];
|
|
10
|
+
|
|
11
|
+
var onOpen = function onOpen() {
|
|
12
|
+
return setOpen(true);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var onClose = function onClose() {
|
|
16
|
+
return setOpen(undefined);
|
|
17
|
+
}; // eslint-disable-next-line no-unused-vars
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var onSubmit = function onSubmit(_ref) {// Your submission logic here
|
|
21
|
+
|
|
22
|
+
var value = _ref.value,
|
|
23
|
+
touched = _ref.touched;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
/*#__PURE__*/
|
|
28
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
29
|
+
// <Grommet theme={...}>
|
|
30
|
+
React.createElement(Page, {
|
|
31
|
+
kind: "narrow"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(PageContent, null, /*#__PURE__*/React.createElement(Header, {
|
|
33
|
+
background: "light-3",
|
|
34
|
+
sticky: "scrollup",
|
|
35
|
+
pad: {
|
|
36
|
+
vertical: 'small'
|
|
37
|
+
}
|
|
38
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
39
|
+
background: "brand"
|
|
40
|
+
}, "SY"), /*#__PURE__*/React.createElement(Nav, {
|
|
41
|
+
align: "center",
|
|
42
|
+
direction: "row"
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Anchor, {
|
|
44
|
+
label: "Home",
|
|
45
|
+
href: "#"
|
|
46
|
+
}), /*#__PURE__*/React.createElement(Menu, {
|
|
47
|
+
dropProps: {
|
|
48
|
+
align: {
|
|
49
|
+
top: 'bottom',
|
|
50
|
+
left: 'left'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
label: "Profile",
|
|
54
|
+
items: [{
|
|
55
|
+
label: 'Home'
|
|
56
|
+
}, {
|
|
57
|
+
label: 'Profile',
|
|
58
|
+
icon: /*#__PURE__*/React.createElement(User, null),
|
|
59
|
+
gap: 'small'
|
|
60
|
+
}, {
|
|
61
|
+
label: 'Logout',
|
|
62
|
+
icon: /*#__PURE__*/React.createElement(Power, null),
|
|
63
|
+
reverse: true,
|
|
64
|
+
gap: 'small'
|
|
65
|
+
}]
|
|
66
|
+
}))), /*#__PURE__*/React.createElement(Box, {
|
|
67
|
+
pad: "large",
|
|
68
|
+
align: "center"
|
|
69
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
70
|
+
label: "Show me the Layer",
|
|
71
|
+
onClick: onOpen,
|
|
72
|
+
primary: true
|
|
73
|
+
})), /*#__PURE__*/React.createElement(Paragraph, null, "To maximize screen real-estate, the Header on this page scrolls out of view as the user moves down the page. However if the user scrolls upwards, the Header is revealed and fixed atop the window. On long pages this behavior allows easy access to the Headers content, such as navigation or menus, while preventing the Header from obscuring content on mobile devices or in smaller windows."), /*#__PURE__*/React.createElement(Paragraph, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer commodo gravida tincidunt. Nunc fringilla blandit tortor, id accumsan nisi dictum quis. Aenean porttitor at mi id semper. Donec mattis bibendum leo, interdum ullamcorper lectus ultrices vel. Fusce nec enim faucibus nunc porta egestas. Fusce dapibus lobortis tincidunt."), /*#__PURE__*/React.createElement(Paragraph, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer commodo gravida tincidunt. Nunc fringilla blandit tortor, id accumsan nisi dictum quis. Aenean porttitor at mi id semper. Donec mattis bibendum leo, interdum ullamcorper lectus ultrices vel. Fusce nec enim faucibus nunc porta egestas. Fusce dapibus lobortis tincidunt."), /*#__PURE__*/React.createElement(Grid, {
|
|
74
|
+
rows: "small",
|
|
75
|
+
columns: {
|
|
76
|
+
count: 'fit',
|
|
77
|
+
size: 'small'
|
|
78
|
+
},
|
|
79
|
+
gap: "small"
|
|
80
|
+
}, /*#__PURE__*/React.createElement(Card, {
|
|
81
|
+
background: "white",
|
|
82
|
+
pad: "large"
|
|
83
|
+
}, "Card"), /*#__PURE__*/React.createElement(Card, {
|
|
84
|
+
background: "white",
|
|
85
|
+
pad: "large"
|
|
86
|
+
}, "Card"), /*#__PURE__*/React.createElement(Card, {
|
|
87
|
+
background: "white",
|
|
88
|
+
pad: "large"
|
|
89
|
+
}, "Card")), /*#__PURE__*/React.createElement(Paragraph, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer commodo gravida tincidunt. Nunc fringilla blandit tortor, id accumsan nisi dictum quis. Aenean porttitor at mi id semper. Donec mattis bibendum leo, interdum ullamcorper lectus ultrices vel. Fusce nec enim faucibus nunc porta egestas. Fusce dapibus lobortis tincidunt.")), open && /*#__PURE__*/React.createElement(Layer, {
|
|
90
|
+
position: "right",
|
|
91
|
+
onClickOutside: onClose,
|
|
92
|
+
onEsc: onClose
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
94
|
+
fill: "vertical",
|
|
95
|
+
overflow: "auto"
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
97
|
+
background: "light-3",
|
|
98
|
+
sticky: "scrollup",
|
|
99
|
+
pad: {
|
|
100
|
+
vertical: 'small',
|
|
101
|
+
horizontal: 'medium'
|
|
102
|
+
}
|
|
103
|
+
}, /*#__PURE__*/React.createElement(Heading, {
|
|
104
|
+
margin: "none",
|
|
105
|
+
level: 2,
|
|
106
|
+
size: "small"
|
|
107
|
+
}, "Add Monitor"), /*#__PURE__*/React.createElement(Button, {
|
|
108
|
+
icon: /*#__PURE__*/React.createElement(FormClose, null),
|
|
109
|
+
onClick: onClose
|
|
110
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
111
|
+
pad: {
|
|
112
|
+
horizontal: 'medium'
|
|
113
|
+
}
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Paragraph, null, "To maximize screen real-estate, the Header on this page scrolls out of view as the user moves down the page. However if the user scrolls upwards, the Header is revealed and fixed atop the window. On long pages this behavior allows easy access to the Headers content, such as navigation or menus, while preventing the Header from obscuring content on mobile devices or in smaller windows."), /*#__PURE__*/React.createElement(Paragraph, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer commodo gravida tincidunt. Nunc fringilla blandit tortor, id accumsan nisi dictum quis. Aenean porttitor at mi id semper. Donec mattis bibendum leo, interdum ullamcorper lectus ultrices vel. Fusce nec enim faucibus nunc porta egestas. Fusce dapibus lobortis tincidunt."), /*#__PURE__*/React.createElement(Paragraph, null, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer commodo gravida tincidunt. Nunc fringilla blandit tortor, id accumsan nisi dictum quis. Aenean porttitor at mi id semper. Donec mattis bibendum leo, interdum ullamcorper lectus ultrices vel. Fusce nec enim faucibus nunc porta egestas. Fusce dapibus lobortis tincidunt."))))) // </Grommet>
|
|
115
|
+
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
Sticky.storyName = 'Sticky';
|
|
119
|
+
export default {
|
|
120
|
+
title: 'Layout/Header/Sticky'
|
|
121
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
export interface InfiniteScrollProps {
|
|
4
|
+
children?: React.ReactNode | Function;
|
|
4
5
|
items?: (string | number | React.ReactElement | Record<string, any>)[];
|
|
5
6
|
onMore?: () => void;
|
|
6
7
|
renderMarker?: (marker: React.ReactElement) => React.ReactElement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["action", "as", "background", "border", "children", "data", "defaultItemProps", "focus", "itemKey", "itemProps", "onOrder", "pad", "paginate", "primaryKey", "secondaryKey", "show", "step", "onClickItem", "onMore"];
|
|
1
|
+
var _excluded = ["a11yTitle", "aria-label", "action", "as", "background", "border", "children", "data", "defaultItemProps", "focus", "itemKey", "itemProps", "onOrder", "pad", "paginate", "primaryKey", "secondaryKey", "show", "step", "onClickItem", "onMore"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || 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); }
|
|
4
4
|
|
|
@@ -107,7 +107,9 @@ var getItemId = function getItemId(item, index, primaryKey) {
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
110
|
-
var
|
|
110
|
+
var a11yTitle = _ref.a11yTitle,
|
|
111
|
+
ariaLabel = _ref['aria-label'],
|
|
112
|
+
action = _ref.action,
|
|
111
113
|
as = _ref.as,
|
|
112
114
|
background = _ref.background,
|
|
113
115
|
border = _ref.border,
|
|
@@ -226,6 +228,7 @@ var List = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
226
228
|
setActive(active >= min ? Math.min(active + 1, max) : min);
|
|
227
229
|
} : undefined
|
|
228
230
|
}, /*#__PURE__*/React.createElement(StyledList, _extends({
|
|
231
|
+
"aria-label": ariaLabel || a11yTitle,
|
|
229
232
|
ref: listRef,
|
|
230
233
|
as: as || 'ul',
|
|
231
234
|
itemFocus: itemFocus,
|
|
@@ -75,6 +75,7 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
75
75
|
themeDropAlign = _theme$menu$drop.align,
|
|
76
76
|
themeDropProps = _objectWithoutPropertiesLoose(_theme$menu$drop, _excluded2);
|
|
77
77
|
|
|
78
|
+
var a11y = ariaLabel || a11yTitle;
|
|
78
79
|
var align = dropProps && dropProps.align || dropAlign || themeDropAlign;
|
|
79
80
|
var controlButtonIndex = useMemo(function () {
|
|
80
81
|
if (align.top === 'top') return -1;
|
|
@@ -256,7 +257,7 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
256
257
|
// make it accessible at the end of all menu items
|
|
257
258
|
buttonRefs.current[items.length] = r;
|
|
258
259
|
},
|
|
259
|
-
a11yTitle:
|
|
260
|
+
a11yTitle: a11y || format({
|
|
260
261
|
id: 'menu.closeMenu',
|
|
261
262
|
messages: messages
|
|
262
263
|
}),
|
|
@@ -286,7 +287,7 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
286
287
|
}, /*#__PURE__*/React.createElement(DropButton, _extends({
|
|
287
288
|
ref: ref
|
|
288
289
|
}, rest, buttonProps, {
|
|
289
|
-
a11yTitle:
|
|
290
|
+
a11yTitle: a11y || format({
|
|
290
291
|
id: 'menu.openMenu',
|
|
291
292
|
messages: messages
|
|
292
293
|
}),
|
|
@@ -314,7 +315,7 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
314
315
|
}, alignControlMirror === 'top' && align.top === 'top' ? controlMirror : undefined, /*#__PURE__*/React.createElement(Box, {
|
|
315
316
|
overflow: "auto",
|
|
316
317
|
role: "menu",
|
|
317
|
-
a11yTitle:
|
|
318
|
+
a11yTitle: a11y
|
|
318
319
|
}, items.map(function (item, index) {
|
|
319
320
|
// Determine whether the label is done as a child or
|
|
320
321
|
// as an option Button kind property.
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
export interface MenuProps {
|
|
14
14
|
a11yTitle?: A11yTitleType;
|
|
15
15
|
alignSelf?: AlignSelfType;
|
|
16
|
+
children?: Function | React.ReactNode;
|
|
16
17
|
disabled?: boolean;
|
|
17
18
|
dropAlign?: {
|
|
18
19
|
top?: 'top' | 'bottom';
|
|
@@ -41,7 +42,7 @@ export interface MenuProps {
|
|
|
41
42
|
|
|
42
43
|
export interface MenuExtendedProps
|
|
43
44
|
extends MenuProps,
|
|
44
|
-
Omit<ButtonType, 'icon' | 'size'> {}
|
|
45
|
+
Omit<ButtonType, 'icon' | 'size' | 'children'> {}
|
|
45
46
|
|
|
46
47
|
declare const Menu: React.FC<MenuExtendedProps>;
|
|
47
48
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AlignType, WidthType } from '../../utils';
|
|
3
|
+
import { GridProps } from '../Grid';
|
|
3
4
|
export interface NameValueListProps {
|
|
4
5
|
align?: AlignType;
|
|
6
|
+
children?: React.ReactNode;
|
|
5
7
|
layout?: 'column' | 'grid';
|
|
6
8
|
nameProps?: {
|
|
7
9
|
align?: AlignType;
|
|
@@ -17,8 +19,9 @@ export interface NameValueListProps {
|
|
|
17
19
|
}
|
|
18
20
|
export interface NameValueListExtendedProps
|
|
19
21
|
extends NameValueListProps,
|
|
22
|
+
GridProps,
|
|
20
23
|
Omit<JSX.IntrinsicElements['dl'], keyof NameValueListProps> {}
|
|
21
24
|
|
|
22
|
-
declare const NameValueList: React.FC<
|
|
25
|
+
declare const NameValueList: React.FC<NameValueListExtendedProps>;
|
|
23
26
|
|
|
24
27
|
export { NameValueList };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BoxExtendedProps } from '../Box/index';
|
|
3
3
|
|
|
4
4
|
export interface PageProps {
|
|
5
5
|
kind?: 'wide' | 'narrow' | 'full' | string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export interface PageExtendedProps extends PageProps,
|
|
8
|
+
export interface PageExtendedProps extends PageProps, BoxExtendedProps {}
|
|
9
9
|
|
|
10
10
|
declare const Page: React.FC<PageExtendedProps>;
|
|
11
11
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BoxExtendedProps } from '../Box/index';
|
|
3
3
|
import { BackgroundObject } from '../../utils';
|
|
4
4
|
|
|
5
5
|
type PageBackground = BackgroundObject & {
|
|
@@ -12,7 +12,7 @@ export interface PageContentProps {
|
|
|
12
12
|
|
|
13
13
|
export interface PageContentExtendedProps
|
|
14
14
|
extends PageContentProps,
|
|
15
|
-
Omit<
|
|
15
|
+
Omit<BoxExtendedProps, 'background'> {}
|
|
16
16
|
|
|
17
17
|
declare const PageContent: React.FC<PageContentExtendedProps>;
|
|
18
18
|
|
|
@@ -4,6 +4,7 @@ import { A11yTitleType } from '../../utils';
|
|
|
4
4
|
export interface RadioButtonProps {
|
|
5
5
|
a11yTitle?: A11yTitleType;
|
|
6
6
|
checked?: boolean;
|
|
7
|
+
children?: React.ReactNode | Function;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
id?: string;
|
|
9
10
|
label?: React.ReactNode;
|
|
@@ -12,7 +13,7 @@ export interface RadioButtonProps {
|
|
|
12
13
|
|
|
13
14
|
export interface RadioButtonExtendedProps
|
|
14
15
|
extends RadioButtonProps,
|
|
15
|
-
Omit<JSX.IntrinsicElements['input'], 'name'> {}
|
|
16
|
+
Omit<JSX.IntrinsicElements['input'], 'name' | 'children'> {}
|
|
16
17
|
|
|
17
18
|
declare const RadioButton: React.FC<RadioButtonExtendedProps>;
|
|
18
19
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { render } from 'react-dom';
|
|
3
2
|
import { Box, RangeSelector, Stack, Text } from 'grommet';
|
|
4
3
|
var RANGE_MIN = 0;
|
|
5
4
|
var RANGE_MAX = 100;
|
|
@@ -36,7 +35,7 @@ function Thin(_ref) {
|
|
|
36
35
|
}, range[0] + "% - " + range[1] + "%")));
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
function
|
|
38
|
+
export var ThinStory = function ThinStory() {
|
|
40
39
|
return (
|
|
41
40
|
/*#__PURE__*/
|
|
42
41
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
@@ -48,11 +47,6 @@ function App() {
|
|
|
48
47
|
})) // </Grommet>
|
|
49
48
|
|
|
50
49
|
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
render( /*#__PURE__*/React.createElement(App, null), document.getElementById('root'));
|
|
54
|
-
export var ThinStory = function ThinStory() {
|
|
55
|
-
return /*#__PURE__*/React.createElement(App, null);
|
|
56
50
|
};
|
|
57
51
|
ThinStory.storyName = 'Thin';
|
|
58
52
|
export default {
|
|
@@ -33,7 +33,7 @@ var ClearButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
33
33
|
var align = position !== 'bottom' ? 'start' : 'center';
|
|
34
34
|
var buttonLabel = label || "Clear " + (name || 'selection');
|
|
35
35
|
return /*#__PURE__*/React.createElement(Button, {
|
|
36
|
-
fill:
|
|
36
|
+
fill: "horizontal",
|
|
37
37
|
ref: ref,
|
|
38
38
|
onClick: onClear,
|
|
39
39
|
focusIndicator: false
|
|
@@ -86,14 +86,15 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
86
86
|
var clearRef = useRef();
|
|
87
87
|
useEffect(function () {
|
|
88
88
|
var optionsNode = optionsRef.current;
|
|
89
|
-
if (optionsNode.children && optionsNode.children[activeIndex]) optionsNode.children[activeIndex].focus();
|
|
90
|
-
}, [activeIndex]); // adjust activeIndex when options change
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
if (optionsNode.children) {
|
|
91
|
+
var clearButton = clearRef.current;
|
|
92
|
+
var index = activeIndex;
|
|
93
|
+
if (clear && clear.position !== 'bottom' && clearButton) index += 1;
|
|
94
|
+
var optionNode = optionsNode.children[index];
|
|
95
|
+
if (optionNode) optionNode.focus();
|
|
95
96
|
}
|
|
96
|
-
}, [activeIndex,
|
|
97
|
+
}, [activeIndex, clear]); // set initial focus
|
|
97
98
|
|
|
98
99
|
useEffect(function () {
|
|
99
100
|
// need to wait for Drop to be ready
|
|
@@ -304,6 +305,13 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
304
305
|
selectOption(activeIndex)(event);
|
|
305
306
|
}
|
|
306
307
|
}, [activeIndex, selectOption, options]);
|
|
308
|
+
|
|
309
|
+
var shouldShowClearButton = function shouldShowClearButton(position) {
|
|
310
|
+
var hasValue = Boolean(multiple ? value.length : value);
|
|
311
|
+
var showAtPosition = position === 'bottom' ? (clear == null ? void 0 : clear.position) === 'bottom' : (clear == null ? void 0 : clear.position) !== 'bottom';
|
|
312
|
+
return clear && hasValue && showAtPosition;
|
|
313
|
+
};
|
|
314
|
+
|
|
307
315
|
var customSearchInput = theme.select.searchInput;
|
|
308
316
|
var SelectTextInput = customSearchInput || TextInput;
|
|
309
317
|
var selectOptionsStyle = theme.select.options ? _extends({}, theme.select.options.box, theme.select.options.container) : {};
|
|
@@ -339,7 +347,7 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
339
347
|
tabIndex: "-1",
|
|
340
348
|
ref: optionsRef,
|
|
341
349
|
"aria-multiselectable": multiple
|
|
342
|
-
},
|
|
350
|
+
}, shouldShowClearButton('top') && /*#__PURE__*/React.createElement(ClearButton, {
|
|
343
351
|
ref: clearRef,
|
|
344
352
|
clear: clear,
|
|
345
353
|
name: name,
|
|
@@ -392,7 +400,6 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
392
400
|
disabled: optionDisabled || undefined,
|
|
393
401
|
active: optionActive,
|
|
394
402
|
selected: optionSelected,
|
|
395
|
-
option: option,
|
|
396
403
|
onMouseOver: !optionDisabled ? onActiveOption(index) : undefined,
|
|
397
404
|
onClick: !optionDisabled ? selectOption(index) : undefined,
|
|
398
405
|
textComponent: textComponent
|
|
@@ -403,7 +410,7 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
403
410
|
role: "menuitem",
|
|
404
411
|
hoverIndicator: "background",
|
|
405
412
|
disabled: true
|
|
406
|
-
}, /*#__PURE__*/React.createElement(Box, selectOptionsStyle, /*#__PURE__*/React.createElement(Text, theme.select.container.text, emptySearchMessage))),
|
|
413
|
+
}, /*#__PURE__*/React.createElement(Box, selectOptionsStyle, /*#__PURE__*/React.createElement(Text, theme.select.container.text, emptySearchMessage))), shouldShowClearButton('bottom') && /*#__PURE__*/React.createElement(ClearButton, {
|
|
407
414
|
ref: clearRef,
|
|
408
415
|
clear: clear,
|
|
409
416
|
name: name,
|
|
@@ -14,8 +14,8 @@ var ClearTop = function ClearTop() {
|
|
|
14
14
|
pad: "large"
|
|
15
15
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
16
16
|
placeholder: "Clear Options",
|
|
17
|
-
multiple: true,
|
|
18
17
|
value: value,
|
|
18
|
+
multiple: true,
|
|
19
19
|
options: options,
|
|
20
20
|
onChange: function onChange(_ref) {
|
|
21
21
|
var nextValue = _ref.value;
|
|
@@ -25,12 +25,37 @@ var ClearTop = function ClearTop() {
|
|
|
25
25
|
}));
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
var ClearBottom = function ClearBottom() {
|
|
29
|
+
var _useState2 = useState(),
|
|
30
|
+
value = _useState2[0],
|
|
31
|
+
setValue = _useState2[1];
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
34
|
+
fill: true,
|
|
35
|
+
align: "center",
|
|
36
|
+
justify: "start",
|
|
37
|
+
pad: "large"
|
|
38
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
39
|
+
placeholder: "Clear Options",
|
|
40
|
+
value: value,
|
|
41
|
+
multiple: true,
|
|
42
|
+
options: options,
|
|
43
|
+
onChange: function onChange(_ref2) {
|
|
44
|
+
var nextValue = _ref2.value;
|
|
45
|
+
return setValue(nextValue);
|
|
46
|
+
},
|
|
47
|
+
clear: {
|
|
48
|
+
position: 'bottom'
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
|
|
28
53
|
export var Clear = function Clear() {
|
|
29
54
|
return (
|
|
30
55
|
/*#__PURE__*/
|
|
31
56
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
32
57
|
// <Grommet theme={...}>
|
|
33
|
-
React.createElement(ClearTop, null) // </Grommet>
|
|
58
|
+
React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClearTop, null), /*#__PURE__*/React.createElement(ClearBottom, null)) // </Grommet>
|
|
34
59
|
|
|
35
60
|
);
|
|
36
61
|
};
|
|
@@ -4,8 +4,9 @@ import { ColorType } from 'grommet/utils';
|
|
|
4
4
|
import { BoxProps } from '../Box/index';
|
|
5
5
|
|
|
6
6
|
export interface SpinnerProps {
|
|
7
|
-
|
|
7
|
+
children?: React.ReactNode;
|
|
8
8
|
color?: ColorType;
|
|
9
|
+
size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string;
|
|
9
10
|
message?: string | { start?: string; end?: string };
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["align", "background", "border", "children", "className", "colSpan", "onWidth", "pad", "plain", "rowSpan", "scope", "size", "verticalAlign"];
|
|
1
|
+
var _excluded = ["align", "aria-disabled", "background", "border", "children", "className", "colSpan", "onWidth", "pad", "plain", "rowSpan", "scope", "size", "verticalAlign"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || 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); }
|
|
4
4
|
|
|
@@ -13,13 +13,14 @@ import { Box } from '../Box';
|
|
|
13
13
|
import { TableContext } from '../Table/TableContext';
|
|
14
14
|
import { StyledTableCell } from '../Table/StyledTable';
|
|
15
15
|
import { TableCellPropTypes } from './propTypes';
|
|
16
|
-
var verticalAlignToJustify = {
|
|
16
|
+
export var verticalAlignToJustify = {
|
|
17
17
|
middle: 'center',
|
|
18
18
|
top: 'start',
|
|
19
19
|
bottom: 'end'
|
|
20
20
|
};
|
|
21
21
|
var TableCell = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
22
22
|
var align = _ref.align,
|
|
23
|
+
ariaDisabled = _ref['aria-disabled'],
|
|
23
24
|
background = _ref.background,
|
|
24
25
|
border = _ref.border,
|
|
25
26
|
children = _ref.children,
|
|
@@ -86,16 +87,18 @@ var TableCell = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
86
87
|
|
|
87
88
|
Object.keys(mergedProps).forEach(function (key) {
|
|
88
89
|
if (rest[key] === undefined) mergedProps[key] = tableContextTheme[key];
|
|
89
|
-
}); // split out background, border, and
|
|
90
|
+
}); // split out background, border, pad, and aria-disabled
|
|
90
91
|
|
|
91
92
|
var cellProps = {
|
|
92
93
|
align: align || mergedProps.align || undefined,
|
|
94
|
+
'aria-disabled': ariaDisabled || undefined,
|
|
93
95
|
background: background || mergedProps.background || undefined,
|
|
94
96
|
border: border || mergedProps.border || undefined,
|
|
95
97
|
pad: plain !== 'noPad' ? pad || mergedProps.pad || undefined : undefined,
|
|
96
98
|
verticalAlign: verticalAlign || mergedProps.verticalAlign || undefined
|
|
97
99
|
};
|
|
98
100
|
delete mergedProps.align;
|
|
101
|
+
delete mergedProps.ariaDisabled;
|
|
99
102
|
delete mergedProps.background;
|
|
100
103
|
delete mergedProps.border;
|
|
101
104
|
delete mergedProps.pad;
|
|
@@ -108,7 +111,7 @@ var TableCell = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
108
111
|
// TableCell
|
|
109
112
|
content = /*#__PURE__*/React.createElement(Box, {
|
|
110
113
|
ref: containerRef,
|
|
111
|
-
justify:
|
|
114
|
+
justify: verticalAlign ? verticalAlignToJustify[verticalAlign] : 'center'
|
|
112
115
|
}, children);
|
|
113
116
|
} // construct a new theme object in case we have a background that wants
|
|
114
117
|
// to change the background color context
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { genericStyles, normalizeColor } from '../../utils';
|
|
2
|
+
import { focusStyle, genericStyles, normalizeColor } from '../../utils';
|
|
3
3
|
import { defaultProps } from '../../default-props';
|
|
4
4
|
var FIT_MAP = {
|
|
5
5
|
cover: 'cover',
|
|
@@ -24,7 +24,7 @@ Object.setPrototypeOf(StyledVideo.defaultProps, defaultProps);
|
|
|
24
24
|
var StyledVideoContainer = styled.div.withConfig({
|
|
25
25
|
displayName: "StyledVideo__StyledVideoContainer",
|
|
26
26
|
componentId: "sc-w4v8h9-1"
|
|
27
|
-
})(["flex:1 1;display:flex;flex-direction:column;overflow:hidden;position:relative;", "
|
|
27
|
+
})(["flex:1 1;display:flex;flex-direction:column;overflow:hidden;position:relative;", ";&:focus{", "}"], genericStyles, focusStyle());
|
|
28
28
|
StyledVideoContainer.defaultProps = {};
|
|
29
29
|
Object.setPrototypeOf(StyledVideoContainer.defaultProps, defaultProps); // z-index is for Safari so controls aren't hidden
|
|
30
30
|
|