@transferwise/components 0.0.0-experimental-dad811d → 0.0.0-experimental-36cf7cb

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 (62) hide show
  1. package/build/index.esm.js +193 -327
  2. package/build/index.esm.js.map +1 -1
  3. package/build/index.js +164 -298
  4. package/build/index.js.map +1 -1
  5. package/build/main.css +6 -82
  6. package/build/styles/decision/Decision.css +6 -82
  7. package/build/styles/main.css +6 -82
  8. package/build/types/body/Body.d.ts +1 -1
  9. package/build/types/card/Card.d.ts +0 -1
  10. package/build/types/card/Card.d.ts.map +1 -1
  11. package/build/types/common/Option/Option.d.ts +0 -1
  12. package/build/types/common/Option/Option.d.ts.map +1 -1
  13. package/build/types/common/commonProps.d.ts +1 -1
  14. package/build/types/common/commonProps.d.ts.map +1 -1
  15. package/build/types/common/panel/Panel.d.ts +1 -1
  16. package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -1
  17. package/build/types/dateInput/index.d.ts +2 -2
  18. package/build/types/dateInput/index.d.ts.map +1 -1
  19. package/build/types/dateLookup/DateLookup.d.ts +1 -0
  20. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  21. package/build/types/decision/Decision.d.ts +39 -52
  22. package/build/types/decision/Decision.d.ts.map +1 -1
  23. package/build/types/decision/index.d.ts +1 -2
  24. package/build/types/decision/index.d.ts.map +1 -1
  25. package/build/types/dimmer/Dimmer.d.ts +1 -1
  26. package/build/types/index.d.ts +2 -0
  27. package/build/types/index.d.ts.map +1 -1
  28. package/build/types/promoCard/PromoCard.d.ts +1 -2
  29. package/build/types/promoCard/PromoCard.d.ts.map +1 -1
  30. package/build/types/select/searchBox/SearchBox.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/src/card/Card.js +0 -3
  33. package/src/card/Card.story.js +2 -17
  34. package/src/common/Option/Option.spec.js +0 -7
  35. package/src/common/Option/Option.tsx +2 -9
  36. package/src/common/commonProps.ts +1 -1
  37. package/src/dateInput/index.ts +2 -3
  38. package/src/dateLookup/DateLookup.js +12 -1
  39. package/src/dateLookup/DateLookup.testingLibrary.spec.js +12 -1
  40. package/src/decision/Decision.css +6 -82
  41. package/src/decision/Decision.less +3 -41
  42. package/src/decision/Decision.spec.js +56 -61
  43. package/src/decision/{Decision.story.js → Decision.story.tsx} +5 -5
  44. package/src/decision/Decision.tsx +133 -0
  45. package/src/decision/index.ts +1 -0
  46. package/src/index.ts +2 -0
  47. package/src/main.css +6 -82
  48. package/src/promoCard/PromoCard.tsx +1 -2
  49. package/src/tile/Tile.js +1 -1
  50. package/build/types/decision/decisionEnums.d.ts +0 -9
  51. package/build/types/decision/decisionEnums.d.ts.map +0 -1
  52. package/build/types/sizeSwapper/SizeSwapper.d.ts +0 -3
  53. package/build/types/sizeSwapper/SizeSwapper.d.ts.map +0 -1
  54. package/build/types/sizeSwapper/index.d.ts +0 -2
  55. package/build/types/sizeSwapper/index.d.ts.map +0 -1
  56. package/src/decision/Decision.js +0 -148
  57. package/src/decision/decisionEnums.ts +0 -11
  58. package/src/decision/index.js +0 -2
  59. package/src/sizeSwapper/SizeSwapper.js +0 -69
  60. package/src/sizeSwapper/SizeSwapper.spec.js +0 -100
  61. package/src/sizeSwapper/SizeSwapper.story.js +0 -34
  62. package/src/sizeSwapper/index.js +0 -1
package/build/index.js CHANGED
@@ -549,108 +549,8 @@ const Chevron = ({
549
549
  });
550
550
  };
551
551
 
552
- // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
553
- exports.AvatarType = void 0;
554
- (function (AvatarType) {
555
- AvatarType["THUMBNAIL"] = "thumbnail";
556
- AvatarType["ICON"] = "icon";
557
- AvatarType["EMOJI"] = "emoji";
558
- AvatarType["INITIALS"] = "initials";
559
- })(exports.AvatarType || (exports.AvatarType = {}));
560
-
561
- /*
562
- * The colors we support generating an Avatar background color from a "seed" for.
563
- * Changing this array will change the assignment between seeds.
564
- * Do not change this array.
565
- */
566
- const avatarColors = ['--color-bright-blue', '--color-bright-yellow', '--color-bright-pink', '--color-bright-orange'];
567
- /*
568
- * Takes in a "seed" string and spits out an index for the color we should use.
569
- * This implementation has been synced across all three clients so that we consistently
570
- * generate branded avatar colors when rendering a list of Avatars.
571
- * Do not change this implementation.
572
- */
573
- const hashSeed = seed => {
574
- const base = 31;
575
- const modulo = avatarColors.length;
576
- let hashValue = 0;
577
- let basePow = 1;
578
- for (let i = 0; i < seed.length; i++) {
579
- hashValue = (hashValue + seed.charCodeAt(i) * basePow) % modulo;
580
- basePow = basePow * base % modulo;
581
- }
582
- return hashValue;
583
- };
584
- const getAvatarColorFromSeed = seed => {
585
- return avatarColors[hashSeed(seed)];
586
- };
587
-
588
- const backwardsCompatibleSize = size => {
589
- switch (size) {
590
- case 'sm':
591
- return 24;
592
- case 'md':
593
- return 48;
594
- case 'lg':
595
- return 72;
596
- default:
597
- return size;
598
- }
599
- };
600
- const Avatar = ({
601
- backgroundColor = null,
602
- backgroundColorSeed = null,
603
- children = null,
604
- className,
605
- outlined = false,
606
- size: sizeFromProps = 48,
607
- theme = exports.Theme.LIGHT,
608
- type = 'thumbnail'
609
- }) => {
610
- const backgroundColorFromSeed = React.useMemo(() => !backgroundColor && backgroundColorSeed ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})` : undefined, [backgroundColor, backgroundColorSeed]);
611
- const size = backwardsCompatibleSize(sizeFromProps);
612
- return /*#__PURE__*/jsxRuntime.jsx("div", {
613
- className: classNames__default.default('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
614
- 'tw-avatar--outlined': outlined,
615
- 'tw-avatar--branded': Boolean(backgroundColorFromSeed),
616
- 'np-text-title-body': type === 'initials'
617
- }),
618
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
619
- className: "tw-avatar__content",
620
- style: {
621
- backgroundColor: backgroundColor || backgroundColorFromSeed
622
- },
623
- children: children
624
- })
625
- });
626
- };
627
-
628
- const Badge = ({
629
- badge,
630
- className = undefined,
631
- size = exports.Size.SMALL,
632
- border = exports.Theme.LIGHT,
633
- children
634
- }) => {
635
- const classes = classNames__default.default('tw-badge', {
636
- [`tw-badge-border-${border}`]: border,
637
- [`tw-badge-${size}`]: size
638
- }, className);
639
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
640
- className: classes,
641
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
642
- className: "tw-badge__children",
643
- children: children
644
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
645
- className: "tw-badge__content",
646
- children: badge
647
- })]
648
- });
649
- };
650
-
651
552
  const Option$2 = /*#__PURE__*/React.forwardRef(({
652
553
  media = '',
653
- badgeContentIcon = '',
654
554
  title,
655
555
  content,
656
556
  as: component,
@@ -681,13 +581,7 @@ const Option$2 = /*#__PURE__*/React.forwardRef(({
681
581
  className: "media",
682
582
  children: [media && /*#__PURE__*/jsxRuntime.jsx("div", {
683
583
  className: "media-left",
684
- children: badgeContentIcon ? /*#__PURE__*/jsxRuntime.jsx(Badge, {
685
- badge: badgeContentIcon,
686
- children: /*#__PURE__*/jsxRuntime.jsx(Avatar, {
687
- type: "icon",
688
- children: media
689
- })
690
- }) : showMediaCircle ? /*#__PURE__*/jsxRuntime.jsx("div", {
584
+ children: showMediaCircle ? /*#__PURE__*/jsxRuntime.jsx("div", {
691
585
  className: classNames__default.default('circle circle-sm text-primary', {
692
586
  'circle-inverse': inverseMediaCircle
693
587
  }),
@@ -1355,6 +1249,105 @@ Alert.defaultProps = {
1355
1249
  };
1356
1250
  var Alert$1 = Alert;
1357
1251
 
1252
+ // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
1253
+ exports.AvatarType = void 0;
1254
+ (function (AvatarType) {
1255
+ AvatarType["THUMBNAIL"] = "thumbnail";
1256
+ AvatarType["ICON"] = "icon";
1257
+ AvatarType["EMOJI"] = "emoji";
1258
+ AvatarType["INITIALS"] = "initials";
1259
+ })(exports.AvatarType || (exports.AvatarType = {}));
1260
+
1261
+ /*
1262
+ * The colors we support generating an Avatar background color from a "seed" for.
1263
+ * Changing this array will change the assignment between seeds.
1264
+ * Do not change this array.
1265
+ */
1266
+ const avatarColors = ['--color-bright-blue', '--color-bright-yellow', '--color-bright-pink', '--color-bright-orange'];
1267
+ /*
1268
+ * Takes in a "seed" string and spits out an index for the color we should use.
1269
+ * This implementation has been synced across all three clients so that we consistently
1270
+ * generate branded avatar colors when rendering a list of Avatars.
1271
+ * Do not change this implementation.
1272
+ */
1273
+ const hashSeed = seed => {
1274
+ const base = 31;
1275
+ const modulo = avatarColors.length;
1276
+ let hashValue = 0;
1277
+ let basePow = 1;
1278
+ for (let i = 0; i < seed.length; i++) {
1279
+ hashValue = (hashValue + seed.charCodeAt(i) * basePow) % modulo;
1280
+ basePow = basePow * base % modulo;
1281
+ }
1282
+ return hashValue;
1283
+ };
1284
+ const getAvatarColorFromSeed = seed => {
1285
+ return avatarColors[hashSeed(seed)];
1286
+ };
1287
+
1288
+ const backwardsCompatibleSize = size => {
1289
+ switch (size) {
1290
+ case 'sm':
1291
+ return 24;
1292
+ case 'md':
1293
+ return 48;
1294
+ case 'lg':
1295
+ return 72;
1296
+ default:
1297
+ return size;
1298
+ }
1299
+ };
1300
+ const Avatar = ({
1301
+ backgroundColor = null,
1302
+ backgroundColorSeed = null,
1303
+ children = null,
1304
+ className,
1305
+ outlined = false,
1306
+ size: sizeFromProps = 48,
1307
+ theme = exports.Theme.LIGHT,
1308
+ type = 'thumbnail'
1309
+ }) => {
1310
+ const backgroundColorFromSeed = React.useMemo(() => !backgroundColor && backgroundColorSeed ? `var(${getAvatarColorFromSeed(backgroundColorSeed)})` : undefined, [backgroundColor, backgroundColorSeed]);
1311
+ const size = backwardsCompatibleSize(sizeFromProps);
1312
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
1313
+ className: classNames__default.default('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
1314
+ 'tw-avatar--outlined': outlined,
1315
+ 'tw-avatar--branded': Boolean(backgroundColorFromSeed),
1316
+ 'np-text-title-body': type === 'initials'
1317
+ }),
1318
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
1319
+ className: "tw-avatar__content",
1320
+ style: {
1321
+ backgroundColor: backgroundColor || backgroundColorFromSeed
1322
+ },
1323
+ children: children
1324
+ })
1325
+ });
1326
+ };
1327
+
1328
+ const Badge = ({
1329
+ badge,
1330
+ className = undefined,
1331
+ size = exports.Size.SMALL,
1332
+ border = exports.Theme.LIGHT,
1333
+ children
1334
+ }) => {
1335
+ const classes = classNames__default.default('tw-badge', {
1336
+ [`tw-badge-border-${border}`]: border,
1337
+ [`tw-badge-${size}`]: size
1338
+ }, className);
1339
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
1340
+ className: classes,
1341
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1342
+ className: "tw-badge__children",
1343
+ children: children
1344
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
1345
+ className: "tw-badge__content",
1346
+ children: badge
1347
+ })]
1348
+ });
1349
+ };
1350
+
1358
1351
  const OptionalBadge = ({
1359
1352
  url,
1360
1353
  altText,
@@ -2399,7 +2392,6 @@ const Card$1 = /*#__PURE__*/React.forwardRef((props, reference) => {
2399
2392
  children,
2400
2393
  onClick,
2401
2394
  icon,
2402
- badgeContentIcon,
2403
2395
  id,
2404
2396
  className,
2405
2397
  ...rest
@@ -2419,7 +2411,6 @@ const Card$1 = /*#__PURE__*/React.forwardRef((props, reference) => {
2419
2411
  as: children ? 'button' : 'div',
2420
2412
  className: classNames__default.default('np-card__button'),
2421
2413
  media: icon,
2422
- badgeContentIcon: badgeContentIcon,
2423
2414
  title: title,
2424
2415
  content: details,
2425
2416
  showMediaAtAllSizes: true,
@@ -2450,7 +2441,6 @@ Card$1.propTypes = {
2450
2441
  details: PropTypes__default.default.node.isRequired,
2451
2442
  onClick: requiredIf__default.default(PropTypes__default.default.func, hasChildren),
2452
2443
  icon: PropTypes__default.default.node,
2453
- badgeContentIcon: PropTypes__default.default.node,
2454
2444
  children: PropTypes__default.default.node,
2455
2445
  id: PropTypes__default.default.string,
2456
2446
  className: PropTypes__default.default.string,
@@ -4310,6 +4300,7 @@ class DateLookup extends React.PureComponent {
4310
4300
  size,
4311
4301
  placeholder,
4312
4302
  label,
4303
+ 'aria-labelledby': ariaLabelledBy,
4313
4304
  monthFormat,
4314
4305
  disabled,
4315
4306
  clearable,
@@ -4318,6 +4309,7 @@ class DateLookup extends React.PureComponent {
4318
4309
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
4319
4310
  // eslint-disable-line jsx-a11y/no-static-element-interactions
4320
4311
  ref: this.element,
4312
+ "aria-labelledby": ariaLabelledBy,
4321
4313
  className: "input-group",
4322
4314
  onKeyDown: this.handleKeyDown,
4323
4315
  children: [/*#__PURE__*/jsxRuntime.jsx(DateTrigger$1, {
@@ -4347,6 +4339,7 @@ DateLookup.propTypes = {
4347
4339
  size: PropTypes__default.default.oneOf(['sm', 'md', 'lg']),
4348
4340
  placeholder: PropTypes__default.default.string,
4349
4341
  label: PropTypes__default.default.string,
4342
+ 'aria-labelledby': PropTypes__default.default.string,
4350
4343
  monthFormat: PropTypes__default.default.oneOf(['long', 'short']),
4351
4344
  disabled: PropTypes__default.default.bool,
4352
4345
  onChange: PropTypes__default.default.func.isRequired,
@@ -4369,19 +4362,6 @@ DateLookup.defaultProps = {
4369
4362
  };
4370
4363
  var DateLookup$1 = DateLookup;
4371
4364
 
4372
- // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
4373
- exports.DecisionPresentation = void 0;
4374
- (function (Presentation) {
4375
- Presentation["LIST"] = "LIST";
4376
- Presentation["LIST_BLOCK"] = "LIST_BLOCK";
4377
- Presentation["LIST_BLOCK_GRID"] = "LIST_BLOCK_GRID";
4378
- })(exports.DecisionPresentation || (exports.DecisionPresentation = {}));
4379
- // TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
4380
- exports.DecisionType = void 0;
4381
- (function (Type) {
4382
- Type["NAVIGATION"] = "NAVIGATION";
4383
- })(exports.DecisionType || (exports.DecisionType = {}));
4384
-
4385
4365
  const NavigationOption = /*#__PURE__*/React.forwardRef(({
4386
4366
  as: component = 'button',
4387
4367
  disabled = false,
@@ -4415,70 +4395,6 @@ const NavigationOption = /*#__PURE__*/React.forwardRef(({
4415
4395
  });
4416
4396
  });
4417
4397
 
4418
- const Layout = {
4419
- COLUMN: 'COLUMN'
4420
- };
4421
- const SizeSwapper = /*#__PURE__*/React.forwardRef(({
4422
- items,
4423
- inline
4424
- }, reference) => {
4425
- const parentReference = React.useRef(null);
4426
- const [clientWidth] = useClientWidth({
4427
- ref: reference || parentReference
4428
- });
4429
- if (!items || items.length === 0) {
4430
- return null;
4431
- }
4432
- // If all breakpoints are specified and clientWidth never > breakpoint itemsToRender can be undefined.
4433
- // Do not use deconstruct here to get items and layout.
4434
- let itemsToRender = [];
4435
- if (clientWidth) {
4436
- itemsToRender = items.filter(({
4437
- breakpoint = 0
4438
- }) => clientWidth >= breakpoint).pop();
4439
- } else {
4440
- // On SSR environments useClientWidth returns null because ref is undefined so we render
4441
- // all elements by default.
4442
- // If there's no SSR and on first Hydration only the right elements are going to be rendered.
4443
- // If clientWidth is null or zero all elements render like a responsive technique would do.
4444
- itemsToRender.items = items.map(({
4445
- items
4446
- }) => Object.values(items));
4447
- }
4448
-
4449
- // Always return parent container even if there are no items to display to
4450
- // keep the ref on DOM and let clientWidth be calculated properly.
4451
- return /*#__PURE__*/jsxRuntime.jsx("div", {
4452
- ref: parentReference,
4453
- className: classNames__default.default('np-size-swapper', {
4454
- 'd-flex': !inline,
4455
- 'd-inline-flex': inline,
4456
- 'flex-column': itemsToRender && itemsToRender.layout === Layout.COLUMN,
4457
- 'flex-wrap': itemsToRender && itemsToRender.wrap
4458
- }),
4459
- style: {
4460
- visibility: clientWidth ? 'visible' : 'hidden'
4461
- },
4462
- children: itemsToRender && itemsToRender.items
4463
- });
4464
- });
4465
- SizeSwapper.Breakpoint = exports.Breakpoint;
4466
- SizeSwapper.Layout = Layout;
4467
- SizeSwapper.propTypes = {
4468
- inline: PropTypes__default.default.bool,
4469
- /** List of items that will appear at the specified breakpoint and presented in row or columns depending on layout */
4470
- items: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
4471
- items: PropTypes__default.default.arrayOf(PropTypes__default.default.element),
4472
- breakpoint: PropTypes__default.default.number,
4473
- layout: PropTypes__default.default.oneOf([SizeSwapper.Layout.COLUMN]),
4474
- wrap: PropTypes__default.default.bool
4475
- })).isRequired
4476
- };
4477
- SizeSwapper.defaultProps = {
4478
- inline: false
4479
- };
4480
- var SizeSwapper$1 = SizeSwapper;
4481
-
4482
4398
  const Tile = ({
4483
4399
  className,
4484
4400
  description,
@@ -4527,7 +4443,7 @@ Tile.propTypes = {
4527
4443
  className: PropTypes__default.default.string,
4528
4444
  description: PropTypes__default.default.node,
4529
4445
  disabled: PropTypes__default.default.bool,
4530
- href: PropTypes__default.default.string.isRequired,
4446
+ href: PropTypes__default.default.string,
4531
4447
  target: PropTypes__default.default.oneOf(['_self', '_blank', '_parent', '_top']),
4532
4448
  /** Accepts only Avatar and images */
4533
4449
  media: PropTypes__default.default.node.isRequired,
@@ -4546,85 +4462,28 @@ Tile.defaultProps = {
4546
4462
  };
4547
4463
  var Tile$1 = Tile;
4548
4464
 
4465
+ exports.DecisionPresentation = void 0;
4466
+ (function (DecisionPresentation) {
4467
+ DecisionPresentation["LIST"] = "LIST";
4468
+ DecisionPresentation["LIST_BLOCK"] = "LIST_BLOCK";
4469
+ DecisionPresentation["LIST_BLOCK_GRID"] = "LIST_BLOCK_GRID";
4470
+ })(exports.DecisionPresentation || (exports.DecisionPresentation = {}));
4471
+ exports.DecisionType = void 0;
4472
+ (function (DecisionType) {
4473
+ DecisionType["NAVIGATION"] = "NAVIGATION";
4474
+ })(exports.DecisionType || (exports.DecisionType = {}));
4549
4475
  const Decision = ({
4550
4476
  options,
4551
- presentation,
4552
- type,
4553
- showMediaCircleInList,
4554
- isContainerAligned,
4555
- size
4477
+ presentation = exports.DecisionPresentation.LIST,
4478
+ size = exports.Size.MEDIUM,
4479
+ type = exports.DecisionType.NAVIGATION,
4480
+ showMediaCircleInList = true,
4481
+ isContainerAligned = false
4556
4482
  }) => {
4483
+ const screenXs = useScreenSize(exports.Breakpoint.EXTRA_SMALL);
4484
+ const screenSm = useScreenSize(exports.Breakpoint.SMALL);
4557
4485
  if (type === exports.DecisionType.NAVIGATION) {
4558
- const {
4559
- LIST_BLOCK,
4560
- LIST_BLOCK_GRID
4561
- } = exports.DecisionPresentation;
4562
- if (presentation === LIST_BLOCK || presentation === LIST_BLOCK_GRID) {
4563
- const isSmall = size === exports.Size.SMALL;
4564
- const isGrid = presentation === LIST_BLOCK_GRID;
4565
- const items = [{
4566
- items: [],
4567
- layout: SizeSwapper$1.Layout.COLUMN
4568
- }, {
4569
- items: [],
4570
- breakpoint: isSmall ? exports.Breakpoint.EXTRA_SMALL : exports.Breakpoint.SMALL,
4571
- wrap: isGrid
4572
- }];
4573
- options.forEach(({
4574
- description,
4575
- disabled,
4576
- href,
4577
- target,
4578
- media: {
4579
- block,
4580
- list
4581
- },
4582
- onClick,
4583
- title
4584
- }, key) => {
4585
- items[0].items.push( /*#__PURE__*/jsxRuntime.jsx(NavigationOption
4586
- // eslint-disable-next-line react/no-array-index-key
4587
- , {
4588
- complex: false,
4589
- content: description,
4590
- disabled: disabled,
4591
- href: href,
4592
- target: target,
4593
- media: list,
4594
- showMediaAtAllSizes: true,
4595
- showMediaCircle: showMediaCircleInList,
4596
- isContainerAligned: isContainerAligned,
4597
- title: title,
4598
- onClick: onClick
4599
- }, `nav-${key}`));
4600
- items[1].items.push( /*#__PURE__*/jsxRuntime.jsx(Tile$1
4601
- // eslint-disable-next-line react/no-array-index-key
4602
- , {
4603
- className: classNames__default.default(`np-decision__tile${isSmall ? '--small' : ''}`, {
4604
- 'np-decision__tile--fixed-width': isGrid
4605
- }),
4606
- description: description,
4607
- disabled: disabled,
4608
- href: href,
4609
- target: target,
4610
- media: block,
4611
- size: isSmall ? exports.Size.SMALL : exports.Size.MEDIUM,
4612
- title: title,
4613
- onClick: onClick
4614
- }, `tile-${key}`));
4615
- });
4616
- return /*#__PURE__*/jsxRuntime.jsx("div", {
4617
- className: classNames__default.default('np-decision', {
4618
- 'np-decision--small': isSmall,
4619
- 'np-decision--grid': isGrid
4620
- }),
4621
- children: /*#__PURE__*/jsxRuntime.jsx(SizeSwapper$1, {
4622
- items: items
4623
- })
4624
- });
4625
- }
4626
- // LIST
4627
- return options.map(({
4486
+ const renderedOptions = options.map(({
4628
4487
  title,
4629
4488
  description,
4630
4489
  disabled,
@@ -4649,42 +4508,49 @@ const Decision = ({
4649
4508
  title: title,
4650
4509
  onClick: onClick
4651
4510
  }, `nav-${key}`));
4511
+ if (presentation === exports.DecisionPresentation.LIST_BLOCK || presentation === exports.DecisionPresentation.LIST_BLOCK_GRID) {
4512
+ const isSmall = size === exports.Size.SMALL;
4513
+ const breakpoint = isSmall ? screenXs : screenSm;
4514
+ const isGrid = presentation === exports.DecisionPresentation.LIST_BLOCK_GRID;
4515
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
4516
+ className: classNames__default.default('np-decision d-flex', {
4517
+ 'np-decision--small': isSmall,
4518
+ 'np-decision--grid': isGrid
4519
+ }, breakpoint ? isGrid && 'flex-wrap' : 'flex-column'),
4520
+ children: breakpoint ? options.map(({
4521
+ description,
4522
+ disabled,
4523
+ href,
4524
+ target,
4525
+ media: {
4526
+ block
4527
+ },
4528
+ onClick,
4529
+ title
4530
+ }, key) => /*#__PURE__*/jsxRuntime.jsx(Tile$1
4531
+ // eslint-disable-next-line react/no-array-index-key
4532
+ , {
4533
+ className: classNames__default.default(`np-decision__tile${isSmall ? '--small' : ''}`, {
4534
+ 'np-decision__tile--fixed-width': isGrid
4535
+ }),
4536
+ description: description,
4537
+ disabled: disabled,
4538
+ href: href,
4539
+ target: target,
4540
+ media: block,
4541
+ size: isSmall ? exports.Size.SMALL : exports.Size.MEDIUM,
4542
+ title: title,
4543
+ onClick: onClick
4544
+ }, `tile-${key}`)) : renderedOptions
4545
+ });
4546
+ }
4547
+ // LIST
4548
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
4549
+ children: renderedOptions
4550
+ });
4652
4551
  }
4653
- return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
4654
- };
4655
- Decision.propTypes = {
4656
- /** A list of elements to be rendered */
4657
- options: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
4658
- description: PropTypes__default.default.node,
4659
- disabled: PropTypes__default.default.bool,
4660
- href: PropTypes__default.default.string,
4661
- target: PropTypes__default.default.oneOf(['_self', '_blank', '_parent', '_top']),
4662
- media: PropTypes__default.default.shape({
4663
- block: PropTypes__default.default.node.isRequired,
4664
- list: PropTypes__default.default.node.isRequired
4665
- }),
4666
- onClick: PropTypes__default.default.func,
4667
- title: PropTypes__default.default.node.isRequired
4668
- })).isRequired,
4669
- /** Handles the display mode of the component */
4670
- presentation: PropTypes__default.default.oneOf(['LIST', 'LIST_BLOCK', 'LIST_BLOCK_GRID']),
4671
- /** Size currently affects only Tile dimension */
4672
- size: PropTypes__default.default.oneOf(['sm', 'md']),
4673
- /** Decide which kind of element type needs to be rendered ex: Navigation Options or in the future Radio or Checkbox Options */
4674
- type: PropTypes__default.default.oneOf(['NAVIGATION']),
4675
- /** Display media in a circle in list presentation */
4676
- showMediaCircleInList: PropTypes__default.default.bool,
4677
- /** Sets navigation options to be aligned with the parent container */
4678
- isContainerAligned: PropTypes__default.default.bool
4679
- };
4680
- Decision.defaultProps = {
4681
- presentation: exports.DecisionPresentation.LIST,
4682
- size: exports.Size.MEDIUM,
4683
- type: exports.DecisionType.NAVIGATION,
4684
- showMediaCircleInList: true,
4685
- isContainerAligned: false
4552
+ return null;
4686
4553
  };
4687
- var Decision$1 = Decision;
4688
4554
 
4689
4555
  const isLayoutHorizontal = layout => [exports.Layout.HORIZONTAL_LEFT_ALIGNED, exports.Layout.HORIZONTAL_RIGHT_ALIGNED, exports.Layout.HORIZONTAL_JUSTIFIED].includes(layout);
4690
4556
  const getAlignmentClasses = (layout, action) => {
@@ -15448,7 +15314,7 @@ exports.DEFAULT_LANG = DEFAULT_LANG;
15448
15314
  exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
15449
15315
  exports.DateInput = DateInput;
15450
15316
  exports.DateLookup = DateLookup$1;
15451
- exports.Decision = Decision$1;
15317
+ exports.Decision = Decision;
15452
15318
  exports.DefinitionList = DefinitionList$1;
15453
15319
  exports.Dimmer = Dimmer$1;
15454
15320
  exports.DirectionProvider = DirectionProvider;