@transferwise/components 0.0.0-experimental-c20c070 → 0.0.0-experimental-b2b287d

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 (126) hide show
  1. package/README.md +1 -1
  2. package/build/Link/Link.js.map +1 -1
  3. package/build/Link/Link.mjs.map +1 -1
  4. package/build/Loader/Loader.js.map +1 -1
  5. package/build/Loader/Loader.mjs.map +1 -1
  6. package/build/Section/Section.js.map +1 -1
  7. package/build/Section/Section.mjs.map +1 -1
  8. package/build/Snackbar/Snackbar.js +178 -102
  9. package/build/Snackbar/Snackbar.js.map +1 -1
  10. package/build/Snackbar/Snackbar.messages.js +14 -0
  11. package/build/Snackbar/Snackbar.messages.js.map +1 -0
  12. package/build/Snackbar/Snackbar.messages.mjs +10 -0
  13. package/build/Snackbar/Snackbar.messages.mjs.map +1 -0
  14. package/build/Snackbar/Snackbar.mjs +180 -101
  15. package/build/Snackbar/Snackbar.mjs.map +1 -1
  16. package/build/Snackbar/SnackbarContext.js.map +1 -1
  17. package/build/Snackbar/SnackbarContext.mjs.map +1 -1
  18. package/build/Snackbar/SnackbarPortal.js +12 -0
  19. package/build/Snackbar/SnackbarPortal.js.map +1 -0
  20. package/build/Snackbar/SnackbarPortal.mjs +8 -0
  21. package/build/Snackbar/SnackbarPortal.mjs.map +1 -0
  22. package/build/Snackbar/SnackbarProvider.js +24 -28
  23. package/build/Snackbar/SnackbarProvider.js.map +1 -1
  24. package/build/Snackbar/SnackbarProvider.mjs +25 -29
  25. package/build/Snackbar/SnackbarProvider.mjs.map +1 -1
  26. package/build/Snackbar/constants.js +17 -0
  27. package/build/Snackbar/constants.js.map +1 -0
  28. package/build/Snackbar/constants.mjs +11 -0
  29. package/build/Snackbar/constants.mjs.map +1 -0
  30. package/build/Snackbar/useSnackbarAutoDismiss.js +66 -0
  31. package/build/Snackbar/useSnackbarAutoDismiss.js.map +1 -0
  32. package/build/Snackbar/useSnackbarAutoDismiss.mjs +62 -0
  33. package/build/Snackbar/useSnackbarAutoDismiss.mjs.map +1 -0
  34. package/build/Snackbar/useSnackbarManager.js +153 -0
  35. package/build/Snackbar/useSnackbarManager.js.map +1 -0
  36. package/build/Snackbar/useSnackbarManager.mjs +149 -0
  37. package/build/Snackbar/useSnackbarManager.mjs.map +1 -0
  38. package/build/Snackbar/useSnackbarSwipeDismiss.js +135 -0
  39. package/build/Snackbar/useSnackbarSwipeDismiss.js.map +1 -0
  40. package/build/Snackbar/useSnackbarSwipeDismiss.mjs +131 -0
  41. package/build/Snackbar/useSnackbarSwipeDismiss.mjs.map +1 -0
  42. package/build/_deprecated/Select/Select.js +1 -1
  43. package/build/_deprecated/Select/Select.js.map +1 -1
  44. package/build/_deprecated/Select/Select.mjs +1 -1
  45. package/build/_deprecated/Select/Select.mjs.map +1 -1
  46. package/build/common/BottomSheet/BottomSheet.js +3 -1
  47. package/build/common/BottomSheet/BottomSheet.js.map +1 -1
  48. package/build/common/BottomSheet/BottomSheet.mjs +3 -1
  49. package/build/common/BottomSheet/BottomSheet.mjs.map +1 -1
  50. package/build/i18n/en.json +1 -0
  51. package/build/i18n/en.json.js +1 -0
  52. package/build/i18n/en.json.js.map +1 -1
  53. package/build/i18n/en.json.mjs +1 -0
  54. package/build/i18n/en.json.mjs.map +1 -1
  55. package/build/main.css +116 -53
  56. package/build/styles/Snackbar/Snackbar.css +117 -54
  57. package/build/styles/main.css +116 -53
  58. package/build/types/Link/Link.d.ts +1 -1
  59. package/build/types/Loader/Loader.d.ts +1 -1
  60. package/build/types/Section/Section.d.ts +1 -1
  61. package/build/types/Snackbar/Snackbar.d.ts +55 -9
  62. package/build/types/Snackbar/Snackbar.d.ts.map +1 -1
  63. package/build/types/Snackbar/Snackbar.messages.d.ts +9 -0
  64. package/build/types/Snackbar/Snackbar.messages.d.ts.map +1 -0
  65. package/build/types/Snackbar/Snackbar.types.d.ts +12 -0
  66. package/build/types/Snackbar/Snackbar.types.d.ts.map +1 -0
  67. package/build/types/Snackbar/SnackbarContext.d.ts +2 -2
  68. package/build/types/Snackbar/SnackbarContext.d.ts.map +1 -1
  69. package/build/types/Snackbar/SnackbarPortal.d.ts +4 -0
  70. package/build/types/Snackbar/SnackbarPortal.d.ts.map +1 -0
  71. package/build/types/Snackbar/SnackbarProvider.d.ts +7 -0
  72. package/build/types/Snackbar/SnackbarProvider.d.ts.map +1 -1
  73. package/build/types/Snackbar/constants.d.ts +9 -0
  74. package/build/types/Snackbar/constants.d.ts.map +1 -0
  75. package/build/types/Snackbar/index.d.ts +1 -1
  76. package/build/types/Snackbar/index.d.ts.map +1 -1
  77. package/build/types/Snackbar/useSnackbar.d.ts +1 -1
  78. package/build/types/Snackbar/useSnackbar.d.ts.map +1 -1
  79. package/build/types/Snackbar/useSnackbarAutoDismiss.d.ts +13 -0
  80. package/build/types/Snackbar/useSnackbarAutoDismiss.d.ts.map +1 -0
  81. package/build/types/Snackbar/useSnackbarManager.d.ts +20 -0
  82. package/build/types/Snackbar/useSnackbarManager.d.ts.map +1 -0
  83. package/build/types/Snackbar/useSnackbarSwipeDismiss.d.ts +22 -0
  84. package/build/types/Snackbar/useSnackbarSwipeDismiss.d.ts.map +1 -0
  85. package/build/types/_deprecated/Select/Select.d.ts +1 -1
  86. package/build/types/common/BottomSheet/BottomSheet.d.ts +3 -1
  87. package/build/types/common/BottomSheet/BottomSheet.d.ts.map +1 -1
  88. package/build/types/index.d.ts +1 -1
  89. package/build/types/index.d.ts.map +1 -1
  90. package/build/types/test-utils/index.d.ts +2 -0
  91. package/build/types/test-utils/index.d.ts.map +1 -1
  92. package/package.json +3 -3
  93. package/src/FlowNavigation/_stories/FlowNavigation.CriticalBanner.docs.mdx +66 -0
  94. package/src/Link/Link.tsx +1 -1
  95. package/src/ListItem/AdditionalInfo/_stories/ListItemAdditionalInfo.story.tsx +1 -1
  96. package/src/ListItem/AvatarView/_stories/ListItemAvatarView.story.tsx +3 -3
  97. package/src/ListItem/_stories/ListItem.disabled.story.tsx +1 -1
  98. package/src/Loader/Loader.tsx +1 -1
  99. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.story.tsx +2 -0
  100. package/src/Section/Section.tsx +1 -1
  101. package/src/Snackbar/Snackbar.css +117 -54
  102. package/src/Snackbar/Snackbar.less +139 -60
  103. package/src/Snackbar/Snackbar.messages.ts +9 -0
  104. package/src/Snackbar/Snackbar.test.tsx +989 -119
  105. package/src/Snackbar/Snackbar.tsx +208 -93
  106. package/src/Snackbar/Snackbar.types.ts +17 -0
  107. package/src/Snackbar/SnackbarContext.ts +2 -2
  108. package/src/Snackbar/SnackbarPortal.tsx +8 -0
  109. package/src/Snackbar/SnackbarProvider.test.tsx +783 -0
  110. package/src/Snackbar/SnackbarProvider.tsx +27 -19
  111. package/src/Snackbar/_stories/Snackbar.accessibility.docs.mdx +58 -0
  112. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +16 -8
  113. package/src/Snackbar/_stories/Snackbar.story.tsx +388 -61
  114. package/src/Snackbar/_stories/Snackbar.test.story.tsx +171 -47
  115. package/src/Snackbar/constants.ts +10 -0
  116. package/src/Snackbar/index.ts +1 -1
  117. package/src/Snackbar/useSnackbarAutoDismiss.ts +74 -0
  118. package/src/Snackbar/useSnackbarManager.ts +169 -0
  119. package/src/Snackbar/useSnackbarSwipeDismiss.ts +169 -0
  120. package/src/_deprecated/Select/Select.tsx +1 -1
  121. package/src/_deprecated/Select/_stories/Select.story.tsx +1 -1
  122. package/src/common/BottomSheet/BottomSheet.tsx +3 -1
  123. package/src/i18n/en.json +1 -0
  124. package/src/index.ts +1 -1
  125. package/src/main.css +116 -53
  126. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.docs.mdx +0 -122
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-c20c070",
3
+ "version": "0.0.0-experimental-b2b287d",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -59,7 +59,7 @@
59
59
  "@testing-library/jest-dom": "^6.9.1",
60
60
  "@testing-library/react": "^16.3.3",
61
61
  "@testing-library/user-event": "^14.6.7",
62
- "@transferwise/icons": "^4.7.0",
62
+ "@transferwise/icons": "^4.6.0",
63
63
  "@transferwise/less-config": "3.2.0",
64
64
  "@tsconfig/recommended": "^1.0.13",
65
65
  "@types/babel__core": "^7.20.5",
@@ -74,7 +74,7 @@
74
74
  "@monaco-editor/react": "^4.7.0",
75
75
  "monaco-editor": "^0.57.0",
76
76
  "monaco-editor-webpack-plugin": "^7.1.1",
77
- "@wise/art": "^2.33.0",
77
+ "@wise/art": "^2.32.0",
78
78
  "@wise/components-theming": "1.10.3",
79
79
  "@wise/eslint-config": "^14.2.1",
80
80
  "@wise/wds-configs": "0.0.0",
@@ -0,0 +1,66 @@
1
+ import { Meta, Source } from '@storybook/addon-docs/blocks';
2
+
3
+ <Meta title="Navigation/FlowNavigation/Critical Banner Guide" />
4
+
5
+ # Critical Banner in FlowNavigation
6
+
7
+ The `FlowNavigation` component supports displaying critical banners above the navigation, by passing a `banner` prop.
8
+
9
+ `banner` accepts either the internal `CriticalBannerProps` shape, or the legacy backend `CriticalBannerData` shape (e.g. as received from `navigation-service`/`navigation-ui`) — `FlowNavigation` maps the legacy shape to `CriticalBannerProps` internally, so no manual mapping is required.
10
+
11
+ ## Basic Usage
12
+
13
+ When you're using `FlowNavigation` directly from `@transferwise/components`.
14
+
15
+ <Source
16
+ code={`import { FlowNavigation, CriticalBannerProps } from '@transferwise/components';
17
+
18
+ const banner: CriticalBannerProps = {
19
+ sentiment: 'negative',
20
+ title: 'Action required',
21
+ description: 'Please verify your identity to continue with this transfer.',
22
+ action: {
23
+ label: 'Verify now',
24
+ onClick: () => {
25
+ // Handle action
26
+ },
27
+ },
28
+ };
29
+
30
+ <FlowNavigation
31
+ banner={banner}
32
+ steps={steps}
33
+ activeStep={activeStep}
34
+ avatar={avatar}
35
+ onClose={onClose}
36
+ />;
37
+ `}
38
+ language="typescript"
39
+ dark
40
+ />
41
+
42
+ ## Using Legacy Backend Data
43
+
44
+ If your application receives banner data from a backend service (e.g. navigation-ui) in the legacy shape, you can pass it directly to `banner` — `FlowNavigation` maps it to the internal `CriticalBannerProps` shape automatically.
45
+
46
+ <Source
47
+ code={`import { FlowNavigation, CriticalBannerData } from '@transferwise/components';
48
+
49
+ const banner: CriticalBannerData = {
50
+ id: 'banner-123',
51
+ title: 'Your account requires attention', // Rendered as the banner description
52
+ subtitle: 'Action required', // Rendered as the banner title
53
+ style: 'WARNING',
54
+ action: { label: 'Take action', href: '/action' },
55
+ collapsed: false, // Rendered expanded
56
+ };
57
+
58
+ <FlowNavigation
59
+ banner={banner}
60
+ steps={steps}
61
+ activeStep={activeStep}
62
+ />;
63
+ `}
64
+ language="typescript"
65
+ dark
66
+ />
package/src/Link/Link.tsx CHANGED
@@ -14,7 +14,7 @@ export type LinkProps = PrimitiveAnchorProps &
14
14
  /**
15
15
  * Standard Link component with navigate away icon
16
16
  *
17
- * Documentation: https://storybook.wise.design/?path=/docs/typography-link--docs
17
+ * Documentation: https://transferwise.github.io/neptune-web/components/content/Link
18
18
  */
19
19
  const Link = ({
20
20
  className,
@@ -15,7 +15,7 @@ import { action } from 'storybook/actions';
15
15
  /**
16
16
  * Use additional information to add extra details that help make the information clearer for users. Use additional information only after you've used the subtitle.
17
17
  *
18
- * Refer to the [design documentation](https://docs.wise.design/components/list-item#additional-information) for more details.
18
+ * Refer to the [design documentation](https://docs.wise.design/components/list-item#content:~:text=StatusIcon.iconLabel.error-,Additional%20information,-Use%20additional%20information) for more details.
19
19
  */
20
20
  export default {
21
21
  component: ListItem.AdditionalInfo,
@@ -135,7 +135,7 @@ export const Playground: Story = {
135
135
 
136
136
  /**
137
137
  * AvatarView can display different types of content including icons, profile images, and initials. <br />
138
- * Refer to the [design documentation](https://docs.wise.design/components/avatar#media) for details.
138
+ * Refer to the [design documentation](https://docs.wise.design/components/avatar#:~:text=56%2C%20%E2%80%A8and%2072.-,Media,-There%20are%204) for details.
139
139
  */
140
140
  export const ContentTypes: Story = {
141
141
  args: {
@@ -209,7 +209,7 @@ export const ContentTypes: Story = {
209
209
 
210
210
  /**
211
211
  * AvatarView supports 6 sizes to fit different list item contexts: `24`, `32`, `40`, `48`, `56`, `72`. If decorated with a Badge, those will be sized accordingly as well. <br />
212
- * Please refer to the [design documentation](https://docs.wise.design/components/list-item#avatar-sizes) for details on when to use which one.
212
+ * Please refer to the [design documentation](https://docs.wise.design/components/list-item#avatar:~:text=of%20the%20avatar.-,Avatar%20sizes,-List%20item%20supports) for details on when to use which one.
213
213
  */
214
214
  export const Sizes: Story = {
215
215
  parameters: {
@@ -243,7 +243,7 @@ export const Sizes: Story = {
243
243
 
244
244
  /**
245
245
  * AvatarView supports different types of badges for additional context and information. <br />
246
- * Refer to the [design documentation](https://docs.wise.design/components/avatar#with-badge) for details.
246
+ * Refer to the [design documentation](https://docs.wise.design/components/avatar#:~:text=support%20the%20information.-,With%20badge,-Badges%20contain%20additional) for details.
247
247
  */
248
248
  export const Badges: Story = {
249
249
  args: {
@@ -42,7 +42,7 @@ const disabledPromptMessage = (
42
42
  );
43
43
 
44
44
  /**
45
- * Please refer to the [design documentation](https://docs.wise.design/components/list-item#disabled-states) for more details
45
+ * Please refer to the [design documentation](https://docs.wise.design/components/list-item#accessibility:~:text=-,Disabled%20states,-) for more details
46
46
  */
47
47
  export default {
48
48
  component: ListItem,
@@ -32,7 +32,7 @@ export type LoaderProps = {
32
32
  /**
33
33
  * Loader component
34
34
  *
35
- * Docs link: https://storybook.wise.design/?path=/docs/loading-loader--docs
35
+ * Docs link: https://transferwise.github.io/neptune-web/components/progress/Loader
36
36
  *
37
37
  * @param root0
38
38
  * @param root0.small
@@ -14,6 +14,8 @@ import { CriticalBanner, type CriticalBannerProps } from '..';
14
14
  * **Design guidance**: <a href="https://docs.wise.design/components/critical-banner" target="_blank">wise.design/components/critical-banner</a>
15
15
  *
16
16
  * Can be controlled or uncontrolled. When `onToggle` is provided, the consumer manages the expanded state via `expanded` and the banner calls `onToggle` when the user clicks the chevron. When `onToggle` is not provided, the banner manages its own expanded state internally and toggles it when the user clicks the chevron.
17
+ *
18
+ * **Using with FlowNavigation**: See the [FlowNavigation Critical Banner Guide](?path=/docs/navigation-flownavigation-critical-banner-guide--docs) for integration patterns and data mapping examples.
17
19
  */
18
20
  const meta = {
19
21
  component: CriticalBanner,
@@ -13,7 +13,7 @@ type SectionProps = PropsWithChildren<
13
13
 
14
14
  /**
15
15
  *
16
- * Neptune Web: https://storybook.wise.design/?path=/docs/content-section--docs
16
+ * Neptune Web: https://transferwise.github.io/neptune-web/components/content/Section
17
17
  *
18
18
  */
19
19
  const Section = ({
@@ -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
+ });