@transferwise/components 0.0.0-experimental-8b0167a → 0.0.0-experimental-d9b4d5e

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.mjs CHANGED
@@ -2283,8 +2283,9 @@ const CheckboxButton = /*#__PURE__*/forwardRef(({
2283
2283
  })
2284
2284
  })]
2285
2285
  }));
2286
+ var CheckboxButton$1 = CheckboxButton;
2286
2287
 
2287
- function Checkbox({
2288
+ const Checkbox = ({
2288
2289
  id,
2289
2290
  checked,
2290
2291
  required,
@@ -2296,11 +2297,14 @@ function Checkbox({
2296
2297
  onChange,
2297
2298
  onFocus,
2298
2299
  onBlur
2299
- }) {
2300
+ }) => {
2301
+ const {
2302
+ isModern
2303
+ } = useTheme();
2300
2304
  const classList = classNames('np-checkbox', {
2301
2305
  checkbox: true,
2302
2306
  'checkbox-lg': secondary,
2303
- disabled
2307
+ disabled: isModern && disabled
2304
2308
  }, className);
2305
2309
  const innerDisabled = disabled || readOnly;
2306
2310
  return /*#__PURE__*/jsx("div", {
@@ -2310,7 +2314,7 @@ function Checkbox({
2310
2314
  className: classNames({
2311
2315
  disabled
2312
2316
  }),
2313
- children: [/*#__PURE__*/jsx(CheckboxButton, {
2317
+ children: [/*#__PURE__*/jsx(CheckboxButton$1, {
2314
2318
  className: "p-r-2",
2315
2319
  checked: checked,
2316
2320
  disabled: innerDisabled,
@@ -2327,12 +2331,39 @@ function Checkbox({
2327
2331
  children: label
2328
2332
  }), secondary && /*#__PURE__*/jsx(Body, {
2329
2333
  as: "span",
2334
+ className: classNames({
2335
+ secondary: !isModern
2336
+ }),
2330
2337
  children: secondary
2331
2338
  })]
2332
2339
  })]
2333
2340
  })
2334
2341
  });
2335
- }
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
+ };
2336
2367
 
2337
2368
  const CheckboxOption = /*#__PURE__*/forwardRef(({
2338
2369
  checked,
@@ -2344,7 +2375,7 @@ const CheckboxOption = /*#__PURE__*/forwardRef(({
2344
2375
  ...rest,
2345
2376
  ref: reference,
2346
2377
  disabled: disabled,
2347
- button: /*#__PURE__*/jsx(CheckboxButton, {
2378
+ button: /*#__PURE__*/jsx(CheckboxButton$1, {
2348
2379
  checked: checked,
2349
2380
  disabled: disabled,
2350
2381
  onChange: () => onChange?.(!checked)
@@ -4621,7 +4652,7 @@ const NavigationOption = /*#__PURE__*/forwardRef(({
4621
4652
  });
4622
4653
  });
4623
4654
 
4624
- const Tile = ({
4655
+ function Tile({
4625
4656
  className,
4626
4657
  description,
4627
4658
  disabled,
@@ -4629,10 +4660,10 @@ const Tile = ({
4629
4660
  target,
4630
4661
  media,
4631
4662
  onClick,
4632
- size,
4663
+ size = 'md',
4633
4664
  title
4634
- }) => {
4635
- const isSmall = size === Size.SMALL;
4665
+ }) {
4666
+ const isSmall = size === 'sm';
4636
4667
  const Element = href ? 'a' : 'button';
4637
4668
  return /*#__PURE__*/jsxs(Element, {
4638
4669
  className: classNames('decision', 'flex-column', 'np-tile', 'text-no-decoration', 'text-xs-center', className, {
@@ -4641,12 +4672,12 @@ const Tile = ({
4641
4672
  }, disabled && 'disabled'),
4642
4673
  href: href,
4643
4674
  target: target,
4644
- onClick: disabled ? null : onClick,
4645
- onKeyDown: disabled ? null : ({
4675
+ onClick: disabled ? undefined : onClick,
4676
+ onKeyDown: disabled ? undefined : ({
4646
4677
  key
4647
4678
  }) => {
4648
4679
  if (key === 'Enter' || key === ' ') {
4649
- onClick();
4680
+ onClick?.();
4650
4681
  }
4651
4682
  },
4652
4683
  children: [/*#__PURE__*/jsx("div", {
@@ -4663,29 +4694,7 @@ const Tile = ({
4663
4694
  children: description
4664
4695
  }) : null]
4665
4696
  });
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
- };
4697
+ }
4689
4698
 
4690
4699
  var DecisionPresentation;
4691
4700
  (function (DecisionPresentation) {
@@ -14714,5 +14723,5 @@ const translations = {
14714
14723
  'zh-HK': zhHK
14715
14724
  };
14716
14725
 
14717
- 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$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 };
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 };
14718
14727
  //# sourceMappingURL=index.mjs.map