@pingux/astro 1.0.0-alpha.9 → 1.0.1

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 (94) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/README.md +5 -0
  3. package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.stories.js +4 -11
  4. package/lib/cjs/components/Button/Button.js +5 -24
  5. package/lib/cjs/components/Button/Button.stories.js +5 -11
  6. package/lib/cjs/components/Button/Button.test.js +0 -24
  7. package/lib/cjs/components/Chip/Chip.js +26 -10
  8. package/lib/cjs/components/Chip/Chip.stories.js +44 -5
  9. package/lib/cjs/components/Chip/Chip.test.js +9 -0
  10. package/lib/cjs/components/{DropdownField/index.js → Chip/ChipContext.js} +8 -7
  11. package/lib/cjs/components/IconButton/IconButton.js +17 -7
  12. package/lib/cjs/components/IconButton/IconButton.test.js +0 -1
  13. package/lib/cjs/components/ListItem/ListItem.stories.js +0 -2
  14. package/lib/cjs/components/ListView/ListView.js +4 -3
  15. package/lib/cjs/components/ListViewItem/ListViewItem.js +3 -6
  16. package/lib/cjs/components/Stepper/Stepper.js +1 -0
  17. package/lib/cjs/components/Tab/Tab.js +5 -3
  18. package/lib/cjs/components/Tabs/Tabs.js +3 -0
  19. package/lib/cjs/components/Tabs/Tabs.stories.js +3 -4
  20. package/lib/cjs/components/Tabs/Tabs.test.js +44 -15
  21. package/lib/cjs/components/TextAreaField/TextAreaField.test.js +10 -0
  22. package/lib/cjs/index.js +48 -136
  23. package/lib/cjs/layouts/ListLayout.stories.js +2 -1
  24. package/lib/cjs/layouts/SchemaFormLayout.stories.js +2 -21
  25. package/lib/cjs/recipes/ArrayField.stories.js +3 -3
  26. package/lib/cjs/styles/forms/input.js +4 -0
  27. package/lib/cjs/styles/theme.js +0 -3
  28. package/lib/cjs/styles/variants/accordion.js +5 -7
  29. package/lib/cjs/styles/variants/boxes.js +20 -18
  30. package/lib/cjs/styles/variants/buttons.js +2 -28
  31. package/lib/cjs/styles/variants/variants.js +0 -3
  32. package/lib/components/AccordionGridGroup/AccordionGridGroup.stories.js +4 -11
  33. package/lib/components/Button/Button.js +7 -24
  34. package/lib/components/Button/Button.stories.js +5 -10
  35. package/lib/components/Button/Button.test.js +0 -20
  36. package/lib/components/Chip/Chip.js +25 -10
  37. package/lib/components/Chip/Chip.stories.js +41 -5
  38. package/lib/components/Chip/Chip.test.js +9 -0
  39. package/lib/components/Chip/ChipContext.js +3 -0
  40. package/lib/components/IconButton/IconButton.js +17 -9
  41. package/lib/components/IconButton/IconButton.test.js +0 -1
  42. package/lib/components/ListItem/ListItem.stories.js +0 -2
  43. package/lib/components/ListView/ListView.js +4 -3
  44. package/lib/components/ListViewItem/ListViewItem.js +3 -5
  45. package/lib/components/Stepper/Stepper.js +1 -0
  46. package/lib/components/Tab/Tab.js +5 -3
  47. package/lib/components/Tabs/Tabs.js +3 -0
  48. package/lib/components/Tabs/Tabs.stories.js +3 -4
  49. package/lib/components/Tabs/Tabs.test.js +40 -15
  50. package/lib/components/TextAreaField/TextAreaField.test.js +8 -0
  51. package/lib/index.js +0 -8
  52. package/lib/layouts/ListLayout.stories.js +2 -1
  53. package/lib/layouts/SchemaFormLayout.stories.js +2 -19
  54. package/lib/recipes/ArrayField.stories.js +3 -3
  55. package/lib/styles/forms/input.js +4 -0
  56. package/lib/styles/theme.js +0 -3
  57. package/lib/styles/variants/accordion.js +5 -7
  58. package/lib/styles/variants/boxes.js +20 -18
  59. package/lib/styles/variants/buttons.js +2 -28
  60. package/lib/styles/variants/variants.js +0 -2
  61. package/package.json +1 -1
  62. package/lib/cjs/components/Dropdown/Dropdown.js +0 -112
  63. package/lib/cjs/components/Dropdown/Dropdown.test.js +0 -80
  64. package/lib/cjs/components/Dropdown/index.js +0 -18
  65. package/lib/cjs/components/DropdownField/DropdownField.js +0 -187
  66. package/lib/cjs/components/DropdownField/DropdownField.stories.js +0 -278
  67. package/lib/cjs/components/DropdownField/DropdownField.test.js +0 -80
  68. package/lib/cjs/components/Panel/Panel.js +0 -101
  69. package/lib/cjs/components/Panel/Panel.stories.js +0 -57
  70. package/lib/cjs/components/Panel/Panel.test.js +0 -72
  71. package/lib/cjs/components/Panel/index.js +0 -18
  72. package/lib/cjs/components/Popover/Popover.js +0 -87
  73. package/lib/cjs/components/Popover/Popover.stories.js +0 -80
  74. package/lib/cjs/components/Popover/Popover.test.js +0 -91
  75. package/lib/cjs/components/Popover/index.js +0 -18
  76. package/lib/cjs/recipes/InputBoxWithLinkedChip.stories.js +0 -67
  77. package/lib/cjs/styles/variants/popover.js +0 -86
  78. package/lib/components/Dropdown/Dropdown.js +0 -90
  79. package/lib/components/Dropdown/Dropdown.test.js +0 -62
  80. package/lib/components/Dropdown/index.js +0 -1
  81. package/lib/components/DropdownField/DropdownField.js +0 -155
  82. package/lib/components/DropdownField/DropdownField.stories.js +0 -222
  83. package/lib/components/DropdownField/DropdownField.test.js +0 -60
  84. package/lib/components/DropdownField/index.js +0 -1
  85. package/lib/components/Panel/Panel.js +0 -71
  86. package/lib/components/Panel/Panel.stories.js +0 -35
  87. package/lib/components/Panel/Panel.test.js +0 -52
  88. package/lib/components/Panel/index.js +0 -1
  89. package/lib/components/Popover/Popover.js +0 -65
  90. package/lib/components/Popover/Popover.stories.js +0 -52
  91. package/lib/components/Popover/Popover.test.js +0 -75
  92. package/lib/components/Popover/index.js +0 -2
  93. package/lib/recipes/InputBoxWithLinkedChip.stories.js +0 -43
  94. package/lib/styles/variants/popover.js +0 -76
@@ -37,10 +37,10 @@ var accordionBody = {
37
37
  var accordionGridHeader = {
38
38
  cursor: 'pointer',
39
39
  lineHeight: '30px',
40
- px: 'md',
40
+ pl: 'sm',
41
41
  outline: 'none',
42
42
  display: 'flex',
43
- justifyContent: 'flex-start',
43
+ justifyContent: 'center',
44
44
  flexShrink: 0,
45
45
  wordBreak: 'inherit',
46
46
  whiteSpace: 'nowrap',
@@ -54,12 +54,9 @@ var accordionGridHeader = {
54
54
  WebkitBoxShadow: 'focus',
55
55
  MozBoxShadow: 'focus'
56
56
  },
57
- padding: '0px',
57
+ minHeight: '64px',
58
58
  '&.is-hovered': {
59
- color: 'active',
60
- '& div > div > div > span': {
61
- color: 'active'
62
- }
59
+ backgroundColor: 'accent.99'
63
60
  },
64
61
  '&.is-pressed': {
65
62
  color: 'accent.20',
@@ -70,6 +67,7 @@ var accordionGridHeader = {
70
67
  };
71
68
  var accordionGridBody = {
72
69
  display: 'none !important',
70
+ pl: 'sm',
73
71
  width: '100%',
74
72
  '&.is-selected': {
75
73
  display: 'flex !important'
@@ -37,20 +37,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
37
37
  var base = {
38
38
  display: 'flex'
39
39
  };
40
- var panel = {
41
- outline: 'none',
42
- position: 'relative',
43
- bg: 'white',
44
- borderLeft: 'separator',
45
- transition: 'margin 0.25s ease-in',
46
- visibility: 'hidden',
47
- '&.is-focused': {
48
- boxShadow: 'focus'
49
- },
50
- '&.is-visible': {
51
- visibility: 'visible'
52
- }
53
- };
54
40
  var card = {
55
41
  boxShadow: 'standard',
56
42
  p: 'lg',
@@ -106,6 +92,10 @@ var listViewItem = _objectSpread(_objectSpread({}, base), {}, {
106
92
  },
107
93
  '&.is-focused': {
108
94
  boxShadow: 'inset 0 0 5px #5873bdbf'
95
+ },
96
+ '&.has-separator': {
97
+ borderBottom: '1px solid',
98
+ borderBottomColor: 'line.hairline'
109
99
  }
110
100
  });
111
101
 
@@ -119,14 +109,27 @@ var listBoxSectionTitle = {
119
109
  };
120
110
  var chip = {
121
111
  cursor: 'pointer',
122
- height: '15px',
123
- p: '10px',
112
+ p: '3px 5px 4px 5px',
124
113
  alignItems: 'center',
125
114
  justifyContent: 'center',
126
115
  minWidth: '50px',
127
116
  alignSelf: 'flex-start',
128
117
  display: 'inline-flex !important',
129
- borderRadius: '5px'
118
+ borderRadius: '5px',
119
+ fontWeight: 1,
120
+ '& button': {
121
+ backgroundColor: 'transparent',
122
+ marginLeft: 'xs',
123
+ marginTop: '1px',
124
+ padding: '0',
125
+ '&.is-hovered': {
126
+ backgroundColor: 'white'
127
+ },
128
+ '& .mdi-icon': {
129
+ marginLeft: '0',
130
+ padding: '2px'
131
+ }
132
+ }
130
133
  };
131
134
  var inputInContainerSlot = {
132
135
  position: 'absolute',
@@ -284,7 +287,6 @@ var _default = {
284
287
  listItem: listItem,
285
288
  listBoxSectionTitle: listBoxSectionTitle,
286
289
  listViewItem: listViewItem,
287
- panel: panel,
288
290
  radioCheckedContent: radioCheckedContent,
289
291
  radioContainer: radioContainer,
290
292
  scrollbox: scrollbox,
@@ -179,32 +179,7 @@ var accordionHeader = _objectSpread(_objectSpread({}, base), {}, {
179
179
  color: 'accent.20'
180
180
  },
181
181
  '&.is-focused': _objectSpread({}, defaultFocus)
182
- }); // TODO: Remove this variant in Astro-UI 1.0.0
183
-
184
-
185
- var icon = {
186
- p: '3px',
187
- alignSelf: 'flex-start',
188
- flexGrow: 0,
189
- borderRadius: '100%',
190
- cursor: 'pointer',
191
- bg: 'transparent',
192
- 'path': {
193
- fill: 'text.secondary'
194
- },
195
- outline: 'none',
196
- color: 'white',
197
- '&.is-hovered': {
198
- bg: 'accent.90'
199
- },
200
- '&.is-pressed': {
201
- 'path': {
202
- fill: 'white'
203
- },
204
- bg: 'active'
205
- },
206
- '&.is-focused': _objectSpread({}, defaultFocus)
207
- };
182
+ });
208
183
 
209
184
  var primary = _objectSpread(_objectSpread({}, base), {}, {
210
185
  display: 'inline-flex',
@@ -330,7 +305,7 @@ var inline = _objectSpread(_objectSpread({}, base), {}, {
330
305
  bg: 'white',
331
306
  height: '22px',
332
307
  lineHeight: 1,
333
- fontSize: '14px',
308
+ fontSize: 'sm',
334
309
  borderRadius: '15px',
335
310
  border: '1px solid',
336
311
  borderColor: 'active',
@@ -512,7 +487,6 @@ var _default = {
512
487
  expandableRow: expandableRow,
513
488
  fileInputField: fileInputField,
514
489
  iconButton: iconButton,
515
- icon: icon,
516
490
  imageUpload: imageUpload,
517
491
  inline: inline,
518
492
  inverted: inverted,
@@ -54,8 +54,6 @@ var _messages = _interopRequireDefault(require("./messages"));
54
54
 
55
55
  var _numberField = _interopRequireDefault(require("./numberField"));
56
56
 
57
- var _popover = _interopRequireDefault(require("./popover"));
58
-
59
57
  var _overlayPanel = _interopRequireDefault(require("./overlayPanel"));
60
58
 
61
59
  var _popoverMenu = _interopRequireDefault(require("./popoverMenu"));
@@ -90,7 +88,6 @@ var _default = _objectSpread(_objectSpread({
90
88
  modal: _modal["default"],
91
89
  numberField: _numberField["default"],
92
90
  overlayPanel: _overlayPanel["default"],
93
- popover: _popover["default"],
94
91
  popoverMenu: _popoverMenu["default"],
95
92
  rockerbutton: _rockerbutton["default"],
96
93
  separator: _separator["default"],
@@ -83,8 +83,6 @@ export var Default = function Default() {
83
83
  return ___EmotionJSX(Box, {
84
84
  isRow: true,
85
85
  sx: {
86
- pt: '12px',
87
- pb: '12px',
88
86
  flexGrow: 1
89
87
  }
90
88
  }, ___EmotionJSX(Box, {
@@ -129,20 +127,14 @@ export var Default = function Default() {
129
127
  sx: {
130
128
  mr: '4px',
131
129
  height: '26px',
132
- width: '26px',
133
- 'path': {
134
- fill: 'active'
135
- }
130
+ width: '26px'
136
131
  }
137
132
  }, ___EmotionJSX(CreateIcon, null)), ___EmotionJSX(IconButton, {
138
133
  "aria-label": "vertical-lines-icon",
139
134
  sx: {
140
135
  mr: '4px',
141
136
  height: '26px',
142
- width: '26px',
143
- 'path': {
144
- fill: 'active'
145
- }
137
+ width: '26px'
146
138
  }
147
139
  }, ___EmotionJSX(MoreVertIcon, null)))));
148
140
  };
@@ -285,7 +277,8 @@ export var Default = function Default() {
285
277
  item: item
286
278
  }), item.key !== 'Organization' ? ___EmotionJSX(Separator, {
287
279
  sx: {
288
- m: 0
280
+ m: 0,
281
+ bg: 'neutral.90'
289
282
  }
290
283
  }) : null);
291
284
  }))
@@ -14,17 +14,15 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
14
14
 
15
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
16
16
 
17
- import React, { forwardRef, useRef, useImperativeHandle, useMemo } from 'react';
17
+ import React, { forwardRef, useRef, useImperativeHandle } from 'react';
18
18
  import PropTypes from 'prop-types';
19
19
  import { Button as ThemeUIButton } from 'theme-ui';
20
20
  import { useButton } from '@react-aria/button';
21
21
  import { useHover } from '@react-aria/interactions';
22
22
  import { useFocusRing } from '@react-aria/focus';
23
23
  import { mergeProps } from '@react-aria/utils';
24
- import { modes } from './constants';
25
- import { useAriaLabelWarning, useStatusClasses, useDeprecationWarning, usePropWarning } from '../../hooks';
24
+ import { useAriaLabelWarning, useStatusClasses, usePropWarning } from '../../hooks';
26
25
  import Loader from '../Loader';
27
- import Box from '../Box';
28
26
  import { jsx as ___EmotionJSX } from "@emotion/react";
29
27
  var Button = /*#__PURE__*/forwardRef(function (props, ref) {
30
28
  var className = props.className,
@@ -39,8 +37,7 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
39
37
  onPressChange = props.onPressChange,
40
38
  onPressUp = props.onPressUp,
41
39
  children = props.children,
42
- mode = props.mode,
43
- others = _objectWithoutProperties(props, ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children", "mode"]);
40
+ others = _objectWithoutProperties(props, ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children"]);
44
41
 
45
42
  var buttonRef = useRef();
46
43
  usePropWarning(props, 'disabled', 'isDisabled');
@@ -49,20 +46,13 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
49
46
  useImperativeHandle(ref, function () {
50
47
  return buttonRef.current;
51
48
  });
52
- var ButtonBase = useMemo(function () {
53
- return mode === modes.ICON ? Box : ThemeUIButton;
54
- }, [mode]);
55
- var elementType = useMemo(function () {
56
- if (mode === modes.ICON) return 'div';
57
- return 'button';
58
- }, [mode]);
59
49
 
60
50
  var _useFocusRing = useFocusRing(),
61
51
  isFocusVisible = _useFocusRing.isFocusVisible,
62
52
  focusProps = _useFocusRing.focusProps;
63
53
 
64
54
  var _useButton = useButton(_objectSpread({
65
- elementType: elementType
55
+ elementType: 'button'
66
56
  }, props), buttonRef),
67
57
  buttonProps = _useButton.buttonProps,
68
58
  isPressed = _useButton.isPressed;
@@ -79,12 +69,9 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
79
69
  }),
80
70
  classNames = _useStatusClasses.classNames;
81
71
 
82
- useDeprecationWarning('The "icon" variant for `Button` will be deprecated in Astro-UI 1.0.0, use the `IconButton` component instead.', {
83
- isActive: props.variant === 'icon'
84
- });
85
72
  var ariaLabel = props['aria-label'];
86
73
  useAriaLabelWarning('Button', ariaLabel);
87
- return ___EmotionJSX(ButtonBase, _extends({
74
+ return ___EmotionJSX(ThemeUIButton, _extends({
88
75
  "aria-label": ariaLabel || 'Button',
89
76
  ref: buttonRef,
90
77
  className: classNames,
@@ -167,15 +154,11 @@ Button.propTypes = {
167
154
  onPressUp: PropTypes.func,
168
155
 
169
156
  /** The styling variation of the button. */
170
- variant: PropTypes.string,
171
-
172
- /** The behavioral pattern to apply to the button. */
173
- mode: PropTypes.oneOf(['default', 'icon'])
157
+ variant: PropTypes.string
174
158
  };
175
159
  Button.defaultProps = {
176
160
  isDisabled: false,
177
- variant: 'default',
178
- mode: 'default'
161
+ variant: 'default'
179
162
  };
180
163
  Button.displayName = 'Button';
181
164
  export default Button;
@@ -1,8 +1,3 @@
1
- import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
2
- import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
3
-
4
- var _context;
5
-
6
1
  import React from 'react';
7
2
  import AddCircleIcon from 'mdi-react/AddCircleIcon';
8
3
  import Box from '../Box';
@@ -15,7 +10,9 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
15
10
  var variants = buttonVariants;
16
11
  delete variants.ICON;
17
12
  delete variants.ICON_BUTTON;
18
- delete variants.INVERTED;
13
+ delete variants.INVERTED; // add designer approved variants for devs to use here
14
+
15
+ var variantOptions = ['critical', 'danger', 'default', 'inline', 'link', 'primary', 'success', 'text'];
19
16
  export default {
20
17
  title: 'Button',
21
18
  component: Button,
@@ -23,11 +20,9 @@ export default {
23
20
  variant: {
24
21
  control: {
25
22
  type: 'select',
26
- options: _Object$values(variants)
23
+ options: variantOptions
27
24
  },
28
- defaultValue: _findInstanceProperty(_context = _Object$values(variants)).call(_context, function (value) {
29
- return value === 'default';
30
- })
25
+ defaultValue: 'default'
31
26
  },
32
27
  children: {
33
28
  description: 'Button text.',
@@ -1,11 +1,9 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import React from 'react';
3
3
  import userEvent from '@testing-library/user-event';
4
- import AddCircleIcon from 'mdi-react/AddCircleIcon';
5
4
  import axeTest from '../../utils/testUtils/testAxe';
6
5
  import { fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
7
6
  import Button from '.';
8
- import Icon from '../Icon';
9
7
  import { jsx as ___EmotionJSX } from "@emotion/react";
10
8
  var testId = 'test-button';
11
9
  var defaultProps = {
@@ -15,15 +13,6 @@ var defaultProps = {
15
13
  var getComponent = function getComponent() {
16
14
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
15
  return render(___EmotionJSX(Button, _extends({}, defaultProps, props)));
18
- };
19
-
20
- var getIconButton = function getIconButton() {
21
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22
- return render(___EmotionJSX(Button, _extends({}, defaultProps, props, {
23
- variant: "icon"
24
- }), ___EmotionJSX(Icon, {
25
- icon: AddCircleIcon
26
- })));
27
16
  }; // Need to be added to each test file to test accessibility using axe.
28
17
 
29
18
 
@@ -99,13 +88,4 @@ test('button renders children when not loading', function () {
99
88
  expect(childWrapper).toBeInTheDocument();
100
89
  expect(childWrapper).toBeVisible();
101
90
  expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
102
- });
103
- test('passing in an icon makes the button parent a div', function () {
104
- getIconButton({
105
- mode: 'icon'
106
- });
107
- var button = screen.getByRole('button');
108
- expect(button).toBeInTheDocument();
109
- expect(button).toBeVisible();
110
- expect(button).toBeInstanceOf(HTMLDivElement);
111
91
  });
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import { ChipContext } from './ChipContext';
4
5
  import Box from '../Box/Box';
5
6
  import Text from '../Text/Text';
6
7
  import * as colors from '../../styles/colors';
@@ -12,21 +13,31 @@ import * as colors from '../../styles/colors';
12
13
 
13
14
  import { jsx as ___EmotionJSX } from "@emotion/react";
14
15
  var Chip = /*#__PURE__*/React.forwardRef(function (props, ref) {
15
- var children = props.children,
16
+ var bg = props.bg,
17
+ children = props.children,
16
18
  textColor = props.textColor,
17
19
  textProps = props.textProps,
18
- label = props.label;
19
- return ___EmotionJSX(Box, _extends({
20
+ label = props.label,
21
+ isUppercase = props.isUppercase;
22
+ return ___EmotionJSX(ChipContext.Provider, {
23
+ value: {
24
+ bg: bg
25
+ }
26
+ }, ___EmotionJSX(Box, _extends({
20
27
  isRow: true,
21
28
  variant: "boxes.chip",
29
+ sx: isUppercase && {
30
+ paddingBottom: '3px'
31
+ },
22
32
  ref: ref
23
33
  }, props), ___EmotionJSX(Text, _extends({
24
34
  variant: "label",
25
- sx: {
26
- textTransform: 'uppercase'
27
- },
28
- color: textColor
29
- }, textProps), label), children);
35
+ color: textColor,
36
+ sx: isUppercase && {
37
+ textTransform: 'uppercase',
38
+ fontSize: '11px'
39
+ }
40
+ }, textProps), label), children));
30
41
  });
31
42
  Chip.propTypes = {
32
43
  /** The text color of the chip. */
@@ -39,10 +50,14 @@ Chip.propTypes = {
39
50
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
40
51
 
41
52
  /** Props object that is spread directly into the textfield. */
42
- textProps: PropTypes.shape({})
53
+ textProps: PropTypes.shape({}),
54
+
55
+ /** When true, display chip label as uppercase. */
56
+ isUppercase: PropTypes.bool
43
57
  };
44
58
  Chip.defaultProps = {
45
59
  textColor: 'white',
46
- bg: colors.neutral[10]
60
+ bg: colors.neutral[10],
61
+ isUppercase: false
47
62
  };
48
63
  export default Chip;
@@ -3,8 +3,11 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
3
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
4
4
  import React from 'react';
5
5
  import Clear from 'mdi-react/CloseIcon';
6
- import Chip from '../Chip/Chip';
7
- import Icon from '../Icon/Icon';
6
+ import ContentCopy from 'mdi-react/ContentCopyIcon';
7
+ import Earth from 'mdi-react/EarthIcon';
8
+ import Chip from '../Chip';
9
+ import Icon from '../Icon';
10
+ import IconButton from '../IconButton';
8
11
  import { flatColorList } from '../../styles/colors.js';
9
12
  import { jsx as ___EmotionJSX } from "@emotion/react";
10
13
  export default {
@@ -40,6 +43,12 @@ export default {
40
43
  control: {
41
44
  type: 'text'
42
45
  }
46
+ },
47
+ isUppercase: {
48
+ defaultValue: false,
49
+ control: {
50
+ type: 'boolean'
51
+ }
43
52
  }
44
53
  }
45
54
  };
@@ -59,13 +68,40 @@ export var ChipWithCustomColors = function ChipWithCustomColors() {
59
68
  });
60
69
  };
61
70
  export var ChipWithIcon = function ChipWithIcon() {
62
- return ___EmotionJSX(Chip, {
63
- label: "Chip with Icon",
71
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Chip, {
72
+ label: "Chip with Icon Button",
64
73
  bg: "navy"
74
+ }, ___EmotionJSX(IconButton, {
75
+ "aria-label": "Clear Chip with Icon Button",
76
+ variant: "inverted"
65
77
  }, ___EmotionJSX(Icon, {
66
78
  icon: Clear,
67
79
  ml: "xs",
80
+ size: "14px"
81
+ }))), ___EmotionJSX("div", {
82
+ style: {
83
+ padding: '5px'
84
+ }
85
+ }), ___EmotionJSX(Chip, {
86
+ label: "Chip with Icon Button"
87
+ }, ___EmotionJSX(IconButton, {
88
+ "aria-label": "Clear Chip with Icon Button",
89
+ variant: "inverted"
90
+ }, ___EmotionJSX(Icon, {
91
+ icon: Earth,
92
+ ml: "xs",
93
+ size: "14px"
94
+ }))), ___EmotionJSX("div", {
95
+ style: {
96
+ padding: '5px'
97
+ }
98
+ }), ___EmotionJSX(Chip, {
99
+ label: "Chip with Icon",
100
+ bg: "green"
101
+ }, ___EmotionJSX(Icon, {
102
+ icon: ContentCopy,
103
+ ml: "xs",
68
104
  size: "14px",
69
105
  color: "white"
70
- }));
106
+ })));
71
107
  };
@@ -31,4 +31,13 @@ test('renders children within Chip component', function () {
31
31
  });
32
32
  var mockedChildren = screen.getByRole('button');
33
33
  expect(mockedChildren).toBeInTheDocument();
34
+ });
35
+ test('renders Chip component with uppercase', function () {
36
+ var label = 'uppercase';
37
+ var isUppercase = true;
38
+ getComponent({
39
+ label: label,
40
+ isUppercase: isUppercase
41
+ });
42
+ expect(screen.queryByText('uppercase')).toHaveStyleRule('text-transform', 'uppercase');
34
43
  });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ var defaultValue = 'inherit';
3
+ export var ChipContext = /*#__PURE__*/React.createContext(defaultValue);
@@ -14,13 +14,15 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
14
14
 
15
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
16
16
 
17
- import React, { forwardRef, useRef, useImperativeHandle } from 'react';
17
+ import React, { forwardRef, useRef, useImperativeHandle, useContext } from 'react';
18
18
  import PropTypes from 'prop-types';
19
19
  import { IconButton as ThemeUIIconButton } from 'theme-ui';
20
+ import { useButton } from '@react-aria/button';
20
21
  import { useFocusRing } from '@react-aria/focus';
21
- import { Pressable, useHover, usePress } from '@react-aria/interactions';
22
+ import { Pressable, useHover } from '@react-aria/interactions';
22
23
  import { mergeProps } from '@react-aria/utils';
23
24
  import { useAriaLabelWarning, useStatusClasses } from '../../hooks';
25
+ import { ChipContext } from '../Chip/ChipContext';
24
26
  import TooltipTrigger, { Tooltip } from '../TooltipTrigger';
25
27
  /**
26
28
  * Convenience wrapper for a Button + Icon. This component applies specific styles necessary for
@@ -51,11 +53,12 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
51
53
  return buttonRef.current;
52
54
  });
53
55
 
54
- var _usePress = usePress(_objectSpread({
55
- ref: buttonRef
56
- }, props)),
57
- isPressed = _usePress.isPressed,
58
- pressProps = _usePress.pressProps;
56
+ var _useButton = useButton(_objectSpread({}, props), buttonRef),
57
+ buttonProps = _useButton.buttonProps,
58
+ isPressed = _useButton.isPressed;
59
+
60
+ var _useContext = useContext(ChipContext),
61
+ chipBg = _useContext.bg;
59
62
 
60
63
  var _useHover = useHover(props),
61
64
  hoverProps = _useHover.hoverProps,
@@ -80,8 +83,13 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
80
83
  tabIndex: 0,
81
84
  ref: buttonRef,
82
85
  className: classNames,
83
- "aria-label": ariaLabel || 'Icon Button'
84
- }, others, mergeProps(hoverProps, focusProps, pressProps)), children);
86
+ "aria-label": ariaLabel || 'Icon Button',
87
+ sx: chipBg && isHovered && {
88
+ 'path': {
89
+ fill: chipBg
90
+ }
91
+ }
92
+ }, mergeProps(hoverProps, focusProps, buttonProps, others)), children);
85
93
 
86
94
  if (title) {
87
95
  return ___EmotionJSX(TooltipTrigger, {
@@ -32,7 +32,6 @@ test('default icon button', function () {
32
32
  var button = screen.getByRole('button');
33
33
  expect(button).toHaveAttribute('data-testid', testId);
34
34
  expect(button).toBeInstanceOf(HTMLButtonElement);
35
- expect(button).toHaveAttribute('tabindex', '0');
36
35
  expect(button).toBeInTheDocument();
37
36
  });
38
37
  test('icon button hover', function () {
@@ -32,7 +32,6 @@ export var Default = function Default(args) {
32
32
  isRow: true,
33
33
  alignSelf: "center"
34
34
  }, ___EmotionJSX(IconButton, {
35
- variant: "icon",
36
35
  size: 26
37
36
  }, ___EmotionJSX(Icon, {
38
37
  icon: MoreVertIcon,
@@ -64,7 +63,6 @@ export var WithSubtitle = function WithSubtitle(args) {
64
63
  isRow: true,
65
64
  alignSelf: "center"
66
65
  }, ___EmotionJSX(IconButton, {
67
- variant: "icon",
68
66
  size: 26
69
67
  }, ___EmotionJSX(Icon, {
70
68
  icon: MoreVertIcon,
@@ -37,18 +37,19 @@ export var collectionTypes = {
37
37
  PLACEHOLDER: 'placeholder'
38
38
  };
39
39
  export function useListLayout(state) {
40
+ var ROW_HEIGHT = 81;
40
41
  var collator = useCollator({
41
42
  usage: 'search',
42
43
  sensitivity: 'base'
43
44
  });
44
45
  var layout = useMemo(function () {
45
46
  return new ListLayout({
46
- estimatedRowHeight: 81,
47
+ estimatedRowHeight: ROW_HEIGHT,
47
48
  estimatedHeadingHeight: 26,
48
49
  paddingRight: 4,
49
50
  paddingLeft: 4,
50
- loaderHeight: 81,
51
- placeholderHeight: 81,
51
+ loaderHeight: ROW_HEIGHT,
52
+ placeholderHeight: ROW_HEIGHT,
52
53
  collator: collator
53
54
  });
54
55
  }, [collator]);
@@ -8,7 +8,6 @@ import { useGridCell, useGridRow } from '@react-aria/grid';
8
8
  import { useHover } from '@react-aria/interactions';
9
9
  import { ListViewContext } from '../ListView/ListViewContext';
10
10
  import Box from '../Box';
11
- import Separator from '../Separator';
12
11
  import { useStatusClasses } from '../../hooks';
13
12
  import { jsx as ___EmotionJSX } from "@emotion/react";
14
13
 
@@ -65,7 +64,8 @@ var ListViewItem = function ListViewItem(props) {
65
64
  var _useStatusClasses = useStatusClasses(className, {
66
65
  isHovered: isHovered,
67
66
  isSelected: isSelected,
68
- isFocused: isDisabled ? false : isFocusVisible
67
+ isFocused: isDisabled ? false : isFocusVisible,
68
+ hasSeparator: hasSeparator
69
69
  }),
70
70
  classNames = _useStatusClasses.classNames;
71
71
 
@@ -86,9 +86,7 @@ var ListViewItem = function ListViewItem(props) {
86
86
  isSelected: isSelected,
87
87
  className: classNames,
88
88
  "data-id": dataId
89
- }, listItemProps), item.rendered)), hasSeparator && ___EmotionJSX(Separator, {
90
- m: "0px"
91
- }));
89
+ }, listItemProps), item.rendered)));
92
90
  };
93
91
 
94
92
  ListViewItem.propTypes = {
@@ -89,6 +89,7 @@ var Stepper = /*#__PURE__*/forwardRef(function (props, ref) {
89
89
  },
90
90
  textValue: textValue,
91
91
  title: step,
92
+ "aria-label": textValue,
92
93
  content: item.rendered,
93
94
  separator: !isFirst && line
94
95
  });