@magento/venia-ui 9.7.0 → 10.0.0-beta.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 (96) hide show
  1. package/i18n/en_US.json +23 -2
  2. package/lib/RootComponents/Category/NoProductsFound/noProductsFound.js +1 -1
  3. package/lib/RootComponents/Category/__tests__/__snapshots__/categoryContent.shimmer.spec.js.snap +6 -0
  4. package/lib/components/AccountChip/__tests__/__snapshots__/accountChip.spec.js.snap +3 -0
  5. package/lib/components/AccountChip/accountChip.js +14 -1
  6. package/lib/components/AccountInformationPage/__tests__/__snapshots__/editForm.spec.js.snap +15 -0
  7. package/lib/components/AddressBookPage/__tests__/__snapshots__/addEditDialog.spec.js.snap +28 -0
  8. package/lib/components/App/__tests__/app.spec.js +3 -1
  9. package/lib/components/App/app.js +1 -1
  10. package/lib/components/CartPage/GiftCards/__tests__/__snapshots__/giftCards.spec.js.snap +2 -0
  11. package/lib/components/CartPage/PriceAdjustments/CouponCode/__tests__/__snapshots__/couponCode.spec.js.snap +9 -3
  12. package/lib/components/CartPage/PriceAdjustments/ShippingMethods/__tests__/__snapshots__/shippingForm.spec.js.snap +15 -0
  13. package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/priceSummary.spec.js.snap +0 -2
  14. package/lib/components/CartPage/PriceSummary/priceSummary.js +2 -0
  15. package/lib/components/CartPage/ProductListing/EditModal/__tests__/__snapshots__/productForm.spec.js.snap +4 -0
  16. package/lib/components/CartPage/ProductListing/__tests__/__snapshots__/product.spec.js.snap +6 -0
  17. package/lib/components/CartPage/ProductListing/__tests__/__snapshots__/quantity.spec.js.snap +1 -0
  18. package/lib/components/CategoryTree/categoryBranch.js +1 -1
  19. package/lib/components/CategoryTree/categoryLeaf.js +1 -1
  20. package/lib/components/CategoryTree/categoryTree.js +1 -1
  21. package/lib/components/Checkout/__tests__/__snapshots__/addressForm.spec.js.snap +16 -0
  22. package/lib/components/Checkout/__tests__/__snapshots__/paymentsForm.spec.js.snap +7 -0
  23. package/lib/components/Checkout/section.module.css +0 -1
  24. package/lib/components/CheckoutPage/ItemsReview/__tests__/__snapshots__/itemsReview.spec.js.snap +3 -0
  25. package/lib/components/CheckoutPage/OrderConfirmationPage/__tests__/__snapshots__/createAccount.spec.js.snap +20 -0
  26. package/lib/components/CheckoutPage/OrderConfirmationPage/createAccount.js +16 -0
  27. package/lib/components/CheckoutPage/ShippingInformation/AddressForm/__tests__/__snapshots__/customerForm.spec.js.snap +46 -0
  28. package/lib/components/CheckoutPage/ShippingInformation/AddressForm/__tests__/__snapshots__/guestForm.spec.js.snap +68 -0
  29. package/lib/components/CheckoutPage/ShippingInformation/AddressForm/customerForm.js +36 -0
  30. package/lib/components/CheckoutPage/ShippingInformation/AddressForm/guestForm.js +36 -0
  31. package/lib/components/CheckoutPage/__tests__/__snapshots__/checkoutPage.spec.js.snap +1 -1
  32. package/lib/components/CheckoutPage/checkoutPage.js +4 -0
  33. package/lib/components/Country/__tests__/__snapshots__/country.spec.js.snap +2 -0
  34. package/lib/components/CreateAccount/__tests__/__snapshots__/createAccount.spec.js.snap +36 -10
  35. package/lib/components/CreateAccount/createAccount.js +18 -0
  36. package/lib/components/Field/fieldIcons.js +3 -1
  37. package/lib/components/FilterModalOpenButton/filterModalOpenButton.js +12 -2
  38. package/lib/components/ForgotPassword/ForgotPasswordForm/__tests__/__snapshots__/forgotPasswordForm.spec.js.snap +2 -0
  39. package/lib/components/Gallery/__tests__/__snapshots__/gallery.spec.js.snap +2 -0
  40. package/lib/components/Gallery/__tests__/__snapshots__/item.spec.js.snap +3 -0
  41. package/lib/components/Gallery/item.js +1 -0
  42. package/lib/components/Header/__tests__/__snapshots__/accountTrigger.spec.js.snap +1 -1
  43. package/lib/components/Header/accountTrigger.js +12 -5
  44. package/lib/components/Image/placeholderImage.js +1 -0
  45. package/lib/components/LegacyMiniCart/__tests__/__snapshots__/kebab.spec.js.snap +2 -0
  46. package/lib/components/LegacyMiniCart/__tests__/__snapshots__/miniCart.spec.js.snap +3 -0
  47. package/lib/components/LegacyMiniCart/kebab.js +14 -0
  48. package/lib/components/Link/__tests__/link.spec.js +8 -6
  49. package/lib/components/Link/link.js +1 -1
  50. package/lib/components/MiniCart/ProductList/__tests__/__snapshots__/item.spec.js.snap +8 -0
  51. package/lib/components/MiniCart/ProductList/item.js +11 -0
  52. package/lib/components/MyAccount/ResetPassword/__tests__/__snapshots__/resetPassword.spec.js.snap +16 -4
  53. package/lib/components/Newsletter/__tests__/__snapshots__/newsletter.spec.js.snap +2 -0
  54. package/lib/components/OrderHistoryPage/OrderDetails/__tests__/__snapshots__/item.spec.js.snap +1 -0
  55. package/lib/components/OrderHistoryPage/__tests__/__snapshots__/orderHistoryPage.spec.js.snap +13 -0
  56. package/lib/components/OrderHistoryPage/__tests__/__snapshots__/orderRow.spec.js.snap +4 -0
  57. package/lib/components/OrderHistoryPage/__tests__/__snapshots__/resetButton.spec.js.snap +3 -0
  58. package/lib/components/OrderHistoryPage/collapsedImageGallery.js +3 -3
  59. package/lib/components/OrderHistoryPage/orderHistoryPage.js +1 -0
  60. package/lib/components/OrderHistoryPage/orderRow.js +1 -0
  61. package/lib/components/OrderHistoryPage/resetButton.js +13 -2
  62. package/lib/components/PageLoadingIndicator/__tests__/pageLoadingIndicator.spec.js +1 -1
  63. package/lib/components/PageLoadingIndicator/pageLoadingIndicator.js +1 -1
  64. package/lib/components/Password/__tests__/__snapshots__/password.spec.js.snap +13 -3
  65. package/lib/components/Password/password.js +24 -2
  66. package/lib/components/ProductImageCarousel/__tests__/__snapshots__/carousel.spec.js.snap +18 -16
  67. package/lib/components/ProductImageCarousel/__tests__/__snapshots__/thumbnail.spec.js.snap +12 -12
  68. package/lib/components/ProductImageCarousel/__tests__/thumbnail.spec.js +2 -2
  69. package/lib/components/ProductImageCarousel/thumbnail.js +4 -5
  70. package/lib/components/ProductImageCarousel/thumbnail.module.css +0 -1
  71. package/lib/components/ProductOptions/__tests__/__snapshots__/swatch.spec.js.snap +6 -0
  72. package/lib/components/ProductOptions/__tests__/__snapshots__/swatchList.spec.js.snap +1 -0
  73. package/lib/components/ProductOptions/__tests__/swatch.spec.js +2 -1
  74. package/lib/components/ProductOptions/option.js +1 -0
  75. package/lib/components/ProductOptions/swatch.js +5 -2
  76. package/lib/components/ProductOptions/swatchList.js +5 -2
  77. package/lib/components/ProductSort/__tests__/__snapshots__/productSort.spec.js.snap +1 -0
  78. package/lib/components/ProductSort/productSort.js +17 -0
  79. package/lib/components/QuantityStepper/quantityStepper.module.css +0 -2
  80. package/lib/components/Region/__tests__/__snapshots__/region.spec.js.snap +3 -0
  81. package/lib/components/SearchBar/__tests__/__snapshots__/searchField.spec.js.snap +1 -0
  82. package/lib/components/SearchBar/__tests__/__snapshots__/suggestedProduct.spec.js.snap +1 -0
  83. package/lib/components/SearchBar/searchBar.js +6 -1
  84. package/lib/components/SearchBar/searchField.js +4 -2
  85. package/lib/components/SearchPage/__tests__/__snapshots__/searchPage.spec.js.snap +28 -28
  86. package/lib/components/SearchPage/searchPage.js +6 -4
  87. package/lib/components/SignIn/__tests__/__snapshots__/signIn.spec.js.snap +12 -0
  88. package/lib/components/SignIn/signIn.js +10 -0
  89. package/lib/components/Trigger/__tests__/__snapshots__/trigger.spec.js.snap +8 -2
  90. package/lib/components/Trigger/trigger.js +30 -5
  91. package/lib/components/Wishlist/WishlistDialog/CreateWishlistForm/__tests__/__snapshots__/createWishlistForm.spec.js.snap +2 -0
  92. package/lib/components/WishlistPage/__tests__/__snapshots__/createWishlist.ee.spec.js.snap +1 -0
  93. package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistEditFavoritesListDialog.spec.js.snap +4 -0
  94. package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistItem.spec.js.snap +2 -0
  95. package/lib/index.module.css +7 -9
  96. package/package.json +2 -2
@@ -13,6 +13,7 @@ exports[`Should disable delete icon while loading 1`] = `
13
13
  >
14
14
  <img
15
15
  alt="P1"
16
+ aria-hidden="true"
16
17
  className="image placeholder"
17
18
  loading="eager"
18
19
  src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
@@ -113,6 +114,7 @@ exports[`Should disable delete icon while loading 1`] = `
113
114
 
114
115
  </span>
115
116
  <button
117
+ aria-label="Item Deleted"
116
118
  className="deleteButton"
117
119
  disabled={true}
118
120
  onClick={[Function]}
@@ -170,6 +172,7 @@ exports[`Should render correctly 1`] = `
170
172
  >
171
173
  <img
172
174
  alt="P1"
175
+ aria-hidden="true"
173
176
  className="image placeholder"
174
177
  loading="eager"
175
178
  src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
@@ -270,6 +273,7 @@ exports[`Should render correctly 1`] = `
270
273
 
271
274
  </span>
272
275
  <button
276
+ aria-label="Delete"
273
277
  className="deleteButton"
274
278
  disabled={false}
275
279
  onClick={[Function]}
@@ -327,6 +331,7 @@ exports[`Should render correctly when configured to use variant thumbnail 1`] =
327
331
  >
328
332
  <img
329
333
  alt="P1"
334
+ aria-hidden="true"
330
335
  className="image placeholder"
331
336
  loading="eager"
332
337
  src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
@@ -427,6 +432,7 @@ exports[`Should render correctly when configured to use variant thumbnail 1`] =
427
432
 
428
433
  </span>
429
434
  <button
435
+ aria-label="Delete"
430
436
  className="deleteButton"
431
437
  disabled={false}
432
438
  onClick={[Function]}
@@ -484,6 +490,7 @@ exports[`Should render correctly with out of stock product 1`] = `
484
490
  >
485
491
  <img
486
492
  alt="P1"
493
+ aria-hidden="true"
487
494
  className="image placeholder"
488
495
  loading="eager"
489
496
  src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
@@ -584,6 +591,7 @@ exports[`Should render correctly with out of stock product 1`] = `
584
591
  Out-of-stock
585
592
  </span>
586
593
  <button
594
+ aria-label="Delete"
587
595
  className="deleteButton"
588
596
  disabled={false}
589
597
  onClick={[Function]}
@@ -52,6 +52,16 @@ const Item = props => {
52
52
  const rootClass = isDeleting ? classes.root_disabled : classes.root;
53
53
  const configured_variant = configuredVariant(configurable_options, product);
54
54
 
55
+ const minicartButtonDeleted = formatMessage({
56
+ id: 'global.deletedButton',
57
+ defaultMessage: 'Item Deleted'
58
+ });
59
+ const miniCartButton = formatMessage({
60
+ id: 'global.deleteButton',
61
+ defaultMessage: 'Delete'
62
+ });
63
+ const buttonStatus = isDeleting ? minicartButtonDeleted : miniCartButton;
64
+
55
65
  return (
56
66
  <div className={rootClass} data-cy="MiniCart-Item-root">
57
67
  <Link
@@ -113,6 +123,7 @@ const Item = props => {
113
123
  className={classes.deleteButton}
114
124
  disabled={isDeleting}
115
125
  data-cy="MiniCart-Item-deleteButton"
126
+ aria-label={buttonStatus}
116
127
  >
117
128
  <Icon
118
129
  size={16}
@@ -71,7 +71,9 @@ exports[`should render formErrors 1`] = `
71
71
  />
72
72
  </span>
73
73
  <span />
74
- <span />
74
+ <span
75
+ aria-hidden="false"
76
+ />
75
77
  </span>
76
78
  <p />
77
79
  </div>
@@ -100,11 +102,14 @@ exports[`should render formErrors 1`] = `
100
102
  />
101
103
  </span>
102
104
  <span />
103
- <span>
105
+ <span
106
+ aria-hidden="false"
107
+ >
104
108
  <button
105
109
  disabled={false}
106
110
  onClick={[Function]}
107
111
  onDragStart={[Function]}
112
+ onKey={true}
108
113
  onKeyDown={[Function]}
109
114
  onKeyUp={[Function]}
110
115
  onMouseDown={[Function]}
@@ -119,6 +124,7 @@ exports[`should render formErrors 1`] = `
119
124
  >
120
125
  <span>
121
126
  <svg
127
+ aria-label="View Password"
122
128
  fill="none"
123
129
  height={24}
124
130
  stroke="currentColor"
@@ -222,7 +228,9 @@ exports[`should render properly 1`] = `
222
228
  />
223
229
  </span>
224
230
  <span />
225
- <span />
231
+ <span
232
+ aria-hidden="false"
233
+ />
226
234
  </span>
227
235
  <p />
228
236
  </div>
@@ -251,11 +259,14 @@ exports[`should render properly 1`] = `
251
259
  />
252
260
  </span>
253
261
  <span />
254
- <span>
262
+ <span
263
+ aria-hidden="false"
264
+ >
255
265
  <button
256
266
  disabled={false}
257
267
  onClick={[Function]}
258
268
  onDragStart={[Function]}
269
+ onKey={true}
259
270
  onKeyDown={[Function]}
260
271
  onKeyUp={[Function]}
261
272
  onMouseDown={[Function]}
@@ -270,6 +281,7 @@ exports[`should render properly 1`] = `
270
281
  >
271
282
  <span>
272
283
  <svg
284
+ aria-label="View Password"
273
285
  fill="none"
274
286
  height={24}
275
287
  stroke="currentColor"
@@ -69,6 +69,7 @@ exports[`#Newsletter display renders correctly 1`] = `
69
69
  className="before"
70
70
  />
71
71
  <span
72
+ aria-hidden="false"
72
73
  className="after"
73
74
  />
74
75
  </span>
@@ -155,6 +156,7 @@ exports[`#Newsletter submit displays an error message if the email already subsc
155
156
  className="before"
156
157
  />
157
158
  <span
159
+ aria-hidden="false"
158
160
  className="after"
159
161
  />
160
162
  </span>
@@ -11,6 +11,7 @@ exports[`should render properly 1`] = `
11
11
  >
12
12
  <img
13
13
  alt="Product 1"
14
+ aria-hidden="true"
14
15
  className="undefined undefined"
15
16
  loading="eager"
16
17
  src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
@@ -90,6 +90,7 @@ exports[`renders correctly with data 1`] = `
90
90
  </span>
91
91
  </span>
92
92
  <span
93
+ aria-hidden="false"
93
94
  className="after"
94
95
  />
95
96
  </span>
@@ -97,6 +98,7 @@ exports[`renders correctly with data 1`] = `
97
98
  className="root"
98
99
  />
99
100
  <button
101
+ aria-label="submit"
100
102
  className="searchButton"
101
103
  disabled={false}
102
104
  onClick={[Function]}
@@ -280,6 +282,7 @@ exports[`renders correctly without data 1`] = `
280
282
  </span>
281
283
  </span>
282
284
  <span
285
+ aria-hidden="false"
283
286
  className="after"
284
287
  />
285
288
  </span>
@@ -287,6 +290,7 @@ exports[`renders correctly without data 1`] = `
287
290
  className="root"
288
291
  />
289
292
  <button
293
+ aria-label="submit"
290
294
  className="searchButton"
291
295
  disabled={false}
292
296
  onClick={[Function]}
@@ -457,11 +461,15 @@ exports[`renders invalid order id message if order id is wrong 1`] = `
457
461
  </span>
458
462
  </span>
459
463
  <span
464
+ aria-hidden="false"
460
465
  className="after"
461
466
  >
462
467
  <button
468
+ aria-hidden="false"
469
+ aria-label="Clear Text"
463
470
  className="root"
464
471
  onClick={[Function]}
472
+ onKeyDown={[Function]}
465
473
  type="button"
466
474
  >
467
475
  <span
@@ -500,6 +508,7 @@ exports[`renders invalid order id message if order id is wrong 1`] = `
500
508
  className="root"
501
509
  />
502
510
  <button
511
+ aria-label="submit"
503
512
  className="searchButton"
504
513
  disabled={false}
505
514
  onClick={[Function]}
@@ -645,6 +654,7 @@ exports[`renders loading indicator 1`] = `
645
654
  </span>
646
655
  </span>
647
656
  <span
657
+ aria-hidden="false"
648
658
  className="after"
649
659
  />
650
660
  </span>
@@ -652,6 +662,7 @@ exports[`renders loading indicator 1`] = `
652
662
  className="root"
653
663
  />
654
664
  <button
665
+ aria-label="submit"
655
666
  className="searchButton"
656
667
  disabled={true}
657
668
  onClick={[Function]}
@@ -856,6 +867,7 @@ exports[`renders no orders message is orders is empty 1`] = `
856
867
  </span>
857
868
  </span>
858
869
  <span
870
+ aria-hidden="false"
859
871
  className="after"
860
872
  />
861
873
  </span>
@@ -863,6 +875,7 @@ exports[`renders no orders message is orders is empty 1`] = `
863
875
  className="root"
864
876
  />
865
877
  <button
878
+ aria-label="submit"
866
879
  className="searchButton"
867
880
  disabled={false}
868
881
  onClick={[Function]}
@@ -127,6 +127,7 @@ exports[`it does not render order details if loading is true 1`] = `
127
127
  />
128
128
  </div>
129
129
  <button
130
+ aria-expanded={false}
130
131
  className="contentToggleContainer"
131
132
  onClick={[MockFunction handleContentToggle]}
132
133
  type="button"
@@ -285,6 +286,7 @@ exports[`it renders collapsed order row 1`] = `
285
286
  />
286
287
  </div>
287
288
  <button
289
+ aria-expanded={false}
288
290
  className="contentToggleContainer"
289
291
  onClick={[MockFunction handleContentToggle]}
290
292
  type="button"
@@ -571,6 +573,7 @@ exports[`it renders open order row 1`] = `
571
573
  />
572
574
  </div>
573
575
  <button
576
+ aria-expanded={true}
574
577
  className="contentToggleContainer"
575
578
  onClick={[MockFunction handleContentToggle]}
576
579
  type="button"
@@ -867,6 +870,7 @@ exports[`it renders with missing order information 1`] = `
867
870
  />
868
871
  </div>
869
872
  <button
873
+ aria-expanded={false}
870
874
  className="contentToggleContainer"
871
875
  onClick={[MockFunction]}
872
876
  type="button"
@@ -2,7 +2,10 @@
2
2
 
3
3
  exports[`renders reset trigger 1`] = `
4
4
  <button
5
+ aria-hidden="false"
6
+ aria-label="Clear Text"
5
7
  onClick={[Function]}
8
+ onKeyDown={[Function]}
6
9
  type="button"
7
10
  >
8
11
  <span>
@@ -19,13 +19,13 @@ const CollapsedImageGallery = props => {
19
19
  const baseImageElements = Object.values(items)
20
20
  .slice(0, DISPLAY_COUNT)
21
21
  .map((item, index) => {
22
- const { thumbnail } = item;
23
- const { label, url } = thumbnail;
22
+ const { thumbnail, name } = item;
23
+ const { url } = thumbnail;
24
24
 
25
25
  return (
26
26
  <Image
27
27
  key={Object.keys(items)[index]}
28
- alt={label}
28
+ alt={name}
29
29
  src={url}
30
30
  width={48}
31
31
  />
@@ -180,6 +180,7 @@ const OrderHistoryPage = props => {
180
180
  }
181
181
  priority={'high'}
182
182
  type="submit"
183
+ aria-label="submit"
183
184
  >
184
185
  {submitIcon}
185
186
  </Button>
@@ -131,6 +131,7 @@ const OrderRow = props => {
131
131
  className={classes.contentToggleContainer}
132
132
  onClick={handleContentToggle}
133
133
  type="button"
134
+ aria-expanded={isOpen}
134
135
  >
135
136
  {contentToggleIcon}
136
137
  </button>
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useFormApi } from 'informed';
3
+ import { useIntl } from 'react-intl';
3
4
  import { func } from 'prop-types';
4
5
  import { X as ClearIcon } from 'react-feather';
5
6
 
@@ -19,8 +20,18 @@ const ResetButton = props => {
19
20
  onReset();
20
21
  }
21
22
  };
22
-
23
- return <Trigger action={handleReset}>{clearIcon}</Trigger>;
23
+ const { formatMessage } = useIntl();
24
+ return (
25
+ <Trigger
26
+ action={handleReset}
27
+ addLabel={formatMessage({
28
+ id: 'global.clearText',
29
+ defaultMessage: 'Clear Text'
30
+ })}
31
+ >
32
+ {clearIcon}
33
+ </Trigger>
34
+ );
24
35
  };
25
36
 
26
37
  export default ResetButton;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { act, create } from 'react-test-renderer';
3
- import usePageLoadingIndicator from '@magento/peregrine/lib/talons/PageLoadingIndicator/usePageLoadingIndicator';
3
+ import { usePageLoadingIndicator } from '@magento/peregrine/lib/talons/PageLoadingIndicator/usePageLoadingIndicator';
4
4
  import PageLoadingIndicator from '../pageLoadingIndicator';
5
5
 
6
6
  jest.mock(
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { shape, string, bool } from 'prop-types';
3
3
  import { useStyle } from '../../classify';
4
4
  import defaultClasses from './pageLoadingIndicator.module.css';
5
- import usePageLoadingIndicator from '@magento/peregrine/lib/talons/PageLoadingIndicator/usePageLoadingIndicator';
5
+ import { usePageLoadingIndicator } from '@magento/peregrine/lib/talons/PageLoadingIndicator/usePageLoadingIndicator';
6
6
 
7
7
  const PageLoadingIndicator = props => {
8
8
  const classes = useStyle(defaultClasses, props.classes);
@@ -32,7 +32,9 @@ exports[`should render properly 1`] = `
32
32
  />
33
33
  </span>
34
34
  <span />
35
- <span />
35
+ <span
36
+ aria-hidden="false"
37
+ />
36
38
  </span>
37
39
  <p />
38
40
  </div>
@@ -71,11 +73,14 @@ exports[`should render show button if visible is false 1`] = `
71
73
  />
72
74
  </span>
73
75
  <span />
74
- <span>
76
+ <span
77
+ aria-hidden="false"
78
+ >
75
79
  <button
76
80
  disabled={false}
77
81
  onClick={[MockFunction]}
78
82
  onDragStart={[Function]}
83
+ onKey={true}
79
84
  onKeyDown={[Function]}
80
85
  onKeyUp={[Function]}
81
86
  onMouseDown={[Function]}
@@ -90,6 +95,7 @@ exports[`should render show button if visible is false 1`] = `
90
95
  >
91
96
  <span>
92
97
  <svg
98
+ aria-label="Hide Password"
93
99
  fill="none"
94
100
  height={24}
95
101
  stroke="currentColor"
@@ -150,11 +156,14 @@ exports[`should render toggle button if isToggleButtonHidden is false 1`] = `
150
156
  />
151
157
  </span>
152
158
  <span />
153
- <span>
159
+ <span
160
+ aria-hidden="false"
161
+ >
154
162
  <button
155
163
  disabled={false}
156
164
  onClick={[MockFunction]}
157
165
  onDragStart={[Function]}
166
+ onKey={true}
158
167
  onKeyDown={[Function]}
159
168
  onKeyUp={[Function]}
160
169
  onMouseDown={[Function]}
@@ -169,6 +178,7 @@ exports[`should render toggle button if isToggleButtonHidden is false 1`] = `
169
178
  >
170
179
  <span>
171
180
  <svg
181
+ aria-label="View Password"
172
182
  fill="none"
173
183
  height={24}
174
184
  stroke="currentColor"
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { string, bool, shape, func } from 'prop-types';
3
3
  import { Eye, EyeOff } from 'react-feather';
4
-
4
+ import { useIntl } from 'react-intl';
5
5
  import { useStyle } from '@magento/venia-ui/lib/classify';
6
6
  import { usePassword } from '@magento/peregrine/lib/talons/Password/usePassword';
7
7
 
@@ -27,13 +27,35 @@ const Password = props => {
27
27
  const { handleBlur, togglePasswordVisibility, visible } = talonProps;
28
28
  const classes = useStyle(defaultClasses, propClasses);
29
29
 
30
+ const handleKeypress = e => {
31
+ if (e.code == 'Enter') {
32
+ togglePasswordVisibility;
33
+ }
34
+ };
35
+ const { formatMessage } = useIntl();
36
+ const hidePassword = formatMessage({
37
+ id: 'password.hide',
38
+ defaultMessage: 'Hide Password'
39
+ });
40
+ const viewPassword = formatMessage({
41
+ id: 'password.view',
42
+ defaultMessage: 'View Password'
43
+ });
44
+ const speak = visible ? hidePassword : viewPassword;
45
+
30
46
  const passwordButton = (
31
47
  <Button
32
48
  className={classes.passwordButton}
33
49
  onClick={togglePasswordVisibility}
50
+ onKeyDown={handleKeypress}
51
+ onKey
34
52
  type="button"
35
53
  >
36
- {visible ? <Eye /> : <EyeOff />}
54
+ {visible ? (
55
+ <Eye aria-label={speak} />
56
+ ) : (
57
+ <EyeOff aria-label={speak} />
58
+ )}
37
59
  </Button>
38
60
  );
39
61
 
@@ -50,6 +50,7 @@ exports[`renders a transparent main image if no file name is provided 1`] = `
50
50
  >
51
51
  <img
52
52
  alt="image-product"
53
+ aria-hidden="true"
53
54
  className="image placeholder"
54
55
  loading="eager"
55
56
  src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
@@ -160,6 +161,7 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
160
161
  >
161
162
  <img
162
163
  alt="test-thumbnail1"
164
+ aria-hidden="true"
163
165
  className="image placeholder"
164
166
  loading="eager"
165
167
  src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
@@ -238,17 +240,17 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
238
240
  <div
239
241
  className="thumbnailList"
240
242
  >
241
- <span
242
- aria-hidden="true"
243
+ <button
244
+ aria-label="Current Image"
243
245
  className="rootSelected"
244
246
  onClick={[Function]}
245
- role="button"
246
247
  >
247
248
  <div
248
249
  className="root container"
249
250
  >
250
251
  <img
251
252
  alt="test-thumbnail1"
253
+ aria-hidden="true"
252
254
  className="image placeholder"
253
255
  height={170}
254
256
  loading="eager"
@@ -287,18 +289,18 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
287
289
  width={135}
288
290
  />
289
291
  </div>
290
- </span>
291
- <span
292
- aria-hidden="true"
292
+ </button>
293
+ <button
294
+ aria-label="Next Image"
293
295
  className="root"
294
296
  onClick={[Function]}
295
- role="button"
296
297
  >
297
298
  <div
298
299
  className="root container"
299
300
  >
300
301
  <img
301
302
  alt="test-thumbnail2"
303
+ aria-hidden="true"
302
304
  className="image placeholder"
303
305
  height={170}
304
306
  loading="eager"
@@ -337,18 +339,18 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
337
339
  width={135}
338
340
  />
339
341
  </div>
340
- </span>
341
- <span
342
- aria-hidden="true"
342
+ </button>
343
+ <button
344
+ aria-label="Next Image"
343
345
  className="root"
344
346
  onClick={[Function]}
345
- role="button"
346
347
  >
347
348
  <div
348
349
  className="root container"
349
350
  >
350
351
  <img
351
352
  alt="test-thumbnail3"
353
+ aria-hidden="true"
352
354
  className="image placeholder"
353
355
  height={170}
354
356
  loading="eager"
@@ -387,18 +389,18 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
387
389
  width={135}
388
390
  />
389
391
  </div>
390
- </span>
391
- <span
392
- aria-hidden="true"
392
+ </button>
393
+ <button
394
+ aria-label="Next Image"
393
395
  className="root"
394
396
  onClick={[Function]}
395
- role="button"
396
397
  >
397
398
  <div
398
399
  className="root container"
399
400
  >
400
401
  <img
401
402
  alt="test-thumbnail4"
403
+ aria-hidden="true"
402
404
  className="image placeholder"
403
405
  height={170}
404
406
  loading="eager"
@@ -437,7 +439,7 @@ exports[`renders the Carousel component correctly w/ sorted images 1`] = `
437
439
  width={135}
438
440
  />
439
441
  </div>
440
- </span>
442
+ </button>
441
443
  </div>
442
444
  </div>
443
445
  `;