@transferwise/components 0.0.0-experimental-63c3fc6 → 0.0.0-experimental-5f03867

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 (147) hide show
  1. package/build/Snackbar/Snackbar.js +178 -102
  2. package/build/Snackbar/Snackbar.js.map +1 -1
  3. package/build/Snackbar/Snackbar.messages.js +14 -0
  4. package/build/Snackbar/Snackbar.messages.js.map +1 -0
  5. package/build/Snackbar/Snackbar.messages.mjs +10 -0
  6. package/build/Snackbar/Snackbar.messages.mjs.map +1 -0
  7. package/build/Snackbar/Snackbar.mjs +180 -101
  8. package/build/Snackbar/Snackbar.mjs.map +1 -1
  9. package/build/Snackbar/SnackbarContext.js.map +1 -1
  10. package/build/Snackbar/SnackbarContext.mjs.map +1 -1
  11. package/build/Snackbar/SnackbarPortal.js +12 -0
  12. package/build/Snackbar/SnackbarPortal.js.map +1 -0
  13. package/build/Snackbar/SnackbarPortal.mjs +8 -0
  14. package/build/Snackbar/SnackbarPortal.mjs.map +1 -0
  15. package/build/Snackbar/SnackbarProvider.js +24 -28
  16. package/build/Snackbar/SnackbarProvider.js.map +1 -1
  17. package/build/Snackbar/SnackbarProvider.mjs +25 -29
  18. package/build/Snackbar/SnackbarProvider.mjs.map +1 -1
  19. package/build/Snackbar/constants.js +17 -0
  20. package/build/Snackbar/constants.js.map +1 -0
  21. package/build/Snackbar/constants.mjs +11 -0
  22. package/build/Snackbar/constants.mjs.map +1 -0
  23. package/build/Snackbar/useSnackbarAutoDismiss.js +66 -0
  24. package/build/Snackbar/useSnackbarAutoDismiss.js.map +1 -0
  25. package/build/Snackbar/useSnackbarAutoDismiss.mjs +62 -0
  26. package/build/Snackbar/useSnackbarAutoDismiss.mjs.map +1 -0
  27. package/build/Snackbar/useSnackbarManager.js +153 -0
  28. package/build/Snackbar/useSnackbarManager.js.map +1 -0
  29. package/build/Snackbar/useSnackbarManager.mjs +149 -0
  30. package/build/Snackbar/useSnackbarManager.mjs.map +1 -0
  31. package/build/Snackbar/useSnackbarSwipeDismiss.js +135 -0
  32. package/build/Snackbar/useSnackbarSwipeDismiss.js.map +1 -0
  33. package/build/Snackbar/useSnackbarSwipeDismiss.mjs +131 -0
  34. package/build/Snackbar/useSnackbarSwipeDismiss.mjs.map +1 -0
  35. package/build/i18n/en.json +1 -0
  36. package/build/i18n/en.json.js +1 -0
  37. package/build/i18n/en.json.js.map +1 -1
  38. package/build/i18n/en.json.mjs +1 -0
  39. package/build/i18n/en.json.mjs.map +1 -1
  40. package/build/index.js +0 -4
  41. package/build/index.js.map +1 -1
  42. package/build/index.mjs +0 -2
  43. package/build/index.mjs.map +1 -1
  44. package/build/main.css +116 -191
  45. package/build/styles/Snackbar/Snackbar.css +117 -54
  46. package/build/styles/main.css +116 -191
  47. package/build/types/Snackbar/Snackbar.d.ts +55 -9
  48. package/build/types/Snackbar/Snackbar.d.ts.map +1 -1
  49. package/build/types/Snackbar/Snackbar.messages.d.ts +9 -0
  50. package/build/types/Snackbar/Snackbar.messages.d.ts.map +1 -0
  51. package/build/types/Snackbar/Snackbar.types.d.ts +12 -0
  52. package/build/types/Snackbar/Snackbar.types.d.ts.map +1 -0
  53. package/build/types/Snackbar/SnackbarContext.d.ts +2 -2
  54. package/build/types/Snackbar/SnackbarContext.d.ts.map +1 -1
  55. package/build/types/Snackbar/SnackbarPortal.d.ts +4 -0
  56. package/build/types/Snackbar/SnackbarPortal.d.ts.map +1 -0
  57. package/build/types/Snackbar/SnackbarProvider.d.ts +7 -0
  58. package/build/types/Snackbar/SnackbarProvider.d.ts.map +1 -1
  59. package/build/types/Snackbar/constants.d.ts +9 -0
  60. package/build/types/Snackbar/constants.d.ts.map +1 -0
  61. package/build/types/Snackbar/index.d.ts +1 -1
  62. package/build/types/Snackbar/index.d.ts.map +1 -1
  63. package/build/types/Snackbar/useSnackbar.d.ts +1 -1
  64. package/build/types/Snackbar/useSnackbar.d.ts.map +1 -1
  65. package/build/types/Snackbar/useSnackbarAutoDismiss.d.ts +13 -0
  66. package/build/types/Snackbar/useSnackbarAutoDismiss.d.ts.map +1 -0
  67. package/build/types/Snackbar/useSnackbarManager.d.ts +20 -0
  68. package/build/types/Snackbar/useSnackbarManager.d.ts.map +1 -0
  69. package/build/types/Snackbar/useSnackbarSwipeDismiss.d.ts +22 -0
  70. package/build/types/Snackbar/useSnackbarSwipeDismiss.d.ts.map +1 -0
  71. package/build/types/index.d.ts +1 -5
  72. package/build/types/index.d.ts.map +1 -1
  73. package/build/types/test-utils/index.d.ts +2 -0
  74. package/build/types/test-utils/index.d.ts.map +1 -1
  75. package/package.json +3 -3
  76. package/src/Snackbar/Snackbar.css +117 -54
  77. package/src/Snackbar/Snackbar.less +139 -60
  78. package/src/Snackbar/Snackbar.messages.ts +9 -0
  79. package/src/Snackbar/Snackbar.test.tsx +989 -119
  80. package/src/Snackbar/Snackbar.tsx +208 -93
  81. package/src/Snackbar/Snackbar.types.ts +17 -0
  82. package/src/Snackbar/SnackbarContext.ts +2 -2
  83. package/src/Snackbar/SnackbarPortal.tsx +8 -0
  84. package/src/Snackbar/SnackbarProvider.test.tsx +783 -0
  85. package/src/Snackbar/SnackbarProvider.tsx +27 -19
  86. package/src/Snackbar/_stories/Snackbar.accessibility.docs.mdx +66 -0
  87. package/src/Snackbar/_stories/Snackbar.migration.docs.mdx +64 -0
  88. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +16 -8
  89. package/src/Snackbar/_stories/Snackbar.story.tsx +389 -61
  90. package/src/Snackbar/_stories/Snackbar.test.story.tsx +171 -47
  91. package/src/Snackbar/constants.ts +10 -0
  92. package/src/Snackbar/index.ts +1 -1
  93. package/src/Snackbar/useSnackbarAutoDismiss.ts +74 -0
  94. package/src/Snackbar/useSnackbarManager.ts +169 -0
  95. package/src/Snackbar/useSnackbarSwipeDismiss.ts +169 -0
  96. package/src/i18n/en.json +1 -0
  97. package/src/index.ts +1 -14
  98. package/src/main.css +116 -191
  99. package/src/main.less +0 -2
  100. package/build/CardContainer/CardContainer.js +0 -33
  101. package/build/CardContainer/CardContainer.js.map +0 -1
  102. package/build/CardContainer/CardContainer.mjs +0 -29
  103. package/build/CardContainer/CardContainer.mjs.map +0 -1
  104. package/build/CardWidget/CardWidget.js +0 -94
  105. package/build/CardWidget/CardWidget.js.map +0 -1
  106. package/build/CardWidget/CardWidget.mjs +0 -90
  107. package/build/CardWidget/CardWidget.mjs.map +0 -1
  108. package/build/CardWidget/CardWidgetAction.js +0 -70
  109. package/build/CardWidget/CardWidgetAction.js.map +0 -1
  110. package/build/CardWidget/CardWidgetAction.mjs +0 -65
  111. package/build/CardWidget/CardWidgetAction.mjs.map +0 -1
  112. package/build/styles/CardContainer/CardContainer.css +0 -74
  113. package/build/styles/CardWidget/CardWidget.css +0 -64
  114. package/build/types/CardContainer/CardContainer.d.ts +0 -8
  115. package/build/types/CardContainer/CardContainer.d.ts.map +0 -1
  116. package/build/types/CardContainer/CardContainer.types.d.ts +0 -44
  117. package/build/types/CardContainer/CardContainer.types.d.ts.map +0 -1
  118. package/build/types/CardContainer/_stories/helpers.d.ts +0 -3
  119. package/build/types/CardContainer/_stories/helpers.d.ts.map +0 -1
  120. package/build/types/CardContainer/index.d.ts +0 -3
  121. package/build/types/CardContainer/index.d.ts.map +0 -1
  122. package/build/types/CardWidget/CardWidget.d.ts +0 -8
  123. package/build/types/CardWidget/CardWidget.d.ts.map +0 -1
  124. package/build/types/CardWidget/CardWidget.types.d.ts +0 -52
  125. package/build/types/CardWidget/CardWidget.types.d.ts.map +0 -1
  126. package/build/types/CardWidget/CardWidgetAction.d.ts +0 -54
  127. package/build/types/CardWidget/CardWidgetAction.d.ts.map +0 -1
  128. package/build/types/CardWidget/index.d.ts +0 -4
  129. package/build/types/CardWidget/index.d.ts.map +0 -1
  130. package/src/CardContainer/CardContainer.css +0 -74
  131. package/src/CardContainer/CardContainer.less +0 -112
  132. package/src/CardContainer/CardContainer.test.tsx +0 -118
  133. package/src/CardContainer/CardContainer.tsx +0 -39
  134. package/src/CardContainer/CardContainer.types.ts +0 -50
  135. package/src/CardContainer/_stories/CardContainer.story.tsx +0 -136
  136. package/src/CardContainer/_stories/CardContainer.test.story.tsx +0 -103
  137. package/src/CardContainer/_stories/helpers.tsx +0 -50
  138. package/src/CardContainer/index.ts +0 -6
  139. package/src/CardWidget/CardWidget.css +0 -64
  140. package/src/CardWidget/CardWidget.less +0 -82
  141. package/src/CardWidget/CardWidget.test.tsx +0 -189
  142. package/src/CardWidget/CardWidget.tsx +0 -74
  143. package/src/CardWidget/CardWidget.types.ts +0 -60
  144. package/src/CardWidget/CardWidgetAction.tsx +0 -126
  145. package/src/CardWidget/_stories/CardWidget.story.tsx +0 -209
  146. package/src/CardWidget/_stories/CardWidget.test.story.tsx +0 -350
  147. package/src/CardWidget/index.ts +0 -3
@@ -1,71 +1,134 @@
1
- .snackbar {
2
- text-align: center;
1
+ .wds-Snackbar {
2
+ display: flex;
3
+ justify-content: center;
4
+ box-sizing: border-box;
5
+ padding-inline: var(--size-16);
6
+ padding-block-end: calc(var(--size-16) + env(safe-area-inset-bottom));
3
7
  position: fixed;
4
8
  inset-block-end: 0;
5
- inset-inline-start: 0;
6
- inset-inline-end: 0;
9
+ inset-inline: 0;
7
10
  z-index: 1060;
8
11
  }
9
- .snackbar__text {
10
- background: #37517e;
11
- color: #ffffff;
12
- display: inline-flex;
13
- border-radius: 2px;
14
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
15
- align-items: center;
16
- justify-content: space-between;
12
+ @media (min-width: 600px) {
13
+ .wds-Snackbar {
14
+ padding-block-end: var(--size-24);
15
+ }
16
+ }
17
+ .wds-Snackbar--swipe-dismiss {
18
+ transition: transform var(--Snackbar-exit-duration) cubic-bezier(1, 0, 1, 1);
19
+ }
20
+ .wds-Snackbar--swipe-settle {
21
+ transition: transform var(--Snackbar-exit-duration) cubic-bezier(0, 0, 0, 1);
22
+ }
23
+ .wds-Snackbar-container {
24
+ --Prompt-border-radius: var(--radius-medium);
25
+ --Prompt-gap: var(--size-8);
26
+ --Prompt-padding-x: var(--size-12);
27
+ --Prompt-padding-y: var(--size-12);
28
+ box-sizing: border-box;
29
+ max-inline-size: 480px;
17
30
  text-align: start;
18
- font-size: var(--wds-font-size-body);
19
- margin-block: 0;
20
- margin-inline: var(--size-16);
21
- padding-block: var(--size-8);
22
- padding-inline: var(--size-16);
23
- inline-size: calc(100% - var(--size-32));
24
- transition: 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
31
+ cursor: grab;
32
+ touch-action: pan-x pinch-zoom;
25
33
  }
26
- .np-theme-personal .snackbar__text {
27
- box-shadow: 0 2px 4px 0 rgba(69, 71, 69, 0.35);
28
- position: relative;
29
- background: var(--color-contrast-theme);
30
- border-radius: var(--radius-small);
31
- color: var(--color-contrast-overlay);
34
+ .wds-Snackbar-container .wds-prompt__content-wrapper--with-dismiss {
35
+ grid-template-columns: auto minmax(0, 1fr);
32
36
  }
33
- .np-theme-personal .snackbar__text::after {
34
- display: block;
35
- border-radius: inherit;
36
- block-size: 100%;
37
- inline-size: 100%;
38
- content: "";
39
- position: absolute;
40
- inset-inline-start: 0;
41
- inset-block-start: 0;
42
- z-index: -1;
43
- background-color: var(--color-background-neutral);
44
- }
45
- .np-theme-personal--dark .snackbar__text,
46
- .np-theme-personal--forest-green .snackbar__text {
47
- box-shadow: none;
37
+ @media (min-width: 600px) {
38
+ .wds-Snackbar-container .wds-prompt__content-wrapper--with-dismiss {
39
+ grid-template-columns: auto minmax(0, 1fr) auto;
40
+ }
41
+ }
42
+ .wds-Snackbar-container .wds-prompt__media-wrapper {
43
+ display: flex;
44
+ align-items: center;
45
+ min-block-size: max(var(--size-32), 1lh);
46
+ padding-block-start: 0;
47
+ color: var(--color-sentiment-content-primary);
48
+ }
49
+ .wds-Snackbar-container .wds-prompt__media-wrapper:has(+ .wds-Snackbar__content .wds-Snackbar__action) {
50
+ min-block-size: max(var(--size-32), calc(1lh + var(--size-5) * 2));
51
+ }
52
+ .wds-Snackbar__media-asset {
53
+ display: flex;
54
+ }
55
+ .wds-Snackbar__media-asset svg {
56
+ inline-size: var(--size-24);
57
+ block-size: var(--size-24);
58
+ }
59
+ .wds-Snackbar__process-indicator .process-circle {
60
+ stroke: currentColor;
61
+ }
62
+ .wds-Snackbar-container .wds-prompt__dismiss {
63
+ display: none;
64
+ align-self: flex-start;
65
+ margin-block-start: calc(var(--size-4) - 1px);
48
66
  }
49
67
  @media (min-width: 600px) {
50
- .snackbar__text {
51
- inline-size: auto;
52
- max-inline-size: 600px;
68
+ .wds-Snackbar-container .wds-prompt__dismiss {
69
+ display: flex;
53
70
  }
54
71
  }
55
- .snackbar__text__action {
72
+ .wds-Snackbar__action {
56
73
  flex-shrink: 0;
57
- margin-inline-start: var(--size-16);
58
74
  }
59
- .snackbar__text-container-enter,
60
- .snackbar__text-container-exit {
61
- transform: translateY(calc(100% + 10px));
75
+ .wds-Snackbar__content {
76
+ display: flex;
77
+ align-items: flex-start;
78
+ gap: var(--size-8);
79
+ flex: 1 0 0;
80
+ min-block-size: var(--size-32);
81
+ min-inline-size: 0;
62
82
  }
63
- .snackbar__text-container-enter-active {
64
- transform: translateY(-16px);
65
- transform: translateY(calc(-16px - env(safe-area-inset-bottom)));
83
+ .wds-Snackbar__message {
84
+ display: flex;
85
+ flex-direction: column;
86
+ justify-content: center;
87
+ inline-size: auto;
88
+ flex: 1 0 0;
89
+ min-inline-size: 0;
90
+ align-self: stretch;
66
91
  }
67
- @media (min-width: 600px) {
68
- .snackbar__text-container-enter-active {
69
- transform: translateY(-24px);
92
+ .wds-Snackbar__body {
93
+ display: block;
94
+ }
95
+ .wds-Snackbar-container-appear,
96
+ .wds-Snackbar-container-enter {
97
+ opacity: 0;
98
+ transform: translateY(80px) scale(0.5);
99
+ }
100
+ .wds-Snackbar-container-appear-active,
101
+ .wds-Snackbar-container-enter-active {
102
+ opacity: 1;
103
+ transform: translateY(0) scale(1);
104
+ transition: opacity 150ms linear, transform var(--Snackbar-enter-duration) cubic-bezier(0, 0, 0, 1);
105
+ }
106
+ .wds-Snackbar-container-exit {
107
+ opacity: 1;
108
+ transform: translateY(0) scale(1);
109
+ }
110
+ .wds-Snackbar-container-exit-active {
111
+ opacity: 0;
112
+ transform: translateY(80px) scale(0.5);
113
+ transition: opacity 50ms linear 50ms, transform var(--Snackbar-exit-duration) cubic-bezier(1, 0, 1, 1);
114
+ }
115
+ @media (prefers-reduced-motion: reduce) {
116
+ .wds-Snackbar--swipe-dismiss,
117
+ .wds-Snackbar--swipe-settle {
118
+ transition: none;
119
+ }
120
+ .wds-Snackbar-container-appear,
121
+ .wds-Snackbar-container-appear-active,
122
+ .wds-Snackbar-container-enter,
123
+ .wds-Snackbar-container-enter-active,
124
+ .wds-Snackbar-container-exit {
125
+ opacity: 1;
126
+ transform: none;
127
+ transition: none;
128
+ }
129
+ .wds-Snackbar-container-exit-active {
130
+ opacity: 0;
131
+ transform: none;
132
+ transition: none;
70
133
  }
71
134
  }
@@ -26203,144 +26203,6 @@ a[data-toggle="tooltip"] {
26203
26203
  .wds-container--fluid {
26204
26204
  max-inline-size: var(--wds-container-width-fluid);
26205
26205
  }
26206
- .wds-card-container {
26207
- /**
26208
- * There is no shadow or elevation token in @transferwise/neptune-tokens, so the active
26209
- * spotlight's resting shadow is component-scoped for now, the way PromoCard scopes
26210
- * `--Card-box-shadow`. The value is the "Module shadow" effect style from Figma: `#0e0f0c` at
26211
- * 4%, kept literal so it doesn't drift with a theme's tokens. Collapses to a token reference
26212
- * once one is minted.
26213
- */
26214
- --CardContainer-shadow-color: rgba(14, 15, 12, 0.04);
26215
- --CardContainer-shadow: 0 2px 12px var(--CardContainer-shadow-color), 0 2px 32px var(--CardContainer-shadow-color);
26216
- --CardContainer-background-color: var(--color-background-screen);
26217
- --CardContainer-border-color: var(--color-border-neutral);
26218
- --CardContainer-border-radius: var(--radius-large);
26219
- --CardContainer-padding-block: var(--size-8);
26220
- --CardContainer-padding-inline: var(--size-8);
26221
- background-color: var(--CardContainer-background-color);
26222
- border: 1px solid var(--CardContainer-border-color);
26223
- border-radius: var(--CardContainer-border-radius);
26224
- box-sizing: border-box;
26225
- display: flex;
26226
- flex-direction: column;
26227
- padding-block: var(--CardContainer-padding-block);
26228
- padding-inline: var(--CardContainer-padding-inline);
26229
- inline-size: 100%;
26230
- }
26231
- @media (min-width: 840px) {
26232
- .wds-card-container {
26233
- --CardContainer-padding-block: var(--size-16);
26234
- --CardContainer-padding-inline: var(--size-16);
26235
- }
26236
- }
26237
- .wds-card-container--padding-none {
26238
- --CardContainer-padding-block: 0;
26239
- --CardContainer-padding-inline: 0;
26240
- overflow: clip;
26241
- }
26242
- .wds-card-container--active {
26243
- --CardContainer-background-color: var(--color-background-elevated);
26244
- --CardContainer-border-color: color-mix(in srgb, var(--color-border-neutral) 25%, transparent);
26245
- }
26246
- .np-theme-personal:not(.np-theme-personal--dark):not(.np-theme-personal--bright-green):not(.np-theme-personal--forest-green):not(.np-theme-business--dark):not(.np-theme-business--bright-green):not(.np-theme-business--forest-green):not(.np-theme-platform--forest-green) .wds-card-container--active {
26247
- box-shadow: var(--CardContainer-shadow);
26248
- }
26249
- .wds-card-container--inactive {
26250
- --CardContainer-background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
26251
- border-width: 0;
26252
- padding-block: calc(var(--CardContainer-padding-block) + 1px);
26253
- padding-inline: calc(var(--CardContainer-padding-inline) + 1px);
26254
- position: relative;
26255
- }
26256
- .wds-card-container__border {
26257
- container-type: size;
26258
- inset: 0;
26259
- pointer-events: none;
26260
- position: absolute;
26261
- }
26262
- .wds-card-container__border svg {
26263
- display: block;
26264
- block-size: 100%;
26265
- inline-size: 100%;
26266
- }
26267
- .wds-card-container__border rect {
26268
- --CardContainer-border-dash-size: calc(var(--size-12) * 0.5);
26269
- --CardContainer-border-stroke-radius: calc(min(var(--CardContainer-border-radius), 50cqh, 50cqw) - 0.5px);
26270
- fill: none;
26271
- block-size: calc(100% - 1px);
26272
- rx: var(--CardContainer-border-stroke-radius);
26273
- ry: var(--CardContainer-border-stroke-radius);
26274
- stroke: var(--color-border-neutral);
26275
- stroke-dasharray: var(--CardContainer-border-dash-size) var(--CardContainer-border-dash-size);
26276
- inline-size: calc(100% - 1px);
26277
- x: 0.5px;
26278
- y: 0.5px;
26279
- }
26280
- .wds-card-widget {
26281
- --CardWidget-inset: var(--size-8);
26282
- --CardWidget-header-spacing: var(--size-8);
26283
- --CardWidget-actions-gap: var(--size-8);
26284
- }
26285
- .wds-card-widget__header {
26286
- align-items: center;
26287
- -moz-column-gap: var(--size-24);
26288
- column-gap: var(--size-24);
26289
- container-type: inline-size;
26290
- display: flex;
26291
- flex-wrap: wrap;
26292
- padding-inline-start: var(--CardWidget-inset);
26293
- row-gap: var(--size-8);
26294
- }
26295
- .wds-card-widget__header:not(:last-child) {
26296
- margin-block-end: var(--CardWidget-header-spacing);
26297
- }
26298
- .wds-card-widget__title {
26299
- align-items: center;
26300
- color: var(--color-content-secondary);
26301
- display: grid;
26302
- flex: 1 1 0;
26303
- margin: 0;
26304
- min-block-size: var(--size-32);
26305
- }
26306
- @container (width <= 360px) {
26307
- .wds-card-widget__title {
26308
- flex-basis: auto;
26309
- }
26310
- }
26311
- .wds-card-widget__title-link.np-link {
26312
- color: inherit;
26313
- display: inline;
26314
- font: inherit;
26315
- letter-spacing: inherit;
26316
- text-align: start;
26317
- -webkit-text-decoration: none;
26318
- text-decoration: none;
26319
- }
26320
- .wds-card-widget__title-link.np-link:hover,
26321
- .wds-card-widget__title-link.np-link:focus-visible {
26322
- -webkit-text-decoration: underline;
26323
- text-decoration: underline;
26324
- }
26325
- .wds-card-widget__title-link.np-link .wds-card-widget__title-chevron {
26326
- white-space: nowrap;
26327
- }
26328
- .wds-card-widget__title-link.np-link .wds-card-widget__title-chevron .tw-icon {
26329
- display: inline-block;
26330
- margin: 0;
26331
- vertical-align: text-bottom;
26332
- }
26333
- .wds-card-widget__actions {
26334
- align-self: start;
26335
- align-items: center;
26336
- display: flex;
26337
- flex: none;
26338
- gap: var(--CardWidget-actions-gap);
26339
- margin-inline-start: auto;
26340
- }
26341
- .wds-card-widget--with-header .wds-card-widget__content {
26342
- padding-inline: var(--CardWidget-inset);
26343
- }
26344
26206
  .critical-comms {
26345
26207
  border-radius: var(--radius-medium);
26346
26208
  overflow: hidden;
@@ -31460,75 +31322,138 @@ button.np-link {
31460
31322
  [dir="rtl"] .np-theme-personal .sliding-panel.sliding-panel--border-left {
31461
31323
  box-shadow: inset 1px 0 0 0 var(--color-border-neutral);
31462
31324
  }
31463
- .snackbar {
31464
- text-align: center;
31325
+ .wds-Snackbar {
31326
+ display: flex;
31327
+ justify-content: center;
31328
+ box-sizing: border-box;
31329
+ padding-inline: var(--size-16);
31330
+ padding-block-end: calc(var(--size-16) + env(safe-area-inset-bottom));
31465
31331
  position: fixed;
31466
31332
  inset-block-end: 0;
31467
- inset-inline-start: 0;
31468
- inset-inline-end: 0;
31333
+ inset-inline: 0;
31469
31334
  z-index: 1060;
31470
31335
  }
31471
- .snackbar__text {
31472
- background: #37517e;
31473
- color: #ffffff;
31474
- display: inline-flex;
31475
- border-radius: 2px;
31476
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
31477
- align-items: center;
31478
- justify-content: space-between;
31336
+ @media (min-width: 600px) {
31337
+ .wds-Snackbar {
31338
+ padding-block-end: var(--size-24);
31339
+ }
31340
+ }
31341
+ .wds-Snackbar--swipe-dismiss {
31342
+ transition: transform var(--Snackbar-exit-duration) cubic-bezier(1, 0, 1, 1);
31343
+ }
31344
+ .wds-Snackbar--swipe-settle {
31345
+ transition: transform var(--Snackbar-exit-duration) cubic-bezier(0, 0, 0, 1);
31346
+ }
31347
+ .wds-Snackbar-container {
31348
+ --Prompt-border-radius: var(--radius-medium);
31349
+ --Prompt-gap: var(--size-8);
31350
+ --Prompt-padding-x: var(--size-12);
31351
+ --Prompt-padding-y: var(--size-12);
31352
+ box-sizing: border-box;
31353
+ max-inline-size: 480px;
31479
31354
  text-align: start;
31480
- font-size: var(--wds-font-size-body);
31481
- margin-block: 0;
31482
- margin-inline: var(--size-16);
31483
- padding-block: var(--size-8);
31484
- padding-inline: var(--size-16);
31485
- inline-size: calc(100% - var(--size-32));
31486
- transition: 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
31355
+ cursor: grab;
31356
+ touch-action: pan-x pinch-zoom;
31487
31357
  }
31488
- .np-theme-personal .snackbar__text {
31489
- box-shadow: 0 2px 4px 0 rgba(69, 71, 69, 0.35);
31490
- position: relative;
31491
- background: var(--color-contrast-theme);
31492
- border-radius: var(--radius-small);
31493
- color: var(--color-contrast-overlay);
31358
+ .wds-Snackbar-container .wds-prompt__content-wrapper--with-dismiss {
31359
+ grid-template-columns: auto minmax(0, 1fr);
31494
31360
  }
31495
- .np-theme-personal .snackbar__text::after {
31496
- display: block;
31497
- border-radius: inherit;
31498
- block-size: 100%;
31499
- inline-size: 100%;
31500
- content: "";
31501
- position: absolute;
31502
- inset-inline-start: 0;
31503
- inset-block-start: 0;
31504
- z-index: -1;
31505
- background-color: var(--color-background-neutral);
31361
+ @media (min-width: 600px) {
31362
+ .wds-Snackbar-container .wds-prompt__content-wrapper--with-dismiss {
31363
+ grid-template-columns: auto minmax(0, 1fr) auto;
31364
+ }
31506
31365
  }
31507
- .np-theme-personal--dark .snackbar__text,
31508
- .np-theme-personal--forest-green .snackbar__text {
31509
- box-shadow: none;
31366
+ .wds-Snackbar-container .wds-prompt__media-wrapper {
31367
+ display: flex;
31368
+ align-items: center;
31369
+ min-block-size: max(var(--size-32), 1lh);
31370
+ padding-block-start: 0;
31371
+ color: var(--color-sentiment-content-primary);
31372
+ }
31373
+ .wds-Snackbar-container .wds-prompt__media-wrapper:has(+ .wds-Snackbar__content .wds-Snackbar__action) {
31374
+ min-block-size: max(var(--size-32), calc(1lh + var(--size-5) * 2));
31375
+ }
31376
+ .wds-Snackbar__media-asset {
31377
+ display: flex;
31378
+ }
31379
+ .wds-Snackbar__media-asset svg {
31380
+ inline-size: var(--size-24);
31381
+ block-size: var(--size-24);
31382
+ }
31383
+ .wds-Snackbar__process-indicator .process-circle {
31384
+ stroke: currentColor;
31385
+ }
31386
+ .wds-Snackbar-container .wds-prompt__dismiss {
31387
+ display: none;
31388
+ align-self: flex-start;
31389
+ margin-block-start: calc(var(--size-4) - 1px);
31510
31390
  }
31511
31391
  @media (min-width: 600px) {
31512
- .snackbar__text {
31513
- inline-size: auto;
31514
- max-inline-size: 600px;
31392
+ .wds-Snackbar-container .wds-prompt__dismiss {
31393
+ display: flex;
31515
31394
  }
31516
31395
  }
31517
- .snackbar__text__action {
31396
+ .wds-Snackbar__action {
31518
31397
  flex-shrink: 0;
31519
- margin-inline-start: var(--size-16);
31520
31398
  }
31521
- .snackbar__text-container-enter,
31522
- .snackbar__text-container-exit {
31523
- transform: translateY(calc(100% + 10px));
31399
+ .wds-Snackbar__content {
31400
+ display: flex;
31401
+ align-items: flex-start;
31402
+ gap: var(--size-8);
31403
+ flex: 1 0 0;
31404
+ min-block-size: var(--size-32);
31405
+ min-inline-size: 0;
31524
31406
  }
31525
- .snackbar__text-container-enter-active {
31526
- transform: translateY(-16px);
31527
- transform: translateY(calc(-16px - env(safe-area-inset-bottom)));
31407
+ .wds-Snackbar__message {
31408
+ display: flex;
31409
+ flex-direction: column;
31410
+ justify-content: center;
31411
+ inline-size: auto;
31412
+ flex: 1 0 0;
31413
+ min-inline-size: 0;
31414
+ align-self: stretch;
31528
31415
  }
31529
- @media (min-width: 600px) {
31530
- .snackbar__text-container-enter-active {
31531
- transform: translateY(-24px);
31416
+ .wds-Snackbar__body {
31417
+ display: block;
31418
+ }
31419
+ .wds-Snackbar-container-appear,
31420
+ .wds-Snackbar-container-enter {
31421
+ opacity: 0;
31422
+ transform: translateY(80px) scale(0.5);
31423
+ }
31424
+ .wds-Snackbar-container-appear-active,
31425
+ .wds-Snackbar-container-enter-active {
31426
+ opacity: 1;
31427
+ transform: translateY(0) scale(1);
31428
+ transition: opacity 150ms linear, transform var(--Snackbar-enter-duration) cubic-bezier(0, 0, 0, 1);
31429
+ }
31430
+ .wds-Snackbar-container-exit {
31431
+ opacity: 1;
31432
+ transform: translateY(0) scale(1);
31433
+ }
31434
+ .wds-Snackbar-container-exit-active {
31435
+ opacity: 0;
31436
+ transform: translateY(80px) scale(0.5);
31437
+ transition: opacity 50ms linear 50ms, transform var(--Snackbar-exit-duration) cubic-bezier(1, 0, 1, 1);
31438
+ }
31439
+ @media (prefers-reduced-motion: reduce) {
31440
+ .wds-Snackbar--swipe-dismiss,
31441
+ .wds-Snackbar--swipe-settle {
31442
+ transition: none;
31443
+ }
31444
+ .wds-Snackbar-container-appear,
31445
+ .wds-Snackbar-container-appear-active,
31446
+ .wds-Snackbar-container-enter,
31447
+ .wds-Snackbar-container-enter-active,
31448
+ .wds-Snackbar-container-exit {
31449
+ opacity: 1;
31450
+ transform: none;
31451
+ transition: none;
31452
+ }
31453
+ .wds-Snackbar-container-exit-active {
31454
+ opacity: 0;
31455
+ transform: none;
31456
+ transition: none;
31532
31457
  }
31533
31458
  }
31534
31459
  .status-circle.negative,
@@ -1,16 +1,62 @@
1
1
  import type { ThemeDark, ThemeLight } from '../common';
2
+ import type { Sentiment } from '../SentimentSurface';
3
+ import type { SnackbarAction, SnackbarDuration } from './Snackbar.types';
4
+ /**
5
+ * Props for the controlled Snackbar surface, including provider-managed lifecycle controls.
6
+ * Use SnackbarCreationProps when creating notifications through SnackbarProvider/useSnackbar.
7
+ */
2
8
  export interface SnackbarProps {
3
- action?: {
4
- label: string;
5
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
6
- };
9
+ /** One optional callback or navigation action. Activating it dismisses after its callback runs. */
10
+ action?: SnackbarAction;
11
+ /** Changes for each new Snackbar so LiveRegion re-announces it. */
12
+ announcementKey: number;
13
+ /**
14
+ * Controls auto-dismiss with a four-second, six-second or indefinite duration after entry finishes.
15
+ * Takes precedence over the deprecated `timeout`.
16
+ * When neither option is supplied, the default is 4000ms (previously 4500ms).
17
+ * @default 'default'
18
+ */
19
+ duration?: SnackbarDuration;
20
+ /**
21
+ * Replaces the media with a progress indicator, uses neutral styling and prevents auto-dismiss.
22
+ * Takes precedence over `media`, `sentiment`, `duration` and the deprecated `timeout`.
23
+ * @default false
24
+ */
25
+ loading?: boolean;
26
+ /** Overrides sentiment-derived media with content for the 24×24px media slot. */
27
+ media?: React.ReactNode;
28
+ /**
29
+ * Called once after this Snackbar finishes exiting, including after an action (e.g. Undo)
30
+ * or replacement by a newer Snackbar. The action callback runs first.
31
+ * Not called for Snackbars discarded before being shown, such as earlier creates batched
32
+ * before the first render.
33
+ */
34
+ onDismiss?: () => void;
35
+ /** Requests an exit; the provider retains the surface until onExited confirms it has finished. */
36
+ onDismissRequest: () => void;
37
+ /** Called after the exit animation so the provider can unmount active or show its replacement. */
38
+ onExited: () => void;
39
+ /**
40
+ * Controls the sentiment surface and default media.
41
+ * @default 'neutral'
42
+ */
43
+ sentiment?: Sentiment;
44
+ /** Message content. Empty strings or absent text dismiss without creating a blank replacement. */
7
45
  text: React.ReactNode;
8
46
  /** @deprecated Has no effect. Snackbar theming is based on ThemeProvider. */
9
47
  theme?: ThemeLight | ThemeDark;
10
- timeout: number;
11
- timestamp: number;
48
+ /**
49
+ * @deprecated Use `duration` instead. Explicit millisecond values remain supported and are not
50
+ * automatically remapped when no `duration` is supplied.
51
+ * To migrate, use `default` for 0–5000ms, `extended` for values above 5000ms, and `indefinite`
52
+ * for intentionally persistent notifications.
53
+ */
54
+ timeout?: number;
55
+ /** @deprecated Has no effect when using SnackbarProvider, which manages Snackbar identity. */
56
+ timestamp?: number;
57
+ /** Controls entry/exit; the surface does not manage visibility itself. */
58
+ visible: boolean;
12
59
  }
13
- export declare const Snackbar: (props: SnackbarProps) => import("react").JSX.Element;
14
- declare const _default: (props: SnackbarProps) => import("react").ReactPortal | null;
15
- export default _default;
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;
16
62
  //# sourceMappingURL=Snackbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/Snackbar.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAKvD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;KACtD,CAAC;IACF,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,gCAoG5C,CAAC;;AAEF,wBAAwC"}
1
+ {"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/Snackbar.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD,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;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B;;;;OAIG;IACH,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,gCAwJf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ escapeDismissHint: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
8
+ export default _default;
9
+ //# sourceMappingURL=Snackbar.messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Snackbar.messages.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/Snackbar.messages.ts"],"names":[],"mappings":";;;;;;;AAEA,wBAMG"}
@@ -0,0 +1,12 @@
1
+ import type { ButtonProps, ButtonReferenceType } from '../Button/Button.types';
2
+ import type { SnackbarProps } from './Snackbar';
3
+ /** Semantic auto-dismiss durations. `indefinite` disables the timer. */
4
+ export type SnackbarDuration = 'default' | 'extended' | 'indefinite';
5
+ /** One optional action. Supports callbacks and navigation through the Button API. */
6
+ export type SnackbarAction = Pick<ButtonProps, 'href' | 'target'> & {
7
+ label: ButtonProps['children'];
8
+ onClick?: React.MouseEventHandler<ButtonReferenceType>;
9
+ };
10
+ /** Props accepted by `createSnackbar` from `useSnackbar()`. */
11
+ export type SnackbarCreationProps = Omit<SnackbarProps, 'announcementKey' | 'onDismissRequest' | 'onExited' | 'timeout' | 'visible'>;
12
+ //# sourceMappingURL=Snackbar.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Snackbar.types.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/Snackbar.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;AAErE,qFAAqF;AACrF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;IAClE,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;CACxD,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,aAAa,EACb,iBAAiB,GAAG,kBAAkB,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAC5E,CAAC"}
@@ -1,6 +1,6 @@
1
- import { SnackbarProps } from './Snackbar';
1
+ import type { SnackbarCreationProps } from './Snackbar.types';
2
2
  export type SnackbarContextType = {
3
- createSnackbar: (props: Omit<SnackbarProps, 'timeout' | 'timestamp'>) => void;
3
+ createSnackbar: (props: SnackbarCreationProps) => void;
4
4
  };
5
5
  export declare const SnackbarContext: import("react").Context<SnackbarContextType>;
6
6
  export declare const SnackbarConsumer: import("react").Consumer<SnackbarContextType>;
@@ -1 +1 @@
1
- {"version":3,"file":"SnackbarContext.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/SnackbarContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,IAAI,CAAC;CAC/E,CAAC;AAEF,eAAO,MAAM,eAAe,8CAAmE,CAAC;AAEhG,eAAO,MAAM,gBAAgB,+CAA2B,CAAC"}
1
+ {"version":3,"file":"SnackbarContext.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/SnackbarContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,eAAO,MAAM,eAAe,8CAAmE,CAAC;AAEhG,eAAO,MAAM,gBAAgB,+CAA2B,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Renders the Snackbar into `document.body` after mount, so it's safe for SSR. */
2
+ declare const SnackbarPortal: (props: import("./Snackbar").SnackbarProps) => import("react").ReactPortal | null;
3
+ export default SnackbarPortal;
4
+ //# sourceMappingURL=SnackbarPortal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SnackbarPortal.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/SnackbarPortal.tsx"],"names":[],"mappings":"AAIA,mFAAmF;AACnF,QAAA,MAAM,cAAc,mFAA2B,CAAC;AAEhD,eAAe,cAAc,CAAC"}
@@ -1,4 +1,11 @@
1
1
  export interface SnackbarProviderProps {
2
+ /**
3
+ * @deprecated Use per-Snackbar `duration` instead. Explicit millisecond values remain supported
4
+ * and are not automatically remapped when no `duration` is supplied.
5
+ * When neither option is supplied, the default is 4000ms (previously 4500ms), after entry finishes.
6
+ * To migrate, use `default` for 0–5000ms, `extended` for values above 5000ms, and `indefinite`
7
+ * for intentionally persistent notifications.
8
+ */
2
9
  timeout?: number;
3
10
  children?: React.ReactNode;
4
11
  }