@transferwise/components 0.0.0-experimental-05a786f → 0.0.0-experimental-278276c
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 +0 -1
- package/build/index.esm.js +206 -229
- package/build/index.esm.js.map +1 -1
- package/build/index.js +206 -229
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/actionButton/ActionButton.css +1 -1
- package/build/styles/chips/Chip.css +1 -1
- package/build/styles/circularButton/CircularButton.css +1 -1
- package/build/styles/common/Option/Option.css +1 -1
- package/build/styles/common/bottomSheet/BottomSheet.css +1 -1
- package/build/styles/common/closeButton/CloseButton.css +1 -1
- package/build/styles/dateLookup/DateLookup.css +1 -1
- package/build/styles/drawer/Drawer.css +1 -1
- package/build/styles/flowNavigation/FlowNavigation.css +1 -1
- package/build/styles/inputs/SelectInput.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/overlayHeader/OverlayHeader.css +1 -1
- package/build/styles/statusIcon/StatusIcon.css +1 -1
- package/build/styles/summary/Summary.css +1 -1
- package/build/styles/typeahead/Typeahead.css +1 -1
- package/build/styles/uploadInput/UploadInput.css +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/propsValues/breakpoint.d.ts +1 -0
- package/build/types/common/propsValues/breakpoint.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +11 -1
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/types/test-utils/window-mock.d.ts +2 -0
- package/build/types/test-utils/window-mock.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/actionButton/ActionButton.css +1 -1
- package/src/actionButton/ActionButton.less +5 -1
- package/src/chips/Chip.css +1 -1
- package/src/chips/Chip.less +8 -0
- package/src/circularButton/CircularButton.css +1 -1
- package/src/circularButton/CircularButton.less +9 -3
- package/src/common/Option/Option.css +1 -1
- package/src/common/Option/Option.less +6 -0
- package/src/common/bottomSheet/BottomSheet.css +1 -1
- package/src/common/bottomSheet/BottomSheet.less +1 -1
- package/src/common/bottomSheet/BottomSheet.spec.tsx +4 -1
- package/src/common/bottomSheet/BottomSheet.story.tsx +4 -0
- package/src/common/bottomSheet/BottomSheet.tsx +10 -1
- package/src/common/closeButton/CloseButton.css +1 -1
- package/src/common/closeButton/CloseButton.less +12 -0
- package/src/common/hooks/useMedia.spec.ts +3 -17
- package/src/common/propsValues/breakpoint.ts +1 -0
- package/src/dateLookup/DateLookup.css +1 -1
- package/src/dateLookup/DateLookup.js +7 -3
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -0
- package/src/dateLookup/DateLookup.less +6 -0
- package/src/dateLookup/DateLookup.story.js +6 -1
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +3 -1
- package/src/dateLookup/DateLookup.view.spec.js +4 -0
- package/src/dateLookup/dateHeader/DateHeader.js +4 -2
- package/src/drawer/Drawer.css +1 -1
- package/src/drawer/Drawer.less +6 -8
- package/src/drawer/Drawer.story.js +42 -2
- package/src/flowNavigation/FlowNavigation.css +1 -1
- package/src/i18n/en.json +0 -1
- package/src/inputs/SelectInput.css +1 -1
- package/src/inputs/SelectInput.less +0 -12
- package/src/inputs/SelectInput.tsx +22 -55
- package/src/inputs/_BottomSheet.tsx +19 -19
- package/src/main.css +1 -1
- package/src/modal/Modal.tsx +2 -2
- package/src/overlayHeader/OverlayHeader.css +1 -1
- package/src/popover/Popover.spec.js +3 -1
- package/src/select/Select.spec.js +6 -9
- package/src/statusIcon/StatusIcon.css +1 -1
- package/src/statusIcon/StatusIcon.less +10 -0
- package/src/summary/Summary.css +1 -1
- package/src/summary/Summary.less +1 -1
- package/src/test-utils/index.js +1 -0
- package/src/test-utils/story-config.ts +21 -7
- package/src/test-utils/window-mock.ts +19 -0
- package/src/typeahead/Typeahead.css +1 -1
- package/src/typeahead/Typeahead.less +5 -6
- package/src/uploadInput/UploadInput.css +1 -1
- package/src/uploadInput/UploadInput.less +5 -1
- package/build/types/inputs/SelectInput.messages.d.ts +0 -9
- package/build/types/inputs/SelectInput.messages.d.ts.map +0 -1
- package/src/inputs/SelectInput.messages.ts +0 -9
|
@@ -2,10 +2,12 @@ import '@testing-library/jest-dom';
|
|
|
2
2
|
import user from '@testing-library/user-event';
|
|
3
3
|
|
|
4
4
|
import { Breakpoint } from '../common';
|
|
5
|
-
import { render, screen, fireEvent } from '../test-utils';
|
|
5
|
+
import { render, screen, fireEvent, mockMatchMedia } from '../test-utils';
|
|
6
6
|
|
|
7
7
|
import DateLookup from '.';
|
|
8
8
|
|
|
9
|
+
mockMatchMedia();
|
|
10
|
+
|
|
9
11
|
jest.mock(
|
|
10
12
|
'../dimmer',
|
|
11
13
|
() =>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { shallow } from 'enzyme';
|
|
2
2
|
|
|
3
|
+
import { mockMatchMedia } from '../test-utils';
|
|
4
|
+
|
|
3
5
|
import DateTrigger from './dateTrigger';
|
|
4
6
|
import DayCalendar from './dayCalendar';
|
|
5
7
|
import MonthCalendar from './monthCalendar';
|
|
@@ -7,6 +9,8 @@ import YearCalendar from './yearCalendar';
|
|
|
7
9
|
|
|
8
10
|
import DateLookup from '.';
|
|
9
11
|
|
|
12
|
+
mockMatchMedia();
|
|
13
|
+
|
|
10
14
|
const defaultLocale = 'en-GB';
|
|
11
15
|
jest.mock('react-intl', () => ({
|
|
12
16
|
injectIntl: (Component) =>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import { useIntl } from 'react-intl';
|
|
3
4
|
|
|
4
5
|
import Chevron from '../../chevron';
|
|
5
6
|
import { Position, Size, Typography } from '../../common';
|
|
7
|
+
import { useLayout } from '../../common/hooks';
|
|
6
8
|
import Title from '../../title';
|
|
7
9
|
import messages from '../DateLookup.messages';
|
|
8
10
|
|
|
@@ -10,9 +12,9 @@ const buttonClasses = 'btn-link p-a-0 text-no-decoration np-text-body-large-bold
|
|
|
10
12
|
|
|
11
13
|
const DateHeader = ({ label, onLabelClick, onPreviousClick, onNextClick, dateMode }) => {
|
|
12
14
|
const intl = useIntl();
|
|
13
|
-
|
|
15
|
+
const { isMobile } = useLayout();
|
|
14
16
|
return (
|
|
15
|
-
<div className=
|
|
17
|
+
<div className={classNames('text-xs-center', !isMobile && ['clearfix', 'p-y-1'])}>
|
|
16
18
|
<div className="pull-left-single-direction">
|
|
17
19
|
<button
|
|
18
20
|
type="button"
|
package/src/drawer/Drawer.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-drawer{display:flex;flex-direction:column;height:100vh;height:100dvh;justify-content:space-between;max-height:100vh;max-height:100dvh;max-width:600px;width:100vw}.np-drawer .np-drawer-header{display:flex;flex-wrap:nowrap;min-height:56px;min-height:var(--size-56);padding:24px 16px;padding:var(--size-24) var(--size-16)}.np-theme-personal .np-drawer .np-drawer-header{padding:24px;padding:var(--size-24)}.np-theme-personal .np-drawer .np-drawer-header
|
|
1
|
+
.np-drawer{display:flex;flex-direction:column;height:100vh;height:100dvh;justify-content:space-between;max-height:100vh;max-height:100dvh;max-width:600px;width:100vw}@media (max-width:770px){.np-drawer{max-width:unset}}.np-drawer .np-drawer-header{align-items:center;display:flex;flex-wrap:nowrap;min-height:56px;min-height:var(--size-56);padding:24px 16px;padding:var(--size-24) var(--size-16)}.np-theme-personal .np-drawer .np-drawer-header{padding:24px;padding:var(--size-24)}@media (max-width:320px){.np-theme-personal .np-drawer .np-drawer-header{padding:16px;padding:var(--size-16)}}.np-theme-personal .np-drawer .np-drawer-header .np-close-button{margin-bottom:-8px;margin-bottom:calc(var(--size-8)*-1);margin-right:-8px;margin-right:calc(var(--size-8)*-1);margin-top:-8px;margin-top:calc(var(--size-8)*-1)}.np-drawer .np-drawer-header.np-drawer-header--withborder{box-shadow:inset 0 -1px 0 0 #e2e6e8}.np-theme-personal .np-drawer .np-drawer-header.np-drawer-header--withborder{box-shadow:inset 0 -1px 0 0 #0000001a;box-shadow:inset 0 -1px 0 0 var(--color-border-neutral)}.np-drawer .np-drawer-header .np-text-title-body{font-size:1.125rem;font-size:var(--font-size-18);letter-spacing:-.01em;letter-spacing:var(--letter-spacing-negative-xs);line-height:1.5rem;line-height:var(--line-height-24);margin-right:16px;margin-right:var(--size-16)}.np-drawer .np-drawer-header .np-close-button{margin-left:auto}.np-drawer .np-drawer-header .tw-icon{fill:#00b9ff;cursor:pointer;display:block}.np-drawer .np-drawer-content{flex:1;overflow-y:auto}.np-drawer .np-drawer-content,.np-drawer .np-drawer-footer{padding:16px;padding:var(--size-16)}.np-drawer .np-drawer-footer{box-shadow:inset 0 1px 0 0 #e2e6e8}.np-theme-personal .np-drawer .np-drawer-footer{box-shadow:inset 0 1px 0 0 #0000001a;box-shadow:inset 0 1px 0 0 var(--color-border-neutral)}@media (min-width:768px){.np-drawer .np-drawer-header{padding:32px 24px;padding:var(--size-32) var(--size-24)}.np-drawer .np-drawer-content,.np-drawer .np-drawer-footer,.np-theme-personal .np-drawer .np-drawer-header{padding:24px;padding:var(--size-24)}}
|
package/src/drawer/Drawer.less
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
width: 100vw;
|
|
9
9
|
max-width: 600px;
|
|
10
|
+
@media (max-width: 770px) {
|
|
11
|
+
max-width: unset;
|
|
12
|
+
}
|
|
10
13
|
height: 100vh;
|
|
11
14
|
height: 100dvh;
|
|
12
15
|
max-height: 100vh;
|
|
@@ -14,16 +17,15 @@
|
|
|
14
17
|
|
|
15
18
|
.np-drawer-header {
|
|
16
19
|
display: flex;
|
|
20
|
+
align-items: center;
|
|
17
21
|
flex-wrap: nowrap;
|
|
18
22
|
min-height: var(--size-56);
|
|
19
23
|
padding: var(--size-24) var(--size-16);
|
|
20
24
|
|
|
21
25
|
.np-theme-personal & {
|
|
22
26
|
padding: var(--size-24);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
padding-top: 0;
|
|
26
|
-
margin-bottom: 0;
|
|
27
|
+
@media (--screen-400-zoom) {
|
|
28
|
+
padding: var(--size-16);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
.np-close-button {
|
|
@@ -44,14 +46,10 @@
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
.np-text-title-body {
|
|
47
|
-
@vertical-alignment-shift: 2px;
|
|
48
|
-
|
|
49
49
|
margin-right: var(--size-16);
|
|
50
50
|
font-size: var(--font-size-18);
|
|
51
51
|
letter-spacing: var(--letter-spacing-negative-xs);
|
|
52
52
|
line-height: var(--line-height-24);
|
|
53
|
-
padding-top: @vertical-alignment-shift;
|
|
54
|
-
margin-bottom: -@vertical-alignment-shift;
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
.np-close-button {
|
|
@@ -2,7 +2,8 @@ import { select } from '@storybook/addon-knobs';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Section, Button, Input, Modal } from '..';
|
|
5
|
-
import { Position } from '../common';
|
|
5
|
+
import { Position, Priority } from '../common';
|
|
6
|
+
import { storyConfig } from '../test-utils';
|
|
6
7
|
|
|
7
8
|
import Drawer from './Drawer';
|
|
8
9
|
|
|
@@ -40,7 +41,10 @@ export const Basic = () => {
|
|
|
40
41
|
footerContent={
|
|
41
42
|
<>
|
|
42
43
|
<Button block onClick={() => {}}>
|
|
43
|
-
Action
|
|
44
|
+
Action 1
|
|
45
|
+
</Button>
|
|
46
|
+
<Button block priority={Priority.SECONDARY} onClick={() => {}}>
|
|
47
|
+
Action 2
|
|
44
48
|
</Button>
|
|
45
49
|
</>
|
|
46
50
|
}
|
|
@@ -77,6 +81,42 @@ export const Basic = () => {
|
|
|
77
81
|
onClose={handleModalClose}
|
|
78
82
|
/>
|
|
79
83
|
</Section>
|
|
84
|
+
<p>
|
|
85
|
+
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
86
|
+
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
87
|
+
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
88
|
+
stumptown try-hard chartreuse.
|
|
89
|
+
</p>
|
|
90
|
+
<p>
|
|
91
|
+
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
92
|
+
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
93
|
+
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
94
|
+
stumptown try-hard chartreuse.
|
|
95
|
+
</p>
|
|
96
|
+
<p>
|
|
97
|
+
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
98
|
+
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
99
|
+
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
100
|
+
stumptown try-hard chartreuse.
|
|
101
|
+
</p>
|
|
102
|
+
<p>
|
|
103
|
+
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
104
|
+
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
105
|
+
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
106
|
+
stumptown try-hard chartreuse.
|
|
107
|
+
</p>
|
|
108
|
+
<p>
|
|
109
|
+
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
110
|
+
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
111
|
+
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
112
|
+
stumptown try-hard chartreuse.
|
|
113
|
+
</p>
|
|
114
|
+
<p>
|
|
115
|
+
I am baby actually poke kickstarter, street art jean shorts bespoke chambray activated
|
|
116
|
+
charcoal ramps marfa shoreditch tumeric tumblr. Mixtape cred palo santo, cliche lyft marfa
|
|
117
|
+
ethical waistcoat poke jean shorts. Scenester readymade selvage disrupt pok pok. La croix
|
|
118
|
+
stumptown try-hard chartreuse.
|
|
119
|
+
</p>
|
|
80
120
|
</Drawer>
|
|
81
121
|
</>
|
|
82
122
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-flow-navigation{min-height:97px;width:100%}.np-flow-navigation--border-bottom{border-bottom:1px solid #0000001a;border-bottom:1px solid var(--color-border-neutral);min-height:96px}.np-flow-navigation__content{max-width:1164px;min-width:320px;width:100%}.np-flow-navigation__stepper{padding-bottom:0!important}[dir=rtl] .np-flow-navigation__stepper{padding-right:0!important}[dir=rtl] .np-flow-navigation__stepper,html:not([dir=rtl]) .np-flow-navigation__stepper{padding-left:0!important}html:not([dir=rtl]) .np-flow-navigation__stepper{padding-right:0!important}.np-flow-navigation--xs-max .np-flow-navigation__stepper .tw-stepper-steps{display:none}.np-flow-navigation--xs-max .np-flow-navigation__stepper .progress{margin-bottom:0}.np-flow-navigation--xs-max .np-animated-label{height:auto}.np-flow-navigation--sm .np-flow-navigation__stepper{min-height:56px}[dir=rtl] .np-flow-navigation--sm .np-flow-navigation__stepper{padding-right:24px!important}[dir=rtl] .np-flow-navigation--sm .np-flow-navigation__stepper,html:not([dir=rtl]) .np-flow-navigation--sm .np-flow-navigation__stepper{padding-left:24px!important}html:not([dir=rtl]) .np-flow-navigation--sm .np-flow-navigation__stepper{padding-right:24px!important}.np-flow-navigation--lg .np-flow-navigation__stepper{max-width:562px}.np-flow-navigation--lg .np-flow-header__left,.np-flow-navigation--lg .np-flow-header__right{width:180px}.np-flow-navigation .separator{background-color:#0000001a;background-color:var(--color-border-neutral);height:32px;height:var(--size-32);min-width:1px;width:1px}[dir=rtl] .np-flow-navigation .separator{margin-right:16px!important}[dir=rtl] .np-flow-navigation .separator,html:not([dir=rtl]) .np-flow-navigation .separator{margin-left:16px!important}html:not([dir=rtl]) .np-flow-navigation .separator{margin-right:16px!important}.np-flow-navigation--hidden{visibility:hidden}.np-theme-personal--bright-green .np-flow-navigation .np-flow-header__left path,.np-theme-personal--dark .np-flow-navigation .np-flow-header__left path,.np-theme-personal--forest-green .np-flow-navigation .np-flow-header__left path{fill:var(--color-interactive-primary)}
|
|
1
|
+
.np-flow-navigation{min-height:97px;width:100%}.np-flow-navigation--border-bottom{border-bottom:1px solid #0000001a;border-bottom:1px solid var(--color-border-neutral);min-height:96px}.np-flow-navigation__content{max-width:1164px;min-width:320px;width:100%}.np-flow-navigation__stepper{padding-bottom:0!important}[dir=rtl] .np-flow-navigation__stepper{padding-right:0!important}[dir=rtl] .np-flow-navigation__stepper,html:not([dir=rtl]) .np-flow-navigation__stepper{padding-left:0!important}html:not([dir=rtl]) .np-flow-navigation__stepper{padding-right:0!important}.np-flow-navigation--xs-max .np-flow-navigation__stepper .tw-stepper-steps{display:none}.np-flow-navigation--xs-max .np-flow-navigation__stepper .progress{margin-bottom:0}.np-flow-navigation--xs-max .np-animated-label{height:auto}.np-flow-navigation--sm .np-flow-navigation__stepper{min-height:56px}[dir=rtl] .np-flow-navigation--sm .np-flow-navigation__stepper{padding-right:24px!important;padding-right:var(--size-24)!important}[dir=rtl] .np-flow-navigation--sm .np-flow-navigation__stepper,html:not([dir=rtl]) .np-flow-navigation--sm .np-flow-navigation__stepper{padding-left:24px!important;padding-left:var(--size-24)!important}html:not([dir=rtl]) .np-flow-navigation--sm .np-flow-navigation__stepper{padding-right:24px!important;padding-right:var(--size-24)!important}.np-flow-navigation--lg .np-flow-navigation__stepper{max-width:562px}.np-flow-navigation--lg .np-flow-header__left,.np-flow-navigation--lg .np-flow-header__right{width:180px}.np-flow-navigation .separator{background-color:#0000001a;background-color:var(--color-border-neutral);height:32px;height:var(--size-32);min-width:1px;width:1px}[dir=rtl] .np-flow-navigation .separator{margin-right:16px!important;margin-right:var(--size-16)!important}[dir=rtl] .np-flow-navigation .separator,html:not([dir=rtl]) .np-flow-navigation .separator{margin-left:16px!important;margin-left:var(--size-16)!important}html:not([dir=rtl]) .np-flow-navigation .separator{margin-right:16px!important;margin-right:var(--size-16)!important}.np-flow-navigation--hidden{visibility:hidden}.np-theme-personal--bright-green .np-flow-navigation .np-flow-header__left path,.np-theme-personal--dark .np-flow-navigation .np-flow-header__left path,.np-theme-personal--forest-green .np-flow-navigation .np-flow-header__left path{fill:var(--color-interactive-primary)}
|
package/src/i18n/en.json
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"neptune.Link.opensInNewTab": "(opens in new tab)",
|
|
19
19
|
"neptune.MoneyInput.Select.placeholder": "Select an option...",
|
|
20
20
|
"neptune.Select.searchPlaceholder": "Search...",
|
|
21
|
-
"neptune.SelectInput.noResultsFound": "No results found",
|
|
22
21
|
"neptune.Summary.statusDone": "Item done",
|
|
23
22
|
"neptune.Summary.statusNotDone": "Item to do",
|
|
24
23
|
"neptune.Summary.statusPending": "Item pending",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-bottom-sheet-v2-container{position:relative;z-index:1060}.np-bottom-sheet-v2-backdrop-container--enter,.np-bottom-sheet-v2-backdrop-container--leave{transition-duration:.15s;transition-property:opacity;transition-timing-function:ease-out}.np-bottom-sheet-v2-backdrop-container--enter-from,.np-bottom-sheet-v2-backdrop-container--leave-to{opacity:0}.np-bottom-sheet-v2-backdrop{background-color:#37517e;background-color:var(--color-content-primary);inset:0;opacity:.4;position:fixed}.np-bottom-sheet-v2{display:flex;flex-direction:column;inset:0;justify-content:flex-end;padding-left:8px;padding-left:var(--size-8);padding-right:8px;padding-right:var(--size-8);padding-top:64px;padding-top:var(--size-64);position:fixed}.np-bottom-sheet-v2-content{max-height:100%}.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-duration:.3s;transition-property:transform;transition-timing-function:ease-out}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-property:opacity}}@media (prefers-reduced-motion:no-preference){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{transform:translateY(100%)}}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{opacity:0}}.np-bottom-sheet-v2-content-inner-container{background-color:#fff;background-color:var(--color-background-elevated);border-top-left-radius:32px;border-top-right-radius:32px;box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;height:100%}.np-bottom-sheet-v2-content-inner-container:focus{outline:none}.np-bottom-sheet-v2-header{align-self:flex-end;padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-content-inner{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;padding-top:0;row-gap:8px;row-gap:var(--size-8)}.np-bottom-sheet-v2-content-inner--has-title{grid-template-rows:auto 1fr}.np-bottom-sheet-v2-content-inner--padding-md{padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-title{color:#37517e;color:var(--color-content-primary)}.np-bottom-sheet-v2-body{color:#5d7079;color:var(--color-content-secondary)}.np-button-input{align-content:center;border-radius:10px;border-radius:var(--size-10);display:inline-grid;grid-auto-columns:minmax(0,1fr);text-align:start}.np-popover-v2-container{background-color:#fff;background-color:var(--color-background-elevated);border-radius:10px;border-radius:var(--radius-small);box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;max-height:var(--max-height);min-width:20rem;width:var(--width);z-index:1060}.np-popover-v2-container:focus{outline:none}.np-popover-v2{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;row-gap:8px;row-gap:var(--size-8)}.np-popover-v2--has-title{grid-template-rows:auto 1fr}.np-popover-v2--padding-md{padding:16px;padding:var(--size-16)}.np-popover-v2-title{color:#37517e;color:var(--color-content-primary)}.np-popover-v2-content{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-placeholder{color:#768e9c;color:var(--color-content-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-options-container{display:flex;flex-direction:column;height:100%}.np-select-input-options-container:focus{outline:none}@media (min-width:576px){.np-select-input-options-container{max-height:28rem}}.np-select-input-
|
|
1
|
+
.np-bottom-sheet-v2-container{position:relative;z-index:1060}.np-bottom-sheet-v2-backdrop-container--enter,.np-bottom-sheet-v2-backdrop-container--leave{transition-duration:.15s;transition-property:opacity;transition-timing-function:ease-out}.np-bottom-sheet-v2-backdrop-container--enter-from,.np-bottom-sheet-v2-backdrop-container--leave-to{opacity:0}.np-bottom-sheet-v2-backdrop{background-color:#37517e;background-color:var(--color-content-primary);inset:0;opacity:.4;position:fixed}.np-bottom-sheet-v2{display:flex;flex-direction:column;inset:0;justify-content:flex-end;padding-left:8px;padding-left:var(--size-8);padding-right:8px;padding-right:var(--size-8);padding-top:64px;padding-top:var(--size-64);position:fixed}.np-bottom-sheet-v2-content{max-height:100%}.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-duration:.3s;transition-property:transform;transition-timing-function:ease-out}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-property:opacity}}@media (prefers-reduced-motion:no-preference){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{transform:translateY(100%)}}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{opacity:0}}.np-bottom-sheet-v2-content-inner-container{background-color:#fff;background-color:var(--color-background-elevated);border-top-left-radius:32px;border-top-right-radius:32px;box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;height:100%}.np-bottom-sheet-v2-content-inner-container:focus{outline:none}.np-bottom-sheet-v2-header{align-self:flex-end;padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-content-inner{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;padding-top:0;row-gap:8px;row-gap:var(--size-8)}.np-bottom-sheet-v2-content-inner--has-title{grid-template-rows:auto 1fr}.np-bottom-sheet-v2-content-inner--padding-md{padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-title{color:#37517e;color:var(--color-content-primary)}.np-bottom-sheet-v2-body{color:#5d7079;color:var(--color-content-secondary)}.np-button-input{align-content:center;border-radius:10px;border-radius:var(--size-10);display:inline-grid;grid-auto-columns:minmax(0,1fr);text-align:start}.np-popover-v2-container{background-color:#fff;background-color:var(--color-background-elevated);border-radius:10px;border-radius:var(--radius-small);box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;max-height:var(--max-height);min-width:20rem;width:var(--width);z-index:1060}.np-popover-v2-container:focus{outline:none}.np-popover-v2{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;row-gap:8px;row-gap:var(--size-8)}.np-popover-v2--has-title{grid-template-rows:auto 1fr}.np-popover-v2--padding-md{padding:16px;padding:var(--size-16)}.np-popover-v2-title{color:#37517e;color:var(--color-content-primary)}.np-popover-v2-content{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-placeholder{color:#768e9c;color:var(--color-content-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-options-container{display:flex;flex-direction:column;height:100%}.np-select-input-options-container:focus{outline:none}@media (min-width:576px){.np-select-input-options-container{max-height:28rem}}.np-select-input-query-container{display:flex;flex-direction:column;padding:8px;padding:var(--size-8);padding-top:0}@media (min-width:576px){.np-select-input-query-container{padding-top:8px;padding-top:var(--size-8)}}.np-select-input-listbox-container{height:var(--initial-height);overflow-y:auto;position:relative;scroll-padding-bottom:8px;scroll-padding-bottom:var(--size-8);scroll-padding-top:8px;scroll-padding-top:var(--size-8)}@media (min-width:576px){.np-select-input-listbox-container{height:auto}}.np-select-input-listbox-container--has-group{scroll-padding-top:32px;scroll-padding-top:var(--size-32)}.np-select-input-listbox{padding:8px;padding:var(--size-8)}.np-select-input-listbox:focus{outline:none}.np-select-input-separator-item{border-top-width:1px;margin:8px;margin:var(--size-8)}.np-select-input-group-item--without-needle:first-child{margin-top:-8px;margin-top:calc(var(--size-8)*-1)}.np-select-input-group-item-header{background-color:#fff;background-color:var(--color-background-elevated);color:#5d7079;color:var(--color-content-secondary);padding:8px 16px 4px;padding:var(--size-8) var(--size-16) var(--size-4);position:sticky;top:0;z-index:10}.np-select-input-option-container{align-items:center;border-radius:10px;border-radius:var(--radius-small);color:var(--color-interactive-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);cursor:default;display:flex;padding:12px 16px;padding:var(--size-12) var(--size-16);-webkit-user-select:none;-moz-user-select:none;user-select:none}.np-select-input-option-container--active{background-color:var(--color-interactive-primary)}.np-select-input-option-container--active.np-select-input-option-container--active *{color:#00a2dd;color:var(--color-interactive-accent)}.np-select-input-option-container--disabled{opacity:.45}.np-select-input-option-check{padding:0 4px;padding:0 var(--size-4)}.np-select-input-option-check--not-selected{visibility:hidden}.np-select-input-option-check-placeholder{display:inline-block;margin-inline-start:16px;margin-inline-start:var(--size-16);width:16px;width:var(--size-16)}.np-select-input-option{flex:1}.np-select-input-option-content-container{align-items:center;color:#37517e;color:var(--color-content-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);display:flex}.np-select-input-option-content-icon{display:flex}.np-select-input-option-content-icon--not-within-trigger{align-self:flex-start}.np-select-input-option-content-text{display:flex;flex:1;flex-direction:column;overflow:hidden}.np-select-input-option-content-text-primary{font:inherit}.np-select-input-option-content-text-secondary{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-option-content-text-within-trigger{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-option-content-text-line-1>:not([hidden])~:not([hidden]){margin-left:8px;margin-left:var(--size-8);margin-right:8px;margin-right:var(--size-8)}.np-select-input-addon-container{align-items:center;display:inline-flex;pointer-events:none}.np-select-input-addon-container,.np-select-input-addon-container>:not([hidden])~:not([hidden]){margin-inline-start:4px;margin-inline-start:var(--size-4)}.np-select-input-addon{align-items:center;background:none;border-radius:.125rem;border-width:0;display:inline-flex;height:24px;height:var(--size-24);justify-content:center;width:24px;width:var(--size-24)}.np-select-input-addon--interactive{color:#c9cbce;color:var(--color-interactive-secondary);pointer-events:auto}.np-select-input-addon--interactive:hover{color:#b5b7ba;color:var(--color-interactive-secondary-hover)}.np-select-input-addon--interactive:focus{outline:none}.np-select-input-addon--interactive:focus-visible{outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-select-input-addon-separator{border-inline-start:1px solid #0000001a;border-inline-start:1px solid var(--color-border-neutral);height:24px;height:var(--size-24)}
|
|
@@ -26,18 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
.np-select-input-options-status {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
column-gap: var(--size-8);
|
|
33
|
-
padding: var(--size-8) var(--size-24) 0px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.np-select-input-options-status-icon {
|
|
37
|
-
padding: 0 var(--size-4);
|
|
38
|
-
color: var(--color-content-tertiary);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
29
|
.np-select-input-query-container {
|
|
42
30
|
display: flex;
|
|
43
31
|
flex-direction: column;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Listbox as ListboxBase } from '@headlessui/react';
|
|
2
2
|
import { useId } from '@radix-ui/react-id';
|
|
3
|
-
import { Check, ChevronDown, Cross
|
|
3
|
+
import { Check, ChevronDown, Cross } from '@transferwise/icons';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import mergeProps from 'merge-props';
|
|
6
6
|
import { createContext, forwardRef, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -11,13 +11,12 @@ import { useEffectEvent } from '../common/hooks/useEffectEvent';
|
|
|
11
11
|
import { useScreenSize } from '../common/hooks/useScreenSize';
|
|
12
12
|
import { PolymorphicWithOverrides } from '../common/polymorphicWithOverrides/PolymorphicWithOverrides';
|
|
13
13
|
import { Breakpoint } from '../common/propsValues/breakpoint';
|
|
14
|
-
import
|
|
14
|
+
import messages from '../dateLookup/dateTrigger/DateTrigger.messages';
|
|
15
15
|
import { wrapInFragment } from '../utilities/wrapInFragment';
|
|
16
16
|
import { Merge } from '../utils';
|
|
17
17
|
|
|
18
18
|
import { InputGroup } from './InputGroup';
|
|
19
19
|
import { SearchInput } from './SearchInput';
|
|
20
|
-
import messages from './SelectInput.messages';
|
|
21
20
|
import { BottomSheet } from './_BottomSheet';
|
|
22
21
|
import { ButtonInput } from './_ButtonInput';
|
|
23
22
|
import { Popover } from './_Popover';
|
|
@@ -84,11 +83,14 @@ function dedupeSelectInputOptionItem<T>(
|
|
|
84
83
|
item: SelectInputOptionItem<T>,
|
|
85
84
|
existingValues: Set<T>,
|
|
86
85
|
): SelectInputOptionItem<T | undefined> {
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
if (existingValues.has(item.value)) {
|
|
87
|
+
return {
|
|
88
|
+
...item,
|
|
89
|
+
value: undefined,
|
|
90
|
+
};
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
+
existingValues.add(item.value);
|
|
93
|
+
return item;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
function dedupeSelectInputItems<T>(
|
|
@@ -114,27 +116,6 @@ function dedupeSelectInputItems<T>(
|
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
118
|
|
|
117
|
-
function filterSelectInputOptionItem<T>(item: SelectInputOptionItem<T>, needle: string) {
|
|
118
|
-
return inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>
|
|
119
|
-
haystack.includes(needle),
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function filterSelectInputItems<T>(items: readonly SelectInputItem<T>[], needle: string) {
|
|
124
|
-
return items.filter((item) => {
|
|
125
|
-
switch (item.type) {
|
|
126
|
-
case 'option': {
|
|
127
|
-
return filterSelectInputOptionItem(item, needle);
|
|
128
|
-
}
|
|
129
|
-
case 'group': {
|
|
130
|
-
return item.options.some((option) => filterSelectInputOptionItem(option, needle));
|
|
131
|
-
}
|
|
132
|
-
default:
|
|
133
|
-
}
|
|
134
|
-
return false;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
119
|
export interface SelectInputProps<T = string> {
|
|
139
120
|
name?: string;
|
|
140
121
|
placeholder?: string;
|
|
@@ -205,7 +186,7 @@ function SelectInputClearButton({ className, onClick }: SelectInputClearButtonPr
|
|
|
205
186
|
return (
|
|
206
187
|
<button
|
|
207
188
|
type="button"
|
|
208
|
-
aria-label={intl.formatMessage(
|
|
189
|
+
aria-label={intl.formatMessage(messages.ariaLabel)}
|
|
209
190
|
className={classNames(className, 'np-select-input-addon np-select-input-addon--interactive')}
|
|
210
191
|
onClick={onClick}
|
|
211
192
|
>
|
|
@@ -369,16 +350,9 @@ const SelectInputOptionsContainer = forwardRef(function SelectInputOptionsContai
|
|
|
369
350
|
ref={ref}
|
|
370
351
|
onKeyDown={(event) => {
|
|
371
352
|
// Prevent absorbing dismissal requests too early
|
|
372
|
-
if (event.key
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// Prevent confirmation close without an active item
|
|
377
|
-
if (event.key === 'Enter' && ariaActiveDescendant == null) {
|
|
378
|
-
return;
|
|
353
|
+
if (event.key !== 'Escape') {
|
|
354
|
+
onKeyDown?.(event);
|
|
379
355
|
}
|
|
380
|
-
|
|
381
|
-
onKeyDown?.(event);
|
|
382
356
|
}}
|
|
383
357
|
{...restProps}
|
|
384
358
|
/>
|
|
@@ -399,10 +373,6 @@ function SelectInputOptions<T = string>({
|
|
|
399
373
|
searchInputRef,
|
|
400
374
|
listboxRef,
|
|
401
375
|
}: SelectInputOptionsProps<T>) {
|
|
402
|
-
const intl = useIntl();
|
|
403
|
-
|
|
404
|
-
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
405
|
-
|
|
406
376
|
const [query, setQuery] = useState('');
|
|
407
377
|
const needle = useMemo(() => {
|
|
408
378
|
if (filterable) {
|
|
@@ -410,7 +380,6 @@ function SelectInputOptions<T = string>({
|
|
|
410
380
|
}
|
|
411
381
|
return undefined;
|
|
412
382
|
}, [filterable, query]);
|
|
413
|
-
const empty = needle != null && filterSelectInputItems(items, needle).length === 0;
|
|
414
383
|
|
|
415
384
|
const listboxContainerRef = useRef<HTMLDivElement>(null);
|
|
416
385
|
useEffect(() => {
|
|
@@ -422,10 +391,10 @@ function SelectInputOptions<T = string>({
|
|
|
422
391
|
}
|
|
423
392
|
}, []);
|
|
424
393
|
|
|
425
|
-
const showStatus = empty;
|
|
426
|
-
const statusId = useId();
|
|
427
394
|
const listboxId = useId();
|
|
428
395
|
|
|
396
|
+
const controllerRef = filterable ? searchInputRef : listboxRef;
|
|
397
|
+
|
|
429
398
|
return (
|
|
430
399
|
<ListboxBase.Options
|
|
431
400
|
as={SelectInputOptionsContainer}
|
|
@@ -449,7 +418,6 @@ function SelectInputOptions<T = string>({
|
|
|
449
418
|
placeholder={filterPlaceholder}
|
|
450
419
|
value={query}
|
|
451
420
|
aria-controls={listboxId}
|
|
452
|
-
aria-describedby={showStatus ? statusId : undefined}
|
|
453
421
|
onKeyDown={(event) => {
|
|
454
422
|
// Prevent interfering with the matcher of Headless UI
|
|
455
423
|
// https://mathiasbynens.be/notes/javascript-unicode#regex
|
|
@@ -472,13 +440,6 @@ function SelectInputOptions<T = string>({
|
|
|
472
440
|
'np-select-input-listbox-container--has-group',
|
|
473
441
|
)}
|
|
474
442
|
>
|
|
475
|
-
{empty ? (
|
|
476
|
-
<div id={statusId} className="np-select-input-options-status">
|
|
477
|
-
<CrossCircle size={16} className="np-select-input-options-status-icon" />
|
|
478
|
-
{intl.formatMessage(messages.noResultsFound)}
|
|
479
|
-
</div>
|
|
480
|
-
) : null}
|
|
481
|
-
|
|
482
443
|
<div
|
|
483
444
|
ref={listboxRef}
|
|
484
445
|
id={listboxId}
|
|
@@ -487,7 +448,7 @@ function SelectInputOptions<T = string>({
|
|
|
487
448
|
tabIndex={0}
|
|
488
449
|
className="np-select-input-listbox"
|
|
489
450
|
>
|
|
490
|
-
{(needle
|
|
451
|
+
{(needle == null ? items : dedupeSelectInputItems(items)).map((item, index) => (
|
|
491
452
|
<SelectInputItemView
|
|
492
453
|
// eslint-disable-next-line react/no-array-index-key
|
|
493
454
|
key={index}
|
|
@@ -517,7 +478,13 @@ function SelectInputItemView<T = string>({
|
|
|
517
478
|
}: SelectInputItemViewProps<T>) {
|
|
518
479
|
switch (item.type) {
|
|
519
480
|
case 'option': {
|
|
520
|
-
if (
|
|
481
|
+
if (
|
|
482
|
+
item.value != null &&
|
|
483
|
+
(!needle ||
|
|
484
|
+
inferSearchableStrings(item.filterMatchers ?? item.value).some((haystack) =>
|
|
485
|
+
haystack.includes(needle),
|
|
486
|
+
))
|
|
487
|
+
) {
|
|
521
488
|
return (
|
|
522
489
|
<SelectInputOption value={item.value} disabled={item.disabled}>
|
|
523
490
|
{renderValue(item.value, false)}
|
|
@@ -74,24 +74,24 @@ export function BottomSheet({
|
|
|
74
74
|
setFloatingKey((prev) => prev + 1);
|
|
75
75
|
}}
|
|
76
76
|
>
|
|
77
|
-
<
|
|
77
|
+
<Transition.Child
|
|
78
|
+
enter="np-bottom-sheet-v2-backdrop-container--enter"
|
|
79
|
+
enterFrom="np-bottom-sheet-v2-backdrop-container--enter-from"
|
|
80
|
+
leave="np-bottom-sheet-v2-backdrop-container--leave"
|
|
81
|
+
leaveTo="np-bottom-sheet-v2-backdrop-container--leave-to"
|
|
82
|
+
>
|
|
83
|
+
<div className="np-bottom-sheet-v2-backdrop" />
|
|
84
|
+
</Transition.Child>
|
|
85
|
+
|
|
86
|
+
<div className="np-bottom-sheet-v2">
|
|
78
87
|
<Transition.Child
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
className="np-bottom-sheet-v2-content"
|
|
89
|
+
enter="np-bottom-sheet-v2-content--enter"
|
|
90
|
+
enterFrom="np-bottom-sheet-v2-content--enter-from"
|
|
91
|
+
leave="np-bottom-sheet-v2-content--leave"
|
|
92
|
+
leaveTo="np-bottom-sheet-v2-content--leave-to"
|
|
83
93
|
>
|
|
84
|
-
<
|
|
85
|
-
</Transition.Child>
|
|
86
|
-
|
|
87
|
-
<div className="np-bottom-sheet-v2">
|
|
88
|
-
<Transition.Child
|
|
89
|
-
className="np-bottom-sheet-v2-content"
|
|
90
|
-
enter="np-bottom-sheet-v2-content--enter"
|
|
91
|
-
enterFrom="np-bottom-sheet-v2-content--enter-from"
|
|
92
|
-
leave="np-bottom-sheet-v2-content--leave"
|
|
93
|
-
leaveTo="np-bottom-sheet-v2-content--leave-to"
|
|
94
|
-
>
|
|
94
|
+
<FocusBoundary>
|
|
95
95
|
<FloatingFocusManager
|
|
96
96
|
context={context}
|
|
97
97
|
initialFocus={initialFocusRef}
|
|
@@ -130,9 +130,9 @@ export function BottomSheet({
|
|
|
130
130
|
</div>
|
|
131
131
|
</div>
|
|
132
132
|
</FloatingFocusManager>
|
|
133
|
-
</
|
|
134
|
-
</
|
|
135
|
-
</
|
|
133
|
+
</FocusBoundary>
|
|
134
|
+
</Transition.Child>
|
|
135
|
+
</div>
|
|
136
136
|
</Transition>
|
|
137
137
|
</ThemeProvider>
|
|
138
138
|
</FloatingPortal>
|