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

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)
@@ -4807,9 +4838,9 @@ const Decision = ({
4807
4838
  return null;
4808
4839
  };
4809
4840
 
4810
- const isLayoutHorizontal = layout => [exports.Layout.HORIZONTAL_LEFT_ALIGNED, exports.Layout.HORIZONTAL_RIGHT_ALIGNED, exports.Layout.HORIZONTAL_JUSTIFIED].includes(layout);
4841
+ const isLayoutHorizontal = layout => layout === exports.Layout.HORIZONTAL_LEFT_ALIGNED || layout === exports.Layout.HORIZONTAL_RIGHT_ALIGNED || layout === exports.Layout.HORIZONTAL_JUSTIFIED;
4811
4842
  const getAlignmentClasses = (layout, action) => {
4812
- let classes = ['d-flex'];
4843
+ const classes = ['d-flex'];
4813
4844
  if (action) {
4814
4845
  if (isLayoutHorizontal(layout)) {
4815
4846
  classes.push('align-items-center');
@@ -4827,60 +4858,44 @@ const getAlignmentClasses = (layout, action) => {
4827
4858
  }
4828
4859
  return classes;
4829
4860
  };
4830
- const DefinitionList = ({
4831
- definitions,
4832
- layout,
4861
+ const defaultDefinitions = [];
4862
+ function DefinitionList({
4863
+ definitions = defaultDefinitions,
4864
+ layout = 'VERTICAL_TWO_COLUMN',
4833
4865
  muted
4834
- }) => /*#__PURE__*/jsxRuntime.jsx("dl", {
4835
- className: classNames__default.default('tw-definition-list d-flex ', {
4836
- 'text-muted': muted,
4837
- 'flex-column': layout === exports.Layout.VERTICAL_ONE_COLUMN,
4838
- 'tw-definition-list--columns flex-column flex-row--sm': layout === exports.Layout.VERTICAL_TWO_COLUMN,
4839
- 'tw-definition-list--horizontal flex-column': isLayoutHorizontal(layout)
4840
- }),
4841
- children: definitions.filter(definition => definition).map(({
4842
- action,
4843
- title,
4844
- value,
4845
- key
4846
- }) => /*#__PURE__*/jsxRuntime.jsxs("div", {
4847
- className: "tw-definition-list__item",
4848
- children: [/*#__PURE__*/jsxRuntime.jsx("dt", {
4849
- children: title
4850
- }), /*#__PURE__*/jsxRuntime.jsxs("dd", {
4851
- className: classNames__default.default(...getAlignmentClasses(layout, action)),
4852
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
4853
- children: value
4854
- }), action ? /*#__PURE__*/jsxRuntime.jsx("div", {
4855
- className: classNames__default.default(isLayoutHorizontal(layout) ? 'p-l-2' : 'p-x-2', 'tw-definition-list__action'),
4856
- children: /*#__PURE__*/jsxRuntime.jsx(ActionButton, {
4857
- className: "tw-definition-list__button",
4858
- onClick: action.onClick,
4859
- children: action.label
4860
- })
4861
- }) : null]
4862
- })]
4863
- }, key))
4864
- });
4865
- DefinitionList.propTypes = {
4866
- definitions: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
4867
- action: PropTypes__default.default.shape({
4868
- label: PropTypes__default.default.string.isRequired,
4869
- onClick: PropTypes__default.default.func
4866
+ }) {
4867
+ return /*#__PURE__*/jsxRuntime.jsx("dl", {
4868
+ className: classNames__default.default('tw-definition-list d-flex ', {
4869
+ 'text-muted': muted,
4870
+ 'flex-column': layout === exports.Layout.VERTICAL_ONE_COLUMN,
4871
+ 'tw-definition-list--columns flex-column flex-row--sm': layout === exports.Layout.VERTICAL_TWO_COLUMN,
4872
+ 'tw-definition-list--horizontal flex-column': isLayoutHorizontal(layout)
4870
4873
  }),
4871
- title: PropTypes__default.default.node.isRequired,
4872
- value: PropTypes__default.default.node.isRequired,
4873
- key: PropTypes__default.default.string.isRequired
4874
- })),
4875
- layout: PropTypes__default.default.oneOf(['VERTICAL_TWO_COLUMN', 'VERTICAL_ONE_COLUMN', 'HORIZONTAL_JUSTIFIED', 'HORIZONTAL_LEFT_ALIGNED', 'HORIZONTAL_RIGHT_ALIGNED']),
4876
- muted: PropTypes__default.default.bool
4877
- };
4878
- DefinitionList.defaultProps = {
4879
- definitions: [],
4880
- layout: exports.Layout.VERTICAL_TWO_COLUMN,
4881
- muted: false
4882
- };
4883
- var DefinitionList$1 = DefinitionList;
4874
+ children: definitions.filter(definition => definition).map(({
4875
+ action,
4876
+ title,
4877
+ value,
4878
+ key
4879
+ }) => /*#__PURE__*/jsxRuntime.jsxs("div", {
4880
+ className: "tw-definition-list__item",
4881
+ children: [/*#__PURE__*/jsxRuntime.jsx("dt", {
4882
+ children: title
4883
+ }), /*#__PURE__*/jsxRuntime.jsxs("dd", {
4884
+ className: classNames__default.default(...getAlignmentClasses(layout, action)),
4885
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
4886
+ children: value
4887
+ }), action ? /*#__PURE__*/jsxRuntime.jsx("div", {
4888
+ className: classNames__default.default(isLayoutHorizontal(layout) ? 'p-l-2' : 'p-x-2', 'tw-definition-list__action'),
4889
+ children: /*#__PURE__*/jsxRuntime.jsx(ActionButton, {
4890
+ className: "tw-definition-list__button",
4891
+ onClick: action.onClick,
4892
+ children: action.label
4893
+ })
4894
+ }) : null]
4895
+ })]
4896
+ }, key))
4897
+ });
4898
+ }
4884
4899
 
4885
4900
  const DropFade = ({
4886
4901
  children,
@@ -14758,7 +14773,7 @@ exports.Button = Button;
14758
14773
  exports.Card = Card$1;
14759
14774
  exports.Carousel = Carousel;
14760
14775
  exports.Checkbox = Checkbox;
14761
- exports.CheckboxButton = CheckboxButton;
14776
+ exports.CheckboxButton = CheckboxButton$1;
14762
14777
  exports.CheckboxOption = CheckboxOption;
14763
14778
  exports.Chevron = Chevron;
14764
14779
  exports.Chip = Chip;
@@ -14770,7 +14785,7 @@ exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
14770
14785
  exports.DateInput = DateInput;
14771
14786
  exports.DateLookup = DateLookup$1;
14772
14787
  exports.Decision = Decision;
14773
- exports.DefinitionList = DefinitionList$1;
14788
+ exports.DefinitionList = DefinitionList;
14774
14789
  exports.Dimmer = Dimmer$1;
14775
14790
  exports.DirectionProvider = DirectionProvider;
14776
14791
  exports.Display = Display;