@transferwise/components 46.168.0 → 46.168.2

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 (168) hide show
  1. package/build/ListItem/ListItem.js +32 -2
  2. package/build/ListItem/ListItem.js.map +1 -1
  3. package/build/ListItem/ListItem.mjs +33 -3
  4. package/build/ListItem/ListItem.mjs.map +1 -1
  5. package/build/Prompt/Snackbar/Snackbar.js +11 -9
  6. package/build/Prompt/Snackbar/Snackbar.js.map +1 -1
  7. package/build/Prompt/Snackbar/Snackbar.mjs +7 -8
  8. package/build/Prompt/Snackbar/Snackbar.mjs.map +1 -1
  9. package/build/Prompt/Snackbar/SnackbarProvider.js +2 -2
  10. package/build/Prompt/Snackbar/SnackbarProvider.js.map +1 -1
  11. package/build/Prompt/Snackbar/SnackbarProvider.mjs +2 -2
  12. package/build/Prompt/Snackbar/SnackbarProvider.mjs.map +1 -1
  13. package/build/Prompt/Snackbar/useSnackbarSwipeDismiss.js +33 -46
  14. package/build/Prompt/Snackbar/useSnackbarSwipeDismiss.js.map +1 -1
  15. package/build/Prompt/Snackbar/useSnackbarSwipeDismiss.mjs +34 -47
  16. package/build/Prompt/Snackbar/useSnackbarSwipeDismiss.mjs.map +1 -1
  17. package/build/Provider/Provider.js +1 -24
  18. package/build/Provider/Provider.js.map +1 -1
  19. package/build/Provider/Provider.mjs +1 -24
  20. package/build/Provider/Provider.mjs.map +1 -1
  21. package/build/WithDisplayFormat/WithDisplayFormat.js +20 -8
  22. package/build/WithDisplayFormat/WithDisplayFormat.js.map +1 -1
  23. package/build/WithDisplayFormat/WithDisplayFormat.mjs +20 -8
  24. package/build/WithDisplayFormat/WithDisplayFormat.mjs.map +1 -1
  25. package/build/i18n/cs.json +1 -0
  26. package/build/i18n/cs.json.js +1 -0
  27. package/build/i18n/cs.json.js.map +1 -1
  28. package/build/i18n/cs.json.mjs +1 -0
  29. package/build/i18n/cs.json.mjs.map +1 -1
  30. package/build/i18n/de.json +1 -0
  31. package/build/i18n/de.json.js +1 -0
  32. package/build/i18n/de.json.js.map +1 -1
  33. package/build/i18n/de.json.mjs +1 -0
  34. package/build/i18n/de.json.mjs.map +1 -1
  35. package/build/i18n/es.json +1 -0
  36. package/build/i18n/es.json.js +1 -0
  37. package/build/i18n/es.json.js.map +1 -1
  38. package/build/i18n/es.json.mjs +1 -0
  39. package/build/i18n/es.json.mjs.map +1 -1
  40. package/build/i18n/hu.json +1 -0
  41. package/build/i18n/hu.json.js +1 -0
  42. package/build/i18n/hu.json.js.map +1 -1
  43. package/build/i18n/hu.json.mjs +1 -0
  44. package/build/i18n/hu.json.mjs.map +1 -1
  45. package/build/i18n/id.json +1 -0
  46. package/build/i18n/id.json.js +1 -0
  47. package/build/i18n/id.json.js.map +1 -1
  48. package/build/i18n/id.json.mjs +1 -0
  49. package/build/i18n/id.json.mjs.map +1 -1
  50. package/build/i18n/it.json +1 -0
  51. package/build/i18n/it.json.js +1 -0
  52. package/build/i18n/it.json.js.map +1 -1
  53. package/build/i18n/it.json.mjs +1 -0
  54. package/build/i18n/it.json.mjs.map +1 -1
  55. package/build/i18n/ja.json +1 -0
  56. package/build/i18n/ja.json.js +1 -0
  57. package/build/i18n/ja.json.js.map +1 -1
  58. package/build/i18n/ja.json.mjs +1 -0
  59. package/build/i18n/ja.json.mjs.map +1 -1
  60. package/build/i18n/nl.json +1 -0
  61. package/build/i18n/nl.json.js +1 -0
  62. package/build/i18n/nl.json.js.map +1 -1
  63. package/build/i18n/nl.json.mjs +1 -0
  64. package/build/i18n/nl.json.mjs.map +1 -1
  65. package/build/i18n/pl.json +1 -0
  66. package/build/i18n/pl.json.js +1 -0
  67. package/build/i18n/pl.json.js.map +1 -1
  68. package/build/i18n/pl.json.mjs +1 -0
  69. package/build/i18n/pl.json.mjs.map +1 -1
  70. package/build/i18n/pt.json +1 -0
  71. package/build/i18n/pt.json.js +1 -0
  72. package/build/i18n/pt.json.js.map +1 -1
  73. package/build/i18n/pt.json.mjs +1 -0
  74. package/build/i18n/pt.json.mjs.map +1 -1
  75. package/build/i18n/ro.json +1 -0
  76. package/build/i18n/ro.json.js +1 -0
  77. package/build/i18n/ro.json.js.map +1 -1
  78. package/build/i18n/ro.json.mjs +1 -0
  79. package/build/i18n/ro.json.mjs.map +1 -1
  80. package/build/i18n/ru.json +1 -0
  81. package/build/i18n/ru.json.js +1 -0
  82. package/build/i18n/ru.json.js.map +1 -1
  83. package/build/i18n/ru.json.mjs +1 -0
  84. package/build/i18n/ru.json.mjs.map +1 -1
  85. package/build/i18n/th.json +1 -0
  86. package/build/i18n/th.json.js +1 -0
  87. package/build/i18n/th.json.js.map +1 -1
  88. package/build/i18n/th.json.mjs +1 -0
  89. package/build/i18n/th.json.mjs.map +1 -1
  90. package/build/i18n/uk.json +1 -0
  91. package/build/i18n/uk.json.js +1 -0
  92. package/build/i18n/uk.json.js.map +1 -1
  93. package/build/i18n/uk.json.mjs +1 -0
  94. package/build/i18n/uk.json.mjs.map +1 -1
  95. package/build/i18n/zh-HK.json +1 -0
  96. package/build/i18n/zh-HK.json.js +1 -0
  97. package/build/i18n/zh-HK.json.js.map +1 -1
  98. package/build/i18n/zh-HK.json.mjs +1 -0
  99. package/build/i18n/zh-HK.json.mjs.map +1 -1
  100. package/build/main.css +12 -16
  101. package/build/styles/Inputs/InputGroup/InputGroup.css +1 -0
  102. package/build/styles/Prompt/ActionPrompt/ActionPrompt.css +10 -2
  103. package/build/styles/Prompt/CriticalBanner/CriticalBanner.css +1 -5
  104. package/build/styles/Prompt/PrimitivePrompt/PrimitivePrompt.css +0 -9
  105. package/build/styles/Prompt/PrimitivePrompt/PrimitivePrompt.vars.css +0 -0
  106. package/build/styles/main.css +12 -16
  107. package/build/test-utils/assets/apple-pay-logo.svg +0 -0
  108. package/build/types/ListItem/ListItem.d.ts +2 -0
  109. package/build/types/ListItem/ListItem.d.ts.map +1 -1
  110. package/build/types/Prompt/Snackbar/Snackbar.d.ts +2 -1
  111. package/build/types/Prompt/Snackbar/Snackbar.d.ts.map +1 -1
  112. package/build/types/Prompt/Snackbar/useSnackbarSwipeDismiss.d.ts +6 -8
  113. package/build/types/Prompt/Snackbar/useSnackbarSwipeDismiss.d.ts.map +1 -1
  114. package/build/types/WithDisplayFormat/WithDisplayFormat.d.ts +6 -4
  115. package/build/types/WithDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  116. package/package.json +16 -16
  117. package/src/InputWithDisplayFormat/_stories/InputWithDisplayFormat.story.tsx +39 -0
  118. package/src/Inputs/InputGroup/InputGroup.css +1 -0
  119. package/src/Inputs/InputGroup/InputGroup.less +1 -0
  120. package/src/Inputs/InputGroup/_stories/InputGroup.test.story.tsx +16 -0
  121. package/src/Inputs/SearchInput/_stories/SearchInput.test.story.tsx +9 -0
  122. package/src/Inputs/SelectInput/_stories/SelectInput.test.story.tsx +12 -0
  123. package/src/ListItem/ListItem.ssr.test.tsx +115 -0
  124. package/src/ListItem/ListItem.test.tsx +42 -0
  125. package/src/ListItem/ListItem.tsx +23 -2
  126. package/src/MoneyInput/_stories/MoneyInput.test.story.tsx +11 -0
  127. package/src/PhoneNumberInput/_stories/PhoneNumberInput.test.story.tsx +30 -0
  128. package/src/Prompt/ActionPrompt/ActionPrompt.css +10 -2
  129. package/src/Prompt/ActionPrompt/ActionPrompt.less +17 -2
  130. package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +29 -29
  131. package/src/Prompt/CriticalBanner/CriticalBanner.css +1 -5
  132. package/src/Prompt/CriticalBanner/CriticalBanner.less +3 -6
  133. package/src/Prompt/CriticalBanner/CriticalBanner.vars.less +3 -3
  134. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.css +0 -9
  135. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.less +0 -9
  136. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.vars.css +0 -0
  137. package/src/Prompt/PrimitivePrompt/PrimitivePrompt.vars.less +2 -0
  138. package/src/Prompt/Snackbar/Snackbar.test.tsx +1 -69
  139. package/src/Prompt/Snackbar/Snackbar.tsx +6 -7
  140. package/src/Prompt/Snackbar/SnackbarProvider.tsx +2 -2
  141. package/src/Prompt/Snackbar/useSnackbarSwipeDismiss.ts +39 -54
  142. package/src/Provider/Provider.tsx +1 -1
  143. package/src/WithDisplayFormat/WithDisplayFormat.test.js +90 -7
  144. package/src/WithDisplayFormat/WithDisplayFormat.tsx +30 -9
  145. package/src/i18n/cs.json +1 -0
  146. package/src/i18n/de.json +1 -0
  147. package/src/i18n/es.json +1 -0
  148. package/src/i18n/hu.json +1 -0
  149. package/src/i18n/id.json +1 -0
  150. package/src/i18n/it.json +1 -0
  151. package/src/i18n/ja.json +1 -0
  152. package/src/i18n/nl.json +1 -0
  153. package/src/i18n/pl.json +1 -0
  154. package/src/i18n/pt.json +1 -0
  155. package/src/i18n/ro.json +1 -0
  156. package/src/i18n/ru.json +1 -0
  157. package/src/i18n/th.json +1 -0
  158. package/src/i18n/uk.json +1 -0
  159. package/src/i18n/zh-HK.json +1 -0
  160. package/src/main.css +12 -16
  161. package/src/test-utils/assets/apple-pay-logo.svg +0 -0
  162. package/build/Prompt/Snackbar/SnackbarPortal.js +0 -12
  163. package/build/Prompt/Snackbar/SnackbarPortal.js.map +0 -1
  164. package/build/Prompt/Snackbar/SnackbarPortal.mjs +0 -8
  165. package/build/Prompt/Snackbar/SnackbarPortal.mjs.map +0 -1
  166. package/build/types/Prompt/Snackbar/SnackbarPortal.d.ts +0 -4
  167. package/build/types/Prompt/Snackbar/SnackbarPortal.d.ts.map +0 -1
  168. package/src/Prompt/Snackbar/SnackbarPortal.tsx +0 -8
@@ -7,6 +7,7 @@ type TextElementProps = InputProps | TextAreaProps;
7
7
  export type EventType = 'KeyDown' | 'Paste' | 'Cut' | 'Undo' | 'Redo' | 'Backspace' | 'Delete' | 'Initial';
8
8
  interface WithDisplayFormatState {
9
9
  value: string;
10
+ prevValue: string;
10
11
  historyNavigator: HistoryNavigator;
11
12
  prevDisplayPattern: string;
12
13
  triggerType: EventType;
@@ -40,12 +41,13 @@ declare class WithDisplayFormat<T extends TextElementProps> extends React.Compon
40
41
  value: string;
41
42
  };
42
43
  constructor(props: WithDisplayFormatProps);
43
- static getDerivedStateFromProps({ displayPattern }: WithDisplayFormatProps, { prevDisplayPattern, value, historyNavigator }: WithDisplayFormatState): {
44
+ static getDerivedStateFromProps({ displayPattern, value: propValue }: WithDisplayFormatProps, { prevDisplayPattern, prevValue, value, historyNavigator, }: WithDisplayFormatState): {
45
+ triggerType?: null | undefined;
46
+ triggerEvent?: null | undefined;
47
+ pastedLength?: number | undefined;
44
48
  prevDisplayPattern: string;
49
+ prevValue: string;
45
50
  value: string;
46
- triggerType: null;
47
- triggerEvent: null;
48
- pastedLength: number;
49
51
  } | null;
50
52
  getUserAction: (unformattedValue: string) => EventType | string;
51
53
  resetEvent: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/WithDisplayFormat/WithDisplayFormat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAS7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,KAAK,eAAe,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAC9D,KAAK,gBAAgB,GAAG,UAAU,GAAG,aAAa,CAAC;AAEnD,MAAM,MAAM,SAAS,GACnB,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErF,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,SAAS,CAAC;IACvB,YAAY,EAA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@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.168.0",
3
+ "version": "46.168.2",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -39,33 +39,33 @@
39
39
  "!**/*.tsbuildinfo"
40
40
  ],
41
41
  "devDependencies": {
42
- "@babel/core": "^7.29.7",
42
+ "@babel/core": "^7.29.13",
43
43
  "@babel/plugin-transform-runtime": "^7.29.7",
44
44
  "@babel/preset-env": "^7.29.7",
45
45
  "@babel/preset-react": "^7.29.7",
46
46
  "@babel/preset-typescript": "^7.29.7",
47
- "@formatjs/cli": "^6.16.31",
47
+ "@formatjs/cli": "^6.18.0",
48
48
  "@rollup/plugin-babel": "^7.1.0",
49
49
  "@rollup/plugin-json": "^6.1.0",
50
50
  "@rollup/plugin-node-resolve": "^16.0.3",
51
- "@rollup/plugin-typescript": "^12.3.0",
51
+ "@rollup/plugin-typescript": "^12.3.1",
52
52
  "@rollup/plugin-url": "^8.0.2",
53
- "@storybook/addon-a11y": "^10.6.0",
54
- "@storybook/addon-docs": "^10.6.0",
55
- "@storybook/addon-mcp": "^0.7.0",
53
+ "@storybook/addon-a11y": "^10.6.6",
54
+ "@storybook/addon-docs": "^10.6.6",
55
+ "@storybook/addon-mcp": "^10.6.6",
56
56
  "@storybook/addon-webpack5-compiler-babel": "^4.0.1",
57
- "@storybook/react-webpack5": "^10.6.0",
57
+ "@storybook/react-webpack5": "^10.6.6",
58
58
  "@testing-library/dom": "^10.4.2",
59
59
  "@testing-library/jest-dom": "^6.9.1",
60
60
  "@testing-library/react": "^16.3.3",
61
- "@testing-library/user-event": "^14.6.7",
61
+ "@testing-library/user-event": "^14.6.8",
62
62
  "@transferwise/icons": "^4.7.0",
63
63
  "@transferwise/less-config": "3.2.0",
64
64
  "@tsconfig/recommended": "^1.0.13",
65
65
  "@types/babel__core": "^7.20.5",
66
66
  "@types/commonmark": "^0.27.10",
67
67
  "@types/jest": "^29.5.14",
68
- "@types/lodash": "4.17.25",
68
+ "@types/lodash": "4.17.27",
69
69
  "@types/lodash.clamp": "^4.0.9",
70
70
  "@types/lodash.debounce": "^4.0.9",
71
71
  "@types/react": "^18.3.31",
@@ -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.0",
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,9 +89,9 @@
89
89
  "lodash.times": "^4.3.2",
90
90
  "react-intl": "^7.1.14",
91
91
  "react-live": "^4.1.8",
92
- "rollup": "^4.63.4",
92
+ "rollup": "^4.68.0",
93
93
  "rollup-preserve-directives": "^1.1.3",
94
- "storybook": "^10.6.0",
94
+ "storybook": "^10.6.6",
95
95
  "storybook-addon-tag-badges": "^3.1.0",
96
96
  "storybook-addon-test-codegen": "^3.0.4"
97
97
  },
@@ -105,7 +105,7 @@
105
105
  "react-intl": ">=5.10.0 <11.0.0"
106
106
  },
107
107
  "dependencies": {
108
- "@babel/runtime": "^7.29.7",
108
+ "@babel/runtime": "^7.29.13",
109
109
  "@floating-ui/react": "^0.27.20",
110
110
  "@headlessui/react": "^2.2.10",
111
111
  "@react-aria/focus": "^3.22.1",
@@ -115,13 +115,13 @@
115
115
  "@transferwise/neptune-validation": "^3.3.4",
116
116
  "clsx": "^2.1.1",
117
117
  "commonmark": "^0.31.2",
118
- "core-js": "^3.50.0",
118
+ "core-js": "^3.51.0",
119
119
  "motion": "^12.43.0",
120
120
  "lodash.clamp": "^4.0.3",
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",
@@ -1,3 +1,5 @@
1
+ import { useState } from 'react';
2
+
1
3
  import {
2
4
  createSandboxStory,
3
5
  globalScope,
@@ -86,3 +88,40 @@ export const SecurityPin: Story = {
86
88
  displayPattern: '*-*-*-*-*-*',
87
89
  },
88
90
  };
91
+
92
+ export const PropUpdates: Story = {
93
+ render: () => {
94
+ const [value, setValue] = useState('123456');
95
+ const [displayPattern, setDisplayPattern] = useState('**-**-**');
96
+
97
+ return (
98
+ <>
99
+ <Field id="prop-updates" label="Value and display pattern">
100
+ <InputWithDisplayFormat
101
+ id="prop-updates"
102
+ value={value}
103
+ displayPattern={displayPattern}
104
+ onChange={setValue}
105
+ />
106
+ </Field>
107
+ <div>
108
+ <button type="button" onClick={() => setValue('654321')}>
109
+ Change value
110
+ </button>{' '}
111
+ <button type="button" onClick={() => setDisplayPattern('**/**/**')}>
112
+ Change pattern
113
+ </button>{' '}
114
+ <button
115
+ type="button"
116
+ onClick={() => {
117
+ setValue('987654');
118
+ setDisplayPattern('** ** **');
119
+ }}
120
+ >
121
+ Change both
122
+ </button>
123
+ </div>
124
+ </>
125
+ );
126
+ },
127
+ };
@@ -2,6 +2,7 @@
2
2
  display: inline-grid;
3
3
  inline-size: 100%;
4
4
  grid-auto-columns: minmax(0, 1fr);
5
+ isolation: isolate;
5
6
  /* Prevent unwanted `group-hover/input` triggers */
6
7
  border-radius: var(--radius-full);
7
8
  }
@@ -2,6 +2,7 @@
2
2
  display: inline-grid;
3
3
  width: 100%;
4
4
  grid-auto-columns: minmax(0, 1fr);
5
+ isolation: isolate;
5
6
 
6
7
  > * {
7
8
  grid-column-start: 1;
@@ -6,6 +6,7 @@ import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/R
6
6
  import Button from '../../../Button';
7
7
  import { Input } from '../../Input/Input';
8
8
  import { InputGroup } from '../InputGroup';
9
+ import { WithOverlaidAbsoluteElement } from '../../../../.storybook/components/WithOverlaidAbsoluteElement';
9
10
 
10
11
  export default {
11
12
  component: InputGroup,
@@ -88,3 +89,18 @@ export const RTLDiff: Story = {
88
89
  },
89
90
  }),
90
91
  };
92
+
93
+ export const StackingContext: Story = {
94
+ render: () => (
95
+ <WithOverlaidAbsoluteElement>
96
+ <InputGroup
97
+ addonStart={{
98
+ content: <Search size={24} />,
99
+ initialContentWidth: 24,
100
+ }}
101
+ >
102
+ <Input placeholder="addonStart only" defaultValue="non-RTL value" />
103
+ </InputGroup>
104
+ </WithOverlaidAbsoluteElement>
105
+ ),
106
+ };
@@ -3,6 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react-webpack5';
3
3
  import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
4
4
  import { Size } from '../../../common';
5
5
  import { SearchInput } from '../SearchInput';
6
+ import { WithOverlaidAbsoluteElement } from '../../../../.storybook/components/WithOverlaidAbsoluteElement';
6
7
 
7
8
  export default {
8
9
  component: SearchInput,
@@ -38,3 +39,11 @@ export const RTLDiff: Story = {
38
39
  },
39
40
  }),
40
41
  };
42
+
43
+ export const StackingContext: Story = {
44
+ render: () => (
45
+ <WithOverlaidAbsoluteElement>
46
+ <SearchInput placeholder="Search" defaultValue="Search value" />
47
+ </WithOverlaidAbsoluteElement>
48
+ ),
49
+ };
@@ -24,6 +24,7 @@ import {
24
24
  SelectInputOptionContent,
25
25
  type SelectInputProps,
26
26
  } from '..';
27
+ import { WithOverlaidAbsoluteElement } from '../../../../.storybook/components/WithOverlaidAbsoluteElement';
27
28
 
28
29
  const meta = {
29
30
  title: 'Forms/SelectInput/Tests',
@@ -1967,3 +1968,14 @@ export const FlagClipping: Story<TestCurrency> = {
1967
1968
  ),
1968
1969
  args: flagClippingArgs,
1969
1970
  };
1971
+
1972
+ export const StackingContext: Story<TestCurrency> = {
1973
+ render: (args) => (
1974
+ <WithOverlaidAbsoluteElement>
1975
+ <Field label="Overlaid element">
1976
+ <SelectInput {...args} />
1977
+ </Field>
1978
+ </WithOverlaidAbsoluteElement>
1979
+ ),
1980
+ args: flagClippingArgs,
1981
+ };
@@ -0,0 +1,115 @@
1
+ import { renderToString } from 'react-dom/server';
2
+ import { render } from '@testing-library/react';
3
+ import { Edit } from '@transferwise/icons';
4
+ import { mockMatchMedia, within } from '../test-utils';
5
+ import Provider from '../Provider';
6
+ import en from '../i18n/en.json';
7
+ import { ListItem } from './ListItem';
8
+
9
+ mockMatchMedia();
10
+
11
+ describe('ListItem server rendering and hydration', () => {
12
+ beforeEach(() => {
13
+ jest.spyOn(console, 'error').mockImplementation((message: string) => {
14
+ // React 18 warns about the existing layout effects when rendering on the server.
15
+ if (!message.startsWith('Warning: useLayoutEffect does nothing on the server')) {
16
+ throw new Error(message);
17
+ }
18
+ });
19
+ });
20
+
21
+ afterEach(() => {
22
+ jest.restoreAllMocks();
23
+ });
24
+
25
+ const controls = [
26
+ { name: 'navigation link', control: <ListItem.Navigation href="/payments" /> },
27
+ { name: 'navigation button', control: <ListItem.Navigation /> },
28
+ {
29
+ name: 'navigation without indicator',
30
+ control: <ListItem.Navigation href="/payments" hideIndicator />,
31
+ },
32
+ { name: 'button', control: <ListItem.Button>Pay</ListItem.Button> },
33
+ { name: 'button link', control: <ListItem.Button href="/payments">Pay</ListItem.Button> },
34
+ {
35
+ name: 'icon button',
36
+ control: (
37
+ <ListItem.IconButton aria-label="Edit">
38
+ <Edit />
39
+ </ListItem.IconButton>
40
+ ),
41
+ },
42
+ {
43
+ name: 'icon button link',
44
+ control: (
45
+ <ListItem.IconButton href="/payments" aria-label="Edit">
46
+ <Edit />
47
+ </ListItem.IconButton>
48
+ ),
49
+ },
50
+ { name: 'checkbox', control: <ListItem.Checkbox /> },
51
+ { name: 'radio', control: <ListItem.Radio name="payment" /> },
52
+ { name: 'switch', control: <ListItem.Switch onClick={jest.fn()} /> },
53
+ ];
54
+
55
+ describe.each(['active', 'inactive'] as const)('%s spotlight', (spotlight) => {
56
+ it.each(controls)(
57
+ 'is present before hydration and unchanged afterwards for $name',
58
+ ({ control }) => {
59
+ const element = (
60
+ <Provider i18n={{ locale: 'en-GB', messages: en }}>
61
+ <ListItem title="Payments" spotlight={spotlight} control={control} />
62
+ </Provider>
63
+ );
64
+ const container = document.createElement('div');
65
+ container.innerHTML = renderToString(element);
66
+ const item = within(container).getByRole('listitem');
67
+ expect(item).toHaveClass(
68
+ 'wds-list-item-interactive',
69
+ 'wds-list-item-spotlight',
70
+ `wds-list-item-spotlight-${spotlight}`,
71
+ );
72
+ expect(item.querySelector('.wds-list-item-spotlight__border') !== null).toBe(
73
+ spotlight === 'inactive',
74
+ );
75
+ const serverMarkup = container.innerHTML;
76
+
77
+ render(element, { container, hydrate: true });
78
+
79
+ expect(within(container).getByRole('listitem')).toBe(item);
80
+ expect(container.innerHTML).toBe(serverMarkup);
81
+ },
82
+ );
83
+
84
+ it.each([
85
+ { name: 'no control', control: undefined },
86
+ {
87
+ name: 'partial button',
88
+ control: <ListItem.Button partiallyInteractive>Pay</ListItem.Button>,
89
+ },
90
+ {
91
+ name: 'partial icon button',
92
+ control: (
93
+ <ListItem.IconButton partiallyInteractive aria-label="Edit">
94
+ <Edit />
95
+ </ListItem.IconButton>
96
+ ),
97
+ },
98
+ ])('is absent before and after hydration for $name', ({ control }) => {
99
+ const element = (
100
+ <Provider i18n={{ locale: 'en-GB', messages: en }}>
101
+ <ListItem title="Payments" spotlight={spotlight} control={control} />
102
+ </Provider>
103
+ );
104
+ const container = document.createElement('div');
105
+ container.innerHTML = renderToString(element);
106
+ expect(within(container).getByRole('listitem')).not.toHaveClass('wds-list-item-spotlight');
107
+ expect(container.querySelector('.wds-list-item-spotlight__border')).toBeNull();
108
+ const serverMarkup = container.innerHTML;
109
+
110
+ render(element, { container, hydrate: true });
111
+
112
+ expect(container.innerHTML).toBe(serverMarkup);
113
+ });
114
+ });
115
+ });
@@ -1480,6 +1480,48 @@ describe('ListItem', () => {
1480
1480
  });
1481
1481
 
1482
1482
  describe('spotlight', () => {
1483
+ it('updates spotlight when the control changes or is removed', () => {
1484
+ const { rerender } = render(
1485
+ <ListItem
1486
+ title="Test Title"
1487
+ spotlight="inactive"
1488
+ control={<ListItem.Button>Pay</ListItem.Button>}
1489
+ />,
1490
+ );
1491
+ expect(screen.getByRole('listitem')).toHaveClass('wds-list-item-spotlight-inactive');
1492
+
1493
+ rerender(
1494
+ <ListItem
1495
+ title="Test Title"
1496
+ spotlight="inactive"
1497
+ control={<ListItem.Button partiallyInteractive>Pay</ListItem.Button>}
1498
+ />,
1499
+ );
1500
+ expect(screen.getByRole('listitem')).not.toHaveClass('wds-list-item-spotlight');
1501
+ expect(screen.getByRole('listitem')).toHaveClass('wds-list-item-partially-interactive');
1502
+
1503
+ rerender(
1504
+ <ListItem
1505
+ title="Test Title"
1506
+ spotlight="active"
1507
+ control={<ListItem.Switch onClick={cb} />}
1508
+ />,
1509
+ );
1510
+ expect(screen.getByRole('listitem')).toHaveClass('wds-list-item-spotlight-active');
1511
+
1512
+ rerender(<ListItem title="Test Title" spotlight="inactive" />);
1513
+ const listItem = screen.getByRole('listitem');
1514
+ expect(listItem).toHaveClass('wds-list-item-non-interactive');
1515
+ expect(listItem).not.toHaveClass('wds-list-item-spotlight');
1516
+ expect(listItem.querySelector('.wds-list-item-spotlight__border')).toBeNull();
1517
+ });
1518
+
1519
+ it('preserves client-side registration for wrapped controls', () => {
1520
+ const WrappedControl = () => <ListItem.Switch onClick={cb} />;
1521
+ render(<ListItem title="Test Title" spotlight="inactive" control={<WrappedControl />} />);
1522
+ expect(screen.getByRole('listitem')).toHaveClass('wds-list-item-spotlight-inactive');
1523
+ });
1524
+
1483
1525
  it('only fully interactive variant can have spotlight:active', () => {
1484
1526
  render(<ListItem title="Test Title" spotlight="active" control={<ListItem.Navigation />} />);
1485
1527
  const listItem = screen.getByRole('listitem');
@@ -1,4 +1,5 @@
1
1
  import {
2
+ isValidElement,
2
3
  useContext,
3
4
  useId,
4
5
  useMemo,
@@ -38,6 +39,15 @@ export type ListItemControlProps =
38
39
  | ListItemRadioProps
39
40
  | ListItemSwitchProps;
40
41
 
42
+ const LIST_ITEM_CONTROLS = [
43
+ { component: Navigation, type: 'navigation' },
44
+ { component: Button, type: 'button' },
45
+ { component: IconButton, type: 'icon-button' },
46
+ { component: Checkbox, type: 'checkbox' },
47
+ { component: Radio, type: 'radio' },
48
+ { component: Switch, type: 'switch' },
49
+ ] as const;
50
+
41
51
  export type ListItemProps = {
42
52
  /** @default 'li' */
43
53
  as?: 'li' | 'div';
@@ -57,6 +67,8 @@ export type ListItemProps = {
57
67
  disabledPromptMessage?: ReactNode;
58
68
  /**
59
69
  * Highlights the list item as an action to be taken or already taken. <br />
70
+ * Only applies to fully interactive items. Pass a supported ListItem control directly
71
+ * to include spotlight styles in server-rendered markup.
60
72
  */
61
73
  spotlight?: 'active' | 'inactive';
62
74
  /**
@@ -128,10 +140,19 @@ export const ListItem = ({
128
140
  id,
129
141
  }: ListItemProps) => {
130
142
  const idPrefix = useId();
131
- const [controlProps, setControlProps] = useState<ListItemControlProps>({});
132
- const [controlType, setControlType] = useState<ListItemTypes>('non-interactive');
143
+ const [registeredControlProps, setControlProps] = useState<ListItemControlProps>({});
144
+ const [registeredControlType, setControlType] = useState<ListItemTypes>('non-interactive');
133
145
  const [mediaSize, setMediaSize] = useState<ListItemMediaSize | undefined>();
134
146
 
147
+ // Resolve supported controls during SSR; retain registration for wrapped controls.
148
+ const controlElement = isValidElement<ListItemControlProps>(control) ? control : undefined;
149
+ const directControlType = LIST_ITEM_CONTROLS.find(
150
+ ({ component }) => component === controlElement?.type,
151
+ )?.type;
152
+ const controlType = control ? (directControlType ?? registeredControlType) : 'non-interactive';
153
+ const controlProps =
154
+ directControlType && controlElement ? controlElement.props : registeredControlProps;
155
+
135
156
  const ids: ListItemContextData['ids'] = {
136
157
  title: `${idPrefix}_title`,
137
158
  ...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),
@@ -6,6 +6,7 @@ import { lorem500 } from '../../test-utils';
6
6
  import Field from '../../Field/Field';
7
7
  import Body from '../../Body';
8
8
  import MoneyInput from '../MoneyInput';
9
+ import { WithOverlaidAbsoluteElement } from '../../../.storybook/components/WithOverlaidAbsoluteElement';
9
10
 
10
11
  const meta = {
11
12
  title: 'Forms/MoneyInput/Tests',
@@ -243,3 +244,13 @@ export const DecimalsFormatParity: Story = {
243
244
  },
244
245
  },
245
246
  };
247
+
248
+ export const StackingContext: Story = {
249
+ render: (args) => (
250
+ <WithOverlaidAbsoluteElement>
251
+ <Field label="Overlaid element">
252
+ <MoneyInput {...args} />
253
+ </Field>
254
+ </WithOverlaidAbsoluteElement>
255
+ ),
256
+ };
@@ -0,0 +1,30 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+
3
+ import { WithOverlaidAbsoluteElement } from '../../../.storybook/components/WithOverlaidAbsoluteElement';
4
+ import Field from '../../Field/Field';
5
+ import PhoneNumberInput from '..';
6
+
7
+ const meta = {
8
+ component: PhoneNumberInput,
9
+ title: 'Forms/PhoneNumberInput/Tests',
10
+ tags: ['!autodocs', '!manifest'],
11
+ args: {
12
+ onChange: () => {},
13
+ },
14
+ } satisfies Meta<typeof PhoneNumberInput>;
15
+
16
+ export default meta;
17
+
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ export const StackingContext: Story = {
21
+ render: (args) => {
22
+ return (
23
+ <WithOverlaidAbsoluteElement>
24
+ <Field label="Phone number">
25
+ <PhoneNumberInput {...args} />
26
+ </Field>
27
+ </WithOverlaidAbsoluteElement>
28
+ );
29
+ },
30
+ };
@@ -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;
@@ -1,3 +1,5 @@
1
+ @import (reference) "../PrimitivePrompt/PrimitivePrompt.vars.less";
2
+
1
3
  .wds-action-prompt {
2
4
  --Prompt-padding-x: var(--size-16);
3
5
  --Prompt-padding-y: var(--size-16);
@@ -5,20 +7,33 @@
5
7
  --Prompt-gap: var(--size-10) var(--size-16);
6
8
  --Prompt-border-radius: var(--radius-large);
7
9
 
10
+ // Responsive to the prompt's own width rather than the viewport, so it adapts to narrow
11
+ // containers. Named so ancestor containers can't intercept the queries.
12
+ container: wds-action-prompt / inline-size;
13
+
8
14
  &--media-image {
9
15
  width: var(--size-48);
10
16
  height: var(--size-48);
11
17
  object-fit: contain;
12
18
  }
13
19
 
14
- @media (--screen-xs-max) {
20
+ @container wds-action-prompt (width < @wds-prompt-actions-full-width-max) {
21
+ .wds-prompt__actions-wrapper {
22
+ grid-column: span 2;
23
+ width: 100%;
24
+ }
25
+
26
+ .wds-prompt__content-wrapper--with-dismiss .wds-prompt__actions-wrapper {
27
+ grid-column: span 3;
28
+ }
29
+
15
30
  .wds-action-prompt__action {
16
31
  width: 100%;
17
32
  }
18
33
  }
19
34
 
20
35
  &--with-two-actions {
21
- @media (--screen-xs-max) {
36
+ @container wds-action-prompt (width < @wds-prompt-actions-full-width-max) {
22
37
  .wds-action-prompt__action {
23
38
  flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
24
39
  min-width: fit-content;