@transferwise/components 45.14.2 → 45.15.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.
- package/build/i18n/en.json +8 -0
- package/build/index.esm.js +1001 -367
- package/build/index.esm.js.map +1 -1
- package/build/index.js +1003 -366
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/common/closeButton/CloseButton.css +1 -1
- package/build/styles/dateLookup/DateLookup.css +1 -1
- package/build/styles/inputs/Input.css +1 -1
- package/build/styles/inputs/InputGroup.css +1 -1
- package/build/styles/inputs/SelectInput.css +1 -0
- package/build/styles/inputs/TextArea.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/promoCard/PromoCard.css +1 -1
- package/build/styles/stepper/Stepper.css +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +14 -5
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/common/Option/Option.d.ts.map +1 -1
- package/build/types/common/focusBoundary/FocusBoundary.d.ts +2 -2
- package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
- package/build/types/common/hooks/useMedia.d.ts +2 -0
- package/build/types/common/hooks/useMedia.d.ts.map +1 -0
- package/build/types/common/hooks/useScreenSize.d.ts +3 -0
- package/build/types/common/hooks/useScreenSize.d.ts.map +1 -0
- package/build/types/common/preventScroll/PreventScroll.d.ts +2 -0
- package/build/types/common/preventScroll/PreventScroll.d.ts.map +1 -0
- package/build/types/dateInput/DateInput.d.ts +2 -0
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.messages.d.ts +65 -0
- package/build/types/dateLookup/DateLookup.messages.d.ts.map +1 -0
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts +3 -1
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts +7 -7
- package/build/types/dateLookup/dateTrigger/DateTrigger.messages.d.ts.map +1 -1
- package/build/types/dateLookup/tableLink/TableLink.d.ts +4 -26
- package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts +4 -29
- package/build/types/dateLookup/yearCalendar/YearCalendar.d.ts.map +1 -1
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputs/Input.d.ts +1 -0
- package/build/types/inputs/Input.d.ts.map +1 -1
- package/build/types/inputs/SearchInput.d.ts +10 -0
- package/build/types/inputs/SearchInput.d.ts.map +1 -0
- package/build/types/inputs/SelectInput.d.ts +41 -0
- package/build/types/inputs/SelectInput.d.ts.map +1 -0
- package/build/types/inputs/_BottomSheet.d.ts +17 -0
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -0
- package/build/types/inputs/_ButtonInput.d.ts +6 -0
- package/build/types/inputs/_ButtonInput.d.ts.map +1 -0
- package/build/types/inputs/_Popover.d.ts +18 -0
- package/build/types/inputs/_Popover.d.ts.map +1 -0
- package/build/types/inputs/_common.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/snackbar/Snackbar.d.ts.map +1 -1
- package/build/types/stepper/Stepper.d.ts.map +1 -1
- package/build/types/tabs/Tabs.d.ts.map +1 -1
- package/build/types/tile/Tile.d.ts.map +1 -1
- package/build/types/upload/steps/completeStep/completeStep.d.ts.map +1 -1
- package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
- package/build/types/utilities/wrapInFragment.d.ts +3 -0
- package/build/types/utilities/wrapInFragment.d.ts.map +1 -0
- package/package.json +27 -20
- package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +6 -6
- package/src/avatarWrapper/AvatarWrapper.tsx +20 -8
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +1 -1
- package/src/card/Card.spec.js +2 -2
- package/src/common/Option/Option.tsx +1 -7
- package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +8 -1
- package/src/common/closeButton/CloseButton.css +1 -1
- package/src/common/focusBoundary/FocusBoundary.tsx +9 -32
- package/src/common/hooks/useMedia.spec.ts +39 -0
- package/src/common/hooks/useMedia.ts +15 -0
- package/src/common/hooks/useScreenSize.ts +7 -0
- package/src/common/preventScroll/PreventScroll.tsx +6 -0
- package/src/dateInput/DateInput.js +6 -0
- package/src/dateInput/DateInput.story.tsx +2 -0
- package/src/dateLookup/DateLookup.css +1 -1
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -3
- package/src/dateLookup/DateLookup.less +4 -0
- package/src/dateLookup/DateLookup.messages.js +44 -0
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +39 -0
- package/src/dateLookup/dateHeader/DateHeader.js +48 -26
- package/src/dateLookup/dateHeader/DateHeader.spec.js +37 -0
- package/src/dateLookup/dayCalendar/DayCalendar.js +3 -1
- package/src/dateLookup/dayCalendar/DayCalendar.spec.js +7 -1
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +7 -3
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.spec.js +1 -0
- package/src/dateLookup/monthCalendar/MonthCalendar.js +3 -1
- package/src/dateLookup/monthCalendar/MonthCalendar.spec.js +7 -1
- package/src/dateLookup/monthCalendar/table/MonthCalendarTable.spec.js +4 -5
- package/src/dateLookup/tableLink/TableLink.js +24 -3
- package/src/dateLookup/tableLink/TableLink.spec.js +60 -4
- package/src/dateLookup/yearCalendar/YearCalendar.js +16 -3
- package/src/dateLookup/yearCalendar/YearCalendar.spec.js +14 -1
- package/src/dateLookup/yearCalendar/table/YearCalendarTable.spec.js +4 -5
- package/src/decision/Decision.story.js +11 -11
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +12 -12
- package/src/i18n/en.json +9 -0
- package/src/index.ts +8 -0
- package/src/inputs/Input.css +1 -1
- package/src/inputs/Input.less +14 -0
- package/src/inputs/Input.tsx +6 -2
- package/src/inputs/InputGroup.css +1 -1
- package/src/inputs/InputGroup.less +5 -0
- package/src/inputs/SearchInput.story.tsx +40 -0
- package/src/inputs/SearchInput.tsx +35 -0
- package/src/inputs/SelectInput.css +1 -0
- package/src/inputs/SelectInput.less +183 -0
- package/src/inputs/SelectInput.spec.tsx +120 -0
- package/src/inputs/SelectInput.story.tsx +264 -0
- package/src/inputs/SelectInput.tsx +565 -0
- package/src/inputs/TextArea.css +1 -1
- package/src/inputs/TextArea.less +5 -0
- package/src/inputs/_BottomSheet.less +107 -0
- package/src/inputs/_BottomSheet.tsx +128 -0
- package/src/inputs/_ButtonInput.less +7 -0
- package/src/inputs/_ButtonInput.tsx +27 -0
- package/src/inputs/_Popover.less +38 -0
- package/src/inputs/_Popover.tsx +118 -0
- package/src/inputs/_common.less +0 -4
- package/src/inputs/_common.ts +0 -1
- package/src/logo/Logo.js +3 -21
- package/src/logo/__snapshots__/Logo.spec.js.snap +78 -30
- package/src/main.css +1 -1
- package/src/main.less +4 -0
- package/src/phoneNumberInput/PhoneNumberInput.js +1 -0
- package/src/promoCard/PromoCard.css +1 -1
- package/src/select/searchBox/__snapshots__/SearchBox.spec.js.snap +1 -1
- package/src/snackbar/Snackbar.js +6 -1
- package/src/snackbar/Snackbar.spec.js +1 -3
- package/src/ssr.spec.js +7 -0
- package/src/stepper/Stepper.css +1 -1
- package/src/stepper/Stepper.less +1 -9
- package/src/stepper/Stepper.spec.js +4 -4
- package/src/stepper/Stepper.tsx +2 -5
- package/src/tabs/Tabs.js +2 -1
- package/src/tile/Tile.js +5 -11
- package/src/tile/__snapshots__/Tile.spec.js.snap +7 -9
- package/src/upload/Upload.js +1 -1
- package/src/upload/steps/completeStep/completeStep.js +4 -1
- package/src/upload/steps/processingStep/processingStep.js +1 -0
- package/src/uploadInput/uploadItem/UploadItem.tsx +1 -1
- package/src/utilities/wrapInFragment.tsx +3 -0
- package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts +0 -2
- package/build/types/common/focusBoundary/utils/getFocusableElements.d.ts.map +0 -1
- package/build/types/common/focusBoundary/utils/index.d.ts +0 -3
- package/build/types/common/focusBoundary/utils/index.d.ts.map +0 -1
- package/build/types/common/focusBoundary/utils/resetFocus.d.ts +0 -2
- package/build/types/common/focusBoundary/utils/resetFocus.d.ts.map +0 -1
- package/src/common/focusBoundary/FocusBoundary.spec.tsx +0 -66
- package/src/common/focusBoundary/__snapshots__/FocusBoundary.spec.tsx.snap +0 -16
- package/src/common/focusBoundary/utils/getFocusableElements.js +0 -25
- package/src/common/focusBoundary/utils/getFocusableElements.spec.js +0 -51
- package/src/common/focusBoundary/utils/index.js +0 -2
- package/src/common/focusBoundary/utils/resetFocus.js +0 -23
- package/src/common/focusBoundary/utils/resetFocus.spec.js +0 -103
- package/src/snackbar/__snapshots__/Snackbar.spec.js.snap +0 -5
- /package/src/dateLookup/dateTrigger/{DateTrigger.messages.js → DateTrigger.messages.ts} +0 -0
package/src/main.less
CHANGED
|
@@ -30,8 +30,12 @@
|
|
|
30
30
|
@import "./header/Header.less";
|
|
31
31
|
@import "./image/Image.less";
|
|
32
32
|
@import "./info/Info.less";
|
|
33
|
+
@import "./inputs/_BottomSheet.less";
|
|
34
|
+
@import "./inputs/_ButtonInput.less";
|
|
35
|
+
@import "./inputs/_Popover.less";
|
|
33
36
|
@import "./inputs/Input.less";
|
|
34
37
|
@import "./inputs/InputGroup.less";
|
|
38
|
+
@import "./inputs/SelectInput.less";
|
|
35
39
|
@import "./inputs/TextArea.less";
|
|
36
40
|
@import "./instructionsList/InstructionsList.less";
|
|
37
41
|
@import "./link/Link.less";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-Card{--Card-image-scale:1;--Card-image-translate:0;--Card-indicator-text-background-color:var(--color-background-neutral);--Card-indicator-icon-background-color:var(--color-interactive-accent);--Card-indicator-icon-color:var(--color-interactive-control);--Card-check-background-color:var(--color-interactive-primary);--Card-check-color:var(--color-interactive-control)}.np-Card--promoCard{--Card-max-width:358px}.np-Card--promoCard.is-disabled{filter:grayscale(1);opacity:.45}.np-Card-image{height:auto;left:-24px;left:calc(var(--size-24)*-1);margin:0 auto;position:relative;transform:scale(var(--Card-image-scale)) translateY(var(--Card-image-translate));transition:transform .5s ease-in-out;width:100%;width:calc(100% + 48px);width:calc(100% + var(--size-48))}[dir=rtl] .np-Card-image{left:auto;right:-24px;right:calc(var(--size-24)*-1)}.np-Card-indicator{bottom:8px;bottom:var(--size-8);display:flex;gap:4px;gap:var(--size-4);position:absolute;right:8px;right:var(--size-8)}[dir=rtl] .np-Card-indicator{left:8px;left:var(--size-8);right:auto}.np-Card-indicatorText{background:var(--Card-indicator-text-background-color);border-radius:100px;display:inline-block;padding:16px;padding:var(--size-16);text-align:left;vertical-align:middle}.np-Card-indicatorIcon{align-items:center;background:var(--Card-indicator-icon-background-color);border-radius:
|
|
1
|
+
.np-Card{--Card-image-scale:1;--Card-image-translate:0;--Card-indicator-text-background-color:var(--color-background-neutral);--Card-indicator-icon-background-color:var(--color-interactive-accent);--Card-indicator-icon-color:var(--color-interactive-control);--Card-check-background-color:var(--color-interactive-primary);--Card-check-color:var(--color-interactive-control)}.np-Card--promoCard{--Card-max-width:358px}.np-Card--promoCard.is-disabled{filter:grayscale(1);opacity:.45}.np-Card-image{height:auto;left:-24px;left:calc(var(--size-24)*-1);margin:0 auto;position:relative;transform:scale(var(--Card-image-scale)) translateY(var(--Card-image-translate));transition:transform .5s ease-in-out;width:100%;width:calc(100% + 48px);width:calc(100% + var(--size-48))}[dir=rtl] .np-Card-image{left:auto;right:-24px;right:calc(var(--size-24)*-1)}.np-Card-indicator{bottom:8px;bottom:var(--size-8);display:flex;gap:4px;gap:var(--size-4);position:absolute;right:8px;right:var(--size-8)}[dir=rtl] .np-Card-indicator{left:8px;left:var(--size-8);right:auto}.np-Card-indicatorText{background:var(--Card-indicator-text-background-color);border-radius:100px;display:inline-block;padding:16px;padding:var(--size-16);text-align:left;vertical-align:middle}.np-Card-indicatorIcon{align-items:center;background:var(--Card-indicator-icon-background-color);border-radius:9999px;border-radius:var(--radius-full);color:var(--Card-indicator-icon-color);display:inline-block;display:flex;height:56px;height:var(--size-56);justify-content:center;width:56px;width:var(--size-56)}[dir=rtl] .np-Card-indicatorIcon{transform:scaleX(-1)}.np-Card--checked,.np-Card--link{box-shadow:none;color:currentColor;cursor:pointer;transform:scale(1);transition:box-shadow .2s ease-in-out,transform .5s ease-in-out}.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--checked,.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--link{--Card-box-shadow:0px 20px var(--size-40) 0px var(--color-background-neutral);--Card-check-color:var(--color-interactive-accent)}.np-Card--checked.is-disabled,.np-Card--link.is-disabled{cursor:not-allowed}@media (prefers-reduced-motion:reduce){.np-Card--checked,.np-Card--link{transition:none}}.np-Card--checked:hover:not(.is-disabled,:disabled,.is-checked,:focus-within),.np-Card--link:hover:not(.is-disabled,:disabled,.is-checked,:focus-within){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow)}.np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral-active);--Card-image-scale:1.1;--Card-image-translate:var(--size-8);box-shadow:var(--Card-box-shadow);transform:scale(98%)}.np-theme-personal--bright-green .np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-theme-personal--bright-green .np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral)}.np-Card--checked:focus-visible:not(.is-disabled,:disabled),.np-Card--checked:has(:focus-visible):not(.np-Card--checked),.np-Card--link:focus-visible:not(.is-disabled,:disabled),.np-Card--link:has(:focus-visible):not(.np-Card--checked){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow);outline:var(--ring-outline-color) solid 4px;outline:var(--ring-outline-color) solid var(--size-4);outline-offset:4px;outline-offset:var(--size-4)}.np-Card--link .np-Card-titleLink{color:#37517e;color:var(--color-content-primary);text-decoration:none}.np-Card--link .np-Card-titleLink:focus-visible{outline:none}.np-Card--link .np-Card-titleLink:after{content:"";display:block;height:100%;left:0;position:absolute;top:0;width:100%;z-index:10}.np-Card--checked.is-checked{box-shadow:0 0 0 4px var(--color-interactive-primary);box-shadow:0 0 0 var(--size-4) var(--color-interactive-primary)}.np-Card--checked.is-checked .np-Card-check{align-items:center;background:var(--Card-check-background-color);border-radius:9999px;border-radius:var(--radius-full);color:var(--Card-check-color);display:flex;height:40px;height:var(--size-40);justify-content:center;position:absolute;right:8px;right:var(--size-8);top:8px;top:var(--size-8);width:40px;width:var(--size-40)}[dir=rtl] .np-Card--checked.is-checked .np-Card-check{left:8px;left:var(--size-8);right:auto}.np-Card--checked.is-checked:focus-visible:not(.is-disabled,:disabled){box-shadow:none}.np-CardGroup{display:flex;flex-direction:column;gap:24px;gap:var(--size-24);width:100%}@media (min-width:768px){.np-CardGroup{flex-direction:row}}.np-CardGroup .np-Card.np-Card--promoCard{max-width:100%}
|
|
@@ -34,7 +34,7 @@ exports[`SearchBox renders 1`] = `
|
|
|
34
34
|
</span>
|
|
35
35
|
</span>
|
|
36
36
|
<input
|
|
37
|
-
class="np-select-filter form-control np-form-control np-form-control--size-auto np-text-body-large np-
|
|
37
|
+
class="np-select-filter form-control np-form-control np-form-control--size-auto np-text-body-large np-input np-input--shape-rectangle"
|
|
38
38
|
placeholder="placeholder"
|
|
39
39
|
spellcheck="false"
|
|
40
40
|
value="value"
|
package/src/snackbar/Snackbar.js
CHANGED
|
@@ -91,7 +91,12 @@ export class Snackbar extends Component {
|
|
|
91
91
|
}}
|
|
92
92
|
unmountOnExit
|
|
93
93
|
>
|
|
94
|
-
<Body
|
|
94
|
+
<Body
|
|
95
|
+
ref={this.bodyRef}
|
|
96
|
+
as="span"
|
|
97
|
+
className={`snackbar__text snackbar__text--${theme}`}
|
|
98
|
+
aria-live="polite"
|
|
99
|
+
>
|
|
95
100
|
{text}
|
|
96
101
|
{action ? (
|
|
97
102
|
<ActionButton className="snackbar__text__action" onClick={action.onClick}>
|
|
@@ -71,8 +71,6 @@ describe('Snackbar', () => {
|
|
|
71
71
|
const snackbarWithNode = () => componentWithNode.find(Snackbar);
|
|
72
72
|
componentWithNode.find('.button-trigger').simulate('click');
|
|
73
73
|
expect(snackbarWithNode().text()).toContain('test');
|
|
74
|
-
|
|
75
|
-
expect(snackbarWithNode().html()).toMatchSnapshot();
|
|
76
74
|
});
|
|
77
75
|
|
|
78
76
|
it('displays a single snack for the given duration with the given text', async () => {
|
|
@@ -107,6 +105,6 @@ describe('Snackbar', () => {
|
|
|
107
105
|
);
|
|
108
106
|
const snackbarWithNode = () => componentWithNode.find(Snackbar);
|
|
109
107
|
componentWithNode.find('.button-trigger').simulate('click');
|
|
110
|
-
expect(snackbarWithNode().
|
|
108
|
+
expect(snackbarWithNode().prop('theme')).toBe('dark');
|
|
111
109
|
});
|
|
112
110
|
});
|
package/src/ssr.spec.js
CHANGED
|
@@ -48,6 +48,10 @@ const excluded = new Set([
|
|
|
48
48
|
'Typography',
|
|
49
49
|
|
|
50
50
|
// types
|
|
51
|
+
'SearchInputProps',
|
|
52
|
+
'SelectInputItem',
|
|
53
|
+
'SelectInputOptionContentProps',
|
|
54
|
+
'SelectInputProps',
|
|
51
55
|
'UploadedFile',
|
|
52
56
|
'UploadError',
|
|
53
57
|
'UploadResponse',
|
|
@@ -179,6 +183,9 @@ describe('Server side rendering', () => {
|
|
|
179
183
|
Input: {
|
|
180
184
|
children: undefined,
|
|
181
185
|
},
|
|
186
|
+
SearchInput: {
|
|
187
|
+
children: undefined,
|
|
188
|
+
},
|
|
182
189
|
TextArea: {
|
|
183
190
|
children: undefined,
|
|
184
191
|
},
|
package/src/stepper/Stepper.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.tw-stepper{padding-bottom:24px;width:100%}@media only screen and (max-width:575px){.tw-stepper{padding-bottom:0}}.tw-stepper__step{list-style-type:none;position:absolute;top:0}.tw-stepper__step--active .tw-stepper__step-label{color:#37517e;color:var(--color-content-primary);cursor:default
|
|
1
|
+
.tw-stepper{padding-bottom:24px;width:100%}@media only screen and (max-width:575px){.tw-stepper{padding-bottom:0}}.tw-stepper__step{list-style-type:none;position:absolute;top:0}.tw-stepper__step--active .tw-stepper__step-label{color:#37517e;color:var(--color-content-primary);cursor:default}.tw-stepper__step--clickable .tw-stepper__step-label{border-radius:2px;color:#0097c7;color:var(--color-content-accent);line-height:0;transition:color .15s ease-in-out}.np-theme-personal .tw-stepper__step--clickable .tw-stepper__step-label{color:#5d7079;color:var(--color-content-secondary);top:0}.tw-stepper__step--has-tooltip{cursor:pointer}@media screen and (min-width:576px) and (max-width:991px){.tw-stepper__step:first-child .tooltip-inner{transform:translateX(calc(50% - 32px))}.tw-stepper__step:last-child .tooltip-inner{transform:translateX(calc(-50% + 32px))}}.tw-stepper__step-label{color:#5d7079;color:var(--color-content-secondary);position:absolute;top:0;transform:translateX(-50%);transition:color .6s ease-in-out;white-space:nowrap}[dir=rtl] .tw-stepper__step-label{transform:translateX(50%)}.tw-stepper .tooltip{top:24px!important;white-space:nowrap}.tw-stepper .tooltip .tooltip-inner{max-width:100%}.tw-stepper .tw-tooltip-container{display:block}.tw-stepper-steps{padding:0;position:relative}[dir=rtl] .tw-stepper-steps{padding:0}.progress-bar{-webkit-backface-visibility:hidden;background-color:var(--color-interactive-primary);border-bottom-left-radius:1px;border-top-left-radius:1px;float:left;height:100%;transition:width .6s ease-in-out;will-change:width}[dir=rtl] .progress-bar{float:right}.progress-bar:after{border-radius:4px;content:"";float:right;height:8px;margin-right:-4px;margin-top:-3px;width:8px}[dir=rtl] .progress-bar:after{float:left;margin-left:-4px;margin-right:0}.btn-unstyled{background:none;border:none;display:block;margin:0;padding:0}
|
package/src/stepper/Stepper.less
CHANGED
|
@@ -19,13 +19,6 @@
|
|
|
19
19
|
.tw-stepper__step-label {
|
|
20
20
|
cursor: default;
|
|
21
21
|
color: var(--color-content-primary);
|
|
22
|
-
font-weight: 600;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.np-theme-personal & ~ li:not(.tw-stepper__step--has-tooltip:hover) {
|
|
26
|
-
.tw-stepper__step-label:not(:active,:focus) {
|
|
27
|
-
opacity: 0.45;
|
|
28
|
-
}
|
|
29
22
|
}
|
|
30
23
|
}
|
|
31
24
|
|
|
@@ -41,7 +34,7 @@
|
|
|
41
34
|
}
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
&--has-tooltip
|
|
37
|
+
&--has-tooltip {
|
|
45
38
|
cursor: pointer;
|
|
46
39
|
}
|
|
47
40
|
|
|
@@ -62,7 +55,6 @@
|
|
|
62
55
|
color: var(--color-content-secondary);
|
|
63
56
|
transition: color 0.6s ease-in-out;
|
|
64
57
|
white-space: nowrap;
|
|
65
|
-
font-weight: var(--font-weight-semi-bold);
|
|
66
58
|
.translateX(-50%);
|
|
67
59
|
}
|
|
68
60
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shallow } from 'enzyme';
|
|
2
2
|
|
|
3
|
-
import { Tooltip
|
|
3
|
+
import { Tooltip } from '..';
|
|
4
4
|
|
|
5
5
|
import Stepper from './Stepper';
|
|
6
6
|
|
|
@@ -57,7 +57,7 @@ describe('Stepper', () => {
|
|
|
57
57
|
steps(5);
|
|
58
58
|
[0, 1, 2, 3, 4].forEach((label, index) => {
|
|
59
59
|
expect(
|
|
60
|
-
component.find('.tw-stepper__step').at(index).find(
|
|
60
|
+
component.find('.tw-stepper__step').at(index).find('span').props().children,
|
|
61
61
|
).toStrictEqual(`${label}`);
|
|
62
62
|
});
|
|
63
63
|
});
|
|
@@ -173,7 +173,7 @@ describe('Stepper', () => {
|
|
|
173
173
|
const firstStepHoverLabel = step(0).children();
|
|
174
174
|
expect(firstStepHoverLabel.type()).toBe(Tooltip);
|
|
175
175
|
expect(firstStepHoverLabel.children().render().text()).toStrictEqual('label');
|
|
176
|
-
expect(step(1).find(
|
|
176
|
+
expect(step(1).find('span').props().children).toStrictEqual('label 2');
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
it('renders jsx', () => {
|
|
@@ -203,7 +203,7 @@ describe('Stepper', () => {
|
|
|
203
203
|
steps: [{ hoverLabel: 'hover', label: 'label' }, { label: 'label 2' }],
|
|
204
204
|
});
|
|
205
205
|
const firstStepHoverLabel = step(0).children();
|
|
206
|
-
expect(firstStepHoverLabel.type()).toBe(
|
|
206
|
+
expect(firstStepHoverLabel.type()).toBe('span');
|
|
207
207
|
expect(firstStepHoverLabel.props().children).toStrictEqual('label');
|
|
208
208
|
expect(step(1).children().props().children).toStrictEqual('label 2');
|
|
209
209
|
});
|
package/src/stepper/Stepper.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import Body from '../body/Body';
|
|
5
4
|
import { Position } from '../common';
|
|
6
5
|
import { useDirection } from '../common/hooks';
|
|
7
6
|
import Tooltip from '../tooltip';
|
|
@@ -49,9 +48,7 @@ const Stepper = ({ steps, activeStep = 0, className }: StepperProps) => {
|
|
|
49
48
|
<small>{step.label}</small>
|
|
50
49
|
</button>
|
|
51
50
|
) : (
|
|
52
|
-
<
|
|
53
|
-
{step.label}
|
|
54
|
-
</Body>
|
|
51
|
+
<span className="tw-stepper__step-label">{step.label}</span>
|
|
55
52
|
);
|
|
56
53
|
return (
|
|
57
54
|
<li
|
|
@@ -59,7 +56,7 @@ const Stepper = ({ steps, activeStep = 0, className }: StepperProps) => {
|
|
|
59
56
|
className={classNames(
|
|
60
57
|
'hidden-xs',
|
|
61
58
|
'tw-stepper__step',
|
|
62
|
-
active
|
|
59
|
+
active ? 'np-text-body-default-bold tw-stepper__step--active' : 'np-text-body-default',
|
|
63
60
|
clickable && 'tw-stepper__step--clickable',
|
|
64
61
|
step.hoverLabel && 'tw-stepper__step--has-tooltip',
|
|
65
62
|
)}
|
package/src/tabs/Tabs.js
CHANGED
package/src/tile/Tile.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useTheme } from '@wise/components-theming';
|
|
2
1
|
import classNames from 'classnames';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
|
|
@@ -18,7 +17,6 @@ export const Tile = ({
|
|
|
18
17
|
title,
|
|
19
18
|
}) => {
|
|
20
19
|
const isSmall = size === Size.SMALL;
|
|
21
|
-
const { isModern } = useTheme();
|
|
22
20
|
const Element = href ? 'a' : 'button';
|
|
23
21
|
|
|
24
22
|
return (
|
|
@@ -31,16 +29,13 @@ export const Tile = ({
|
|
|
31
29
|
'text-xs-center',
|
|
32
30
|
className,
|
|
33
31
|
{
|
|
34
|
-
'p-a-3': !isSmall
|
|
35
|
-
'p-
|
|
36
|
-
'p-a-2': isSmall,
|
|
37
|
-
'np-tile--small': isSmall,
|
|
38
|
-
disabled,
|
|
32
|
+
'p-a-3': !isSmall,
|
|
33
|
+
'p-a-2 np-tile--small': isSmall,
|
|
39
34
|
},
|
|
35
|
+
disabled && 'disabled',
|
|
40
36
|
)}
|
|
41
37
|
href={href}
|
|
42
38
|
target={target}
|
|
43
|
-
aria-label={title}
|
|
44
39
|
onClick={disabled ? null : onClick}
|
|
45
40
|
onKeyDown={
|
|
46
41
|
disabled
|
|
@@ -56,12 +51,11 @@ export const Tile = ({
|
|
|
56
51
|
<Title type={Typography.TITLE_SUBSECTION} className={classNames(isSmall ? 'm-t-1' : 'm-t-2')}>
|
|
57
52
|
{title}
|
|
58
53
|
</Title>
|
|
59
|
-
{
|
|
54
|
+
{description ? (
|
|
60
55
|
<Body as="span" type={Typography.BODY_DEFAULT} className="m-t-1">
|
|
61
56
|
{description}
|
|
62
57
|
</Body>
|
|
63
|
-
)}
|
|
64
|
-
{!isModern && description && <div className="np-tile__description">{description}</div>}
|
|
58
|
+
) : null}
|
|
65
59
|
</Element>
|
|
66
60
|
);
|
|
67
61
|
};
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
exports[`Tile matches snapshot when regular size 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<a
|
|
6
|
-
|
|
7
|
-
class="decision flex-column np-tile text-no-decoration text-xs-center p-y-5 p-x-4"
|
|
6
|
+
class="decision flex-column np-tile text-no-decoration text-xs-center p-a-3"
|
|
8
7
|
href="#href"
|
|
9
8
|
>
|
|
10
9
|
<div
|
|
@@ -19,11 +18,11 @@ exports[`Tile matches snapshot when regular size 1`] = `
|
|
|
19
18
|
>
|
|
20
19
|
Receive money
|
|
21
20
|
</h3>
|
|
22
|
-
<
|
|
23
|
-
class="np-
|
|
21
|
+
<span
|
|
22
|
+
class="np-text-body-default m-t-1"
|
|
24
23
|
>
|
|
25
24
|
Receive money from friends and family like a local
|
|
26
|
-
</
|
|
25
|
+
</span>
|
|
27
26
|
</a>
|
|
28
27
|
</DocumentFragment>
|
|
29
28
|
`;
|
|
@@ -31,7 +30,6 @@ exports[`Tile matches snapshot when regular size 1`] = `
|
|
|
31
30
|
exports[`Tile matches snapshot when small size 1`] = `
|
|
32
31
|
<DocumentFragment>
|
|
33
32
|
<a
|
|
34
|
-
aria-label="Receive money"
|
|
35
33
|
class="decision flex-column np-tile text-no-decoration text-xs-center p-a-2 np-tile--small"
|
|
36
34
|
href="#href"
|
|
37
35
|
>
|
|
@@ -47,11 +45,11 @@ exports[`Tile matches snapshot when small size 1`] = `
|
|
|
47
45
|
>
|
|
48
46
|
Receive money
|
|
49
47
|
</h3>
|
|
50
|
-
<
|
|
51
|
-
class="np-
|
|
48
|
+
<span
|
|
49
|
+
class="np-text-body-default m-t-1"
|
|
52
50
|
>
|
|
53
51
|
Receive money from friends and family like a local
|
|
54
|
-
</
|
|
52
|
+
</span>
|
|
55
53
|
</a>
|
|
56
54
|
</DocumentFragment>
|
|
57
55
|
`;
|
package/src/upload/Upload.js
CHANGED
|
@@ -344,7 +344,7 @@ class Upload extends Component {
|
|
|
344
344
|
/>
|
|
345
345
|
)}
|
|
346
346
|
{!isProcessing && (
|
|
347
|
-
<div className="droppable-dropping-card droppable-card">
|
|
347
|
+
<div className="droppable-dropping-card droppable-card" aria-live="polite">
|
|
348
348
|
<div className="droppable-card-content">
|
|
349
349
|
<div className="circle circle-sm text-primary">
|
|
350
350
|
<PlusIcon size="16" />
|
|
@@ -26,7 +26,10 @@ const CompleteStep = (props) => {
|
|
|
26
26
|
return (
|
|
27
27
|
<div className="droppable-complete-card droppable-card" aria-hidden={!isComplete}>
|
|
28
28
|
<div className="droppable-card-content">
|
|
29
|
-
<div
|
|
29
|
+
<div
|
|
30
|
+
className="droppable-card-content d-flex flex-column align-items-center"
|
|
31
|
+
aria-live="polite"
|
|
32
|
+
>
|
|
30
33
|
{isError ? (
|
|
31
34
|
<>
|
|
32
35
|
{isModern ? (
|
|
@@ -134,7 +134,7 @@ const UploadItem = ({
|
|
|
134
134
|
singleFileUpload={singleFileUpload}
|
|
135
135
|
onDownload={onDownloadFile}
|
|
136
136
|
>
|
|
137
|
-
<div className="np-upload-button">
|
|
137
|
+
<div className="np-upload-button" aria-live="polite">
|
|
138
138
|
<div className="media">
|
|
139
139
|
<div className="np-upload-icon media-left">{getIcon()}</div>
|
|
140
140
|
<div className="media-body text-xs-left" data-testid={TEST_IDS.mediaBody}>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getFocusableElements.d.ts","sourceRoot":"","sources":["../../../../../src/common/focusBoundary/utils/getFocusableElements.js"],"names":[],"mappings":"AAOO,6DAJI,IAAI,GACF,MAAM,CAoBlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/focusBoundary/utils/index.js"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resetFocus.d.ts","sourceRoot":"","sources":["../../../../../src/common/focusBoundary/utils/resetFocus.js"],"names":[],"mappings":"AAOO,qEAJI,MAAM,QAmBhB"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { render, screen, userEvent } from '../../test-utils';
|
|
2
|
-
|
|
3
|
-
import FocusBoundary from './FocusBoundary';
|
|
4
|
-
|
|
5
|
-
const props = {
|
|
6
|
-
onClose: jest.fn(),
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
describe('FocusBoundary', () => {
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
jest.clearAllMocks();
|
|
12
|
-
});
|
|
13
|
-
it('renders component', () => {
|
|
14
|
-
const { container } = render(
|
|
15
|
-
<FocusBoundary {...props}>
|
|
16
|
-
<a href="test">Test</a>
|
|
17
|
-
</FocusBoundary>,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
expect(container).toMatchSnapshot();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('focus on container by default', () => {
|
|
24
|
-
render(
|
|
25
|
-
<>
|
|
26
|
-
<a href="test">not focusable</a>
|
|
27
|
-
<FocusBoundary {...props}>
|
|
28
|
-
<a href="test">Test</a>
|
|
29
|
-
</FocusBoundary>
|
|
30
|
-
</>,
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
expect(focusBoundary()).toHaveFocus();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('traps the focus when user presses tab', () => {
|
|
37
|
-
render(
|
|
38
|
-
<>
|
|
39
|
-
<a href="test">not focusable</a>
|
|
40
|
-
<FocusBoundary {...props}>
|
|
41
|
-
<a href="test">firstFocusable</a>
|
|
42
|
-
<a href="test">lastFocusable</a>
|
|
43
|
-
</FocusBoundary>
|
|
44
|
-
</>,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
userEvent.tab();
|
|
48
|
-
expect(firstFocusableElement()).toHaveFocus();
|
|
49
|
-
|
|
50
|
-
userEvent.tab();
|
|
51
|
-
expect(lastFocusableElement()).toHaveFocus();
|
|
52
|
-
|
|
53
|
-
userEvent.tab();
|
|
54
|
-
expect(firstFocusableElement()).toHaveFocus();
|
|
55
|
-
|
|
56
|
-
userEvent.tab({ shift: true });
|
|
57
|
-
expect(lastFocusableElement()).toHaveFocus();
|
|
58
|
-
|
|
59
|
-
userEvent.tab({ shift: true });
|
|
60
|
-
expect(firstFocusableElement()).toHaveFocus();
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const firstFocusableElement = () => screen.getByText('firstFocusable');
|
|
64
|
-
const lastFocusableElement = () => screen.getByText('lastFocusable');
|
|
65
|
-
const focusBoundary = () => document.querySelector('.np-focus-boundary');
|
|
66
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This function returns the first and the last focusable elements within a node.
|
|
3
|
-
*
|
|
4
|
-
* @param {Node} focusBoundaryContainer - the area that contains focused elements.
|
|
5
|
-
* @returns {object} focusableEls - which contains the first focusable element and the last focusable element. First and last can be the same element if area contains one or none focusable element.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const getFocusableElements = (focusBoundaryContainer) => {
|
|
9
|
-
const focusableEls = { first: focusBoundaryContainer, last: focusBoundaryContainer };
|
|
10
|
-
|
|
11
|
-
if (focusBoundaryContainer?.querySelectorAll) {
|
|
12
|
-
const allEls = [
|
|
13
|
-
...focusBoundaryContainer.querySelectorAll(
|
|
14
|
-
'a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])',
|
|
15
|
-
),
|
|
16
|
-
].filter((element) => !element.hasAttribute('disabled'));
|
|
17
|
-
|
|
18
|
-
if (allEls.length > 0) {
|
|
19
|
-
[focusableEls.first] = allEls;
|
|
20
|
-
focusableEls.last = allEls[allEls.length - 1];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return focusableEls;
|
|
25
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { cleanup, render, screen } from '../../../test-utils';
|
|
2
|
-
|
|
3
|
-
import { getFocusableElements } from './getFocusableElements';
|
|
4
|
-
|
|
5
|
-
describe('getFocusableElements', () => {
|
|
6
|
-
afterEach(() => {
|
|
7
|
-
cleanup();
|
|
8
|
-
});
|
|
9
|
-
it('returns first and last focusable element', () => {
|
|
10
|
-
const { container } = render(
|
|
11
|
-
<>
|
|
12
|
-
<div>another element</div>
|
|
13
|
-
<a href="test">first</a>
|
|
14
|
-
<div>another element</div>
|
|
15
|
-
<a href="test">middle</a>
|
|
16
|
-
<div>another element</div>
|
|
17
|
-
<a href="test">last</a>
|
|
18
|
-
<div>another element</div>
|
|
19
|
-
</>,
|
|
20
|
-
);
|
|
21
|
-
getFocusableElements(container);
|
|
22
|
-
expect(getFocusableElements(container)).toStrictEqual({
|
|
23
|
-
first: first(),
|
|
24
|
-
last: last(),
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('returns container if there are no focusable elements', () => {
|
|
29
|
-
const { container } = render(
|
|
30
|
-
<>
|
|
31
|
-
<div>another element</div>
|
|
32
|
-
</>,
|
|
33
|
-
);
|
|
34
|
-
getFocusableElements(container);
|
|
35
|
-
expect(getFocusableElements(container)).toStrictEqual({
|
|
36
|
-
first: container,
|
|
37
|
-
last: container,
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('returns undefined if container is not provided', () => {
|
|
42
|
-
getFocusableElements();
|
|
43
|
-
expect(getFocusableElements()).toStrictEqual({
|
|
44
|
-
first: undefined,
|
|
45
|
-
last: undefined,
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const first = () => screen.getByText('first');
|
|
50
|
-
const last = () => screen.getByText('last');
|
|
51
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This function resets the focus to either last of first focusable elements within a node.
|
|
3
|
-
*
|
|
4
|
-
* @param {object} focusableEls - contains the first last of first focusable elements within a node.
|
|
5
|
-
* @param {object} event - the triggered event
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const resetFocus = ({ focusableEls: { first, last }, event }) => {
|
|
9
|
-
const { activeElement } = document;
|
|
10
|
-
if (event.shiftKey && activeElement === first) {
|
|
11
|
-
if (last) {
|
|
12
|
-
last.focus();
|
|
13
|
-
}
|
|
14
|
-
event.preventDefault();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (!event.shiftKey && activeElement === last) {
|
|
18
|
-
if (first) {
|
|
19
|
-
first.focus();
|
|
20
|
-
}
|
|
21
|
-
event.preventDefault();
|
|
22
|
-
}
|
|
23
|
-
};
|