@transferwise/components 0.0.0-experimental-d72e9b7 → 0.0.0-experimental-f4ca4fa

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 (109) hide show
  1. package/build/Prompt/PrimitivePrompt/PrimitivePrompt.js +2 -1
  2. package/build/Prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  3. package/build/Prompt/PrimitivePrompt/PrimitivePrompt.mjs +2 -1
  4. package/build/Prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  5. package/build/Provider/Provider.js +24 -1
  6. package/build/Provider/Provider.js.map +1 -1
  7. package/build/Provider/Provider.mjs +24 -1
  8. package/build/Provider/Provider.mjs.map +1 -1
  9. package/build/Snackbar/Snackbar.js +179 -102
  10. package/build/Snackbar/Snackbar.js.map +1 -1
  11. package/build/Snackbar/Snackbar.messages.js +14 -0
  12. package/build/Snackbar/Snackbar.messages.js.map +1 -0
  13. package/build/Snackbar/Snackbar.messages.mjs +10 -0
  14. package/build/Snackbar/Snackbar.messages.mjs.map +1 -0
  15. package/build/Snackbar/Snackbar.mjs +181 -101
  16. package/build/Snackbar/Snackbar.mjs.map +1 -1
  17. package/build/Snackbar/SnackbarContext.js.map +1 -1
  18. package/build/Snackbar/SnackbarContext.mjs.map +1 -1
  19. package/build/Snackbar/SnackbarPortal.js +12 -0
  20. package/build/Snackbar/SnackbarPortal.js.map +1 -0
  21. package/build/Snackbar/SnackbarPortal.mjs +8 -0
  22. package/build/Snackbar/SnackbarPortal.mjs.map +1 -0
  23. package/build/Snackbar/SnackbarProvider.js +24 -28
  24. package/build/Snackbar/SnackbarProvider.js.map +1 -1
  25. package/build/Snackbar/SnackbarProvider.mjs +25 -29
  26. package/build/Snackbar/SnackbarProvider.mjs.map +1 -1
  27. package/build/Snackbar/constants.js +17 -0
  28. package/build/Snackbar/constants.js.map +1 -0
  29. package/build/Snackbar/constants.mjs +11 -0
  30. package/build/Snackbar/constants.mjs.map +1 -0
  31. package/build/Snackbar/useSnackbarAutoDismiss.js +66 -0
  32. package/build/Snackbar/useSnackbarAutoDismiss.js.map +1 -0
  33. package/build/Snackbar/useSnackbarAutoDismiss.mjs +62 -0
  34. package/build/Snackbar/useSnackbarAutoDismiss.mjs.map +1 -0
  35. package/build/Snackbar/useSnackbarManager.js +153 -0
  36. package/build/Snackbar/useSnackbarManager.js.map +1 -0
  37. package/build/Snackbar/useSnackbarManager.mjs +149 -0
  38. package/build/Snackbar/useSnackbarManager.mjs.map +1 -0
  39. package/build/Snackbar/useSnackbarSwipeDismiss.js +135 -0
  40. package/build/Snackbar/useSnackbarSwipeDismiss.js.map +1 -0
  41. package/build/Snackbar/useSnackbarSwipeDismiss.mjs +131 -0
  42. package/build/Snackbar/useSnackbarSwipeDismiss.mjs.map +1 -0
  43. package/build/i18n/en.json +1 -0
  44. package/build/i18n/en.json.js +1 -0
  45. package/build/i18n/en.json.js.map +1 -1
  46. package/build/i18n/en.json.mjs +1 -0
  47. package/build/i18n/en.json.mjs.map +1 -1
  48. package/build/main.css +119 -57
  49. package/build/styles/IconButton/IconButton.css +3 -4
  50. package/build/styles/Snackbar/Snackbar.css +117 -54
  51. package/build/styles/main.css +119 -57
  52. package/build/types/Prompt/PrimitivePrompt/PrimitivePrompt.d.ts +11 -0
  53. package/build/types/Prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  54. package/build/types/Snackbar/Snackbar.d.ts +55 -9
  55. package/build/types/Snackbar/Snackbar.d.ts.map +1 -1
  56. package/build/types/Snackbar/Snackbar.messages.d.ts +9 -0
  57. package/build/types/Snackbar/Snackbar.messages.d.ts.map +1 -0
  58. package/build/types/Snackbar/Snackbar.types.d.ts +12 -0
  59. package/build/types/Snackbar/Snackbar.types.d.ts.map +1 -0
  60. package/build/types/Snackbar/SnackbarContext.d.ts +2 -2
  61. package/build/types/Snackbar/SnackbarContext.d.ts.map +1 -1
  62. package/build/types/Snackbar/SnackbarPortal.d.ts +4 -0
  63. package/build/types/Snackbar/SnackbarPortal.d.ts.map +1 -0
  64. package/build/types/Snackbar/SnackbarProvider.d.ts +7 -0
  65. package/build/types/Snackbar/SnackbarProvider.d.ts.map +1 -1
  66. package/build/types/Snackbar/constants.d.ts +9 -0
  67. package/build/types/Snackbar/constants.d.ts.map +1 -0
  68. package/build/types/Snackbar/index.d.ts +1 -1
  69. package/build/types/Snackbar/index.d.ts.map +1 -1
  70. package/build/types/Snackbar/useSnackbar.d.ts +1 -1
  71. package/build/types/Snackbar/useSnackbar.d.ts.map +1 -1
  72. package/build/types/Snackbar/useSnackbarAutoDismiss.d.ts +13 -0
  73. package/build/types/Snackbar/useSnackbarAutoDismiss.d.ts.map +1 -0
  74. package/build/types/Snackbar/useSnackbarManager.d.ts +20 -0
  75. package/build/types/Snackbar/useSnackbarManager.d.ts.map +1 -0
  76. package/build/types/Snackbar/useSnackbarSwipeDismiss.d.ts +22 -0
  77. package/build/types/Snackbar/useSnackbarSwipeDismiss.d.ts.map +1 -0
  78. package/build/types/index.d.ts +1 -1
  79. package/build/types/index.d.ts.map +1 -1
  80. package/build/types/test-utils/index.d.ts +2 -0
  81. package/build/types/test-utils/index.d.ts.map +1 -1
  82. package/package.json +1 -1
  83. package/src/IconButton/IconButton.css +3 -4
  84. package/src/IconButton/IconButton.less +14 -1
  85. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.test.tsx +24 -1
  86. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.tsx +8 -2
  87. package/src/Provider/Provider.tsx +1 -1
  88. package/src/Snackbar/Snackbar.css +117 -54
  89. package/src/Snackbar/Snackbar.less +139 -60
  90. package/src/Snackbar/Snackbar.messages.ts +9 -0
  91. package/src/Snackbar/Snackbar.test.tsx +992 -119
  92. package/src/Snackbar/Snackbar.tsx +209 -93
  93. package/src/Snackbar/Snackbar.types.ts +17 -0
  94. package/src/Snackbar/SnackbarContext.ts +2 -2
  95. package/src/Snackbar/SnackbarPortal.tsx +8 -0
  96. package/src/Snackbar/SnackbarProvider.test.tsx +783 -0
  97. package/src/Snackbar/SnackbarProvider.tsx +27 -19
  98. package/src/Snackbar/_stories/Snackbar.accessibility.docs.mdx +58 -0
  99. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +16 -8
  100. package/src/Snackbar/_stories/Snackbar.story.tsx +388 -61
  101. package/src/Snackbar/_stories/Snackbar.test.story.tsx +171 -47
  102. package/src/Snackbar/constants.ts +10 -0
  103. package/src/Snackbar/index.ts +1 -1
  104. package/src/Snackbar/useSnackbarAutoDismiss.ts +74 -0
  105. package/src/Snackbar/useSnackbarManager.ts +169 -0
  106. package/src/Snackbar/useSnackbarSwipeDismiss.ts +169 -0
  107. package/src/i18n/en.json +1 -0
  108. package/src/index.ts +1 -1
  109. package/src/main.css +119 -57
@@ -35,15 +35,14 @@
35
35
  color: var(--color-white);
36
36
  }
37
37
  .np-icon-button-minimal-default {
38
- color: var(--color-interactive-primary);
39
- background-color: var(--color-background-screen);
38
+ color: var(--color-sentiment-content-primary, var(--color-interactive-primary));
40
39
  background-color: transparent;
41
40
  }
42
41
  .np-icon-button-minimal-default:not(.disabled):not(:disabled):hover {
43
- background-color: var(--color-background-screen-hover);
42
+ background-color: var(--color-sentiment-interactive-secondary-neutral-hover, var(--color-background-screen-hover));
44
43
  }
45
44
  .np-icon-button-minimal-default:not(.disabled):not(:disabled):active {
46
- background-color: var(--color-background-screen-active);
45
+ background-color: var(--color-sentiment-interactive-secondary-neutral-active, var(--color-background-screen-active));
47
46
  }
48
47
  .np-icon-button-secondary-default {
49
48
  color: var(--color-sentiment-content-primary, var(--color-interactive-primary));
@@ -31,8 +31,21 @@
31
31
  }
32
32
 
33
33
  &-minimal-default {
34
- .colors(--color-interactive-primary, --color-background-screen);
34
+ color: var(--color-sentiment-content-primary, var(--color-interactive-primary));
35
35
  background-color: transparent;
36
+
37
+ &:not(.disabled, :disabled):hover {
38
+ background-color: var(
39
+ --color-sentiment-interactive-secondary-neutral-hover,
40
+ var(--color-background-screen-hover)
41
+ );
42
+ }
43
+ &:not(.disabled, :disabled):active {
44
+ background-color: var(
45
+ --color-sentiment-interactive-secondary-neutral-active,
46
+ var(--color-background-screen-active)
47
+ );
48
+ }
36
49
  }
37
50
 
38
51
  &-secondary-default {
@@ -74,7 +74,30 @@ describe('PrimitivePrompt', () => {
74
74
  const onDismiss = jest.fn();
75
75
  render(<PrimitivePrompt {...defaultProps} onDismiss={onDismiss} />);
76
76
 
77
- expect(screen.getByLabelText('Close')).toBeInTheDocument();
77
+ expect(screen.getByRole('button', { name: 'Close' })).toHaveClass(
78
+ 'np-icon-button-secondary-default',
79
+ );
80
+ });
81
+
82
+ it('supports a minimal dismiss button without changing its accessible name or handler', async () => {
83
+ const onDismiss = jest.fn();
84
+ const user = userEvent.setup();
85
+ render(
86
+ <PrimitivePrompt
87
+ {...defaultProps}
88
+ dismissButtonPriority="minimal"
89
+ data-testid="prompt"
90
+ onDismiss={onDismiss}
91
+ />,
92
+ );
93
+
94
+ const dismissButton = screen.getByRole('button', { name: 'Close' });
95
+ expect(dismissButton).toHaveClass('np-icon-button-minimal-default');
96
+ expect(screen.getByTestId('prompt')).not.toHaveAttribute('dismissButtonPriority');
97
+
98
+ await user.click(dismissButton);
99
+
100
+ expect(onDismiss).toHaveBeenCalledTimes(1);
78
101
  });
79
102
 
80
103
  it('calls onDismiss when dismiss button is clicked', async () => {
@@ -1,7 +1,7 @@
1
1
  import { Cross } from '@transferwise/icons';
2
2
  import { clsx } from 'clsx';
3
3
  import SentimentSurface, { Emphasis, Sentiment } from '../../SentimentSurface';
4
- import IconButton from '../../IconButton';
4
+ import IconButton, { type IconButtonProps } from '../../IconButton';
5
5
  import { useIntl } from 'react-intl';
6
6
  import closeBtnMessages from '../../common/CloseButton/CloseButton.messages';
7
7
  import { forwardRef, HTMLAttributes, ReactNode } from 'react';
@@ -29,6 +29,11 @@ export type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {
29
29
  * Handler called when the close button is clicked. If not provided, then the close button is hidden.
30
30
  */
31
31
  onDismiss?: () => void;
32
+ /**
33
+ * The priority of the dismiss IconButton.
34
+ * @default 'secondary'
35
+ */
36
+ dismissButtonPriority?: IconButtonProps['priority'];
32
37
  /**
33
38
  * Test ID for testing tools
34
39
  */
@@ -46,6 +51,7 @@ export const PrimitivePrompt = forwardRef<HTMLDivElement, PrimitivePromptProps>(
46
51
  media,
47
52
  actions,
48
53
  onDismiss,
54
+ dismissButtonPriority = 'secondary',
49
55
  className,
50
56
  children,
51
57
  ...restProps
@@ -73,7 +79,7 @@ export const PrimitivePrompt = forwardRef<HTMLDivElement, PrimitivePromptProps>(
73
79
  {onDismiss && (
74
80
  <IconButton
75
81
  size={24}
76
- priority="secondary"
82
+ priority={dismissButtonPriority}
77
83
  aria-label={intl.formatMessage(closeBtnMessages.ariaLabel)}
78
84
  className="wds-prompt__dismiss"
79
85
  onClick={onDismiss}
@@ -1,6 +1,6 @@
1
1
  import { IntlProvider, ResolvedIntlConfig } from 'react-intl';
2
2
 
3
- import { adjustLocale, DEFAULT_LOCALE, getDirectionFromLocale } from '../common/Locale';
3
+ import { adjustLocale, DEFAULT_LOCALE, getDirectionFromLocale } from '../common';
4
4
  import en from '../i18n/en.json';
5
5
 
6
6
  import { DirectionProvider } from './Direction';
@@ -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
  }
@@ -1,80 +1,159 @@
1
1
  @import (reference) "./../styles/variables/zindex.less";
2
- @import (reference) "./../styles/variables/neptune-tokens.less";
3
2
 
4
- .snackbar {
5
- text-align: center;
3
+ .wds-Snackbar {
4
+ display: flex;
5
+ justify-content: center;
6
+ box-sizing: border-box;
7
+ padding-inline: var(--size-16);
8
+ padding-bottom: calc(var(--size-16) + env(safe-area-inset-bottom));
6
9
  position: fixed;
7
10
  bottom: 0;
8
- left: 0;
11
+ inset-inline: 0;
12
+ z-index: @zindex-mobile-nav;
9
13
 
10
- right: 0;
14
+ @media (--screen-sm) {
15
+ padding-bottom: var(--size-24);
16
+ }
11
17
 
12
- z-index: @zindex-mobile-nav;
18
+ &--swipe-dismiss {
19
+ transition: transform var(--Snackbar-exit-duration) cubic-bezier(1, 0, 1, 1);
20
+ }
13
21
 
14
- &__text {
15
- background: @color-navy-background-elevated;
16
- color: @color-navy-content-primary;
17
- display: inline-flex;
18
- border-radius: 2px;
19
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
20
- align-items: center;
21
- justify-content: space-between;
22
- text-align: left;
23
-
24
- font-size: var(--wds-font-size-body);
25
- margin: 0 var(--size-16);
26
- padding: var(--size-8) var(--size-16);
27
- width: calc(100% - var(--size-32));
28
- transition: 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
29
-
30
- .np-theme-personal & {
31
- box-shadow: 0 2px 4px 0 rgba(69, 71, 69, 0.35);
32
- position: relative;
33
- background: var(--color-contrast-theme);
34
- border-radius: var(--radius-small);
35
- color: var(--color-contrast-overlay);
36
-
37
- &::after {
38
- display: block;
39
- border-radius: inherit;
40
- height: 100%;
41
- width: 100%;
42
- content: "";
43
- position: absolute;
44
- left: 0;
45
- top: 0;
46
- z-index: -1;
47
- background-color: var(--color-background-neutral);
48
- }
49
- }
22
+ &--swipe-settle {
23
+ transition: transform var(--Snackbar-exit-duration) cubic-bezier(0, 0, 0, 1);
24
+ }
50
25
 
51
- .np-theme-personal--dark &,
52
- .np-theme-personal--forest-green & {
53
- box-shadow: none;
54
- }
26
+ &-container {
27
+ --Prompt-border-radius: var(--radius-medium);
28
+ --Prompt-gap: var(--size-8);
29
+ --Prompt-padding-x: var(--size-12);
30
+ --Prompt-padding-y: var(--size-12);
31
+ box-sizing: border-box;
32
+ max-width: 480px;
33
+ text-align: start;
34
+ cursor: grab;
35
+ touch-action: pan-x pinch-zoom;
36
+ }
37
+
38
+ &-container .wds-prompt__content-wrapper--with-dismiss {
39
+ grid-template-columns: auto minmax(0, 1fr);
55
40
 
56
41
  @media (--screen-sm) {
57
- width: auto;
58
- max-width: 600px;
42
+ grid-template-columns: auto minmax(0, 1fr) auto;
59
43
  }
44
+ }
60
45
 
61
- &__action {
62
- flex-shrink: 0;
63
- margin-left: var(--size-16);
46
+ &-container .wds-prompt__media-wrapper {
47
+ display: flex;
48
+ align-items: center;
49
+ min-height: max(var(--size-32), 1lh);
50
+ padding-top: 0;
51
+ color: var(--color-sentiment-content-primary);
52
+
53
+ // At 400% reflow spacing shrinks, but the text's line height does not.
54
+ &:has(+ .wds-Snackbar__content .wds-Snackbar__action) {
55
+ min-height: max(var(--size-32), calc(1lh + var(--size-5) * 2));
64
56
  }
57
+ }
65
58
 
66
- &-container-enter,
67
- &-container-exit {
68
- transform: translateY(calc(100% + 10px));
59
+ &__media-asset {
60
+ display: flex;
61
+
62
+ svg {
63
+ width: var(--size-24);
64
+ height: var(--size-24);
69
65
  }
66
+ }
70
67
 
71
- &-container-enter-active {
72
- transform: translateY(-16px);
73
- transform: translateY(calc(-16px - env(safe-area-inset-bottom)));
68
+ &__process-indicator .process-circle {
69
+ stroke: currentColor;
70
+ }
71
+
72
+ &-container .wds-prompt__dismiss {
73
+ display: none;
74
+ align-self: flex-start;
75
+ margin-top: calc(var(--size-4) - 1px);
74
76
 
75
- @media (--screen-sm) {
76
- transform: translateY(-24px);
77
- }
77
+ @media (--screen-sm) {
78
+ display: flex;
78
79
  }
79
80
  }
81
+
82
+ &__action {
83
+ flex-shrink: 0;
84
+ }
85
+
86
+ &__content {
87
+ display: flex;
88
+ align-items: flex-start;
89
+ gap: var(--size-8);
90
+ flex: 1 0 0;
91
+ min-height: var(--size-32);
92
+ min-width: 0;
93
+ }
94
+
95
+ &__message {
96
+ display: flex;
97
+ flex-direction: column;
98
+ justify-content: center;
99
+ width: auto;
100
+ flex: 1 0 0;
101
+ min-width: 0;
102
+ align-self: stretch;
103
+ }
104
+
105
+ &__body {
106
+ display: block;
107
+ }
108
+ }
109
+
110
+ .wds-Snackbar-container-appear,
111
+ .wds-Snackbar-container-enter {
112
+ opacity: 0;
113
+ transform: translateY(80px) scale(0.5);
114
+ }
115
+
116
+ .wds-Snackbar-container-appear-active,
117
+ .wds-Snackbar-container-enter-active {
118
+ opacity: 1;
119
+ transform: translateY(0) scale(1);
120
+ transition:
121
+ opacity 150ms linear,
122
+ transform var(--Snackbar-enter-duration) cubic-bezier(0, 0, 0, 1);
123
+ }
124
+
125
+ .wds-Snackbar-container-exit {
126
+ opacity: 1;
127
+ transform: translateY(0) scale(1);
128
+ }
129
+
130
+ .wds-Snackbar-container-exit-active {
131
+ opacity: 0;
132
+ transform: translateY(80px) scale(0.5);
133
+ transition:
134
+ opacity 50ms linear 50ms,
135
+ transform var(--Snackbar-exit-duration) cubic-bezier(1, 0, 1, 1);
136
+ }
137
+
138
+ @media (prefers-reduced-motion: reduce) {
139
+ .wds-Snackbar--swipe-dismiss,
140
+ .wds-Snackbar--swipe-settle {
141
+ transition: none;
142
+ }
143
+
144
+ .wds-Snackbar-container-appear,
145
+ .wds-Snackbar-container-appear-active,
146
+ .wds-Snackbar-container-enter,
147
+ .wds-Snackbar-container-enter-active,
148
+ .wds-Snackbar-container-exit {
149
+ opacity: 1;
150
+ transform: none;
151
+ transition: none;
152
+ }
153
+
154
+ .wds-Snackbar-container-exit-active {
155
+ opacity: 0;
156
+ transform: none;
157
+ transition: none;
158
+ }
80
159
  }
@@ -0,0 +1,9 @@
1
+ import { defineMessages } from 'react-intl';
2
+
3
+ export default defineMessages({
4
+ escapeDismissHint: {
5
+ id: 'neptune.Snackbar.escapeDismissHint',
6
+ defaultMessage: 'Press Escape to dismiss.',
7
+ description: 'Screen-reader instruction for dismissing a Snackbar without moving focus',
8
+ },
9
+ });