@transferwise/components 0.0.0-experimental-3ab6847 → 0.0.0-experimental-0e85724
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/ListItem/ListItem.js +2 -0
- package/build/ListItem/ListItem.js.map +1 -1
- package/build/ListItem/ListItem.mjs +2 -0
- package/build/ListItem/ListItem.mjs.map +1 -1
- package/build/Snackbar/Snackbar.js +101 -98
- package/build/Snackbar/Snackbar.js.map +1 -1
- package/build/Snackbar/Snackbar.mjs +102 -99
- package/build/Snackbar/Snackbar.mjs.map +1 -1
- package/build/i18n/de.json +1 -0
- package/build/i18n/de.json.js +1 -0
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +1 -0
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/fr.json +1 -0
- package/build/i18n/fr.json.js +1 -0
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +1 -0
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/th.json +1 -0
- package/build/i18n/th.json.js +1 -0
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +1 -0
- package/build/i18n/th.json.mjs.map +1 -1
- package/build/main.css +5 -0
- package/build/styles/ListItem/ListItem.css +5 -0
- package/build/styles/main.css +5 -0
- package/build/types/ListItem/ListItem.d.ts +6 -1
- package/build/types/ListItem/ListItem.d.ts.map +1 -1
- package/build/types/Snackbar/Snackbar.d.ts +15 -1
- package/build/types/Snackbar/Snackbar.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ListItem/ListItem.css +5 -0
- package/src/ListItem/ListItem.less +4 -0
- package/src/ListItem/ListItem.test.tsx +17 -0
- package/src/ListItem/ListItem.tsx +7 -0
- package/src/ListItem/_stories/ListItem.layout.test.story.tsx +23 -0
- package/src/ListItem/_stories/ListItem.story.tsx +8 -0
- package/src/Snackbar/Snackbar.tsx +88 -90
- package/src/i18n/de.json +1 -0
- package/src/i18n/fr.json +1 -0
- package/src/i18n/th.json +1 -0
- package/src/main.css +5 -0
|
@@ -1,122 +1,125 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component, createRef } from 'react';
|
|
2
2
|
import { CSSTransition } from 'react-transition-group';
|
|
3
3
|
import Button from '../Button/Button.resolver.mjs';
|
|
4
4
|
import Body from '../Body/Body.mjs';
|
|
5
|
+
import { DirectionContext } from '../Provider/Direction/DirectionProvider.mjs';
|
|
5
6
|
import withNextPortalWrapper from '../WithNextPortal/WithNextPortal.mjs';
|
|
6
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
8
|
|
|
8
9
|
const CSS_TRANSITION_DURATION = 400;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
window.clearTimeout(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
10
|
+
class Snackbar extends Component {
|
|
11
|
+
bodyRef = /*#__PURE__*/createRef();
|
|
12
|
+
timeout = 0;
|
|
13
|
+
transitionTimeout = 0;
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
this.state = {
|
|
17
|
+
visible: false,
|
|
18
|
+
text: ''
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
componentWillUnmount() {
|
|
22
|
+
window.clearTimeout(this.timeout);
|
|
23
|
+
window.clearTimeout(this.transitionTimeout);
|
|
24
|
+
}
|
|
25
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
26
|
+
if (!nextProps.text) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (nextProps.timestamp === this.props.timestamp && nextState.visible === this.state.visible && nextState.text === this.state.text) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
setLeaveTimeout = () => {
|
|
35
|
+
const {
|
|
36
|
+
timeout
|
|
37
|
+
} = this.props;
|
|
38
|
+
this.timeout = window.setTimeout(() => {
|
|
39
|
+
this.setState({
|
|
40
|
+
visible: false
|
|
41
|
+
});
|
|
42
|
+
}, timeout);
|
|
43
|
+
};
|
|
44
|
+
componentDidUpdate(previousProps) {
|
|
31
45
|
const {
|
|
32
46
|
action,
|
|
33
47
|
text,
|
|
34
|
-
timeout,
|
|
35
48
|
timestamp
|
|
36
|
-
} = props;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// given text again. Preserved here deliberately to keep this refactor behaviour-identical.
|
|
40
|
-
const updateWhileTextIsPresent = update => {
|
|
41
|
-
if (committedProps.current.text) {
|
|
42
|
-
update();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const setLeaveTimeout = () => {
|
|
46
|
-
leaveTimeout.current = window.setTimeout(() => {
|
|
47
|
-
updateWhileTextIsPresent(() => setState(current => ({
|
|
48
|
-
...current,
|
|
49
|
-
visible: false
|
|
50
|
-
})));
|
|
51
|
-
}, timeout);
|
|
52
|
-
};
|
|
53
|
-
const show = () => {
|
|
54
|
-
setState(current => ({
|
|
55
|
-
...current,
|
|
49
|
+
} = this.props;
|
|
50
|
+
if (!previousProps.text) {
|
|
51
|
+
this.setState({
|
|
56
52
|
visible: true,
|
|
57
53
|
action,
|
|
58
54
|
text
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (!text) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (!previousProps.text) {
|
|
66
|
-
show();
|
|
55
|
+
}, () => {
|
|
56
|
+
this.setLeaveTimeout();
|
|
57
|
+
});
|
|
67
58
|
} else if (previousProps.timestamp !== timestamp) {
|
|
68
|
-
window.clearTimeout(
|
|
69
|
-
if (state.visible) {
|
|
70
|
-
setState(
|
|
71
|
-
...current,
|
|
59
|
+
window.clearTimeout(this.timeout);
|
|
60
|
+
if (this.state.visible) {
|
|
61
|
+
this.setState({
|
|
72
62
|
visible: false
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
}, () => {
|
|
64
|
+
this.transitionTimeout = window.setTimeout(() => {
|
|
65
|
+
this.setState({
|
|
66
|
+
visible: true,
|
|
67
|
+
action,
|
|
68
|
+
text
|
|
69
|
+
});
|
|
70
|
+
this.setLeaveTimeout();
|
|
71
|
+
}, CSS_TRANSITION_DURATION);
|
|
72
|
+
});
|
|
77
73
|
} else {
|
|
78
|
-
|
|
74
|
+
this.setState({
|
|
75
|
+
visible: true,
|
|
76
|
+
action,
|
|
77
|
+
text
|
|
78
|
+
});
|
|
79
|
+
this.setLeaveTimeout();
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
const {
|
|
85
|
+
action,
|
|
86
|
+
text,
|
|
87
|
+
visible
|
|
88
|
+
} = this.state;
|
|
89
|
+
const {
|
|
90
|
+
timeout
|
|
91
|
+
} = this.props;
|
|
92
|
+
return /*#__PURE__*/jsx("div", {
|
|
93
|
+
className: "snackbar",
|
|
94
|
+
"aria-live": "assertive",
|
|
95
|
+
role: "alert",
|
|
96
|
+
children: /*#__PURE__*/jsx(CSSTransition, {
|
|
97
|
+
nodeRef: this.bodyRef,
|
|
98
|
+
in: visible,
|
|
99
|
+
classNames: "snackbar__text-container",
|
|
100
|
+
timeout: {
|
|
101
|
+
appear: 0,
|
|
102
|
+
enter: timeout,
|
|
103
|
+
exit: CSS_TRANSITION_DURATION
|
|
104
|
+
},
|
|
105
|
+
unmountOnExit: true,
|
|
106
|
+
children: /*#__PURE__*/jsxs(Body, {
|
|
107
|
+
ref: this.bodyRef,
|
|
108
|
+
as: "span",
|
|
109
|
+
className: "snackbar__text",
|
|
110
|
+
children: [text, action ? /*#__PURE__*/jsx(Button, {
|
|
111
|
+
className: "snackbar__text__action",
|
|
112
|
+
v2: true,
|
|
113
|
+
size: "sm",
|
|
114
|
+
onClick: action.onClick,
|
|
115
|
+
children: action.label
|
|
116
|
+
}) : null]
|
|
117
|
+
})
|
|
116
118
|
})
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
Snackbar.contextType = DirectionContext;
|
|
120
123
|
var SnackbarPortal = withNextPortalWrapper(Snackbar);
|
|
121
124
|
|
|
122
125
|
export { Snackbar, SnackbarPortal as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.mjs","sources":["../../src/Snackbar/Snackbar.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Snackbar.mjs","sources":["../../src/Snackbar/Snackbar.tsx"],"sourcesContent":["import { Component, createRef } from 'react';\nimport { CSSTransition } from 'react-transition-group';\n\nimport Button from '../Button';\nimport Body from '../Body';\nimport type { ThemeDark, ThemeLight } from '../common';\nimport { DirectionContext } from '../Provider/Direction';\nimport withNextPortal from '../WithNextPortal/WithNextPortal';\n\nconst CSS_TRANSITION_DURATION = 400;\n\nexport interface SnackbarProps {\n action?: {\n label: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement>;\n };\n text: React.ReactNode;\n /** @deprecated */\n theme?: ThemeLight | ThemeDark;\n timeout: number;\n timestamp: number;\n}\n\ninterface SnackbarState extends Pick<SnackbarProps, 'action' | 'text' | 'theme'> {\n visible: boolean;\n}\n\nexport class Snackbar extends Component<SnackbarProps, SnackbarState> {\n bodyRef = createRef<HTMLSpanElement>();\n timeout = 0;\n transitionTimeout = 0;\n\n constructor(props: SnackbarProps) {\n super(props);\n this.state = {\n visible: false,\n text: '',\n };\n }\n\n componentWillUnmount() {\n window.clearTimeout(this.timeout);\n window.clearTimeout(this.transitionTimeout);\n }\n\n shouldComponentUpdate(nextProps: SnackbarProps, nextState: SnackbarState) {\n if (!nextProps.text) {\n return false;\n }\n if (\n nextProps.timestamp === this.props.timestamp &&\n nextState.visible === this.state.visible &&\n nextState.text === this.state.text\n ) {\n return false;\n }\n\n return true;\n }\n\n setLeaveTimeout = () => {\n const { timeout } = this.props;\n\n this.timeout = window.setTimeout(() => {\n this.setState({ visible: false });\n }, timeout);\n };\n\n componentDidUpdate(previousProps: SnackbarProps) {\n const { action, text, timestamp } = this.props;\n\n if (!previousProps.text) {\n this.setState({ visible: true, action, text }, () => {\n this.setLeaveTimeout();\n });\n } else if (previousProps.timestamp !== timestamp) {\n window.clearTimeout(this.timeout);\n\n if (this.state.visible) {\n this.setState({ visible: false }, () => {\n this.transitionTimeout = window.setTimeout(() => {\n this.setState({ visible: true, action, text });\n this.setLeaveTimeout();\n }, CSS_TRANSITION_DURATION);\n });\n } else {\n this.setState({ visible: true, action, text });\n this.setLeaveTimeout();\n }\n }\n }\n\n render() {\n const { action, text, visible } = this.state;\n const { timeout } = this.props;\n\n return (\n <div className=\"snackbar\" aria-live=\"assertive\" role=\"alert\">\n <CSSTransition\n nodeRef={this.bodyRef}\n in={visible}\n classNames=\"snackbar__text-container\"\n timeout={{\n appear: 0,\n enter: timeout,\n exit: CSS_TRANSITION_DURATION,\n }}\n unmountOnExit\n >\n <Body ref={this.bodyRef} as=\"span\" className=\"snackbar__text\">\n {text}\n {action ? (\n <Button className=\"snackbar__text__action\" v2 size=\"sm\" onClick={action.onClick}>\n {action.label}\n </Button>\n ) : null}\n </Body>\n </CSSTransition>\n </div>\n );\n }\n}\n\nSnackbar.contextType = DirectionContext;\n\nexport default withNextPortal(Snackbar);\n"],"names":["CSS_TRANSITION_DURATION","Snackbar","Component","bodyRef","createRef","timeout","transitionTimeout","constructor","props","state","visible","text","componentWillUnmount","window","clearTimeout","shouldComponentUpdate","nextProps","nextState","timestamp","setLeaveTimeout","setTimeout","setState","componentDidUpdate","previousProps","action","render","_jsx","className","role","children","CSSTransition","nodeRef","in","classNames","appear","enter","exit","unmountOnExit","_jsxs","Body","ref","as","Button","v2","size","onClick","label","contextType","DirectionContext","withNextPortal"],"mappings":";;;;;;;;AASA,MAAMA,uBAAuB,GAAG,GAAG;AAkB7B,MAAOC,QAAS,SAAQC,SAAuC,CAAA;EACnEC,OAAO,gBAAGC,SAAS,EAAmB;AACtCC,EAAAA,OAAO,GAAG,CAAC;AACXC,EAAAA,iBAAiB,GAAG,CAAC;EAErBC,WAAAA,CAAYC,KAAoB,EAAA;IAC9B,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,KAAK,GAAG;AACXC,MAAAA,OAAO,EAAE,KAAK;AACdC,MAAAA,IAAI,EAAE;KACP;AACH,EAAA;AAEAC,EAAAA,oBAAoBA,GAAA;AAClBC,IAAAA,MAAM,CAACC,YAAY,CAAC,IAAI,CAACT,OAAO,CAAC;AACjCQ,IAAAA,MAAM,CAACC,YAAY,CAAC,IAAI,CAACR,iBAAiB,CAAC;AAC7C,EAAA;AAEAS,EAAAA,qBAAqBA,CAACC,SAAwB,EAAEC,SAAwB,EAAA;AACtE,IAAA,IAAI,CAACD,SAAS,CAACL,IAAI,EAAE;AACnB,MAAA,OAAO,KAAK;AACd,IAAA;AACA,IAAA,IACEK,SAAS,CAACE,SAAS,KAAK,IAAI,CAACV,KAAK,CAACU,SAAS,IAC5CD,SAA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AI,EAAC,IAAI;YAACC,OAAO,EAAErB,MAAM,CAACqB,OAAQ;YAAAhB,QAAA,EAC7EL,MAAM,CAACsB;WACF,CAAC,GACP,IAAI;SACJ;OACO;AACjB,KAAK,CAAC;AAEV,EAAA;AACD;AAED7C,QAAQ,CAAC8C,WAAW,GAAGC,gBAAgB;AAEvC,qBAAeC,qBAAc,CAAChD,QAAQ,CAAC;;"}
|
package/build/i18n/de.json
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Wähle eine Option...",
|
|
36
36
|
"neptune.PhoneNumberInput.countryCodeLabel": "Ländercode",
|
|
37
37
|
"neptune.PhoneNumberInput.phoneNumberLabel": "Telefonnummer",
|
|
38
|
+
"neptune.PhoneNumberInput.phoneNumberPrefix": "Vorwahl",
|
|
38
39
|
"neptune.Select.searchPlaceholder": "Wird gesucht...",
|
|
39
40
|
"neptune.SelectInput.noResultsFound": "Keine Ergebnisse gefunden",
|
|
40
41
|
"neptune.StatusIcon.iconLabel.error": "Fehler:",
|
package/build/i18n/de.json.js
CHANGED
|
@@ -39,6 +39,7 @@ var de = {
|
|
|
39
39
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Wähle eine Option...",
|
|
40
40
|
"neptune.PhoneNumberInput.countryCodeLabel": "Ländercode",
|
|
41
41
|
"neptune.PhoneNumberInput.phoneNumberLabel": "Telefonnummer",
|
|
42
|
+
"neptune.PhoneNumberInput.phoneNumberPrefix": "Vorwahl",
|
|
42
43
|
"neptune.Select.searchPlaceholder": "Wird gesucht...",
|
|
43
44
|
"neptune.SelectInput.noResultsFound": "Keine Ergebnisse gefunden",
|
|
44
45
|
"neptune.StatusIcon.iconLabel.error": "Fehler:",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"de.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/de.json.mjs
CHANGED
|
@@ -35,6 +35,7 @@ var de = {
|
|
|
35
35
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Wähle eine Option...",
|
|
36
36
|
"neptune.PhoneNumberInput.countryCodeLabel": "Ländercode",
|
|
37
37
|
"neptune.PhoneNumberInput.phoneNumberLabel": "Telefonnummer",
|
|
38
|
+
"neptune.PhoneNumberInput.phoneNumberPrefix": "Vorwahl",
|
|
38
39
|
"neptune.Select.searchPlaceholder": "Wird gesucht...",
|
|
39
40
|
"neptune.SelectInput.noResultsFound": "Keine Ergebnisse gefunden",
|
|
40
41
|
"neptune.StatusIcon.iconLabel.error": "Fehler:",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"de.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/fr.json
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Sélectionnez une option…",
|
|
36
36
|
"neptune.PhoneNumberInput.countryCodeLabel": "Code pays",
|
|
37
37
|
"neptune.PhoneNumberInput.phoneNumberLabel": "Numéro de téléphone",
|
|
38
|
+
"neptune.PhoneNumberInput.phoneNumberPrefix": "Indicatif",
|
|
38
39
|
"neptune.Select.searchPlaceholder": "Recherche...",
|
|
39
40
|
"neptune.SelectInput.noResultsFound": "Aucun résultat trouvé",
|
|
40
41
|
"neptune.StatusIcon.iconLabel.error": "Erreur :",
|
package/build/i18n/fr.json.js
CHANGED
|
@@ -39,6 +39,7 @@ var fr = {
|
|
|
39
39
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Sélectionnez une option…",
|
|
40
40
|
"neptune.PhoneNumberInput.countryCodeLabel": "Code pays",
|
|
41
41
|
"neptune.PhoneNumberInput.phoneNumberLabel": "Numéro de téléphone",
|
|
42
|
+
"neptune.PhoneNumberInput.phoneNumberPrefix": "Indicatif",
|
|
42
43
|
"neptune.Select.searchPlaceholder": "Recherche...",
|
|
43
44
|
"neptune.SelectInput.noResultsFound": "Aucun résultat trouvé",
|
|
44
45
|
"neptune.StatusIcon.iconLabel.error": "Erreur :",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fr.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fr.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/fr.json.mjs
CHANGED
|
@@ -35,6 +35,7 @@ var fr = {
|
|
|
35
35
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "Sélectionnez une option…",
|
|
36
36
|
"neptune.PhoneNumberInput.countryCodeLabel": "Code pays",
|
|
37
37
|
"neptune.PhoneNumberInput.phoneNumberLabel": "Numéro de téléphone",
|
|
38
|
+
"neptune.PhoneNumberInput.phoneNumberPrefix": "Indicatif",
|
|
38
39
|
"neptune.Select.searchPlaceholder": "Recherche...",
|
|
39
40
|
"neptune.SelectInput.noResultsFound": "Aucun résultat trouvé",
|
|
40
41
|
"neptune.StatusIcon.iconLabel.error": "Erreur :",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fr.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fr.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/th.json
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "เลือกตัวเลือก...",
|
|
36
36
|
"neptune.PhoneNumberInput.countryCodeLabel": "รหัสประเทศ",
|
|
37
37
|
"neptune.PhoneNumberInput.phoneNumberLabel": "หมายเลขโทรศัพท์",
|
|
38
|
+
"neptune.PhoneNumberInput.phoneNumberPrefix": "คำนำหน้า",
|
|
38
39
|
"neptune.Select.searchPlaceholder": "ค้นหา...",
|
|
39
40
|
"neptune.SelectInput.noResultsFound": "ไม่พบผลลัพธ์",
|
|
40
41
|
"neptune.StatusIcon.iconLabel.error": "ข้อผิดพลาด:",
|
package/build/i18n/th.json.js
CHANGED
|
@@ -39,6 +39,7 @@ var th = {
|
|
|
39
39
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "เลือกตัวเลือก...",
|
|
40
40
|
"neptune.PhoneNumberInput.countryCodeLabel": "รหัสประเทศ",
|
|
41
41
|
"neptune.PhoneNumberInput.phoneNumberLabel": "หมายเลขโทรศัพท์",
|
|
42
|
+
"neptune.PhoneNumberInput.phoneNumberPrefix": "คำนำหน้า",
|
|
42
43
|
"neptune.Select.searchPlaceholder": "ค้นหา...",
|
|
43
44
|
"neptune.SelectInput.noResultsFound": "ไม่พบผลลัพธ์",
|
|
44
45
|
"neptune.StatusIcon.iconLabel.error": "ข้อผิดพลาด:",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"th.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"th.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/i18n/th.json.mjs
CHANGED
|
@@ -35,6 +35,7 @@ var th = {
|
|
|
35
35
|
"neptune.PhoneNumberInput.SelectInput.placeholder": "เลือกตัวเลือก...",
|
|
36
36
|
"neptune.PhoneNumberInput.countryCodeLabel": "รหัสประเทศ",
|
|
37
37
|
"neptune.PhoneNumberInput.phoneNumberLabel": "หมายเลขโทรศัพท์",
|
|
38
|
+
"neptune.PhoneNumberInput.phoneNumberPrefix": "คำนำหน้า",
|
|
38
39
|
"neptune.Select.searchPlaceholder": "ค้นหา...",
|
|
39
40
|
"neptune.SelectInput.noResultsFound": "ไม่พบผลลัพธ์",
|
|
40
41
|
"neptune.StatusIcon.iconLabel.error": "ข้อผิดพลาด:",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"th.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"th.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/main.css
CHANGED
|
@@ -23806,6 +23806,11 @@ button.np-option {
|
|
|
23806
23806
|
padding-inline: 0;
|
|
23807
23807
|
container-type: inline-size;
|
|
23808
23808
|
}
|
|
23809
|
+
.wds-list-item-paddingY-24 {
|
|
23810
|
+
padding-block: 24px;
|
|
23811
|
+
padding-block: var(--size-24);
|
|
23812
|
+
padding-inline: 0;
|
|
23813
|
+
}
|
|
23809
23814
|
.wds-list-item + .wds-list-item-spotlight,
|
|
23810
23815
|
.wds-list-item-spotlight + .wds-list-item {
|
|
23811
23816
|
margin-block-start: 16px;
|
|
@@ -397,6 +397,11 @@
|
|
|
397
397
|
padding-inline: 0;
|
|
398
398
|
container-type: inline-size;
|
|
399
399
|
}
|
|
400
|
+
.wds-list-item-paddingY-24 {
|
|
401
|
+
padding-block: 24px;
|
|
402
|
+
padding-block: var(--size-24);
|
|
403
|
+
padding-inline: 0;
|
|
404
|
+
}
|
|
400
405
|
.wds-list-item + .wds-list-item-spotlight,
|
|
401
406
|
.wds-list-item-spotlight + .wds-list-item {
|
|
402
407
|
margin-block-start: 16px;
|
package/build/styles/main.css
CHANGED
|
@@ -23806,6 +23806,11 @@ button.np-option {
|
|
|
23806
23806
|
padding-inline: 0;
|
|
23807
23807
|
container-type: inline-size;
|
|
23808
23808
|
}
|
|
23809
|
+
.wds-list-item-paddingY-24 {
|
|
23810
|
+
padding-block: 24px;
|
|
23811
|
+
padding-block: var(--size-24);
|
|
23812
|
+
padding-inline: 0;
|
|
23813
|
+
}
|
|
23809
23814
|
.wds-list-item + .wds-list-item-spotlight,
|
|
23810
23815
|
.wds-list-item-spotlight + .wds-list-item {
|
|
23811
23816
|
margin-block-start: 16px;
|
|
@@ -28,6 +28,11 @@ export type ListItemProps = {
|
|
|
28
28
|
* Highlights the list item as an action to be taken or already taken. <br />
|
|
29
29
|
*/
|
|
30
30
|
spotlight?: 'active' | 'inactive';
|
|
31
|
+
/**
|
|
32
|
+
* Vertical padding of the list item, in pixels.
|
|
33
|
+
* @default 12
|
|
34
|
+
*/
|
|
35
|
+
paddingY?: 12 | 24;
|
|
31
36
|
title: ReactNode;
|
|
32
37
|
subtitle?: ReactNode;
|
|
33
38
|
/**
|
|
@@ -72,7 +77,7 @@ export type ListItemProps = {
|
|
|
72
77
|
* @see [Storybook documentation](https://storybook.wise.design/?path=/docs/content-listitem--docs)
|
|
73
78
|
*/
|
|
74
79
|
export declare const ListItem: {
|
|
75
|
-
({ as: ListItemElement, title, subtitle, additionalInfo, prompt, inverted, media, spotlight, valueTitle, valueSubtitle, control, disabled, disabledPromptMessage, className, valueColumnWidth, id, }: ListItemProps): import("react").JSX.Element;
|
|
80
|
+
({ as: ListItemElement, title, subtitle, additionalInfo, prompt, inverted, media, spotlight, paddingY, valueTitle, valueSubtitle, control, disabled, disabledPromptMessage, className, valueColumnWidth, id, }: ListItemProps): import("react").JSX.Element;
|
|
76
81
|
Image: {
|
|
77
82
|
({ alt, size, className, ...props }: import("./Image").ListItemImageProps): import("react").JSX.Element;
|
|
78
83
|
displayName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../src/ListItem/ListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAc,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAY,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAc,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EAAU,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAS,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAU,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAY5D,MAAM,MAAM,aAAa,GACvB,iBAAiB,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEhG,MAAM,MAAM,oBAAoB,GAC5B,uBAAuB,GACvB,qBAAqB,GACrB,mBAAmB,GACnB,uBAAuB,GACvB,kBAAkB,GAClB,mBAAmB,CAAC;AAExB,MAAM,MAAM,aAAa,GAAG;IAC1B,oBAAoB;IACpB,EAAE,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,SAAS,CAAC;IAClC;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAClC,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,S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B;IACpB,EAAE,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,SAAS,CAAC;IAClC;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ;oNAkBlB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Of,CAAC;AA6GF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
1
2
|
import type { ThemeDark, ThemeLight } from '../common';
|
|
2
3
|
export interface SnackbarProps {
|
|
3
4
|
action?: {
|
|
@@ -10,7 +11,20 @@ export interface SnackbarProps {
|
|
|
10
11
|
timeout: number;
|
|
11
12
|
timestamp: number;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
interface SnackbarState extends Pick<SnackbarProps, 'action' | 'text' | 'theme'> {
|
|
15
|
+
visible: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class Snackbar extends Component<SnackbarProps, SnackbarState> {
|
|
18
|
+
bodyRef: import("react").RefObject<HTMLSpanElement>;
|
|
19
|
+
timeout: number;
|
|
20
|
+
transitionTimeout: number;
|
|
21
|
+
constructor(props: SnackbarProps);
|
|
22
|
+
componentWillUnmount(): void;
|
|
23
|
+
shouldComponentUpdate(nextProps: SnackbarProps, nextState: SnackbarState): boolean;
|
|
24
|
+
setLeaveTimeout: () => void;
|
|
25
|
+
componentDidUpdate(previousProps: SnackbarProps): void;
|
|
26
|
+
render(): import("react").JSX.Element;
|
|
27
|
+
}
|
|
14
28
|
declare const _default: (props: SnackbarProps) => import("react").ReactPortal | null;
|
|
15
29
|
export default _default;
|
|
16
30
|
//# sourceMappingURL=Snackbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/Snackbar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../../src/Snackbar/Snackbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAK7C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAMvD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;KACtD,CAAC;IACF,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,kBAAkB;IAClB,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,aAAc,SAAQ,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9E,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,QAAS,SAAQ,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IACnE,OAAO,6CAAgC;IACvC,OAAO,SAAK;IACZ,iBAAiB,SAAK;gBAEV,KAAK,EAAE,aAAa;IAQhC,oBAAoB;IAKpB,qBAAqB,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa;IAexE,eAAe,aAMb;IAEF,kBAAkB,CAAC,aAAa,EAAE,aAAa;IAwB/C,MAAM;CA6BP;;AAID,wBAAwC"}
|
package/package.json
CHANGED
|
@@ -397,6 +397,11 @@
|
|
|
397
397
|
padding-inline: 0;
|
|
398
398
|
container-type: inline-size;
|
|
399
399
|
}
|
|
400
|
+
.wds-list-item-paddingY-24 {
|
|
401
|
+
padding-block: 24px;
|
|
402
|
+
padding-block: var(--size-24);
|
|
403
|
+
padding-inline: 0;
|
|
404
|
+
}
|
|
400
405
|
.wds-list-item + .wds-list-item-spotlight,
|
|
401
406
|
.wds-list-item-spotlight + .wds-list-item {
|
|
402
407
|
margin-block-start: 16px;
|
|
@@ -1513,6 +1513,23 @@ describe('ListItem', () => {
|
|
|
1513
1513
|
});
|
|
1514
1514
|
});
|
|
1515
1515
|
|
|
1516
|
+
describe('paddingY', () => {
|
|
1517
|
+
it('uses the default vertical padding when not set', () => {
|
|
1518
|
+
render(<ListItem title="Test Title" />);
|
|
1519
|
+
expect(screen.getByRole('listitem')).not.toHaveClass('wds-list-item-paddingY-24');
|
|
1520
|
+
});
|
|
1521
|
+
|
|
1522
|
+
it('uses the default vertical padding when set to 12', () => {
|
|
1523
|
+
render(<ListItem title="Test Title" paddingY={12} />);
|
|
1524
|
+
expect(screen.getByRole('listitem')).not.toHaveClass('wds-list-item-paddingY-24');
|
|
1525
|
+
});
|
|
1526
|
+
|
|
1527
|
+
it('uses the larger vertical padding when set to 24', () => {
|
|
1528
|
+
render(<ListItem title="Test Title" paddingY={24} />);
|
|
1529
|
+
expect(screen.getByRole('listitem')).toHaveClass('wds-list-item-paddingY-24');
|
|
1530
|
+
});
|
|
1531
|
+
});
|
|
1532
|
+
|
|
1516
1533
|
describe('disable states', () => {
|
|
1517
1534
|
describe('short-lived', () => {
|
|
1518
1535
|
it('should override existing prompt if disabled and disabledPromptMessage are set', () => {
|
|
@@ -59,6 +59,11 @@ export type ListItemProps = {
|
|
|
59
59
|
* Highlights the list item as an action to be taken or already taken. <br />
|
|
60
60
|
*/
|
|
61
61
|
spotlight?: 'active' | 'inactive';
|
|
62
|
+
/**
|
|
63
|
+
* Vertical padding of the list item, in pixels.
|
|
64
|
+
* @default 12
|
|
65
|
+
*/
|
|
66
|
+
paddingY?: 12 | 24;
|
|
62
67
|
title: ReactNode;
|
|
63
68
|
subtitle?: ReactNode;
|
|
64
69
|
/**
|
|
@@ -112,6 +117,7 @@ export const ListItem = ({
|
|
|
112
117
|
inverted,
|
|
113
118
|
media,
|
|
114
119
|
spotlight,
|
|
120
|
+
paddingY = 12,
|
|
115
121
|
valueTitle,
|
|
116
122
|
valueSubtitle,
|
|
117
123
|
control = null,
|
|
@@ -232,6 +238,7 @@ export const ListItem = ({
|
|
|
232
238
|
'wds-list-item-partially-interactive': isPartiallyInteractive,
|
|
233
239
|
[`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]:
|
|
234
240
|
isFullyInteractive && !!spotlight,
|
|
241
|
+
'wds-list-item-paddingY-24': paddingY === 24,
|
|
235
242
|
disabled: disabled && !isPartiallyInteractive,
|
|
236
243
|
'disabled--has-prompt-reason':
|
|
237
244
|
!disabledPromptMessage && disabled && !isPartiallyInteractive,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fragment } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
|
+
import { Plane } from '@transferwise/icons';
|
|
3
4
|
import List from '../../List';
|
|
4
5
|
import { ListItem, type ListItemProps } from '../ListItem';
|
|
5
6
|
import { lorem10, lorem20, lorem5 } from '../../test-utils';
|
|
@@ -61,6 +62,28 @@ export const GapsBetweenItems: Story = {
|
|
|
61
62
|
},
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
export const PaddingY: Story = {
|
|
66
|
+
render: () => {
|
|
67
|
+
const props = {
|
|
68
|
+
title: lorem5,
|
|
69
|
+
subtitle: lorem10,
|
|
70
|
+
media: <ListItem.AvatarLayout size={32} avatars={[{ asset: <Plane /> }, { asset: '7+' }]} />,
|
|
71
|
+
control: CONTROLS.navigation,
|
|
72
|
+
};
|
|
73
|
+
return (
|
|
74
|
+
<List>
|
|
75
|
+
{([12, 24] as const).map((paddingY) => (
|
|
76
|
+
<Fragment key={paddingY}>
|
|
77
|
+
<ListItem {...props} paddingY={paddingY} />
|
|
78
|
+
<ListItem {...props} paddingY={paddingY} spotlight="active" />
|
|
79
|
+
<ListItem {...props} paddingY={paddingY} spotlight="inactive" />
|
|
80
|
+
</Fragment>
|
|
81
|
+
))}
|
|
82
|
+
</List>
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
64
87
|
type PreviewStoryArgs = ListItemProps & {
|
|
65
88
|
previewImageSize: ListItemMediaSize;
|
|
66
89
|
previewWithLineGuides: boolean;
|