@transferwise/components 0.0.0-experimental-2b935a9 → 0.0.0-experimental-4b847ab

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 (42) hide show
  1. package/build/index.js +57 -77
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +56 -76
  4. package/build/index.mjs.map +1 -1
  5. package/build/types/checkbox/Checkbox.d.ts +16 -20
  6. package/build/types/checkbox/Checkbox.d.ts.map +1 -1
  7. package/build/types/checkbox/index.d.ts +2 -2
  8. package/build/types/checkbox/index.d.ts.map +1 -1
  9. package/build/types/decision/Decision.d.ts +1 -1
  10. package/build/types/decision/Decision.d.ts.map +1 -1
  11. package/build/types/index.d.ts +1 -0
  12. package/build/types/index.d.ts.map +1 -1
  13. package/build/types/logo/Logo.d.ts +16 -23
  14. package/build/types/logo/Logo.d.ts.map +1 -1
  15. package/build/types/logo/index.d.ts +1 -2
  16. package/build/types/logo/index.d.ts.map +1 -1
  17. package/build/types/tile/Tile.d.ts +37 -17
  18. package/build/types/tile/Tile.d.ts.map +1 -1
  19. package/build/types/tile/index.d.ts +1 -1
  20. package/build/types/tile/index.d.ts.map +1 -1
  21. package/package.json +1 -1
  22. package/src/checkbox/{Checkbox.spec.js → Checkbox.spec.tsx} +5 -5
  23. package/src/checkbox/{Checkbox.js → Checkbox.tsx} +19 -41
  24. package/src/checkbox/index.ts +2 -0
  25. package/src/decision/Decision.tsx +1 -1
  26. package/src/index.ts +1 -0
  27. package/src/logo/Logo.story.tsx +3 -6
  28. package/src/logo/{Logo.js → Logo.tsx} +25 -35
  29. package/src/logo/index.ts +1 -0
  30. package/src/tile/{Tile.tsx → Tile.js} +35 -24
  31. package/src/tile/{Tile.spec.tsx → Tile.spec.js} +1 -1
  32. package/build/types/logo/logoTypes.d.ts +0 -6
  33. package/build/types/logo/logoTypes.d.ts.map +0 -1
  34. package/src/checkbox/index.js +0 -3
  35. package/src/logo/index.js +0 -2
  36. package/src/logo/logoTypes.ts +0 -6
  37. /package/src/checkbox/__snapshots__/{Checkbox.spec.js.snap → Checkbox.spec.tsx.snap} +0 -0
  38. /package/src/logo/{Logo.spec.js → Logo.spec.tsx} +0 -0
  39. /package/src/logo/__snapshots__/{Logo.spec.js.snap → Logo.spec.tsx.snap} +0 -0
  40. /package/src/tile/{Tile.story.tsx → Tile.story.js} +0 -0
  41. /package/src/tile/__snapshots__/{Tile.spec.tsx.snap → Tile.spec.js.snap} +0 -0
  42. /package/src/tile/{index.ts → index.js} +0 -0
package/build/index.js CHANGED
@@ -2313,9 +2313,8 @@ const CheckboxButton = /*#__PURE__*/React.forwardRef(({
2313
2313
  })
2314
2314
  })]
2315
2315
  }));
2316
- var CheckboxButton$1 = CheckboxButton;
2317
2316
 
2318
- const Checkbox = ({
2317
+ function Checkbox({
2319
2318
  id,
2320
2319
  checked,
2321
2320
  required,
@@ -2327,14 +2326,11 @@ const Checkbox = ({
2327
2326
  onChange,
2328
2327
  onFocus,
2329
2328
  onBlur
2330
- }) => {
2331
- const {
2332
- isModern
2333
- } = componentsTheming.useTheme();
2329
+ }) {
2334
2330
  const classList = classNames__default.default('np-checkbox', {
2335
2331
  checkbox: true,
2336
2332
  'checkbox-lg': secondary,
2337
- disabled: isModern && disabled
2333
+ disabled
2338
2334
  }, className);
2339
2335
  const innerDisabled = disabled || readOnly;
2340
2336
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -2344,7 +2340,7 @@ const Checkbox = ({
2344
2340
  className: classNames__default.default({
2345
2341
  disabled
2346
2342
  }),
2347
- children: [/*#__PURE__*/jsxRuntime.jsx(CheckboxButton$1, {
2343
+ children: [/*#__PURE__*/jsxRuntime.jsx(CheckboxButton, {
2348
2344
  className: "p-r-2",
2349
2345
  checked: checked,
2350
2346
  disabled: innerDisabled,
@@ -2361,39 +2357,12 @@ const Checkbox = ({
2361
2357
  children: label
2362
2358
  }), secondary && /*#__PURE__*/jsxRuntime.jsx(Body, {
2363
2359
  as: "span",
2364
- className: classNames__default.default({
2365
- secondary: !isModern
2366
- }),
2367
2360
  children: secondary
2368
2361
  })]
2369
2362
  })]
2370
2363
  })
2371
2364
  });
2372
- };
2373
- Checkbox.propTypes = {
2374
- id: PropTypes__default.default.string,
2375
- checked: PropTypes__default.default.bool,
2376
- required: PropTypes__default.default.bool,
2377
- disabled: PropTypes__default.default.bool,
2378
- readOnly: PropTypes__default.default.bool,
2379
- label: PropTypes__default.default.node.isRequired,
2380
- secondary: PropTypes__default.default.string,
2381
- onFocus: PropTypes__default.default.func,
2382
- onChange: PropTypes__default.default.func.isRequired,
2383
- onBlur: PropTypes__default.default.func,
2384
- className: PropTypes__default.default.string
2385
- };
2386
- Checkbox.defaultProps = {
2387
- id: null,
2388
- checked: false,
2389
- required: false,
2390
- disabled: false,
2391
- readOnly: false,
2392
- secondary: null,
2393
- onFocus: null,
2394
- onBlur: null,
2395
- className: undefined
2396
- };
2365
+ }
2397
2366
 
2398
2367
  const CheckboxOption = /*#__PURE__*/React.forwardRef(({
2399
2368
  checked,
@@ -2405,7 +2374,7 @@ const CheckboxOption = /*#__PURE__*/React.forwardRef(({
2405
2374
  ...rest,
2406
2375
  ref: reference,
2407
2376
  disabled: disabled,
2408
- button: /*#__PURE__*/jsxRuntime.jsx(CheckboxButton$1, {
2377
+ button: /*#__PURE__*/jsxRuntime.jsx(CheckboxButton, {
2409
2378
  checked: checked,
2410
2379
  disabled: disabled,
2411
2380
  onChange: () => onChange?.(!checked)
@@ -4682,7 +4651,7 @@ const NavigationOption = /*#__PURE__*/React.forwardRef(({
4682
4651
  });
4683
4652
  });
4684
4653
 
4685
- function Tile({
4654
+ const Tile = ({
4686
4655
  className,
4687
4656
  description,
4688
4657
  disabled,
@@ -4690,10 +4659,10 @@ function Tile({
4690
4659
  target,
4691
4660
  media,
4692
4661
  onClick,
4693
- size = 'md',
4662
+ size,
4694
4663
  title
4695
- }) {
4696
- const isSmall = size === 'sm';
4664
+ }) => {
4665
+ const isSmall = size === exports.Size.SMALL;
4697
4666
  const Element = href ? 'a' : 'button';
4698
4667
  return /*#__PURE__*/jsxRuntime.jsxs(Element, {
4699
4668
  className: classNames__default.default('decision', 'flex-column', 'np-tile', 'text-no-decoration', 'text-xs-center', className, {
@@ -4702,12 +4671,12 @@ function Tile({
4702
4671
  }, disabled && 'disabled'),
4703
4672
  href: href,
4704
4673
  target: target,
4705
- onClick: disabled ? undefined : onClick,
4706
- onKeyDown: disabled ? undefined : ({
4674
+ onClick: disabled ? null : onClick,
4675
+ onKeyDown: disabled ? null : ({
4707
4676
  key
4708
4677
  }) => {
4709
4678
  if (key === 'Enter' || key === ' ') {
4710
- onClick?.();
4679
+ onClick();
4711
4680
  }
4712
4681
  },
4713
4682
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -4724,7 +4693,29 @@ function Tile({
4724
4693
  children: description
4725
4694
  }) : null]
4726
4695
  });
4727
- }
4696
+ };
4697
+ Tile.propTypes = {
4698
+ /** Classes to apply to the Tile container */
4699
+ className: PropTypes__default.default.string,
4700
+ description: PropTypes__default.default.node,
4701
+ disabled: PropTypes__default.default.bool,
4702
+ href: PropTypes__default.default.string,
4703
+ target: PropTypes__default.default.oneOf(['_self', '_blank', '_parent', '_top']),
4704
+ /** Accepts only Avatar and images */
4705
+ media: PropTypes__default.default.node.isRequired,
4706
+ /** Function called onClick or onKeyDown */
4707
+ onClick: PropTypes__default.default.func,
4708
+ /** The size applied to Tile */
4709
+ size: PropTypes__default.default.oneOf(['sm', 'md']),
4710
+ title: PropTypes__default.default.node.isRequired
4711
+ };
4712
+ Tile.defaultProps = {
4713
+ className: '',
4714
+ description: null,
4715
+ disabled: false,
4716
+ size: exports.Size.MEDIUM,
4717
+ target: undefined
4718
+ };
4728
4719
 
4729
4720
  exports.DecisionPresentation = void 0;
4730
4721
  (function (DecisionPresentation) {
@@ -5078,14 +5069,6 @@ const FlowHeader = /*#__PURE__*/React__namespace.forwardRef(({
5078
5069
  });
5079
5070
  });
5080
5071
 
5081
- // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
5082
- exports.LogoType = void 0;
5083
- (function (LogoType) {
5084
- LogoType["WISE"] = "WISE";
5085
- LogoType["WISE_BUSINESS"] = "WISE_BUSINESS";
5086
- LogoType["WISE_PLATFORM"] = "WISE_PLATFORM";
5087
- })(exports.LogoType || (exports.LogoType = {}));
5088
-
5089
5072
  var LogoFlagInverse = function LogoFlagInverse(props) {
5090
5073
  return /*#__PURE__*/jsxRuntime.jsx("svg", {
5091
5074
  ...props,
@@ -5218,15 +5201,26 @@ const svgPaths = {
5218
5201
  WISE_FLAG_PLATFORM: LogoFlagPlatform,
5219
5202
  WISE_FLAG_PLATFORM_INVERSE: LogoFlagPlatformInverse
5220
5203
  };
5221
- const Logo = ({
5204
+ exports.LogoType = void 0;
5205
+ (function (LogoType) {
5206
+ LogoType["WISE"] = "WISE";
5207
+ LogoType["WISE_BUSINESS"] = "WISE_BUSINESS";
5208
+ LogoType["WISE_PLATFORM"] = "WISE_PLATFORM";
5209
+ })(exports.LogoType || (exports.LogoType = {}));
5210
+ const labelByType = {
5211
+ WISE: 'Wise',
5212
+ WISE_BUSINESS: 'Wise Business',
5213
+ WISE_PLATFORM: 'Wise Platform'
5214
+ };
5215
+ function Logo({
5222
5216
  className,
5223
5217
  inverse,
5224
- type
5225
- }) => {
5226
- const LogoSm = svgPaths[`WISE_FLAG${type === exports.LogoType.WISE_PLATFORM ? '_PLATFORM' : ''}${inverse ? '_INVERSE' : ''}`];
5218
+ type = 'WISE'
5219
+ }) {
5220
+ const LogoSm = svgPaths[`WISE_FLAG${type === 'WISE_PLATFORM' ? '_PLATFORM' : ''}${inverse ? '_INVERSE' : ''}`];
5227
5221
  const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
5228
5222
  return /*#__PURE__*/jsxRuntime.jsxs("span", {
5229
- "aria-label": type === exports.LogoType.WISE ? 'Wise' : 'Wise Business' | type === exports.LogoType.WISE_PLATFORM ? 'Wise Platform' : 'Wise Business',
5223
+ "aria-label": labelByType[type],
5230
5224
  role: "img",
5231
5225
  className: classNames__default.default(className, 'np-logo'),
5232
5226
  children: [/*#__PURE__*/jsxRuntime.jsx(LogoSm, {
@@ -5235,21 +5229,7 @@ const Logo = ({
5235
5229
  className: "np-logo-svg np-logo-svg--size-md"
5236
5230
  })]
5237
5231
  });
5238
- };
5239
- Logo.propTypes = {
5240
- /** Extra classes applied to Logo */
5241
- className: PropTypes__default.default.string,
5242
- /** If true, will use dark colours for dark on light theme */
5243
- inverse: PropTypes__default.default.bool,
5244
- /** What type of logo to display */
5245
- type: PropTypes__default.default.oneOf(['WISE', 'WISE_BUSINESS', 'WISE_PLATFORM'])
5246
- };
5247
- Logo.defaultProps = {
5248
- className: undefined,
5249
- inverse: false,
5250
- type: exports.LogoType.WISE
5251
- };
5252
- var Logo$1 = Logo;
5232
+ }
5253
5233
 
5254
5234
  /* eslint-disable @typescript-eslint/ban-ts-comment */
5255
5235
  const Tooltip = ({
@@ -5479,7 +5459,7 @@ BackButton.defaultProps = {
5479
5459
  const FlowNavigation = ({
5480
5460
  activeStep = 0,
5481
5461
  avatar,
5482
- logo = /*#__PURE__*/jsxRuntime.jsx(Logo$1, {}),
5462
+ logo = /*#__PURE__*/jsxRuntime.jsx(Logo, {}),
5483
5463
  done = false,
5484
5464
  onClose,
5485
5465
  onGoBack,
@@ -7906,7 +7886,7 @@ const OverlayHeader = ({
7906
7886
  };
7907
7887
  OverlayHeader.defaultProps = {
7908
7888
  avatar: null,
7909
- logo: /*#__PURE__*/jsxRuntime.jsx(Logo$1, {}),
7889
+ logo: /*#__PURE__*/jsxRuntime.jsx(Logo, {}),
7910
7890
  onClose: null
7911
7891
  };
7912
7892
  OverlayHeader.propTypes = {
@@ -14767,7 +14747,7 @@ exports.Button = Button;
14767
14747
  exports.Card = Card$1;
14768
14748
  exports.Carousel = Carousel;
14769
14749
  exports.Checkbox = Checkbox;
14770
- exports.CheckboxButton = CheckboxButton$1;
14750
+ exports.CheckboxButton = CheckboxButton;
14771
14751
  exports.CheckboxOption = CheckboxOption;
14772
14752
  exports.Chevron = Chevron;
14773
14753
  exports.Chip = Chip;
@@ -14801,7 +14781,7 @@ exports.LanguageProvider = LanguageProvider;
14801
14781
  exports.Link = Link;
14802
14782
  exports.ListItem = ListItem$1;
14803
14783
  exports.Loader = Loader;
14804
- exports.Logo = Logo$1;
14784
+ exports.Logo = Logo;
14805
14785
  exports.Markdown = Markdown;
14806
14786
  exports.Modal = Modal;
14807
14787
  exports.Money = Money;