@transferwise/components 46.64.0 → 46.65.0
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/bottomSheet/BottomSheet.js +8 -2
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs +8 -2
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/drawer/Drawer.js +5 -3
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +5 -3
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +1 -1
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +1 -1
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js +89 -15
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +90 -16
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/main.css +10 -1
- package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +10 -1
- package/build/styles/main.css +10 -1
- package/build/switch/Switch.js +3 -27
- package/build/switch/Switch.js.map +1 -1
- package/build/switch/Switch.mjs +3 -27
- package/build/switch/Switch.mjs.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts +3 -3
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts +4 -3
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +3 -3
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
- package/build/types/switch/Switch.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common/bottomSheet/BottomSheet.tsx +13 -4
- package/src/drawer/Drawer.tsx +7 -5
- package/src/flowNavigation/FlowNavigation.story.js +69 -17
- package/src/flowNavigation/FlowNavigation.tsx +1 -5
- package/src/flowNavigation/animatedLabel/AnimatedLabel.css +10 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.less +10 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +64 -27
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +102 -20
- package/src/main.css +10 -1
- package/src/switch/Switch.story.tsx +4 -7
- package/src/switch/Switch.tsx +1 -24
- package/src/switch/__snapshots__/Switch.spec.tsx.snap +2 -44
- package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +0 -25
|
@@ -1,25 +1,99 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import { useId, useState } from 'react';
|
|
3
|
+
import BottomSheet from '../../common/bottomSheet/BottomSheet.mjs';
|
|
4
|
+
import Option from '../../common/Option/Option.mjs';
|
|
5
|
+
import { ChevronDown, Check } from '@transferwise/icons';
|
|
6
|
+
import { OverlayIdProvider, OverlayIdContext } from '../../provider/overlay/OverlayIdProvider.mjs';
|
|
7
|
+
import { List } from '../../listItem/List.mjs';
|
|
8
|
+
import '../../body/Body.mjs';
|
|
9
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
10
|
|
|
7
11
|
const AnimatedLabel = ({
|
|
8
12
|
activeLabel,
|
|
9
13
|
className,
|
|
10
|
-
|
|
14
|
+
steps
|
|
11
15
|
}) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const labelId = useId();
|
|
17
|
+
const [showSteps, setShowSteps] = useState(false);
|
|
18
|
+
function handleStepAction(onClick) {
|
|
19
|
+
return () => {
|
|
20
|
+
setShowSteps(false);
|
|
21
|
+
onClick?.();
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return /*#__PURE__*/jsx(OverlayIdProvider, {
|
|
25
|
+
open: showSteps,
|
|
26
|
+
children: /*#__PURE__*/jsx(OverlayIdContext.Consumer, {
|
|
27
|
+
children: overlayId => {
|
|
28
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
29
|
+
children: [/*#__PURE__*/jsx("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
id: labelId,
|
|
32
|
+
"aria-haspopup": "menu",
|
|
33
|
+
"aria-controls": overlayId,
|
|
34
|
+
"aria-expanded": showSteps,
|
|
35
|
+
className: clsx('np-animated-label', 'btn-unstyled', 'np-text-body-large-bold', className),
|
|
36
|
+
onClick: () => setShowSteps(true),
|
|
37
|
+
children: steps.map(({
|
|
38
|
+
label
|
|
39
|
+
}, index) => {
|
|
40
|
+
const isCurrentStep = activeLabel === index;
|
|
41
|
+
const previousIndex = index - 1;
|
|
42
|
+
return /*#__PURE__*/jsxs("div", {
|
|
43
|
+
"aria-hidden": !isCurrentStep,
|
|
44
|
+
className: clsx('text-xs-center', 'd-inline-flex', {
|
|
45
|
+
'np-animated-label--active text-ellipsis': isCurrentStep
|
|
46
|
+
}),
|
|
47
|
+
children: [label, " ", /*#__PURE__*/jsx(ChevronDown, {
|
|
48
|
+
className: "m-l-1",
|
|
49
|
+
size: 24
|
|
50
|
+
})]
|
|
51
|
+
}, previousIndex);
|
|
52
|
+
})
|
|
53
|
+
}), /*#__PURE__*/jsx(BottomSheet, {
|
|
54
|
+
role: "menu",
|
|
55
|
+
"aria-labelledby": labelId,
|
|
56
|
+
open: showSteps,
|
|
57
|
+
onClose: () => setShowSteps(false),
|
|
58
|
+
children: /*#__PURE__*/jsx(List, {
|
|
59
|
+
className: "m-b-0 p-a-1",
|
|
60
|
+
children: steps.map((step, index) => {
|
|
61
|
+
const isCurrentStep = activeLabel === index;
|
|
62
|
+
const isDisabled = activeLabel < index;
|
|
63
|
+
const itemId = `step-${index}`;
|
|
64
|
+
return /*#__PURE__*/jsx(Option, {
|
|
65
|
+
id: itemId,
|
|
66
|
+
as: "li",
|
|
67
|
+
role: "menuitem",
|
|
68
|
+
decision: false,
|
|
69
|
+
className: clsx('np-animated-label-option', 'p-x-3', 'p-y-1', 'm-y-1', {
|
|
70
|
+
clickable: !isDisabled
|
|
71
|
+
}),
|
|
72
|
+
title: step.label,
|
|
73
|
+
content: step.hoverLabel,
|
|
74
|
+
button: isCurrentStep ? /*#__PURE__*/jsx(Check, {
|
|
75
|
+
size: 24
|
|
76
|
+
}) : null,
|
|
77
|
+
"aria-current": isCurrentStep ? 'step' : false,
|
|
78
|
+
"aria-disabled": isDisabled,
|
|
79
|
+
disabled: isDisabled,
|
|
80
|
+
isContainerAligned: true,
|
|
81
|
+
...(!isDisabled && {
|
|
82
|
+
tabIndex: 0,
|
|
83
|
+
onClick: handleStepAction(step.onClick),
|
|
84
|
+
onKeyDown: event => {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
if (event.code === 'Enter' || event.code === 'Space') {
|
|
87
|
+
handleStepAction(step.onClick)();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
}, itemId);
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
})]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
23
97
|
})
|
|
24
98
|
});
|
|
25
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedLabel.mjs","sources":["../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport
|
|
1
|
+
{"version":3,"file":"AnimatedLabel.mjs","sources":["../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useState } from 'react';\n\nimport type { Step } from '../../stepper/Stepper';\nimport BottomSheet from '../../common/bottomSheet';\nimport Option from '../../common/Option';\nimport { Check, ChevronDown } from '@transferwise/icons';\nimport { OverlayIdContext, OverlayIdProvider } from '../../provider/overlay/OverlayIdProvider';\nimport { List } from '../../listItem';\n\nexport interface AnimatedLabelProps {\n activeLabel: number;\n className?: string;\n steps: readonly Step[];\n}\n\nconst AnimatedLabel = ({ activeLabel, className, steps }: AnimatedLabelProps) => {\n const labelId = useId();\n const [showSteps, setShowSteps] = useState(false);\n\n function handleStepAction(onClick: Step['onClick']) {\n return () => {\n setShowSteps(false);\n onClick?.();\n };\n }\n\n return (\n <OverlayIdProvider open={showSteps}>\n <OverlayIdContext.Consumer>\n {(overlayId) => {\n return (\n <>\n <button\n type=\"button\"\n id={labelId}\n aria-haspopup=\"menu\"\n aria-controls={overlayId}\n aria-expanded={showSteps}\n className={clsx(\n 'np-animated-label',\n 'btn-unstyled',\n 'np-text-body-large-bold',\n className,\n )}\n onClick={() => setShowSteps(true)}\n >\n {steps.map(({ label }, index) => {\n const isCurrentStep = activeLabel === index;\n const previousIndex = index - 1;\n return (\n <div\n key={previousIndex}\n aria-hidden={!isCurrentStep}\n className={clsx('text-xs-center', 'd-inline-flex', {\n 'np-animated-label--active text-ellipsis': isCurrentStep,\n })}\n >\n {label} <ChevronDown className=\"m-l-1\" size={24} />\n </div>\n );\n })}\n </button>\n <BottomSheet\n role=\"menu\"\n aria-labelledby={labelId}\n open={showSteps}\n onClose={() => setShowSteps(false)}\n >\n <List className=\"m-b-0 p-a-1\">\n {steps.map((step, index) => {\n const isCurrentStep = activeLabel === index;\n const isDisabled = activeLabel < index;\n const itemId = `step-${index}`;\n return (\n <Option\n key={itemId}\n id={itemId}\n as=\"li\"\n role=\"menuitem\"\n decision={false}\n className={clsx('np-animated-label-option', 'p-x-3', 'p-y-1', 'm-y-1', {\n clickable: !isDisabled,\n })}\n title={step.label}\n content={step.hoverLabel}\n button={isCurrentStep ? <Check size={24} /> : null}\n aria-current={isCurrentStep ? 'step' : false}\n aria-disabled={isDisabled}\n disabled={isDisabled}\n isContainerAligned\n {...(!isDisabled && {\n tabIndex: 0,\n onClick: handleStepAction(step.onClick),\n onKeyDown: (event) => {\n event.preventDefault();\n if (event.code === 'Enter' || event.code === 'Space') {\n handleStepAction(step.onClick)();\n }\n },\n })}\n />\n );\n })}\n </List>\n </BottomSheet>\n </>\n );\n }}\n </OverlayIdContext.Consumer>\n </OverlayIdProvider>\n );\n};\n\nexport default AnimatedLabel;\n"],"names":["AnimatedLabel","activeLabel","className","steps","labelId","useId","showSteps","setShowSteps","useState","handleStepAction","onClick","_jsx","OverlayIdProvider","open","children","OverlayIdContext","Consumer","overlayId","_jsxs","_Fragment","type","id","clsx","map","label","index","isCurrentStep","previousIndex","ChevronDown","size","BottomSheet","role","onClose","List","step","isDisabled","itemId","Option","as","decision","clickable","title","content","hoverLabel","button","Check","disabled","isContainerAligned","tabIndex","onKeyDown","event","preventDefault","code"],"mappings":";;;;;;;;;;AAgBMA,MAAAA,aAAa,GAAGA,CAAC;EAAEC,WAAW;EAAEC,SAAS;AAAEC,EAAAA,KAAAA;AAA2B,CAAA,KAAI;AAC9E,EAAA,MAAMC,OAAO,GAAGC,KAAK,EAAE,CAAA;EACvB,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,QAAQ,CAAC,KAAK,CAAC,CAAA;EAEjD,SAASC,gBAAgBA,CAACC,OAAwB,EAAA;AAChD,IAAA,OAAO,MAAK;MACVH,YAAY,CAAC,KAAK,CAAC,CAAA;AACnBG,MAAAA,OAAO,IAAI,CAAA;KACZ,CAAA;AACH,GAAA;EAEA,oBACEC,GAAA,CAACC,iBAAiB,EAAA;AAACC,IAAAA,IAAI,EAAEP,SAAU;AAAAQ,IAAAA,QAAA,eACjCH,GAAA,CAACI,gBAAgB,CAACC,QAAQ,EAAA;MAAAF,QAAA,EACtBG,SAAS,IAAI;QACb,oBACEC,IAAA,CAAAC,QAAA,EAAA;AAAAL,UAAAA,QAAA,gBACEH,GAAA,CAAA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,KAAK,OAAO,IAAIF,KAAK,CAACE,IAAI,KAAK,OAAO,EAAE;AACpD3C,wBAAAA,gBAAgB,CAACyB,IAAI,CAACxB,OAAO,CAAC,EAAE,CAAA;AAClC,uBAAA;AACF,qBAAA;mBACD,CAAA;AAAA,iBAAA,EAxBI0B,MAyBL,CAAA,CAAA;eAEL,CAAA;aACG,CAAA;AACR,WAAa,CACf,CAAA;AAAA,SAAA,CAAG,CAAA;AAEP,OAAA;KACyB,CAAA;AAC7B,GAAmB,CAAC,CAAA;AAExB;;;;"}
|
package/build/main.css
CHANGED
|
@@ -2098,7 +2098,7 @@ button.np-option {
|
|
|
2098
2098
|
transform: translateX(-8px);
|
|
2099
2099
|
transition: all 0.15s ease-in;
|
|
2100
2100
|
}
|
|
2101
|
-
.np-animated-label--
|
|
2101
|
+
.np-animated-label--active {
|
|
2102
2102
|
height: auto;
|
|
2103
2103
|
opacity: 1;
|
|
2104
2104
|
position: relative;
|
|
@@ -2106,6 +2106,15 @@ button.np-option {
|
|
|
2106
2106
|
transform: translateX(0);
|
|
2107
2107
|
transition: all 0.15s ease-in 0.15s;
|
|
2108
2108
|
}
|
|
2109
|
+
.np-animated-label-option {
|
|
2110
|
+
border-radius: 10px;
|
|
2111
|
+
border-radius: var(--radius-small);
|
|
2112
|
+
}
|
|
2113
|
+
.np-animated-label-option:not(.disabled):hover,
|
|
2114
|
+
.np-animated-label-option:not(.disabled):focus-visible {
|
|
2115
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
2116
|
+
outline-offset: var(--ring-outline-offset);
|
|
2117
|
+
}
|
|
2109
2118
|
.np-back-button {
|
|
2110
2119
|
color: #00a2dd;
|
|
2111
2120
|
color: var(--color-interactive-accent);
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
transform: translateX(-8px);
|
|
12
12
|
transition: all 0.3s ease-in;
|
|
13
13
|
}
|
|
14
|
-
.np-animated-label--
|
|
14
|
+
.np-animated-label--active {
|
|
15
15
|
height: auto;
|
|
16
16
|
opacity: 1;
|
|
17
17
|
position: relative;
|
|
@@ -19,3 +19,12 @@
|
|
|
19
19
|
transform: translateX(0);
|
|
20
20
|
transition: all 0.3s ease-in 0.3s;
|
|
21
21
|
}
|
|
22
|
+
.np-animated-label-option {
|
|
23
|
+
border-radius: 10px;
|
|
24
|
+
border-radius: var(--radius-small);
|
|
25
|
+
}
|
|
26
|
+
.np-animated-label-option:not(.disabled):hover,
|
|
27
|
+
.np-animated-label-option:not(.disabled):focus-visible {
|
|
28
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
29
|
+
outline-offset: var(--ring-outline-offset);
|
|
30
|
+
}
|
package/build/styles/main.css
CHANGED
|
@@ -2098,7 +2098,7 @@ button.np-option {
|
|
|
2098
2098
|
transform: translateX(-8px);
|
|
2099
2099
|
transition: all 0.15s ease-in;
|
|
2100
2100
|
}
|
|
2101
|
-
.np-animated-label--
|
|
2101
|
+
.np-animated-label--active {
|
|
2102
2102
|
height: auto;
|
|
2103
2103
|
opacity: 1;
|
|
2104
2104
|
position: relative;
|
|
@@ -2106,6 +2106,15 @@ button.np-option {
|
|
|
2106
2106
|
transform: translateX(0);
|
|
2107
2107
|
transition: all 0.15s ease-in 0.15s;
|
|
2108
2108
|
}
|
|
2109
|
+
.np-animated-label-option {
|
|
2110
|
+
border-radius: 10px;
|
|
2111
|
+
border-radius: var(--radius-small);
|
|
2112
|
+
}
|
|
2113
|
+
.np-animated-label-option:not(.disabled):hover,
|
|
2114
|
+
.np-animated-label-option:not(.disabled):focus-visible {
|
|
2115
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
2116
|
+
outline-offset: var(--ring-outline-offset);
|
|
2117
|
+
}
|
|
2109
2118
|
.np-back-button {
|
|
2110
2119
|
color: #00a2dd;
|
|
2111
2120
|
color: var(--color-interactive-accent);
|
package/build/switch/Switch.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var icons = require('@transferwise/icons');
|
|
4
|
-
var componentsTheming = require('@wise/components-theming');
|
|
5
3
|
var clsx = require('clsx');
|
|
6
4
|
var contexts = require('../inputs/contexts.js');
|
|
7
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -10,9 +8,6 @@ const Switch = props => {
|
|
|
10
8
|
const inputAttributes = contexts.useInputAttributes({
|
|
11
9
|
nonLabelable: true
|
|
12
10
|
});
|
|
13
|
-
const {
|
|
14
|
-
isModern
|
|
15
|
-
} = componentsTheming.useTheme();
|
|
16
11
|
const {
|
|
17
12
|
checked,
|
|
18
13
|
className,
|
|
@@ -28,27 +23,6 @@ const Switch = props => {
|
|
|
28
23
|
onClick();
|
|
29
24
|
}
|
|
30
25
|
};
|
|
31
|
-
const returnIcon = () => {
|
|
32
|
-
if (isModern) {
|
|
33
|
-
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
34
|
-
className: "np-switch--thumb"
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
if (checked) {
|
|
38
|
-
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
39
|
-
className: "np-switch--thumb",
|
|
40
|
-
children: /*#__PURE__*/jsxRuntime.jsx(icons.CheckCircleFill, {
|
|
41
|
-
size: 24
|
|
42
|
-
})
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
46
|
-
className: "np-switch--thumb",
|
|
47
|
-
children: /*#__PURE__*/jsxRuntime.jsx(icons.CrossCircleFill, {
|
|
48
|
-
size: 24
|
|
49
|
-
})
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
26
|
const ariaLabelledby = (ariaLabel ? undefined : ariaLabelledbyProp) ?? inputAttributes['aria-labelledby'];
|
|
53
27
|
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
54
28
|
className: clsx.clsx('np-switch', {
|
|
@@ -66,7 +40,9 @@ const Switch = props => {
|
|
|
66
40
|
"aria-disabled": disabled,
|
|
67
41
|
onClick: !disabled ? onClick : undefined,
|
|
68
42
|
onKeyDown: !disabled ? handleKeyDown : undefined,
|
|
69
|
-
children: [
|
|
43
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
44
|
+
className: "np-switch--thumb"
|
|
45
|
+
}), /*#__PURE__*/jsxRuntime.jsx("input", {
|
|
70
46
|
type: "checkbox",
|
|
71
47
|
checked: checked,
|
|
72
48
|
readOnly: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../src/switch/Switch.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../src/switch/Switch.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { KeyboardEventHandler, MouseEvent } from 'react';\n\nimport type { CommonProps } from '../common';\nimport { useInputAttributes } from '../inputs/contexts';\n\nexport type SwitchProps = CommonProps & {\n /**\n * Used to describe the purpose of the switch. To be used if there is no external label (i.e. aria-labelledby is null)\n * @deprecated Use `Field` wrapper or the `aria-labelledby` attribute instead.\n */\n 'aria-label'?: string;\n /** A reference to a label that describes the purpose of the switch. Ignored if aria-label is provided */\n 'aria-labelledby'?: string;\n /** Whether the switch is checked or not */\n checked?: boolean;\n disabled?: boolean;\n /** ID to apply to the switch container */\n id?: string;\n /** Function called when the switch is toggled */\n onClick: (event?: MouseEvent<HTMLSpanElement>) => void;\n};\n\nconst Switch = (props: SwitchProps) => {\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n\n const {\n checked,\n className,\n id = inputAttributes.id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledbyProp,\n onClick,\n disabled,\n } = props;\n\n const handleKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === ' ') {\n event.preventDefault();\n onClick();\n }\n };\n\n const ariaLabelledby =\n (ariaLabel ? undefined : ariaLabelledbyProp) ?? inputAttributes['aria-labelledby'];\n\n return (\n <span\n className={clsx(\n 'np-switch',\n {\n 'np-switch--unchecked': !checked,\n 'np-switch--checked': checked,\n disabled,\n },\n className,\n )}\n tabIndex={0}\n role=\"switch\"\n aria-checked={checked}\n aria-label={ariaLabel}\n {...inputAttributes}\n aria-labelledby={ariaLabelledby}\n id={id}\n aria-disabled={disabled}\n onClick={!disabled ? onClick : undefined}\n onKeyDown={!disabled ? handleKeyDown : undefined}\n >\n <span className=\"np-switch--thumb\" />\n <input type=\"checkbox\" checked={checked} readOnly />\n </span>\n );\n};\n\nexport default Switch;\n"],"names":["Switch","props","inputAttributes","useInputAttributes","nonLabelable","checked","className","id","ariaLabel","ariaLabelledbyProp","onClick","disabled","handleKeyDown","event","key","preventDefault","ariaLabelledby","undefined","_jsxs","clsx","tabIndex","role","onKeyDown","children","_jsx","type","readOnly"],"mappings":";;;;;;AAuBMA,MAAAA,MAAM,GAAIC,KAAkB,IAAI;EACpC,MAAMC,eAAe,GAAGC,2BAAkB,CAAC;AAAEC,IAAAA,YAAY,EAAE,IAAA;AAAM,GAAA,CAAC,CAAA;EAElE,MAAM;IACJC,OAAO;IACPC,SAAS;IACTC,EAAE,GAAGL,eAAe,CAACK,EAAE;AACvB,IAAA,YAAY,EAAEC,SAAS;AACvB,IAAA,iBAAiB,EAAEC,kBAAkB;IACrCC,OAAO;AACPC,IAAAA,QAAAA;AAAQ,GACT,GAAGV,KAAK,CAAA;EAET,MAAMW,aAAa,GAA0BC,KAAK,IAAI;AACpD,IAAA,IAAIA,KAAK,CAACC,GAAG,KAAK,GAAG,EAAE;MACrBD,KAAK,CAACE,cAAc,EAAE,CAAA;AACtBL,MAAAA,OAAO,EAAE,CAAA;AACX,KAAA;GACD,CAAA;AAED,EAAA,MAAMM,cAAc,GAClB,CAACR,SAAS,GAAGS,SAAS,GAAGR,kBAAkB,KAAKP,eAAe,CAAC,iBAAiB,CAAC,CAAA;AAEpF,EAAA,oBACEgB,eAAA,CAAA,MAAA,EAAA;AACEZ,IAAAA,SAAS,EAAEa,SAAI,CACb,WAAW,EACX;MACE,sBAAsB,EAAE,CAACd,OAAO;AAChC,MAAA,oBAAoB,EAAEA,OAAO;AAC7BM,MAAAA,QAAAA;KACD,EACDL,SAAS,CACT;AACFc,IAAAA,QAAQ,EAAE,CAAE;AACZC,IAAAA,IAAI,EAAC,QAAQ;AACb,IAAA,cAAA,EAAchB,OAAQ;AACtB,IAAA,YAAA,EAAYG,SAAU;AAAA,IAAA,GAClBN,eAAe;AACnB,IAAA,iBAAA,EAAiBc,cAAe;AAChCT,IAAAA,EAAE,EAAEA,EAAG;AACP,IAAA,eAAA,EAAeI,QAAS;AACxBD,IAAAA,OAAO,EAAE,CAACC,QAAQ,GAAGD,OAAO,GAAGO,SAAU;AACzCK,IAAAA,SAAS,EAAE,CAACX,QAAQ,GAAGC,aAAa,GAAGK,SAAU;AAAAM,IAAAA,QAAA,gBAEjDC,cAAA,CAAA,MAAA,EAAA;AAAMlB,MAAAA,SAAS,EAAC,kBAAA;KAChB,CAAA,eAAAkB,cAAA,CAAA,OAAA,EAAA;AAAOC,MAAAA,IAAI,EAAC,UAAU;AAACpB,MAAAA,OAAO,EAAEA,OAAQ;MAACqB,QAAQ,EAAA,IAAA;AAAA,KACnD,CAAA,CAAA;AAAA,GAAM,CAAC,CAAA;AAEX;;;;"}
|
package/build/switch/Switch.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { CheckCircleFill, CrossCircleFill } from '@transferwise/icons';
|
|
2
|
-
import { useTheme } from '@wise/components-theming';
|
|
3
1
|
import { clsx } from 'clsx';
|
|
4
2
|
import { useInputAttributes } from '../inputs/contexts.mjs';
|
|
5
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -8,9 +6,6 @@ const Switch = props => {
|
|
|
8
6
|
const inputAttributes = useInputAttributes({
|
|
9
7
|
nonLabelable: true
|
|
10
8
|
});
|
|
11
|
-
const {
|
|
12
|
-
isModern
|
|
13
|
-
} = useTheme();
|
|
14
9
|
const {
|
|
15
10
|
checked,
|
|
16
11
|
className,
|
|
@@ -26,27 +21,6 @@ const Switch = props => {
|
|
|
26
21
|
onClick();
|
|
27
22
|
}
|
|
28
23
|
};
|
|
29
|
-
const returnIcon = () => {
|
|
30
|
-
if (isModern) {
|
|
31
|
-
return /*#__PURE__*/jsx("span", {
|
|
32
|
-
className: "np-switch--thumb"
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
if (checked) {
|
|
36
|
-
return /*#__PURE__*/jsx("span", {
|
|
37
|
-
className: "np-switch--thumb",
|
|
38
|
-
children: /*#__PURE__*/jsx(CheckCircleFill, {
|
|
39
|
-
size: 24
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return /*#__PURE__*/jsx("span", {
|
|
44
|
-
className: "np-switch--thumb",
|
|
45
|
-
children: /*#__PURE__*/jsx(CrossCircleFill, {
|
|
46
|
-
size: 24
|
|
47
|
-
})
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
24
|
const ariaLabelledby = (ariaLabel ? undefined : ariaLabelledbyProp) ?? inputAttributes['aria-labelledby'];
|
|
51
25
|
return /*#__PURE__*/jsxs("span", {
|
|
52
26
|
className: clsx('np-switch', {
|
|
@@ -64,7 +38,9 @@ const Switch = props => {
|
|
|
64
38
|
"aria-disabled": disabled,
|
|
65
39
|
onClick: !disabled ? onClick : undefined,
|
|
66
40
|
onKeyDown: !disabled ? handleKeyDown : undefined,
|
|
67
|
-
children: [
|
|
41
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
42
|
+
className: "np-switch--thumb"
|
|
43
|
+
}), /*#__PURE__*/jsx("input", {
|
|
68
44
|
type: "checkbox",
|
|
69
45
|
checked: checked,
|
|
70
46
|
readOnly: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.mjs","sources":["../../src/switch/Switch.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Switch.mjs","sources":["../../src/switch/Switch.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { KeyboardEventHandler, MouseEvent } from 'react';\n\nimport type { CommonProps } from '../common';\nimport { useInputAttributes } from '../inputs/contexts';\n\nexport type SwitchProps = CommonProps & {\n /**\n * Used to describe the purpose of the switch. To be used if there is no external label (i.e. aria-labelledby is null)\n * @deprecated Use `Field` wrapper or the `aria-labelledby` attribute instead.\n */\n 'aria-label'?: string;\n /** A reference to a label that describes the purpose of the switch. Ignored if aria-label is provided */\n 'aria-labelledby'?: string;\n /** Whether the switch is checked or not */\n checked?: boolean;\n disabled?: boolean;\n /** ID to apply to the switch container */\n id?: string;\n /** Function called when the switch is toggled */\n onClick: (event?: MouseEvent<HTMLSpanElement>) => void;\n};\n\nconst Switch = (props: SwitchProps) => {\n const inputAttributes = useInputAttributes({ nonLabelable: true });\n\n const {\n checked,\n className,\n id = inputAttributes.id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledbyProp,\n onClick,\n disabled,\n } = props;\n\n const handleKeyDown: KeyboardEventHandler = (event) => {\n if (event.key === ' ') {\n event.preventDefault();\n onClick();\n }\n };\n\n const ariaLabelledby =\n (ariaLabel ? undefined : ariaLabelledbyProp) ?? inputAttributes['aria-labelledby'];\n\n return (\n <span\n className={clsx(\n 'np-switch',\n {\n 'np-switch--unchecked': !checked,\n 'np-switch--checked': checked,\n disabled,\n },\n className,\n )}\n tabIndex={0}\n role=\"switch\"\n aria-checked={checked}\n aria-label={ariaLabel}\n {...inputAttributes}\n aria-labelledby={ariaLabelledby}\n id={id}\n aria-disabled={disabled}\n onClick={!disabled ? onClick : undefined}\n onKeyDown={!disabled ? handleKeyDown : undefined}\n >\n <span className=\"np-switch--thumb\" />\n <input type=\"checkbox\" checked={checked} readOnly />\n </span>\n );\n};\n\nexport default Switch;\n"],"names":["Switch","props","inputAttributes","useInputAttributes","nonLabelable","checked","className","id","ariaLabel","ariaLabelledbyProp","onClick","disabled","handleKeyDown","event","key","preventDefault","ariaLabelledby","undefined","_jsxs","clsx","tabIndex","role","onKeyDown","children","_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C,aAAa,GAAGK,SAAU;AAAAM,IAAAA,QAAA,gBAEjDC,GAAA,CAAA,MAAA,EAAA;AAAMlB,MAAAA,SAAS,EAAC,kBAAA;KAChB,CAAA,eAAAkB,GAAA,CAAA,OAAA,EAAA;AAAOC,MAAAA,IAAI,EAAC,UAAU;AAACpB,MAAAA,OAAO,EAAEA,OAAQ;MAACqB,QAAQ,EAAA,IAAA;AAAA,KACnD,CAAA,CAAA;AAAA,GAAM,CAAC,CAAA;AAEX;;;;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { PropsWithChildren, SyntheticEvent } from 'react';
|
|
1
|
+
import { HTMLAttributes, PropsWithChildren, SyntheticEvent } from 'react';
|
|
2
2
|
import { CommonProps } from '../commonProps';
|
|
3
3
|
export type BottomSheetProps = PropsWithChildren<{
|
|
4
4
|
onClose?: (event: Event | SyntheticEvent) => void;
|
|
5
5
|
open: boolean;
|
|
6
|
-
} & CommonProps
|
|
6
|
+
} & CommonProps & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>>;
|
|
7
7
|
/**
|
|
8
8
|
* Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/
|
|
9
9
|
*
|
|
10
10
|
* Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
|
-
declare const BottomSheet: (props: BottomSheetProps) => import("react").JSX.Element;
|
|
13
|
+
declare const BottomSheet: ({ role, ...props }: BottomSheetProps) => import("react").JSX.Element;
|
|
14
14
|
export default BottomSheet;
|
|
15
15
|
//# sourceMappingURL=BottomSheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../../src/common/bottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EACjB,cAAc,EAIf,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAa7C,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAC9C;IACE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,KAAK,IAAI,CAAC;IAClD,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../../src/common/bottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,cAAc,EACd,iBAAiB,EACjB,cAAc,EAIf,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAa7C,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAC9C;IACE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,KAAK,IAAI,CAAC;IAClD,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,WAAW,GACb,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAC,CACnE,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,uBAAmC,gBAAgB,gCA2LnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
1
2
|
import { Position } from '../common';
|
|
2
|
-
export
|
|
3
|
+
export type DrawerProps = {
|
|
3
4
|
/** The content to appear in the drawer body. */
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
className?: string;
|
|
@@ -13,6 +14,6 @@ export interface DrawerProps {
|
|
|
13
14
|
position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;
|
|
14
15
|
/** The action to perform on close click. */
|
|
15
16
|
onClose?: (event: KeyboardEvent | React.MouseEvent) => void;
|
|
16
|
-
}
|
|
17
|
-
export default function Drawer({ children, className, footerContent, headerTitle, onClose, open, position, }: DrawerProps): import("react").JSX.Element;
|
|
17
|
+
} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;
|
|
18
|
+
export default function Drawer({ children, className, footerContent, headerTitle, onClose, open, position, role, 'aria-labelledby': ariaLabelledBy, }: DrawerProps): import("react").JSX.Element;
|
|
18
19
|
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAqB,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAc,MAAM,WAAW,CAAC;AASjD,MAAM,MAAM,WAAW,GAAG;IACxB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,kDAAkD;IAClD,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,+CAA+C;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uGAAuG;IACvG,QAAQ,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;IACjE,4CAA4C;IAC5C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAC7D,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAC,CAAC;AAErE,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,QAAQ,EACR,SAAS,EACT,aAAa,EACb,WAAW,EACX,OAAO,EACP,IAAY,EACZ,QAAkB,EAClB,IAAe,EACf,iBAAiB,EAAE,cAAc,GAClC,EAAE,WAAW,+BAuCb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/flowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAOA,OAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAOxD,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,wGAAwG;IACxG,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACxB;AAED,QAAA,MAAM,cAAc,kEAQjB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/flowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAOA,OAAgB,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAOxD,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,wGAAwG;IACxG,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACxB;AAED,QAAA,MAAM,cAAc,kEAQjB,mBAAmB,gCA8DrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Step } from '../../stepper/Stepper';
|
|
2
2
|
export interface AnimatedLabelProps {
|
|
3
3
|
activeLabel: number;
|
|
4
4
|
className?: string;
|
|
5
|
-
|
|
5
|
+
steps: readonly Step[];
|
|
6
6
|
}
|
|
7
|
-
declare const AnimatedLabel: ({ activeLabel, className,
|
|
7
|
+
declare const AnimatedLabel: ({ activeLabel, className, steps }: AnimatedLabelProps) => import("react").JSX.Element;
|
|
8
8
|
export default AnimatedLabel;
|
|
9
9
|
//# sourceMappingURL=AnimatedLabel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedLabel.d.ts","sourceRoot":"","sources":["../../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnimatedLabel.d.ts","sourceRoot":"","sources":["../../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAOlD,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACxB;AAED,QAAA,MAAM,aAAa,sCAAuC,kBAAkB,gCAgG3E,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/switch/Switch.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/switch/Switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAwB,UAAU,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yGAAyG;IACzG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,QAAA,MAAM,MAAM,UAAW,WAAW,gCAiDjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.65.0",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"rollup-preserve-directives": "^1.1.1",
|
|
94
94
|
"storybook": "^8.2.2",
|
|
95
95
|
"@transferwise/less-config": "3.1.0",
|
|
96
|
-
"@
|
|
97
|
-
"@
|
|
96
|
+
"@wise/components-theming": "1.6.0",
|
|
97
|
+
"@transferwise/neptune-css": "14.15.0"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@transferwise/icons": "^3.7.0",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import {
|
|
3
3
|
CSSProperties,
|
|
4
|
+
HTMLAttributes,
|
|
4
5
|
PropsWithChildren,
|
|
5
6
|
SyntheticEvent,
|
|
6
7
|
useContext,
|
|
@@ -30,7 +31,8 @@ export type BottomSheetProps = PropsWithChildren<
|
|
|
30
31
|
{
|
|
31
32
|
onClose?: (event: Event | SyntheticEvent) => void;
|
|
32
33
|
open: boolean;
|
|
33
|
-
} & CommonProps
|
|
34
|
+
} & CommonProps &
|
|
35
|
+
Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>
|
|
34
36
|
>;
|
|
35
37
|
|
|
36
38
|
/**
|
|
@@ -39,7 +41,7 @@ export type BottomSheetProps = PropsWithChildren<
|
|
|
39
41
|
* Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet
|
|
40
42
|
*
|
|
41
43
|
*/
|
|
42
|
-
const BottomSheet = (props: BottomSheetProps) => {
|
|
44
|
+
const BottomSheet = ({ role = 'dialog', ...props }: BottomSheetProps) => {
|
|
43
45
|
const bottomSheetReference = useRef<HTMLDivElement>(null);
|
|
44
46
|
const topBarReference = useRef<HTMLDivElement>(null);
|
|
45
47
|
const contentReference = useRef<HTMLDivElement>(null);
|
|
@@ -181,7 +183,13 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
181
183
|
const overlayId = useContext(OverlayIdContext);
|
|
182
184
|
|
|
183
185
|
return is400Zoom ? (
|
|
184
|
-
<Drawer
|
|
186
|
+
<Drawer
|
|
187
|
+
aria-labelledby={props['aria-labelledby']}
|
|
188
|
+
role={role}
|
|
189
|
+
open={props.open}
|
|
190
|
+
className={props.className}
|
|
191
|
+
onClose={close}
|
|
192
|
+
>
|
|
185
193
|
{props.children}
|
|
186
194
|
</Drawer>
|
|
187
195
|
) : (
|
|
@@ -195,7 +203,8 @@ const BottomSheet = (props: BottomSheetProps) => {
|
|
|
195
203
|
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}
|
|
196
204
|
<div
|
|
197
205
|
id={overlayId}
|
|
198
|
-
|
|
206
|
+
aria-labelledby={props['aria-labelledby']}
|
|
207
|
+
role={role}
|
|
199
208
|
aria-modal
|
|
200
209
|
onTouchStart={onSwipeStart}
|
|
201
210
|
onTouchMove={onSwipeMove}
|
package/src/drawer/Drawer.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import { useContext, useId } from 'react';
|
|
2
|
+
import { HTMLAttributes, useContext, useId } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Position, Typography } from '../common';
|
|
5
5
|
import { CloseButton } from '../common/closeButton';
|
|
@@ -10,7 +10,7 @@ import SlidingPanel from '../slidingPanel';
|
|
|
10
10
|
import Title from '../title';
|
|
11
11
|
import { logActionRequiredIf } from '../utilities';
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type DrawerProps = {
|
|
14
14
|
/** The content to appear in the drawer body. */
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
className?: string;
|
|
@@ -24,7 +24,7 @@ export interface DrawerProps {
|
|
|
24
24
|
position?: `${Position.LEFT | Position.RIGHT | Position.BOTTOM}`;
|
|
25
25
|
/** The action to perform on close click. */
|
|
26
26
|
onClose?: (event: KeyboardEvent | React.MouseEvent) => void;
|
|
27
|
-
}
|
|
27
|
+
} & Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-labelledby'>;
|
|
28
28
|
|
|
29
29
|
export default function Drawer({
|
|
30
30
|
children,
|
|
@@ -34,6 +34,8 @@ export default function Drawer({
|
|
|
34
34
|
onClose,
|
|
35
35
|
open = false,
|
|
36
36
|
position = 'right',
|
|
37
|
+
role = 'dialog',
|
|
38
|
+
'aria-labelledby': ariaLabelledBy,
|
|
37
39
|
}: DrawerProps) {
|
|
38
40
|
logActionRequiredIf(
|
|
39
41
|
'Drawer now expects `onClose`, and will soon make this prop required. Please update your usage to provide it.',
|
|
@@ -50,9 +52,9 @@ export default function Drawer({
|
|
|
50
52
|
<SlidingPanel open={open} position={isMobile ? Position.BOTTOM : position}>
|
|
51
53
|
<div
|
|
52
54
|
id={overlayId}
|
|
53
|
-
role=
|
|
55
|
+
role={role}
|
|
54
56
|
aria-modal
|
|
55
|
-
aria-labelledby={headerTitle ? titleId : undefined}
|
|
57
|
+
aria-labelledby={ariaLabelledBy || (headerTitle ? titleId : undefined)}
|
|
56
58
|
className={clsx('np-drawer', className)}
|
|
57
59
|
>
|
|
58
60
|
<div
|