grommet 2.30.0 → 2.31.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 (63) hide show
  1. package/components/Anchor/Anchor.js +3 -2
  2. package/components/Button/Badge.js +42 -43
  3. package/components/Button/Button.js +15 -12
  4. package/components/Button/StyledButton.js +4 -2
  5. package/components/Button/StyledButtonKind.js +5 -3
  6. package/components/Button/index.d.ts +2 -0
  7. package/components/Button/propTypes.js +1 -0
  8. package/components/CheckBox/index.d.ts +1 -1
  9. package/components/Data/DataForm.js +40 -34
  10. package/components/DataView/DataView.js +1 -1
  11. package/components/DateInput/DateInput.js +2 -1
  12. package/components/FormField/FormField.js +0 -1
  13. package/components/MaskedInput/MaskedInput.js +3 -2
  14. package/components/MaskedInput/StyledMaskedInput.js +2 -1
  15. package/components/Notification/Notification.js +7 -3
  16. package/components/PageHeader/PageHeader.js +6 -4
  17. package/components/Pagination/StyledPageControl.js +3 -1
  18. package/components/Paragraph/Paragraph.js +2 -2
  19. package/components/Paragraph/stories/All.js +5 -1
  20. package/components/SelectMultiple/SelectMultiple.js +11 -10
  21. package/components/SelectMultiple/SelectMultipleContainer.js +16 -13
  22. package/components/SelectMultiple/stories/Help.js +49 -0
  23. package/components/Text/Text.js +2 -2
  24. package/components/TextInput/StyledTextInput.js +2 -1
  25. package/components/TextInput/TextInput.js +3 -2
  26. package/es6/components/Anchor/Anchor.js +4 -3
  27. package/es6/components/Button/Badge.js +43 -44
  28. package/es6/components/Button/Button.js +16 -13
  29. package/es6/components/Button/StyledButton.js +5 -3
  30. package/es6/components/Button/StyledButtonKind.js +6 -4
  31. package/es6/components/Button/index.d.ts +2 -0
  32. package/es6/components/Button/propTypes.js +2 -1
  33. package/es6/components/CheckBox/index.d.ts +1 -1
  34. package/es6/components/Data/DataForm.js +40 -34
  35. package/es6/components/DataView/DataView.js +1 -1
  36. package/es6/components/DateInput/DateInput.js +2 -1
  37. package/es6/components/FormField/FormField.js +0 -1
  38. package/es6/components/MaskedInput/MaskedInput.js +4 -3
  39. package/es6/components/MaskedInput/StyledMaskedInput.js +2 -1
  40. package/es6/components/Notification/Notification.js +7 -3
  41. package/es6/components/PageHeader/PageHeader.js +6 -4
  42. package/es6/components/Pagination/StyledPageControl.js +3 -1
  43. package/es6/components/Paragraph/Paragraph.js +2 -2
  44. package/es6/components/Paragraph/stories/All.js +5 -1
  45. package/es6/components/SelectMultiple/SelectMultiple.js +11 -10
  46. package/es6/components/SelectMultiple/SelectMultipleContainer.js +16 -13
  47. package/es6/components/SelectMultiple/stories/Help.js +42 -0
  48. package/es6/components/Text/Text.js +2 -2
  49. package/es6/components/TextInput/StyledTextInput.js +2 -1
  50. package/es6/components/TextInput/TextInput.js +4 -3
  51. package/es6/themes/base.d.ts +3 -0
  52. package/es6/themes/base.js +6 -0
  53. package/es6/utils/icon.js +7 -0
  54. package/es6/utils/index.js +1 -0
  55. package/es6/utils/styles.js +10 -0
  56. package/grommet.min.js +1 -1
  57. package/grommet.min.js.map +1 -1
  58. package/package.json +30 -30
  59. package/themes/base.d.ts +3 -0
  60. package/themes/base.js +6 -0
  61. package/utils/icon.js +12 -0
  62. package/utils/index.js +6 -0
  63. package/utils/styles.js +12 -1
@@ -332,7 +332,6 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
332
332
  return /*#__PURE__*/React.createElement(FormFieldBox, _extends({
333
333
  ref: formFieldRef,
334
334
  className: className,
335
- flex: false,
336
335
  background: outerBackground,
337
336
  margin: abut ? abutMargin : margin || _extends({}, formFieldTheme.margin)
338
337
  }, outerProps, {
@@ -9,7 +9,7 @@ import { Button } from '../Button';
9
9
  import { Drop } from '../Drop';
10
10
  import { FormContext } from '../Form/FormContext';
11
11
  import { Keyboard } from '../Keyboard';
12
- import { sizeStyle, useForwardedRef } from '../../utils';
12
+ import { sizeStyle, useForwardedRef, useSizedIcon } from '../../utils';
13
13
  import { StyledMaskedInput, StyledMaskedInputContainer, StyledIcon } from './StyledMaskedInput';
14
14
  import { MaskedInputPropTypes } from './propTypes';
15
15
  var parseValue = function parseValue(mask, value) {
@@ -320,12 +320,13 @@ var MaskedInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
320
320
  return item.placeholder || item.fixed;
321
321
  }).join('');
322
322
  };
323
+ var maskedInputIcon = useSizedIcon(icon, rest.size, theme);
323
324
  return /*#__PURE__*/React.createElement(StyledMaskedInputContainer, {
324
325
  plain: plain
325
- }, icon && /*#__PURE__*/React.createElement(StyledIcon, {
326
+ }, maskedInputIcon && /*#__PURE__*/React.createElement(StyledIcon, {
326
327
  reverse: reverse,
327
328
  theme: theme
328
- }, icon), /*#__PURE__*/React.createElement(Keyboard, {
329
+ }, maskedInputIcon), /*#__PURE__*/React.createElement(Keyboard, {
329
330
  onEsc: onEsc,
330
331
  onTab: showDrop ? function () {
331
332
  return setShowDrop(false);
@@ -1,12 +1,13 @@
1
1
  import styled from 'styled-components';
2
2
  import { disabledStyle, getInputPadBySide, inputStyle, plainInputStyle, textAlignStyle } from '../../utils';
3
+ import { inputPadForIcon } from '../../utils/styles';
3
4
  export var StyledMaskedInput = styled.input.withConfig({
4
5
  displayName: "StyledMaskedInput",
5
6
  componentId: "sc-99vkfa-0"
6
7
  })(["", " ", " ", " ", " ", " ", ";"], inputStyle, function (props) {
7
8
  return props.plain && plainInputStyle;
8
9
  }, function (props) {
9
- return props.icon && (props.reverse ? "padding-right: " + props.theme.global.edgeSize.large + ";" : "padding-left: " + props.theme.global.edgeSize.large + ";");
10
+ return props.icon && inputPadForIcon;
10
11
  }, function (props) {
11
12
  return props.disabled && disabledStyle(props.theme.maskedInput.disabled && props.theme.maskedInput.disabled.opacity);
12
13
  }, function (props) {
@@ -50,7 +50,7 @@ var NotificationAnchor = styled(Anchor).withConfig({
50
50
  componentId: "sc-1yq09yz-0"
51
51
  })(["white-space:nowrap;"]);
52
52
  var Notification = function Notification(_ref) {
53
- var _theme$notification, _theme$notification2, _theme$notification2$, _theme$notification2$2, _theme$notification3, _theme$notification3$, _theme$notification4, _theme$notification4$, _theme$notification4$2;
53
+ var _theme$notification, _theme$notification2, _theme$notification2$, _theme$notification2$2, _theme$notification3, _theme$notification3$, _theme$notification4, _theme$notification4$, _theme$notification4$2, _theme$notification5, _theme$notification5$;
54
54
  var actionsProp = _ref.actions,
55
55
  messageProp = _ref.message,
56
56
  onClose = _ref.onClose,
@@ -133,6 +133,7 @@ var Notification = function Notification(_ref) {
133
133
  right: 'xsmall'
134
134
  }
135
135
  }, message), actions) : message;
136
+ var iconDimension = ((_theme$notification5 = theme.notification) == null ? void 0 : (_theme$notification5$ = _theme$notification5.message) == null ? void 0 : _theme$notification5$.size) || 'medium';
136
137
  var content = /*#__PURE__*/React.createElement(Box, _extends({}, theme.notification.container, global ? _extends({}, theme.notification.global.container) : {}, toast ? _extends({}, theme.notification.toast.container) : {}, {
137
138
  background: background
138
139
  // let internal box control pad
@@ -146,7 +147,8 @@ var Notification = function Notification(_ref) {
146
147
  pad: textPad,
147
148
  flex: true
148
149
  }, /*#__PURE__*/React.createElement(Box, theme.notification.iconContainer, icon || /*#__PURE__*/React.createElement(StatusIcon, {
149
- color: color
150
+ color: color,
151
+ height: iconDimension
150
152
  })), /*#__PURE__*/React.createElement(Box, theme.notification.textContainer, /*#__PURE__*/React.createElement(TextWrapper, null, title && /*#__PURE__*/React.createElement(Text, theme.notification.title, title), message && title && direction === 'row' && /*#__PURE__*/React.createElement(React.Fragment, null, "\xA0"), message))), onClose &&
151
153
  /*#__PURE__*/
152
154
  // theme.notification.container and textContainer may both have pad,
@@ -155,7 +157,9 @@ var Notification = function Notification(_ref) {
155
157
  pad: closeButtonPad
156
158
  }, /*#__PURE__*/React.createElement(Box, theme.notification.textContainer, /*#__PURE__*/React.createElement(Button, {
157
159
  icon: /*#__PURE__*/React.createElement(CloseIcon, {
158
- color: closeIconColor
160
+ color: closeIconColor,
161
+ height: iconDimension,
162
+ width: iconDimension
159
163
  }),
160
164
  onClick: close,
161
165
  hoverIndicator: true,
@@ -9,9 +9,11 @@ import { Heading } from '../Heading';
9
9
  import { Grid } from '../Grid';
10
10
  import { Paragraph } from '../Paragraph';
11
11
  import { ResponsiveContext } from '../../contexts/ResponsiveContext';
12
- var sizeStyle = function sizeStyle(size, feature, theme) {
13
- var _ref, _theme$pageHeader$siz;
14
- var style = _extends({}, theme.pageHeader[feature], (_ref = size && ((_theme$pageHeader$siz = theme.pageHeader.size[size]) == null ? void 0 : _theme$pageHeader$siz[feature])) != null ? _ref : theme.pageHeader[feature]);
12
+ var sizeStyle = function sizeStyle(size, feature, theme, breakpoint) {
13
+ var _ref, _theme$pageHeader$siz, _theme$global$breakpo, _theme$global$breakpo2;
14
+ var style = _extends({}, theme.pageHeader[feature], (_ref = size && ((_theme$pageHeader$siz = theme.pageHeader.size[size]) == null ? void 0 : _theme$pageHeader$siz[feature])) != null ? _ref : theme.pageHeader[feature], (!size || size === 'medium') && feature === 'subtitle' && ((_theme$global$breakpo = theme.global.breakpoints[breakpoint]) == null ? void 0 : _theme$global$breakpo.value) <= ((_theme$global$breakpo2 = theme.global.breakpoints.small) == null ? void 0 : _theme$global$breakpo2.value) && {
15
+ size: 'medium'
16
+ });
15
17
  return style;
16
18
  };
17
19
  var PageHeader = /*#__PURE__*/forwardRef(function (_ref2, ref) {
@@ -53,7 +55,7 @@ var PageHeader = /*#__PURE__*/forwardRef(function (_ref2, ref) {
53
55
  gridArea: "title"
54
56
  }, typeof title === 'string' ? /*#__PURE__*/React.createElement(Heading, sizeStyle(size, 'title', theme), title) : title), /*#__PURE__*/React.createElement(Box, {
55
57
  gridArea: "subtitle"
56
- }, typeof subtitle === 'string' ? /*#__PURE__*/React.createElement(Paragraph, sizeStyle(size, 'subtitle', theme), subtitle) : subtitle), /*#__PURE__*/React.createElement(Box, _extends({
58
+ }, typeof subtitle === 'string' ? /*#__PURE__*/React.createElement(Paragraph, sizeStyle(size, 'subtitle', theme, breakpoint), subtitle) : subtitle), /*#__PURE__*/React.createElement(Box, _extends({
57
59
  gridArea: "actions"
58
60
  }, actionsProps), actions)));
59
61
  });
@@ -6,7 +6,9 @@ var sizeStyle = function sizeStyle(props) {
6
6
  return style ? {
7
7
  content: {
8
8
  fontSize: style.font && style.font.size,
9
- lineHeight: style.font && style.font.height
9
+ // fix for safari, apply line-height 0 on next/previous
10
+ // icon-only buttons
11
+ lineHeight: style.font && props.hasLabel ? style.font.height : 0
10
12
  },
11
13
  container: {
12
14
  height: style.height,
@@ -31,9 +31,9 @@ var Paragraph = /*#__PURE__*/forwardRef(function (_ref, ref) {
31
31
  colorProp: color,
32
32
  fillProp: fill,
33
33
  size: size
34
- }, rest), /*#__PURE__*/React.createElement(TextContext.Provider, {
34
+ }, rest), children !== undefined ? /*#__PURE__*/React.createElement(TextContext.Provider, {
35
35
  value: textContextValue
36
- }, children));
36
+ }, children) : undefined);
37
37
  });
38
38
  Paragraph.displayName = 'Paragraph';
39
39
  Paragraph.prototype = ParagraphPropTypes;
@@ -12,7 +12,11 @@ export var All = function All() {
12
12
  color: "status-critical"
13
13
  }, "This is an error message."), /*#__PURE__*/React.createElement(Paragraph, {
14
14
  fill: true
15
- }, "This is a full-width paragraph, using the \"fill\" property:", ' ', paragraphFiller));
15
+ }, "This is a full-width paragraph, using the \"fill\" property:", ' ', paragraphFiller), /*#__PURE__*/React.createElement(Paragraph, {
16
+ dangerouslySetInnerHTML: {
17
+ __html: 'This is a dangerouslySetInnerHTML!'
18
+ }
19
+ }));
16
20
  };
17
21
  export default {
18
22
  title: 'Type/Paragraph/All'
@@ -270,6 +270,16 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
270
270
  return undefined;
271
271
  }, [labelKey, messages, format, optionIndexesInValue, allOptions, selectValue]);
272
272
  var iconColor = getIconColor(theme);
273
+ var displaySelectIcon = SelectIcon && /*#__PURE__*/React.createElement(Box, {
274
+ alignSelf: "center",
275
+ margin: theme.select.icons.margin,
276
+ width: {
277
+ min: 'auto'
278
+ }
279
+ }, /*#__PURE__*/isValidElement(SelectIcon) ? SelectIcon : /*#__PURE__*/React.createElement(SelectIcon, {
280
+ color: iconColor,
281
+ size: size
282
+ }));
273
283
  var dropContent = /*#__PURE__*/React.createElement(SelectMultipleContainer, {
274
284
  allOptions: allOptions,
275
285
  disabled: disabled,
@@ -277,6 +287,7 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
277
287
  dropHeight: dropHeight,
278
288
  emptySearchMessage: emptySearchMessage,
279
289
  help: help,
290
+ icon: displaySelectIcon,
280
291
  id: id,
281
292
  labelKey: labelKey,
282
293
  limit: limit,
@@ -319,16 +330,6 @@ var SelectMultiple = /*#__PURE__*/forwardRef(function (_ref, ref) {
319
330
  dropContent: dropContent,
320
331
  theme: theme
321
332
  };
322
- var displaySelectIcon = SelectIcon && /*#__PURE__*/React.createElement(Box, {
323
- alignSelf: "center",
324
- margin: theme.select.icons.margin,
325
- width: {
326
- min: 'auto'
327
- }
328
- }, /*#__PURE__*/isValidElement(SelectIcon) ? SelectIcon : /*#__PURE__*/React.createElement(SelectIcon, {
329
- color: iconColor,
330
- size: size
331
- }));
332
333
  return /*#__PURE__*/React.createElement(Keyboard, {
333
334
  onDown: onRequestOpen,
334
335
  onUp: onRequestOpen
@@ -1,7 +1,6 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
2
  import React, { forwardRef, useCallback, useContext, useEffect, useRef, useState } from 'react';
3
3
  import { ThemeContext } from 'styled-components';
4
- import { FormUp } from 'grommet-icons/icons/FormUp';
5
4
  import { setFocusWithoutScroll } from '../../utils';
6
5
  import { defaultProps } from '../../default-props';
7
6
  import { Box } from '../Box';
@@ -26,6 +25,7 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
26
25
  _ref$emptySearchMessa = _ref.emptySearchMessage,
27
26
  emptySearchMessage = _ref$emptySearchMessa === void 0 ? 'No matches found' : _ref$emptySearchMessa,
28
27
  help = _ref.help,
28
+ icon = _ref.icon,
29
29
  id = _ref.id,
30
30
  labelKey = _ref.labelKey,
31
31
  limit = _ref.limit,
@@ -258,21 +258,26 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
258
258
  value: value,
259
259
  valueKey: valueKey
260
260
  });
261
+ var helpContent;
262
+ if (help) {
263
+ if (typeof help === 'string') helpContent = /*#__PURE__*/React.createElement(Box, {
264
+ flex: false,
265
+ pad: "xsmall"
266
+ }, /*#__PURE__*/React.createElement(Text, {
267
+ size: "small"
268
+ }, help));else helpContent = /*#__PURE__*/React.createElement(Box, {
269
+ flex: false
270
+ }, help);
271
+ }
261
272
  if (showSelectedInline) summaryContent = /*#__PURE__*/React.createElement(Box, {
262
273
  direction: "row",
263
274
  justify: "between",
264
275
  flex: false
265
- }, summaryContent, /*#__PURE__*/React.createElement(Button, {
276
+ }, summaryContent, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Button, {
277
+ fill: "vertical",
266
278
  onClick: onClose,
267
279
  a11yTitle: "Close Select"
268
- }, /*#__PURE__*/React.createElement(Box, {
269
- fill: true,
270
- alignSelf: "start",
271
- pad: {
272
- right: 'small',
273
- top: 'small'
274
- }
275
- }, /*#__PURE__*/React.createElement(FormUp, null))));
280
+ }, icon)));
276
281
  return /*#__PURE__*/React.createElement(Keyboard, {
277
282
  onEnter: onSelectOption,
278
283
  onSpace: onSelectOption,
@@ -307,9 +312,7 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
307
312
  setActiveIndex(-1);
308
313
  onSearch(nextSearch);
309
314
  }
310
- }))), /*#__PURE__*/React.createElement(Box, {
311
- flex: false
312
- }, help), /*#__PURE__*/React.createElement(OptionsContainer, {
315
+ }))), helpContent, /*#__PURE__*/React.createElement(OptionsContainer, {
313
316
  role: "listbox",
314
317
  tabIndex: "0",
315
318
  ref: optionsRef,
@@ -0,0 +1,42 @@
1
+ import React, { useState } from 'react';
2
+ import { Box } from 'grommet';
3
+ import { SelectMultiple } from '../SelectMultiple';
4
+ var options = ['Apple', 'Orange', 'Banana', 'Grape', 'Melon', 'Strawberry', 'Kiwi', 'Mango', 'Raspberry', 'Rhubarb'];
5
+ export var Help = function Help() {
6
+ var _useState = useState([]),
7
+ valueMultiple = _useState[0],
8
+ setValueMultiple = _useState[1];
9
+ return (
10
+ /*#__PURE__*/
11
+ // Uncomment <Grommet> lines when using outside of storybook
12
+ // <Grommet theme={...}>
13
+ React.createElement(Box, {
14
+ fill: true,
15
+ align: "center",
16
+ pad: "large",
17
+ gap: "large"
18
+ }, /*#__PURE__*/React.createElement(SelectMultiple, {
19
+ value: valueMultiple,
20
+ placeholder: "Select",
21
+ options: options,
22
+ help: "something helpful",
23
+ onChange: function onChange(_ref) {
24
+ var value = _ref.value;
25
+ return setValueMultiple(value);
26
+ }
27
+ }))
28
+ // </Grommet>
29
+ );
30
+ };
31
+
32
+ Help.parameters = {
33
+ chromatic: {
34
+ disable: true
35
+ }
36
+ };
37
+ Help.args = {
38
+ full: true
39
+ };
40
+ export default {
41
+ title: 'Input/SelectMultiple/Help'
42
+ };
@@ -60,9 +60,9 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
60
60
  size: size
61
61
  }, rest, {
62
62
  ref: textRef
63
- }), /*#__PURE__*/React.createElement(TextContext.Provider, {
63
+ }), children !== undefined ? /*#__PURE__*/React.createElement(TextContext.Provider, {
64
64
  value: textContextValue
65
- }, children));
65
+ }, children) : undefined);
66
66
  if (tipProp || textTruncated) {
67
67
  // place the text content in a tip if truncate === 'tip'
68
68
  // and the text has been truncated
@@ -1,6 +1,7 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { disabledStyle, getInputPadBySide, inputStyle, parseMetricToNum, plainInputStyle, textAlignStyle, widthStyle } from '../../utils';
3
3
  import { defaultProps } from '../../default-props';
4
+ import { inputPadForIcon } from '../../utils/styles';
4
5
  var getPlainStyle = function getPlainStyle(plain) {
5
6
  if (plain === 'full') {
6
7
  return css(["", " padding:0;"], plainInputStyle);
@@ -13,7 +14,7 @@ var StyledTextInput = styled.input.withConfig({
13
14
  })(["", " ", " ", " ", " ", " ", " ", ";"], inputStyle, function (props) {
14
15
  return getPlainStyle(props.plain);
15
16
  }, function (props) {
16
- return props.icon && (props.reverse ? "padding-right: " + props.theme.global.edgeSize.large + ";" : "padding-left: " + props.theme.global.edgeSize.large + ";");
17
+ return props.icon && inputPadForIcon;
17
18
  }, function (props) {
18
19
  return props.disabled && disabledStyle(props.theme.textInput.disabled && props.theme.textInput.disabled.opacity);
19
20
  }, function (props) {
@@ -11,7 +11,7 @@ import { InfiniteScroll } from '../InfiniteScroll';
11
11
  import { Keyboard } from '../Keyboard';
12
12
  import { FormContext } from '../Form/FormContext';
13
13
  import { AnnounceContext } from '../../contexts';
14
- import { isNodeAfterScroll, isNodeBeforeScroll, sizeStyle, useForwardedRef } from '../../utils';
14
+ import { isNodeAfterScroll, isNodeBeforeScroll, sizeStyle, useForwardedRef, useSizedIcon } from '../../utils';
15
15
  import { StyledTextInput, StyledTextInputContainer, StyledPlaceholder, StyledIcon, StyledSuggestions } from './StyledTextInput';
16
16
  import { MessageContext } from '../../contexts/MessageContext';
17
17
  import { TextInputPropTypes } from './propTypes';
@@ -345,12 +345,13 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
345
345
  // otherwise we only listen to onDown on the input element itself,
346
346
  // primarily for tests.
347
347
 
348
+ var textInputIcon = useSizedIcon(icon, rest.size, theme);
348
349
  return /*#__PURE__*/React.createElement(StyledTextInputContainer, {
349
350
  plain: plain
350
- }, showStyledPlaceholder && /*#__PURE__*/React.createElement(StyledPlaceholder, null, placeholder), icon && /*#__PURE__*/React.createElement(StyledIcon, {
351
+ }, showStyledPlaceholder && /*#__PURE__*/React.createElement(StyledPlaceholder, null, placeholder), textInputIcon && /*#__PURE__*/React.createElement(StyledIcon, {
351
352
  reverse: reverse,
352
353
  theme: theme
353
- }, icon), /*#__PURE__*/React.createElement(Keyboard, _extends({
354
+ }, textInputIcon), /*#__PURE__*/React.createElement(Keyboard, _extends({
354
355
  target: focus ? 'document' : undefined
355
356
  }, keyboardProps), /*#__PURE__*/React.createElement(StyledTextInput, _extends({
356
357
  "aria-label": a11yTitle,
@@ -164,6 +164,7 @@ interface ButtonKindType {
164
164
 
165
165
  interface ButtonType {
166
166
  badge?: {
167
+ align?: 'container';
167
168
  container?: {
168
169
  background?: BackgroundType;
169
170
  pad?: PadType;
@@ -1028,6 +1029,8 @@ export interface ThemeType {
1028
1029
  };
1029
1030
  icon?: {
1030
1031
  extend?: ExtendType;
1032
+ disableScaleDown?: boolean;
1033
+ matchSize?: boolean;
1031
1034
  size?: {
1032
1035
  small?: string;
1033
1036
  medium?: string;
@@ -352,6 +352,11 @@ export var generate = function generate(baseSpacing, scale) {
352
352
  full: '100%'
353
353
  }
354
354
  },
355
+ // icon: {
356
+ // extennd: undefined,
357
+ // matchSize: undefined,
358
+ // size: undefined,
359
+ // },
355
360
  accordion: {
356
361
  panel: {
357
362
  // border: {
@@ -466,6 +471,7 @@ export var generate = function generate(baseSpacing, scale) {
466
471
 
467
472
  button: {
468
473
  badge: {
474
+ // align: undefined,,
469
475
  container: {
470
476
  background: 'brand'
471
477
  // pad: undefined,
@@ -0,0 +1,7 @@
1
+ import { cloneElement } from 'react';
2
+ export var useSizedIcon = function useSizedIcon(icon, size, theme) {
3
+ var _theme$icon;
4
+ return icon && theme != null && (_theme$icon = theme.icon) != null && _theme$icon.matchSize && !icon.props.size ? /*#__PURE__*/cloneElement(icon, {
5
+ size: size
6
+ }) : icon;
7
+ };
@@ -6,6 +6,7 @@ export * from './colors';
6
6
  export * from './dates';
7
7
  export * from './DOM';
8
8
  export * from './graphics';
9
+ export * from './icon';
9
10
  export * from './styles';
10
11
  export * from './object';
11
12
  export * from './pagination';
@@ -245,6 +245,16 @@ export var inputStyle = css(["box-sizing:border-box;", " font-family:inherit;bor
245
245
  }, controlBorderStyle, placeholderStyle, function (props) {
246
246
  return props.theme.global.input.extend;
247
247
  });
248
+
249
+ // Apply padding on input to create space for icon.
250
+ // When theme.icon.matchSize is true, the space for the
251
+ // icon should equal the icon dimension + 12px (edgeSize.medium)
252
+ // to ensure there is reasonable space between the icon and value or placeholder
253
+ export var inputPadForIcon = css(["", ""], function (props) {
254
+ var _props$theme, _props$theme$icon, _props$theme$icon2, _props$theme$icon2$si;
255
+ var pad = (_props$theme = props.theme) != null && (_props$theme$icon = _props$theme.icon) != null && _props$theme$icon.matchSize ? parseMetricToNum((_props$theme$icon2 = props.theme.icon) == null ? void 0 : (_props$theme$icon2$si = _props$theme$icon2.size) == null ? void 0 : _props$theme$icon2$si[(props == null ? void 0 : props.size) || 'medium']) + parseMetricToNum(props.theme.global.edgeSize.medium) + "px" : props.theme.global.edgeSize.large;
256
+ return props.reverse ? "padding-right: " + pad + ";" : "padding-left: " + pad + ";";
257
+ });
248
258
  export var overflowStyle = function overflowStyle(overflowProp) {
249
259
  if (typeof overflowProp === 'string') {
250
260
  return css(["overflow:", ";"], overflowProp);