@obolnetwork/obol-ui 1.0.19-0 → 1.0.20

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.
@@ -29,3 +29,4 @@ export * from "./static-icons/CheckIcon";
29
29
  export * from "./static-icons/TrashIcon";
30
30
  export * from "./static-icons/BulletCheckIcon";
31
31
  export * from "./static-icons/HelpIcon";
32
+ export * from "./static-icons/WaitingIcon";
@@ -0,0 +1 @@
1
+ export declare const WaitingIcon: () => JSX.Element;
@@ -1,32 +1,32 @@
1
1
  /// <reference types="react" />
2
- export interface RowItem {
2
+ export declare type RowDef<T> = {
3
3
  id: string;
4
- value: string;
5
- }
6
- export declare type RowTableType = Record<string, string | React.ReactNode>;
7
- export declare type RowsTableType = RowItem[];
4
+ isRemovable?: boolean;
5
+ isEditable?: boolean;
6
+ } & T;
8
7
  export declare type CellDef = {
9
- component: "TextField" | "NumberField";
8
+ component: "TextField";
10
9
  config?: {
11
10
  type: "text" | "number";
12
11
  max?: number;
13
12
  min?: number;
13
+ totalCell?: boolean;
14
14
  };
15
15
  };
16
16
  export declare type ColumnDef<T> = {
17
17
  accessorKey: keyof T;
18
- header: string;
18
+ header: string | React.ReactNode;
19
19
  cell?: CellDef;
20
20
  };
21
21
  export interface TableProps {
22
- rows: any[];
22
+ rows: RowDef<any>[];
23
23
  columns: ColumnDef<any>[];
24
24
  }
25
25
  export interface SplitterTableProps extends TableProps {
26
- onAddRow(item?: unknown): void;
27
- onRemoveRow(item: string | number): void;
28
- onUpdateRow(id: string, value: string | number, accessorKey: unknown): void;
29
- removeButton?: boolean;
26
+ onAddRow?(item?: unknown): void;
27
+ onRemoveRow?(item: string | number): void;
28
+ onUpdateRow?(id: string, value: string | number, accessorKey: unknown): void;
29
+ totalSplitFooter?: number;
30
30
  }
31
31
  export declare const SplitterTable: React.FC<SplitterTableProps>;
32
32
  export declare const Table: React.FC<TableProps>;
package/dist/index.es.js CHANGED
@@ -1102,6 +1102,8 @@ var BulletCheckIcon = function () { return (jsxs("svg", __assign({ width: "24",
1102
1102
 
1103
1103
  var HelpIcon = function () { return (jsx("svg", __assign({ width: "25", height: "24", viewBox: "0 0 25 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsx("path", { d: "M11.5 18H13.5V16H11.5V18ZM12.5 2C6.98 2 2.5 6.48 2.5 12C2.5 17.52 6.98 22 12.5 22C18.02 22 22.5 17.52 22.5 12C22.5 6.48 18.02 2 12.5 2ZM12.5 20C8.09 20 4.5 16.41 4.5 12C4.5 7.59 8.09 4 12.5 4C16.91 4 20.5 7.59 20.5 12C20.5 16.41 16.91 20 12.5 20ZM12.5 6C10.29 6 8.5 7.79 8.5 10H10.5C10.5 8.9 11.4 8 12.5 8C13.6 8 14.5 8.9 14.5 10C14.5 12 11.5 11.75 11.5 15H13.5C13.5 12.75 16.5 12.5 16.5 10C16.5 7.79 14.71 6 12.5 6Z", fill: "#9CC2C9" }) }))); };
1104
1104
 
1105
+ var WaitingIcon = function () { return (jsxs("svg", __assign({ width: "25", height: "24", viewBox: "0 0 25 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("rect", { x: "0.5", width: "24", height: "24", rx: "12", fill: "#243D42" }), jsx("path", { d: "M12.5 0C5.9 0 0.5 5.4 0.5 12C0.5 18.6 5.9 24 12.5 24C19.1 24 24.5 18.6 24.5 12C24.5 5.4 19.1 0 12.5 0ZM12.5 21.6C7.208 21.6 2.9 17.292 2.9 12C2.9 6.708 7.208 2.4 12.5 2.4C17.792 2.4 22.1 6.708 22.1 12C22.1 17.292 17.792 21.6 12.5 21.6ZM13.1 6H11.3V13.2L17.54 17.04L18.5 15.48L13.1 12.24V6Z", fill: "#475E64" })] }))); };
1106
+
1105
1107
  var TeamMemberCard = function (props) { return (jsxs(Box, __assign({ css: {
1106
1108
  display: "grid",
1107
1109
  gridTemplateColumns: "1fr",
@@ -1725,9 +1727,15 @@ var NotificationCard = function (_a) {
1725
1727
 
1726
1728
  var ProgressTracker = function (_a) {
1727
1729
  var items = _a.items;
1728
- var count = items.filter(function (item) { return item.status === "complete"; }).length;
1729
- var offset = 100 / items.length / 2;
1730
- var width = (100 / items.length) * count + offset;
1730
+ var _b = useState(items), steps = _b[0], setSteps = _b[1];
1731
+ var _c = useState(0), width = _c[0], setWidth = _c[1];
1732
+ useEffect(function () {
1733
+ var _count = items.filter(function (item) { return item.status === "complete"; }).length;
1734
+ var offset = 100 / items.length / 2;
1735
+ var width = (100 / items.length) * _count + offset;
1736
+ setWidth(width);
1737
+ setSteps(items);
1738
+ }, [items]);
1731
1739
  return (jsx(Box, __assign({ css: { backgroundColor: "$bg02", py: "$3xl", px: "$6xl" } }, { children: jsxs(Box, __assign({ css: { display: "flex", fd: "column", gap: "$md" } }, { children: [jsx(Box, __assign({ className: "progress-bar-behind", css: {
1732
1740
  height: "$xxs",
1733
1741
  borderRadius: "$3",
@@ -1771,8 +1779,8 @@ var ProgressTracker = function (_a) {
1771
1779
  },
1772
1780
  } })] })) })), jsx(Box, __assign({ className: "link-items", css: {
1773
1781
  display: "grid",
1774
- gridTemplateColumns: "repeat(".concat(items.length || 1, ", 1fr)"),
1775
- } }, { children: items.map(function (item, index) { return (jsx(Link, __assign({ disabled: item.status === "incomplete", href: item.status === "incomplete" ? "#" : item.href, css: {
1782
+ gridTemplateColumns: "repeat(".concat(steps.length || 1, ", 1fr)"),
1783
+ } }, { children: steps.map(function (item, index) { return (jsx(Link, __assign({ disabled: item.status === "incomplete", href: item.href, css: {
1776
1784
  display: "flex",
1777
1785
  justifyContent: "center",
1778
1786
  alignItems: "center",
@@ -1853,9 +1861,8 @@ var StyledTable = styled("table", {
1853
1861
  });
1854
1862
  var Td = styled("td", {
1855
1863
  border: "2px solid $bg04",
1856
- py: 0,
1864
+ py: "$sm",
1857
1865
  px: "$sm",
1858
- textAlign: "center",
1859
1866
  color: "$body",
1860
1867
  fontWeight: "$bold",
1861
1868
  fontSize: "$4",
@@ -1865,9 +1872,10 @@ var Td = styled("td", {
1865
1872
  width: "100%",
1866
1873
  },
1867
1874
  variants: {
1868
- noPadding: {
1875
+ splitter: {
1869
1876
  true: {
1870
- p: 0,
1877
+ py: 0,
1878
+ px: 0,
1871
1879
  backgroundColor: "$bg03",
1872
1880
  },
1873
1881
  },
@@ -1876,6 +1884,11 @@ var Td = styled("td", {
1876
1884
  width: "$3xl",
1877
1885
  },
1878
1886
  },
1887
+ textCenter: {
1888
+ true: {
1889
+ textAlign: "center",
1890
+ },
1891
+ },
1879
1892
  },
1880
1893
  });
1881
1894
  var Th = styled("th", {
@@ -1897,56 +1910,83 @@ var BoxBorderTop = styled(Box, {
1897
1910
  borderTop: "2px solid $bg04",
1898
1911
  marginTop: "$2",
1899
1912
  height: "$3xl",
1913
+ display: "flex",
1914
+ alignItems: "center",
1915
+ px: "$sm",
1900
1916
  });
1901
- var AddNewRow = function (props) {
1902
- return (jsxs(Tr, { children: [jsx(Td, __assign({ noPadding: true }, { children: jsx(BoxBorderTop, { children: "" }) })), jsx(Td, __assign({ noPadding: true, css: { backgroundColor: "$bg03" } }, { children: jsx(BoxBorderTop, { children: jsx(Button, __assign({ type: "button", css: {
1917
+ var AddNewRow = function (_a) {
1918
+ var onAddRow = _a.onAddRow, totalSplitFooter = _a.totalSplitFooter;
1919
+ return (jsxs(Tr, { children: [jsx(Td, __assign({ splitter: true }, { children: jsx(BoxBorderTop, {}) })), jsx(Td, __assign({ splitter: true, css: { backgroundColor: "$bg03" } }, { children: jsx(BoxBorderTop, { children: onAddRow && (jsx(Button, __assign({ type: "button", css: {
1903
1920
  color: "$obolGreen",
1904
1921
  justifyContent: "start",
1905
1922
  borderRadius: 0,
1906
1923
  "&:hover": {
1907
1924
  backgroundColor: "#2FE4AB10",
1908
1925
  },
1909
- }, fullWidth: true, ghost: true, onClick: props.handleOnClick }, { children: "+ Add Signer" })) }) })), jsx(Td, __assign({ noPadding: true, css: { backgroundColor: "$bg03" } }, { children: jsx(BoxBorderTop, {}) }))] }));
1926
+ "&:disabled": {
1927
+ borderColor: "transparent",
1928
+ },
1929
+ }, fullWidth: true, ghost: true, onClick: function (e) {
1930
+ e.preventDefault();
1931
+ onAddRow();
1932
+ }, disabled: totalSplitFooter === 100 }, { children: "+ Add Signer" }))) }) })), jsx(Td, __assign({ splitter: true, css: { backgroundColor: "$bg03" } }, { children: jsx(BoxBorderTop, { children: jsx(Box, { children: totalSplitFooter && "".concat(totalSplitFooter, "%") }) }) }))] }));
1910
1933
  };
1911
- // Components
1912
1934
  var SplitterTable = function (_a) {
1913
- 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;
1914
- 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) {
1915
- var _a;
1916
- var isTextField = !!column.cell;
1917
- return (jsx(Td, __assign({ noPadding: true, css: {
1918
- "input::-webkit-inner-spin-button": {
1919
- "-webkit-appearance": "none",
1920
- margin: 0,
1921
- },
1922
- /* Firefox */
1923
- "input[type=number]": {
1924
- "-moz-appearance": "textfield",
1925
- },
1926
- } }, { children: isTextField ? (jsx(TextField, __assign({ defaultValue: row[column.accessorKey], onInput: function (e) {
1927
- var _a, _b, _c, _d, _e, _f, _g, _h;
1928
- if (((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number") {
1929
- if ((_d = (_c = column.cell) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.max) {
1930
- 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))
1931
- e.target.value = (_h = (_g = column.cell) === null || _g === void 0 ? void 0 : _g.config) === null || _h === void 0 ? void 0 : _h.max;
1935
+ var rows = _a.rows, columns = _a.columns, onAddRow = _a.onAddRow, onRemoveRow = _a.onRemoveRow, onUpdateRow = _a.onUpdateRow, _b = _a.totalSplitFooter, totalSplitFooter = _b === void 0 ? 100 : _b;
1936
+ 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 (_a, rowIndex) {
1937
+ var _b = _a.isRemovable, isRemovable = _b === void 0 ? true : _b, _c = _a.isEditable, isEditable = _c === void 0 ? true : _c, row = __rest(_a, ["isRemovable", "isEditable"]);
1938
+ return (jsxs("tr", { children: [jsx(Td, __assign({ textCenter: true, size: "sm" }, { children: rowIndex + 1 })), columns.map(function (column, cellIndex) {
1939
+ var _a, _b;
1940
+ var isTextField = ((_a = column.cell) === null || _a === void 0 ? void 0 : _a.component) === "TextField";
1941
+ return (jsx(Td, __assign({ splitter: true, css: {
1942
+ "input::-webkit-inner-spin-button": {
1943
+ "-webkit-appearance": "none",
1944
+ margin: 0,
1945
+ },
1946
+ /* Firefox */
1947
+ "input[type=number]": {
1948
+ "-moz-appearance": "textfield",
1949
+ },
1950
+ } }, { children: isTextField && (jsx(TextField, __assign({ css: { color: "$body", fontWeight: "$bold" }, defaultValue: row[column.accessorKey], step: "any", onInput: function (e) {
1951
+ var _a, _b, _c, _d;
1952
+ var inputValue = e.target.value === ""
1953
+ ? 0
1954
+ : parseFloat(e.target.value);
1955
+ if (((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number") {
1956
+ if ((_d = (_c = column.cell) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.totalCell) {
1957
+ var value = rows.reduce(function (prev, curr, indx) {
1958
+ var floatNumber = parseFloat(curr[column.accessorKey]);
1959
+ var parsedValue = isNaN(floatNumber)
1960
+ ? 0
1961
+ : floatNumber;
1962
+ return curr[column.accessorKey] &&
1963
+ indx !== rowIndex
1964
+ ? parsedValue + prev
1965
+ : prev;
1966
+ }, 0);
1967
+ var maxValue = 100 - value;
1968
+ if (inputValue > maxValue)
1969
+ e.target.value = maxValue.toFixed(2);
1970
+ }
1932
1971
  }
1933
- }
1934
- }, onChange: function (e) {
1935
- var _a, _b;
1936
- var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
1937
- ? Number(e.target.value)
1938
- : e.target.value;
1939
- onUpdateRow(row.id, value, column.accessorKey);
1940
- } }, (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config))) : (row[column.accessorKey]) }), "cell ".concat(cellIndex)));
1941
- }), removeButton && (jsx(Td, __assign({ size: "sm" }, { children: jsx(IconButton, __assign({ ghost: true, onClick: function () { return onRemoveRow(row.id); } }, { children: jsx(TrashIcon, {}) })) })))] }, row.id)); }), jsx(AddNewRow, { handleOnClick: function (e) {
1942
- e.preventDefault();
1943
- onAddRow();
1944
- } })] })] }));
1972
+ }, onChange: function (e) {
1973
+ var _a, _b;
1974
+ var inputValue = e.target.value === ""
1975
+ ? 0
1976
+ : parseFloat(e.target.value);
1977
+ var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
1978
+ ? inputValue.toFixed(2)
1979
+ : e.target.value;
1980
+ if (onUpdateRow)
1981
+ onUpdateRow(row.id, value, column.accessorKey);
1982
+ } }, (_b = column.cell) === null || _b === void 0 ? void 0 : _b.config, { readOnly: !isEditable }))) }), "cell ".concat(cellIndex)));
1983
+ }), onRemoveRow && isRemovable && (jsx(Td, __assign({ splitter: true, size: "sm", css: { p: "$2" } }, { children: jsx(IconButton, __assign({ ghost: true, onClick: function () { return onRemoveRow(row.id); } }, { children: jsx(TrashIcon, {}) })) })))] }, row.id));
1984
+ }), jsx(AddNewRow, { onAddRow: onAddRow, totalSplitFooter: totalSplitFooter })] })] }));
1945
1985
  };
1946
1986
  var Table = function (_a) {
1947
1987
  var rows = _a.rows, columns = _a.columns;
1948
- return (jsxs(StyledTable, { children: [jsx("thead", { children: columns.map(function (column, index) { return (jsx(Td, { children: column }, "header-".concat(index))); }) }), jsx("tbody", { children: rows.map(function (row, rowIndex) { return (jsx("tr", { children: columns.map(function (column, cellIndex) {
1949
- return (jsx(Td, { children: row[column.accessorKey] }, "cell ".concat(cellIndex)));
1988
+ return (jsxs(StyledTable, { children: [jsx("thead", { children: jsx("tr", { children: columns.map(function (column, index) { return (jsx(Th, __assign({ css: { textAlign: "start" } }, { children: column.header }), "header-".concat(index))); }) }) }), jsx("tbody", { children: rows.map(function (row, rowIndex) { return (jsx("tr", { children: columns.map(function (column, cellIndex) {
1989
+ return (jsx(Td, __assign({ css: { color: "$light" } }, { children: row[column.accessorKey] }), "cell ".concat(cellIndex)));
1950
1990
  }) }, "row ".concat(rowIndex))); }) })] }));
1951
1991
  };
1952
1992
 
@@ -2154,4 +2194,4 @@ var TwoColumnSection = function (_a) {
2154
2194
  } }, { children: !screenDownSm ? (jsx(Image, { src: image.basePath, width: "100%", height: "100%", alt: "Obol Logo" })) : (jsx(Image, { src: image.mobilePath || image.basePath, width: "100%", height: "100%", alt: "Obol Logo" })) }))] })));
2155
2195
  };
2156
2196
 
2157
- export { Accordion, Advisory, AdvisoryToggleBullet, AdvisoryToggleItem, AlertIcon, AloneIcon, ArrowForward, Box, BulletCheckIcon, Button, ButtonStory, Card, CheckIcon, ChevronDownIcon, ChevronUpIcon, CloseIcon, CodeIcon, Container, CopyIcon, CreateIcon, Download, ExistingGroupIcon, Flex, Footer, GithubIcon, GroupIcon, HelpIcon, HeroSection, Hexapod, HexapodMobile, IconButton, IconButtonStory, Image, Link, LinkStory, LogoCard, MediaQueryKeys, MenuIcon, MigrateIcon, Navbar, NotificationCard, NotificationContainer, NumberField, ObolDarkBgH, ObolDarkBgMark, ObolDarkBgV, ObolDarkCircle, ObolLightBgH, ObolLightBgMark, ObolLightBgV, ObolLightCircle, ObolSolidDarkBgH, ObolSolidDarkBgMark, ObolSolidDarkBgV, ObolSolidLightBgH, ObolSolidLightBgMark, ObolSolidLightBgV, OpenInNew, PlanetBlue, PlanetGreen, PlanetGrey, PlanetMagenta, PlanetOrange, ProgressTracker, Provider, PublicGoodIcon, RadioGroup, RadioGroupComponent, RadioGroupIndicator, RadioGroupItem, RadioGroupItemLabel, RadioGroupRadio, RunIcon, Spin, SplitterTable, SvgIcon, Table, Tabs$1 as Tabs, TeamMemberCard, TestIcon, Text, TextField, TextFieldWithCopy, TextStory, ToggleCardItem, ToggleGroup, ToggleGroupItem, Tooltip, TooltipArrow, TooltipComponent, TooltipContent, TooltipTrigger, TrashIcon, TrustMinimisedIcon, TwitterIcon, TwoColumnSection, config, createTheme, css, getCssText, globalCss, keyframes, modifyVariantsForStory, reset, styled, theme, useMediaQuery };
2197
+ export { Accordion, Advisory, AdvisoryToggleBullet, AdvisoryToggleItem, AlertIcon, AloneIcon, ArrowForward, Box, BulletCheckIcon, Button, ButtonStory, Card, CheckIcon, ChevronDownIcon, ChevronUpIcon, CloseIcon, CodeIcon, Container, CopyIcon, CreateIcon, Download, ExistingGroupIcon, Flex, Footer, GithubIcon, GroupIcon, HelpIcon, HeroSection, Hexapod, HexapodMobile, IconButton, IconButtonStory, Image, Link, LinkStory, LogoCard, MediaQueryKeys, MenuIcon, MigrateIcon, Navbar, NotificationCard, NotificationContainer, NumberField, ObolDarkBgH, ObolDarkBgMark, ObolDarkBgV, ObolDarkCircle, ObolLightBgH, ObolLightBgMark, ObolLightBgV, ObolLightCircle, ObolSolidDarkBgH, ObolSolidDarkBgMark, ObolSolidDarkBgV, ObolSolidLightBgH, ObolSolidLightBgMark, ObolSolidLightBgV, OpenInNew, PlanetBlue, PlanetGreen, PlanetGrey, PlanetMagenta, PlanetOrange, ProgressTracker, Provider, PublicGoodIcon, RadioGroup, RadioGroupComponent, RadioGroupIndicator, RadioGroupItem, RadioGroupItemLabel, RadioGroupRadio, RunIcon, Spin, SplitterTable, SvgIcon, Table, Tabs$1 as Tabs, TeamMemberCard, TestIcon, Text, TextField, TextFieldWithCopy, TextStory, ToggleCardItem, ToggleGroup, ToggleGroupItem, Tooltip, TooltipArrow, TooltipComponent, TooltipContent, TooltipTrigger, TrashIcon, TrustMinimisedIcon, TwitterIcon, TwoColumnSection, WaitingIcon, config, createTheme, css, getCssText, globalCss, keyframes, modifyVariantsForStory, reset, styled, theme, useMediaQuery };
package/dist/index.js CHANGED
@@ -1133,6 +1133,8 @@ var BulletCheckIcon = function () { return (jsxRuntime.jsxs("svg", __assign({ wi
1133
1133
 
1134
1134
  var HelpIcon = function () { return (jsxRuntime.jsx("svg", __assign({ width: "25", height: "24", viewBox: "0 0 25 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsxRuntime.jsx("path", { d: "M11.5 18H13.5V16H11.5V18ZM12.5 2C6.98 2 2.5 6.48 2.5 12C2.5 17.52 6.98 22 12.5 22C18.02 22 22.5 17.52 22.5 12C22.5 6.48 18.02 2 12.5 2ZM12.5 20C8.09 20 4.5 16.41 4.5 12C4.5 7.59 8.09 4 12.5 4C16.91 4 20.5 7.59 20.5 12C20.5 16.41 16.91 20 12.5 20ZM12.5 6C10.29 6 8.5 7.79 8.5 10H10.5C10.5 8.9 11.4 8 12.5 8C13.6 8 14.5 8.9 14.5 10C14.5 12 11.5 11.75 11.5 15H13.5C13.5 12.75 16.5 12.5 16.5 10C16.5 7.79 14.71 6 12.5 6Z", fill: "#9CC2C9" }) }))); };
1135
1135
 
1136
+ var WaitingIcon = function () { return (jsxRuntime.jsxs("svg", __assign({ width: "25", height: "24", viewBox: "0 0 25 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("rect", { x: "0.5", width: "24", height: "24", rx: "12", fill: "#243D42" }), jsxRuntime.jsx("path", { d: "M12.5 0C5.9 0 0.5 5.4 0.5 12C0.5 18.6 5.9 24 12.5 24C19.1 24 24.5 18.6 24.5 12C24.5 5.4 19.1 0 12.5 0ZM12.5 21.6C7.208 21.6 2.9 17.292 2.9 12C2.9 6.708 7.208 2.4 12.5 2.4C17.792 2.4 22.1 6.708 22.1 12C22.1 17.292 17.792 21.6 12.5 21.6ZM13.1 6H11.3V13.2L17.54 17.04L18.5 15.48L13.1 12.24V6Z", fill: "#475E64" })] }))); };
1137
+
1136
1138
  var TeamMemberCard = function (props) { return (jsxRuntime.jsxs(Box, __assign({ css: {
1137
1139
  display: "grid",
1138
1140
  gridTemplateColumns: "1fr",
@@ -1756,9 +1758,15 @@ var NotificationCard = function (_a) {
1756
1758
 
1757
1759
  var ProgressTracker = function (_a) {
1758
1760
  var items = _a.items;
1759
- var count = items.filter(function (item) { return item.status === "complete"; }).length;
1760
- var offset = 100 / items.length / 2;
1761
- var width = (100 / items.length) * count + offset;
1761
+ var _b = React.useState(items), steps = _b[0], setSteps = _b[1];
1762
+ var _c = React.useState(0), width = _c[0], setWidth = _c[1];
1763
+ React.useEffect(function () {
1764
+ var _count = items.filter(function (item) { return item.status === "complete"; }).length;
1765
+ var offset = 100 / items.length / 2;
1766
+ var width = (100 / items.length) * _count + offset;
1767
+ setWidth(width);
1768
+ setSteps(items);
1769
+ }, [items]);
1762
1770
  return (jsxRuntime.jsx(Box, __assign({ css: { backgroundColor: "$bg02", py: "$3xl", px: "$6xl" } }, { children: jsxRuntime.jsxs(Box, __assign({ css: { display: "flex", fd: "column", gap: "$md" } }, { children: [jsxRuntime.jsx(Box, __assign({ className: "progress-bar-behind", css: {
1763
1771
  height: "$xxs",
1764
1772
  borderRadius: "$3",
@@ -1802,8 +1810,8 @@ var ProgressTracker = function (_a) {
1802
1810
  },
1803
1811
  } })] })) })), jsxRuntime.jsx(Box, __assign({ className: "link-items", css: {
1804
1812
  display: "grid",
1805
- gridTemplateColumns: "repeat(".concat(items.length || 1, ", 1fr)"),
1806
- } }, { children: items.map(function (item, index) { return (jsxRuntime.jsx(Link, __assign({ disabled: item.status === "incomplete", href: item.status === "incomplete" ? "#" : item.href, css: {
1813
+ gridTemplateColumns: "repeat(".concat(steps.length || 1, ", 1fr)"),
1814
+ } }, { children: steps.map(function (item, index) { return (jsxRuntime.jsx(Link, __assign({ disabled: item.status === "incomplete", href: item.href, css: {
1807
1815
  display: "flex",
1808
1816
  justifyContent: "center",
1809
1817
  alignItems: "center",
@@ -1884,9 +1892,8 @@ var StyledTable = styled("table", {
1884
1892
  });
1885
1893
  var Td = styled("td", {
1886
1894
  border: "2px solid $bg04",
1887
- py: 0,
1895
+ py: "$sm",
1888
1896
  px: "$sm",
1889
- textAlign: "center",
1890
1897
  color: "$body",
1891
1898
  fontWeight: "$bold",
1892
1899
  fontSize: "$4",
@@ -1896,9 +1903,10 @@ var Td = styled("td", {
1896
1903
  width: "100%",
1897
1904
  },
1898
1905
  variants: {
1899
- noPadding: {
1906
+ splitter: {
1900
1907
  true: {
1901
- p: 0,
1908
+ py: 0,
1909
+ px: 0,
1902
1910
  backgroundColor: "$bg03",
1903
1911
  },
1904
1912
  },
@@ -1907,6 +1915,11 @@ var Td = styled("td", {
1907
1915
  width: "$3xl",
1908
1916
  },
1909
1917
  },
1918
+ textCenter: {
1919
+ true: {
1920
+ textAlign: "center",
1921
+ },
1922
+ },
1910
1923
  },
1911
1924
  });
1912
1925
  var Th = styled("th", {
@@ -1928,56 +1941,83 @@ var BoxBorderTop = styled(Box, {
1928
1941
  borderTop: "2px solid $bg04",
1929
1942
  marginTop: "$2",
1930
1943
  height: "$3xl",
1944
+ display: "flex",
1945
+ alignItems: "center",
1946
+ px: "$sm",
1931
1947
  });
1932
- var AddNewRow = function (props) {
1933
- return (jsxRuntime.jsxs(Tr, { children: [jsxRuntime.jsx(Td, __assign({ noPadding: true }, { children: jsxRuntime.jsx(BoxBorderTop, { children: "" }) })), jsxRuntime.jsx(Td, __assign({ noPadding: true, css: { backgroundColor: "$bg03" } }, { children: jsxRuntime.jsx(BoxBorderTop, { children: jsxRuntime.jsx(Button, __assign({ type: "button", css: {
1948
+ var AddNewRow = function (_a) {
1949
+ var onAddRow = _a.onAddRow, totalSplitFooter = _a.totalSplitFooter;
1950
+ return (jsxRuntime.jsxs(Tr, { children: [jsxRuntime.jsx(Td, __assign({ splitter: true }, { children: jsxRuntime.jsx(BoxBorderTop, {}) })), jsxRuntime.jsx(Td, __assign({ splitter: true, css: { backgroundColor: "$bg03" } }, { children: jsxRuntime.jsx(BoxBorderTop, { children: onAddRow && (jsxRuntime.jsx(Button, __assign({ type: "button", css: {
1934
1951
  color: "$obolGreen",
1935
1952
  justifyContent: "start",
1936
1953
  borderRadius: 0,
1937
1954
  "&:hover": {
1938
1955
  backgroundColor: "#2FE4AB10",
1939
1956
  },
1940
- }, fullWidth: true, ghost: true, onClick: props.handleOnClick }, { children: "+ Add Signer" })) }) })), jsxRuntime.jsx(Td, __assign({ noPadding: true, css: { backgroundColor: "$bg03" } }, { children: jsxRuntime.jsx(BoxBorderTop, {}) }))] }));
1957
+ "&:disabled": {
1958
+ borderColor: "transparent",
1959
+ },
1960
+ }, fullWidth: true, ghost: true, onClick: function (e) {
1961
+ e.preventDefault();
1962
+ onAddRow();
1963
+ }, disabled: totalSplitFooter === 100 }, { children: "+ Add Signer" }))) }) })), jsxRuntime.jsx(Td, __assign({ splitter: true, css: { backgroundColor: "$bg03" } }, { children: jsxRuntime.jsx(BoxBorderTop, { children: jsxRuntime.jsx(Box, { children: totalSplitFooter && "".concat(totalSplitFooter, "%") }) }) }))] }));
1941
1964
  };
1942
- // Components
1943
1965
  var SplitterTable = function (_a) {
1944
- 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;
1945
- 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) {
1946
- var _a;
1947
- var isTextField = !!column.cell;
1948
- return (jsxRuntime.jsx(Td, __assign({ noPadding: true, css: {
1949
- "input::-webkit-inner-spin-button": {
1950
- "-webkit-appearance": "none",
1951
- margin: 0,
1952
- },
1953
- /* Firefox */
1954
- "input[type=number]": {
1955
- "-moz-appearance": "textfield",
1956
- },
1957
- } }, { children: isTextField ? (jsxRuntime.jsx(TextField, __assign({ defaultValue: row[column.accessorKey], onInput: function (e) {
1958
- var _a, _b, _c, _d, _e, _f, _g, _h;
1959
- if (((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number") {
1960
- if ((_d = (_c = column.cell) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.max) {
1961
- 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))
1962
- e.target.value = (_h = (_g = column.cell) === null || _g === void 0 ? void 0 : _g.config) === null || _h === void 0 ? void 0 : _h.max;
1966
+ var rows = _a.rows, columns = _a.columns, onAddRow = _a.onAddRow, onRemoveRow = _a.onRemoveRow, onUpdateRow = _a.onUpdateRow, _b = _a.totalSplitFooter, totalSplitFooter = _b === void 0 ? 100 : _b;
1967
+ 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 (_a, rowIndex) {
1968
+ var _b = _a.isRemovable, isRemovable = _b === void 0 ? true : _b, _c = _a.isEditable, isEditable = _c === void 0 ? true : _c, row = __rest(_a, ["isRemovable", "isEditable"]);
1969
+ return (jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx(Td, __assign({ textCenter: true, size: "sm" }, { children: rowIndex + 1 })), columns.map(function (column, cellIndex) {
1970
+ var _a, _b;
1971
+ var isTextField = ((_a = column.cell) === null || _a === void 0 ? void 0 : _a.component) === "TextField";
1972
+ return (jsxRuntime.jsx(Td, __assign({ splitter: true, css: {
1973
+ "input::-webkit-inner-spin-button": {
1974
+ "-webkit-appearance": "none",
1975
+ margin: 0,
1976
+ },
1977
+ /* Firefox */
1978
+ "input[type=number]": {
1979
+ "-moz-appearance": "textfield",
1980
+ },
1981
+ } }, { children: isTextField && (jsxRuntime.jsx(TextField, __assign({ css: { color: "$body", fontWeight: "$bold" }, defaultValue: row[column.accessorKey], step: "any", onInput: function (e) {
1982
+ var _a, _b, _c, _d;
1983
+ var inputValue = e.target.value === ""
1984
+ ? 0
1985
+ : parseFloat(e.target.value);
1986
+ if (((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number") {
1987
+ if ((_d = (_c = column.cell) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.totalCell) {
1988
+ var value = rows.reduce(function (prev, curr, indx) {
1989
+ var floatNumber = parseFloat(curr[column.accessorKey]);
1990
+ var parsedValue = isNaN(floatNumber)
1991
+ ? 0
1992
+ : floatNumber;
1993
+ return curr[column.accessorKey] &&
1994
+ indx !== rowIndex
1995
+ ? parsedValue + prev
1996
+ : prev;
1997
+ }, 0);
1998
+ var maxValue = 100 - value;
1999
+ if (inputValue > maxValue)
2000
+ e.target.value = maxValue.toFixed(2);
2001
+ }
1963
2002
  }
1964
- }
1965
- }, onChange: function (e) {
1966
- var _a, _b;
1967
- var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
1968
- ? Number(e.target.value)
1969
- : e.target.value;
1970
- onUpdateRow(row.id, value, column.accessorKey);
1971
- } }, (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config))) : (row[column.accessorKey]) }), "cell ".concat(cellIndex)));
1972
- }), removeButton && (jsxRuntime.jsx(Td, __assign({ size: "sm" }, { children: jsxRuntime.jsx(IconButton, __assign({ ghost: true, onClick: function () { return onRemoveRow(row.id); } }, { children: jsxRuntime.jsx(TrashIcon, {}) })) })))] }, row.id)); }), jsxRuntime.jsx(AddNewRow, { handleOnClick: function (e) {
1973
- e.preventDefault();
1974
- onAddRow();
1975
- } })] })] }));
2003
+ }, onChange: function (e) {
2004
+ var _a, _b;
2005
+ var inputValue = e.target.value === ""
2006
+ ? 0
2007
+ : parseFloat(e.target.value);
2008
+ var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
2009
+ ? inputValue.toFixed(2)
2010
+ : e.target.value;
2011
+ if (onUpdateRow)
2012
+ onUpdateRow(row.id, value, column.accessorKey);
2013
+ } }, (_b = column.cell) === null || _b === void 0 ? void 0 : _b.config, { readOnly: !isEditable }))) }), "cell ".concat(cellIndex)));
2014
+ }), onRemoveRow && isRemovable && (jsxRuntime.jsx(Td, __assign({ splitter: true, size: "sm", css: { p: "$2" } }, { children: jsxRuntime.jsx(IconButton, __assign({ ghost: true, onClick: function () { return onRemoveRow(row.id); } }, { children: jsxRuntime.jsx(TrashIcon, {}) })) })))] }, row.id));
2015
+ }), jsxRuntime.jsx(AddNewRow, { onAddRow: onAddRow, totalSplitFooter: totalSplitFooter })] })] }));
1976
2016
  };
1977
2017
  var Table = function (_a) {
1978
2018
  var rows = _a.rows, columns = _a.columns;
1979
- return (jsxRuntime.jsxs(StyledTable, { children: [jsxRuntime.jsx("thead", { children: columns.map(function (column, index) { return (jsxRuntime.jsx(Td, { children: column }, "header-".concat(index))); }) }), jsxRuntime.jsx("tbody", { children: rows.map(function (row, rowIndex) { return (jsxRuntime.jsx("tr", { children: columns.map(function (column, cellIndex) {
1980
- return (jsxRuntime.jsx(Td, { children: row[column.accessorKey] }, "cell ".concat(cellIndex)));
2019
+ return (jsxRuntime.jsxs(StyledTable, { children: [jsxRuntime.jsx("thead", { children: jsxRuntime.jsx("tr", { children: columns.map(function (column, index) { return (jsxRuntime.jsx(Th, __assign({ css: { textAlign: "start" } }, { children: column.header }), "header-".concat(index))); }) }) }), jsxRuntime.jsx("tbody", { children: rows.map(function (row, rowIndex) { return (jsxRuntime.jsx("tr", { children: columns.map(function (column, cellIndex) {
2020
+ return (jsxRuntime.jsx(Td, __assign({ css: { color: "$light" } }, { children: row[column.accessorKey] }), "cell ".concat(cellIndex)));
1981
2021
  }) }, "row ".concat(rowIndex))); }) })] }));
1982
2022
  };
1983
2023
 
@@ -2281,6 +2321,7 @@ exports.TrashIcon = TrashIcon;
2281
2321
  exports.TrustMinimisedIcon = TrustMinimisedIcon;
2282
2322
  exports.TwitterIcon = TwitterIcon;
2283
2323
  exports.TwoColumnSection = TwoColumnSection;
2324
+ exports.WaitingIcon = WaitingIcon;
2284
2325
  exports.config = config;
2285
2326
  exports.createTheme = createTheme;
2286
2327
  exports.css = css;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-ui",
3
- "version": "1.0.19-0",
3
+ "version": "1.0.20",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "license": "MIT",