@transferwise/components 46.52.0 → 46.52.2

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.
Files changed (47) hide show
  1. package/build/i18n/pt.json +2 -0
  2. package/build/i18n/pt.json.js +2 -0
  3. package/build/i18n/pt.json.js.map +1 -1
  4. package/build/i18n/pt.json.mjs +2 -0
  5. package/build/i18n/pt.json.mjs.map +1 -1
  6. package/build/i18n/zh-CN.json +2 -0
  7. package/build/i18n/zh-CN.json.js +2 -0
  8. package/build/i18n/zh-CN.json.js.map +1 -1
  9. package/build/i18n/zh-CN.json.mjs +2 -0
  10. package/build/i18n/zh-CN.json.mjs.map +1 -1
  11. package/build/inputs/SelectInput.js +4 -0
  12. package/build/inputs/SelectInput.js.map +1 -1
  13. package/build/inputs/SelectInput.mjs +4 -0
  14. package/build/inputs/SelectInput.mjs.map +1 -1
  15. package/build/main.css +1 -0
  16. package/build/styles/inputs/InputGroup.css +1 -0
  17. package/build/styles/main.css +1 -0
  18. package/build/typeahead/Typeahead.js +63 -59
  19. package/build/typeahead/Typeahead.js.map +1 -1
  20. package/build/typeahead/Typeahead.messages.js +12 -0
  21. package/build/typeahead/Typeahead.messages.js.map +1 -0
  22. package/build/typeahead/Typeahead.messages.mjs +10 -0
  23. package/build/typeahead/Typeahead.messages.mjs.map +1 -0
  24. package/build/typeahead/Typeahead.mjs +63 -59
  25. package/build/typeahead/Typeahead.mjs.map +1 -1
  26. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  27. package/build/types/typeahead/Typeahead.d.ts +2 -1
  28. package/build/types/typeahead/Typeahead.d.ts.map +1 -1
  29. package/build/types/typeahead/Typeahead.messages.d.ts +9 -0
  30. package/build/types/typeahead/Typeahead.messages.d.ts.map +1 -0
  31. package/package.json +3 -3
  32. package/src/dateInput/DateInput.spec.tsx +9 -9
  33. package/src/dateInput/DateInput.tests.story.tsx +1 -1
  34. package/src/i18n/pt.json +2 -0
  35. package/src/i18n/zh-CN.json +2 -0
  36. package/src/inputs/InputGroup.css +1 -0
  37. package/src/inputs/InputGroup.less +1 -0
  38. package/src/inputs/SelectInput.spec.tsx +5 -5
  39. package/src/inputs/SelectInput.story.tsx +19 -7
  40. package/src/inputs/SelectInput.tsx +4 -0
  41. package/src/main.css +1 -0
  42. package/src/moneyInput/MoneyInput.story.tsx +1 -1
  43. package/src/typeahead/Typeahead.messages.ts +9 -0
  44. package/src/typeahead/Typeahead.rtl.spec.tsx +13 -1
  45. package/src/typeahead/Typeahead.spec.js +12 -10
  46. package/src/typeahead/Typeahead.story.tsx +194 -195
  47. package/src/typeahead/Typeahead.tsx +16 -9
@@ -1,27 +1,28 @@
1
- /* eslint-disable jsx-a11y/anchor-is-valid */
2
- /* eslint-disable jsx-a11y/click-events-have-key-events */
3
- /* eslint-disable jsx-a11y/no-static-element-interactions */
4
-
5
1
  import { Cross as CrossIcon } from '@transferwise/icons';
6
2
  import { clsx } from 'clsx';
7
3
  import { DebouncedFunc } from 'lodash';
8
4
  import clamp from 'lodash.clamp';
9
5
  import debounce from 'lodash.debounce';
10
6
  import { Component, ReactNode } from 'react';
7
+ import { injectIntl, WrappedComponentProps } from 'react-intl';
11
8
 
12
9
  import Chip from '../chips/Chip';
13
- import { Size, Sentiment, SizeMedium, SizeLarge } from '../common';
14
10
  import {
11
+ Size,
12
+ Sentiment,
13
+ SizeMedium,
14
+ SizeLarge,
15
15
  addClickClassToDocumentOnIos,
16
16
  removeClickClassFromDocumentOnIos,
17
17
  stopPropagation,
18
- } from '../common/domHelpers';
18
+ } from '../common';
19
19
  import InlineAlert from '../inlineAlert';
20
20
  import { InlineAlertProps } from '../inlineAlert/InlineAlert';
21
21
  import { withInputAttributes, WithInputAttributesProps } from '../inputs/contexts';
22
22
 
23
23
  import TypeaheadInput from './typeaheadInput/TypeaheadInput';
24
24
  import TypeaheadOption from './typeaheadOption/TypeaheadOption';
25
+ import messages from './Typeahead.messages';
25
26
 
26
27
  const DEFAULT_MIN_QUERY_LENGTH = 3;
27
28
  const SEARCH_DELAY = 200;
@@ -35,7 +36,7 @@ export type TypeaheadOption<T = string> = {
35
36
  keepFocusOnSelect?: boolean;
36
37
  };
37
38
 
38
- export interface TypeaheadProps<T> {
39
+ export interface TypeaheadProps<T> extends WrappedComponentProps {
39
40
  id: string;
40
41
  name: string;
41
42
  addon?: ReactNode;
@@ -464,6 +465,7 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
464
465
  const hasWarning = displayAlert && alertType === Sentiment.WARNING;
465
466
  const hasInfo = displayAlert && alertType === Sentiment.NEUTRAL;
466
467
  return (
468
+ /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */
467
469
  <div
468
470
  role="group"
469
471
  {...inputAttributes}
@@ -513,7 +515,12 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
513
515
 
514
516
  {clearButton && (
515
517
  <div className="input-group-addon">
516
- <button type="button" className="btn-unstyled" onClick={this.clear}>
518
+ <button
519
+ type="button"
520
+ className="btn-unstyled"
521
+ aria-label={this.props.intl.formatMessage(messages.clearLabel)}
522
+ onClick={this.clear}
523
+ >
517
524
  <CrossIcon />
518
525
  </button>
519
526
  </div>
@@ -526,6 +533,6 @@ class Typeahead<T> extends Component<TypeaheadPropsWithInputAttributes<T>, Typea
526
533
  }
527
534
  }
528
535
 
529
- export default withInputAttributes(Typeahead, { nonLabelable: true }) as <T>(
536
+ export default injectIntl(withInputAttributes(Typeahead, { nonLabelable: true })) as <T>(
530
537
  props: TypeaheadProps<T>,
531
538
  ) => React.ReactElement;