@transferwise/components 46.168.1 → 46.169.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 (103) hide show
  1. package/build/CardWidget/CardWidgetAction.js +7 -4
  2. package/build/CardWidget/CardWidgetAction.js.map +1 -1
  3. package/build/CardWidget/CardWidgetAction.mjs +7 -4
  4. package/build/CardWidget/CardWidgetAction.mjs.map +1 -1
  5. package/build/ListItem/ListItem.js +32 -2
  6. package/build/ListItem/ListItem.js.map +1 -1
  7. package/build/ListItem/ListItem.mjs +33 -3
  8. package/build/ListItem/ListItem.mjs.map +1 -1
  9. package/build/Prompt/Snackbar/Snackbar.js +7 -2
  10. package/build/Prompt/Snackbar/Snackbar.js.map +1 -1
  11. package/build/Prompt/Snackbar/Snackbar.mjs +3 -1
  12. package/build/Prompt/Snackbar/Snackbar.mjs.map +1 -1
  13. package/build/Prompt/Snackbar/SnackbarProvider.js +2 -2
  14. package/build/Prompt/Snackbar/SnackbarProvider.js.map +1 -1
  15. package/build/Prompt/Snackbar/SnackbarProvider.mjs +2 -2
  16. package/build/Prompt/Snackbar/SnackbarProvider.mjs.map +1 -1
  17. package/build/i18n/de.json +1 -0
  18. package/build/i18n/de.json.js +1 -0
  19. package/build/i18n/de.json.js.map +1 -1
  20. package/build/i18n/de.json.mjs +1 -0
  21. package/build/i18n/de.json.mjs.map +1 -1
  22. package/build/i18n/hu.json +1 -0
  23. package/build/i18n/hu.json.js +1 -0
  24. package/build/i18n/hu.json.js.map +1 -1
  25. package/build/i18n/hu.json.mjs +1 -0
  26. package/build/i18n/hu.json.mjs.map +1 -1
  27. package/build/i18n/it.json +1 -0
  28. package/build/i18n/it.json.js +1 -0
  29. package/build/i18n/it.json.js.map +1 -1
  30. package/build/i18n/it.json.mjs +1 -0
  31. package/build/i18n/it.json.mjs.map +1 -1
  32. package/build/i18n/nl.json +1 -1
  33. package/build/i18n/nl.json.js +1 -1
  34. package/build/i18n/nl.json.mjs +1 -1
  35. package/build/i18n/pl.json +1 -0
  36. package/build/i18n/pl.json.js +1 -0
  37. package/build/i18n/pl.json.js.map +1 -1
  38. package/build/i18n/pl.json.mjs +1 -0
  39. package/build/i18n/pl.json.mjs.map +1 -1
  40. package/build/i18n/th.json +1 -0
  41. package/build/i18n/th.json.js +1 -0
  42. package/build/i18n/th.json.js.map +1 -1
  43. package/build/i18n/th.json.mjs +1 -0
  44. package/build/i18n/th.json.mjs.map +1 -1
  45. package/build/main.css +39 -16
  46. package/build/styles/CardContainer/CardContainer.css +23 -0
  47. package/build/styles/CardWidget/CardWidget.css +5 -0
  48. package/build/styles/Prompt/ActionPrompt/ActionPrompt.css +10 -2
  49. package/build/styles/Prompt/CriticalBanner/CriticalBanner.css +1 -5
  50. package/build/styles/Prompt/PrimitivePrompt/PrimitivePrompt.css +0 -9
  51. package/build/styles/Prompt/PrimitivePrompt/PrimitivePrompt.vars.css +0 -0
  52. package/build/styles/main.css +39 -16
  53. package/build/types/CardContainer/CardContainer.types.d.ts +4 -3
  54. package/build/types/CardContainer/CardContainer.types.d.ts.map +1 -1
  55. package/build/types/CardWidget/CardWidget.types.d.ts +3 -1
  56. package/build/types/CardWidget/CardWidget.types.d.ts.map +1 -1
  57. package/build/types/CardWidget/CardWidgetAction.d.ts +10 -3
  58. package/build/types/CardWidget/CardWidgetAction.d.ts.map +1 -1
  59. package/build/types/ListItem/ListItem.d.ts +2 -0
  60. package/build/types/ListItem/ListItem.d.ts.map +1 -1
  61. package/build/types/Prompt/Snackbar/Snackbar.d.ts +2 -1
  62. package/build/types/Prompt/Snackbar/Snackbar.d.ts.map +1 -1
  63. package/package.json +4 -4
  64. package/src/CardContainer/CardContainer.css +23 -0
  65. package/src/CardContainer/CardContainer.less +32 -0
  66. package/src/CardContainer/CardContainer.types.ts +4 -3
  67. package/src/CardContainer/_stories/CardContainer.story.tsx +25 -2
  68. package/src/CardWidget/CardWidget.css +5 -0
  69. package/src/CardWidget/CardWidget.less +8 -0
  70. package/src/CardWidget/CardWidget.test.tsx +16 -0
  71. package/src/CardWidget/CardWidget.types.ts +3 -1
  72. package/src/CardWidget/CardWidgetAction.tsx +14 -3
  73. package/src/CardWidget/_stories/CardWidget.story.tsx +57 -2
  74. package/src/CardWidget/_stories/CardWidget.test.story.tsx +20 -1
  75. package/src/ListItem/ListItem.ssr.test.tsx +115 -0
  76. package/src/ListItem/ListItem.test.tsx +42 -0
  77. package/src/ListItem/ListItem.tsx +23 -2
  78. package/src/Prompt/ActionPrompt/ActionPrompt.css +10 -2
  79. package/src/Prompt/ActionPrompt/ActionPrompt.less +17 -2
  80. package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +29 -29
  81. package/src/Prompt/CriticalBanner/CriticalBanner.css +1 -5
  82. package/src/Prompt/CriticalBanner/CriticalBanner.less +3 -6
  83. package/src/Prompt/CriticalBanner/CriticalBanner.vars.less +3 -3
  84. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.css +0 -9
  85. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.less +0 -9
  86. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.vars.css +0 -0
  87. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.vars.less +2 -0
  88. package/src/Prompt/Snackbar/Snackbar.tsx +2 -1
  89. package/src/Prompt/Snackbar/SnackbarProvider.tsx +2 -2
  90. package/src/i18n/de.json +1 -0
  91. package/src/i18n/hu.json +1 -0
  92. package/src/i18n/it.json +1 -0
  93. package/src/i18n/nl.json +1 -1
  94. package/src/i18n/pl.json +1 -0
  95. package/src/i18n/th.json +1 -0
  96. package/src/main.css +39 -16
  97. package/build/Prompt/Snackbar/SnackbarPortal.js +0 -12
  98. package/build/Prompt/Snackbar/SnackbarPortal.js.map +0 -1
  99. package/build/Prompt/Snackbar/SnackbarPortal.mjs +0 -8
  100. package/build/Prompt/Snackbar/SnackbarPortal.mjs.map +0 -1
  101. package/build/types/Prompt/Snackbar/SnackbarPortal.d.ts +0 -4
  102. package/build/types/Prompt/Snackbar/SnackbarPortal.d.ts.map +0 -1
  103. package/src/Prompt/Snackbar/SnackbarPortal.tsx +0 -8
@@ -13,6 +13,11 @@
13
13
  padding-inline-start: var(--CardWidget-inset);
14
14
  row-gap: var(--size-8);
15
15
  }
16
+ .wds-card-widget__content {
17
+ display: flex;
18
+ flex: 1 0 auto;
19
+ flex-direction: column;
20
+ }
16
21
  .wds-card-widget__header + .wds-card-widget__content {
17
22
  margin-block-start: var(--CardWidget-header-spacing);
18
23
  }
@@ -4,6 +4,7 @@
4
4
  --Prompt-actions-gap: var(--size-8);
5
5
  --Prompt-gap: var(--size-10) var(--size-16);
6
6
  --Prompt-border-radius: var(--radius-large);
7
+ container: wds-action-prompt / inline-size;
7
8
  }
8
9
  .wds-action-prompt--media-image {
9
10
  inline-size: var(--size-48);
@@ -11,12 +12,19 @@
11
12
  -o-object-fit: contain;
12
13
  object-fit: contain;
13
14
  }
14
- @media (max-width: 599.98px) {
15
+ @container wds-action-prompt (width < 600px) {
16
+ .wds-action-prompt .wds-prompt__actions-wrapper {
17
+ grid-column: span 2;
18
+ inline-size: 100%;
19
+ }
20
+ .wds-action-prompt .wds-prompt__content-wrapper--with-dismiss .wds-prompt__actions-wrapper {
21
+ grid-column: span 3;
22
+ }
15
23
  .wds-action-prompt .wds-action-prompt__action {
16
24
  inline-size: 100%;
17
25
  }
18
26
  }
19
- @media (max-width: 599.98px) {
27
+ @container wds-action-prompt (width < 600px) {
20
28
  .wds-action-prompt--with-two-actions .wds-action-prompt__action {
21
29
  flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
22
30
  min-inline-size: -moz-fit-content;
@@ -11,8 +11,6 @@
11
11
  position: relative;
12
12
  --critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
13
13
  --critical-banner-duration: 150ms;
14
- /* Override PrimitivePrompt's --screen-sm-max actions behaviour:
15
- actions only go full-width below mobile-max token (container query) */
16
14
  }
17
15
  .wds-critical-banner.wds-prompt--neutral {
18
16
  --critical-banner-background-base: var(--color-background-elevated);
@@ -91,13 +89,11 @@
91
89
  }
92
90
  }
93
91
  .wds-critical-banner .wds-prompt__actions-wrapper {
94
- grid-column-start: 2;
95
- grid-column-end: 3;
96
92
  max-block-size: 200px;
97
93
  opacity: 1;
98
94
  overflow: visible;
99
95
  }
100
- @container (max-width: 600px) {
96
+ @container (width < 600px) {
101
97
  .wds-critical-banner .wds-prompt__actions-wrapper {
102
98
  grid-column: span 3;
103
99
  inline-size: 100%;
@@ -35,15 +35,6 @@
35
35
  grid-column-start: 2;
36
36
  grid-column-end: 3;
37
37
  }
38
- @media (max-width: 599.98px) {
39
- .wds-prompt__actions-wrapper {
40
- grid-column: span 2;
41
- inline-size: 100%;
42
- }
43
- .wds-prompt__content-wrapper--with-dismiss .wds-prompt__actions-wrapper {
44
- grid-column: span 3;
45
- }
46
- }
47
38
  .wds-prompt__dismiss {
48
39
  position: relative;
49
40
  }
@@ -26243,6 +26243,29 @@ a[data-toggle="tooltip"] {
26243
26243
  padding-inline: calc(var(--CardContainer-padding-inline) + 1px);
26244
26244
  position: relative;
26245
26245
  }
26246
+ .wds-card-container--interactive:has( > :is(a[href], button:enabled):first-child):not( :has( > * + :not(.wds-card-container__border))) {
26247
+ position: relative;
26248
+ }
26249
+ .wds-card-container--interactive > a[href]:first-child:not(:has( ~ :not(.wds-card-container__border)))::before {
26250
+ border-radius: var(--CardContainer-border-radius);
26251
+ content: "";
26252
+ inset: 0;
26253
+ position: absolute;
26254
+ }
26255
+ .wds-card-container--interactive > button:enabled:first-child:not(:has( ~ :not(.wds-card-container__border)))::before {
26256
+ border-radius: var(--CardContainer-border-radius);
26257
+ content: "";
26258
+ inset: 0;
26259
+ position: absolute;
26260
+ }
26261
+ .wds-card-container--interactive.wds-card-container--padding-none > a[href]:first-child:not(:has( ~ :not(.wds-card-container__border))) {
26262
+ --ring-outline-offset: calc(-1 * var(--ring-outline-width));
26263
+ border-radius: var(--CardContainer-border-radius);
26264
+ }
26265
+ .wds-card-container--interactive.wds-card-container--padding-none > button:enabled:first-child:not(:has( ~ :not(.wds-card-container__border))) {
26266
+ --ring-outline-offset: calc(-1 * var(--ring-outline-width));
26267
+ border-radius: var(--CardContainer-border-radius);
26268
+ }
26246
26269
  .wds-card-container--interactive:has(
26247
26270
  > a[href]:hover,
26248
26271
  > button:enabled:hover,
@@ -26326,6 +26349,11 @@ a[data-toggle="tooltip"] {
26326
26349
  padding-inline-start: var(--CardWidget-inset);
26327
26350
  row-gap: var(--size-8);
26328
26351
  }
26352
+ .wds-card-widget__content {
26353
+ display: flex;
26354
+ flex: 1 0 auto;
26355
+ flex-direction: column;
26356
+ }
26329
26357
  .wds-card-widget__header + .wds-card-widget__content {
26330
26358
  margin-block-start: var(--CardWidget-header-spacing);
26331
26359
  }
@@ -31064,15 +31092,6 @@ button.np-link {
31064
31092
  grid-column-start: 2;
31065
31093
  grid-column-end: 3;
31066
31094
  }
31067
- @media (max-width: 599.98px) {
31068
- .wds-prompt__actions-wrapper {
31069
- grid-column: span 2;
31070
- inline-size: 100%;
31071
- }
31072
- .wds-prompt__content-wrapper--with-dismiss .wds-prompt__actions-wrapper {
31073
- grid-column: span 3;
31074
- }
31075
- }
31076
31095
  .wds-prompt__dismiss {
31077
31096
  position: relative;
31078
31097
  }
@@ -31196,6 +31215,7 @@ button.np-link {
31196
31215
  --Prompt-actions-gap: var(--size-8);
31197
31216
  --Prompt-gap: var(--size-10) var(--size-16);
31198
31217
  --Prompt-border-radius: var(--radius-large);
31218
+ container: wds-action-prompt / inline-size;
31199
31219
  }
31200
31220
  .wds-action-prompt--media-image {
31201
31221
  inline-size: var(--size-48);
@@ -31203,12 +31223,19 @@ button.np-link {
31203
31223
  -o-object-fit: contain;
31204
31224
  object-fit: contain;
31205
31225
  }
31206
- @media (max-width: 599.98px) {
31226
+ @container wds-action-prompt (width < 600px) {
31227
+ .wds-action-prompt .wds-prompt__actions-wrapper {
31228
+ grid-column: span 2;
31229
+ inline-size: 100%;
31230
+ }
31231
+ .wds-action-prompt .wds-prompt__content-wrapper--with-dismiss .wds-prompt__actions-wrapper {
31232
+ grid-column: span 3;
31233
+ }
31207
31234
  .wds-action-prompt .wds-action-prompt__action {
31208
31235
  inline-size: 100%;
31209
31236
  }
31210
31237
  }
31211
- @media (max-width: 599.98px) {
31238
+ @container wds-action-prompt (width < 600px) {
31212
31239
  .wds-action-prompt--with-two-actions .wds-action-prompt__action {
31213
31240
  flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
31214
31241
  min-inline-size: -moz-fit-content;
@@ -31231,8 +31258,6 @@ button.np-link {
31231
31258
  position: relative;
31232
31259
  --critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
31233
31260
  --critical-banner-duration: 150ms;
31234
- /* Override PrimitivePrompt's --screen-sm-max actions behaviour:
31235
- actions only go full-width below mobile-max token (container query) */
31236
31261
  }
31237
31262
  .wds-critical-banner.wds-prompt--neutral {
31238
31263
  --critical-banner-background-base: var(--color-background-elevated);
@@ -31311,13 +31336,11 @@ button.np-link {
31311
31336
  }
31312
31337
  }
31313
31338
  .wds-critical-banner .wds-prompt__actions-wrapper {
31314
- grid-column-start: 2;
31315
- grid-column-end: 3;
31316
31339
  max-block-size: 200px;
31317
31340
  opacity: 1;
31318
31341
  overflow: visible;
31319
31342
  }
31320
- @container (max-width: 600px) {
31343
+ @container (width < 600px) {
31321
31344
  .wds-critical-banner .wds-prompt__actions-wrapper {
31322
31345
  grid-column: span 3;
31323
31346
  inline-size: 100%;
@@ -43,9 +43,10 @@ export interface CardContainerProps extends HTMLAttributes<HTMLElement> {
43
43
  /**
44
44
  * Shows the card as hovered or pressed while a direct child link (with an `href`) or enabled
45
45
  * button is, such as a link that fills the card, and as hovered while that child has keyboard
46
- * focus. The rest of the card,
47
- * and controls nested deeper, don't trigger the states, so the card is only shown as something
48
- * to act on where it can be clicked.
46
+ * focus. When that link or button is the card's only child, it also covers the card's padding,
47
+ * so the whole card is clickable. Otherwise the rest of the card, and controls nested deeper,
48
+ * don't trigger the states, so the card is only shown as something to act on where it can be
49
+ * clicked.
49
50
  * @default false
50
51
  */
51
52
  interactive?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"CardContainer.types.d.ts","sourceRoot":"","sources":["../../../src/CardContainer/CardContainer.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACrE;;;;OAIG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IAEnC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,EAAE,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC;IAEnC;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"CardContainer.types.d.ts","sourceRoot":"","sources":["../../../src/CardContainer/CardContainer.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACrE;;;;OAIG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IAEnC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,EAAE,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC;IAEnC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -47,7 +47,9 @@ export interface CardWidgetProps extends Omit<CardContainerProps, 'padding' | 'i
47
47
  */
48
48
  header?: CardWidgetHeader;
49
49
  /**
50
- * The widget's content, rendered under the header.
50
+ * The widget's content, rendered under the header. Children are stacked in a flex column that
51
+ * fills the rest of the card's height, so `margin-top: auto` on the last child pushes it to the
52
+ * bottom of the card.
51
53
  * @default undefined
52
54
  */
53
55
  children?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"CardWidget.types.d.ts","sourceRoot":"","sources":["../../../src/CardWidget/CardWidget.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;AAEnF,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC;I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eAAgB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,aAAa,CAAC;IAC1F;;;OAGG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
@@ -10,8 +10,8 @@ type CardWidgetActionButtonBase = Pick<ButtonProps, 'href' | 'target' | 'disable
10
10
  */
11
11
  onClick?: MouseEventHandler<HTMLElement>;
12
12
  /**
13
- * Rendered after `label`, or as the only content of an unlabelled action.
14
- * Size it yourself — 16px is expected in both cases.
13
+ * Rendered beside `label`, on the side set by `iconPosition`, or as the only content of an
14
+ * unlabelled action. Size it yourself — 16px is expected in both cases.
15
15
  * @default undefined
16
16
  */
17
17
  icon?: ReactNode;
@@ -21,6 +21,11 @@ type CardWidgetActionButtonBase = Pick<ButtonProps, 'href' | 'target' | 'disable
21
21
  type CardWidgetLabelledActionButton = CardWidgetActionButtonBase & {
22
22
  /** Non-rendering values are excluded, so an unlabelled action has to meet the icon-only rules. */
23
23
  label: Exclude<ButtonProps['children'], null | undefined | boolean>;
24
+ /**
25
+ * Side of the label the `icon` is rendered on.
26
+ * @default 'end'
27
+ */
28
+ iconPosition?: 'start' | 'end';
24
29
  /** @default undefined */
25
30
  'aria-label'?: string;
26
31
  };
@@ -31,6 +36,8 @@ type CardWidgetLabelledActionButton = CardWidgetActionButtonBase & {
31
36
  */
32
37
  type CardWidgetIconActionButton = CardWidgetActionButtonBase & {
33
38
  label?: never;
39
+ /** An unlabelled action has no label for the icon to sit beside. */
40
+ iconPosition?: never;
34
41
  icon: ReactNode;
35
42
  'aria-label': string;
36
43
  };
@@ -46,7 +53,7 @@ export type CardWidgetActionButton = CardWidgetLabelledActionButton | CardWidget
46
53
  */
47
54
  export declare const isCardWidgetActionButton: (value: unknown) => value is CardWidgetActionButton;
48
55
  /** Renders a `CardWidgetActionButton` at the emphasis of the slot it was passed to. */
49
- declare const CardWidgetAction: ({ action: { label, icon, "aria-label": ariaLabel, "data-testid": dataTestId, href, target, onClick, disabled, }, slot, }: {
56
+ declare const CardWidgetAction: ({ action: { label, icon, iconPosition, "aria-label": ariaLabel, "data-testid": dataTestId, href, target, onClick, disabled, }, slot, }: {
50
57
  action: CardWidgetActionButton;
51
58
  slot: CardWidgetActionSlot;
52
59
  }) => import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"CardWidgetAction.d.ts","sourceRoot":"","sources":["../../../src/CardWidget/CardWidgetAction.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG/E,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1E,uGAAuG;AACvG,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAEhE,KAAK,0BAA0B,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC,GAAG;IACpF;;;;OAIG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAEzC;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,kEAAkE;AAClE,KAAK,8BAA8B,GAAG,0BAA0B,GAAG;IACjE,kGAAkG;IAClG,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC;IACpE,yBAAyB;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,KAAK,0BAA0B,GAAG,0BAA0B,GAAG;IAC7D,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAA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AC7D,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,oEAAoE;IACpE,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,8BAA8B,GAAG,0BAA0B,CAAC;AAYjG;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,sBAK5B,CAAC;AAExC,uFAAuF;AACvF,QAAA,MAAM,gBAAgB,GAA6B,wIAahD;IACD,MAAM,EAAE,sBAAsB,CAAC;IAC/B,IAAI,EAAE,oBAAoB,CAAC;CAC5B,gCAuCA,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -26,6 +26,8 @@ export type ListItemProps = {
26
26
  disabledPromptMessage?: ReactNode;
27
27
  /**
28
28
  * Highlights the list item as an action to be taken or already taken. <br />
29
+ * Only applies to fully interactive items. Pass a supported ListItem control directly
30
+ * to include spotlight styles in server-rendered markup.
29
31
  */
30
32
  spotlight?: 'active' | 'inactive';
31
33
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../src/ListItem/ListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAc,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAY,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAc,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EAAU,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAS,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAU,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAY5D,MAAM,MAAM,aAAa,GACvB,iB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AC;IAC3B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ;oNAkBlB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqPf,CAAC;AA6GF,eAAe,QAAQ,CAAC"}
@@ -58,5 +58,6 @@ export interface SnackbarProps {
58
58
  visible: boolean;
59
59
  }
60
60
  export declare const Snackbar: ({ action, announcementKey, duration, loading, media, onDismissRequest, onExited, sentiment, text, timeout, visible, }: SnackbarProps) => import("react").JSX.Element;
61
- export default Snackbar;
61
+ declare const _default: (props: SnackbarProps) => import("react").ReactPortal | null;
62
+ export default _default;
62
63
  //# sourceMappingURL=Snackbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../../../src/Prompt/Snackbar/Snackbar.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKxD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,mGAAmG;IACnG,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAC;IACxB;;;;;OA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,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,kGAAkG;IAClG,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,kGAAkG;IAClG,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,kGAAkG;IAClG,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,QAAQ,GAAI,uHAYtB,aAAa,gCAuJf,CAAC;;AAEF,wBAAwC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.168.1",
3
+ "version": "46.169.0",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -80,7 +80,7 @@
80
80
  "@wise/wds-configs": "0.0.0",
81
81
  "babel-plugin-formatjs": "^11.3.16",
82
82
  "eslint": "^9.39.5",
83
- "eslint-plugin-storybook": "^10.6.5",
83
+ "eslint-plugin-storybook": "^10.6.6",
84
84
  "gulp": "^5.0.1",
85
85
  "jest": "^29.7.0",
86
86
  "jest-environment-jsdom": "^29.7.0",
@@ -89,7 +89,7 @@
89
89
  "lodash.times": "^4.3.2",
90
90
  "react-intl": "^7.1.14",
91
91
  "react-live": "^4.1.8",
92
- "rollup": "^4.67.5",
92
+ "rollup": "^4.68.0",
93
93
  "rollup-preserve-directives": "^1.1.3",
94
94
  "storybook": "^10.6.6",
95
95
  "storybook-addon-tag-badges": "^3.1.0",
@@ -121,7 +121,7 @@
121
121
  "lodash.debounce": "^4.0.8",
122
122
  "merge-props": "^6.0.0",
123
123
  "react-transition-group": "^4.4.5",
124
- "virtua": "^0.54.1"
124
+ "virtua": "^0.54.2"
125
125
  },
126
126
  "publishConfig": {
127
127
  "access": "public",
@@ -38,6 +38,29 @@
38
38
  padding-inline: calc(var(--CardContainer-padding-inline) + 1px);
39
39
  position: relative;
40
40
  }
41
+ .wds-card-container--interactive:has( > :is(a[href], button:enabled):first-child):not( :has( > * + :not(.wds-card-container__border))) {
42
+ position: relative;
43
+ }
44
+ .wds-card-container--interactive > a[href]:first-child:not(:has( ~ :not(.wds-card-container__border)))::before {
45
+ border-radius: var(--CardContainer-border-radius);
46
+ content: "";
47
+ inset: 0;
48
+ position: absolute;
49
+ }
50
+ .wds-card-container--interactive > button:enabled:first-child:not(:has( ~ :not(.wds-card-container__border)))::before {
51
+ border-radius: var(--CardContainer-border-radius);
52
+ content: "";
53
+ inset: 0;
54
+ position: absolute;
55
+ }
56
+ .wds-card-container--interactive.wds-card-container--padding-none > a[href]:first-child:not(:has( ~ :not(.wds-card-container__border))) {
57
+ --ring-outline-offset: calc(-1 * var(--ring-outline-width));
58
+ border-radius: var(--CardContainer-border-radius);
59
+ }
60
+ .wds-card-container--interactive.wds-card-container--padding-none > button:enabled:first-child:not(:has( ~ :not(.wds-card-container__border))) {
61
+ --ring-outline-offset: calc(-1 * var(--ring-outline-width));
62
+ border-radius: var(--CardContainer-border-radius);
63
+ }
41
64
  .wds-card-container--interactive:has(
42
65
  > a[href]:hover,
43
66
  > button:enabled:hover,
@@ -1,3 +1,7 @@
1
+ // An interactive card's link or button, when it is the card's only content. The inactive
2
+ // spotlight's border is rendered after the children, so it doesn't count.
3
+ @card-container-only-action: ~":is(a[href], button:enabled):first-child:not(:has(~ :not(.wds-card-container__border)))";
4
+
1
5
  // The hover and pressed states, as mixins so CardWidget can apply them to the card when only its
2
6
  // title is hovered or pressed. Applied to the card's root.
3
7
  .wds-card-container-hover-state() {
@@ -90,6 +94,34 @@
90
94
  position: relative;
91
95
  }
92
96
 
97
+ &--interactive {
98
+ // Only when the stretched link applies, so other cards keep their containing block. Spelled
99
+ // out, as `:has()` can't nest the only-action selector's own `:has()`.
100
+ &:has(> :is(a[href], button:enabled):first-child):not(
101
+ :has(> * + :not(.wds-card-container__border))
102
+ ) {
103
+ position: relative;
104
+ }
105
+
106
+ // When a link or button is the card's only content, it stretches over the padding, so the
107
+ // whole card hovers and clicks as it. Rounded like the card, so its corners outside the card's
108
+ // radius don't click.
109
+ > @{card-container-only-action}::before {
110
+ border-radius: var(--CardContainer-border-radius);
111
+ content: "";
112
+ inset: 0;
113
+ position: absolute;
114
+ }
115
+
116
+ // Without padding, the card clips at its edges, so the only link or button's focus ring is
117
+ // drawn inside it, rounded like the card.
118
+ &.wds-card-container--padding-none > @{card-container-only-action} {
119
+ --ring-outline-offset: calc(-1 * var(--ring-outline-width));
120
+
121
+ border-radius: var(--CardContainer-border-radius);
122
+ }
123
+ }
124
+
93
125
  // An `interactive` card follows its direct child link or button, such as a link that fills the
94
126
  // card, so it only looks clickable where it can be clicked. Keyboard focus on the child shows the
95
127
  // hover state too. A card without a spotlight has no hover or pressed state.
@@ -50,9 +50,10 @@ export interface CardContainerProps extends HTMLAttributes<HTMLElement> {
50
50
  /**
51
51
  * Shows the card as hovered or pressed while a direct child link (with an `href`) or enabled
52
52
  * button is, such as a link that fills the card, and as hovered while that child has keyboard
53
- * focus. The rest of the card,
54
- * and controls nested deeper, don't trigger the states, so the card is only shown as something
55
- * to act on where it can be clicked.
53
+ * focus. When that link or button is the card's only child, it also covers the card's padding,
54
+ * so the whole card is clickable. Otherwise the rest of the card, and controls nested deeper,
55
+ * don't trigger the states, so the card is only shown as something to act on where it can be
56
+ * clicked.
56
57
  * @default false
57
58
  */
58
59
  interactive?: boolean;
@@ -106,6 +106,8 @@ export const Spotlight: Story = {
106
106
  *
107
107
  * Focus rings are clipped at the edges too, so keep `none` for non-interactive content, and lists
108
108
  * on `md`.
109
+ *
110
+ * The last three cards are `interactive`, with a link as their content.
109
111
  */
110
112
  export const Padding: Story = {
111
113
  parameters: { controls: { disable: true } },
@@ -126,14 +128,35 @@ export const Padding: Story = {
126
128
  ),
127
129
  ),
128
130
  )}
131
+ {([undefined, 'active', 'inactive'] as (CardContainerSpotlight | undefined)[]).map(
132
+ (spotlight) => (
133
+ <CardContainer
134
+ key={`interactive-${spotlight ?? 'none'}`}
135
+ padding="none"
136
+ spotlight={spotlight}
137
+ interactive
138
+ >
139
+ <a
140
+ href="#padding"
141
+ aria-label={`Interactive, spotlight: ${spotlight ?? 'not set'}`}
142
+ style={{
143
+ display: 'block',
144
+ height: '120px',
145
+ background: 'var(--color-background-screen-active)',
146
+ }}
147
+ />
148
+ </CardContainer>
149
+ ),
150
+ )}
129
151
  </div>
130
152
  ),
131
153
  };
132
154
 
133
155
  /**
134
156
  * `interactive` shows the card as hovered or pressed while a direct child link or button is, and
135
- * as hovered while that child has keyboard focus. The card's padding, and a link nested deeper
136
- * such as inside text, don't trigger the states.
157
+ * as hovered while that child has keyboard focus. A link or button that is the card's only child
158
+ * covers the card's padding too. A link nested deeper, such as inside text, doesn't trigger the
159
+ * states.
137
160
  */
138
161
  export const Interactive: Story = {
139
162
  parameters: { controls: { disable: true } },
@@ -13,6 +13,11 @@
13
13
  padding-inline-start: var(--CardWidget-inset);
14
14
  row-gap: var(--size-8);
15
15
  }
16
+ .wds-card-widget__content {
17
+ display: flex;
18
+ flex: 1 0 auto;
19
+ flex-direction: column;
20
+ }
16
21
  .wds-card-widget__header + .wds-card-widget__content {
17
22
  margin-block-start: var(--CardWidget-header-spacing);
18
23
  }
@@ -22,6 +22,14 @@
22
22
  row-gap: var(--size-8);
23
23
  }
24
24
 
25
+ // Fills the rest of the card's height, so content can be laid out against its bottom edge, such
26
+ // as a footer pushed down with `margin-top: auto`. Children stack like the card's own.
27
+ &__content {
28
+ display: flex;
29
+ flex: 1 0 auto;
30
+ flex-direction: column;
31
+ }
32
+
25
33
  // On the content rather than the header, as an inactive card's decorative border comes after the
26
34
  // header, so a header-only widget's header isn't its last child.
27
35
  &__header + &__content {
@@ -136,6 +136,22 @@ describe('CardWidget', () => {
136
136
  );
137
137
  });
138
138
 
139
+ it('renders a labelled action icon after the label by default', () => {
140
+ renderWidget({ action: { label: 'Order card', icon: <span data-testid="action-icon" /> } });
141
+ expect(screen.getByTestId('action-icon').parentElement).toHaveClass('wds-Button-icon--end');
142
+ });
143
+
144
+ it('renders a labelled action icon before the label with iconPosition start', () => {
145
+ renderWidget({
146
+ action: {
147
+ label: 'Order card',
148
+ icon: <span data-testid="action-icon" />,
149
+ iconPosition: 'start',
150
+ },
151
+ });
152
+ expect(screen.getByTestId('action-icon').parentElement).toHaveClass('wds-Button-icon--start');
153
+ });
154
+
139
155
  it('names an unlabelled action from its aria-label', () => {
140
156
  renderWidget({ action: { 'aria-label': 'Card settings', icon: <Settings size={16} /> } });
141
157
  expect(screen.getByRole('button', { name: 'Card settings' })).toBeInTheDocument();
@@ -56,7 +56,9 @@ export interface CardWidgetProps extends Omit<CardContainerProps, 'padding' | 'i
56
56
  header?: CardWidgetHeader;
57
57
 
58
58
  /**
59
- * The widget's content, rendered under the header.
59
+ * The widget's content, rendered under the header. Children are stacked in a flex column that
60
+ * fills the rest of the card's height, so `margin-top: auto` on the last child pushes it to the
61
+ * bottom of the card.
60
62
  * @default undefined
61
63
  */
62
64
  children?: ReactNode;
@@ -16,8 +16,8 @@ type CardWidgetActionButtonBase = Pick<ButtonProps, 'href' | 'target' | 'disable
16
16
  onClick?: MouseEventHandler<HTMLElement>;
17
17
 
18
18
  /**
19
- * Rendered after `label`, or as the only content of an unlabelled action.
20
- * Size it yourself — 16px is expected in both cases.
19
+ * Rendered beside `label`, on the side set by `iconPosition`, or as the only content of an
20
+ * unlabelled action. Size it yourself — 16px is expected in both cases.
21
21
  * @default undefined
22
22
  */
23
23
  icon?: ReactNode;
@@ -28,6 +28,11 @@ type CardWidgetActionButtonBase = Pick<ButtonProps, 'href' | 'target' | 'disable
28
28
  type CardWidgetLabelledActionButton = CardWidgetActionButtonBase & {
29
29
  /** Non-rendering values are excluded, so an unlabelled action has to meet the icon-only rules. */
30
30
  label: Exclude<ButtonProps['children'], null | undefined | boolean>;
31
+ /**
32
+ * Side of the label the `icon` is rendered on.
33
+ * @default 'end'
34
+ */
35
+ iconPosition?: 'start' | 'end';
31
36
  /** @default undefined */
32
37
  'aria-label'?: string;
33
38
  };
@@ -39,6 +44,8 @@ type CardWidgetLabelledActionButton = CardWidgetActionButtonBase & {
39
44
  */
40
45
  type CardWidgetIconActionButton = CardWidgetActionButtonBase & {
41
46
  label?: never;
47
+ /** An unlabelled action has no label for the icon to sit beside. */
48
+ iconPosition?: never;
42
49
  icon: ReactNode;
43
50
  'aria-label': string;
44
51
  };
@@ -76,6 +83,7 @@ const CardWidgetAction = function CardWidgetAction({
76
83
  action: {
77
84
  label,
78
85
  icon,
86
+ iconPosition = 'end',
79
87
  'aria-label': ariaLabel,
80
88
  'data-testid': dataTestId,
81
89
  href,
@@ -105,6 +113,8 @@ const CardWidgetAction = function CardWidgetAction({
105
113
  );
106
114
  }
107
115
 
116
+ const addon = icon ? ({ type: 'icon', value: icon } as const) : undefined;
117
+
108
118
  return (
109
119
  <Button
110
120
  v2
@@ -114,7 +124,8 @@ const CardWidgetAction = function CardWidgetAction({
114
124
  href={href}
115
125
  target={target}
116
126
  disabled={disabled}
117
- addonEnd={icon ? { type: 'icon', value: icon } : undefined}
127
+ addonStart={iconPosition === 'start' ? addon : undefined}
128
+ addonEnd={iconPosition !== 'start' ? addon : undefined}
118
129
  // The v2 resolver drops `Button`'s own `button` default, so an action would submit a form.
119
130
  type="button"
120
131
  data-testid={dataTestId}