@transferwise/components 45.20.0 → 45.21.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.
Files changed (131) hide show
  1. package/build/i18n/cs.json +11 -3
  2. package/build/i18n/de.json +11 -3
  3. package/build/i18n/en.json +1 -0
  4. package/build/i18n/es.json +11 -3
  5. package/build/i18n/fr.json +11 -3
  6. package/build/i18n/hu.json +11 -3
  7. package/build/i18n/id.json +11 -3
  8. package/build/i18n/it.json +11 -3
  9. package/build/i18n/ja.json +11 -3
  10. package/build/i18n/pl.json +11 -3
  11. package/build/i18n/pt.json +11 -3
  12. package/build/i18n/ro.json +11 -3
  13. package/build/i18n/ru.json +11 -3
  14. package/build/i18n/th.json +11 -3
  15. package/build/i18n/tr.json +11 -3
  16. package/build/i18n/uk.json +11 -3
  17. package/build/i18n/zh-CN.json +11 -3
  18. package/build/i18n/{zh.json → zh-HK.json} +11 -3
  19. package/build/index.esm.js +535 -236
  20. package/build/index.esm.js.map +1 -1
  21. package/build/index.js +535 -236
  22. package/build/index.js.map +1 -1
  23. package/build/main.css +1 -1
  24. package/build/styles/actionButton/ActionButton.css +1 -1
  25. package/build/styles/chips/Chip.css +1 -1
  26. package/build/styles/circularButton/CircularButton.css +1 -1
  27. package/build/styles/common/Option/Option.css +1 -1
  28. package/build/styles/common/bottomSheet/BottomSheet.css +1 -1
  29. package/build/styles/common/closeButton/CloseButton.css +1 -1
  30. package/build/styles/dateLookup/DateLookup.css +1 -1
  31. package/build/styles/drawer/Drawer.css +1 -1
  32. package/build/styles/flowNavigation/FlowNavigation.css +1 -1
  33. package/build/styles/inputs/SelectInput.css +1 -1
  34. package/build/styles/main.css +1 -1
  35. package/build/styles/overlayHeader/OverlayHeader.css +1 -1
  36. package/build/styles/statusIcon/StatusIcon.css +1 -1
  37. package/build/styles/summary/Summary.css +1 -1
  38. package/build/styles/typeahead/Typeahead.css +1 -1
  39. package/build/styles/uploadInput/UploadInput.css +1 -1
  40. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  41. package/build/types/common/locale/index.d.ts +10 -1
  42. package/build/types/common/locale/index.d.ts.map +1 -1
  43. package/build/types/common/propsValues/breakpoint.d.ts +1 -0
  44. package/build/types/common/propsValues/breakpoint.d.ts.map +1 -1
  45. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  46. package/build/types/dateLookup/dateHeader/DateHeader.d.ts.map +1 -1
  47. package/build/types/i18n/index.d.ts.map +1 -1
  48. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  49. package/build/types/inputs/SelectInput.messages.d.ts +9 -0
  50. package/build/types/inputs/SelectInput.messages.d.ts.map +1 -0
  51. package/build/types/test-utils/story-config.d.ts +11 -1
  52. package/build/types/test-utils/story-config.d.ts.map +1 -1
  53. package/build/types/test-utils/window-mock.d.ts +2 -0
  54. package/build/types/test-utils/window-mock.d.ts.map +1 -0
  55. package/package.json +4 -4
  56. package/src/actionButton/ActionButton.css +1 -1
  57. package/src/actionButton/ActionButton.less +5 -1
  58. package/src/chips/Chip.css +1 -1
  59. package/src/chips/Chip.less +8 -0
  60. package/src/circularButton/CircularButton.css +1 -1
  61. package/src/circularButton/CircularButton.less +9 -3
  62. package/src/common/Option/Option.css +1 -1
  63. package/src/common/Option/Option.less +6 -0
  64. package/src/common/bottomSheet/BottomSheet.css +1 -1
  65. package/src/common/bottomSheet/BottomSheet.less +1 -1
  66. package/src/common/bottomSheet/BottomSheet.spec.tsx +4 -1
  67. package/src/common/bottomSheet/BottomSheet.story.tsx +4 -0
  68. package/src/common/bottomSheet/BottomSheet.tsx +10 -1
  69. package/src/common/closeButton/CloseButton.css +1 -1
  70. package/src/common/closeButton/CloseButton.less +12 -0
  71. package/src/common/hooks/useMedia.spec.ts +3 -17
  72. package/src/common/locale/index.js +10 -1
  73. package/src/common/locale/index.spec.js +1 -34
  74. package/src/common/propsValues/breakpoint.ts +1 -0
  75. package/src/dateLookup/DateLookup.css +1 -1
  76. package/src/dateLookup/DateLookup.js +7 -3
  77. package/src/dateLookup/DateLookup.keyboardEvents.spec.js +3 -0
  78. package/src/dateLookup/DateLookup.less +6 -0
  79. package/src/dateLookup/DateLookup.story.js +6 -1
  80. package/src/dateLookup/DateLookup.testingLibrary.spec.js +3 -1
  81. package/src/dateLookup/DateLookup.view.spec.js +4 -0
  82. package/src/dateLookup/dateHeader/DateHeader.js +4 -2
  83. package/src/drawer/Drawer.css +1 -1
  84. package/src/drawer/Drawer.less +6 -8
  85. package/src/drawer/Drawer.story.js +42 -2
  86. package/src/flowNavigation/FlowNavigation.css +1 -1
  87. package/src/i18n/cs.json +11 -3
  88. package/src/i18n/de.json +11 -3
  89. package/src/i18n/en.json +1 -0
  90. package/src/i18n/es.json +11 -3
  91. package/src/i18n/fr.json +11 -3
  92. package/src/i18n/hu.json +11 -3
  93. package/src/i18n/id.json +11 -3
  94. package/src/i18n/index.ts +6 -2
  95. package/src/i18n/it.json +11 -3
  96. package/src/i18n/ja.json +11 -3
  97. package/src/i18n/pl.json +11 -3
  98. package/src/i18n/pt.json +11 -3
  99. package/src/i18n/ro.json +11 -3
  100. package/src/i18n/ru.json +11 -3
  101. package/src/i18n/th.json +11 -3
  102. package/src/i18n/tr.json +11 -3
  103. package/src/i18n/uk.json +11 -3
  104. package/src/i18n/zh-CN.json +11 -3
  105. package/src/i18n/{zh.json → zh-HK.json} +11 -3
  106. package/src/inputs/SelectInput.css +1 -1
  107. package/src/inputs/SelectInput.less +13 -1
  108. package/src/inputs/SelectInput.messages.ts +9 -0
  109. package/src/inputs/SelectInput.story.tsx +8 -5
  110. package/src/inputs/SelectInput.tsx +55 -22
  111. package/src/inputs/_BottomSheet.tsx +19 -19
  112. package/src/main.css +1 -1
  113. package/src/modal/Modal.tsx +2 -2
  114. package/src/overlayHeader/OverlayHeader.css +1 -1
  115. package/src/popover/Popover.spec.js +3 -1
  116. package/src/radioGroup/RadioGroup.js +1 -1
  117. package/src/radioGroup/RadioGroup.spec.js +18 -0
  118. package/src/select/Select.spec.js +6 -9
  119. package/src/statusIcon/StatusIcon.css +1 -1
  120. package/src/statusIcon/StatusIcon.less +10 -0
  121. package/src/summary/Summary.css +1 -1
  122. package/src/summary/Summary.less +1 -1
  123. package/src/test-utils/index.js +1 -0
  124. package/src/test-utils/story-config.ts +21 -7
  125. package/src/test-utils/window-mock.ts +19 -0
  126. package/src/typeahead/Typeahead.css +1 -1
  127. package/src/typeahead/Typeahead.less +5 -6
  128. package/src/uploadInput/UploadInput.css +1 -1
  129. package/src/uploadInput/UploadInput.less +5 -1
  130. package/build/i18n/zh_CN.json +0 -44
  131. package/src/i18n/zh_CN.json +0 -44
@@ -52,7 +52,7 @@ const Modal = ({
52
52
  }: ModalProps) => {
53
53
  const checkSpecialClasses = (classToCheck: string) =>
54
54
  className?.split(' ').includes(classToCheck);
55
- const { isMobile } = useLayout();
55
+ const { isMobile, isMedium: isTablet } = useLayout();
56
56
 
57
57
  // These should be replaced with props in breaking change.
58
58
  const isCompact = checkSpecialClasses('compact');
@@ -60,7 +60,7 @@ const Modal = ({
60
60
 
61
61
  const contentReference = useRef<HTMLDivElement>(null);
62
62
 
63
- return isMobile ? (
63
+ return isMobile || isTablet ? (
64
64
  <Drawer
65
65
  open={open}
66
66
  headerTitle={title}
@@ -1 +1 @@
1
- .np-overlay-header .np-overlay-header__content{max-width:1164px;min-height:97px;min-width:320px;width:100%}.np-overlay-header .np-overlay-header__content .separator{background-color:#0000001a;background-color:var(--color-border-neutral);height:32px;height:var(--size-32);width:1px}[dir=rtl] .np-overlay-header .np-overlay-header__content .separator{margin-right:16px!important}[dir=rtl] .np-overlay-header .np-overlay-header__content .separator,html:not([dir=rtl]) .np-overlay-header .np-overlay-header__content .separator{margin-left:16px!important}html:not([dir=rtl]) .np-overlay-header .np-overlay-header__content .separator{margin-right:16px!important}.np-theme-personal .np-overlay-header{border-bottom:1px solid #0000001a;border-bottom:1px solid var(--color-border-neutral)}.np-theme-personal--bright-green .np-overlay-header .np-flow-header__left path,.np-theme-personal--dark .np-overlay-header .np-flow-header__left path,.np-theme-personal--forest-green .np-overlay-header .np-flow-header__left path{fill:var(--color-interactive-primary)}
1
+ .np-overlay-header .np-overlay-header__content{max-width:1164px;min-height:97px;min-width:320px;width:100%}.np-overlay-header .np-overlay-header__content .separator{background-color:#0000001a;background-color:var(--color-border-neutral);height:32px;height:var(--size-32);width:1px}[dir=rtl] .np-overlay-header .np-overlay-header__content .separator{margin-right:16px!important;margin-right:var(--size-16)!important}[dir=rtl] .np-overlay-header .np-overlay-header__content .separator,html:not([dir=rtl]) .np-overlay-header .np-overlay-header__content .separator{margin-left:16px!important;margin-left:var(--size-16)!important}html:not([dir=rtl]) .np-overlay-header .np-overlay-header__content .separator{margin-right:16px!important;margin-right:var(--size-16)!important}.np-theme-personal .np-overlay-header{border-bottom:1px solid #0000001a;border-bottom:1px solid var(--color-border-neutral)}.np-theme-personal--bright-green .np-overlay-header .np-flow-header__left path,.np-theme-personal--dark .np-overlay-header .np-flow-header__left path,.np-theme-personal--forest-green .np-overlay-header .np-flow-header__left path{fill:var(--color-interactive-primary)}
@@ -1,8 +1,10 @@
1
1
  import { Breakpoint, Position } from '../common';
2
- import { render, screen, userEvent } from '../test-utils';
2
+ import { render, screen, userEvent, mockMatchMedia } from '../test-utils';
3
3
 
4
4
  import Popover from './Popover';
5
5
 
6
+ mockMatchMedia();
7
+
6
8
  jest.mock('react-transition-group', () => ({
7
9
  __esModule: true,
8
10
  CSSTransition: (props) => (props.in ? props.children : null),
@@ -19,7 +19,7 @@ class RadioGroup extends Component {
19
19
  render() {
20
20
  const { radios, name } = this.props;
21
21
  const { selectedValue } = this.state;
22
- return radios && radios.length > 1 ? (
22
+ return radios && radios.length > 0 ? (
23
23
  <>
24
24
  {radios.map(({ id, avatar, value, label, disabled, secondary, readOnly }, index) => (
25
25
  <Radio
@@ -55,6 +55,24 @@ describe('RadioGroup', () => {
55
55
  );
56
56
  });
57
57
 
58
+ it('renders a single radio option, when radios array contains a single element', () => {
59
+ const component = shallow(<RadioGroup radios={RADIOS.slice(0, 1)} {...props} />);
60
+ expect(component.find(Radio)).toHaveLength(1);
61
+ expect(JSON.stringify(component.find(Radio).at(0).props())).toStrictEqual(
62
+ JSON.stringify({
63
+ id: 'id-test-0',
64
+ value: 'value-test0',
65
+ label: 'Radio1',
66
+ name: 'radio-group',
67
+ disabled: true,
68
+ checked: false,
69
+ secondary: 'secondary',
70
+ onChange: () => props.onChange,
71
+ avatar,
72
+ }),
73
+ );
74
+ });
75
+
58
76
  it('checks specified radio', () => {
59
77
  const component = shallow(
60
78
  <RadioGroup radios={RADIOS} selectedValue="value-test2" {...props} />,
@@ -1,24 +1,21 @@
1
- import { render, screen, userEvent, waitFor } from '../test-utils';
1
+ import { Breakpoint } from '../common';
2
+ import { render, screen, userEvent, waitFor, mockMatchMedia } from '../test-utils';
2
3
 
3
4
  import Select from '.';
4
5
 
6
+ mockMatchMedia();
7
+
5
8
  jest.mock('../common/domHelpers', () => ({
6
9
  ...jest.requireActual('../common/domHelpers'),
7
10
  getSimpleRandomId: jest.fn((prefix) => `${prefix}mock-random-id`),
8
11
  }));
9
12
 
10
13
  function enableDesktopScreen() {
11
- window.innerWidth = 1024;
12
- window.matchMedia = () => {
13
- return { matches: false };
14
- };
14
+ window.innerWidth = Breakpoint.LARGE;
15
15
  }
16
16
 
17
17
  function enableMobileScreen() {
18
- window.innerWidth = 100;
19
- window.matchMedia = () => {
20
- return { matches: true };
21
- };
18
+ window.innerWidth = Breakpoint.EXTRA_SMALL;
22
19
  }
23
20
 
24
21
  const mockScrollIntoView = jest.fn();
@@ -1 +1 @@
1
- .status-icon>svg{height:32px;height:var(--size-32);width:32px;width:var(--size-32)}.status-circle{align-items:center;border-radius:50%;display:flex;flex-shrink:0;justify-content:center}.status-circle .light{color:var(--color-contrast)}.status-circle .dark{color:#37517e;color:var(--color-content-primary)}.status-circle.pending,.status-circle.warning{background-color:var(--color-sentiment-warning)}.np-theme-personal .status-circle.pending .status-icon,.np-theme-personal .status-circle.warning .status-icon{color:var(--color-dark)}.status-circle-lg{height:48px;height:var(--size-48);width:48px;width:var(--size-48)}.status-circle-md{height:40px;height:var(--size-40);width:40px;width:var(--size-40)}.status-circle-sm{height:16px;height:var(--size-16);width:16px;width:var(--size-16)}.status-circle-sm .status-icon>svg{height:14px;height:var(--size-14);width:14px;width:var(--size-14)}.status-circle.negative{background-color:var(--color-sentiment-negative)}.status-circle.neutral{background-color:#5d7079;background-color:var(--color-content-secondary)}.status-circle.positive{background-color:var(--color-sentiment-positive)}
1
+ .status-icon>svg{height:32px;height:var(--size-32);width:32px;width:var(--size-32)}.status-circle{align-items:center;border-radius:50%;display:flex;flex-shrink:0;justify-content:center}.status-circle .light{color:var(--color-contrast)}.status-circle .dark{color:#37517e;color:var(--color-content-primary)}.status-circle.pending,.status-circle.warning{background-color:var(--color-sentiment-warning)}.np-theme-personal .status-circle.pending .status-icon,.np-theme-personal .status-circle.warning .status-icon{color:var(--color-dark)}.status-circle-lg{height:48px;height:var(--size-48);width:48px;width:var(--size-48)}.status-circle-md{height:40px;height:var(--size-40);width:40px;width:var(--size-40)}.status-circle-sm{height:16px;height:var(--size-16);width:16px;width:var(--size-16)}.status-circle-sm .status-icon>svg{height:14px;height:var(--size-14);width:14px;width:var(--size-14)}@media (max-width:320px){.status-circle-sm .status-icon>svg{height:24px;height:var(--size-24);width:24px;width:var(--size-24)}.status-circle-sm{height:32px;height:var(--size-32);width:32px;width:var(--size-32)}}.status-circle.negative{background-color:var(--color-sentiment-negative)}.status-circle.neutral{background-color:#5d7079;background-color:var(--color-content-secondary)}.status-circle.positive{background-color:var(--color-sentiment-positive)}
@@ -46,6 +46,16 @@
46
46
  .status-icon > svg {
47
47
  height: var(--size-14);
48
48
  width: var(--size-14);
49
+
50
+ @media (--screen-400-zoom) {
51
+ width: var(--size-24);
52
+ height: var(--size-24);
53
+ }
54
+ }
55
+
56
+ @media (--screen-400-zoom) {
57
+ width: var(--size-32);
58
+ height: var(--size-32);
49
59
  }
50
60
  }
51
61
  }
@@ -1 +1 @@
1
- .np-summary{min-width:280px}.np-summary__body{flex:1}.np-summary__title{font-weight:600;font-weight:var(--font-weight-semi-bold);justify-content:space-between;line-height:1.375;margin-top:0}.np-summary__title span{letter-spacing:normal;line-height:1.375;margin-bottom:0!important}.np-summary__title .np-info button,.np-summary__title .np-info__small{margin-top:0}.np-summary__title .np-info .tw-icon{color:var(--color-interactive-primary)}.np-summary__icon{color:#37517e;color:var(--color-content-primary);position:relative}.np-summary__icon .np-summary-icon__done{color:var(--color-sentiment-positive)}.np-summary__icon .np-summary-icon__pending{color:var(--color-sentiment-warning)}.np-summary__icon :nth-child(2){background-color:transparent;border-radius:50%;bottom:-6px;position:absolute;right:-8px}[dir=rtl] .np-summary__icon :nth-child(2){left:-8px;right:auto}.np-summary__description{color:#5d7079;color:var(--color-content-secondary);font-size:.875rem;font-size:var(--font-size-14);line-height:1.42857;margin-top:4px;margin-top:var(--size-4);padding-right:32px;padding-right:calc(var(--size-24) + var(--size-8))}[dir=rtl] .np-summary__description{padding-left:32px;padding-left:calc(var(--size-24) + var(--size-8));padding-right:0}.np-summary__action{font-size:.875rem;font-size:var(--font-size-14);font-weight:600;font-weight:var(--font-weight-semi-bold);margin-top:4px;margin-top:var(--size-4)}.np-summary+.np-summary{margin-top:24px;margin-top:var(--size-24)}
1
+ .np-summary{min-width:280px}.np-summary__body{flex:1}.np-summary__title{font-weight:600;font-weight:var(--font-weight-semi-bold);justify-content:space-between;line-height:1.375;margin-top:0}.np-summary__title span{letter-spacing:normal;line-height:1.375;margin-bottom:0!important}.np-summary__title .np-info button,.np-summary__title .np-info__small{margin-top:0}.np-summary__title .np-info .tw-icon{color:var(--color-interactive-primary)}.np-summary__icon{color:#37517e;color:var(--color-content-primary);position:relative}.np-summary__icon .np-summary-icon__done{color:var(--color-sentiment-positive)}.np-summary__icon .np-summary-icon__pending{color:var(--color-sentiment-warning)}.np-summary__icon :nth-child(2){background-color:transparent;border-radius:50%;bottom:-6px;position:absolute;right:-8px;right:calc(var(--size-8)*-1)}[dir=rtl] .np-summary__icon :nth-child(2){left:-8px;left:calc(var(--size-8)*-1);right:auto}.np-summary__description{color:#5d7079;color:var(--color-content-secondary);font-size:.875rem;font-size:var(--font-size-14);line-height:1.42857;margin-top:4px;margin-top:var(--size-4);padding-right:32px;padding-right:calc(var(--size-24) + var(--size-8))}[dir=rtl] .np-summary__description{padding-left:32px;padding-left:calc(var(--size-24) + var(--size-8));padding-right:0}.np-summary__action{font-size:.875rem;font-size:var(--font-size-14);font-weight:600;font-weight:var(--font-weight-semi-bold);margin-top:4px;margin-top:var(--size-4)}.np-summary+.np-summary{margin-top:24px;margin-top:var(--size-24)}
@@ -53,7 +53,7 @@
53
53
  background-color: transparent;
54
54
  border-radius: 50%;
55
55
  position: absolute;
56
- .right(-8px);
56
+ .right(calc(var(--size-8) * -1));
57
57
 
58
58
  bottom: -6px;
59
59
  }
@@ -30,6 +30,7 @@ function customRenderHook(callback, { locale = DEFAULT_LOCALE, messages = en } =
30
30
  });
31
31
  }
32
32
 
33
+ export * from './window-mock';
33
34
  export * from './story-config';
34
35
  export * from './fake-data';
35
36
  export * from '@testing-library/react';
@@ -1,6 +1,16 @@
1
1
  import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport';
2
2
  import { StoryObj } from '@storybook/react';
3
3
 
4
+ export const viewports = {
5
+ ...MINIMAL_VIEWPORTS,
6
+ mobile3: {
7
+ name: '400% Zoom',
8
+ // 320x256 https://www.w3.org/WAI/WCAG21/Understanding/reflow.html
9
+ styles: { height: '256px', width: '320px' },
10
+ type: 'mobile',
11
+ },
12
+ };
13
+
4
14
  interface StoryConfig {
5
15
  /**
6
16
  * Creates variations of the component for the current story. Some
@@ -15,10 +25,10 @@ interface StoryConfig {
15
25
  *
16
26
  * @default undefined
17
27
  */
18
- variants?: ('default' | 'light' | 'dark' | 'rtl' | 'mobile')[];
28
+ variants?: ('default' | 'light' | 'dark' | 'rtl' | 'mobile' | '400%')[];
19
29
  }
20
30
 
21
- const getViewportWidth = (viewport: (typeof MINIMAL_VIEWPORTS)[keyof typeof MINIMAL_VIEWPORTS]) => {
31
+ const getViewportWidth = (viewport: (typeof viewports)[keyof typeof viewports]) => {
22
32
  if (viewport.styles && typeof viewport.styles === 'object') {
23
33
  return parseInt(viewport.styles.width);
24
34
  }
@@ -26,11 +36,14 @@ const getViewportWidth = (viewport: (typeof MINIMAL_VIEWPORTS)[keyof typeof MINI
26
36
  };
27
37
 
28
38
  /**
29
- * The key to 'Large mobile' viewport {@link MINIMAL_VIEWPORTS.mobile2}
39
+ * The key to 'Large mobile' viewport {@link viewports.mobile2}
30
40
  */
31
41
  const mobileViewportKey = 'mobile2';
32
- const mobileViewport = MINIMAL_VIEWPORTS[mobileViewportKey];
33
- const mobileViewportWidth = getViewportWidth(mobileViewport);
42
+ // @ts-expect-error viewports has mobile2 property (comes from ...MINIMAL_VIEWPORTS)
43
+ const mobileViewportWidth = getViewportWidth(viewports.mobile2);
44
+
45
+ const zoom400perViewportKey = 'mobile3';
46
+ const zoom400perViewportWidth = getViewportWidth(viewports.mobile3);
34
47
 
35
48
  /**
36
49
  * Utility function for creating variants of a CSFv3 story.
@@ -40,6 +53,7 @@ export const storyConfig = <Args>(
40
53
  { variants }: StoryConfig,
41
54
  ): StoryObj<Args> => {
42
55
  const isMobile = variants?.includes('mobile') || undefined;
56
+ const is400Zoom = variants?.includes('400%') || undefined;
43
57
 
44
58
  return {
45
59
  ...storyObject,
@@ -48,12 +62,12 @@ export const storyConfig = <Args>(
48
62
  variants,
49
63
  chromatic: {
50
64
  ...storyObject.parameters?.chromatic,
51
- viewports: isMobile && [mobileViewportWidth],
65
+ viewports: (isMobile && [mobileViewportWidth]) || (is400Zoom && [zoom400perViewportWidth]),
52
66
  },
53
67
  viewport: {
54
68
  ...storyObject.parameters?.viewport,
55
69
  /** Set defaultViewport if 'mobile' variant is used */
56
- defaultViewport: isMobile && mobileViewportKey,
70
+ defaultViewport: (isMobile && mobileViewportKey) || (is400Zoom && zoom400perViewportKey),
57
71
  },
58
72
  },
59
73
  };
@@ -0,0 +1,19 @@
1
+ export function mockMatchMedia() {
2
+ Object.defineProperty(window, 'matchMedia', {
3
+ writable: true,
4
+ value: jest.fn().mockImplementation((query: string) => {
5
+ const matches = /^\(min-width: ([0-9]+)px\)$/.exec(query);
6
+ const minWidth = matches != null ? Number(matches[1]) : undefined;
7
+ return {
8
+ matches: minWidth != null ? window.innerWidth >= minWidth : false,
9
+ media: query,
10
+ onchange: null,
11
+ addListener: jest.fn(), // deprecated
12
+ removeListener: jest.fn(), // deprecated
13
+ addEventListener: jest.fn(),
14
+ removeEventListener: jest.fn(),
15
+ dispatchEvent: jest.fn(),
16
+ };
17
+ }),
18
+ });
19
+ }
@@ -1 +1 @@
1
- .typeahead.open .input-group{z-index:1060}.typeahead .dropdown.btn-block{display:block}.typeahead .dropdown-menu{max-width:100%;width:100%}.np-theme-personal--bright-green .typeahead .dropdown-menu,.np-theme-personal--dark .typeahead .dropdown-menu,.np-theme-personal--forest-green .typeahead .dropdown-menu{background-color:#fff;background-color:var(--color-background-elevated)}.typeahead--multiple .np-chip{animation-duration:.03s;animation-name:slide;animation-timing-function:ease-in-out;margin-bottom:auto}.typeahead--multiple .np-chip:first-child{animation-name:slideFirst}.typeahead--multiple .np-chip-remove{animation-duration:.03s;animation-name:fadeIn;animation-timing-function:ease-in-out}.typeahead--multiple .form-control{height:auto;min-height:auto;overflow:auto;padding-bottom:0;padding-top:0}.typeahead--multiple .typeahead__input{align-self:stretch;border:none;float:none;outline:none;padding:0}.typeahead--multiple .typeahead__input-aligner{display:inline-block;height:40px;width:0}.typeahead--multiple .typeahead__input-container{cursor:text;display:flex}.typeahead--multiple .sizer{position:absolute;visibility:hidden;white-space:pre;width:auto}.typeahead--multiple.typeahead--has-value .typeahead__input-container{padding-left:8px;padding-left:var(--size-8)}[dir=rtl] .typeahead--multiple.typeahead--has-value .typeahead__input-container{padding-left:0;padding-right:8px;padding-right:var(--size-8)}.typeahead--multiple.typeahead--has-value .input-group-addon+.typeahead__input-container{padding-left:0}.typeahead--multiple.typeahead--has-value .typeahead__input{margin-bottom:-7px;margin-bottom:calc(var(--size-8)*-1 + 1px);margin-left:4px;margin-left:var(--size-4)}[dir=rtl] .typeahead--multiple.typeahead--has-value .typeahead__input{margin-left:0;margin-right:4px;margin-right:var(--size-4)}.typeahead--multiple.typeahead--has-value .typeahead__input-wrapper:after{content:"";height:calc(8px - 1);height:calc(var(--size-8) - 1);width:100%}.typeahead__input-wrapper{align-items:center;display:flex;flex:1;flex-wrap:wrap;margin-top:-1px;width:100%}.np-theme-personal .typeahead__input-wrapper{margin-top:0}.typeahead--empty.typeahead--multiple .typeahead__input-wrapper{margin:0;padding:0}.typeahead-sm.typeahead--multiple .typeahead__input-container{min-height:32px}.typeahead-sm.typeahead--multiple .typeahead__input{padding-top:0}.typeahead-md.typeahead--multiple .typeahead__input-container{min-height:48px}.np-theme-personal .typeahead-md.typeahead--multiple .typeahead__input-container{min-height:53px}.typeahead-lg.typeahead--multiple .typeahead__input-container{min-height:72px}.typeahead-lg.typeahead--multiple .typeahead__input{padding-top:calc(8px - 1);padding-top:calc(var(--size-8) - 1)}.typeahead-lg.typeahead--multiple .typeahead__input-wrapper{margin:0;padding-bottom:8px;padding-bottom:var(--size-8)}.typeahead-lg.typeahead--multiple .typeahead__input-wrapper:after{content:none}.typeahead-lg.typeahead--multiple .np-chip{margin-bottom:0}@keyframes slide{0%{transform:translateX(-12px)}to{transform:none}}@keyframes slideFirst{0%{transform:translateX(-4px)}to{transform:none}}@keyframes fadeIn{0%{opacity:0}to{opacity:.6}}@media (max-width:575px){.typeahead .dropdown.open .dropdown-menu{bottom:auto;overflow:scroll;position:absolute}}.np-theme-personal .typeahead .input-group:not(.disabled,:disabled,.input-group--has-error):focus-within .tw-icon-search{color:var(--color-interactive-primary)}.np-theme-personal .typeahead .tw-icon-search{color:#c9cbce;color:var(--color-interactive-secondary)}.np-theme-personal .typeahead .np-chip{margin-top:9px!important}.np-theme-personal .typeahead .np-chip--removable .np-text-body-default-bold{padding-right:16px;padding-right:var(--size-16)}
1
+ .typeahead.open .input-group{z-index:1060}.typeahead .dropdown.btn-block{display:block}.typeahead .dropdown-menu{max-width:100%;width:100%}.np-theme-personal--bright-green .typeahead .dropdown-menu,.np-theme-personal--dark .typeahead .dropdown-menu,.np-theme-personal--forest-green .typeahead .dropdown-menu{background-color:#fff;background-color:var(--color-background-elevated)}.typeahead--multiple .np-chip{animation-duration:.03s;animation-name:slide;animation-timing-function:ease-in-out;margin-bottom:auto}.typeahead--multiple .np-chip:first-child{animation-name:slideFirst}.typeahead--multiple .np-chip-remove{animation-duration:.03s;animation-name:fadeIn;animation-timing-function:ease-in-out}.typeahead--multiple .form-control{height:auto;min-height:auto;overflow:auto;padding-bottom:0;padding-top:0}.typeahead--multiple .typeahead__input{align-self:stretch;border:none;float:none;outline:none;padding:0}.typeahead--multiple .typeahead__input-aligner{display:inline-block;height:40px;width:0}.typeahead--multiple .typeahead__input-container{cursor:text;display:flex}.typeahead--multiple .sizer{position:absolute;visibility:hidden;white-space:pre;width:auto}.typeahead--multiple.typeahead--has-value .typeahead__input-container{padding-left:8px;padding-left:var(--size-8)}[dir=rtl] .typeahead--multiple.typeahead--has-value .typeahead__input-container{padding-left:0;padding-right:8px;padding-right:var(--size-8)}.typeahead--multiple.typeahead--has-value .input-group-addon+.typeahead__input-container{padding-left:0}.typeahead--multiple.typeahead--has-value .typeahead__input{margin-bottom:-7px;margin-bottom:calc(var(--size-8)*-1 + 1px);margin-left:4px;margin-left:var(--size-4)}[dir=rtl] .typeahead--multiple.typeahead--has-value .typeahead__input{margin-left:0;margin-right:4px;margin-right:var(--size-4)}.typeahead--multiple.typeahead--has-value .typeahead__input-wrapper:after{content:"";height:calc(8px - 1);height:calc(var(--size-8) - 1);width:100%}.typeahead__input-wrapper{align-items:center;display:flex;flex:1;flex-wrap:wrap;margin-top:-1px;width:100%}.np-theme-personal .typeahead__input-wrapper{margin-top:0}.typeahead--empty.typeahead--multiple .typeahead__input-wrapper{margin:0;padding:0}.typeahead-sm.typeahead--multiple .typeahead__input-container{min-height:32px}.typeahead-sm.typeahead--multiple .typeahead__input{padding-top:0}.typeahead-md.typeahead--multiple .typeahead__input-container{min-height:var(--input-height-base)}.typeahead-lg.typeahead--multiple .typeahead__input-container{min-height:var(--input-height-large)}.typeahead-lg.typeahead--multiple .typeahead__input{padding-top:calc(8px - 1);padding-top:calc(var(--size-8) - 1)}.typeahead-lg.typeahead--multiple .typeahead__input-wrapper{margin:0;padding-bottom:8px;padding-bottom:var(--size-8)}.typeahead-lg.typeahead--multiple .typeahead__input-wrapper:after{content:none}.typeahead-lg.typeahead--multiple .np-chip{margin-bottom:0}@keyframes slide{0%{transform:translateX(-12px)}to{transform:none}}@keyframes slideFirst{0%{transform:translateX(-4px)}to{transform:none}}@keyframes fadeIn{0%{opacity:0}to{opacity:.6}}@media (max-width:575px){.typeahead .dropdown.open .dropdown-menu{bottom:auto;overflow:scroll;position:absolute}}.np-theme-personal .typeahead .input-group:not(.disabled,:disabled,.input-group--has-error):focus-within .tw-icon-search{color:var(--color-interactive-primary)}.np-theme-personal .typeahead .tw-icon-search{color:#c9cbce;color:var(--color-interactive-secondary)}.np-theme-personal .typeahead .np-chip{margin-top:9px!important}.np-theme-personal .typeahead .np-chip--removable .np-text-body-default-bold{padding-right:16px;padding-right:var(--size-16)}@media (max-width:320px){.np-theme-personal .typeahead .np-chip--removable .np-text-body-default-bold{padding-right:32px;padding-right:var(--size-32)}}
@@ -138,11 +138,7 @@
138
138
  &-md {
139
139
  &.typeahead--multiple {
140
140
  .typeahead__input-container {
141
- min-height: @input-height-base;
142
- .np-theme-personal & {
143
- // TODO: Remove this value later or use variable fo it, right now it equals to Money Input min-height.
144
- min-height: 53px;
145
- }
141
+ min-height: var(--input-height-base);
146
142
  }
147
143
  }
148
144
  }
@@ -150,7 +146,7 @@
150
146
  &-lg {
151
147
  &.typeahead--multiple {
152
148
  .typeahead__input-container {
153
- min-height: @input-height-large;
149
+ min-height: var(--input-height-large);
154
150
  }
155
151
 
156
152
  .typeahead__input {
@@ -223,6 +219,9 @@
223
219
  .np-chip--removable {
224
220
  .np-text-body-default-bold {
225
221
  padding-right: var(--size-16);
222
+ @media (--screen-400-zoom) {
223
+ padding-right: var(--size-32);
224
+ }
226
225
  }
227
226
  }
228
227
  }
@@ -1 +1 @@
1
- .np-upload-input{border:1px solid #c9cbce;border:1px solid var(--color-interactive-secondary);border-radius:10px;border-radius:var(--radius-small)}.np-upload-input:has(:focus-visible){outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-upload-input.form-control{height:auto;padding:initial}.np-theme-personal .np-upload-input{border-radius:10px;border-radius:var(--radius-small);min-height:78px}.np-theme-personal .np-upload-input.disabled .btn{cursor:inherit}.np-theme-personal .np-upload-input .np-upload-button{border-radius:9px;border-radius:calc(var(--radius-small) - 1px);padding:16px;padding:var(--padding-small)}.np-theme-personal .np-upload-input .np-upload-input--square-top{border-top-left-radius:0;border-top-right-radius:0}.np-theme-personal .np-upload-input .np-upload-item__remove-button{border-radius:unset}.np-theme-personal .np-upload-input .np-upload-icon{color:var(--color-interactive-primary)}.np-theme-personal .np-upload-input .media-body{color:var(--color-content-link);white-space:break-spaces}.np-theme-personal .np-upload-input .media-body .np-text-body-large-bold{text-decoration:underline;text-underline-offset:.3em}.np-theme-personal .np-upload-input .media-body .np-text-body-default,.np-theme-personal .np-upload-input .media-body .np-upload-description,.np-theme-personal .np-upload-input .media-body .text-positive{color:#5d7079!important;color:var(--color-content-secondary)!important}.np-theme-personal .np-upload-input .media-body .text-negative{color:var(--color-sentiment-negative)!important}.np-theme-personal .np-upload-input .status-circle{height:24px;height:var(--size-x-small);width:24px;width:var(--size-x-small)}
1
+ .np-upload-input{border:1px solid #c9cbce;border:1px solid var(--color-interactive-secondary);border-radius:10px;border-radius:var(--radius-small)}.np-upload-input:has(:focus-visible){outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-upload-input.form-control{height:auto;padding:initial}.np-theme-personal .np-upload-input{border-radius:10px;border-radius:var(--radius-small)}.np-theme-personal .np-upload-input.disabled .btn{cursor:inherit}.np-theme-personal .np-upload-input .np-upload-button{border-radius:9px;border-radius:calc(var(--radius-small) - 1px);padding:16px;padding:var(--padding-small)}.np-theme-personal .np-upload-input .np-upload-input--square-top{border-top-left-radius:0;border-top-right-radius:0}.np-theme-personal .np-upload-input .np-upload-item__remove-button{border-radius:unset}.np-theme-personal .np-upload-input .np-upload-icon{color:var(--color-interactive-primary)}.np-theme-personal .np-upload-input .media-body{color:var(--color-content-link);white-space:break-spaces}.np-theme-personal .np-upload-input .media-body .np-text-body-large-bold{text-decoration:underline;text-underline-offset:.3em}.np-theme-personal .np-upload-input .media-body .np-text-body-default,.np-theme-personal .np-upload-input .media-body .np-upload-description,.np-theme-personal .np-upload-input .media-body .text-positive{color:#5d7079!important;color:var(--color-content-secondary)!important}.np-theme-personal .np-upload-input .media-body .text-negative{color:var(--color-sentiment-negative)!important}.np-theme-personal .np-upload-input .status-circle{height:24px;height:var(--size-x-small);width:24px;width:var(--size-x-small)}@media (max-width:320px){.np-theme-personal .np-upload-input .status-circle{height:48px;height:var(--size-large);width:48px;width:var(--size-large)}}
@@ -19,7 +19,6 @@
19
19
  .np-theme-personal {
20
20
  .np-upload-input {
21
21
  border-radius: var(--radius-small);
22
- min-height: 78px;
23
22
 
24
23
  &.disabled .btn {
25
24
  cursor: inherit;
@@ -66,6 +65,11 @@
66
65
  .status-circle {
67
66
  width: var(--size-x-small);
68
67
  height: var(--size-x-small);
68
+
69
+ @media (--screen-400-zoom) {
70
+ width: var(--size-large);
71
+ height: var(--size-large);
72
+ }
69
73
  }
70
74
  }
71
75
  }
@@ -1,44 +0,0 @@
1
- {
2
- "neptune.Chips.ariaLabel": "清除 {choice}",
3
- "neptune.ClearButton.ariaLabel": "清晰",
4
- "neptune.CloseButton.ariaLabel": "关闭",
5
- "neptune.DateInput.day.label": "日",
6
- "neptune.DateInput.month.label": "月",
7
- "neptune.DateInput.year.label": "年",
8
- "neptune.MoneyInput.Select.placeholder": "请选择...",
9
- "neptune.Pagination.ariaLabel": "分页导航",
10
- "neptune.PaginationLink.ariaLabel.active": "转到第 {pageNumber} 页",
11
- "neptune.PaginationLink.ariaLabel.inactive": "当前页面,第 {pageNumber} 页",
12
- "neptune.Select.searchPlaceholder": "搜索",
13
- "neptune.Summary.statusDone": "已完成",
14
- "neptune.Summary.statusNotDone": "未完成",
15
- "neptune.Summary.statusPending": "待处理",
16
- "neptune.Upload.csButtonText": "上传另一个文件?",
17
- "neptune.Upload.csFailureText": "上传失败。请重试",
18
- "neptune.Upload.csSuccessText": "上传完毕!",
19
- "neptune.Upload.csTooLargeMessage": "请提供小于 5MB 的文件",
20
- "neptune.Upload.csWrongTypeMessage": "不支持该文件类型,请试试其他文件",
21
- "neptune.Upload.psButtonText": "取消",
22
- "neptune.Upload.psProcessingText": "正在上传…",
23
- "neptune.Upload.usButtonText": "或选择文件",
24
- "neptune.Upload.usDropMessage": "拖放文件开始上传",
25
- "neptune.Upload.usPlaceholder": "拖放小于 5MB 的文件",
26
- "neptune.UploadButton.allFileTypes": "所有文件类型",
27
- "neptune.UploadButton.dropFiles": "拖放文件开始上传",
28
- "neptune.UploadButton.instructions": "{fileTypes},小于 {size}MB",
29
- "neptune.UploadButton.uploadFile": "上传文件",
30
- "neptune.UploadButton.uploadFiles": "上传文件",
31
- "neptune.UploadInput.deleteModalBody": "删除此文件会将其从我们的系统中删除",
32
- "neptune.UploadInput.deleteModalCancelButtonText": "取消",
33
- "neptune.UploadInput.deleteModalConfirmButtonText": "删除",
34
- "neptune.UploadInput.deleteModalTitle": "确定要删除此文件吗?",
35
- "neptune.UploadInput.fileIsTooLarge": "文件太大",
36
- "neptune.UploadInput.fileTypeNotSupported": "文件类型不受支持",
37
- "neptune.UploadInput.maximumFilesAlreadyUploaded": "抱歉,此上传失败,因为我们一次只能接受 {maxFilesAllowed} 个文件。",
38
- "neptune.UploadItem.deleting": "正在删除…",
39
- "neptune.UploadItem.removeFile": "删除文件 {filename}",
40
- "neptune.UploadItem.uploaded": "已上传",
41
- "neptune.UploadItem.uploadedFile": "上传的文件",
42
- "neptune.UploadItem.uploading": "正在上传…",
43
- "neptune.UploadItem.uploadingFailed": "上传失败"
44
- }
@@ -1,44 +0,0 @@
1
- {
2
- "neptune.Chips.ariaLabel": "清除 {choice}",
3
- "neptune.ClearButton.ariaLabel": "清晰",
4
- "neptune.CloseButton.ariaLabel": "关闭",
5
- "neptune.DateInput.day.label": "日",
6
- "neptune.DateInput.month.label": "月",
7
- "neptune.DateInput.year.label": "年",
8
- "neptune.MoneyInput.Select.placeholder": "请选择...",
9
- "neptune.Pagination.ariaLabel": "分页导航",
10
- "neptune.PaginationLink.ariaLabel.active": "转到第 {pageNumber} 页",
11
- "neptune.PaginationLink.ariaLabel.inactive": "当前页面,第 {pageNumber} 页",
12
- "neptune.Select.searchPlaceholder": "搜索",
13
- "neptune.Summary.statusDone": "已完成",
14
- "neptune.Summary.statusNotDone": "未完成",
15
- "neptune.Summary.statusPending": "待处理",
16
- "neptune.Upload.csButtonText": "上传另一个文件?",
17
- "neptune.Upload.csFailureText": "上传失败。请重试",
18
- "neptune.Upload.csSuccessText": "上传完毕!",
19
- "neptune.Upload.csTooLargeMessage": "请提供小于 5MB 的文件",
20
- "neptune.Upload.csWrongTypeMessage": "不支持该文件类型,请试试其他文件",
21
- "neptune.Upload.psButtonText": "取消",
22
- "neptune.Upload.psProcessingText": "正在上传…",
23
- "neptune.Upload.usButtonText": "或选择文件",
24
- "neptune.Upload.usDropMessage": "拖放文件开始上传",
25
- "neptune.Upload.usPlaceholder": "拖放小于 5MB 的文件",
26
- "neptune.UploadButton.allFileTypes": "所有文件类型",
27
- "neptune.UploadButton.dropFiles": "拖放文件开始上传",
28
- "neptune.UploadButton.instructions": "{fileTypes},小于 {size}MB",
29
- "neptune.UploadButton.uploadFile": "上传文件",
30
- "neptune.UploadButton.uploadFiles": "上传文件",
31
- "neptune.UploadInput.deleteModalBody": "删除此文件会将其从我们的系统中删除",
32
- "neptune.UploadInput.deleteModalCancelButtonText": "取消",
33
- "neptune.UploadInput.deleteModalConfirmButtonText": "删除",
34
- "neptune.UploadInput.deleteModalTitle": "确定要删除此文件吗?",
35
- "neptune.UploadInput.fileIsTooLarge": "文件太大",
36
- "neptune.UploadInput.fileTypeNotSupported": "文件类型不受支持",
37
- "neptune.UploadInput.maximumFilesAlreadyUploaded": "抱歉,此上传失败,因为我们一次只能接受 {maxFilesAllowed} 个文件。",
38
- "neptune.UploadItem.deleting": "正在删除…",
39
- "neptune.UploadItem.removeFile": "删除文件 {filename}",
40
- "neptune.UploadItem.uploaded": "已上传",
41
- "neptune.UploadItem.uploadedFile": "上传的文件",
42
- "neptune.UploadItem.uploading": "正在上传…",
43
- "neptune.UploadItem.uploadingFailed": "上传失败"
44
- }