@pingux/astro 1.12.0 → 1.13.0-alpha.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.
@@ -36,13 +36,18 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
36
36
  */
37
37
  var Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
38
38
  return (0, _react2.jsx)(_themeUi.Avatar, (0, _extends2["default"])({
39
- ref: ref,
40
- alt: "Avatar"
39
+ ref: ref
41
40
  }, props));
42
41
  });
43
42
  Avatar.propTypes = {
44
43
  /** Source of avatar. */
45
- src: _propTypes["default"].string.isRequired
44
+ src: _propTypes["default"].string.isRequired,
45
+
46
+ /** Alternative text for avatar. */
47
+ alt: _propTypes["default"].string
48
+ };
49
+ Avatar.defaultProps = {
50
+ alt: 'Avatar'
46
51
  };
47
52
  Avatar.displayName = 'Avatar';
48
53
  var _default = Avatar;
@@ -34,4 +34,14 @@ test('an avatar is rendered', function () {
34
34
 
35
35
  expect(img).toBeInstanceOf(HTMLImageElement);
36
36
  expect(img).toBeInTheDocument();
37
+ expect(img).toHaveAttribute('alt', 'Avatar');
38
+ });
39
+ test('an avatar is rendered with custom alt', function () {
40
+ getComponent({
41
+ alt: 'Custom Alt'
42
+ });
43
+
44
+ var img = _testWrapper.screen.getByRole('img');
45
+
46
+ expect(img).toHaveAttribute('alt', 'Custom Alt');
37
47
  });
@@ -54,7 +54,7 @@ var _Loader = _interopRequireDefault(require("../Loader"));
54
54
 
55
55
  var _react2 = require("@emotion/react");
56
56
 
57
- var _excluded = ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children", "variant"];
57
+ var _excluded = ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children", "variant", "tabIndex"];
58
58
 
59
59
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
60
60
 
@@ -78,6 +78,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
78
78
  onPressUp = props.onPressUp,
79
79
  children = props.children,
80
80
  variant = props.variant,
81
+ tabIndex = props.tabIndex,
81
82
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
82
83
  var buttonRef = (0, _react.useRef)();
83
84
  (0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
@@ -132,7 +133,9 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
132
133
  alignItems: 'center'
133
134
  },
134
135
  variant: variant
135
- }, others, (0, _utils.mergeProps)(hoverProps, focusProps, buttonProps)), isLoading ? (0, _react2.jsx)("span", {
136
+ }, others, (0, _utils.mergeProps)(hoverProps, focusProps, _objectSpread(_objectSpread({}, buttonProps), {}, {
137
+ tabIndex: tabIndex
138
+ }))), isLoading ? (0, _react2.jsx)("span", {
136
139
  style: {
137
140
  visibility: 'hidden'
138
141
  }
@@ -204,7 +207,10 @@ Button.propTypes = {
204
207
  onPressUp: _propTypes["default"].func,
205
208
 
206
209
  /** The styling variation of the button. */
207
- variant: _propTypes["default"].string
210
+ variant: _propTypes["default"].string,
211
+
212
+ /** The focus variation of the button. */
213
+ tabIndex: _propTypes["default"].number
208
214
  };
209
215
  Button.defaultProps = {
210
216
  isDisabled: false,
@@ -85,7 +85,7 @@ test('renders component in the default state', function () {
85
85
  test('copy button is hovered and renders tooltip via mouse', function () {
86
86
  getComponent();
87
87
 
88
- var copyBtn = _testWrapper.screen.getByLabelText('copy');
88
+ var copyBtn = _testWrapper.screen.getByLabelText('copy to clipboard');
89
89
 
90
90
  expect(copyBtn).not.toHaveFocus();
91
91
 
@@ -98,7 +98,7 @@ test('copy button is hovered and renders tooltip via mouse', function () {
98
98
  test('copy button is focused and renders tooltip via keyboard', function () {
99
99
  getComponent();
100
100
 
101
- var copyBtn = _testWrapper.screen.getByLabelText('copy');
101
+ var copyBtn = _testWrapper.screen.getByLabelText('copy to clipboard');
102
102
 
103
103
  expect(copyBtn).not.toHaveFocus();
104
104
 
@@ -141,7 +141,7 @@ test('click on copy button copies data to the clipboard', /*#__PURE__*/(0, _asyn
141
141
  switch (_context2.prev = _context2.next) {
142
142
  case 0:
143
143
  getComponent();
144
- button = _testWrapper.screen.getByLabelText('copy');
144
+ button = _testWrapper.screen.getByLabelText('copy to clipboard');
145
145
  _context2.next = 4;
146
146
  return (0, _testWrapper.act)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
147
147
  return _regenerator["default"].wrap(function _callee$(_context) {
@@ -176,7 +176,7 @@ test('after button click, the tooltip renders with the text "Copied!"', /*#__PUR
176
176
  switch (_context4.prev = _context4.next) {
177
177
  case 0:
178
178
  getComponent();
179
- button = _testWrapper.screen.getByLabelText('copy');
179
+ button = _testWrapper.screen.getByLabelText('copy to clipboard');
180
180
  _context4.next = 4;
181
181
  return (0, _testWrapper.act)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
182
182
  return _regenerator["default"].wrap(function _callee3$(_context3) {
@@ -159,7 +159,8 @@ var ComboBoxInput = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
159
159
  variant: "comboBox"
160
160
  }, triggerProps, {
161
161
  ref: triggerRef,
162
- isDisabled: isDisabled || isReadOnly
162
+ isDisabled: isDisabled || isReadOnly,
163
+ tabIndex: -1
163
164
  }), (0, _react2.jsx)(_index.Icon, {
164
165
  icon: _MenuDownIcon["default"],
165
166
  sx: isOpen ? {
@@ -39,7 +39,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
39
39
  var CopyButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
40
40
  return (0, _react2.jsx)(_IconButton["default"], (0, _extends2["default"])({
41
41
  ref: ref,
42
- "aria-label": "copy",
42
+ "aria-label": "copy to clipboard",
43
43
  variant: "buttons.copy"
44
44
  }, (0, _lodash.omit)(props, 'iconProps')), (0, _react2.jsx)(_Icon["default"], (0, _extends2["default"])({
45
45
  icon: _ContentCopyIcon["default"],
@@ -34,6 +34,8 @@ var _interactions = require("@react-aria/interactions");
34
34
 
35
35
  var _utils = require("@react-aria/utils");
36
36
 
37
+ var _liveAnnouncer = require("@react-aria/live-announcer");
38
+
37
39
  var _index = require("../../index");
38
40
 
39
41
  var _CopyButton = _interopRequireDefault(require("./CopyButton"));
@@ -101,6 +103,7 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
101
103
 
102
104
  (0, _react.useEffect)(function () {
103
105
  if (isCopied) {
106
+ (0, _liveAnnouncer.announce)('Copied!', 'polite');
104
107
  var timer = (0, _setTimeout2["default"])(function () {
105
108
  setIsCopied(false);
106
109
  }, 1000);
@@ -115,7 +118,8 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
115
118
  var content = mode === 'link' || mode === 'nonClickableContent' ? children : (0, _react2.jsx)(_index.Button, (0, _extends2["default"])({
116
119
  variant: "quiet",
117
120
  onPress: copyToClipboard,
118
- "aria-label": "copy-content"
121
+ "aria-label": "copy-content",
122
+ tabIndex: -1
119
123
  }, focusProps), children);
120
124
  var tooltip = isCopied ? 'Copied!' : tooltipText;
121
125
  var isTooltipOpen = isFocusVisible || isHovered || isCopied;
@@ -88,19 +88,10 @@ describe('Text mode', function () {
88
88
  expect(_testWrapper.screen.queryByRole('tooltip')).toBeInTheDocument();
89
89
  expect(_testWrapper.screen.queryByRole('tooltip')).toHaveTextContent('Copy to clipboard');
90
90
  });
91
- test('content and copy buttons are focused with keyboard', function () {
91
+ test('copy button is focused with keyboard', function () {
92
92
  getComponent();
93
93
 
94
- var contentBtn = _testWrapper.screen.getByLabelText('copy-content');
95
-
96
- expect(contentBtn).not.toHaveFocus();
97
-
98
- _userEvent["default"].tab();
99
-
100
- expect(contentBtn).toHaveFocus();
101
- expect(contentBtn).toHaveClass('is-focused');
102
-
103
- var copyBtn = _testWrapper.screen.getByLabelText('copy');
94
+ var copyBtn = _testWrapper.screen.getByLabelText('copy to clipboard');
104
95
 
105
96
  expect(copyBtn).not.toHaveFocus();
106
97
 
@@ -164,7 +155,7 @@ describe('Text mode', function () {
164
155
  switch (_context4.prev = _context4.next) {
165
156
  case 0:
166
157
  getComponent();
167
- button = _testWrapper.screen.getByLabelText('copy');
158
+ button = _testWrapper.screen.getByLabelText('copy to clipboard');
168
159
  _context4.next = 4;
169
160
  return (0, _testWrapper.act)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
170
161
  return _regenerator["default"].wrap(function _callee3$(_context3) {
@@ -202,7 +193,7 @@ describe('Text mode', function () {
202
193
  getComponent({
203
194
  textToCopy: textToCopy
204
195
  });
205
- button = _testWrapper.screen.getByLabelText('copy');
196
+ button = _testWrapper.screen.getByLabelText('copy to clipboard');
206
197
  _context6.next = 5;
207
198
  return (0, _testWrapper.act)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
208
199
  return _regenerator["default"].wrap(function _callee5$(_context5) {
@@ -238,7 +229,7 @@ describe('Text mode', function () {
238
229
  case 0:
239
230
  global.navigator.clipboard = undefined;
240
231
  getComponent();
241
- button = _testWrapper.screen.getByLabelText('copy');
232
+ button = _testWrapper.screen.getByLabelText('copy to clipboard');
242
233
  _context8.next = 5;
243
234
  return (0, _testWrapper.act)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
244
235
  return _regenerator["default"].wrap(function _callee7$(_context7) {
@@ -283,7 +274,7 @@ describe('Text mode', function () {
283
274
  getComponent();
284
275
  spy = jest.spyOn(console, 'error');
285
276
  expect(spy).not.toHaveBeenCalled();
286
- button = _testWrapper.screen.getByLabelText('copy');
277
+ button = _testWrapper.screen.getByLabelText('copy to clipboard');
287
278
  _context10.next = 9;
288
279
  return (0, _testWrapper.act)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
289
280
  return _regenerator["default"].wrap(function _callee9$(_context9) {
@@ -319,7 +310,7 @@ describe('Text mode', function () {
319
310
  switch (_context12.prev = _context12.next) {
320
311
  case 0:
321
312
  getComponent();
322
- button = _testWrapper.screen.getByLabelText('copy');
313
+ button = _testWrapper.screen.getByLabelText('copy to clipboard');
323
314
  _context12.next = 4;
324
315
  return (0, _testWrapper.act)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
325
316
  return _regenerator["default"].wrap(function _callee11$(_context11) {
@@ -354,7 +345,7 @@ describe('Text mode', function () {
354
345
  switch (_context14.prev = _context14.next) {
355
346
  case 0:
356
347
  getComponent();
357
- button = _testWrapper.screen.getByLabelText('copy');
348
+ button = _testWrapper.screen.getByLabelText('copy to clipboard');
358
349
  _context14.next = 4;
359
350
  return (0, _testWrapper.act)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
360
351
  return _regenerator["default"].wrap(function _callee13$(_context13) {
@@ -415,7 +406,7 @@ describe('Link mode', function () {
415
406
 
416
407
  expect(_testWrapper.screen.queryByRole('tooltip')).not.toBeInTheDocument();
417
408
 
418
- var button = _testWrapper.screen.getByLabelText('copy');
409
+ var button = _testWrapper.screen.getByLabelText('copy to clipboard');
419
410
 
420
411
  _testWrapper.fireEvent.mouseMove(button);
421
412
 
@@ -426,7 +417,7 @@ describe('Link mode', function () {
426
417
  test('copy button is focused with keyboard', function () {
427
418
  getComponent();
428
419
 
429
- var copyBtn = _testWrapper.screen.getByLabelText('copy');
420
+ var copyBtn = _testWrapper.screen.getByLabelText('copy to clipboard');
430
421
 
431
422
  expect(copyBtn).not.toHaveFocus();
432
423
 
@@ -454,7 +445,7 @@ describe('Link mode', function () {
454
445
  switch (_context16.prev = _context16.next) {
455
446
  case 0:
456
447
  getComponent();
457
- button = _testWrapper.screen.getByLabelText('copy');
448
+ button = _testWrapper.screen.getByLabelText('copy to clipboard');
458
449
  _context16.next = 4;
459
450
  return (0, _testWrapper.act)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15() {
460
451
  return _regenerator["default"].wrap(function _callee15$(_context15) {
@@ -58,6 +58,8 @@ var _MenuItem = _interopRequireDefault(require("../MenuItem"));
58
58
 
59
59
  var _Box = _interopRequireDefault(require("../Box"));
60
60
 
61
+ var _orientation = _interopRequireDefault(require("../../utils/devUtils/constants/orientation"));
62
+
61
63
  var _react2 = require("@emotion/react");
62
64
 
63
65
  var _excluded = ["isDisabled", "onAction", "onSelectionChange", "isNotFocusedOnHover"];
@@ -111,7 +113,8 @@ var Menu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
111
113
  return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
112
114
  as: "ul",
113
115
  ref: menuRef,
114
- variant: "menu"
116
+ variant: "menu",
117
+ "aria-orientation": _orientation["default"].VERTICAL
115
118
  }, others, (0, _utils.mergeProps)(focusProps, menuProps)), (0, _map["default"])(_context = (0, _from["default"])(state.collection)).call(_context, function (item) {
116
119
  return (0, _react2.jsx)(_MenuItem["default"], {
117
120
  key: item.key,
@@ -20,6 +20,8 @@ var _testWrapper = require("../../utils/testUtils/testWrapper");
20
20
 
21
21
  var _index = require("../../index");
22
22
 
23
+ var _orientation = _interopRequireDefault(require("../../utils/devUtils/constants/orientation"));
24
+
23
25
  var _react2 = require("@emotion/react");
24
26
 
25
27
  var testTitle = 'Test Title';
@@ -59,6 +61,7 @@ test('should render basic menu with children', function () {
59
61
  var menuItems = _testWrapper.screen.queryAllByRole('menuitem');
60
62
 
61
63
  expect(menuItems).toHaveLength(3);
64
+ expect(menu).toHaveAttribute('aria-orientation', _orientation["default"].VERTICAL);
62
65
  });
63
66
  test('should render items when selectionMode is set to single', function () {
64
67
  getComponent({
@@ -10,13 +10,18 @@ import { Avatar as ThemeUIAvatar } from 'theme-ui';
10
10
  import { jsx as ___EmotionJSX } from "@emotion/react";
11
11
  var Avatar = /*#__PURE__*/forwardRef(function (props, ref) {
12
12
  return ___EmotionJSX(ThemeUIAvatar, _extends({
13
- ref: ref,
14
- alt: "Avatar"
13
+ ref: ref
15
14
  }, props));
16
15
  });
17
16
  Avatar.propTypes = {
18
17
  /** Source of avatar. */
19
- src: PropTypes.string.isRequired
18
+ src: PropTypes.string.isRequired,
19
+
20
+ /** Alternative text for avatar. */
21
+ alt: PropTypes.string
22
+ };
23
+ Avatar.defaultProps = {
24
+ alt: 'Avatar'
20
25
  };
21
26
  Avatar.displayName = 'Avatar';
22
27
  export default Avatar;
@@ -21,4 +21,12 @@ test('an avatar is rendered', function () {
21
21
  var img = screen.getByRole('img');
22
22
  expect(img).toBeInstanceOf(HTMLImageElement);
23
23
  expect(img).toBeInTheDocument();
24
+ expect(img).toHaveAttribute('alt', 'Avatar');
25
+ });
26
+ test('an avatar is rendered with custom alt', function () {
27
+ getComponent({
28
+ alt: 'Custom Alt'
29
+ });
30
+ var img = screen.getByRole('img');
31
+ expect(img).toHaveAttribute('alt', 'Custom Alt');
24
32
  });
@@ -9,7 +9,7 @@ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
9
9
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
10
10
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
11
11
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
12
- var _excluded = ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children", "variant"];
12
+ var _excluded = ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children", "variant", "tabIndex"];
13
13
 
14
14
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
15
 
@@ -39,6 +39,7 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
39
39
  onPressUp = props.onPressUp,
40
40
  children = props.children,
41
41
  variant = props.variant,
42
+ tabIndex = props.tabIndex,
42
43
  others = _objectWithoutProperties(props, _excluded);
43
44
 
44
45
  var buttonRef = useRef();
@@ -94,7 +95,9 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
94
95
  alignItems: 'center'
95
96
  },
96
97
  variant: variant
97
- }, others, mergeProps(hoverProps, focusProps, buttonProps)), isLoading ? ___EmotionJSX("span", {
98
+ }, others, mergeProps(hoverProps, focusProps, _objectSpread(_objectSpread({}, buttonProps), {}, {
99
+ tabIndex: tabIndex
100
+ }))), isLoading ? ___EmotionJSX("span", {
98
101
  style: {
99
102
  visibility: 'hidden'
100
103
  }
@@ -166,7 +169,10 @@ Button.propTypes = {
166
169
  onPressUp: PropTypes.func,
167
170
 
168
171
  /** The styling variation of the button. */
169
- variant: PropTypes.string
172
+ variant: PropTypes.string,
173
+
174
+ /** The focus variation of the button. */
175
+ tabIndex: PropTypes.number
170
176
  };
171
177
  Button.defaultProps = {
172
178
  isDisabled: false,
@@ -60,7 +60,7 @@ test('renders component in the default state', function () {
60
60
  });
61
61
  test('copy button is hovered and renders tooltip via mouse', function () {
62
62
  getComponent();
63
- var copyBtn = screen.getByLabelText('copy');
63
+ var copyBtn = screen.getByLabelText('copy to clipboard');
64
64
  expect(copyBtn).not.toHaveFocus();
65
65
  userEvent.hover(copyBtn);
66
66
  expect(copyBtn).toHaveClass('is-hovered');
@@ -69,7 +69,7 @@ test('copy button is hovered and renders tooltip via mouse', function () {
69
69
  });
70
70
  test('copy button is focused and renders tooltip via keyboard', function () {
71
71
  getComponent();
72
- var copyBtn = screen.getByLabelText('copy');
72
+ var copyBtn = screen.getByLabelText('copy to clipboard');
73
73
  expect(copyBtn).not.toHaveFocus();
74
74
  userEvent.tab();
75
75
  expect(copyBtn).toHaveFocus();
@@ -105,7 +105,7 @@ test('click on copy button copies data to the clipboard', /*#__PURE__*/_asyncToG
105
105
  switch (_context2.prev = _context2.next) {
106
106
  case 0:
107
107
  getComponent();
108
- button = screen.getByLabelText('copy');
108
+ button = screen.getByLabelText('copy to clipboard');
109
109
  _context2.next = 4;
110
110
  return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
111
111
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -140,7 +140,7 @@ test('after button click, the tooltip renders with the text "Copied!"', /*#__PUR
140
140
  switch (_context4.prev = _context4.next) {
141
141
  case 0:
142
142
  getComponent();
143
- button = screen.getByLabelText('copy');
143
+ button = screen.getByLabelText('copy to clipboard');
144
144
  _context4.next = 4;
145
145
  return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
146
146
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -117,7 +117,8 @@ var ComboBoxInput = /*#__PURE__*/forwardRef(function (props, ref) {
117
117
  variant: "comboBox"
118
118
  }, triggerProps, {
119
119
  ref: triggerRef,
120
- isDisabled: isDisabled || isReadOnly
120
+ isDisabled: isDisabled || isReadOnly,
121
+ tabIndex: -1
121
122
  }), ___EmotionJSX(Icon, {
122
123
  icon: MenuDown,
123
124
  sx: isOpen ? {
@@ -9,7 +9,7 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
9
9
  var CopyButton = /*#__PURE__*/forwardRef(function (props, ref) {
10
10
  return ___EmotionJSX(IconButton, _extends({
11
11
  ref: ref,
12
- "aria-label": "copy",
12
+ "aria-label": "copy to clipboard",
13
13
  variant: "buttons.copy"
14
14
  }, omit(props, 'iconProps')), ___EmotionJSX(Icon, _extends({
15
15
  icon: ContentCopy,
@@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
9
9
  import { useFocusRing } from '@react-aria/focus';
10
10
  import { Pressable, useHover } from '@react-aria/interactions';
11
11
  import { mergeProps } from '@react-aria/utils';
12
+ import { announce } from '@react-aria/live-announcer';
12
13
  import { Box, Button, Tooltip, TooltipTrigger } from '../../index';
13
14
  import CopyButton from './CopyButton';
14
15
  import useCopyToClipboard from '../../hooks/useCopyToClipboard';
@@ -68,6 +69,8 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
68
69
 
69
70
  useEffect(function () {
70
71
  if (isCopied) {
72
+ announce('Copied!', 'polite');
73
+
71
74
  var timer = _setTimeout(function () {
72
75
  setIsCopied(false);
73
76
  }, 1000);
@@ -83,7 +86,8 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
83
86
  var content = mode === 'link' || mode === 'nonClickableContent' ? children : ___EmotionJSX(Button, _extends({
84
87
  variant: "quiet",
85
88
  onPress: copyToClipboard,
86
- "aria-label": "copy-content"
89
+ "aria-label": "copy-content",
90
+ tabIndex: -1
87
91
  }, focusProps), children);
88
92
  var tooltip = isCopied ? 'Copied!' : tooltipText;
89
93
  var isTooltipOpen = isFocusVisible || isHovered || isCopied;
@@ -60,14 +60,9 @@ describe('Text mode', function () {
60
60
  expect(screen.queryByRole('tooltip')).toBeInTheDocument();
61
61
  expect(screen.queryByRole('tooltip')).toHaveTextContent('Copy to clipboard');
62
62
  });
63
- test('content and copy buttons are focused with keyboard', function () {
63
+ test('copy button is focused with keyboard', function () {
64
64
  getComponent();
65
- var contentBtn = screen.getByLabelText('copy-content');
66
- expect(contentBtn).not.toHaveFocus();
67
- userEvent.tab();
68
- expect(contentBtn).toHaveFocus();
69
- expect(contentBtn).toHaveClass('is-focused');
70
- var copyBtn = screen.getByLabelText('copy');
65
+ var copyBtn = screen.getByLabelText('copy to clipboard');
71
66
  expect(copyBtn).not.toHaveFocus();
72
67
  userEvent.tab();
73
68
  expect(copyBtn).toHaveFocus();
@@ -128,7 +123,7 @@ describe('Text mode', function () {
128
123
  switch (_context4.prev = _context4.next) {
129
124
  case 0:
130
125
  getComponent();
131
- button = screen.getByLabelText('copy');
126
+ button = screen.getByLabelText('copy to clipboard');
132
127
  _context4.next = 4;
133
128
  return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
134
129
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -166,7 +161,7 @@ describe('Text mode', function () {
166
161
  getComponent({
167
162
  textToCopy: textToCopy
168
163
  });
169
- button = screen.getByLabelText('copy');
164
+ button = screen.getByLabelText('copy to clipboard');
170
165
  _context6.next = 5;
171
166
  return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
172
167
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -202,7 +197,7 @@ describe('Text mode', function () {
202
197
  case 0:
203
198
  global.navigator.clipboard = undefined;
204
199
  getComponent();
205
- button = screen.getByLabelText('copy');
200
+ button = screen.getByLabelText('copy to clipboard');
206
201
  _context8.next = 5;
207
202
  return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
208
203
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
@@ -247,7 +242,7 @@ describe('Text mode', function () {
247
242
  getComponent();
248
243
  spy = jest.spyOn(console, 'error');
249
244
  expect(spy).not.toHaveBeenCalled();
250
- button = screen.getByLabelText('copy');
245
+ button = screen.getByLabelText('copy to clipboard');
251
246
  _context10.next = 9;
252
247
  return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
253
248
  return _regeneratorRuntime.wrap(function _callee9$(_context9) {
@@ -283,7 +278,7 @@ describe('Text mode', function () {
283
278
  switch (_context12.prev = _context12.next) {
284
279
  case 0:
285
280
  getComponent();
286
- button = screen.getByLabelText('copy');
281
+ button = screen.getByLabelText('copy to clipboard');
287
282
  _context12.next = 4;
288
283
  return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
289
284
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
@@ -318,7 +313,7 @@ describe('Text mode', function () {
318
313
  switch (_context14.prev = _context14.next) {
319
314
  case 0:
320
315
  getComponent();
321
- button = screen.getByLabelText('copy');
316
+ button = screen.getByLabelText('copy to clipboard');
322
317
  _context14.next = 4;
323
318
  return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
324
319
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
@@ -374,14 +369,14 @@ describe('Link mode', function () {
374
369
  fireEvent.mouseMove(container);
375
370
  fireEvent.mouseEnter(container);
376
371
  expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
377
- var button = screen.getByLabelText('copy');
372
+ var button = screen.getByLabelText('copy to clipboard');
378
373
  fireEvent.mouseMove(button);
379
374
  fireEvent.mouseEnter(button);
380
375
  expect(screen.queryByRole('tooltip')).toBeInTheDocument();
381
376
  });
382
377
  test('copy button is focused with keyboard', function () {
383
378
  getComponent();
384
- var copyBtn = screen.getByLabelText('copy');
379
+ var copyBtn = screen.getByLabelText('copy to clipboard');
385
380
  expect(copyBtn).not.toHaveFocus();
386
381
  userEvent.tab();
387
382
  userEvent.tab();
@@ -405,7 +400,7 @@ describe('Link mode', function () {
405
400
  switch (_context16.prev = _context16.next) {
406
401
  case 0:
407
402
  getComponent();
408
- button = screen.getByLabelText('copy');
403
+ button = screen.getByLabelText('copy to clipboard');
409
404
  _context16.next = 4;
410
405
  return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
411
406
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
@@ -27,6 +27,7 @@ import { MenuContext } from '../../context/MenuContext';
27
27
  import { usePropWarning } from '../../hooks';
28
28
  import MenuItem from '../MenuItem';
29
29
  import Box from '../Box';
30
+ import ORIENTATION from '../../utils/devUtils/constants/orientation';
30
31
  /**
31
32
  * Menu component intended to be used as a wrapper for MenuItem.
32
33
  * This component is typically used alongside others such as PopoverMenu.
@@ -71,7 +72,8 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
71
72
  return ___EmotionJSX(Box, _extends({
72
73
  as: "ul",
73
74
  ref: menuRef,
74
- variant: "menu"
75
+ variant: "menu",
76
+ "aria-orientation": ORIENTATION.VERTICAL
75
77
  }, others, mergeProps(focusProps, menuProps)), _mapInstanceProperty(_context = _Array$from(state.collection)).call(_context, function (item) {
76
78
  return ___EmotionJSX(MenuItem, {
77
79
  key: item.key,
@@ -7,6 +7,7 @@ import userEvent from '@testing-library/user-event';
7
7
  import axeTest from '../../utils/testUtils/testAxe';
8
8
  import { render, screen, fireEvent } from '../../utils/testUtils/testWrapper';
9
9
  import { Menu, Item } from '../../index';
10
+ import ORIENTATION from '../../utils/devUtils/constants/orientation';
10
11
  import { jsx as ___EmotionJSX } from "@emotion/react";
11
12
  var testTitle = 'Test Title';
12
13
  var defaultProps = {
@@ -41,6 +42,7 @@ test('should render basic menu with children', function () {
41
42
  expect(menu).toBeInTheDocument();
42
43
  var menuItems = screen.queryAllByRole('menuitem');
43
44
  expect(menuItems).toHaveLength(3);
45
+ expect(menu).toHaveAttribute('aria-orientation', ORIENTATION.VERTICAL);
44
46
  });
45
47
  test('should render items when selectionMode is set to single', function () {
46
48
  getComponent({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.12.0",
3
+ "version": "1.13.0-alpha.0",
4
4
  "description": "PingUX themeable React component library",
5
5
  "author": "ux-development@pingidentity.com",
6
6
  "license": "Apache-2.0",