@razorpay/blade 12.95.4 → 12.96.0

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 (22) hide show
  1. package/build/lib/web/development/_virtual/cloneDeep.js +1 -1
  2. package/build/lib/web/development/_virtual/cloneDeep3.js +1 -1
  3. package/build/lib/web/development/_virtual/flatten.js +1 -1
  4. package/build/lib/web/development/_virtual/flatten3.js +1 -1
  5. package/build/lib/web/development/components/GenUI/GenUIComponents.web.js +40 -71
  6. package/build/lib/web/development/components/GenUI/GenUIComponents.web.js.map +1 -1
  7. package/build/lib/web/development/components/GenUI/GenUISchemaRenderer.web.js +26 -6
  8. package/build/lib/web/development/components/GenUI/GenUISchemaRenderer.web.js.map +1 -1
  9. package/build/lib/web/development/node_modules/es-toolkit/dist/array/flatten.js +1 -1
  10. package/build/lib/web/development/node_modules/es-toolkit/dist/compat/array/flatten.js +1 -1
  11. package/build/lib/web/development/node_modules/es-toolkit/dist/compat/array/sortBy.js +2 -2
  12. package/build/lib/web/development/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -1
  13. package/build/lib/web/development/node_modules/es-toolkit/dist/compat/object/omit.js +2 -2
  14. package/build/lib/web/development/node_modules/es-toolkit/dist/compat/predicate/matches.js +2 -2
  15. package/build/lib/web/development/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js +2 -2
  16. package/build/lib/web/development/node_modules/es-toolkit/dist/object/cloneDeep.js +1 -1
  17. package/build/lib/web/production/components/GenUI/GenUIComponents.web.js +40 -71
  18. package/build/lib/web/production/components/GenUI/GenUIComponents.web.js.map +1 -1
  19. package/build/lib/web/production/components/GenUI/GenUISchemaRenderer.web.js +26 -6
  20. package/build/lib/web/production/components/GenUI/GenUISchemaRenderer.web.js.map +1 -1
  21. package/build/types/components/index.d.ts +5 -4
  22. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import '../node_modules/es-toolkit/dist/compat/object/cloneDeep.js';
1
+ import '../node_modules/es-toolkit/dist/object/cloneDeep.js';
2
2
  //# sourceMappingURL=cloneDeep.js.map
@@ -1,2 +1,2 @@
1
- import '../node_modules/es-toolkit/dist/object/cloneDeep.js';
1
+ import '../node_modules/es-toolkit/dist/compat/object/cloneDeep.js';
2
2
  //# sourceMappingURL=cloneDeep3.js.map
@@ -1,2 +1,2 @@
1
- import '../node_modules/es-toolkit/dist/compat/array/flatten.js';
1
+ import '../node_modules/es-toolkit/dist/array/flatten.js';
2
2
  //# sourceMappingURL=flatten.js.map
@@ -1,2 +1,2 @@
1
- import '../node_modules/es-toolkit/dist/array/flatten.js';
1
+ import '../node_modules/es-toolkit/dist/compat/array/flatten.js';
2
2
  //# sourceMappingURL=flatten3.js.map
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
2
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
3
  import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
5
4
  import { memo, useMemo, useState } from 'react';
@@ -805,62 +804,12 @@ var TableRowHoverActions = function TableRowHoverActions(_ref17) {
805
804
  });
806
805
  };
807
806
 
808
- // px per average character at ~14px font size
809
- var CHAR_WIDTH = 7.5;
810
- // horizontal cell padding (left + right)
811
- var CELL_H_PADDING = 8;
812
-
813
- // Returns the minimum pixel width hint for a cell based on its content type.
814
- // Used as the `min` track in `minmax(min, max-content)` so columns never
815
- // collapse below a sensible floor while still growing to fit real content.
816
- var getCellMinWidth = function getCellMinWidth(cell) {
817
- var _cell$value$length, _cell$value2, _cell$value$toString, _cell$value3, _cell$value$length2, _cell$value4, _cell$value$length3, _cell$value5, _cell$text$length, _cell$text2;
818
- if (!(cell !== null && cell !== void 0 && cell.component)) return 80;
819
- switch (cell.component) {
820
- case 'TEXT':
821
- return Math.max(80, Math.min(300, ((_cell$value$length = (_cell$value2 = cell.value) === null || _cell$value2 === void 0 ? void 0 : _cell$value2.length) !== null && _cell$value$length !== void 0 ? _cell$value$length : 1) * CHAR_WIDTH + CELL_H_PADDING));
822
- case 'AMOUNT':
823
- // currency symbol + digits + separators
824
- return Math.max(100, (String((_cell$value$toString = (_cell$value3 = cell.value) === null || _cell$value3 === void 0 ? void 0 : _cell$value3.toString()) !== null && _cell$value$toString !== void 0 ? _cell$value$toString : 0).length + 2) * CHAR_WIDTH + CELL_H_PADDING);
825
- case 'INDICATOR':
826
- return Math.max(100, ((_cell$value$length2 = (_cell$value4 = cell.value) === null || _cell$value4 === void 0 ? void 0 : _cell$value4.length) !== null && _cell$value$length2 !== void 0 ? _cell$value$length2 : 1) * CHAR_WIDTH);
827
- case 'BADGE':
828
- return Math.max(80, ((_cell$value$length3 = (_cell$value5 = cell.value) === null || _cell$value5 === void 0 ? void 0 : _cell$value5.length) !== null && _cell$value$length3 !== void 0 ? _cell$value$length3 : 1) * CHAR_WIDTH);
829
- case 'DATE':
830
- {
831
- var dateValue = dayjs(cell.value);
832
- if (!dateValue.isValid()) {
833
- var _cell$value$length4, _cell$value6;
834
- return ((_cell$value$length4 = (_cell$value6 = cell.value) === null || _cell$value6 === void 0 ? void 0 : _cell$value6.length) !== null && _cell$value$length4 !== void 0 ? _cell$value$length4 : 0) * CHAR_WIDTH;
835
- }
836
- var defaultFormat = 'DD MMM YYYY, HH:mm';
837
- var formatted = dateValue.format(cell.dateFormat || defaultFormat);
838
- return formatted.length * CHAR_WIDTH;
839
- }
840
- case 'LINK':
841
- return Math.max(80, Math.min(250, ((_cell$text$length = (_cell$text2 = cell.text) === null || _cell$text2 === void 0 ? void 0 : _cell$text2.length) !== null && _cell$text$length !== void 0 ? _cell$text$length : 1) * CHAR_WIDTH + CELL_H_PADDING));
842
- default:
843
- return 80;
844
- }
845
- };
846
-
847
- // Produces one CSS grid track per column as a `fr` value proportional to
848
- // the estimated content width so columns fill the full table width while
849
- // still reflecting relative content size (wider content → more space).
850
- var calculateColumnWidths = function calculateColumnWidths(headers, rows) {
851
- var weights = headers.map(function (header, colIndex) {
852
- var headerWeight = header.length * CHAR_WIDTH + CELL_H_PADDING;
853
- var cellWeight = rows.reduce(function (max, row) {
854
- var cell = row[colIndex];
855
- return Math.max(max, getCellMinWidth(cell));
856
- }, 80);
857
- return Math.max(headerWeight, cellWeight);
858
- });
859
-
860
- // Normalise to smallest weight so fr numbers stay small and readable
861
- var minWeight = Math.min.apply(Math, _toConsumableArray(weights));
862
- return weights.map(function (w) {
863
- return "".concat(Math.round(w / minWeight * 10) / 10, "fr");
807
+ // Produces column widths using minmax(max-content, 1fr) so columns:
808
+ // 1. Never shrink below their content width (no text wrapping)
809
+ // 2. Expand proportionally to fill available width when space permits
810
+ var calculateColumnWidths = function calculateColumnWidths(headers, _rows) {
811
+ return headers.map(function () {
812
+ return 'minmax(max-content, 1fr)';
864
813
  });
865
814
  };
866
815
  var RenderTableComponent = /*#__PURE__*/memo(function (_ref18) {
@@ -905,7 +854,10 @@ var RenderTableComponent = /*#__PURE__*/memo(function (_ref18) {
905
854
  }), /*#__PURE__*/jsx(TableBody, {
906
855
  children: data.map(function (item, rowIndex) {
907
856
  return /*#__PURE__*/jsx(TableRow, {
908
- item: item,
857
+ item: item
858
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
859
+ ,
860
+ onHover: rowActions && rowActions.length > 0 ? function () {} : undefined,
909
861
  hoverActions: rowActions && rowActions.length > 0 ? /*#__PURE__*/jsx(TableRowHoverActions, {
910
862
  rowActions: rowActions,
911
863
  rowIndex: rowIndex,
@@ -931,9 +883,7 @@ var RenderCardComponent = /*#__PURE__*/memo(function (_ref19) {
931
883
  description = _ref19.description,
932
884
  footer = _ref19.footer,
933
885
  children = _ref19.children;
934
- if (!title && !description) {
935
- return null;
936
- }
886
+ var hasHeader = title || description;
937
887
  return /*#__PURE__*/jsx(Box, {
938
888
  height: "100%",
939
889
  display: "flex",
@@ -943,13 +893,12 @@ var RenderCardComponent = /*#__PURE__*/memo(function (_ref19) {
943
893
  width: "100%",
944
894
  height: "100%",
945
895
  padding: "spacing.7",
946
- children: [/*#__PURE__*/jsx(CardHeader, {
947
- showDivider: false,
896
+ children: [hasHeader ? /*#__PURE__*/jsx(CardHeader, {
948
897
  children: /*#__PURE__*/jsx(CardHeaderLeading, {
949
898
  title: title || '',
950
899
  subtitle: description || ''
951
900
  })
952
- }), children && children.length > 0 ? /*#__PURE__*/jsx(CardBody, {
901
+ }) : null, children && children.length > 0 ? /*#__PURE__*/jsx(CardBody, {
953
902
  height: "100%",
954
903
  children: /*#__PURE__*/jsx(Box, {
955
904
  display: "flex",
@@ -1067,9 +1016,12 @@ var RenderInfoGroupComponent = /*#__PURE__*/memo(function (_ref25) {
1067
1016
  }
1068
1017
 
1069
1018
  // Filter out invalid items during streaming
1019
+ // Filters out: null, undefined, and empty string children
1070
1020
  var validItems = items.filter(function (item) {
1071
- var _item$key, _item$value;
1072
- return ((_item$key = item.key) === null || _item$key === void 0 ? void 0 : _item$key.children) && ((_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.children);
1021
+ var _item$value, _item$key;
1022
+ var children = (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.children;
1023
+ if (!((_item$key = item.key) !== null && _item$key !== void 0 && _item$key.children) || children == null) return false;
1024
+ return typeof children !== 'string' || children !== '';
1073
1025
  });
1074
1026
  if (validItems.length === 0) {
1075
1027
  return null;
@@ -1080,14 +1032,31 @@ var RenderInfoGroupComponent = /*#__PURE__*/memo(function (_ref25) {
1080
1032
  size: "medium",
1081
1033
  valueAlign: "left",
1082
1034
  children: validItems.map(function (item, index) {
1083
- var _item$key2, _item$key3, _item$value2, _item$value3;
1035
+ var _item$key4, _item$key5;
1036
+ var value = item.value;
1037
+ var isString = typeof value.children === 'string';
1038
+ if (isString) {
1039
+ var _item$key2, _item$key3;
1040
+ return /*#__PURE__*/jsxs(InfoItem, {
1041
+ children: [/*#__PURE__*/jsx(InfoItemKey, {
1042
+ helpText: item === null || item === void 0 || (_item$key2 = item.key) === null || _item$key2 === void 0 ? void 0 : _item$key2.helpText,
1043
+ children: item === null || item === void 0 || (_item$key3 = item.key) === null || _item$key3 === void 0 ? void 0 : _item$key3.children
1044
+ }), /*#__PURE__*/jsx(InfoItemValue, {
1045
+ helpText: value.helpText,
1046
+ children: value.children
1047
+ })]
1048
+ }, index);
1049
+ }
1084
1050
  return /*#__PURE__*/jsxs(InfoItem, {
1085
1051
  children: [/*#__PURE__*/jsx(InfoItemKey, {
1086
- helpText: item === null || item === void 0 || (_item$key2 = item.key) === null || _item$key2 === void 0 ? void 0 : _item$key2.helpText,
1087
- children: item === null || item === void 0 || (_item$key3 = item.key) === null || _item$key3 === void 0 ? void 0 : _item$key3.children
1052
+ helpText: item === null || item === void 0 || (_item$key4 = item.key) === null || _item$key4 === void 0 ? void 0 : _item$key4.helpText,
1053
+ children: item === null || item === void 0 || (_item$key5 = item.key) === null || _item$key5 === void 0 ? void 0 : _item$key5.children
1088
1054
  }), /*#__PURE__*/jsx(InfoItemValue, {
1089
- helpText: item === null || item === void 0 || (_item$value2 = item.value) === null || _item$value2 === void 0 ? void 0 : _item$value2.helpText,
1090
- children: item === null || item === void 0 || (_item$value3 = item.value) === null || _item$value3 === void 0 ? void 0 : _item$value3.children
1055
+ helpText: value.helpText,
1056
+ children: /*#__PURE__*/jsx(GenUIComponentRenderer, {
1057
+ component: value.children,
1058
+ index: index
1059
+ })
1091
1060
  })]
1092
1061
  }, index);
1093
1062
  })