grommet 2.53.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.
@@ -313,7 +313,7 @@ var ResizablePinnedDataTable = exports.ResizablePinnedDataTable = function Resiz
313
313
  resizeable: true
314
314
  })))
315
315
  // </Grommet>
316
- ;
316
+ ;
317
317
  };
318
318
  ResizablePinnedDataTable.storyName = 'Resizable pinned columns';
319
319
  var _default = exports["default"] = {
@@ -275,7 +275,7 @@ var DateInput = exports.DateInput = /*#__PURE__*/(0, _react.forwardRef)(function
275
275
  }, buttonProps));
276
276
  }
277
277
  var onClickCopy = function onClickCopy() {
278
- global.navigator.clipboard.writeText(textValue);
278
+ navigator.clipboard.writeText(textValue);
279
279
  announce(readOnlyCopyValidation, 'assertive');
280
280
  setTip(readOnlyCopyValidation);
281
281
  };
@@ -22,7 +22,7 @@ var Sticky = exports.Sticky = function Sticky() {
22
22
  var value = _ref.value,
23
23
  touched = _ref.touched;
24
24
  } // Your submission logic here
25
- ;
25
+ ;
26
26
  return (
27
27
  /*#__PURE__*/
28
28
  // Uncomment <Grommet> lines when using outside of storybook
@@ -49,6 +49,7 @@ To make a selection:
49
49
 
50
50
  var defaultItems = [];
51
51
  var Menu = exports.Menu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
52
+ var _theme$menu$disabled;
52
53
  var a11yTitle = props.a11yTitle,
53
54
  ariaLabel = props['aria-label'],
54
55
  children = props.children,
@@ -75,6 +76,7 @@ var Menu = exports.Menu = /*#__PURE__*/(0, _react.forwardRef)(function (props, r
75
76
  var _useContext = (0, _react.useContext)(_MessageContext.MessageContext),
76
77
  format = _useContext.format;
77
78
  var iconColor = (0, _utils.normalizeColor)(theme.menu.icons.color || 'control', theme);
79
+ var iconDisabledColor = (0, _utils.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);
78
80
  // need to destructure the align otherwise it will get passed through
79
81
  // to DropButton and override prop values
80
82
  var _theme$menu$drop = theme.menu.drop,
@@ -216,7 +218,7 @@ var Menu = exports.Menu = /*#__PURE__*/(0, _react.forwardRef)(function (props, r
216
218
  }
217
219
  };
218
220
  var menuIcon = icon !== false ? icon !== true && icon || /*#__PURE__*/_react["default"].createElement(MenuIcon, {
219
- color: iconColor,
221
+ color: disabled ? iconDisabledColor : iconColor,
220
222
  size: size
221
223
  }) : null;
222
224
  var buttonProps = {
@@ -288,10 +290,10 @@ var Menu = exports.Menu = /*#__PURE__*/(0, _react.forwardRef)(function (props, r
288
290
  var child = !theme.button.option ?
289
291
  /*#__PURE__*/
290
292
  /*
291
- Not adding a theme object now because this code path
292
- is not used in the HPE theme, but we may add theme
293
- support here in the future.
294
- */
293
+ Not adding a theme object now because this code path
294
+ is not used in the HPE theme, but we may add theme
295
+ support here in the future.
296
+ */
295
297
  _react["default"].createElement(_Box.Box, {
296
298
  align: ((_theme$menu$item = theme.menu.item) == null ? void 0 : _theme$menu$item.align) || 'start',
297
299
  pad: "small",
@@ -52,7 +52,7 @@ var Tab = exports.Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
52
52
  tabsContextRef.current = tabRef.current;
53
53
  }
54
54
  });
55
- (0, _react.useEffect)(function () {
55
+ (0, _useIsomorphicLayoutEffect.useLayoutEffect)(function () {
56
56
  if (active) {
57
57
  setActiveContent(children);
58
58
  var activeTitle = typeof title === 'string' ? title : activeIndex + 1;
@@ -128,7 +128,7 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
128
128
  tip = _useState4[0],
129
129
  setTip = _useState4[1];
130
130
  var onClickCopy = function onClickCopy() {
131
- global.navigator.clipboard.writeText(value);
131
+ navigator.clipboard.writeText(value);
132
132
  announce(readOnlyCopyValidation, 'assertive');
133
133
  setTip(readOnlyCopyValidation);
134
134
  };
@@ -408,7 +408,7 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
408
408
  onMouseMove: function onMouseMove() {
409
409
  return setMouseMovedSinceLastKey(true);
410
410
  }
411
- }, passThemeFlag), reverse && readOnlyCopy && ReadOnlyCopyButton, showStyledPlaceholder && /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledPlaceholder, passThemeFlag, placeholder), textInputIcon && !readOnly && /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledIcon, {
411
+ }, passThemeFlag), reverse && readOnlyCopy && ReadOnlyCopyButton, showStyledPlaceholder && /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledPlaceholder, passThemeFlag, placeholder), textInputIcon && !readOnlyCopy && /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledIcon, {
412
412
  reverse: reverse,
413
413
  theme: theme
414
414
  }, textInputIcon), /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, _extends({
@@ -422,7 +422,7 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
422
422
  disabled: disabled,
423
423
  plain: plain,
424
424
  placeholder: typeof placeholder === 'string' ? placeholder : undefined,
425
- icon: !readOnly && icon,
425
+ icon: !readOnlyCopy && icon,
426
426
  reverse: reverse,
427
427
  focus: focus,
428
428
  focusIndicator: focusIndicator,
@@ -308,7 +308,7 @@ export var ResizablePinnedDataTable = function ResizablePinnedDataTable() {
308
308
  resizeable: true
309
309
  })))
310
310
  // </Grommet>
311
- ;
311
+ ;
312
312
  };
313
313
  ResizablePinnedDataTable.storyName = 'Resizable pinned columns';
314
314
  export default {
@@ -269,7 +269,7 @@ var DateInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
269
269
  }, buttonProps));
270
270
  }
271
271
  var onClickCopy = function onClickCopy() {
272
- global.navigator.clipboard.writeText(textValue);
272
+ navigator.clipboard.writeText(textValue);
273
273
  announce(readOnlyCopyValidation, 'assertive');
274
274
  setTip(readOnlyCopyValidation);
275
275
  };
@@ -19,7 +19,7 @@ export var Sticky = function Sticky() {
19
19
  var value = _ref.value,
20
20
  touched = _ref.touched;
21
21
  } // Your submission logic here
22
- ;
22
+ ;
23
23
  return (
24
24
  /*#__PURE__*/
25
25
  // Uncomment <Grommet> lines when using outside of storybook
@@ -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
- Not adding a theme object now because this code path
286
- is not used in the HPE theme, but we may add theme
287
- support here in the future.
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, useEffect, useState } from 'react';
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
- useEffect(function () {
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
- global.navigator.clipboard.writeText(value);
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 && !readOnly && /*#__PURE__*/React.createElement(StyledIcon, {
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: !readOnly && icon,
419
+ icon: !readOnlyCopy && icon,
420
420
  reverse: reverse,
421
421
  focus: focus,
422
422
  focusIndicator: focusIndicator,
@@ -1474,6 +1474,11 @@ export interface ThemeType {
1474
1474
  up?: any;
1475
1475
  color?: ColorType;
1476
1476
  };
1477
+ disabled?: {
1478
+ icons?: {
1479
+ color?: ColorType;
1480
+ };
1481
+ };
1477
1482
  };
1478
1483
  meter?: {
1479
1484
  background?: BackgroundType;
@@ -1616,6 +1616,11 @@ export var generate = function generate(baseSpacing, scale) {
1616
1616
  // up: undefined,
1617
1617
  // color: { dark: undefined, light: undefined },
1618
1618
  }
1619
+ // disabled: {
1620
+ // icons: {
1621
+ // color: undefined,
1622
+ // },
1623
+ // },
1619
1624
  },
1620
1625
  meter: {
1621
1626
  background: {