@transferwise/components 46.29.0 → 46.29.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 (96) hide show
  1. package/build/i18n/hu.json +1 -1
  2. package/build/index.js +4494 -4489
  3. package/build/index.js.map +1 -1
  4. package/build/index.mjs +4713 -4707
  5. package/build/index.mjs.map +1 -1
  6. package/build/mocks.js.map +1 -1
  7. package/build/mocks.mjs.map +1 -1
  8. package/build/types/common/DOMOperations/DOMOperations.d.ts +10 -2
  9. package/build/types/common/DOMOperations/DOMOperations.d.ts.map +1 -1
  10. package/build/types/common/DOMOperations/index.d.ts +1 -3
  11. package/build/types/common/DOMOperations/index.d.ts.map +1 -1
  12. package/build/types/common/bottomSheet/BottomSheet.d.ts +2 -2
  13. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  14. package/build/types/common/bottomSheet/index.d.ts +2 -1
  15. package/build/types/common/bottomSheet/index.d.ts.map +1 -1
  16. package/build/types/common/closeButton/CloseButton.messages.d.ts +7 -7
  17. package/build/types/common/closeButton/CloseButton.messages.d.ts.map +1 -1
  18. package/build/types/common/closeButton/index.d.ts +0 -1
  19. package/build/types/common/closeButton/index.d.ts.map +1 -1
  20. package/build/types/common/deviceDetection/deviceDetection.d.ts +1 -1
  21. package/build/types/common/deviceDetection/deviceDetection.d.ts.map +1 -1
  22. package/build/types/common/deviceDetection/index.d.ts +1 -1
  23. package/build/types/common/deviceDetection/index.d.ts.map +1 -1
  24. package/build/types/common/domHelpers/documentIosClick.d.ts +7 -2
  25. package/build/types/common/domHelpers/documentIosClick.d.ts.map +1 -1
  26. package/build/types/common/domHelpers/index.d.ts +1 -6
  27. package/build/types/common/domHelpers/index.d.ts.map +1 -1
  28. package/build/types/common/flowHeader/index.d.ts +2 -0
  29. package/build/types/common/flowHeader/index.d.ts.map +1 -0
  30. package/build/types/common/focusBoundary/index.d.ts +1 -1
  31. package/build/types/common/focusBoundary/index.d.ts.map +1 -1
  32. package/build/types/common/historyNavigator/historyNavigator.d.ts +8 -8
  33. package/build/types/common/historyNavigator/historyNavigator.d.ts.map +1 -1
  34. package/build/types/common/historyNavigator/index.d.ts +1 -1
  35. package/build/types/common/historyNavigator/index.d.ts.map +1 -1
  36. package/build/types/common/hooks/index.d.ts +0 -1
  37. package/build/types/common/panel/Panel.d.ts +1 -1
  38. package/build/types/common/panel/Panel.d.ts.map +1 -1
  39. package/build/types/common/panel/index.d.ts +1 -1
  40. package/build/types/common/panel/index.d.ts.map +1 -1
  41. package/build/types/dimmer/Dimmer.d.ts +1 -1
  42. package/build/types/dimmer/Dimmer.d.ts.map +1 -1
  43. package/build/types/dimmer/index.d.ts +2 -1
  44. package/build/types/dimmer/index.d.ts.map +1 -1
  45. package/build/types/flowNavigation/FlowNavigation.d.ts +3 -3
  46. package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
  47. package/build/types/index.d.ts +42 -41
  48. package/build/types/index.d.ts.map +1 -1
  49. package/package.json +61 -60
  50. package/src/common/DOMOperations/index.ts +1 -0
  51. package/src/common/bottomSheet/BottomSheet.tsx +6 -3
  52. package/src/common/bottomSheet/index.ts +2 -0
  53. package/src/common/closeButton/{CloseButton.spec.js → CloseButton.spec.tsx} +1 -0
  54. package/src/common/closeButton/index.ts +0 -1
  55. package/src/common/deviceDetection/{deviceDetection.spec.js → deviceDetection.spec.ts} +1 -1
  56. package/src/common/deviceDetection/deviceDetection.ts +7 -0
  57. package/src/common/domHelpers/{documentIosClick.spec.js → documentIosClick.spec.ts} +7 -13
  58. package/src/common/domHelpers/{documentIosClick.js → documentIosClick.ts} +23 -0
  59. package/src/common/domHelpers/index.ts +4 -23
  60. package/src/common/flowHeader/{FlowHeader.spec.js → FlowHeader.spec.tsx} +2 -1
  61. package/src/common/flowHeader/index.ts +1 -0
  62. package/src/common/historyNavigator/{historyNavigator.js → historyNavigator.ts} +9 -5
  63. package/src/common/hooks/index.js +0 -1
  64. package/src/common/panel/{Panel.spec.js → Panel.spec.tsx} +14 -9
  65. package/src/common/panel/Panel.tsx +3 -3
  66. package/src/common/responsivePanel/ResponsivePanel.tsx +1 -1
  67. package/src/decision/Decision.spec.js +0 -1
  68. package/src/dimmer/Dimmer.tsx +1 -1
  69. package/src/dimmer/index.ts +2 -0
  70. package/src/flowNavigation/FlowNavigation.spec.js +7 -22
  71. package/src/flowNavigation/FlowNavigation.tsx +20 -34
  72. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +2 -2
  73. package/src/i18n/hu.json +1 -1
  74. package/src/index.ts +68 -66
  75. package/src/overlayHeader/OverlayHeader.js +1 -1
  76. package/src/provider/theme/ThemeProvider.story.tsx +21 -0
  77. package/src/withDisplayFormat/WithDisplayFormat.tsx +2 -2
  78. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts +0 -11
  79. package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts.map +0 -1
  80. package/src/common/DOMOperations/index.js +0 -3
  81. package/src/common/bottomSheet/index.js +0 -1
  82. package/src/common/deviceDetection/deviceDetection.js +0 -7
  83. package/src/common/hooks/useClientWidth/useClientWidth.spec.js +0 -77
  84. package/src/common/hooks/useClientWidth/useClientWidth.tsx +0 -47
  85. package/src/dimmer/index.js +0 -1
  86. /package/src/common/DOMOperations/{DOMOperations.spec.js → DOMOperations.spec.tsx} +0 -0
  87. /package/src/common/DOMOperations/{DOMOperations.js → DOMOperations.ts} +0 -0
  88. /package/src/common/closeButton/{CloseButton.messages.js → CloseButton.messages.ts} +0 -0
  89. /package/src/common/closeButton/__snapshots__/{CloseButton.spec.js.snap → CloseButton.spec.tsx.snap} +0 -0
  90. /package/src/common/deviceDetection/{index.js → index.ts} +0 -0
  91. /package/src/common/flowHeader/__snapshots__/{FlowHeader.spec.js.snap → FlowHeader.spec.tsx.snap} +0 -0
  92. /package/src/common/focusBoundary/{index.js → index.ts} +0 -0
  93. /package/src/common/historyNavigator/{historyNavigator.spec.js → historyNavigator.spec.ts} +0 -0
  94. /package/src/common/historyNavigator/{index.js → index.ts} +0 -0
  95. /package/src/common/panel/__snapshots__/{Panel.spec.js.snap → Panel.spec.tsx.snap} +0 -0
  96. /package/src/common/panel/{index.js → index.ts} +0 -0
@@ -1,15 +1,13 @@
1
1
  import classNames from 'classnames';
2
- import { useRef } from 'react';
3
- import React from 'react';
4
2
  import { useIntl } from 'react-intl';
5
3
 
6
4
  import { Breakpoint, Layout } from '../common';
7
5
  import { CloseButton } from '../common/closeButton';
8
6
  import FlowHeader from '../common/flowHeader/FlowHeader';
9
- import { useClientWidth } from '../common/hooks';
10
7
  import Logo from '../logo';
11
- import Stepper, { Step } from '../stepper/Stepper';
8
+ import Stepper, { type Step } from '../stepper/Stepper';
12
9
 
10
+ import { useScreenSize } from '../common/hooks/useScreenSize';
13
11
  import messages from './FlowNavigation.messages';
14
12
  import AnimatedLabel from './animatedLabel';
15
13
  import BackButton from './backButton';
@@ -36,13 +34,12 @@ const FlowNavigation = ({
36
34
  onGoBack,
37
35
  steps,
38
36
  }: FlowNavigationProps) => {
39
- const reference = useRef<HTMLDivElement>(null);
40
37
  const intl = useIntl();
41
38
 
42
- const [clientWidth] = useClientWidth({ ref: reference });
43
39
  const closeButton = onClose != null && <CloseButton size="lg" onClick={onClose} />;
44
- const isSmall = clientWidth != null && clientWidth < Breakpoint.SMALL;
45
- const isLarge = clientWidth != null && clientWidth >= Breakpoint.LARGE;
40
+
41
+ const screenSm = useScreenSize(Breakpoint.SMALL);
42
+ const screenLg = useScreenSize(Breakpoint.LARGE);
46
43
 
47
44
  const newAvatar = done ? null : avatar;
48
45
 
@@ -50,28 +47,31 @@ const FlowNavigation = ({
50
47
 
51
48
  return (
52
49
  <div
53
- ref={reference}
54
50
  className={classNames(
55
51
  'np-flow-navigation d-flex align-items-center justify-content-center p-y-3',
56
52
  { 'np-flow-navigation--border-bottom': !done },
57
53
  )}
58
54
  >
59
55
  <FlowHeader
60
- className={classNames('np-flow-navigation__content p-x-3', {
61
- 'np-flow-navigation--hidden': !clientWidth,
62
- 'np-flow-navigation--xs-max': isSmall,
63
- // Size switches on parent container which may or may not have the same size as the window.
64
- 'np-flow-navigation--sm': clientWidth != null && clientWidth >= Breakpoint.SMALL,
65
- 'np-flow-navigation--lg': isLarge,
66
- })}
56
+ className={classNames(
57
+ 'np-flow-navigation__content p-x-3',
58
+ screenSm == null
59
+ ? 'np-flow-navigation--hidden'
60
+ : {
61
+ 'np-flow-navigation--xs-max': !screenSm,
62
+ // Size switches on parent container which may or may not have the same size as the window.
63
+ 'np-flow-navigation--sm': screenSm,
64
+ 'np-flow-navigation--lg': screenLg,
65
+ },
66
+ )}
67
67
  leftContent={
68
68
  <>
69
- {isSmall && displayGoBack ? (
69
+ {!screenSm && displayGoBack ? (
70
70
  <BackButton aria-label={intl.formatMessage(messages.back)} onClick={onGoBack} />
71
71
  ) : (
72
72
  <div className="np-flow-header__left">{logo}</div>
73
73
  )}
74
- {isSmall && (
74
+ {!screenSm && (
75
75
  <AnimatedLabel
76
76
  className="m-x-1"
77
77
  labels={steps.map((step) => step.label)}
@@ -81,17 +81,7 @@ const FlowNavigation = ({
81
81
  </>
82
82
  }
83
83
  rightContent={
84
- <div
85
- className={classNames(
86
- 'np-flow-header__right',
87
- 'd-flex',
88
- 'align-items-center',
89
- 'justify-content-end',
90
- {
91
- 'order-2': isLarge,
92
- },
93
- )}
94
- >
84
+ <div className="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg">
95
85
  {newAvatar}
96
86
  {newAvatar && closeButton && <span className="m-x-1" />}
97
87
  {closeButton}
@@ -106,11 +96,7 @@ const FlowNavigation = ({
106
96
  />
107
97
  )
108
98
  }
109
- layout={
110
- clientWidth != null && clientWidth < Breakpoint.LARGE
111
- ? Layout.VERTICAL
112
- : Layout.HORIZONTAL
113
- }
99
+ layout={!screenLg ? Layout.VERTICAL : Layout.HORIZONTAL}
114
100
  />
115
101
  </div>
116
102
  );
@@ -18,7 +18,7 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
18
18
  AnimatedLabel
19
19
  </div>
20
20
  <div
21
- class="np-flow-header__right d-flex align-items-center justify-content-end"
21
+ class="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg"
22
22
  >
23
23
  <div
24
24
  class="tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
@@ -134,7 +134,7 @@ exports[`FlowNavigation renders as expected 1`] = `
134
134
  />
135
135
  </div>
136
136
  <div
137
- class="np-flow-header__right d-flex align-items-center justify-content-end order-2"
137
+ class="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg"
138
138
  >
139
139
  <div
140
140
  class="tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
package/src/i18n/hu.json CHANGED
@@ -35,7 +35,7 @@
35
35
  "neptune.Upload.psProcessingText": "Feltöltés...",
36
36
  "neptune.Upload.usButtonText": "Vagy válaszd ki a fájlt",
37
37
  "neptune.Upload.usDropMessage": "Húzd ide a fájlokat a feltöltéshez",
38
- "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize} MB méretű fájlt",
38
+ "neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}MB méretű fájlt",
39
39
  "neptune.UploadButton.allFileTypes": "Összes fájltípus",
40
40
  "neptune.UploadButton.dropFiles": "Húzd a fájlokat ide a feltöltéshez",
41
41
  "neptune.UploadButton.instructions": "{fileTypes}, legfeljebb {size}MB",
package/src/index.ts CHANGED
@@ -1,23 +1,30 @@
1
1
  /**
2
2
  * Types
3
3
  */
4
- export type { AccordionProps, AccordionItem } from './accordion';
5
- export type { AvatarProps } from './avatar';
4
+ export type { AccordionItem, AccordionProps } from './accordion';
6
5
  export type { ActionOptionProps } from './actionOption';
7
- export type { AlertProps, AlertAction, AlertArrowPosition, AlertType } from './alert';
6
+ export type { AlertAction, AlertProps, AlertType } from './alert';
7
+ export type { AvatarProps } from './avatar';
8
8
  export type { BadgeProps } from './badge';
9
9
  export type { CircularButtonProps } from './circularButton';
10
+ export type {
11
+ BodyTypes,
12
+ DisplayTypes,
13
+ LayoutDirection,
14
+ LinkTypes,
15
+ TitleTypes,
16
+ TypographyTypes,
17
+ } from './common';
18
+ export type { BottomSheetProps } from './common/bottomSheet';
19
+ export type { DateInputProps } from './dateInput';
20
+ export type { DateLookupProps } from './dateLookup';
10
21
  export type { DecisionProps } from './decision/Decision';
22
+ export type { DimmerProps } from './dimmer';
11
23
  export type { EmphasisProps } from './emphasis';
12
24
  export type { InfoProps } from './info';
13
- export type { SummaryProps } from './summary';
14
- export type { InputProps } from './inputs/Input';
15
- export type { DateInputProps } from './dateInput';
16
- export type { DateLookupProps } from './dateLookup';
17
25
  export type { InputWithDisplayFormatProps } from './inputWithDisplayFormat';
26
+ export type { InputProps } from './inputs/Input';
18
27
  export type { InputGroupProps } from './inputs/InputGroup';
19
- export type { LoaderProps } from './loader';
20
- export type { NavigationOptionListProps } from './navigationOptionsList';
21
28
  export type { SearchInputProps } from './inputs/SearchInput';
22
29
  export type {
23
30
  SelectInputGroupItem,
@@ -29,50 +36,43 @@ export type {
29
36
  SelectInputTriggerButtonProps,
30
37
  } from './inputs/SelectInput';
31
38
  export type { TextAreaProps } from './inputs/TextArea';
39
+ export type { InstructionsListProps } from './instructionsList';
40
+ export type { LoaderProps } from './loader';
41
+ export type { MarkdownProps } from './markdown';
42
+ export type { ModalProps } from './modal';
43
+ export type { MoneyProps } from './money';
44
+ export type {
45
+ CurrencyHeaderItem,
46
+ CurrencyItem,
47
+ CurrencyOptionItem,
48
+ MoneyInputProps,
49
+ } from './moneyInput';
50
+ export type { NavigationOptionListProps } from './navigationOptionsList';
32
51
  export type { PhoneNumberInputProps } from './phoneNumberInput/PhoneNumberInput';
33
52
  export type { PopoverProps } from './popover';
34
53
  export type { ProgressProps } from './progress';
35
54
  export type { ProgressBarProps } from './progressBar';
36
- export type { ProviderProps, DirectionProviderProps, LanguageProviderProps } from './provider';
55
+ export type { DirectionProviderProps, LanguageProviderProps, ProviderProps } from './provider';
37
56
  export type { RadioProps } from './radio';
38
57
  export type { RadioGroupProps, RadioGroupRadio } from './radioGroup';
39
58
  export type { RadioOptionProps } from './radioOption';
59
+ export type { SegmentedControlProps } from './segmentedControl';
60
+ export type { SlidingPanelProps } from './slidingPanel';
40
61
  export type { SnackbarProps } from './snackbar/Snackbar';
41
62
  export type { SnackbarContextType } from './snackbar/SnackbarContext';
42
63
  export type { StatusIconProps } from './statusIcon';
43
64
  export type { StickyProps } from './sticky';
65
+ export type { SummaryProps } from './summary';
44
66
  export type { SwitchProps } from './switch';
45
67
  export type { SwitchOptionProps } from './switchOption';
46
68
  export type { TextareaWithDisplayFormatProps } from './textareaWithDisplayFormat';
47
69
  export type { TooltipProps } from './tooltip';
48
- export type { UploadedFile, UploadError, UploadResponse } from './uploadInput/types';
49
- export type { MarkdownProps } from './markdown';
50
- export type { ModalProps } from './modal';
51
- export type { MoneyProps } from './money';
52
- export type {
53
- CurrencyHeaderItem,
54
- CurrencyItem,
55
- CurrencyOptionItem,
56
- MoneyInputProps,
57
- } from './moneyInput';
58
- export type { SlidingPanelProps } from './slidingPanel';
59
- export type {
60
- LayoutDirection,
61
- TypographyTypes,
62
- TitleTypes,
63
- BodyTypes,
64
- LinkTypes,
65
- DisplayTypes,
66
- } from './common';
67
- export type { SegmentedControlProps } from './segmentedControl';
68
- export type { TypeaheadProps, TypeaheadOption } from './typeahead';
69
- export type { InstructionsListProps } from './instructionsList';
70
+ export type { TypeaheadOption, TypeaheadProps } from './typeahead';
71
+ export type { UploadError, UploadResponse, UploadedFile } from './uploadInput/types';
70
72
 
71
73
  /**
72
74
  * Components
73
75
  */
74
- export { default as Title } from './title';
75
- export { default as Body } from './body';
76
76
  export { default as Accordion } from './accordion';
77
77
  export { default as ActionButton } from './actionButton';
78
78
  export { default as ActionOption } from './actionOption';
@@ -80,16 +80,19 @@ export { default as Alert } from './alert';
80
80
  export { default as Avatar } from './avatar';
81
81
  export { default as AvatarWrapper } from './avatarWrapper';
82
82
  export { default as Badge } from './badge';
83
- export { default as BottomSheet } from './common/bottomSheet';
83
+ export { default as Body } from './body';
84
84
  export { default as Button } from './button';
85
85
  export { default as Card } from './card';
86
- export { default as BaseCard } from './common/card';
87
86
  export { default as Checkbox } from './checkbox';
88
87
  export { default as CheckboxButton } from './checkboxButton';
89
88
  export { default as CheckboxOption } from './checkboxOption';
90
89
  export { default as Chevron } from './chevron';
91
- export { default as Chips, Chip } from './chips';
90
+ export { Chip, default as Chips } from './chips';
92
91
  export { default as CircularButton } from './circularButton';
92
+ export { default as Option } from './common/Option';
93
+ export { default as BottomSheet } from './common/bottomSheet';
94
+ export { default as BaseCard } from './common/card';
95
+ export { default as CriticalCommsBanner } from './criticalBanner';
93
96
  export { default as DateInput } from './dateInput';
94
97
  export { default as DateLookup } from './dateLookup';
95
98
  export { default as Decision } from './decision';
@@ -104,6 +107,7 @@ export { default as Header } from './header';
104
107
  export { default as Image } from './image';
105
108
  export { default as Info } from './info';
106
109
  export { default as InlineAlert } from './inlineAlert';
110
+ export { default as InputWithDisplayFormat } from './inputWithDisplayFormat';
107
111
  export { Input } from './inputs/Input';
108
112
  export { InputGroup } from './inputs/InputGroup';
109
113
  export { SearchInput } from './inputs/SearchInput';
@@ -113,9 +117,9 @@ export {
113
117
  SelectInputTriggerButton,
114
118
  } from './inputs/SelectInput';
115
119
  export { TextArea } from './inputs/TextArea';
116
- export { default as InputWithDisplayFormat } from './inputWithDisplayFormat';
117
120
  export { default as InstructionsList } from './instructionsList';
118
121
  export { default as Link } from './link';
122
+ export { default as ListItem } from './listItem';
119
123
  export { default as Loader } from './loader';
120
124
  export { default as Logo } from './logo';
121
125
  export { default as Markdown } from './markdown';
@@ -125,24 +129,23 @@ export { default as MoneyInput } from './moneyInput';
125
129
  export { default as NavigationOption } from './navigationOption';
126
130
  export { default as NavigationOptionsList } from './navigationOptionsList';
127
131
  export { default as Nudge } from './nudge';
128
- export { default as Option } from './common/Option';
129
132
  export { default as OverlayHeader } from './overlayHeader';
130
133
  export { default as PhoneNumberInput } from './phoneNumberInput';
131
134
  export { default as Popover } from './popover';
132
135
  export { default as ProcessIndicator } from './processIndicator';
133
- export { default as ProgressBar } from './progressBar';
134
136
  export { default as Progress } from './progress';
135
- export { default as PromoCard } from './promoCard';
136
- export { default as PromoCardGroup } from './promoCard';
137
- export { default as Provider, DirectionProvider, LanguageProvider } from './provider';
137
+ export { default as ProgressBar } from './progressBar';
138
+ export { PromoCardGroup, default as PromoCard } from './promoCard';
139
+ export { DirectionProvider, LanguageProvider, default as Provider } from './provider';
138
140
  export { default as Radio } from './radio';
139
141
  export { default as RadioGroup } from './radioGroup';
140
142
  export { default as RadioOption } from './radioOption';
141
143
  export { default as Section } from './section';
142
- export { default as Select } from './select';
143
144
  export { default as SegmentedControl } from './segmentedControl';
145
+ export { default as Select } from './select';
144
146
  export { default as SlidingPanel } from './slidingPanel';
145
147
  export { default as SnackbarPortal } from './snackbar/Snackbar';
148
+ export { SnackbarConsumer, SnackbarContext } from './snackbar/SnackbarContext';
146
149
  export { default as SnackbarProvider } from './snackbar/SnackbarProvider';
147
150
  export { default as StatusIcon } from './statusIcon/StatusIcon';
148
151
  export { default as Stepper } from './stepper/Stepper';
@@ -152,66 +155,65 @@ export { default as Switch } from './switch';
152
155
  export { default as SwitchOption } from './switchOption';
153
156
  export { default as Tabs } from './tabs';
154
157
  export { default as TextareaWithDisplayFormat } from './textareaWithDisplayFormat';
158
+ export { default as Title } from './title';
155
159
  export { default as Tooltip } from './tooltip';
156
160
  export { default as Typeahead } from './typeahead';
157
161
  export { default as Upload } from './upload';
158
162
  export { default as UploadInput } from './uploadInput';
159
- export { SnackbarConsumer, SnackbarContext } from './snackbar/SnackbarContext';
160
- export { default as CriticalCommsBanner } from './criticalBanner';
161
- export { default as ListItem } from './listItem';
162
163
 
163
164
  /**
164
165
  * Hooks
165
166
  */
166
- export { default as useSnackbar } from './snackbar/useSnackbar';
167
167
  export { useDirection, useLayout } from './common/hooks';
168
168
  export { useScreenSize } from './common/hooks/useScreenSize';
169
+ export { default as useSnackbar } from './snackbar/useSnackbar';
169
170
 
170
171
  /**
171
172
  * Enums
172
173
  */
174
+ export { AlertArrowPosition } from './alert/Alert';
175
+ export { AvatarType } from './avatar';
173
176
  export {
174
- Direction,
175
- Size,
176
- Width,
177
- Sentiment,
178
- Priority,
177
+ Breakpoint,
179
178
  ControlType,
180
- Type,
181
- Theme,
182
179
  DateMode,
180
+ Direction,
181
+ FileType,
182
+ Layout,
183
+ MarkdownNodeType,
183
184
  MonthFormat,
184
185
  Position,
185
- Scroll,
186
+ Priority,
186
187
  ProfileType,
187
- Breakpoint,
188
- Layout,
188
+ Scroll,
189
+ Sentiment,
190
+ Size,
189
191
  Status,
190
- MarkdownNodeType,
192
+ Theme,
193
+ Type,
191
194
  Typography,
192
195
  Variant,
196
+ Width,
193
197
  } from './common';
194
- export { AvatarType } from './avatar';
195
- export { InfoPresentation } from './info';
196
- export { UploadStep } from './upload';
197
198
  export { DecisionPresentation, DecisionType } from './decision';
199
+ export { InfoPresentation } from './info';
198
200
  export { LogoType } from './logo';
199
- export { FileType } from './common';
201
+ export { UploadStep } from './upload';
200
202
 
201
203
  /**
202
204
  * Utils
203
205
  */
204
206
  export {
205
- adjustLocale,
206
207
  DEFAULT_LANG,
207
208
  DEFAULT_LOCALE,
209
+ RTL_LANGUAGES,
210
+ SUPPORTED_LANGUAGES,
211
+ adjustLocale,
208
212
  getCountryFromLocale,
209
213
  getDirectionFromLocale,
210
214
  getLangFromLocale,
211
215
  isBrowser,
212
216
  isServerSide,
213
- RTL_LANGUAGES,
214
- SUPPORTED_LANGUAGES,
215
217
  } from './common';
216
218
 
217
219
  /**
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
 
4
4
  import { Size } from '../common';
5
5
  import { CloseButton } from '../common/closeButton';
6
- import FlowHeader from '../common/flowHeader/FlowHeader';
6
+ import FlowHeader from '../common/flowHeader';
7
7
  import Logo from '../logo';
8
8
 
9
9
  const OverlayHeader = ({ avatar, onClose, logo }) => {
@@ -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
+ };
@@ -169,10 +169,10 @@ class WithDisplayFormat<T extends TextElementProps> extends Component<
169
169
  let newFormattedValue = '';
170
170
 
171
171
  if (this.detectUndoRedo(event) === 'Undo') {
172
- newFormattedValue = formatWithPattern(historyNavigator.undo(), displayPattern);
172
+ newFormattedValue = formatWithPattern(historyNavigator.undo().toString(), displayPattern);
173
173
  this.setState({ value: newFormattedValue, triggerType: 'Undo' });
174
174
  } else if (this.detectUndoRedo(event) === 'Redo') {
175
- newFormattedValue = formatWithPattern(historyNavigator.redo(), displayPattern);
175
+ newFormattedValue = formatWithPattern(historyNavigator.redo().toString(), displayPattern);
176
176
  this.setState({ value: newFormattedValue, triggerType: 'Redo' });
177
177
  } else {
178
178
  this.setState({
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- type FlowNavigationProps = {
3
- ref: React.RefObject<HTMLElement> | Window | undefined;
4
- throttleMs?: number;
5
- };
6
- export declare const useClientWidth: {
7
- ({ ref, throttleMs }: FlowNavigationProps): (number | null)[];
8
- THROTTLE_MS: number;
9
- };
10
- export {};
11
- //# sourceMappingURL=useClientWidth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useClientWidth.d.ts","sourceRoot":"","sources":["../../../../../src/common/hooks/useClientWidth/useClientWidth.tsx"],"names":[],"mappings":";AAOA,KAAK,mBAAmB,GAAG;IACzB,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,cAAc;0BAAuC,mBAAmB;;CAgCpF,CAAC"}
@@ -1,3 +0,0 @@
1
- import { addNoScrollClass, removeNoScrollClass } from './DOMOperations';
2
-
3
- export { addNoScrollClass, removeNoScrollClass };
@@ -1 +0,0 @@
1
- export { default } from './BottomSheet';
@@ -1,7 +0,0 @@
1
- export function isIosDevice() {
2
- const sampleTouchDevices = ['iphone', 'ipad', 'ipod'];
3
- const matchString = sampleTouchDevices.map((device) => `(${device})`).join('|');
4
- const regex = new RegExp(matchString, 'gi');
5
-
6
- return typeof navigator !== 'undefined' && !!navigator.userAgent.match(regex);
7
- }
@@ -1,77 +0,0 @@
1
- import { act, renderHook } from '@testing-library/react-hooks';
2
-
3
- import { fireEvent } from '../../../test-utils';
4
-
5
- import { useClientWidth } from './useClientWidth';
6
-
7
- jest.mock('lodash.throttle', () => jest.fn((fn) => fn));
8
-
9
- describe('useClientWidth', () => {
10
- describe('when invalid ref is provided', () => {
11
- it('returns 0', () => {
12
- const reference = { invalid: true };
13
- const {
14
- result: { current },
15
- } = renderHook(() => useClientWidth({ ref: reference }));
16
-
17
- expect(current).toStrictEqual([null]);
18
- });
19
- });
20
-
21
- describe('when valid ref is provided', () => {
22
- it('returns initial ref width', () => {
23
- const reference = { current: { clientWidth: 500 } };
24
- const {
25
- result: { current },
26
- } = renderHook(() => useClientWidth({ ref: reference }));
27
-
28
- expect(current).toStrictEqual([500]);
29
- });
30
-
31
- it('updates the ref width on window resize', () => {
32
- const reference = { current: { clientWidth: 500 } };
33
- const { result } = renderHook(() => useClientWidth({ ref: reference }));
34
-
35
- expect(result.current).toStrictEqual([500]);
36
-
37
- act(() => {
38
- reference.current.clientWidth = 700;
39
- fireEvent(window, new Event('resize'));
40
- });
41
- expect(result.current).toStrictEqual([700]);
42
-
43
- act(() => {
44
- reference.current.clientWidth = 800;
45
- fireEvent(window, new Event('resize'));
46
- });
47
- expect(result.current).toStrictEqual([800]);
48
- });
49
- });
50
-
51
- describe('when window ref is provided', () => {
52
- it('returns window innerWidth', () => {
53
- window.innerWidth = 600;
54
- const {
55
- result: { current },
56
- } = renderHook(() => useClientWidth({ ref: window }));
57
-
58
- expect(current).toStrictEqual([600]);
59
- });
60
- });
61
-
62
- describe('when cleanup runs the event is not longer attached to window', () => {
63
- it('returns window innerWidth', () => {
64
- const reference = { current: { clientWidth: 500 } };
65
- const { result, unmount } = renderHook(() => useClientWidth({ ref: reference }));
66
-
67
- unmount();
68
-
69
- act(() => {
70
- reference.current.clientWidth = 700;
71
- fireEvent(window, new Event('resize'));
72
- });
73
-
74
- expect(result.current).toStrictEqual([500]);
75
- });
76
- });
77
- });
@@ -1,47 +0,0 @@
1
- import throttle from 'lodash.throttle';
2
- import { useLayoutEffect, useState, useEffect, RefObject } from 'react';
3
-
4
- const THROTTLE_MS = 100;
5
-
6
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
7
-
8
- type FlowNavigationProps = {
9
- ref: React.RefObject<HTMLElement> | Window | undefined;
10
- throttleMs?: number;
11
- };
12
-
13
- export const useClientWidth = ({ ref, throttleMs = THROTTLE_MS }: FlowNavigationProps) => {
14
- const [clientWidth, setClientWidth] = useState<number | null>(null);
15
-
16
- useIsomorphicLayoutEffect(() => {
17
- // eslint-disable-next-line unicorn/consistent-function-scoping
18
- const updateClientWidth = () => {
19
- if (ref) {
20
- // when `ref` is a window
21
- if ('innerWidth' in ref) {
22
- setClientWidth(ref.innerWidth);
23
- }
24
- // when `ref` is an element
25
- else if (ref.current) {
26
- setClientWidth(ref.current.clientWidth);
27
- }
28
- }
29
- };
30
- // This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
31
- // If throttle gets passed directly to both add and removeEventListenet the results will be that the event
32
- // won't get removed even if the component is unmounted.
33
- const attachedFunction = throttle(updateClientWidth, throttleMs);
34
-
35
- window.addEventListener('resize', attachedFunction, true);
36
-
37
- // using requestAnimationFrame to perform the calculation before the next repaint
38
- // getting width earlier causes issues in animations when used with react-transition-group
39
- window.requestAnimationFrame(updateClientWidth);
40
-
41
- return () => window.removeEventListener('resize', attachedFunction, true);
42
- }, []);
43
-
44
- return [clientWidth];
45
- };
46
-
47
- useClientWidth.THROTTLE_MS = THROTTLE_MS;
@@ -1 +0,0 @@
1
- export { default } from './Dimmer';
File without changes
File without changes