@transferwise/components 0.0.0-experimental-303fd87 → 0.0.0-experimental-1aabc72
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/common/panel/Panel.js +1 -0
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +1 -0
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +6 -1
- package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +6 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +1 -0
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +1 -0
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/inputs/_BottomSheet.js +0 -10
- package/build/inputs/_BottomSheet.js.map +1 -1
- package/build/inputs/_BottomSheet.mjs +1 -11
- package/build/inputs/_BottomSheet.mjs.map +1 -1
- package/build/main.css +10 -35
- package/build/styles/inputs/SelectInput.css +10 -35
- package/build/styles/main.css +10 -35
- package/build/types/common/panel/Panel.d.ts +2 -0
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -0
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common/panel/Panel.tsx +2 -0
- package/src/common/responsivePanel/ResponsivePanel.tsx +7 -1
- package/src/dateInput/DateInput.spec.tsx +27 -0
- package/src/dateLookup/DateLookup.spec.tsx +16 -0
- package/src/dateLookup/DateLookup.tsx +1 -0
- package/src/inputs/SelectInput.css +10 -35
- package/src/inputs/_BottomSheet.less +8 -34
- package/src/inputs/_BottomSheet.tsx +1 -18
- package/src/main.css +10 -35
- package/src/moneyInput/MoneyInput.spec.tsx +14 -0
- package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +32 -0
- package/src/common/bottomSheet/BottomSheet.test.story.tsx +0 -94
- package/src/inputs/SelectInput.test.story.tsx +0 -83
- package/src/moneyInput/MoneyInput.test.story.tsx +0 -101
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_BottomSheet.mjs","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment,
|
|
1
|
+
{"version":3,"file":"_BottomSheet.mjs","sources":["../../src/inputs/_BottomSheet.tsx"],"sourcesContent":["import {\n FloatingFocusManager,\n FloatingPortal,\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react';\nimport { Transition } from '@headlessui/react';\nimport { FocusScope } from '@react-aria/focus';\nimport { ThemeProvider, useTheme } from '@wise/components-theming';\nimport { clsx } from 'clsx';\nimport { Fragment, useState } from 'react';\n\nimport { CloseButton } from '../common/closeButton';\nimport { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';\nimport { PreventScroll } from '../common/preventScroll/PreventScroll';\nimport { Size } from '../common/propsValues/size';\n\nexport interface BottomSheetProps {\n open: boolean;\n renderTrigger?: (args: {\n ref: React.RefCallback<Element>;\n getInteractionProps: (customEventHandlers?: React.HTMLProps<Element>) => {\n [key: string]: unknown;\n };\n }) => React.ReactNode;\n title?: string;\n initialFocusRef?: React.MutableRefObject<HTMLElement | null>;\n padding?: 'none' | 'md';\n children?: React.ReactNode;\n onClose?: () => void;\n onCloseEnd?: () => void;\n}\n\nexport function BottomSheet({\n open,\n renderTrigger,\n title,\n initialFocusRef,\n padding = 'md',\n children,\n onClose,\n onCloseEnd,\n}: BottomSheetProps) {\n useVirtualKeyboard();\n\n const { refs, context } = useFloating<Element>({\n open,\n onOpenChange: (value) => {\n if (!value) {\n onClose?.();\n }\n },\n });\n\n const dismiss = useDismiss(context);\n const role = useRole(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, role]);\n\n const [floatingKey, setFloatingKey] = useState(0);\n\n const { theme, screenMode } = useTheme();\n\n return (\n <>\n {open ? <PreventScroll /> : null}\n {renderTrigger?.({\n ref: refs.setReference,\n getInteractionProps: getReferenceProps,\n })}\n\n <FloatingPortal>\n <ThemeProvider\n theme=\"personal\"\n screenMode={theme === 'personal' ? screenMode : 'light'}\n isNotRootProvider\n >\n <Transition\n show={open}\n className=\"np-bottom-sheet-v2-container\"\n beforeEnter={() => {\n setFloatingKey((prev) => prev + 1);\n }}\n afterLeave={onCloseEnd}\n >\n <Transition.Child\n className=\"np-bottom-sheet-v2-backdrop\"\n enterFrom=\"np-bottom-sheet-v2-backdrop--closed\"\n leaveTo=\"np-bottom-sheet-v2-backdrop--closed\"\n />\n\n <div className=\"np-bottom-sheet-v2\">\n <FocusScope>\n <FloatingFocusManager context={context} initialFocus={initialFocusRef}>\n <Fragment\n key={floatingKey} // Force inner state invalidation on open\n >\n <Transition.Child\n ref={refs.setFloating}\n className=\"np-bottom-sheet-v2-content\"\n enterFrom=\"np-bottom-sheet-v2-content--closed\"\n leaveTo=\"np-bottom-sheet-v2-content--closed\"\n {...getFloatingProps()}\n >\n <div className=\"np-bottom-sheet-v2-header\">\n <CloseButton\n size={Size.SMALL}\n onClick={() => {\n onClose?.();\n }}\n />\n </div>\n <div\n className={clsx(\n 'np-bottom-sheet-v2-content-inner',\n title && 'np-bottom-sheet-v2-content-inner--has-title',\n padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',\n )}\n >\n {title ? (\n <h2 className=\"np-bottom-sheet-v2-title np-text-title-body\">{title}</h2>\n ) : null}\n <div className=\"np-bottom-sheet-v2-body np-text-body-default\">\n {children}\n </div>\n </div>\n </Transition.Child>\n </Fragment>\n </FloatingFocusManager>\n </FocusScope>\n </div>\n </Transition>\n </ThemeProvider>\n </FloatingPortal>\n </>\n );\n}\n"],"names":["BottomSheet","open","renderTrigger","title","initialFocusRef","padding","children","onClose","onCloseEnd","useVirtualKeyboard","refs","context","useFloating","onOpenChange","value","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","floatingKey","setFloatingKey","useState","theme","screenMode","useTheme","_jsxs","_Fragment","_jsx","PreventScroll","ref","setReference","getInteractionProps","FloatingPortal","ThemeProvider","isNotRootProvider","Transition","show","className","beforeEnter","prev","afterLeave","Child","enterFrom","leaveTo","FocusScope","FloatingFocusManager","initialFocus","Fragment","setFloating","CloseButton","size","Size","SMALL","onClick","clsx"],"mappings":";;;;;;;;;;;;AAmCM,SAAUA,WAAWA,CAAC;EAC1BC,IAAI;EACJC,aAAa;EACbC,KAAK;EACLC,eAAe;AACfC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,OAAO;AACPC,EAAAA;AAAU,CACO,EAAA;AACjBC,EAAAA,kBAAkB,EAAE;EAEpB,MAAM;IAAEC,IAAI;AAAEC,IAAAA;GAAS,GAAGC,WAAW,CAAU;IAC7CX,IAAI;IACJY,YAAY,EAAGC,KAAK,IAAI;MACtB,IAAI,CAACA,KAAK,EAAE;AACVP,QAAAA,OAAO,IAAI;AACb,MAAA;AACF,IAAA;AACD,GAAA,CAAC;AAEF,EAAA,MAAMQ,OAAO,GAAGC,UAAU,CAACL,OAAO,CAAC;AACnC,EAAA,MAAMM,IAAI,GAAGC,OAAO,CAACP,OAAO,CAAC;EAC7B,MAAM;IAAEQ,iBAAiB;AAAEC,IAAAA;GAAkB,GAAGC,eAAe,CAAC,CAACN,OAAO,EAAEE,IAAI,CAAC,CAAC;EAEhF,MAAM,CAACK,WAAW,EAAEC,cAAc,CAAC,GAAGC,QAAQ,CAAC,CAAC,CAAC;EAEjD,MAAM;IAAEC,KAAK;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kBAAAA,QAAA,eAGPsB,IAAA,CAACU,UAAU,CAACM,KAAK,EAAA;oBACfZ,GAAG,EAAEtB,IAAI,CAACyC,WAAY;AACtBX,oBAAAA,SAAS,EAAC,4BAA4B;AACtCK,oBAAAA,SAAS,EAAC,oCAAoC;AAC9CC,oBAAAA,OAAO,EAAC,oCAAoC;oBAAA,GACxC1B,gBAAgB,EAAE;AAAAd,oBAAAA,QAAA,gBAEtBwB,GAAA,CAAA,KAAA,EAAA;AAAKU,sBAAAA,SAAS,EAAC,2BAA2B;sBAAAlC,QAAA,eACxCwB,GAAA,CAACsB,WAAW,EAAA;wBACVC,IAAI,EAAEC,IAAI,CAACC,KAAM;wBACjBC,OAAO,EAAEA,MAAK;AACZjD,0BAAAA,OAAO,IAAI;AACb,wBAAA;uBAAE;qBAED,CACL,eAAAqB,IAAA,CAAA,KAAA,EAAA;AACEY,sBAAAA,SAAS,EAAEiB,IAAI,CACb,kCAAkC,EAClCtD,KAAK,IAAI,6CAA6C,EACtDE,OAAO,KAAK,IAAI,IAAI,8CAA8C,CAClE;sBAAAC,QAAA,EAAA,CAEDH,KAAK,gBACJ2B,GAAA,CAAA,IAAA,EAAA;AAAIU,wBAAAA,SAAS,EAAC,6CAA6C;AAAAlC,wBAAAA,QAAA,EAAEH;AAAK,uBAAK,CAAC,GACtE,IAAI,eACR2B,GAAA,CAAA,KAAA,EAAA;AAAKU,wBAAAA,SAAS,EAAC,8CAA8C;AAAAlC,wBAAAA,QAAA,EAC1DA;AAAQ,uBACN,CACP;AAAA,qBAAK,CACP;mBAAkB;AACpB,iBAAA,EAhCOgB,WAgCG;eACU;aACZ;AACd,WAAK,CACP;SAAY;OACC;AACjB,KAAgB,CAClB;AAAA,GAAA,CAAG;AAEP;;;;"}
|
package/build/main.css
CHANGED
|
@@ -3519,73 +3519,48 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3519
3519
|
padding-inline-start: 8px;
|
|
3520
3520
|
padding-inline-start: var(--size-8);
|
|
3521
3521
|
}
|
|
3522
|
-
.wds-select-input-scroll-freeze {
|
|
3523
|
-
scroll-behavior: unset !important;
|
|
3524
|
-
height: 100vh;
|
|
3525
|
-
}
|
|
3526
|
-
.wds-select-input-scroll-freeze body {
|
|
3527
|
-
height: 100vh;
|
|
3528
|
-
}
|
|
3529
3522
|
.np-bottom-sheet-v2-container {
|
|
3530
3523
|
position: relative;
|
|
3531
3524
|
z-index: 1060;
|
|
3532
3525
|
}
|
|
3533
3526
|
.np-bottom-sheet-v2-backdrop {
|
|
3534
3527
|
position: fixed;
|
|
3535
|
-
inset:
|
|
3536
|
-
|
|
3537
|
-
background-color:
|
|
3528
|
+
inset: 0px;
|
|
3529
|
+
background-color: #37517e;
|
|
3530
|
+
background-color: var(--color-content-primary);
|
|
3531
|
+
opacity: 0.4;
|
|
3538
3532
|
transition-property: opacity;
|
|
3539
3533
|
transition-timing-function: ease-out;
|
|
3540
3534
|
transition-duration: 300ms;
|
|
3541
|
-
min-height: 100vh;
|
|
3542
|
-
}
|
|
3543
|
-
@supports (color: color-mix(in lch, red, blue)) {
|
|
3544
|
-
.np-bottom-sheet-v2-backdrop {
|
|
3545
|
-
background-color: color-mix(in srgb, var(--color-content-primary) 40%, transparent);
|
|
3546
|
-
}
|
|
3547
3535
|
}
|
|
3548
3536
|
.np-bottom-sheet-v2-backdrop--closed {
|
|
3549
3537
|
opacity: 0;
|
|
3550
3538
|
}
|
|
3551
3539
|
.np-bottom-sheet-v2 {
|
|
3552
3540
|
position: fixed;
|
|
3553
|
-
inset:
|
|
3554
|
-
bottom: env(
|
|
3555
|
-
margin-top: 64px;
|
|
3556
|
-
margin-top: var(--size-64);
|
|
3541
|
+
inset: 0px;
|
|
3542
|
+
bottom: env(keyboard-inset-height, 0px);
|
|
3557
3543
|
margin-left: 8px;
|
|
3558
3544
|
margin-left: var(--size-8);
|
|
3559
3545
|
margin-right: 8px;
|
|
3560
3546
|
margin-right: var(--size-8);
|
|
3547
|
+
margin-top: 64px;
|
|
3548
|
+
margin-top: var(--size-64);
|
|
3561
3549
|
display: flex;
|
|
3562
3550
|
flex-direction: column;
|
|
3563
3551
|
justify-content: flex-end;
|
|
3564
|
-
height: calc(100vh - 64px - 40px);
|
|
3565
|
-
height: calc(100vh - var(--size-64) - 40px);
|
|
3566
|
-
}
|
|
3567
|
-
.np-bottom-sheet-v2:after {
|
|
3568
|
-
content: '';
|
|
3569
|
-
position: fixed;
|
|
3570
|
-
bottom: -74px;
|
|
3571
|
-
width: 100%;
|
|
3572
|
-
background: #ffffff;
|
|
3573
|
-
background: var(--color-background-elevated);
|
|
3574
|
-
height: 32px;
|
|
3575
|
-
z-index: 1500;
|
|
3576
3552
|
}
|
|
3577
3553
|
.np-bottom-sheet-v2-content {
|
|
3578
3554
|
display: flex;
|
|
3579
3555
|
flex-direction: column;
|
|
3580
3556
|
overflow: auto;
|
|
3581
3557
|
border-top-left-radius: 32px;
|
|
3582
|
-
|
|
3558
|
+
/* TODO: Tokenize */
|
|
3583
3559
|
border-top-right-radius: 32px;
|
|
3584
|
-
|
|
3560
|
+
/* TODO: Tokenize */
|
|
3585
3561
|
background-color: #ffffff;
|
|
3586
3562
|
background-color: var(--color-background-elevated);
|
|
3587
3563
|
box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
|
|
3588
|
-
will-change: transform;
|
|
3589
3564
|
}
|
|
3590
3565
|
.np-bottom-sheet-v2-content:focus {
|
|
3591
3566
|
outline: none;
|
|
@@ -1,70 +1,45 @@
|
|
|
1
|
-
.wds-select-input-scroll-freeze {
|
|
2
|
-
scroll-behavior: unset !important;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
}
|
|
5
|
-
.wds-select-input-scroll-freeze body {
|
|
6
|
-
height: 100vh;
|
|
7
|
-
}
|
|
8
1
|
.np-bottom-sheet-v2-container {
|
|
9
2
|
position: relative;
|
|
10
3
|
z-index: 1060;
|
|
11
4
|
}
|
|
12
5
|
.np-bottom-sheet-v2-backdrop {
|
|
13
6
|
position: fixed;
|
|
14
|
-
inset:
|
|
15
|
-
|
|
16
|
-
background-color:
|
|
7
|
+
inset: 0px;
|
|
8
|
+
background-color: #37517e;
|
|
9
|
+
background-color: var(--color-content-primary);
|
|
10
|
+
opacity: 0.4;
|
|
17
11
|
transition-property: opacity;
|
|
18
12
|
transition-timing-function: ease-out;
|
|
19
13
|
transition-duration: 300ms;
|
|
20
|
-
min-height: 100vh;
|
|
21
|
-
}
|
|
22
|
-
@supports (color: color-mix(in lch, red, blue)) {
|
|
23
|
-
.np-bottom-sheet-v2-backdrop {
|
|
24
|
-
background-color: color-mix(in srgb, var(--color-content-primary) 40%, transparent);
|
|
25
|
-
}
|
|
26
14
|
}
|
|
27
15
|
.np-bottom-sheet-v2-backdrop--closed {
|
|
28
16
|
opacity: 0;
|
|
29
17
|
}
|
|
30
18
|
.np-bottom-sheet-v2 {
|
|
31
19
|
position: fixed;
|
|
32
|
-
inset:
|
|
33
|
-
bottom: env(
|
|
34
|
-
margin-top: 64px;
|
|
35
|
-
margin-top: var(--size-64);
|
|
20
|
+
inset: 0px;
|
|
21
|
+
bottom: env(keyboard-inset-height, 0px);
|
|
36
22
|
margin-left: 8px;
|
|
37
23
|
margin-left: var(--size-8);
|
|
38
24
|
margin-right: 8px;
|
|
39
25
|
margin-right: var(--size-8);
|
|
26
|
+
margin-top: 64px;
|
|
27
|
+
margin-top: var(--size-64);
|
|
40
28
|
display: flex;
|
|
41
29
|
flex-direction: column;
|
|
42
30
|
justify-content: flex-end;
|
|
43
|
-
height: calc(100vh - 64px - 40px);
|
|
44
|
-
height: calc(100vh - var(--size-64) - 40px);
|
|
45
|
-
}
|
|
46
|
-
.np-bottom-sheet-v2:after {
|
|
47
|
-
content: '';
|
|
48
|
-
position: fixed;
|
|
49
|
-
bottom: -74px;
|
|
50
|
-
width: 100%;
|
|
51
|
-
background: #ffffff;
|
|
52
|
-
background: var(--color-background-elevated);
|
|
53
|
-
height: 32px;
|
|
54
|
-
z-index: 1500;
|
|
55
31
|
}
|
|
56
32
|
.np-bottom-sheet-v2-content {
|
|
57
33
|
display: flex;
|
|
58
34
|
flex-direction: column;
|
|
59
35
|
overflow: auto;
|
|
60
36
|
border-top-left-radius: 32px;
|
|
61
|
-
|
|
37
|
+
/* TODO: Tokenize */
|
|
62
38
|
border-top-right-radius: 32px;
|
|
63
|
-
|
|
39
|
+
/* TODO: Tokenize */
|
|
64
40
|
background-color: #ffffff;
|
|
65
41
|
background-color: var(--color-background-elevated);
|
|
66
42
|
box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
|
|
67
|
-
will-change: transform;
|
|
68
43
|
}
|
|
69
44
|
.np-bottom-sheet-v2-content:focus {
|
|
70
45
|
outline: none;
|
package/build/styles/main.css
CHANGED
|
@@ -3519,73 +3519,48 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3519
3519
|
padding-inline-start: 8px;
|
|
3520
3520
|
padding-inline-start: var(--size-8);
|
|
3521
3521
|
}
|
|
3522
|
-
.wds-select-input-scroll-freeze {
|
|
3523
|
-
scroll-behavior: unset !important;
|
|
3524
|
-
height: 100vh;
|
|
3525
|
-
}
|
|
3526
|
-
.wds-select-input-scroll-freeze body {
|
|
3527
|
-
height: 100vh;
|
|
3528
|
-
}
|
|
3529
3522
|
.np-bottom-sheet-v2-container {
|
|
3530
3523
|
position: relative;
|
|
3531
3524
|
z-index: 1060;
|
|
3532
3525
|
}
|
|
3533
3526
|
.np-bottom-sheet-v2-backdrop {
|
|
3534
3527
|
position: fixed;
|
|
3535
|
-
inset:
|
|
3536
|
-
|
|
3537
|
-
background-color:
|
|
3528
|
+
inset: 0px;
|
|
3529
|
+
background-color: #37517e;
|
|
3530
|
+
background-color: var(--color-content-primary);
|
|
3531
|
+
opacity: 0.4;
|
|
3538
3532
|
transition-property: opacity;
|
|
3539
3533
|
transition-timing-function: ease-out;
|
|
3540
3534
|
transition-duration: 300ms;
|
|
3541
|
-
min-height: 100vh;
|
|
3542
|
-
}
|
|
3543
|
-
@supports (color: color-mix(in lch, red, blue)) {
|
|
3544
|
-
.np-bottom-sheet-v2-backdrop {
|
|
3545
|
-
background-color: color-mix(in srgb, var(--color-content-primary) 40%, transparent);
|
|
3546
|
-
}
|
|
3547
3535
|
}
|
|
3548
3536
|
.np-bottom-sheet-v2-backdrop--closed {
|
|
3549
3537
|
opacity: 0;
|
|
3550
3538
|
}
|
|
3551
3539
|
.np-bottom-sheet-v2 {
|
|
3552
3540
|
position: fixed;
|
|
3553
|
-
inset:
|
|
3554
|
-
bottom: env(
|
|
3555
|
-
margin-top: 64px;
|
|
3556
|
-
margin-top: var(--size-64);
|
|
3541
|
+
inset: 0px;
|
|
3542
|
+
bottom: env(keyboard-inset-height, 0px);
|
|
3557
3543
|
margin-left: 8px;
|
|
3558
3544
|
margin-left: var(--size-8);
|
|
3559
3545
|
margin-right: 8px;
|
|
3560
3546
|
margin-right: var(--size-8);
|
|
3547
|
+
margin-top: 64px;
|
|
3548
|
+
margin-top: var(--size-64);
|
|
3561
3549
|
display: flex;
|
|
3562
3550
|
flex-direction: column;
|
|
3563
3551
|
justify-content: flex-end;
|
|
3564
|
-
height: calc(100vh - 64px - 40px);
|
|
3565
|
-
height: calc(100vh - var(--size-64) - 40px);
|
|
3566
|
-
}
|
|
3567
|
-
.np-bottom-sheet-v2:after {
|
|
3568
|
-
content: '';
|
|
3569
|
-
position: fixed;
|
|
3570
|
-
bottom: -74px;
|
|
3571
|
-
width: 100%;
|
|
3572
|
-
background: #ffffff;
|
|
3573
|
-
background: var(--color-background-elevated);
|
|
3574
|
-
height: 32px;
|
|
3575
|
-
z-index: 1500;
|
|
3576
3552
|
}
|
|
3577
3553
|
.np-bottom-sheet-v2-content {
|
|
3578
3554
|
display: flex;
|
|
3579
3555
|
flex-direction: column;
|
|
3580
3556
|
overflow: auto;
|
|
3581
3557
|
border-top-left-radius: 32px;
|
|
3582
|
-
|
|
3558
|
+
/* TODO: Tokenize */
|
|
3583
3559
|
border-top-right-radius: 32px;
|
|
3584
|
-
|
|
3560
|
+
/* TODO: Tokenize */
|
|
3585
3561
|
background-color: #ffffff;
|
|
3586
3562
|
background-color: var(--color-background-elevated);
|
|
3587
3563
|
box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
|
|
3588
|
-
will-change: transform;
|
|
3589
3564
|
}
|
|
3590
3565
|
.np-bottom-sheet-v2-content:focus {
|
|
3591
3566
|
outline: none;
|
|
@@ -9,6 +9,7 @@ export type PanelProps = PropsWithChildren<{
|
|
|
9
9
|
position?: PositionBottom | PositionLeft | PositionRight | PositionTop;
|
|
10
10
|
anchorRef: MutableRefObject<Element | null>;
|
|
11
11
|
anchorWidth?: boolean;
|
|
12
|
+
considerHeight?: boolean;
|
|
12
13
|
}> & HTMLAttributes<HTMLDivElement>;
|
|
13
14
|
declare const Panel: import("react").ForwardRefExoticComponent<{
|
|
14
15
|
arrow?: boolean;
|
|
@@ -19,6 +20,7 @@ declare const Panel: import("react").ForwardRefExoticComponent<{
|
|
|
19
20
|
position?: PositionBottom | PositionLeft | PositionRight | PositionTop;
|
|
20
21
|
anchorRef: MutableRefObject<Element | null>;
|
|
21
22
|
anchorWidth?: boolean;
|
|
23
|
+
considerHeight?: boolean;
|
|
22
24
|
} & {
|
|
23
25
|
children?: import("react").ReactNode | undefined;
|
|
24
26
|
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../../src/common/panel/Panel.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EAKf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAY,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAgBxF,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC;IACzC,KAAK,CAAC,EAAE,O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AC,KAAK,EAAE,KAAK,GAAG,cAAc,KAAK,IAAI;eACtC,cAAc,GAAG,YAAY,GAAG,aAAa,GAAG,WAAW;eAC3D,gBAAgB,CAAC,OAAO,GAAG,IAAI,CAAC;kBAC7B,OAAO;qBACJ,OAAO;;;mFAkGxB,CAAC;AAEH,eAAe,KAAK,CAAC"}
|
|
@@ -7,6 +7,7 @@ declare const ResponsivePanel: import("react").ForwardRefExoticComponent<{
|
|
|
7
7
|
position?: import("..").PositionBottom | import("..").PositionLeft | import("..").PositionRight | import("..").PositionTop;
|
|
8
8
|
anchorRef: import("react").MutableRefObject<Element | null>;
|
|
9
9
|
anchorWidth?: boolean;
|
|
10
|
+
considerHeight?: boolean;
|
|
10
11
|
} & {
|
|
11
12
|
children?: import("react").ReactNode | undefined;
|
|
12
13
|
} & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsivePanel.d.ts","sourceRoot":"","sources":["../../../../src/common/responsivePanel/ResponsivePanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResponsivePanel.d.ts","sourceRoot":"","sources":["../../../../src/common/responsivePanel/ResponsivePanel.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,eAAe;;;;;;;;;;;;mGAsDnB,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateLookup.d.ts","sourceRoot":"","sources":["../../../src/dateLookup/DateLookup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EACL,IAAI,EACJ,WAAW,EAGX,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,wBAAwB,EAAuB,MAAM,oBAAoB,CAAC;AAQnF,MAAM,WAAW,eA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AAQ,EACR,OAAO,EACP,UAAU,GACX,EAAE,gBAAgB,+BA6FlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-1aabc72",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
"@floating-ui/react": "^0.27.16",
|
|
103
103
|
"@headlessui/react": "^1.7.19",
|
|
104
104
|
"@popperjs/core": "^2.11.8",
|
|
105
|
-
"@react-aria/focus": "^3.21.
|
|
106
|
-
"@react-aria/overlays": "^3.
|
|
105
|
+
"@react-aria/focus": "^3.21.0",
|
|
106
|
+
"@react-aria/overlays": "^3.28.0",
|
|
107
107
|
"@react-spring/web": "~10.0.1",
|
|
108
108
|
"@transferwise/formatting": "^2.13.4",
|
|
109
109
|
"@transferwise/neptune-validation": "^3.3.1",
|
|
@@ -37,6 +37,7 @@ export type PanelProps = PropsWithChildren<{
|
|
|
37
37
|
position?: PositionBottom | PositionLeft | PositionRight | PositionTop;
|
|
38
38
|
anchorRef: MutableRefObject<Element | null>;
|
|
39
39
|
anchorWidth?: boolean;
|
|
40
|
+
considerHeight?: boolean;
|
|
40
41
|
}> &
|
|
41
42
|
HTMLAttributes<HTMLDivElement>;
|
|
42
43
|
|
|
@@ -51,6 +52,7 @@ const Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(
|
|
|
51
52
|
position = Position.BOTTOM,
|
|
52
53
|
anchorRef,
|
|
53
54
|
anchorWidth = false,
|
|
55
|
+
considerHeight = false,
|
|
54
56
|
...rest
|
|
55
57
|
}: PanelProps,
|
|
56
58
|
reference,
|
|
@@ -4,6 +4,7 @@ import { Position } from '..';
|
|
|
4
4
|
import BottomSheet from '../bottomSheet';
|
|
5
5
|
import { useLayout } from '../hooks';
|
|
6
6
|
import Panel, { type PanelProps } from '../panel';
|
|
7
|
+
import { isServerSide } from '../domHelpers';
|
|
7
8
|
|
|
8
9
|
const ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function ResponsivePanel(
|
|
9
10
|
{
|
|
@@ -17,12 +18,16 @@ const ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function Responsi
|
|
|
17
18
|
position = Position.BOTTOM,
|
|
18
19
|
anchorWidth = false,
|
|
19
20
|
'aria-label': ariaLabel,
|
|
21
|
+
considerHeight = false,
|
|
20
22
|
'aria-labelledby': ariaLabelledBy,
|
|
21
23
|
}: PanelProps,
|
|
22
24
|
reference,
|
|
23
25
|
) {
|
|
24
26
|
const { isMobile } = useLayout();
|
|
25
|
-
|
|
27
|
+
const SHORT_SCREEN = 500;
|
|
28
|
+
const isShortViewport = considerHeight && !isServerSide() && window.innerHeight < SHORT_SCREEN;
|
|
29
|
+
|
|
30
|
+
if (isMobile || isShortViewport) {
|
|
26
31
|
return (
|
|
27
32
|
<BottomSheet
|
|
28
33
|
key="bottomSheet"
|
|
@@ -47,6 +52,7 @@ const ResponsivePanel = forwardRef<HTMLDivElement, PanelProps>(function Responsi
|
|
|
47
52
|
anchorWidth={anchorWidth}
|
|
48
53
|
anchorRef={anchorRef}
|
|
49
54
|
aria-label={ariaLabel}
|
|
55
|
+
considerHeight={considerHeight}
|
|
50
56
|
aria-labelledby={ariaLabelledBy}
|
|
51
57
|
className={className}
|
|
52
58
|
onClose={onClose}
|
|
@@ -247,4 +247,31 @@ describe('Date Input Component', () => {
|
|
|
247
247
|
);
|
|
248
248
|
expect(screen.getAllByRole('group')[0]).toHaveAccessibleName(/^Date of birth/);
|
|
249
249
|
});
|
|
250
|
+
|
|
251
|
+
it('focuses day input when `Field` label is clicked', async () => {
|
|
252
|
+
const label = 'Date of birth';
|
|
253
|
+
|
|
254
|
+
render(
|
|
255
|
+
<Field label={label}>
|
|
256
|
+
<DateInput onChange={() => {}} />
|
|
257
|
+
</Field>,
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
const dayInput = screen.getByRole('textbox', { name: /day/i });
|
|
261
|
+
await userEvent.click(screen.getByText(label, { selector: 'label' })); // Have to use `getByText` due to the way `Field` handles group labelling
|
|
262
|
+
expect(dayInput).toHaveFocus();
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('focuses month input when `Field` label is clicked and day is not present', async () => {
|
|
266
|
+
const label = 'Date of birth';
|
|
267
|
+
|
|
268
|
+
render(
|
|
269
|
+
<Field label={label}>
|
|
270
|
+
<DateInput mode="month-year" onChange={() => {}} />
|
|
271
|
+
</Field>,
|
|
272
|
+
);
|
|
273
|
+
const monthTrigger = screen.getByRole('combobox');
|
|
274
|
+
await userEvent.click(screen.getByText(label, { selector: 'label' })); // Have to use `getByText` due to the way `Field` handles group labelling
|
|
275
|
+
expect(monthTrigger).toHaveAttribute('aria-expanded', 'true');
|
|
276
|
+
});
|
|
250
277
|
});
|
|
@@ -42,6 +42,22 @@ describe('DateLookup', () => {
|
|
|
42
42
|
expect(button).toHaveAttribute('aria-haspopup');
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
+
it('focuses trigger and opens panel when `Field` label is clicked', async () => {
|
|
46
|
+
const label = 'Date of birth';
|
|
47
|
+
|
|
48
|
+
render(
|
|
49
|
+
<Field label={label}>
|
|
50
|
+
<DateLookup value={initialValue} onChange={() => {}} />
|
|
51
|
+
</Field>,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const button = screen.getByRole('button', { name: /^Date of birth/ });
|
|
55
|
+
await user.click(screen.getByLabelText(label));
|
|
56
|
+
|
|
57
|
+
expect(button).toHaveAttribute('aria-expanded', 'true');
|
|
58
|
+
expect(screen.getByRole('button', { name: /next/iu })).toBeInTheDocument();
|
|
59
|
+
});
|
|
60
|
+
|
|
45
61
|
it.each([' ', '{Enter}', '{ArrowDown}', '{ArrowUp}', '{ArrowRight}', '{ArrowLeft}'] as const)(
|
|
46
62
|
"opens with '%s' and closes with '{Escape}'",
|
|
47
63
|
async (text: string) => {
|
|
@@ -1,70 +1,45 @@
|
|
|
1
|
-
.wds-select-input-scroll-freeze {
|
|
2
|
-
scroll-behavior: unset !important;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
}
|
|
5
|
-
.wds-select-input-scroll-freeze body {
|
|
6
|
-
height: 100vh;
|
|
7
|
-
}
|
|
8
1
|
.np-bottom-sheet-v2-container {
|
|
9
2
|
position: relative;
|
|
10
3
|
z-index: 1060;
|
|
11
4
|
}
|
|
12
5
|
.np-bottom-sheet-v2-backdrop {
|
|
13
6
|
position: fixed;
|
|
14
|
-
inset:
|
|
15
|
-
|
|
16
|
-
background-color:
|
|
7
|
+
inset: 0px;
|
|
8
|
+
background-color: #37517e;
|
|
9
|
+
background-color: var(--color-content-primary);
|
|
10
|
+
opacity: 0.4;
|
|
17
11
|
transition-property: opacity;
|
|
18
12
|
transition-timing-function: ease-out;
|
|
19
13
|
transition-duration: 300ms;
|
|
20
|
-
min-height: 100vh;
|
|
21
|
-
}
|
|
22
|
-
@supports (color: color-mix(in lch, red, blue)) {
|
|
23
|
-
.np-bottom-sheet-v2-backdrop {
|
|
24
|
-
background-color: color-mix(in srgb, var(--color-content-primary) 40%, transparent);
|
|
25
|
-
}
|
|
26
14
|
}
|
|
27
15
|
.np-bottom-sheet-v2-backdrop--closed {
|
|
28
16
|
opacity: 0;
|
|
29
17
|
}
|
|
30
18
|
.np-bottom-sheet-v2 {
|
|
31
19
|
position: fixed;
|
|
32
|
-
inset:
|
|
33
|
-
bottom: env(
|
|
34
|
-
margin-top: 64px;
|
|
35
|
-
margin-top: var(--size-64);
|
|
20
|
+
inset: 0px;
|
|
21
|
+
bottom: env(keyboard-inset-height, 0px);
|
|
36
22
|
margin-left: 8px;
|
|
37
23
|
margin-left: var(--size-8);
|
|
38
24
|
margin-right: 8px;
|
|
39
25
|
margin-right: var(--size-8);
|
|
26
|
+
margin-top: 64px;
|
|
27
|
+
margin-top: var(--size-64);
|
|
40
28
|
display: flex;
|
|
41
29
|
flex-direction: column;
|
|
42
30
|
justify-content: flex-end;
|
|
43
|
-
height: calc(100vh - 64px - 40px);
|
|
44
|
-
height: calc(100vh - var(--size-64) - 40px);
|
|
45
|
-
}
|
|
46
|
-
.np-bottom-sheet-v2:after {
|
|
47
|
-
content: '';
|
|
48
|
-
position: fixed;
|
|
49
|
-
bottom: -74px;
|
|
50
|
-
width: 100%;
|
|
51
|
-
background: #ffffff;
|
|
52
|
-
background: var(--color-background-elevated);
|
|
53
|
-
height: 32px;
|
|
54
|
-
z-index: 1500;
|
|
55
31
|
}
|
|
56
32
|
.np-bottom-sheet-v2-content {
|
|
57
33
|
display: flex;
|
|
58
34
|
flex-direction: column;
|
|
59
35
|
overflow: auto;
|
|
60
36
|
border-top-left-radius: 32px;
|
|
61
|
-
|
|
37
|
+
/* TODO: Tokenize */
|
|
62
38
|
border-top-right-radius: 32px;
|
|
63
|
-
|
|
39
|
+
/* TODO: Tokenize */
|
|
64
40
|
background-color: #ffffff;
|
|
65
41
|
background-color: var(--color-background-elevated);
|
|
66
42
|
box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
|
|
67
|
-
will-change: transform;
|
|
68
43
|
}
|
|
69
44
|
.np-bottom-sheet-v2-content:focus {
|
|
70
45
|
outline: none;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
.wds-select-input-scroll-freeze{
|
|
2
|
-
scroll-behavior: unset !important;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
|
|
5
|
-
body{
|
|
6
|
-
height: 100vh;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
1
|
.np-bottom-sheet-v2-container {
|
|
11
2
|
position: relative;
|
|
12
3
|
z-index: 1060;
|
|
@@ -14,17 +5,12 @@
|
|
|
14
5
|
|
|
15
6
|
.np-bottom-sheet-v2-backdrop {
|
|
16
7
|
position: fixed;
|
|
17
|
-
inset:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
in srgb,
|
|
21
|
-
var(--color-content-primary) 40%,
|
|
22
|
-
transparent
|
|
23
|
-
);
|
|
8
|
+
inset: 0px;
|
|
9
|
+
background-color: var(--color-content-primary);
|
|
10
|
+
opacity: 0.4;
|
|
24
11
|
transition-property: opacity;
|
|
25
12
|
transition-timing-function: ease-out;
|
|
26
13
|
transition-duration: 300ms;
|
|
27
|
-
min-height: 100vh;
|
|
28
14
|
|
|
29
15
|
&--closed {
|
|
30
16
|
opacity: 0;
|
|
@@ -33,36 +19,24 @@
|
|
|
33
19
|
|
|
34
20
|
.np-bottom-sheet-v2 {
|
|
35
21
|
position: fixed;
|
|
36
|
-
inset:
|
|
37
|
-
bottom: env(
|
|
38
|
-
margin-top: var(--size-64);
|
|
22
|
+
inset: 0px;
|
|
23
|
+
bottom: env(keyboard-inset-height, 0px);
|
|
39
24
|
margin-left: var(--size-8);
|
|
40
25
|
margin-right: var(--size-8);
|
|
26
|
+
margin-top: var(--size-64);
|
|
41
27
|
display: flex;
|
|
42
28
|
flex-direction: column;
|
|
43
29
|
justify-content: flex-end;
|
|
44
|
-
height: calc(100vh - var(--size-64) - 40px);
|
|
45
|
-
|
|
46
|
-
&:after{
|
|
47
|
-
content: '';
|
|
48
|
-
position:fixed;
|
|
49
|
-
bottom: -74px;
|
|
50
|
-
width: 100%;
|
|
51
|
-
background: var(--color-background-elevated);
|
|
52
|
-
height: 32px;
|
|
53
|
-
z-index: 1500;
|
|
54
|
-
}
|
|
55
30
|
}
|
|
56
31
|
|
|
57
32
|
.np-bottom-sheet-v2-content {
|
|
58
33
|
display: flex;
|
|
59
34
|
flex-direction: column;
|
|
60
35
|
overflow: auto;
|
|
61
|
-
border-top-left-radius:
|
|
62
|
-
border-top-right-radius:
|
|
36
|
+
border-top-left-radius: 32px; /* TODO: Tokenize */
|
|
37
|
+
border-top-right-radius: 32px; /* TODO: Tokenize */
|
|
63
38
|
background-color: var(--color-background-elevated);
|
|
64
39
|
box-shadow: 0 0 40px rgb(69 71 69 / 0.2);
|
|
65
|
-
will-change: transform;
|
|
66
40
|
|
|
67
41
|
&:focus {
|
|
68
42
|
outline: none;
|