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.
Files changed (127) hide show
  1. package/components/Box/propTypes.js +1 -1
  2. package/components/Button/index.d.ts +15 -16
  3. package/components/CheckBox/CheckBox.js +1 -1
  4. package/components/CheckBox/StyledCheckBox.js +6 -2
  5. package/components/CheckBox/index.d.ts +2 -1
  6. package/components/DataChart/DataChart.js +26 -15
  7. package/components/DataChart/XAxis.js +18 -6
  8. package/components/DataChart/index.d.ts +1 -1
  9. package/components/DataChart/propTypes.js +3 -1
  10. package/components/DataChart/stories/Offset.js +6 -1
  11. package/components/DataTable/Body.js +76 -24
  12. package/components/DataTable/Cell.js +10 -4
  13. package/components/DataTable/DataTable.js +14 -5
  14. package/components/DataTable/Footer.js +6 -3
  15. package/components/DataTable/GroupedBody.js +22 -6
  16. package/components/DataTable/Header.js +85 -40
  17. package/components/DataTable/StyledDataTable.js +2 -2
  18. package/components/DataTable/index.d.ts +14 -2
  19. package/components/DataTable/propTypes.js +9 -2
  20. package/components/DataTable/stories/Units.js +41 -2
  21. package/components/DataTable/stories/VerticalAlign.js +51 -0
  22. package/components/DataTable/stories/typescript/Clickable.tsx +1 -0
  23. package/components/DataTable/stories/typescript/OnSelect.tsx +5 -10
  24. package/components/Drop/DropContainer.js +5 -2
  25. package/components/Drop/index.d.ts +2 -0
  26. package/components/Footer/index.d.ts +2 -2
  27. package/components/FormField/index.d.ts +4 -1
  28. package/components/Header/Header.js +62 -7
  29. package/components/Header/index.d.ts +8 -2
  30. package/components/Header/propTypes.js +19 -0
  31. package/components/Header/stories/Sticky.js +134 -0
  32. package/components/InfiniteScroll/index.d.ts +1 -0
  33. package/components/Keyboard/index.d.ts +1 -0
  34. package/components/List/List.js +5 -2
  35. package/components/List/index.d.ts +1 -0
  36. package/components/List/stories/Basic.js +1 -0
  37. package/components/Main/index.d.ts +2 -2
  38. package/components/Menu/Menu.js +4 -3
  39. package/components/Menu/index.d.ts +2 -1
  40. package/components/Menu/stories/Simple.js +1 -0
  41. package/components/Menu/stories/typescript/Children.tsx +1 -1
  42. package/components/NameValueList/index.d.ts +4 -1
  43. package/components/Nav/index.d.ts +2 -2
  44. package/components/Page/index.d.ts +2 -2
  45. package/components/PageContent/index.d.ts +2 -2
  46. package/components/RadioButton/index.d.ts +2 -1
  47. package/components/RangeSelector/stories/Thin.js +1 -9
  48. package/components/Select/SelectContainer.js +17 -10
  49. package/components/Select/stories/Clear.js +27 -2
  50. package/components/Spinner/index.d.ts +2 -1
  51. package/components/TableCell/TableCell.js +8 -4
  52. package/components/Tip/index.d.ts +1 -0
  53. package/components/Video/StyledVideo.js +1 -1
  54. package/components/Video/Video.js +72 -20
  55. package/components/Video/index.d.ts +14 -8
  56. package/components/Video/propTypes.js +7 -5
  57. package/components/Video/stories/typescript/ControlsBelow.tsx +6 -4
  58. package/components/Video/stories/typescript/Simple.tsx +1 -1
  59. package/components/Video/stories/typescript/TheaterMode.tsx +1 -2
  60. package/contexts/ThemeContext/index.d.ts +4 -1
  61. package/es6/components/Box/propTypes.js +1 -1
  62. package/es6/components/Button/index.d.ts +15 -16
  63. package/es6/components/CheckBox/CheckBox.js +1 -1
  64. package/es6/components/CheckBox/StyledCheckBox.js +6 -2
  65. package/es6/components/CheckBox/index.d.ts +2 -1
  66. package/es6/components/DataChart/DataChart.js +26 -15
  67. package/es6/components/DataChart/XAxis.js +18 -6
  68. package/es6/components/DataChart/index.d.ts +1 -1
  69. package/es6/components/DataChart/propTypes.js +3 -1
  70. package/es6/components/DataChart/stories/Offset.js +6 -1
  71. package/es6/components/DataTable/Body.js +76 -24
  72. package/es6/components/DataTable/Cell.js +11 -4
  73. package/es6/components/DataTable/DataTable.js +14 -5
  74. package/es6/components/DataTable/Footer.js +6 -3
  75. package/es6/components/DataTable/GroupedBody.js +22 -6
  76. package/es6/components/DataTable/Header.js +85 -40
  77. package/es6/components/DataTable/StyledDataTable.js +2 -2
  78. package/es6/components/DataTable/index.d.ts +14 -2
  79. package/es6/components/DataTable/propTypes.js +9 -2
  80. package/es6/components/DataTable/stories/Units.js +41 -2
  81. package/es6/components/DataTable/stories/VerticalAlign.js +38 -0
  82. package/es6/components/DataTable/stories/typescript/Clickable.tsx +1 -0
  83. package/es6/components/DataTable/stories/typescript/OnSelect.tsx +5 -10
  84. package/es6/components/Drop/DropContainer.js +5 -2
  85. package/es6/components/Drop/index.d.ts +2 -0
  86. package/es6/components/Footer/index.d.ts +2 -2
  87. package/es6/components/FormField/index.d.ts +4 -1
  88. package/es6/components/Header/Header.js +57 -6
  89. package/es6/components/Header/index.d.ts +8 -2
  90. package/es6/components/Header/propTypes.js +10 -0
  91. package/es6/components/Header/stories/Sticky.js +121 -0
  92. package/es6/components/InfiniteScroll/index.d.ts +1 -0
  93. package/es6/components/Keyboard/index.d.ts +1 -0
  94. package/es6/components/List/List.js +5 -2
  95. package/es6/components/List/index.d.ts +1 -0
  96. package/es6/components/List/stories/Basic.js +1 -0
  97. package/es6/components/Main/index.d.ts +2 -2
  98. package/es6/components/Menu/Menu.js +4 -3
  99. package/es6/components/Menu/index.d.ts +2 -1
  100. package/es6/components/Menu/stories/Simple.js +1 -0
  101. package/es6/components/Menu/stories/typescript/Children.tsx +1 -1
  102. package/es6/components/NameValueList/index.d.ts +4 -1
  103. package/es6/components/Nav/index.d.ts +2 -2
  104. package/es6/components/Page/index.d.ts +2 -2
  105. package/es6/components/PageContent/index.d.ts +2 -2
  106. package/es6/components/RadioButton/index.d.ts +2 -1
  107. package/es6/components/RangeSelector/stories/Thin.js +1 -7
  108. package/es6/components/Select/SelectContainer.js +17 -10
  109. package/es6/components/Select/stories/Clear.js +27 -2
  110. package/es6/components/Spinner/index.d.ts +2 -1
  111. package/es6/components/TableCell/TableCell.js +7 -4
  112. package/es6/components/Tip/index.d.ts +1 -0
  113. package/es6/components/Video/StyledVideo.js +2 -2
  114. package/es6/components/Video/Video.js +71 -20
  115. package/es6/components/Video/index.d.ts +14 -8
  116. package/es6/components/Video/propTypes.js +7 -5
  117. package/es6/components/Video/stories/typescript/ControlsBelow.tsx +6 -4
  118. package/es6/components/Video/stories/typescript/Simple.tsx +1 -1
  119. package/es6/components/Video/stories/typescript/TheaterMode.tsx +1 -2
  120. package/es6/contexts/ThemeContext/index.d.ts +4 -1
  121. package/es6/themes/base.d.ts +21 -14
  122. package/es6/themes/base.js +10 -3
  123. package/grommet.min.js +1 -1
  124. package/grommet.min.js.map +1 -1
  125. package/package.json +40 -40
  126. package/themes/base.d.ts +21 -14
  127. 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;
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { KeyboardType } from '../../utils';
3
3
 
4
4
  export interface KeyboardProps {
5
+ children?: React.ReactNode;
5
6
  target?: 'component' | 'document';
6
7
  onBackspace?: KeyboardType;
7
8
  onComma?: KeyboardType;
@@ -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 action = _ref.action,
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,
@@ -43,6 +43,7 @@ export interface ListProps<ListItemType> {
43
43
  | string[]
44
44
  | { light: string | string[]; dark: string | string[] };
45
45
  border?: BorderType;
46
+ children?: React.ReactNode;
46
47
  data?: ListItemType[];
47
48
  gridArea?: GridAreaType;
48
49
  defaultItemProps?: BoxTypes;
@@ -6,6 +6,7 @@ export var Basic = function Basic() {
6
6
  align: "center",
7
7
  pad: "large"
8
8
  }, /*#__PURE__*/React.createElement(List, {
9
+ a11yTitle: "Locations",
9
10
  data: locations
10
11
  }));
11
12
  };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { BoxProps } from '../Box/index';
2
+ import { BoxExtendedProps } from '../Box/index';
3
3
 
4
- declare const Main: React.FC<BoxProps>;
4
+ declare const Main: React.FC<BoxExtendedProps>;
5
5
 
6
6
  export { Main };
@@ -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: ariaLabel || a11yTitle || format({
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: ariaLabel || a11yTitle || format({
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: ariaLabel || 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
 
@@ -7,6 +7,7 @@ var SimpleMenu = function SimpleMenu() {
7
7
  pad: "large"
8
8
  }, /*#__PURE__*/React.createElement(Menu, {
9
9
  dropProps: {
10
+ a11yTitle: 'Simple drop content',
10
11
  align: {
11
12
  top: 'bottom',
12
13
  left: 'left'
@@ -12,7 +12,7 @@ const MenuWithChildren = (props) => (
12
12
  ]}
13
13
  {...props}
14
14
  >
15
- {({ disabled, drop, hover, focus }) => {
15
+ {({ disabled, drop, hover }) => {
16
16
  const color = hover && !drop && !disabled ? 'brand' : undefined;
17
17
  return (
18
18
  <Box
@@ -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<NameValueListProps>;
25
+ declare const NameValueList: React.FC<NameValueListExtendedProps>;
23
26
 
24
27
  export { NameValueList };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { BoxProps } from '../Box/index';
2
+ import { BoxExtendedProps } from '../Box/index';
3
3
 
4
- declare const Nav: React.FC<BoxProps>;
4
+ declare const Nav: React.FC<BoxExtendedProps>;
5
5
 
6
6
  export { Nav };
@@ -1,11 +1,11 @@
1
1
  import * as React from 'react';
2
- import { BoxProps } from '../Box/index';
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, BoxProps {}
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 { BoxProps } from '../Box/index';
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<BoxProps, 'background'> {}
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 App() {
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: true,
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
- useEffect(function () {
93
- if (activeIndex === -1 && search && optionIndexesInValue.length) {
94
- setActiveIndex(optionIndexesInValue[0]);
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, optionIndexesInValue, search]); // set initial focus
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
- }, clear && clear.position !== 'bottom' && value && /*#__PURE__*/React.createElement(ClearButton, {
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))), clear && clear.position === 'bottom' && value && /*#__PURE__*/React.createElement(ClearButton, {
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
- size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string;
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 pad
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: "center"
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
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import { DropProps } from '../Drop';
4
4
 
5
5
  export interface TipProps {
6
+ children?: React.ReactNode;
6
7
  content?: React.ReactNode;
7
8
  dropProps?: DropProps;
8
9
  plain?: boolean;
@@ -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;", ";"], genericStyles);
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