@obolnetwork/obol-ui 1.0.15 → 1.0.16

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.
@@ -9,8 +9,8 @@ export declare type CellDef = {
9
9
  component: "TextField" | "NumberField";
10
10
  config?: {
11
11
  type: "text" | "number";
12
- max: number;
13
- min: number;
12
+ max?: number;
13
+ min?: number;
14
14
  };
15
15
  };
16
16
  export declare type ColumnDef<T> = {
package/dist/index.es.js CHANGED
@@ -1870,6 +1870,20 @@ var Td = styled("td", {
1870
1870
  },
1871
1871
  },
1872
1872
  });
1873
+ var Th = styled("th", {
1874
+ border: "2px solid $bg04",
1875
+ py: "$sm",
1876
+ px: "$sm",
1877
+ textAlign: "center",
1878
+ color: "$body",
1879
+ fontWeight: "$bold",
1880
+ fontSize: "$4",
1881
+ "& input": {
1882
+ border: "none",
1883
+ borderRadius: 0,
1884
+ width: "100%",
1885
+ },
1886
+ });
1873
1887
  var Tr = styled("tr", {});
1874
1888
  var BoxBorderTop = styled(Box, {
1875
1889
  borderTop: "2px solid $bg04",
@@ -1889,7 +1903,7 @@ var AddNewRow = function (props) {
1889
1903
  // Components
1890
1904
  var SplitterTable = function (_a) {
1891
1905
  var rows = _a.rows, columns = _a.columns, onAddRow = _a.onAddRow, onRemoveRow = _a.onRemoveRow, onUpdateRow = _a.onUpdateRow, _b = _a.removeButton, removeButton = _b === void 0 ? true : _b;
1892
- return (jsxs(StyledTable, { children: [jsxs("thead", { children: [jsx(Td, {}), columns.map(function (column, index) { return (jsx(Td, __assign({ css: { textAlign: "start" } }, { children: column.header }), "header-".concat(index))); }), jsx(Td, {})] }), jsxs("tbody", { children: [rows.map(function (row, rowIndex) { return (jsxs("tr", { children: [jsx(Td, __assign({ size: "sm" }, { children: rowIndex + 1 })), columns.map(function (column, cellIndex) {
1906
+ return (jsxs(StyledTable, { children: [jsx("thead", { children: jsxs("tr", { children: [jsx(Th, {}), columns.map(function (column, index) { return (jsx(Th, __assign({ css: { textAlign: "start" } }, { children: column.header }), "header-".concat(index))); }), jsx(Th, {})] }) }), jsxs("tbody", { children: [rows.map(function (row, rowIndex) { return (jsxs("tr", { children: [jsx(Td, __assign({ size: "sm" }, { children: rowIndex + 1 })), columns.map(function (column, cellIndex) {
1893
1907
  var _a;
1894
1908
  var isTextField = !!column.cell;
1895
1909
  return (jsx(Td, __assign({ noPadding: true, css: {
@@ -1902,8 +1916,13 @@ var SplitterTable = function (_a) {
1902
1916
  "-moz-appearance": "textfield",
1903
1917
  },
1904
1918
  } }, { children: isTextField ? (jsx(TextField, __assign({ defaultValue: row[column.accessorKey], onInput: function (e) {
1905
- if (Number(e.target.value) > 100)
1906
- e.target.value = 100;
1919
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1920
+ if (((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number") {
1921
+ if ((_d = (_c = column.cell) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.max) {
1922
+ if (Number(e.target.value) > ((_f = (_e = column.cell) === null || _e === void 0 ? void 0 : _e.config) === null || _f === void 0 ? void 0 : _f.max))
1923
+ e.target.value = (_h = (_g = column.cell) === null || _g === void 0 ? void 0 : _g.config) === null || _h === void 0 ? void 0 : _h.max;
1924
+ }
1925
+ }
1907
1926
  }, onChange: function (e) {
1908
1927
  var _a, _b;
1909
1928
  var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
package/dist/index.js CHANGED
@@ -1901,6 +1901,20 @@ var Td = styled("td", {
1901
1901
  },
1902
1902
  },
1903
1903
  });
1904
+ var Th = styled("th", {
1905
+ border: "2px solid $bg04",
1906
+ py: "$sm",
1907
+ px: "$sm",
1908
+ textAlign: "center",
1909
+ color: "$body",
1910
+ fontWeight: "$bold",
1911
+ fontSize: "$4",
1912
+ "& input": {
1913
+ border: "none",
1914
+ borderRadius: 0,
1915
+ width: "100%",
1916
+ },
1917
+ });
1904
1918
  var Tr = styled("tr", {});
1905
1919
  var BoxBorderTop = styled(Box, {
1906
1920
  borderTop: "2px solid $bg04",
@@ -1920,7 +1934,7 @@ var AddNewRow = function (props) {
1920
1934
  // Components
1921
1935
  var SplitterTable = function (_a) {
1922
1936
  var rows = _a.rows, columns = _a.columns, onAddRow = _a.onAddRow, onRemoveRow = _a.onRemoveRow, onUpdateRow = _a.onUpdateRow, _b = _a.removeButton, removeButton = _b === void 0 ? true : _b;
1923
- return (jsxRuntime.jsxs(StyledTable, { children: [jsxRuntime.jsxs("thead", { children: [jsxRuntime.jsx(Td, {}), columns.map(function (column, index) { return (jsxRuntime.jsx(Td, __assign({ css: { textAlign: "start" } }, { children: column.header }), "header-".concat(index))); }), jsxRuntime.jsx(Td, {})] }), jsxRuntime.jsxs("tbody", { children: [rows.map(function (row, rowIndex) { return (jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx(Td, __assign({ size: "sm" }, { children: rowIndex + 1 })), columns.map(function (column, cellIndex) {
1937
+ return (jsxRuntime.jsxs(StyledTable, { children: [jsxRuntime.jsx("thead", { children: jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx(Th, {}), columns.map(function (column, index) { return (jsxRuntime.jsx(Th, __assign({ css: { textAlign: "start" } }, { children: column.header }), "header-".concat(index))); }), jsxRuntime.jsx(Th, {})] }) }), jsxRuntime.jsxs("tbody", { children: [rows.map(function (row, rowIndex) { return (jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx(Td, __assign({ size: "sm" }, { children: rowIndex + 1 })), columns.map(function (column, cellIndex) {
1924
1938
  var _a;
1925
1939
  var isTextField = !!column.cell;
1926
1940
  return (jsxRuntime.jsx(Td, __assign({ noPadding: true, css: {
@@ -1933,8 +1947,13 @@ var SplitterTable = function (_a) {
1933
1947
  "-moz-appearance": "textfield",
1934
1948
  },
1935
1949
  } }, { children: isTextField ? (jsxRuntime.jsx(TextField, __assign({ defaultValue: row[column.accessorKey], onInput: function (e) {
1936
- if (Number(e.target.value) > 100)
1937
- e.target.value = 100;
1950
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1951
+ if (((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number") {
1952
+ if ((_d = (_c = column.cell) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.max) {
1953
+ if (Number(e.target.value) > ((_f = (_e = column.cell) === null || _e === void 0 ? void 0 : _e.config) === null || _f === void 0 ? void 0 : _f.max))
1954
+ e.target.value = (_h = (_g = column.cell) === null || _g === void 0 ? void 0 : _g.config) === null || _h === void 0 ? void 0 : _h.max;
1955
+ }
1956
+ }
1938
1957
  }, onChange: function (e) {
1939
1958
  var _a, _b;
1940
1959
  var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-ui",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "license": "MIT",