@obolnetwork/obol-ui 1.0.17 → 1.0.19

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,11 +1,13 @@
1
1
  /// <reference types="react" />
2
- interface LinkItemProps {
2
+ export interface StepProps {
3
+ id: string | number;
3
4
  title: string;
4
5
  href: string;
5
- status: "complete" | "incomplete";
6
+ status: "complete" | "incomplete" | "current";
7
+ rank?: number;
6
8
  }
7
9
  interface ProgressTrackerProps {
8
- items: LinkItemProps[];
10
+ items: StepProps[];
9
11
  }
10
12
  export declare const ProgressTracker: React.FC<ProgressTrackerProps>;
11
13
  export {};
@@ -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",
@@ -1723,8 +1725,17 @@ var NotificationCard = function (_a) {
1723
1725
  return (jsxs(NotificationContainer, { children: [jsx(Box, { children: jsx(AlertIcon, { size: "lg", color: "body" }) }), jsxs(Box, __assign({ css: { display: "flex", fd: "column", gap: "$sm" } }, { children: [jsxs(Box, __assign({ css: { display: "flex", fd: "column", gap: "$xs" } }, { children: [jsx(Text, __assign({ variant: "body" }, { children: heading })), subHeading && (jsx(Text, __assign({ css: { color: "$textLight", fontSize: "$3" } }, { children: subHeading })))] })), link && (jsxs(Link, __assign({ target: "_blank", href: link }, { children: [linkText, jsx(ArrowForward, { size: "md" })] })))] }))] }));
1724
1726
  };
1725
1727
 
1726
- var ProgressTracker = function (props) {
1727
- var _a = useState(props.items), items = _a[0]; _a[1];
1728
+ var ProgressTracker = function (_a) {
1729
+ var items = _a.items;
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]);
1728
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: {
1729
1740
  height: "$xxs",
1730
1741
  borderRadius: "$3",
@@ -1737,7 +1748,7 @@ var ProgressTracker = function (props) {
1737
1748
  height: "$xxs",
1738
1749
  borderRadius: "$3",
1739
1750
  position: "relative",
1740
- width: "calc(100% / ".concat(items.length - 1, ")"),
1751
+ width: "".concat(width > 100 ? 100 : width, "%"),
1741
1752
  } }, { children: [jsx(Box, { css: {
1742
1753
  display: "grid",
1743
1754
  placeItems: "center",
@@ -1767,10 +1778,15 @@ var ProgressTracker = function (props) {
1767
1778
  right: "-8px",
1768
1779
  },
1769
1780
  } })] })) })), jsx(Box, __assign({ className: "link-items", css: {
1770
- display: "flex",
1771
- justifyContent: "space-between",
1772
- alignItems: "center",
1773
- } }, { children: items.map(function (item, index) { return (jsx(Link, __assign({ disabled: item.status === "incomplete", href: item.status === "incomplete" ? "#" : item.href }, { children: item.title }), ":l".concat(index))); }) }))] })) })));
1781
+ display: "grid",
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: {
1784
+ display: "flex",
1785
+ justifyContent: "center",
1786
+ alignItems: "center",
1787
+ height: "auto",
1788
+ textAlign: "center",
1789
+ } }, { children: item.title }), ":l".concat(index))); }) }))] })) })));
1774
1790
  };
1775
1791
 
1776
1792
  var StyledRadio = styled(RadioGroupPrimitive.Item, {
@@ -1845,9 +1861,8 @@ var StyledTable = styled("table", {
1845
1861
  });
1846
1862
  var Td = styled("td", {
1847
1863
  border: "2px solid $bg04",
1848
- py: 0,
1864
+ py: "$sm",
1849
1865
  px: "$sm",
1850
- textAlign: "center",
1851
1866
  color: "$body",
1852
1867
  fontWeight: "$bold",
1853
1868
  fontSize: "$4",
@@ -1857,9 +1872,10 @@ var Td = styled("td", {
1857
1872
  width: "100%",
1858
1873
  },
1859
1874
  variants: {
1860
- noPadding: {
1875
+ splitter: {
1861
1876
  true: {
1862
- p: 0,
1877
+ py: 0,
1878
+ px: 0,
1863
1879
  backgroundColor: "$bg03",
1864
1880
  },
1865
1881
  },
@@ -1868,6 +1884,11 @@ var Td = styled("td", {
1868
1884
  width: "$3xl",
1869
1885
  },
1870
1886
  },
1887
+ textCenter: {
1888
+ true: {
1889
+ textAlign: "center",
1890
+ },
1891
+ },
1871
1892
  },
1872
1893
  });
1873
1894
  var Th = styled("th", {
@@ -1889,53 +1910,73 @@ var BoxBorderTop = styled(Box, {
1889
1910
  borderTop: "2px solid $bg04",
1890
1911
  marginTop: "$2",
1891
1912
  height: "$3xl",
1913
+ display: "flex",
1914
+ alignItems: "center",
1915
+ px: "$sm",
1892
1916
  });
1893
- var AddNewRow = function (props) {
1894
- 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({ 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: {
1895
1920
  color: "$obolGreen",
1896
1921
  justifyContent: "start",
1897
1922
  borderRadius: 0,
1898
1923
  "&:hover": {
1899
1924
  backgroundColor: "#2FE4AB10",
1900
1925
  },
1901
- }, 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, __assign({ css: { pl: "$sm" } }, { children: totalSplitFooter && "".concat(totalSplitFooter, "%") })) }) }))] }));
1902
1933
  };
1903
- // Components
1904
1934
  var SplitterTable = function (_a) {
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;
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) {
1907
- var _a;
1908
- var isTextField = !!column.cell;
1909
- return (jsx(Td, __assign({ noPadding: true, css: {
1910
- "input::-webkit-inner-spin-button": {
1911
- "-webkit-appearance": "none",
1912
- margin: 0,
1913
- },
1914
- /* Firefox */
1915
- "input[type=number]": {
1916
- "-moz-appearance": "textfield",
1917
- },
1918
- } }, { children: isTextField ? (jsx(TextField, __assign({ defaultValue: row[column.accessorKey], onInput: function (e) {
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;
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 && isEditable ? (jsx(TextField, __assign({ css: { color: "$body", fontWeight: "$bold" }, defaultValue: row[column.accessorKey], onInput: function (e) {
1951
+ var _a, _b, _c, _d;
1952
+ if (((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number") {
1953
+ if ((_d = (_c = column.cell) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.totalCell) {
1954
+ var value = rows.reduce(function (prev, curr, indx) {
1955
+ return curr[column.accessorKey] && indx !== rowIndex
1956
+ ? parseFloat(curr[column.accessorKey]) +
1957
+ prev
1958
+ : prev;
1959
+ }, 0);
1960
+ var maxValue = 100 - value;
1961
+ if (parseFloat(e.target.value) > maxValue)
1962
+ e.target.value = maxValue;
1963
+ }
1924
1964
  }
1925
- }
1926
- }, onChange: function (e) {
1927
- var _a, _b;
1928
- var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
1929
- ? Number(e.target.value)
1930
- : e.target.value;
1931
- onUpdateRow(row.id, value, column.accessorKey);
1932
- } }, (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config))) : (row[column.accessorKey]) }), "cell ".concat(cellIndex)));
1933
- }), 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 () { return onAddRow(); } })] })] }));
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
+ ? parseFloat(e.target.value)
1969
+ : e.target.value;
1970
+ if (onUpdateRow)
1971
+ onUpdateRow(row.id, value, column.accessorKey);
1972
+ } }, (_b = column.cell) === null || _b === void 0 ? void 0 : _b.config))) : (jsx(Box, __assign({ css: { p: "$sm" } }, { children: row[column.accessorKey] }))) }), "cell ".concat(cellIndex)));
1973
+ }), 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));
1974
+ }), jsx(AddNewRow, { onAddRow: onAddRow, totalSplitFooter: totalSplitFooter })] })] }));
1934
1975
  };
1935
1976
  var Table = function (_a) {
1936
1977
  var rows = _a.rows, columns = _a.columns;
1937
- 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) {
1938
- return (jsx(Td, { children: row[column.accessorKey] }, "cell ".concat(cellIndex)));
1978
+ 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) {
1979
+ return (jsx(Td, __assign({ css: { color: "$light" } }, { children: row[column.accessorKey] }), "cell ".concat(cellIndex)));
1939
1980
  }) }, "row ".concat(rowIndex))); }) })] }));
1940
1981
  };
1941
1982
 
@@ -2143,4 +2184,4 @@ var TwoColumnSection = function (_a) {
2143
2184
  } }, { 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" })) }))] })));
2144
2185
  };
2145
2186
 
2146
- 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 };
2187
+ 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",
@@ -1754,8 +1756,17 @@ var NotificationCard = function (_a) {
1754
1756
  return (jsxRuntime.jsxs(NotificationContainer, { children: [jsxRuntime.jsx(Box, { children: jsxRuntime.jsx(AlertIcon, { size: "lg", color: "body" }) }), jsxRuntime.jsxs(Box, __assign({ css: { display: "flex", fd: "column", gap: "$sm" } }, { children: [jsxRuntime.jsxs(Box, __assign({ css: { display: "flex", fd: "column", gap: "$xs" } }, { children: [jsxRuntime.jsx(Text, __assign({ variant: "body" }, { children: heading })), subHeading && (jsxRuntime.jsx(Text, __assign({ css: { color: "$textLight", fontSize: "$3" } }, { children: subHeading })))] })), link && (jsxRuntime.jsxs(Link, __assign({ target: "_blank", href: link }, { children: [linkText, jsxRuntime.jsx(ArrowForward, { size: "md" })] })))] }))] }));
1755
1757
  };
1756
1758
 
1757
- var ProgressTracker = function (props) {
1758
- var _a = React.useState(props.items), items = _a[0]; _a[1];
1759
+ var ProgressTracker = function (_a) {
1760
+ var items = _a.items;
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]);
1759
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: {
1760
1771
  height: "$xxs",
1761
1772
  borderRadius: "$3",
@@ -1768,7 +1779,7 @@ var ProgressTracker = function (props) {
1768
1779
  height: "$xxs",
1769
1780
  borderRadius: "$3",
1770
1781
  position: "relative",
1771
- width: "calc(100% / ".concat(items.length - 1, ")"),
1782
+ width: "".concat(width > 100 ? 100 : width, "%"),
1772
1783
  } }, { children: [jsxRuntime.jsx(Box, { css: {
1773
1784
  display: "grid",
1774
1785
  placeItems: "center",
@@ -1798,10 +1809,15 @@ var ProgressTracker = function (props) {
1798
1809
  right: "-8px",
1799
1810
  },
1800
1811
  } })] })) })), jsxRuntime.jsx(Box, __assign({ className: "link-items", css: {
1801
- display: "flex",
1802
- justifyContent: "space-between",
1803
- alignItems: "center",
1804
- } }, { children: items.map(function (item, index) { return (jsxRuntime.jsx(Link, __assign({ disabled: item.status === "incomplete", href: item.status === "incomplete" ? "#" : item.href }, { children: item.title }), ":l".concat(index))); }) }))] })) })));
1812
+ display: "grid",
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: {
1815
+ display: "flex",
1816
+ justifyContent: "center",
1817
+ alignItems: "center",
1818
+ height: "auto",
1819
+ textAlign: "center",
1820
+ } }, { children: item.title }), ":l".concat(index))); }) }))] })) })));
1805
1821
  };
1806
1822
 
1807
1823
  var StyledRadio = styled(RadioGroupPrimitive__namespace.Item, {
@@ -1876,9 +1892,8 @@ var StyledTable = styled("table", {
1876
1892
  });
1877
1893
  var Td = styled("td", {
1878
1894
  border: "2px solid $bg04",
1879
- py: 0,
1895
+ py: "$sm",
1880
1896
  px: "$sm",
1881
- textAlign: "center",
1882
1897
  color: "$body",
1883
1898
  fontWeight: "$bold",
1884
1899
  fontSize: "$4",
@@ -1888,9 +1903,10 @@ var Td = styled("td", {
1888
1903
  width: "100%",
1889
1904
  },
1890
1905
  variants: {
1891
- noPadding: {
1906
+ splitter: {
1892
1907
  true: {
1893
- p: 0,
1908
+ py: 0,
1909
+ px: 0,
1894
1910
  backgroundColor: "$bg03",
1895
1911
  },
1896
1912
  },
@@ -1899,6 +1915,11 @@ var Td = styled("td", {
1899
1915
  width: "$3xl",
1900
1916
  },
1901
1917
  },
1918
+ textCenter: {
1919
+ true: {
1920
+ textAlign: "center",
1921
+ },
1922
+ },
1902
1923
  },
1903
1924
  });
1904
1925
  var Th = styled("th", {
@@ -1920,53 +1941,73 @@ var BoxBorderTop = styled(Box, {
1920
1941
  borderTop: "2px solid $bg04",
1921
1942
  marginTop: "$2",
1922
1943
  height: "$3xl",
1944
+ display: "flex",
1945
+ alignItems: "center",
1946
+ px: "$sm",
1923
1947
  });
1924
- var AddNewRow = function (props) {
1925
- 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({ 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: {
1926
1951
  color: "$obolGreen",
1927
1952
  justifyContent: "start",
1928
1953
  borderRadius: 0,
1929
1954
  "&:hover": {
1930
1955
  backgroundColor: "#2FE4AB10",
1931
1956
  },
1932
- }, 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, __assign({ css: { pl: "$sm" } }, { children: totalSplitFooter && "".concat(totalSplitFooter, "%") })) }) }))] }));
1933
1964
  };
1934
- // Components
1935
1965
  var SplitterTable = function (_a) {
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;
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) {
1938
- var _a;
1939
- var isTextField = !!column.cell;
1940
- return (jsxRuntime.jsx(Td, __assign({ noPadding: true, css: {
1941
- "input::-webkit-inner-spin-button": {
1942
- "-webkit-appearance": "none",
1943
- margin: 0,
1944
- },
1945
- /* Firefox */
1946
- "input[type=number]": {
1947
- "-moz-appearance": "textfield",
1948
- },
1949
- } }, { children: isTextField ? (jsxRuntime.jsx(TextField, __assign({ defaultValue: row[column.accessorKey], onInput: function (e) {
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;
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 && isEditable ? (jsxRuntime.jsx(TextField, __assign({ css: { color: "$body", fontWeight: "$bold" }, defaultValue: row[column.accessorKey], onInput: function (e) {
1982
+ var _a, _b, _c, _d;
1983
+ if (((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number") {
1984
+ if ((_d = (_c = column.cell) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.totalCell) {
1985
+ var value = rows.reduce(function (prev, curr, indx) {
1986
+ return curr[column.accessorKey] && indx !== rowIndex
1987
+ ? parseFloat(curr[column.accessorKey]) +
1988
+ prev
1989
+ : prev;
1990
+ }, 0);
1991
+ var maxValue = 100 - value;
1992
+ if (parseFloat(e.target.value) > maxValue)
1993
+ e.target.value = maxValue;
1994
+ }
1955
1995
  }
1956
- }
1957
- }, onChange: function (e) {
1958
- var _a, _b;
1959
- var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
1960
- ? Number(e.target.value)
1961
- : e.target.value;
1962
- onUpdateRow(row.id, value, column.accessorKey);
1963
- } }, (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config))) : (row[column.accessorKey]) }), "cell ".concat(cellIndex)));
1964
- }), 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 () { return onAddRow(); } })] })] }));
1996
+ }, onChange: function (e) {
1997
+ var _a, _b;
1998
+ var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
1999
+ ? parseFloat(e.target.value)
2000
+ : e.target.value;
2001
+ if (onUpdateRow)
2002
+ onUpdateRow(row.id, value, column.accessorKey);
2003
+ } }, (_b = column.cell) === null || _b === void 0 ? void 0 : _b.config))) : (jsxRuntime.jsx(Box, __assign({ css: { p: "$sm" } }, { children: row[column.accessorKey] }))) }), "cell ".concat(cellIndex)));
2004
+ }), 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));
2005
+ }), jsxRuntime.jsx(AddNewRow, { onAddRow: onAddRow, totalSplitFooter: totalSplitFooter })] })] }));
1965
2006
  };
1966
2007
  var Table = function (_a) {
1967
2008
  var rows = _a.rows, columns = _a.columns;
1968
- 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) {
1969
- return (jsxRuntime.jsx(Td, { children: row[column.accessorKey] }, "cell ".concat(cellIndex)));
2009
+ 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) {
2010
+ return (jsxRuntime.jsx(Td, __assign({ css: { color: "$light" } }, { children: row[column.accessorKey] }), "cell ".concat(cellIndex)));
1970
2011
  }) }, "row ".concat(rowIndex))); }) })] }));
1971
2012
  };
1972
2013
 
@@ -2270,6 +2311,7 @@ exports.TrashIcon = TrashIcon;
2270
2311
  exports.TrustMinimisedIcon = TrustMinimisedIcon;
2271
2312
  exports.TwitterIcon = TwitterIcon;
2272
2313
  exports.TwoColumnSection = TwoColumnSection;
2314
+ exports.WaitingIcon = WaitingIcon;
2273
2315
  exports.config = config;
2274
2316
  exports.createTheme = createTheme;
2275
2317
  exports.css = css;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-ui",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "license": "MIT",