@transferwise/components 0.0.0-experimental-3e282e9 → 0.0.0-experimental-c0c64e3
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/index.esm.js +19 -5
- package/build/index.esm.js.map +1 -1
- package/build/index.js +19 -5
- package/build/index.js.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +6 -2
- package/build/types/info/Info.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/body/Body.story.tsx +14 -2
- package/src/dateLookup/DateLookup.js +7 -5
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +6 -0
- package/src/dateLookup/tableLink/TableLink.tsx +6 -3
- package/src/info/Info.tsx +6 -1
package/build/index.esm.js
CHANGED
|
@@ -3613,7 +3613,11 @@ const TableLink = ({
|
|
|
3613
3613
|
children: /*#__PURE__*/jsx("button", {
|
|
3614
3614
|
ref: buttonRef,
|
|
3615
3615
|
type: "button",
|
|
3616
|
-
className: `tw-date-lookup-${type}-option
|
|
3616
|
+
className: classNames(`tw-date-lookup-${type}-option np-text-body-default-bold`, {
|
|
3617
|
+
active: !!active
|
|
3618
|
+
}, {
|
|
3619
|
+
today: !!today
|
|
3620
|
+
}),
|
|
3617
3621
|
disabled: disabled,
|
|
3618
3622
|
tabIndex: autofocus ? 0 : -1,
|
|
3619
3623
|
"aria-label": calculateAriaLabel(),
|
|
@@ -4167,6 +4171,7 @@ class DateLookup extends PureComponent {
|
|
|
4167
4171
|
super(props);
|
|
4168
4172
|
this.state = {
|
|
4169
4173
|
selectedDate: getStartOfDay(props.value),
|
|
4174
|
+
originalDate: null,
|
|
4170
4175
|
min: getStartOfDay(props.min),
|
|
4171
4176
|
max: getStartOfDay(props.max),
|
|
4172
4177
|
viewMonth: (props.value || new Date()).getMonth(),
|
|
@@ -4242,7 +4247,8 @@ class DateLookup extends PureComponent {
|
|
|
4242
4247
|
};
|
|
4243
4248
|
handleKeyDown = event => {
|
|
4244
4249
|
const {
|
|
4245
|
-
open
|
|
4250
|
+
open,
|
|
4251
|
+
originalDate
|
|
4246
4252
|
} = this.state;
|
|
4247
4253
|
switch (event.keyCode) {
|
|
4248
4254
|
case KeyCodes.LEFT:
|
|
@@ -4278,6 +4284,7 @@ class DateLookup extends PureComponent {
|
|
|
4278
4284
|
event.preventDefault();
|
|
4279
4285
|
break;
|
|
4280
4286
|
case KeyCodes.ESCAPE:
|
|
4287
|
+
this.props.onChange(originalDate);
|
|
4281
4288
|
this.close();
|
|
4282
4289
|
event.preventDefault();
|
|
4283
4290
|
break;
|
|
@@ -4288,8 +4295,14 @@ class DateLookup extends PureComponent {
|
|
|
4288
4295
|
selectedDate,
|
|
4289
4296
|
min,
|
|
4290
4297
|
max,
|
|
4291
|
-
mode
|
|
4298
|
+
mode,
|
|
4299
|
+
originalDate
|
|
4292
4300
|
} = this.state;
|
|
4301
|
+
if (originalDate === null) {
|
|
4302
|
+
this.setState({
|
|
4303
|
+
originalDate: selectedDate
|
|
4304
|
+
});
|
|
4305
|
+
}
|
|
4293
4306
|
let date;
|
|
4294
4307
|
if (selectedDate) {
|
|
4295
4308
|
date = new Date(mode === MODE.YEAR ? selectedDate.getFullYear() + yearsToAdd : selectedDate.getFullYear(), mode === MODE.MONTH ? selectedDate.getMonth() + monthsToAdd : selectedDate.getMonth(), mode === MODE.DAY ? selectedDate.getDate() + daysToAdd : selectedDate.getDate());
|
|
@@ -6161,7 +6174,8 @@ const Info = ({
|
|
|
6161
6174
|
presentation = InfoPresentation.POPOVER,
|
|
6162
6175
|
size = Size.SMALL,
|
|
6163
6176
|
title = undefined,
|
|
6164
|
-
'aria-label': ariaLabel
|
|
6177
|
+
'aria-label': ariaLabel,
|
|
6178
|
+
preferredPlacement = Position.BOTTOM
|
|
6165
6179
|
}) => {
|
|
6166
6180
|
const [open, setOpen] = useState(false);
|
|
6167
6181
|
const isModal = presentation === InfoPresentation.MODAL;
|
|
@@ -6196,7 +6210,7 @@ const Info = ({
|
|
|
6196
6210
|
})]
|
|
6197
6211
|
}) : /*#__PURE__*/jsx(Popover$2, {
|
|
6198
6212
|
content: content,
|
|
6199
|
-
preferredPlacement:
|
|
6213
|
+
preferredPlacement: preferredPlacement,
|
|
6200
6214
|
title: title,
|
|
6201
6215
|
children: /*#__PURE__*/jsx("button", {
|
|
6202
6216
|
type: "button",
|