@transferwise/components 46.93.1 → 46.93.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.
- package/build/button/LegacyButton.js +0 -2
- package/build/button/LegacyButton.js.map +1 -1
- package/build/button/LegacyButton.mjs +0 -2
- package/build/button/LegacyButton.mjs.map +1 -1
- package/build/carousel/Carousel.js +1 -3
- package/build/carousel/Carousel.js.map +1 -1
- package/build/carousel/Carousel.mjs +1 -3
- package/build/carousel/Carousel.mjs.map +1 -1
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/checkboxButton/CheckboxButton.js +1 -1
- package/build/checkboxButton/CheckboxButton.js.map +1 -1
- package/build/checkboxButton/CheckboxButton.mjs +1 -1
- package/build/checkboxButton/CheckboxButton.mjs.map +1 -1
- package/build/checkboxOption/CheckboxOption.js.map +1 -1
- package/build/checkboxOption/CheckboxOption.mjs.map +1 -1
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/common/dateUtils/isDateValid/isDateValid.js +3 -3
- package/build/common/dateUtils/isDateValid/isDateValid.js.map +1 -1
- package/build/common/dateUtils/isDateValid/isDateValid.mjs +3 -3
- package/build/common/dateUtils/isDateValid/isDateValid.mjs.map +1 -1
- package/build/common/panel/Panel.js +3 -8
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +3 -8
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/dimmer/dimmerManager/DimmerManager.js.map +1 -1
- package/build/dimmer/dimmerManager/DimmerManager.mjs.map +1 -1
- package/build/dropFade/DropFade.js.map +1 -1
- package/build/dropFade/DropFade.mjs.map +1 -1
- package/build/emphasis/EmphasisHtmlTransformer.js.map +1 -1
- package/build/emphasis/EmphasisHtmlTransformer.mjs.map +1 -1
- package/build/inputs/Input.js +1 -3
- package/build/inputs/Input.js.map +1 -1
- package/build/inputs/Input.mjs +1 -3
- package/build/inputs/Input.mjs.map +1 -1
- package/build/inputs/SelectInput.js +1 -3
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +1 -3
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/inputs/_ButtonInput.js +1 -3
- package/build/inputs/_ButtonInput.js.map +1 -1
- package/build/inputs/_ButtonInput.mjs +1 -3
- package/build/inputs/_ButtonInput.mjs.map +1 -1
- package/build/inputs/_Popover.js +1 -3
- package/build/inputs/_Popover.js.map +1 -1
- package/build/inputs/_Popover.mjs +1 -3
- package/build/inputs/_Popover.mjs.map +1 -1
- package/build/moneyInput/currencyFormatting.js +2 -2
- package/build/moneyInput/currencyFormatting.js.map +1 -1
- package/build/moneyInput/currencyFormatting.mjs +2 -2
- package/build/moneyInput/currencyFormatting.mjs.map +1 -1
- package/build/nudge/Nudge.js +0 -2
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +0 -2
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/promoCard/PromoCardContext.js +0 -1
- package/build/promoCard/PromoCardContext.js.map +1 -1
- package/build/promoCard/PromoCardContext.mjs +0 -1
- package/build/promoCard/PromoCardContext.mjs.map +1 -1
- package/build/promoCard/PromoCardGroup.js +0 -1
- package/build/promoCard/PromoCardGroup.js.map +1 -1
- package/build/promoCard/PromoCardGroup.mjs +0 -1
- package/build/promoCard/PromoCardGroup.mjs.map +1 -1
- package/build/select/Select.js +19 -25
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +19 -25
- package/build/select/Select.mjs.map +1 -1
- package/build/table/Table.js +1 -3
- package/build/table/Table.js.map +1 -1
- package/build/table/Table.mjs +1 -3
- package/build/table/Table.mjs.map +1 -1
- package/build/tooltip/Tooltip.js +2 -6
- package/build/tooltip/Tooltip.js.map +1 -1
- package/build/tooltip/Tooltip.mjs +2 -6
- package/build/tooltip/Tooltip.mjs.map +1 -1
- package/build/types/button/LegacyButton.d.ts.map +1 -1
- package/build/types/carousel/Carousel.d.ts.map +1 -1
- package/build/types/checkbox/Checkbox.d.ts.map +1 -1
- package/build/types/checkboxOption/CheckboxOption.d.ts +1 -2
- package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/dateUtils/isDateValid/isDateValid.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/dimmer/dimmerManager/DimmerManager.d.ts +1 -1
- package/build/types/dimmer/dimmerManager/DimmerManager.d.ts.map +1 -1
- package/build/types/dropFade/DropFade.d.ts.map +1 -1
- package/build/types/emphasis/EmphasisHtmlTransformer.d.ts +2 -2
- package/build/types/emphasis/EmphasisHtmlTransformer.d.ts.map +1 -1
- package/build/types/inputs/Input.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/_ButtonInput.d.ts.map +1 -1
- package/build/types/inputs/_Popover.d.ts.map +1 -1
- package/build/types/nudge/Nudge.d.ts.map +1 -1
- package/build/types/promoCard/PromoCardContext.d.ts.map +1 -1
- package/build/types/promoCard/PromoCardGroup.d.ts.map +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/table/Table.d.ts.map +1 -1
- package/build/types/tooltip/Tooltip.d.ts.map +1 -1
- package/build/types/withId/story/source.d.ts +1 -1
- package/build/types/withId/story/source.d.ts.map +1 -1
- package/build/upload/steps/completeStep/completeStep.js +1 -0
- package/build/upload/steps/completeStep/completeStep.js.map +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +1 -0
- package/build/upload/steps/completeStep/completeStep.mjs.map +1 -1
- package/build/upload/steps/processingStep/processingStep.js +1 -0
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -0
- package/build/upload/steps/processingStep/processingStep.mjs.map +1 -1
- package/package.json +6 -3
- package/src/accordion/Accordion.story.tsx +2 -2
- package/src/alert/Alert.story.tsx +4 -4
- package/src/alert/Alert.tests.story.tsx +3 -3
- package/src/button/LegacyButton.tsx +0 -2
- package/src/carousel/Carousel.spec.tsx +0 -4
- package/src/carousel/Carousel.tsx +0 -1
- package/src/checkbox/Checkbox.tsx +0 -1
- package/src/checkboxButton/CheckboxButton.story.tsx +0 -2
- package/src/checkboxButton/CheckboxButton.tsx +1 -1
- package/src/checkboxOption/CheckboxOption.tsx +1 -2
- package/src/common/bottomSheet/BottomSheet.spec.tsx +0 -1
- package/src/common/bottomSheet/BottomSheet.story.tsx +1 -1
- package/src/common/bottomSheet/BottomSheet.tsx +0 -1
- package/src/common/dateUtils/isDateValid/isDateValid.ts +5 -3
- package/src/common/hooks/useHasIntersected/useHasIntersected.spec.js +0 -2
- package/src/common/panel/Panel.tsx +2 -13
- package/src/dimmer/Dimmer.spec.tsx +3 -1
- package/src/dimmer/Dimmer.story.tsx +3 -2
- package/src/dimmer/dimmerManager/DimmerManager.ts +1 -1
- package/src/display/Display.story.tsx +0 -2
- package/src/drawer/Drawer.story.tsx +6 -4
- package/src/dropFade/DropFade.story.tsx +1 -2
- package/src/dropFade/DropFade.tsx +0 -1
- package/src/emphasis/EmphasisHtmlTransformer.spec.tsx +4 -4
- package/src/emphasis/EmphasisHtmlTransformer.ts +2 -2
- package/src/flowNavigation/FlowNavigation.story.tsx +6 -1
- package/src/inputs/Input.tsx +0 -1
- package/src/inputs/SelectInput.story.tsx +6 -2
- package/src/inputs/SelectInput.tsx +1 -7
- package/src/inputs/_ButtonInput.tsx +0 -1
- package/src/inputs/_Popover.tsx +0 -1
- package/src/link/Link.story.tsx +0 -1
- package/src/listItem/ListItem.story.tsx +0 -2
- package/src/markdown/Markdown.spec.tsx +0 -1
- package/src/modal/Modal.story.tsx +14 -4
- package/src/moneyInput/currencyFormatting.ts +3 -3
- package/src/nudge/Nudge.tsx +0 -2
- package/src/popover/Popover.story.tsx +10 -2
- package/src/promoCard/PromoCardContext.tsx +0 -1
- package/src/promoCard/PromoCardGroup.story.tsx +3 -15
- package/src/promoCard/PromoCardGroup.tsx +0 -1
- package/src/provider/theme/ThemeProvider.story.tsx +3 -5
- package/src/select/Select.spec.tsx +0 -1
- package/src/select/Select.tsx +0 -3
- package/src/select/option/Option.spec.js +2 -2
- package/src/selectOption/SelectOption.story.tsx +1 -2
- package/src/slidingPanel/SlidingPanel.story.tsx +1 -1
- package/src/table/Table.tsx +0 -1
- package/src/test-utils/jest.setup.ts +0 -1
- package/src/tooltip/Tooltip.tsx +0 -2
- package/src/upload/Upload.events.spec.js +4 -4
- package/src/upload/steps/completeStep/completeStep.tsx +1 -1
- package/src/upload/steps/processingStep/processingStep.tsx +1 -1
- package/src/withId/story/source.tsx +1 -1
- package/src/withId/withId.story.tsx +3 -1
|
@@ -213,7 +213,7 @@ export const DynamicRender: Story = {
|
|
|
213
213
|
|
|
214
214
|
return (
|
|
215
215
|
<>
|
|
216
|
-
<Button
|
|
216
|
+
<Button v2 onClick={() => setIsOneActive(true)}>
|
|
217
217
|
Trigger Alert
|
|
218
218
|
</Button>
|
|
219
219
|
|
|
@@ -248,7 +248,7 @@ function Render(args) {
|
|
|
248
248
|
|
|
249
249
|
return (
|
|
250
250
|
<>
|
|
251
|
-
<Button
|
|
251
|
+
<Button v2 onClick={() => setIsOneActive(true)}>
|
|
252
252
|
Trigger Alert
|
|
253
253
|
</Button>
|
|
254
254
|
|
|
@@ -325,7 +325,7 @@ export const MultipleDynamicAlerts: Story = {
|
|
|
325
325
|
</Button>
|
|
326
326
|
|
|
327
327
|
{alerts.map((props) => (
|
|
328
|
-
<Alert
|
|
328
|
+
<Alert key={props.title} {...props} className="m-t-3" />
|
|
329
329
|
))}
|
|
330
330
|
</>
|
|
331
331
|
);
|
|
@@ -352,8 +352,8 @@ function Render() {
|
|
|
352
352
|
|
|
353
353
|
{alerts.map(props => (
|
|
354
354
|
<Alert
|
|
355
|
-
{...props}
|
|
356
355
|
key={props.title}
|
|
356
|
+
{...props}
|
|
357
357
|
className="m-t-3"
|
|
358
358
|
/>
|
|
359
359
|
))}
|
|
@@ -37,7 +37,7 @@ export const SimpleTrigger: Story = {
|
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<>
|
|
40
|
-
<Button
|
|
40
|
+
<Button v2 onClick={() => setIsActive(true)}>
|
|
41
41
|
Trigger Alert
|
|
42
42
|
</Button>
|
|
43
43
|
|
|
@@ -119,12 +119,12 @@ export const MultipleDynamicAlerts: Story = {
|
|
|
119
119
|
|
|
120
120
|
return (
|
|
121
121
|
<>
|
|
122
|
-
<Button
|
|
122
|
+
<Button v2 onClick={() => setAlerts(getAlerts())}>
|
|
123
123
|
Generate dynamic alerts
|
|
124
124
|
</Button>
|
|
125
125
|
|
|
126
126
|
{alerts.map((props) => (
|
|
127
|
-
<Alert
|
|
127
|
+
<Alert key={props.title} {...props} className="m-t-3" />
|
|
128
128
|
))}
|
|
129
129
|
</>
|
|
130
130
|
);
|
|
@@ -133,10 +133,8 @@ const LegacyButton = forwardRef<ButtonReferenceType, LegacyButtonProps>(
|
|
|
133
133
|
disabled,
|
|
134
134
|
},
|
|
135
135
|
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
136
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
137
136
|
typeClassMap[newType],
|
|
138
137
|
// @ts-expect-error fix when refactor `typeClassMap` to TypeScript
|
|
139
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
140
138
|
priorityClassMap[newPriority],
|
|
141
139
|
className,
|
|
142
140
|
);
|
|
@@ -47,9 +47,7 @@ describe('Carousel', () => {
|
|
|
47
47
|
const scrollBy = jest.fn();
|
|
48
48
|
|
|
49
49
|
beforeEach(() => {
|
|
50
|
-
// eslint-disable-next-line functional/immutable-data
|
|
51
50
|
window.HTMLElement.prototype.scrollIntoView = focusSpy;
|
|
52
|
-
// eslint-disable-next-line functional/immutable-data
|
|
53
51
|
window.HTMLElement.prototype.scrollBy = scrollBy;
|
|
54
52
|
});
|
|
55
53
|
|
|
@@ -198,13 +196,11 @@ describe('Carousel', () => {
|
|
|
198
196
|
});
|
|
199
197
|
|
|
200
198
|
const mockPositions = (scrollWidth: number, offsetWidth: number) => {
|
|
201
|
-
// eslint-disable-next-line functional/immutable-data
|
|
202
199
|
Object.defineProperty(HTMLElement.prototype, 'scrollWidth', {
|
|
203
200
|
configurable: true,
|
|
204
201
|
value: scrollWidth,
|
|
205
202
|
});
|
|
206
203
|
|
|
207
|
-
// eslint-disable-next-line functional/immutable-data
|
|
208
204
|
Object.defineProperty(HTMLElement.prototype, 'offsetWidth', {
|
|
209
205
|
configurable: true,
|
|
210
206
|
value: offsetWidth,
|
|
@@ -228,7 +228,6 @@ const Carousel: React.FC<CarouselProps> = ({ header, className, cards, onClick }
|
|
|
228
228
|
className={clsx('carousel__card-content', {
|
|
229
229
|
[card.className ?? '']: !!card.className,
|
|
230
230
|
})}
|
|
231
|
-
// eslint-disable-next-line react/forbid-dom-props
|
|
232
231
|
style={card.styles}
|
|
233
232
|
>
|
|
234
233
|
{card.content}
|
|
@@ -44,7 +44,6 @@ export default function Checkbox({
|
|
|
44
44
|
const innerDisabled = disabled || readOnly;
|
|
45
45
|
return (
|
|
46
46
|
<div id={id} className={classList}>
|
|
47
|
-
{/* eslint-disable-next-line jsx-a11y/label-has-for */}
|
|
48
47
|
<label className={clsx({ disabled })}>
|
|
49
48
|
<CheckboxButton
|
|
50
49
|
className="p-r-2"
|
|
@@ -23,7 +23,6 @@ export const Basic: Story = {
|
|
|
23
23
|
'aria-label': 'Toggle email updates',
|
|
24
24
|
},
|
|
25
25
|
render: (args) => {
|
|
26
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
27
26
|
const [checked, setChecked] = useState(true);
|
|
28
27
|
|
|
29
28
|
return <CheckboxButton {...args} checked={checked} onChange={() => setChecked(!checked)} />;
|
|
@@ -36,7 +35,6 @@ export const Indeterminate: Story = {
|
|
|
36
35
|
indeterminate: true,
|
|
37
36
|
},
|
|
38
37
|
render: (args) => {
|
|
39
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
40
38
|
const [indeterminate, setIndeterminate] = useState(true);
|
|
41
39
|
|
|
42
40
|
return (
|
|
@@ -19,7 +19,7 @@ const CheckboxButton = forwardRef<HTMLInputElement, CheckboxButtonProps>(functio
|
|
|
19
19
|
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
if (internalRef.current) {
|
|
22
|
-
// eslint-disable-next-line functional/immutable-data
|
|
22
|
+
// eslint-disable-next-line functional/immutable-data
|
|
23
23
|
internalRef.current.indeterminate = indeterminate;
|
|
24
24
|
}
|
|
25
25
|
}, [indeterminate, reference]);
|
|
@@ -2,8 +2,7 @@ import { forwardRef } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import CheckboxButton from '../checkboxButton';
|
|
4
4
|
import Option from '../common/Option';
|
|
5
|
-
import { ReferenceType } from '../common/Option/Option';
|
|
6
|
-
import { BaseOptionProps } from '../common/Option/Option';
|
|
5
|
+
import { ReferenceType, BaseOptionProps } from '../common/Option/Option';
|
|
7
6
|
|
|
8
7
|
export type CheckboxOptionProps = Omit<BaseOptionProps, 'onChange'> & {
|
|
9
8
|
/**
|
|
@@ -19,8 +19,8 @@ export default {
|
|
|
19
19
|
open: true,
|
|
20
20
|
},
|
|
21
21
|
render: (args) => {
|
|
22
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
23
22
|
const [open, setOpen] = useState(args.open);
|
|
23
|
+
|
|
24
24
|
return (
|
|
25
25
|
<div style={{ height: '2000px' }}>
|
|
26
26
|
<Button onClick={() => setOpen(true)}>Open BottomSheet</Button>
|
|
@@ -201,7 +201,6 @@ const BottomSheet = ({ role = 'dialog', ...props }: BottomSheetProps) => {
|
|
|
201
201
|
position={Position.BOTTOM}
|
|
202
202
|
className={clsx('np-bottom-sheet', props.className)}
|
|
203
203
|
>
|
|
204
|
-
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
|
|
205
204
|
<div
|
|
206
205
|
id={overlayId}
|
|
207
206
|
aria-labelledby={props['aria-labelledby'] || undefined}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export const isDateValid = (date: Date | string | null) => {
|
|
2
2
|
if (date === null) {
|
|
3
3
|
return false;
|
|
4
|
-
}
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
if (date instanceof Date) {
|
|
5
7
|
return validDateObject(date);
|
|
6
|
-
} else {
|
|
7
|
-
return validDateString(date);
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
return validDateString(date);
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export const validDateString = (dateString: string) => validDateObject(new Date(dateString));
|
|
@@ -65,7 +65,6 @@ describe('useHasIntersected', () => {
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
it('calls observer', () => {
|
|
68
|
-
// eslint-disable-next-line jest/prefer-spy-on
|
|
69
68
|
window.IntersectionObserver = jest.fn(() => ({
|
|
70
69
|
observe,
|
|
71
70
|
unobserve,
|
|
@@ -107,7 +106,6 @@ describe('useHasIntersected', () => {
|
|
|
107
106
|
});
|
|
108
107
|
|
|
109
108
|
const setupIntersectionObserver = (isIntersecting) => {
|
|
110
|
-
// eslint-disable-next-line jest/prefer-spy-on
|
|
111
109
|
window.IntersectionObserver = jest.fn((callback) => {
|
|
112
110
|
callback([{ isIntersecting }], { unobserve });
|
|
113
111
|
return {
|
|
@@ -119,26 +119,15 @@ const Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(
|
|
|
119
119
|
{...rest}
|
|
120
120
|
ref={setPopperElement}
|
|
121
121
|
role="dialog"
|
|
122
|
-
// eslint-disable-next-line react/forbid-dom-props
|
|
123
122
|
style={{ ...styles.popper }}
|
|
124
123
|
{...attributes.popper}
|
|
125
124
|
className={clsx('np-panel', { 'np-panel--open': open }, rest.className)}
|
|
126
125
|
>
|
|
127
|
-
<div
|
|
128
|
-
ref={reference}
|
|
129
|
-
/* eslint-disable-next-line react/forbid-dom-props */
|
|
130
|
-
style={contentStyle}
|
|
131
|
-
className={clsx('np-panel__content')}
|
|
132
|
-
>
|
|
126
|
+
<div ref={reference} style={contentStyle} className={clsx('np-panel__content')}>
|
|
133
127
|
{children}
|
|
134
128
|
{/* Arrow has to stay inside content to get the same animations as the "dialog" and to get hidden when panel is closed. */}
|
|
135
129
|
{arrow && (
|
|
136
|
-
<div
|
|
137
|
-
ref={setArrowElement}
|
|
138
|
-
className={clsx('np-panel__arrow')}
|
|
139
|
-
// eslint-disable-next-line react/forbid-dom-props
|
|
140
|
-
style={styles.arrow}
|
|
141
|
-
/>
|
|
130
|
+
<div ref={setArrowElement} className={clsx('np-panel__arrow')} style={styles.arrow} />
|
|
142
131
|
)}
|
|
143
132
|
</div>
|
|
144
133
|
</div>
|
|
@@ -33,7 +33,9 @@ describe('Dimmer', () => {
|
|
|
33
33
|
it('does not call onClose if the dimmer content is clicked', async () => {
|
|
34
34
|
render(
|
|
35
35
|
<Dimmer {...props}>
|
|
36
|
-
<Button onClick={() => {}}>
|
|
36
|
+
<Button v2 onClick={() => {}}>
|
|
37
|
+
McClicky
|
|
38
|
+
</Button>
|
|
37
39
|
</Dimmer>,
|
|
38
40
|
);
|
|
39
41
|
await userEvent.click(screen.getByRole('button'));
|
|
@@ -18,12 +18,13 @@ type Story = StoryObj<typeof Dimmer>;
|
|
|
18
18
|
|
|
19
19
|
export const Basic: Story = {
|
|
20
20
|
render: (args) => {
|
|
21
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
22
21
|
const [open, setOpen] = useState(false);
|
|
23
22
|
|
|
24
23
|
return (
|
|
25
24
|
<>
|
|
26
|
-
<Button onClick={() => setOpen((isOpen) => !isOpen)}>
|
|
25
|
+
<Button v2 onClick={() => setOpen((isOpen) => !isOpen)}>
|
|
26
|
+
Toggle dimmer
|
|
27
|
+
</Button>
|
|
27
28
|
<Dimmer
|
|
28
29
|
{...args}
|
|
29
30
|
open={open}
|
|
@@ -18,7 +18,7 @@ export const Basic = () => {
|
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
20
|
<>
|
|
21
|
-
<Button disabled={false} block={false} onClick={() => setOpenDrawer(true)}>
|
|
21
|
+
<Button v2 disabled={false} block={false} onClick={() => setOpenDrawer(true)}>
|
|
22
22
|
Open drawer
|
|
23
23
|
</Button>
|
|
24
24
|
<Drawer
|
|
@@ -27,10 +27,10 @@ export const Basic = () => {
|
|
|
27
27
|
headerTitle="This is the title of the drawer"
|
|
28
28
|
footerContent={
|
|
29
29
|
<>
|
|
30
|
-
<Button block onClick={() => {}}>
|
|
30
|
+
<Button v2 block onClick={() => {}}>
|
|
31
31
|
Action 1
|
|
32
32
|
</Button>
|
|
33
|
-
<Button block priority={Priority.SECONDARY} onClick={() => {}}>
|
|
33
|
+
<Button v2 block priority={Priority.SECONDARY} onClick={() => {}}>
|
|
34
34
|
Action 2
|
|
35
35
|
</Button>
|
|
36
36
|
</>
|
|
@@ -50,7 +50,9 @@ export const Basic = () => {
|
|
|
50
50
|
<Section className="m-t-2">
|
|
51
51
|
<Input />
|
|
52
52
|
<p className="m-t-3">Cat ipsum dolor sit amet, purr when being pet.</p>
|
|
53
|
-
<Button onClick={() => setOpenModal(true)}>
|
|
53
|
+
<Button v2 onClick={() => setOpenModal(true)}>
|
|
54
|
+
Open Modal
|
|
55
|
+
</Button>
|
|
54
56
|
<Modal
|
|
55
57
|
body={
|
|
56
58
|
<p className="m-t-4">
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable react/forbid-dom-props */
|
|
2
1
|
import { action } from '@storybook/addon-actions';
|
|
3
2
|
import { useState } from 'react';
|
|
4
3
|
|
|
@@ -35,7 +34,7 @@ export const Basic = () => {
|
|
|
35
34
|
}}
|
|
36
35
|
/>
|
|
37
36
|
</DropFade>
|
|
38
|
-
<Button className="m-t-3" block onClick={() => setOpen(true)}>
|
|
37
|
+
<Button v2 className="m-t-3" block onClick={() => setOpen(true)}>
|
|
39
38
|
Some other content
|
|
40
39
|
</Button>
|
|
41
40
|
</div>
|
|
@@ -26,7 +26,6 @@ const DropFade = ({ children, show }: { children: ReactElement; show: boolean })
|
|
|
26
26
|
setHeight(0);
|
|
27
27
|
}}
|
|
28
28
|
>
|
|
29
|
-
{/* eslint-disable-next-line react/forbid-dom-props */}
|
|
30
29
|
<div ref={reference} style={{ height }} className="np-dropfade">
|
|
31
30
|
{clonedChild}
|
|
32
31
|
</div>
|
|
@@ -7,7 +7,7 @@ describe('creates safe, enphasised html', () => {
|
|
|
7
7
|
emphasisHtmlTransformer.transform(
|
|
8
8
|
'<script>something malicious</script><p>some text & more text</p>',
|
|
9
9
|
),
|
|
10
|
-
).
|
|
10
|
+
).toBe(
|
|
11
11
|
'<script>something malicious</script><p>some text & more text</p>',
|
|
12
12
|
);
|
|
13
13
|
});
|
|
@@ -18,7 +18,7 @@ describe('creates safe, enphasised html', () => {
|
|
|
18
18
|
emphasisHtmlTransformer.transform(
|
|
19
19
|
'<script>something malicious</script><positive>hello</positive><negative>world</negative><positive>!</positive>',
|
|
20
20
|
),
|
|
21
|
-
).
|
|
21
|
+
).toBe(
|
|
22
22
|
'<script>something malicious</script><em class="emphasis emphasis--positive">hello</em><em class="emphasis emphasis--negative">world</em><em class="emphasis emphasis--positive">!</em>',
|
|
23
23
|
);
|
|
24
24
|
});
|
|
@@ -26,11 +26,11 @@ describe('creates safe, enphasised html', () => {
|
|
|
26
26
|
describe('supports new line characters', () => {
|
|
27
27
|
it('supports slash n in the string', () => {
|
|
28
28
|
const emphasisHtmlTransformer = new EmphasisHtmlTransformer();
|
|
29
|
-
expect(emphasisHtmlTransformer.transform('hello\\nworld')).
|
|
29
|
+
expect(emphasisHtmlTransformer.transform('hello\\nworld')).toBe('hello<br />world');
|
|
30
30
|
});
|
|
31
31
|
it('supports new line characters', () => {
|
|
32
32
|
const emphasisHtmlTransformer = new EmphasisHtmlTransformer();
|
|
33
|
-
expect(emphasisHtmlTransformer.transform('hello\nworld')).
|
|
33
|
+
expect(emphasisHtmlTransformer.transform('hello\nworld')).toBe('hello<br />world');
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
});
|
|
@@ -13,9 +13,9 @@ type Tags = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
class EmphasisHtmlTransformer {
|
|
16
|
-
tags:
|
|
16
|
+
tags: Tags[];
|
|
17
17
|
|
|
18
|
-
constructor(whitelistedTags?:
|
|
18
|
+
constructor(whitelistedTags?: string[]) {
|
|
19
19
|
this.tags = (whitelistedTags || []).map((tag) => {
|
|
20
20
|
return {
|
|
21
21
|
transformed: {
|
|
@@ -235,7 +235,12 @@ export const SendFlow = () => {
|
|
|
235
235
|
|
|
236
236
|
<Sticky>
|
|
237
237
|
<div className="d-flex justify-content-center align-items-center p-a-3">
|
|
238
|
-
<Button
|
|
238
|
+
<Button
|
|
239
|
+
v2
|
|
240
|
+
disabled={activeStep === 3}
|
|
241
|
+
block
|
|
242
|
+
onClick={() => setActiveStep(activeStep + 1)}
|
|
243
|
+
>
|
|
239
244
|
Continue
|
|
240
245
|
</Button>
|
|
241
246
|
</div>
|
package/src/inputs/Input.tsx
CHANGED
|
@@ -31,7 +31,6 @@ export const Input = forwardRef(function Input(
|
|
|
31
31
|
'np-input--shape-rectangle': shape === 'rectangle',
|
|
32
32
|
'np-input--shape-pill': shape === 'pill',
|
|
33
33
|
})}
|
|
34
|
-
// eslint-disable-next-line react/forbid-dom-props
|
|
35
34
|
style={inputPaddings}
|
|
36
35
|
{...inputAttributes}
|
|
37
36
|
{...restProps}
|
|
@@ -464,7 +464,9 @@ export const WithinDrawer: Story<Currency> = {
|
|
|
464
464
|
const [open, setOpen] = useState(context.viewMode === 'story');
|
|
465
465
|
return (
|
|
466
466
|
<>
|
|
467
|
-
<Button onClick={() => setOpen(true)}>
|
|
467
|
+
<Button v2 onClick={() => setOpen(true)}>
|
|
468
|
+
Open drawer
|
|
469
|
+
</Button>
|
|
468
470
|
<Drawer
|
|
469
471
|
open={open}
|
|
470
472
|
headerTitle="This is the title of the drawer"
|
|
@@ -485,7 +487,9 @@ export const WithinModal: Story<Currency> = {
|
|
|
485
487
|
const [open, setOpen] = useState(context.viewMode === 'story');
|
|
486
488
|
return (
|
|
487
489
|
<>
|
|
488
|
-
<Button onClick={() => setOpen(true)}>
|
|
490
|
+
<Button v2 onClick={() => setOpen(true)}>
|
|
491
|
+
Open modal
|
|
492
|
+
</Button>
|
|
489
493
|
<Modal open={open} body={<Story />} onClose={() => setOpen(false)} />
|
|
490
494
|
</>
|
|
491
495
|
);
|
|
@@ -629,13 +629,7 @@ function SelectInputOptions<T = string>({
|
|
|
629
629
|
const getItemNode = (index: number) => {
|
|
630
630
|
const item = filteredItems[index];
|
|
631
631
|
return (
|
|
632
|
-
<SelectInputItemView
|
|
633
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
634
|
-
key={index}
|
|
635
|
-
item={item}
|
|
636
|
-
renderValue={renderValue}
|
|
637
|
-
needle={needle}
|
|
638
|
-
/>
|
|
632
|
+
<SelectInputItemView key={index} item={item} renderValue={renderValue} needle={needle} />
|
|
639
633
|
);
|
|
640
634
|
};
|
|
641
635
|
|
|
@@ -19,7 +19,6 @@ export const ButtonInput = forwardRef(function ButtonInput(
|
|
|
19
19
|
ref={ref}
|
|
20
20
|
type="button"
|
|
21
21
|
className={clsx(className, inputClassNameBase({ size }), 'np-button-input')}
|
|
22
|
-
// eslint-disable-next-line react/forbid-dom-props
|
|
23
22
|
style={{ ...inputPaddings, ...style }}
|
|
24
23
|
{...restProps}
|
|
25
24
|
/>
|
package/src/inputs/_Popover.tsx
CHANGED
|
@@ -113,7 +113,6 @@ export function Popover({
|
|
|
113
113
|
'np-popover-v2-container--size-md': size === 'md',
|
|
114
114
|
'np-popover-v2-container--size-lg': size === 'lg',
|
|
115
115
|
})}
|
|
116
|
-
// eslint-disable-next-line react/forbid-dom-props
|
|
117
116
|
style={floatingStyles}
|
|
118
117
|
{...getFloatingProps()}
|
|
119
118
|
>
|
package/src/link/Link.story.tsx
CHANGED
|
@@ -30,11 +30,13 @@ export interface StoryContentProps {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const StoryContent = ({ args, screenMode }: StoryContentProps) => {
|
|
33
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
34
33
|
const [open, setOpen] = useState(args.open);
|
|
34
|
+
|
|
35
35
|
return (
|
|
36
36
|
<>
|
|
37
|
-
<Button onClick={() => setOpen(true)}>
|
|
37
|
+
<Button v2 onClick={() => setOpen(true)}>
|
|
38
|
+
Open Modal
|
|
39
|
+
</Button>
|
|
38
40
|
<Modal
|
|
39
41
|
{...args}
|
|
40
42
|
body={
|
|
@@ -62,7 +64,11 @@ export const Basic: Story = {
|
|
|
62
64
|
title: 'Title',
|
|
63
65
|
body: lorem10,
|
|
64
66
|
scroll: Scroll.VIEWPORT,
|
|
65
|
-
footer:
|
|
67
|
+
footer: (
|
|
68
|
+
<Button v2 block>
|
|
69
|
+
Action
|
|
70
|
+
</Button>
|
|
71
|
+
),
|
|
66
72
|
},
|
|
67
73
|
render: (args) => <StoryContent args={args} />,
|
|
68
74
|
};
|
|
@@ -103,7 +109,11 @@ export const WithThemeProviderInContent: Story = {
|
|
|
103
109
|
title: lorem10,
|
|
104
110
|
body: lorem100,
|
|
105
111
|
scroll: Scroll.VIEWPORT,
|
|
106
|
-
footer:
|
|
112
|
+
footer: (
|
|
113
|
+
<Button v2 block>
|
|
114
|
+
Action
|
|
115
|
+
</Button>
|
|
116
|
+
),
|
|
107
117
|
},
|
|
108
118
|
render: (args, { globals: { screenMode } }) => (
|
|
109
119
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -67,12 +67,12 @@ export function parseAmount(number: string, currency: string, locale = DEFAULT_L
|
|
|
67
67
|
const precision = getCurrencyDecimals(currency);
|
|
68
68
|
const groupSeparator = isNumberLocaleSupported() ? (10000).toLocaleString(validLocale)[2] : ',';
|
|
69
69
|
const decimalSeparator = getDecimalSeparator(validLocale);
|
|
70
|
-
const numberWithStandardDecimalSeparator = (number
|
|
70
|
+
const numberWithStandardDecimalSeparator = (number || '')
|
|
71
71
|
.replace(new RegExp(`\\${groupSeparator}`, 'g'), '')
|
|
72
72
|
.replace(new RegExp(`\\${decimalSeparator}`, 'g'), '.')
|
|
73
73
|
.replace(/[^0-9.]/g, '');
|
|
74
|
-
const parsedAmount = parseFloat(
|
|
75
|
-
parseFloat(numberWithStandardDecimalSeparator).toFixed(precision),
|
|
74
|
+
const parsedAmount = Number.parseFloat(
|
|
75
|
+
Number.parseFloat(numberWithStandardDecimalSeparator).toFixed(precision),
|
|
76
76
|
);
|
|
77
77
|
return Math.abs(parsedAmount);
|
|
78
78
|
}
|
package/src/nudge/Nudge.tsx
CHANGED
|
@@ -22,7 +22,6 @@ const getLocalStorage = (): string[] => {
|
|
|
22
22
|
return storage.map((item) => String(item));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
// eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
|
|
26
25
|
} catch (error) {}
|
|
27
26
|
|
|
28
27
|
return [];
|
|
@@ -101,7 +100,6 @@ const Nudge = ({
|
|
|
101
100
|
if (persistDismissal && id) {
|
|
102
101
|
try {
|
|
103
102
|
localStorage.setItem(STORAGE_NAME, JSON.stringify([...dismissedNudgesStorage, id]));
|
|
104
|
-
// eslint-disable-next-line unicorn/prefer-optional-catch-binding, no-empty
|
|
105
103
|
} catch (error) {}
|
|
106
104
|
|
|
107
105
|
setIsDismissed(true);
|
|
@@ -31,7 +31,11 @@ export default {
|
|
|
31
31
|
preferredPlacement: Position.BOTTOM,
|
|
32
32
|
title: 'Guaranteed rate',
|
|
33
33
|
content: <Content />,
|
|
34
|
-
children:
|
|
34
|
+
children: (
|
|
35
|
+
<Button v2 onClick={action(`I'm also triggered`)}>
|
|
36
|
+
Click here to Open Popover!
|
|
37
|
+
</Button>
|
|
38
|
+
),
|
|
35
39
|
},
|
|
36
40
|
argTypes: {
|
|
37
41
|
preferredPlacement: {
|
|
@@ -61,6 +65,10 @@ export const WithoutVisibleTitle: Story = {
|
|
|
61
65
|
title: undefined,
|
|
62
66
|
'aria-label': 'Guaranteed rate',
|
|
63
67
|
content: <Content />,
|
|
64
|
-
children:
|
|
68
|
+
children: (
|
|
69
|
+
<Button v2 onClick={action(`I'm also triggered`)}>
|
|
70
|
+
Click here to Open Popover!
|
|
71
|
+
</Button>
|
|
72
|
+
),
|
|
65
73
|
},
|
|
66
74
|
} satisfies Meta<typeof Popover>;
|
|
@@ -51,32 +51,20 @@ type Story = StoryObj<typeof PromoCardGroup>;
|
|
|
51
51
|
|
|
52
52
|
export const Default: Story = {
|
|
53
53
|
args: {
|
|
54
|
-
children:
|
|
55
|
-
<>
|
|
56
|
-
<PromoCards />
|
|
57
|
-
</>
|
|
58
|
-
),
|
|
54
|
+
children: <PromoCards />,
|
|
59
55
|
},
|
|
60
56
|
};
|
|
61
57
|
|
|
62
58
|
export const DefaultChecked: Story = {
|
|
63
59
|
args: {
|
|
64
|
-
children:
|
|
65
|
-
<>
|
|
66
|
-
<PromoCards />
|
|
67
|
-
</>
|
|
68
|
-
),
|
|
60
|
+
children: <PromoCards />,
|
|
69
61
|
defaultChecked: 'standard',
|
|
70
62
|
},
|
|
71
63
|
};
|
|
72
64
|
|
|
73
65
|
export const Disabled: Story = {
|
|
74
66
|
args: {
|
|
75
|
-
children:
|
|
76
|
-
<>
|
|
77
|
-
<PromoCards />
|
|
78
|
-
</>
|
|
79
|
-
),
|
|
67
|
+
children: <PromoCards />,
|
|
80
68
|
isDisabled: true,
|
|
81
69
|
},
|
|
82
70
|
};
|