@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.mjs CHANGED
@@ -2283,9 +2283,8 @@ const CheckboxButton = /*#__PURE__*/forwardRef(({
2283
2283
  })
2284
2284
  })]
2285
2285
  }));
2286
- var CheckboxButton$1 = CheckboxButton;
2287
2286
 
2288
- const Checkbox = ({
2287
+ function Checkbox({
2289
2288
  id,
2290
2289
  checked,
2291
2290
  required,
@@ -2297,14 +2296,11 @@ const Checkbox = ({
2297
2296
  onChange,
2298
2297
  onFocus,
2299
2298
  onBlur
2300
- }) => {
2301
- const {
2302
- isModern
2303
- } = useTheme();
2299
+ }) {
2304
2300
  const classList = classNames('np-checkbox', {
2305
2301
  checkbox: true,
2306
2302
  'checkbox-lg': secondary,
2307
- disabled: isModern && disabled
2303
+ disabled
2308
2304
  }, className);
2309
2305
  const innerDisabled = disabled || readOnly;
2310
2306
  return /*#__PURE__*/jsx("div", {
@@ -2314,7 +2310,7 @@ const Checkbox = ({
2314
2310
  className: classNames({
2315
2311
  disabled
2316
2312
  }),
2317
- children: [/*#__PURE__*/jsx(CheckboxButton$1, {
2313
+ children: [/*#__PURE__*/jsx(CheckboxButton, {
2318
2314
  className: "p-r-2",
2319
2315
  checked: checked,
2320
2316
  disabled: innerDisabled,
@@ -2331,39 +2327,12 @@ const Checkbox = ({
2331
2327
  children: label
2332
2328
  }), secondary && /*#__PURE__*/jsx(Body, {
2333
2329
  as: "span",
2334
- className: classNames({
2335
- secondary: !isModern
2336
- }),
2337
2330
  children: secondary
2338
2331
  })]
2339
2332
  })]
2340
2333
  })
2341
2334
  });
2342
- };
2343
- Checkbox.propTypes = {
2344
- id: PropTypes.string,
2345
- checked: PropTypes.bool,
2346
- required: PropTypes.bool,
2347
- disabled: PropTypes.bool,
2348
- readOnly: PropTypes.bool,
2349
- label: PropTypes.node.isRequired,
2350
- secondary: PropTypes.string,
2351
- onFocus: PropTypes.func,
2352
- onChange: PropTypes.func.isRequired,
2353
- onBlur: PropTypes.func,
2354
- className: PropTypes.string
2355
- };
2356
- Checkbox.defaultProps = {
2357
- id: null,
2358
- checked: false,
2359
- required: false,
2360
- disabled: false,
2361
- readOnly: false,
2362
- secondary: null,
2363
- onFocus: null,
2364
- onBlur: null,
2365
- className: undefined
2366
- };
2335
+ }
2367
2336
 
2368
2337
  const CheckboxOption = /*#__PURE__*/forwardRef(({
2369
2338
  checked,
@@ -2375,7 +2344,7 @@ const CheckboxOption = /*#__PURE__*/forwardRef(({
2375
2344
  ...rest,
2376
2345
  ref: reference,
2377
2346
  disabled: disabled,
2378
- button: /*#__PURE__*/jsx(CheckboxButton$1, {
2347
+ button: /*#__PURE__*/jsx(CheckboxButton, {
2379
2348
  checked: checked,
2380
2349
  disabled: disabled,
2381
2350
  onChange: () => onChange?.(!checked)
@@ -4652,7 +4621,7 @@ const NavigationOption = /*#__PURE__*/forwardRef(({
4652
4621
  });
4653
4622
  });
4654
4623
 
4655
- function Tile({
4624
+ const Tile = ({
4656
4625
  className,
4657
4626
  description,
4658
4627
  disabled,
@@ -4660,10 +4629,10 @@ function Tile({
4660
4629
  target,
4661
4630
  media,
4662
4631
  onClick,
4663
- size = 'md',
4632
+ size,
4664
4633
  title
4665
- }) {
4666
- const isSmall = size === 'sm';
4634
+ }) => {
4635
+ const isSmall = size === Size.SMALL;
4667
4636
  const Element = href ? 'a' : 'button';
4668
4637
  return /*#__PURE__*/jsxs(Element, {
4669
4638
  className: classNames('decision', 'flex-column', 'np-tile', 'text-no-decoration', 'text-xs-center', className, {
@@ -4672,12 +4641,12 @@ function Tile({
4672
4641
  }, disabled && 'disabled'),
4673
4642
  href: href,
4674
4643
  target: target,
4675
- onClick: disabled ? undefined : onClick,
4676
- onKeyDown: disabled ? undefined : ({
4644
+ onClick: disabled ? null : onClick,
4645
+ onKeyDown: disabled ? null : ({
4677
4646
  key
4678
4647
  }) => {
4679
4648
  if (key === 'Enter' || key === ' ') {
4680
- onClick?.();
4649
+ onClick();
4681
4650
  }
4682
4651
  },
4683
4652
  children: [/*#__PURE__*/jsx("div", {
@@ -4694,7 +4663,29 @@ function Tile({
4694
4663
  children: description
4695
4664
  }) : null]
4696
4665
  });
4697
- }
4666
+ };
4667
+ Tile.propTypes = {
4668
+ /** Classes to apply to the Tile container */
4669
+ className: PropTypes.string,
4670
+ description: PropTypes.node,
4671
+ disabled: PropTypes.bool,
4672
+ href: PropTypes.string,
4673
+ target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
4674
+ /** Accepts only Avatar and images */
4675
+ media: PropTypes.node.isRequired,
4676
+ /** Function called onClick or onKeyDown */
4677
+ onClick: PropTypes.func,
4678
+ /** The size applied to Tile */
4679
+ size: PropTypes.oneOf(['sm', 'md']),
4680
+ title: PropTypes.node.isRequired
4681
+ };
4682
+ Tile.defaultProps = {
4683
+ className: '',
4684
+ description: null,
4685
+ disabled: false,
4686
+ size: Size.MEDIUM,
4687
+ target: undefined
4688
+ };
4698
4689
 
4699
4690
  var DecisionPresentation;
4700
4691
  (function (DecisionPresentation) {
@@ -5048,14 +5039,6 @@ const FlowHeader = /*#__PURE__*/React.forwardRef(({
5048
5039
  });
5049
5040
  });
5050
5041
 
5051
- // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
5052
- var LogoType;
5053
- (function (LogoType) {
5054
- LogoType["WISE"] = "WISE";
5055
- LogoType["WISE_BUSINESS"] = "WISE_BUSINESS";
5056
- LogoType["WISE_PLATFORM"] = "WISE_PLATFORM";
5057
- })(LogoType || (LogoType = {}));
5058
-
5059
5042
  var LogoFlagInverse = function LogoFlagInverse(props) {
5060
5043
  return /*#__PURE__*/jsx("svg", {
5061
5044
  ...props,
@@ -5188,15 +5171,26 @@ const svgPaths = {
5188
5171
  WISE_FLAG_PLATFORM: LogoFlagPlatform,
5189
5172
  WISE_FLAG_PLATFORM_INVERSE: LogoFlagPlatformInverse
5190
5173
  };
5191
- const Logo = ({
5174
+ var LogoType;
5175
+ (function (LogoType) {
5176
+ LogoType["WISE"] = "WISE";
5177
+ LogoType["WISE_BUSINESS"] = "WISE_BUSINESS";
5178
+ LogoType["WISE_PLATFORM"] = "WISE_PLATFORM";
5179
+ })(LogoType || (LogoType = {}));
5180
+ const labelByType = {
5181
+ WISE: 'Wise',
5182
+ WISE_BUSINESS: 'Wise Business',
5183
+ WISE_PLATFORM: 'Wise Platform'
5184
+ };
5185
+ function Logo({
5192
5186
  className,
5193
5187
  inverse,
5194
- type
5195
- }) => {
5196
- const LogoSm = svgPaths[`WISE_FLAG${type === LogoType.WISE_PLATFORM ? '_PLATFORM' : ''}${inverse ? '_INVERSE' : ''}`];
5188
+ type = 'WISE'
5189
+ }) {
5190
+ const LogoSm = svgPaths[`WISE_FLAG${type === 'WISE_PLATFORM' ? '_PLATFORM' : ''}${inverse ? '_INVERSE' : ''}`];
5197
5191
  const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
5198
5192
  return /*#__PURE__*/jsxs("span", {
5199
- "aria-label": type === LogoType.WISE ? 'Wise' : 'Wise Business' | type === LogoType.WISE_PLATFORM ? 'Wise Platform' : 'Wise Business',
5193
+ "aria-label": labelByType[type],
5200
5194
  role: "img",
5201
5195
  className: classNames(className, 'np-logo'),
5202
5196
  children: [/*#__PURE__*/jsx(LogoSm, {
@@ -5205,21 +5199,7 @@ const Logo = ({
5205
5199
  className: "np-logo-svg np-logo-svg--size-md"
5206
5200
  })]
5207
5201
  });
5208
- };
5209
- Logo.propTypes = {
5210
- /** Extra classes applied to Logo */
5211
- className: PropTypes.string,
5212
- /** If true, will use dark colours for dark on light theme */
5213
- inverse: PropTypes.bool,
5214
- /** What type of logo to display */
5215
- type: PropTypes.oneOf(['WISE', 'WISE_BUSINESS', 'WISE_PLATFORM'])
5216
- };
5217
- Logo.defaultProps = {
5218
- className: undefined,
5219
- inverse: false,
5220
- type: LogoType.WISE
5221
- };
5222
- var Logo$1 = Logo;
5202
+ }
5223
5203
 
5224
5204
  /* eslint-disable @typescript-eslint/ban-ts-comment */
5225
5205
  const Tooltip = ({
@@ -5449,7 +5429,7 @@ BackButton.defaultProps = {
5449
5429
  const FlowNavigation = ({
5450
5430
  activeStep = 0,
5451
5431
  avatar,
5452
- logo = /*#__PURE__*/jsx(Logo$1, {}),
5432
+ logo = /*#__PURE__*/jsx(Logo, {}),
5453
5433
  done = false,
5454
5434
  onClose,
5455
5435
  onGoBack,
@@ -7876,7 +7856,7 @@ const OverlayHeader = ({
7876
7856
  };
7877
7857
  OverlayHeader.defaultProps = {
7878
7858
  avatar: null,
7879
- logo: /*#__PURE__*/jsx(Logo$1, {}),
7859
+ logo: /*#__PURE__*/jsx(Logo, {}),
7880
7860
  onClose: null
7881
7861
  };
7882
7862
  OverlayHeader.propTypes = {
@@ -14723,5 +14703,5 @@ const translations = {
14723
14703
  'zh-HK': zhHK
14724
14704
  };
14725
14705
 
14726
- export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card$2 as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$1 as Card, Carousel, Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, Field, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, Label, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCardGroup$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead$1 as Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
14706
+ export { Accordion, ActionButton, ActionOption, Alert, AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card$2 as BaseCard, Body, BottomSheet$1 as BottomSheet, Breakpoint, Button, Card$1 as Card, Carousel, Checkbox, CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, Emphasis, Field, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, Label, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader, Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$1 as Popover, Position, Priority, ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCardGroup$1 as PromoCardGroup, Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip, Type, Typeahead$1 as Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
14727
14707
  //# sourceMappingURL=index.mjs.map