@transferwise/components 46.28.0 → 46.29.1

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 (112) hide show
  1. package/build/i18n/hu.json +1 -1
  2. package/build/index.js +141 -686
  3. package/build/index.js.map +1 -1
  4. package/build/index.mjs +144 -686
  5. package/build/index.mjs.map +1 -1
  6. package/build/main.css +16 -5
  7. package/build/styles/logo/Logo.css +16 -0
  8. package/build/styles/main.css +16 -5
  9. package/build/types/alert/Alert.d.ts.map +1 -1
  10. package/build/types/common/hooks/index.d.ts +0 -1
  11. package/build/types/dimmer/Dimmer.d.ts.map +1 -1
  12. package/build/types/flowNavigation/FlowNavigation.d.ts +3 -3
  13. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  14. package/build/types/index.d.ts +0 -1
  15. package/build/types/index.d.ts.map +1 -1
  16. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  17. package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
  18. package/build/types/inputs/_Popover.d.ts.map +1 -1
  19. package/build/types/loader/Loader.d.ts.map +1 -1
  20. package/build/types/logo/Logo.d.ts.map +1 -1
  21. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  22. package/build/types/popover/Popover.d.ts.map +1 -1
  23. package/build/types/segmentedControl/SegmentedControl.d.ts +2 -2
  24. package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
  25. package/build/types/select/Select.d.ts.map +1 -1
  26. package/build/types/stepper/deviceDetection.d.ts.map +1 -1
  27. package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
  28. package/package.json +10 -8
  29. package/src/accordion/Accordion.story.tsx +1 -1
  30. package/src/alert/Alert.tsx +2 -1
  31. package/src/avatar/colors/colors.ts +1 -1
  32. package/src/body/Body.spec.tsx +1 -1
  33. package/src/body/Body.story.tsx +8 -8
  34. package/src/checkbox/Checkbox.js +1 -1
  35. package/src/checkboxButton/CheckboxButton.spec.tsx +0 -1
  36. package/src/common/Option/Option.tsx +1 -1
  37. package/src/common/deviceDetection/deviceDetection.js +1 -1
  38. package/src/common/deviceDetection/deviceDetection.spec.js +4 -2
  39. package/src/common/hooks/index.js +0 -1
  40. package/src/common/responsivePanel/ResponsivePanel.spec.js +11 -15
  41. package/src/decision/Decision.spec.js +0 -2
  42. package/src/dimmer/Dimmer.tsx +6 -2
  43. package/src/flowNavigation/FlowNavigation.spec.js +7 -22
  44. package/src/flowNavigation/FlowNavigation.tsx +20 -33
  45. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +2 -2
  46. package/src/i18n/hu.json +1 -1
  47. package/src/index.ts +0 -1
  48. package/src/inlineAlert/InlineAlert.story.tsx +8 -7
  49. package/src/inputs/SelectInput.tsx +1 -0
  50. package/src/inputs/_BottomSheet.tsx +33 -28
  51. package/src/inputs/_Popover.tsx +23 -20
  52. package/src/link/Link.story.tsx +16 -16
  53. package/src/loader/Loader.tsx +0 -1
  54. package/src/logo/Logo.css +16 -0
  55. package/src/logo/Logo.js +4 -9
  56. package/src/logo/Logo.less +16 -0
  57. package/src/logo/__snapshots__/Logo.spec.js.snap +104 -8
  58. package/src/main.css +16 -5
  59. package/src/main.less +0 -1
  60. package/src/moneyInput/MoneyInput.story.tsx +3 -3
  61. package/src/nudge/Nudge.spec.tsx +5 -5
  62. package/src/phoneNumberInput/PhoneNumberInput.tsx +2 -1
  63. package/src/phoneNumberInput/utils/cleanNumber/cleanNumber.ts +1 -1
  64. package/src/popover/Popover.tsx +2 -1
  65. package/src/promoCard/PromoCard.tsx +1 -1
  66. package/src/provider/theme/ThemeProvider.story.tsx +21 -0
  67. package/src/radioGroup/RadioGroup.spec.js +1 -1
  68. package/src/section/Section.story.tsx +2 -1
  69. package/src/segmentedControl/SegmentedControl.spec.tsx +88 -2
  70. package/src/segmentedControl/SegmentedControl.story.tsx +54 -16
  71. package/src/segmentedControl/SegmentedControl.tsx +21 -33
  72. package/src/select/Select.js +2 -3
  73. package/src/stepper/deviceDetection.js +1 -2
  74. package/src/stepper/deviceDetection.spec.js +8 -3
  75. package/src/test-utils/index.js +1 -1
  76. package/src/test-utils/story-config.ts +1 -1
  77. package/src/title/Title.spec.tsx +1 -1
  78. package/src/typeahead/Typeahead.spec.js +4 -2
  79. package/src/upload/Upload.spec.js +8 -4
  80. package/src/uploadInput/uploadButton/UploadButton.tsx +1 -0
  81. package/build/styles/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +0 -5
  82. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts +0 -11
  83. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts.map +0 -1
  84. package/build/types/common/requirements.d.ts +0 -3
  85. package/build/types/common/requirements.d.ts.map +0 -1
  86. package/build/types/dynamicFieldDefinitionList/DynamicFieldDefinitionList.d.ts +0 -21
  87. package/build/types/dynamicFieldDefinitionList/DynamicFieldDefinitionList.d.ts.map +0 -1
  88. package/build/types/dynamicFieldDefinitionList/FormattedValue/FormattedValue.d.ts +0 -12
  89. package/build/types/dynamicFieldDefinitionList/FormattedValue/FormattedValue.d.ts.map +0 -1
  90. package/build/types/dynamicFieldDefinitionList/FormattedValue/index.d.ts +0 -2
  91. package/build/types/dynamicFieldDefinitionList/FormattedValue/index.d.ts.map +0 -1
  92. package/build/types/dynamicFieldDefinitionList/index.d.ts +0 -2
  93. package/build/types/dynamicFieldDefinitionList/index.d.ts.map +0 -1
  94. package/build/types/dynamicFieldDefinitionList/utils/createDefinitions.d.ts +0 -2
  95. package/build/types/dynamicFieldDefinitionList/utils/createDefinitions.d.ts.map +0 -1
  96. package/build/types/dynamicFieldDefinitionList/utils/text-format.d.ts +0 -2
  97. package/build/types/dynamicFieldDefinitionList/utils/text-format.d.ts.map +0 -1
  98. package/src/common/hooks/useClientWidth/useClientWidth.spec.js +0 -77
  99. package/src/common/hooks/useClientWidth/useClientWidth.tsx +0 -47
  100. package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.js +0 -41
  101. package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.spec.js +0 -21
  102. package/src/dynamicFieldDefinitionList/DynamicFieldDefinitionList.story.js +0 -134
  103. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.css +0 -5
  104. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.js +0 -73
  105. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.less +0 -4
  106. package/src/dynamicFieldDefinitionList/FormattedValue/FormattedValue.spec.js +0 -200
  107. package/src/dynamicFieldDefinitionList/FormattedValue/index.js +0 -1
  108. package/src/dynamicFieldDefinitionList/index.js +0 -1
  109. package/src/dynamicFieldDefinitionList/utils/createDefinitions.js +0 -33
  110. package/src/dynamicFieldDefinitionList/utils/createDefinitions.spec.js +0 -83
  111. package/src/dynamicFieldDefinitionList/utils/text-format.js +0 -46
  112. package/src/dynamicFieldDefinitionList/utils/text-format.spec.js +0 -43
@@ -8,7 +8,7 @@ exports[`Logo on mobile renders only fast flag 1`] = `
8
8
  role="img"
9
9
  >
10
10
  <svg
11
- class="np-logo-svg"
11
+ class="np-logo-svg np-logo-svg--size-sm"
12
12
  fill="none"
13
13
  height="24"
14
14
  width="26"
@@ -19,6 +19,18 @@ exports[`Logo on mobile renders only fast flag 1`] = `
19
19
  fill="#163300"
20
20
  />
21
21
  </svg>
22
+ <svg
23
+ class="np-logo-svg np-logo-svg--size-md"
24
+ fill="none"
25
+ height="24"
26
+ width="106"
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ >
29
+ <path
30
+ d="M58.738.359h6.498l-3.27 23.322h-6.498L58.739.359Zm-8.193 0L46.16 13.794 44.247.359h-4.545L33.96 13.754 33.243.36h-6.299l2.193 23.322h5.223l6.458-14.75 2.272 14.75h5.143L56.725.359h-6.18Zm54.558 13.555H89.674c.08 3.03 1.894 5.023 4.565 5.023 2.014 0 3.608-1.077 4.844-3.13l5.208 2.368C102.501 21.702 98.729 24 94.08 24c-6.339 0-10.545-4.266-10.545-11.123C83.535 5.342 88.478 0 95.455 0c6.14 0 10.007 4.146 10.007 10.605 0 1.076-.12 2.152-.359 3.309Zm-5.78-4.466c0-2.71-1.516-4.425-3.947-4.425-2.512 0-4.585 1.794-5.144 4.425h9.09ZM6.632 7.387 0 15.139h11.844l1.33-3.655H8.1l3.1-3.586.01-.095-2.016-3.471h9.072l-7.032 19.35h4.812L24.538.358H2.6l4.033 7.028Zm69.168-2.364c2.292 0 4.3 1.233 6.055 3.346l.921-6.575C81.143.688 78.93 0 76 0c-5.82 0-9.09 3.409-9.09 7.734 0 3 1.675 4.834 4.426 6.02l1.315.598c2.452 1.047 3.11 1.565 3.11 2.671 0 1.146-1.106 1.874-2.79 1.874-2.782.01-5.034-1.415-6.728-3.847l-.94 6.699C67.234 23.22 69.708 24 72.97 24c5.532 0 8.93-3.19 8.93-7.615 0-3.01-1.335-4.943-4.704-6.458l-1.435-.678c-1.994-.887-2.671-1.375-2.671-2.352 0-1.056.927-1.874 2.71-1.874Z"
31
+ fill="#163300"
32
+ />
33
+ </svg>
22
34
  </span>
23
35
  </div>
24
36
  `;
@@ -31,7 +43,19 @@ exports[`Logo renders wise business logo 1`] = `
31
43
  role="img"
32
44
  >
33
45
  <svg
34
- class="np-logo-svg"
46
+ class="np-logo-svg np-logo-svg--size-sm"
47
+ fill="none"
48
+ height="24"
49
+ width="26"
50
+ xmlns="http://www.w3.org/2000/svg"
51
+ >
52
+ <path
53
+ d="M6.826 7.232 0 15.21h12.188l1.37-3.762H8.335l3.191-3.69.01-.098L9.461 4.09h9.336L11.56 24h4.953L25.25 0H2.676l4.15 7.232Z"
54
+ fill="#163300"
55
+ />
56
+ </svg>
57
+ <svg
58
+ class="np-logo-svg np-logo-svg--size-md"
35
59
  fill="none"
36
60
  height="24"
37
61
  width="106"
@@ -54,7 +78,19 @@ exports[`Logo renders wise business logo inversed 1`] = `
54
78
  role="img"
55
79
  >
56
80
  <svg
57
- class="np-logo-svg"
81
+ class="np-logo-svg np-logo-svg--size-sm"
82
+ fill="none"
83
+ height="24"
84
+ width="26"
85
+ xmlns="http://www.w3.org/2000/svg"
86
+ >
87
+ <path
88
+ d="M6.826 7.232 0 15.21h12.188l1.37-3.762H8.335l3.191-3.69.01-.098L9.461 4.09h9.336L11.56 24h4.953L25.25 0H2.676l4.15 7.232Z"
89
+ fill="#9FE870"
90
+ />
91
+ </svg>
92
+ <svg
93
+ class="np-logo-svg np-logo-svg--size-md"
58
94
  fill="none"
59
95
  height="24"
60
96
  width="106"
@@ -77,7 +113,19 @@ exports[`Logo renders wise logo 1`] = `
77
113
  role="img"
78
114
  >
79
115
  <svg
80
- class="np-logo-svg"
116
+ class="np-logo-svg np-logo-svg--size-sm"
117
+ fill="none"
118
+ height="24"
119
+ width="26"
120
+ xmlns="http://www.w3.org/2000/svg"
121
+ >
122
+ <path
123
+ d="M6.826 7.232 0 15.21h12.188l1.37-3.762H8.335l3.191-3.69.01-.098L9.461 4.09h9.336L11.56 24h4.953L25.25 0H2.676l4.15 7.232Z"
124
+ fill="#163300"
125
+ />
126
+ </svg>
127
+ <svg
128
+ class="np-logo-svg np-logo-svg--size-md"
81
129
  fill="none"
82
130
  height="24"
83
131
  width="106"
@@ -100,7 +148,19 @@ exports[`Logo renders wise logo by default 1`] = `
100
148
  role="img"
101
149
  >
102
150
  <svg
103
- class="np-logo-svg"
151
+ class="np-logo-svg np-logo-svg--size-sm"
152
+ fill="none"
153
+ height="24"
154
+ width="26"
155
+ xmlns="http://www.w3.org/2000/svg"
156
+ >
157
+ <path
158
+ d="M6.826 7.232 0 15.21h12.188l1.37-3.762H8.335l3.191-3.69.01-.098L9.461 4.09h9.336L11.56 24h4.953L25.25 0H2.676l4.15 7.232Z"
159
+ fill="#163300"
160
+ />
161
+ </svg>
162
+ <svg
163
+ class="np-logo-svg np-logo-svg--size-md"
104
164
  fill="none"
105
165
  height="24"
106
166
  width="106"
@@ -123,7 +183,19 @@ exports[`Logo renders wise logo inversed 1`] = `
123
183
  role="img"
124
184
  >
125
185
  <svg
126
- class="np-logo-svg"
186
+ class="np-logo-svg np-logo-svg--size-sm"
187
+ fill="none"
188
+ height="24"
189
+ width="26"
190
+ xmlns="http://www.w3.org/2000/svg"
191
+ >
192
+ <path
193
+ d="M6.826 7.232 0 15.21h12.188l1.37-3.762H8.335l3.191-3.69.01-.098L9.461 4.09h9.336L11.56 24h4.953L25.25 0H2.676l4.15 7.232Z"
194
+ fill="#9FE870"
195
+ />
196
+ </svg>
197
+ <svg
198
+ class="np-logo-svg np-logo-svg--size-md"
127
199
  fill="none"
128
200
  height="24"
129
201
  width="106"
@@ -146,7 +218,19 @@ exports[`Logo renders wise platform logo 1`] = `
146
218
  role="img"
147
219
  >
148
220
  <svg
149
- class="np-logo-svg"
221
+ class="np-logo-svg np-logo-svg--size-sm"
222
+ fill="none"
223
+ height="18"
224
+ width="111"
225
+ xmlns="http://www.w3.org/2000/svg"
226
+ >
227
+ <path
228
+ d="M4.887 5.92 0 11.525h8.726l.98-2.642H5.969L8.252 6.29l.008-.068-1.486-2.508h6.683L8.276 17.7h3.546L18.079.84H1.916l2.97 5.08Zm17.114 11.8V.792h6.15c1.341 0 2.454.24 3.334.719.882.48 1.541 1.134 1.979 1.963.438.83.657 1.762.657 2.798s-.22 1.976-.662 2.806c-.44.829-1.104 1.485-1.988 1.967-.885.482-1.995.723-3.331.723h-4.23V9.603h3.994c.848 0 1.536-.144 2.064-.434.528-.29.914-.684 1.162-1.186.248-.501.37-1.07.37-1.71 0-.639-.122-1.206-.37-1.702-.248-.497-.636-.885-1.166-1.165-.531-.282-1.228-.422-2.093-.422h-3.268v14.735H22h.001ZM38.823.793v16.926h-2.518V.793h2.518ZM45.712 18c-.82 0-1.561-.15-2.224-.45a3.665 3.665 0 0 1-1.572-1.31c-.385-.573-.576-1.275-.576-2.107 0-.717.14-1.307.42-1.768.281-.462.661-.83 1.138-1.1a6.036 6.036 0 0 1 1.6-.612c.59-.139 1.19-.243 1.802-.314.775-.088 1.404-.16 1.887-.218.482-.058.834-.153 1.052-.286.22-.132.33-.347.33-.644v-.058c0-.72-.208-1.28-.62-1.678-.412-.396-1.025-.595-1.84-.595-.813 0-1.514.183-2 .55-.486.366-.822.772-1.007 1.218L41.736 8.1c.28-.772.692-1.395 1.234-1.873a5.034 5.034 0 0 1 1.874-1.041 7.562 7.562 0 0 1 2.232-.327c.516 0 1.065.06 1.647.178a4.949 4.949 0 0 1 1.634.65c.509.313.925.76 1.25 1.342.325.58.49 1.334.49 2.26v8.43h-2.46v-1.736h-.101c-.163.32-.408.634-.733.942-.326.309-.744.565-1.255.77-.512.204-1.123.305-1.836.305Zm.547-1.984c.696 0 1.294-.135 1.79-.405.497-.27.876-.623 1.138-1.062a2.71 2.71 0 0 0 .392-1.409v-1.637c-.09.089-.262.17-.518.244a7.313 7.313 0 0 1-.871.19c-.327.054-.644.1-.952.14l-.774.104c-.489.06-.933.162-1.336.306-.4.144-.722.348-.96.616-.239.267-.358.62-.358 1.062 0 .612.23 1.073.69 1.385.46.31 1.048.466 1.76.466ZM60.833 5.025V7.01h-7.067V5.025h7.067Zm-5.172-3.04h2.518v12.008c0 .48.074.838.22 1.078a1.1 1.1 0 0 0 .568.488c.233.086.487.128.763.128.201 0 .378-.014.53-.04l.354-.066.455 2.041a4.53 4.53 0 0 1-.624.17c-.27.058-.607.09-1.01.095a4.509 4.509 0 0 1-1.853-.347 3.166 3.166 0 0 1-1.39-1.124c-.355-.506-.531-1.143-.531-1.91V1.985Zm13.846 3.041V7.01h-7.312V5.026h7.312ZM64.2 17.72V3.555c0-.794.177-1.453.531-1.98.354-.525.823-.92 1.406-1.18a4.615 4.615 0 0 1 1.904-.393A6.072 6.072 0 0 1 70.14.34l-.59 2c-.117-.034-.27-.074-.454-.12a2.81 2.81 0 0 0-.674-.07c-.612 0-1.048.148-1.309.445-.26.297-.392.728-.392 1.29V17.72H64.2Zm12.182.257c-1.213 0-2.27-.273-3.175-.818-.904-.545-1.606-1.31-2.106-2.289-.5-.981-.75-2.127-.75-3.438 0-1.312.25-2.469.75-3.455.5-.986 1.202-1.753 2.106-2.298.904-.545 1.963-.818 3.175-.818 1.213 0 2.271.273 3.176.818.904.545 1.605 1.312 2.106 2.298.499.986.75 2.138.75 3.455 0 1.316-.251 2.457-.75 3.438-.5.981-1.202 1.744-2.106 2.289-.905.545-1.963.818-3.176.818Zm.008-2.075c.787 0 1.438-.203 1.954-.611.517-.41.9-.95 1.15-1.628.25-.678.374-1.425.374-2.24 0-.815-.124-1.555-.374-2.236-.25-.68-.633-1.227-1.15-1.64-.516-.415-1.167-.62-1.954-.62-.786 0-1.448.206-1.967.62-.519.412-.904.96-1.153 1.64a6.43 6.43 0 0 0-.375 2.236c0 .81.125 1.562.375 2.24.25.677.634 1.22 1.153 1.627.52.408 1.176.613 1.967.613Zm8.044 1.818V5.026h2.434v2.016h.135a3.098 3.098 0 0 1 1.25-1.617 3.618 3.618 0 0 1 2.034-.591 10.677 10.677 0 0 1 1.071.058v2.363a5.1 5.1 0 0 0-.538-.095 5.6 5.6 0 0 0-.775-.054c-.595 0-1.124.122-1.588.368-.464.245-.83.583-1.1 1.017-.27.432-.405.924-.405 1.475v7.752h-2.518v.002Zm8.589 0V5.025h2.418v2.067h.16c.27-.7.71-1.246 1.322-1.641.612-.394 1.345-.592 2.2-.592.854 0 1.59.198 2.177.596.587.396 1.021.942 1.302 1.637h.135c.309-.678.8-1.22 1.474-1.624.674-.405 1.477-.607 2.409-.607 1.174 0 2.132.361 2.876 1.082.744.722 1.117 1.81 1.117 3.265v8.512h-2.519V9.44c0-.86-.239-1.483-.716-1.869-.477-.386-1.047-.578-1.71-.578-.82 0-1.457.246-1.912.739-.455.492-.683 1.125-.683 1.896v8.092h-2.509V9.283c0-.69-.219-1.243-.657-1.662-.437-.419-1.007-.627-1.71-.627-.477 0-.917.122-1.318.368a2.74 2.74 0 0 0-.969 1.02c-.243.435-.365.94-.365 1.513v7.826h-2.519l-.003-.001Z"
229
+ fill="#163300"
230
+ />
231
+ </svg>
232
+ <svg
233
+ class="np-logo-svg np-logo-svg--size-md"
150
234
  fill="none"
151
235
  height="18"
152
236
  width="172"
@@ -169,7 +253,19 @@ exports[`Logo renders wise platform logo inversed 1`] = `
169
253
  role="img"
170
254
  >
171
255
  <svg
172
- class="np-logo-svg"
256
+ class="np-logo-svg np-logo-svg--size-sm"
257
+ fill="none"
258
+ height="18"
259
+ width="111"
260
+ xmlns="http://www.w3.org/2000/svg"
261
+ >
262
+ <path
263
+ d="M4.887 5.918 0 11.523h8.726l.98-2.642H5.969l2.284-2.593.008-.068-1.486-2.508h6.683L8.276 17.699h3.546L18.079.838H1.916l2.97 5.08Zm17.114 11.799V.791h6.15c1.341 0 2.454.24 3.334.719.882.48 1.541 1.134 1.979 1.963.438.83.657 1.762.657 2.798s-.22 1.976-.662 2.806c-.44.83-1.104 1.485-1.988 1.967-.885.482-1.995.723-3.331.723h-4.23V9.6h3.994c.848 0 1.536-.144 2.064-.434.528-.29.914-.684 1.162-1.186.248-.501.37-1.07.37-1.71 0-.639-.122-1.206-.37-1.702-.248-.497-.636-.885-1.166-1.165-.531-.282-1.228-.422-2.093-.422h-3.268v14.735H22h.001ZM38.823.791v16.926h-2.518V.791h2.518Zm6.889 17.207c-.82 0-1.561-.15-2.224-.45a3.665 3.665 0 0 1-1.572-1.31c-.385-.573-.576-1.275-.576-2.107 0-.716.14-1.307.42-1.768.281-.462.661-.83 1.138-1.1a6.036 6.036 0 0 1 1.6-.612c.59-.139 1.19-.243 1.802-.313.775-.09 1.404-.161 1.887-.22.482-.057.834-.152 1.052-.285.22-.132.33-.347.33-.644v-.058c0-.72-.208-1.28-.62-1.678-.412-.396-1.025-.595-1.84-.595-.813 0-1.514.183-2 .55-.486.366-.822.772-1.007 1.218l-2.366-.528c.28-.772.692-1.395 1.234-1.872a5.034 5.034 0 0 1 1.874-1.042 7.562 7.562 0 0 1 2.232-.327c.516 0 1.065.06 1.647.178a4.949 4.949 0 0 1 1.634.65c.509.313.925.76 1.25 1.342.325.58.49 1.334.49 2.26v8.43h-2.46V15.98h-.101c-.163.32-.408.634-.733.942-.326.309-.744.565-1.255.77-.512.204-1.123.305-1.836.305Zm.547-1.984c.696 0 1.294-.135 1.79-.405.497-.27.876-.623 1.138-1.062a2.71 2.71 0 0 0 .392-1.409v-1.637c-.09.089-.262.17-.518.245a7.313 7.313 0 0 1-.871.19 33.88 33.88 0 0 1-.952.14l-.774.103c-.489.06-.933.162-1.336.306-.4.144-.722.348-.96.616-.239.267-.358.62-.358 1.062 0 .612.23 1.073.69 1.385.46.31 1.048.466 1.76.466ZM60.833 5.023v1.984h-7.067V5.023h7.067Zm-5.172-3.04h2.518V13.99c0 .48.074.838.22 1.078a1.1 1.1 0 0 0 .568.488c.233.086.487.128.763.128.201 0 .378-.014.53-.04l.354-.066.455 2.041a4.518 4.518 0 0 1-.624.17c-.27.058-.607.09-1.01.095a4.509 4.509 0 0 1-1.853-.347 3.165 3.165 0 0 1-1.39-1.124c-.355-.506-.531-1.143-.531-1.91V1.983Zm13.846 3.041v1.984h-7.312V5.024h7.312ZM64.2 17.718V3.553c0-.794.177-1.453.531-1.98.354-.525.823-.92 1.406-1.18A4.615 4.615 0 0 1 68.041 0a6.072 6.072 0 0 1 2.098.338l-.59 2c-.117-.034-.27-.074-.454-.12a2.81 2.81 0 0 0-.674-.07c-.612 0-1.048.148-1.309.445-.26.297-.392.728-.392 1.29v13.835H64.2Zm12.182.257c-1.213 0-2.27-.273-3.175-.818-.904-.545-1.606-1.31-2.106-2.289-.5-.981-.75-2.127-.75-3.438 0-1.312.25-2.469.75-3.455.5-.986 1.202-1.753 2.106-2.298.904-.545 1.963-.818 3.175-.818 1.213 0 2.271.273 3.176.818.904.545 1.605 1.312 2.106 2.298.499.986.75 2.138.75 3.455 0 1.316-.251 2.457-.75 3.438-.5.981-1.202 1.744-2.106 2.289-.905.545-1.963.818-3.176.818Zm.008-2.074c.787 0 1.438-.204 1.954-.612.517-.41.9-.95 1.15-1.628.25-.678.374-1.425.374-2.24 0-.815-.124-1.555-.374-2.236-.25-.68-.633-1.227-1.15-1.64-.516-.415-1.167-.62-1.954-.62-.786 0-1.448.206-1.967.62-.519.412-.904.96-1.153 1.64a6.43 6.43 0 0 0-.375 2.236c0 .81.125 1.562.375 2.24.25.677.634 1.22 1.153 1.628.52.407 1.176.612 1.967.612Zm8.044 1.817V5.024h2.434V7.04h.135a3.098 3.098 0 0 1 1.25-1.617 3.619 3.619 0 0 1 2.034-.591 10.666 10.666 0 0 1 1.071.058v2.363a5.1 5.1 0 0 0-.538-.095 5.6 5.6 0 0 0-.775-.054c-.595 0-1.124.122-1.588.368-.464.245-.83.584-1.1 1.017-.27.432-.405.924-.405 1.475v7.752h-2.518v.002Zm8.589 0V5.023h2.418V7.09h.16c.27-.7.71-1.246 1.322-1.641.612-.394 1.345-.592 2.2-.592.854 0 1.59.198 2.177.596.587.396 1.021.942 1.302 1.637h.135c.309-.678.8-1.22 1.474-1.624.674-.405 1.477-.607 2.409-.607 1.174 0 2.132.361 2.876 1.082.744.722 1.117 1.81 1.117 3.265v8.512h-2.519v-8.28c0-.86-.239-1.483-.716-1.869-.477-.386-1.047-.578-1.71-.578-.82 0-1.457.246-1.912.739-.455.492-.683 1.125-.683 1.896v8.092h-2.509V9.281c0-.69-.219-1.242-.657-1.662-.437-.419-1.007-.627-1.71-.627-.477 0-.917.122-1.318.368a2.74 2.74 0 0 0-.969 1.02c-.243.435-.365.94-.365 1.513v7.826h-2.522Z"
264
+ fill="#fff"
265
+ />
266
+ </svg>
267
+ <svg
268
+ class="np-logo-svg np-logo-svg--size-md"
173
269
  fill="none"
174
270
  height="18"
175
271
  width="172"
package/src/main.css CHANGED
@@ -1857,11 +1857,6 @@ button.np-option {
1857
1857
  transition: opacity 150ms ease-in, height 150ms ease-in 150ms;
1858
1858
  opacity: 0;
1859
1859
  }
1860
- .formatted-value__h3-custom-alignment {
1861
- margin-bottom: 16px;
1862
- margin-bottom: var(--size-16);
1863
- line-height: 24px;
1864
- }
1865
1860
  .emphasis {
1866
1861
  font-weight: 600;
1867
1862
  font-weight: var(--font-weight-semi-bold);
@@ -3028,6 +3023,22 @@ a {
3028
3023
  .np-theme-personal--dark .np-logo-svg path {
3029
3024
  fill: var(--color-white);
3030
3025
  }
3026
+ .np-logo-svg--size-sm {
3027
+ display: block;
3028
+ }
3029
+ @media (min-width: 576px) {
3030
+ .np-logo-svg--size-sm {
3031
+ display: none;
3032
+ }
3033
+ }
3034
+ .np-logo-svg--size-md {
3035
+ display: none;
3036
+ }
3037
+ @media (min-width: 576px) {
3038
+ .np-logo-svg--size-md {
3039
+ display: block;
3040
+ }
3041
+ }
3031
3042
  .tw-modal--scrollable {
3032
3043
  max-height: 100%;
3033
3044
  /* mobile viewport bug fix */
package/src/main.less CHANGED
@@ -22,7 +22,6 @@
22
22
  @import "./dimmer/Dimmer.less";
23
23
  @import "./drawer/Drawer.less";
24
24
  @import "./dropFade/DropFade.less";
25
- @import "./dynamicFieldDefinitionList/FormattedValue/FormattedValue.less";
26
25
  @import "./emphasis/Emphasis.less";
27
26
  @import "./flowNavigation/animatedLabel/AnimatedLabel.less";
28
27
  @import "./flowNavigation/backButton/BackButton.less";
@@ -16,7 +16,7 @@ export default {
16
16
 
17
17
  return (
18
18
  <>
19
- <label htmlFor={args.id as string}>Editable money input label</label>
19
+ <label htmlFor={args.id}>Editable money input label</label>
20
20
  <MoneyInput
21
21
  {...args}
22
22
  selectedCurrency={selectedCurrency}
@@ -160,13 +160,13 @@ export const SmallInput: Story = {
160
160
  render: (args) => {
161
161
  return (
162
162
  <>
163
- <label htmlFor={args.id as string}>Money inputs</label>
163
+ <label htmlFor={args.id}>Money inputs</label>
164
164
  <MoneyInput {...args} {...SingleCurrency.args} />
165
165
  <br />
166
166
  <MoneyInput {...args} {...MultipleCurrencies.args} />
167
167
  <hr />
168
168
  <div className="has-error">
169
- <label htmlFor={args.id as string}>Error states</label>
169
+ <label htmlFor={args.id}>Error states</label>
170
170
  <MoneyInput {...args} {...SingleCurrency.args} />
171
171
  <br />
172
172
  <MoneyInput {...args} {...MultipleCurrencies.args} />
@@ -51,14 +51,14 @@ describe('Nudge', () => {
51
51
  });
52
52
 
53
53
  it('does NOT render a nudge if localStorage has been set with the id of the nudge', () => {
54
- jest.spyOn(window.localStorage.__proto__, 'getItem').mockReturnValue('["CAKE","TEST"]');
54
+ jest.spyOn(Storage.prototype, 'getItem').mockReturnValue('["CAKE","TEST"]');
55
55
 
56
56
  render(<Nudge {...defaultProps} id="TEST" persistDismissal />);
57
57
  expect(screen.queryByText('A nudge title')).not.toBeInTheDocument();
58
58
  });
59
59
 
60
60
  it('does NOT render a nudge if localStorage has been set with the id of the nudge AND calls is previously dismissed with TRUE', () => {
61
- jest.spyOn(window.localStorage.__proto__, 'getItem').mockReturnValue('["CAKE","TEST"]');
61
+ jest.spyOn(Storage.prototype, 'getItem').mockReturnValue('["CAKE","TEST"]');
62
62
  const isPreviouslyDismissed = jest.fn();
63
63
 
64
64
  render(
@@ -75,7 +75,7 @@ describe('Nudge', () => {
75
75
  });
76
76
 
77
77
  it('shows a nudge if localStorage has been set with a different id for a different nudge and calls is previously dismissed with FALSE', () => {
78
- jest.spyOn(window.localStorage.__proto__, 'getItem').mockReturnValue('["BANANA"]');
78
+ jest.spyOn(Storage.prototype, 'getItem').mockReturnValue('["BANANA"]');
79
79
  const isPreviouslyDismissed = jest.fn();
80
80
 
81
81
  render(
@@ -92,8 +92,8 @@ describe('Nudge', () => {
92
92
  });
93
93
 
94
94
  it('calls local storage with updated dismissed nudges value', () => {
95
- jest.spyOn(window.localStorage.__proto__, 'getItem').mockReturnValue('["BANANA"]');
96
- const setItem = jest.spyOn(window.localStorage.__proto__, 'setItem');
95
+ jest.spyOn(Storage.prototype, 'getItem').mockReturnValue('["BANANA"]');
96
+ const setItem = jest.spyOn(Storage.prototype, 'setItem');
97
97
 
98
98
  render(<Nudge {...defaultProps} id="TEST" persistDismissal />);
99
99
  expect(screen.getByText('A nudge title')).toBeInTheDocument();
@@ -110,7 +110,8 @@ const PhoneNumberInput = ({
110
110
 
111
111
  useEffect(() => {
112
112
  if (broadcastedValue === null) {
113
- return setBroadcastedValue(internalValue);
113
+ setBroadcastedValue(internalValue);
114
+ return;
114
115
  }
115
116
 
116
117
  const internalPhoneNumber = `${internalValue.prefix ?? ''}${internalValue.suffix}`;
@@ -1,3 +1,3 @@
1
- const DIGITS_MATCH = /^$|^(\+)|([\d]+)/g;
1
+ const DIGITS_MATCH = /^$|^(\+)|(\d+)/g;
2
2
 
3
3
  export const cleanNumber = (number: string) => number.match(DIGITS_MATCH)?.join('') ?? '';
@@ -38,8 +38,9 @@ function resolvePlacement(preferredPlacement: PopoverPreferredPlacement) {
38
38
  case 'bottom-left':
39
39
  case 'bottom-right':
40
40
  return 'bottom';
41
+ default:
42
+ return preferredPlacement;
41
43
  }
42
- return preferredPlacement;
43
44
  }
44
45
 
45
46
  export default function Popover({
@@ -298,7 +298,7 @@ const PromoCard: FunctionComponent<PromoCardProps> = forwardRef(
298
298
  ...commonProps,
299
299
  'aria-checked':
300
300
  type === 'radio' ? value === state : type === 'checkbox' ? checked : undefined,
301
- 'aria-describedby': `${componentId}-title` || undefined,
301
+ 'aria-describedby': `${componentId}-title`,
302
302
  'aria-disabled': isDisabled,
303
303
  'data-value': value ?? undefined,
304
304
  role: type === 'checkbox' || type === 'radio' ? type : undefined,
@@ -0,0 +1,21 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { ThemeProvider } from '@wise/components-theming';
3
+
4
+ import Button from '../../button';
5
+
6
+ export default {
7
+ component: ThemeProvider,
8
+ title: 'Other/ThemeProvider',
9
+ } satisfies Meta<typeof ThemeProvider>;
10
+
11
+ type Story = StoryObj<typeof ThemeProvider>;
12
+
13
+ export const PlatformTheme: Story = {
14
+ render: () => (
15
+ <>
16
+ <ThemeProvider theme="platform">
17
+ <Button>Button</Button>
18
+ </ThemeProvider>
19
+ </>
20
+ ),
21
+ };
@@ -34,7 +34,7 @@ const RADIOS = [
34
34
 
35
35
  describe('RadioGroup', () => {
36
36
  it('renders null if no radios are provided', () => {
37
- expect(shallow(<RadioGroup radios={[]} {...props} />).toBeNully);
37
+ expect(shallow(<RadioGroup radios={[]} {...props} />).isEmptyRender()).toBe(true);
38
38
  });
39
39
 
40
40
  it('renders radio options', () => {
@@ -74,7 +74,8 @@ export const WithCards = () => {
74
74
 
75
75
  const handleOnCardClick = (index: number) => {
76
76
  if (expandedCardIndex === index) {
77
- return setExpandedCardIndex(null);
77
+ setExpandedCardIndex(null);
78
+ return;
78
79
  }
79
80
  setExpandedCardIndex(index);
80
81
  };
@@ -1,5 +1,7 @@
1
1
  import '@testing-library/jest-dom';
2
- import { render, screen, userEvent } from '../test-utils';
2
+ import React from 'react';
3
+
4
+ import { render, screen, userEvent, waitFor } from '../test-utils';
3
5
 
4
6
  import SegmentedControl, { SegmentedControlProps } from './SegmentedControl';
5
7
 
@@ -30,7 +32,7 @@ const onChange = jest.fn();
30
32
 
31
33
  const defaultProps: SegmentedControlProps = {
32
34
  name: 'segmentedControl',
33
- defaultValue: defaultSegments[0].value,
35
+ value: defaultSegments[0].value,
34
36
  mode: 'input',
35
37
  segments: defaultSegments,
36
38
  onChange,
@@ -86,6 +88,90 @@ describe('SegmentedControl', () => {
86
88
  expect(onChange).toHaveBeenCalledWith('reporting');
87
89
  });
88
90
 
91
+ it('does not call onChange on mount', async () => {
92
+ let onChangeCallCount = 0;
93
+
94
+ const ParentComponent = () => {
95
+ const [_, simulateRerender] = React.useState({});
96
+
97
+ // new function is created on every render
98
+ const onChange = () => {
99
+ onChangeCallCount += 1;
100
+ simulateRerender({});
101
+ };
102
+
103
+ return <SegmentedControl {...defaultProps} onChange={onChange} />;
104
+ };
105
+
106
+ render(<ParentComponent />);
107
+
108
+ await waitFor(() => {
109
+ expect(onChangeCallCount).toBe(0);
110
+ });
111
+ });
112
+
113
+ it('does not repeatedly call the onChange when the provided onChange prop changes on every render of its parent component', async () => {
114
+ let onChangeCallCount = 0;
115
+
116
+ const ParentComponent = () => {
117
+ const [_, simulateRerender] = React.useState({});
118
+
119
+ // a new onChange function is created on every render
120
+ const onChange = () => {
121
+ onChangeCallCount += 1;
122
+ simulateRerender({});
123
+ };
124
+
125
+ return <SegmentedControl {...defaultProps} onChange={onChange} />;
126
+ };
127
+
128
+ const { rerender } = render(<ParentComponent />);
129
+
130
+ rerender(<ParentComponent />);
131
+
132
+ await waitFor(() => {
133
+ expect(onChangeCallCount).toBe(0);
134
+ });
135
+ });
136
+
137
+ it('updates the selected segment when the selectedValue prop changes', () => {
138
+ const { rerender } = render(<SegmentedControl {...defaultProps} />);
139
+
140
+ const payroll = screen.getByRole('radio', { name: 'Payroll' });
141
+ userEvent.click(payroll);
142
+
143
+ expect(onChange).toHaveBeenCalledWith('payroll');
144
+
145
+ rerender(<SegmentedControl {...defaultProps} value="reporting" />);
146
+
147
+ const reporting = screen.getByRole('radio', { name: 'Reporting' });
148
+ expect(reporting).toBeChecked();
149
+ });
150
+
151
+ it('updates the options when the segments prop changes', () => {
152
+ const { rerender } = render(<SegmentedControl {...defaultProps} />);
153
+
154
+ const newSegments = [
155
+ {
156
+ id: '1',
157
+ value: 'payroll',
158
+ label: 'Payroll',
159
+ },
160
+ {
161
+ id: '3',
162
+ value: 'anotherOne',
163
+ label: 'Another One',
164
+ },
165
+ ];
166
+
167
+ rerender(<SegmentedControl {...defaultProps} segments={newSegments} />);
168
+
169
+ const anotherOne = screen.getByRole('radio', { name: 'Another One' });
170
+ userEvent.click(anotherOne);
171
+
172
+ expect(onChange).toHaveBeenCalledWith('anotherOne');
173
+ });
174
+
89
175
  it('throws error if user tries to add too many segments', () => {
90
176
  expect(() => {
91
177
  renderSegmentedControl({
@@ -1,40 +1,78 @@
1
1
  import { StoryFn } from '@storybook/react';
2
2
  import React from 'react';
3
3
 
4
- import SegmentedControl, { Segments } from './SegmentedControl';
4
+ import Button from '../button';
5
+
6
+ import SegmentedControl from './SegmentedControl';
5
7
 
6
8
  export default {
7
9
  component: SegmentedControl,
8
10
  title: 'Forms/SegmentedControl',
9
11
  };
10
12
 
11
- const segments: Segments = [
12
- { id: 'CUPCAKE', label: 'Cupcakes', value: 'cupcakes' },
13
- { id: 'SPONGECAKE', label: 'Sponge cake', value: 'spongecake' },
14
- { id: 'CARROT_CAKE', label: 'Carrot cake', value: 'carrotcake' },
15
- ];
13
+ const Template: StoryFn = (args) => {
14
+ const [segments, setSegments] = React.useState([
15
+ { id: 'CUPCAKE', label: 'Cupcakes', value: 'cupcakes' },
16
+ { id: 'SPONGECAKE', label: 'Sponge cake', value: 'spongecake' },
17
+ { id: 'CARROT_CAKE', label: 'Carrot cake', value: 'carrotcake' },
18
+ ]);
16
19
 
17
- const segmentsWithControls: Segments = [
18
- { id: 'CUPCAKE', label: 'Cupcakes', value: 'cupcakes', controls: 'aControlId' },
19
- { id: 'SPONGECAKE', label: 'Sponge cake', value: 'spongecake', controls: 'aControlId' },
20
- { id: 'CARROT_CAKE', label: 'Carrot cake', value: 'carrotcake', controls: 'aControlId' },
21
- ];
20
+ const [segmentsWithControls, setSegmentsWithControls] = React.useState([
21
+ { id: 'CUPCAKE', label: 'Cupcakes', value: 'cupcakes', controls: 'aControlId' },
22
+ { id: 'SPONGECAKE', label: 'Sponge cake', value: 'spongecake', controls: 'aControlId' },
23
+ { id: 'CARROT_CAKE', label: 'Carrot cake', value: 'carrotcake', controls: 'aControlId' },
24
+ ]);
22
25
 
23
- const Template: StoryFn = (args) => {
24
- const [selectedValue, setSelectedValue] = React.useState(segments[0].value);
26
+ const [value, setValue] = React.useState(segments[0].value);
25
27
 
28
+ console.log('render: segments.length', segments.length);
26
29
  return (
27
30
  <div className="p-a-2">
28
31
  <SegmentedControl
29
32
  name="aSegmentedControl"
30
- defaultValue={selectedValue}
31
- onChange={setSelectedValue}
33
+ value={value}
34
+ onChange={setValue}
32
35
  {...(args.mode === 'view'
33
36
  ? { segments: segmentsWithControls, mode: 'view', controls: 'aControlId' }
34
37
  : { segments, mode: 'input' })}
35
38
  />
36
39
  <div className="m-a-2" id="aControlId">
37
- <p>Selected value: {selectedValue}</p>
40
+ <p>Selected value: {value}</p>
41
+ </div>
42
+ <div className="m-a-2">
43
+ <p>
44
+ Force the <b>selectedValue</b> to be one of the following:
45
+ <ul>
46
+ {segments.map((segment) => (
47
+ <li key={segment.id}>
48
+ <a
49
+ href="/"
50
+ onClick={(e) => {
51
+ e.preventDefault();
52
+ setValue(segment.value);
53
+ }}
54
+ >
55
+ {segment.label}
56
+ </a>
57
+ </li>
58
+ ))}
59
+ </ul>
60
+ </p>
61
+ </div>
62
+ <div className="m-a-2">
63
+ <Button
64
+ priority="secondary"
65
+ type="danger"
66
+ size="sm"
67
+ disabled={segments.length < 2}
68
+ onClick={() => {
69
+ const index = segments.findIndex((s) => s.value !== value);
70
+ setSegments((prev) => prev.filter((_, i) => i !== index));
71
+ setSegmentsWithControls((prev) => prev.filter((_, i) => i !== index));
72
+ }}
73
+ >
74
+ Remove one segment
75
+ </Button>
38
76
  </div>
39
77
  </div>
40
78
  );