@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.js CHANGED
@@ -3647,7 +3647,11 @@ const TableLink = ({
3647
3647
  children: /*#__PURE__*/jsxRuntime.jsx("button", {
3648
3648
  ref: buttonRef,
3649
3649
  type: "button",
3650
- className: `tw-date-lookup-${type}-option ${active ? 'active' : ''} ${today ? 'today' : ''} np-text-body-default-bold`,
3650
+ className: classNames__default.default(`tw-date-lookup-${type}-option np-text-body-default-bold`, {
3651
+ active: !!active
3652
+ }, {
3653
+ today: !!today
3654
+ }),
3651
3655
  disabled: disabled,
3652
3656
  tabIndex: autofocus ? 0 : -1,
3653
3657
  "aria-label": calculateAriaLabel(),
@@ -4201,6 +4205,7 @@ class DateLookup extends React.PureComponent {
4201
4205
  super(props);
4202
4206
  this.state = {
4203
4207
  selectedDate: getStartOfDay(props.value),
4208
+ originalDate: null,
4204
4209
  min: getStartOfDay(props.min),
4205
4210
  max: getStartOfDay(props.max),
4206
4211
  viewMonth: (props.value || new Date()).getMonth(),
@@ -4276,7 +4281,8 @@ class DateLookup extends React.PureComponent {
4276
4281
  };
4277
4282
  handleKeyDown = event => {
4278
4283
  const {
4279
- open
4284
+ open,
4285
+ originalDate
4280
4286
  } = this.state;
4281
4287
  switch (event.keyCode) {
4282
4288
  case KeyCodes.LEFT:
@@ -4312,6 +4318,7 @@ class DateLookup extends React.PureComponent {
4312
4318
  event.preventDefault();
4313
4319
  break;
4314
4320
  case KeyCodes.ESCAPE:
4321
+ this.props.onChange(originalDate);
4315
4322
  this.close();
4316
4323
  event.preventDefault();
4317
4324
  break;
@@ -4322,8 +4329,14 @@ class DateLookup extends React.PureComponent {
4322
4329
  selectedDate,
4323
4330
  min,
4324
4331
  max,
4325
- mode
4332
+ mode,
4333
+ originalDate
4326
4334
  } = this.state;
4335
+ if (originalDate === null) {
4336
+ this.setState({
4337
+ originalDate: selectedDate
4338
+ });
4339
+ }
4327
4340
  let date;
4328
4341
  if (selectedDate) {
4329
4342
  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());
@@ -6195,7 +6208,8 @@ const Info = ({
6195
6208
  presentation = exports.InfoPresentation.POPOVER,
6196
6209
  size = exports.Size.SMALL,
6197
6210
  title = undefined,
6198
- 'aria-label': ariaLabel
6211
+ 'aria-label': ariaLabel,
6212
+ preferredPlacement = exports.Position.BOTTOM
6199
6213
  }) => {
6200
6214
  const [open, setOpen] = React.useState(false);
6201
6215
  const isModal = presentation === exports.InfoPresentation.MODAL;
@@ -6230,7 +6244,7 @@ const Info = ({
6230
6244
  })]
6231
6245
  }) : /*#__PURE__*/jsxRuntime.jsx(Popover$2, {
6232
6246
  content: content,
6233
- preferredPlacement: exports.Position.BOTTOM,
6247
+ preferredPlacement: preferredPlacement,
6234
6248
  title: title,
6235
6249
  children: /*#__PURE__*/jsxRuntime.jsx("button", {
6236
6250
  type: "button",