@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.js CHANGED
@@ -2313,8 +2313,9 @@ const CheckboxButton = /*#__PURE__*/React.forwardRef(({
2313
2313
  })
2314
2314
  })]
2315
2315
  }));
2316
+ var CheckboxButton$1 = CheckboxButton;
2316
2317
 
2317
- function Checkbox({
2318
+ const Checkbox = ({
2318
2319
  id,
2319
2320
  checked,
2320
2321
  required,
@@ -2326,11 +2327,14 @@ function Checkbox({
2326
2327
  onChange,
2327
2328
  onFocus,
2328
2329
  onBlur
2329
- }) {
2330
+ }) => {
2331
+ const {
2332
+ isModern
2333
+ } = componentsTheming.useTheme();
2330
2334
  const classList = classNames__default.default('np-checkbox', {
2331
2335
  checkbox: true,
2332
2336
  'checkbox-lg': secondary,
2333
- disabled
2337
+ disabled: isModern && disabled
2334
2338
  }, className);
2335
2339
  const innerDisabled = disabled || readOnly;
2336
2340
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -2340,7 +2344,7 @@ function Checkbox({
2340
2344
  className: classNames__default.default({
2341
2345
  disabled
2342
2346
  }),
2343
- children: [/*#__PURE__*/jsxRuntime.jsx(CheckboxButton, {
2347
+ children: [/*#__PURE__*/jsxRuntime.jsx(CheckboxButton$1, {
2344
2348
  className: "p-r-2",
2345
2349
  checked: checked,
2346
2350
  disabled: innerDisabled,
@@ -2357,12 +2361,39 @@ function Checkbox({
2357
2361
  children: label
2358
2362
  }), secondary && /*#__PURE__*/jsxRuntime.jsx(Body, {
2359
2363
  as: "span",
2364
+ className: classNames__default.default({
2365
+ secondary: !isModern
2366
+ }),
2360
2367
  children: secondary
2361
2368
  })]
2362
2369
  })]
2363
2370
  })
2364
2371
  });
2365
- }
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
+ };
2366
2397
 
2367
2398
  const CheckboxOption = /*#__PURE__*/React.forwardRef(({
2368
2399
  checked,
@@ -2374,7 +2405,7 @@ const CheckboxOption = /*#__PURE__*/React.forwardRef(({
2374
2405
  ...rest,
2375
2406
  ref: reference,
2376
2407
  disabled: disabled,
2377
- button: /*#__PURE__*/jsxRuntime.jsx(CheckboxButton, {
2408
+ button: /*#__PURE__*/jsxRuntime.jsx(CheckboxButton$1, {
2378
2409
  checked: checked,
2379
2410
  disabled: disabled,
2380
2411
  onChange: () => onChange?.(!checked)
@@ -4651,7 +4682,7 @@ const NavigationOption = /*#__PURE__*/React.forwardRef(({
4651
4682
  });
4652
4683
  });
4653
4684
 
4654
- const Tile = ({
4685
+ function Tile({
4655
4686
  className,
4656
4687
  description,
4657
4688
  disabled,
@@ -4659,10 +4690,10 @@ const Tile = ({
4659
4690
  target,
4660
4691
  media,
4661
4692
  onClick,
4662
- size,
4693
+ size = 'md',
4663
4694
  title
4664
- }) => {
4665
- const isSmall = size === exports.Size.SMALL;
4695
+ }) {
4696
+ const isSmall = size === 'sm';
4666
4697
  const Element = href ? 'a' : 'button';
4667
4698
  return /*#__PURE__*/jsxRuntime.jsxs(Element, {
4668
4699
  className: classNames__default.default('decision', 'flex-column', 'np-tile', 'text-no-decoration', 'text-xs-center', className, {
@@ -4671,12 +4702,12 @@ const Tile = ({
4671
4702
  }, disabled && 'disabled'),
4672
4703
  href: href,
4673
4704
  target: target,
4674
- onClick: disabled ? null : onClick,
4675
- onKeyDown: disabled ? null : ({
4705
+ onClick: disabled ? undefined : onClick,
4706
+ onKeyDown: disabled ? undefined : ({
4676
4707
  key
4677
4708
  }) => {
4678
4709
  if (key === 'Enter' || key === ' ') {
4679
- onClick();
4710
+ onClick?.();
4680
4711
  }
4681
4712
  },
4682
4713
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -4693,29 +4724,7 @@ const Tile = ({
4693
4724
  children: description
4694
4725
  }) : null]
4695
4726
  });
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
- };
4727
+ }
4719
4728
 
4720
4729
  exports.DecisionPresentation = void 0;
4721
4730
  (function (DecisionPresentation) {
@@ -14758,7 +14767,7 @@ exports.Button = Button;
14758
14767
  exports.Card = Card$1;
14759
14768
  exports.Carousel = Carousel;
14760
14769
  exports.Checkbox = Checkbox;
14761
- exports.CheckboxButton = CheckboxButton;
14770
+ exports.CheckboxButton = CheckboxButton$1;
14762
14771
  exports.CheckboxOption = CheckboxOption;
14763
14772
  exports.Chevron = Chevron;
14764
14773
  exports.Chip = Chip;