@obolnetwork/obol-ui 1.0.11 → 1.0.14
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.
|
@@ -3,6 +3,7 @@ import * as Stitches from "@stitches/react";
|
|
|
3
3
|
export declare const IconButton: import("@stitches/react/types/styled-component").StyledComponent<"button", {
|
|
4
4
|
ghost?: boolean | "true" | undefined;
|
|
5
5
|
fullWidth?: boolean | "true" | undefined;
|
|
6
|
+
borderDisabled?: boolean | "true" | undefined;
|
|
6
7
|
}, {
|
|
7
8
|
motion: "(prefers-reduced-motion)";
|
|
8
9
|
hover: "(any-hover: hover)";
|
|
@@ -488,6 +489,7 @@ export declare type IconButtonComponentProps = IconButtonComponentVariants;
|
|
|
488
489
|
export declare const IconButtonStory: (props: Omit<import("@stitches/react/types/styled-component").TransformProps<{
|
|
489
490
|
ghost?: boolean | "true" | undefined;
|
|
490
491
|
fullWidth?: boolean | "true" | undefined;
|
|
492
|
+
borderDisabled?: boolean | "true" | undefined;
|
|
491
493
|
}, {
|
|
492
494
|
motion: "(prefers-reduced-motion)";
|
|
493
495
|
hover: "(any-hover: hover)";
|
|
@@ -498,9 +500,10 @@ export declare const IconButtonStory: (props: Omit<import("@stitches/react/types
|
|
|
498
500
|
bp2: "(min-width: 900px)";
|
|
499
501
|
md: "(max-width: 1200px)";
|
|
500
502
|
lg: "(max-width: 1800px)";
|
|
501
|
-
}>, "ghost" | "fullWidth"> & {
|
|
503
|
+
}>, "ghost" | "fullWidth" | "borderDisabled"> & {
|
|
502
504
|
ghost?: boolean | undefined;
|
|
503
505
|
fullWidth?: boolean | undefined;
|
|
506
|
+
borderDisabled?: boolean | undefined;
|
|
504
507
|
} & {
|
|
505
508
|
children?: import("react").ReactNode;
|
|
506
509
|
disabled?: boolean | undefined;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { FocusEventHandler } from "react";
|
|
2
2
|
interface NumberFieldProps {
|
|
3
|
-
value?: number;
|
|
4
|
-
onChangeValue?(value: number): void;
|
|
5
3
|
max?: number;
|
|
6
4
|
min?: number;
|
|
5
|
+
value?: number;
|
|
6
|
+
onChangeValue?(value: number): void;
|
|
7
|
+
onBlur?: FocusEventHandler<HTMLInputElement> | undefined;
|
|
8
|
+
name?: string;
|
|
7
9
|
}
|
|
8
10
|
export declare const NumberField: import("react").ForwardRefExoticComponent<NumberFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
9
11
|
export {};
|
|
@@ -5,15 +5,28 @@ export interface RowItem {
|
|
|
5
5
|
}
|
|
6
6
|
export declare type RowTableType = Record<string, string | React.ReactNode>;
|
|
7
7
|
export declare type RowsTableType = RowItem[];
|
|
8
|
+
export declare type CellDef = {
|
|
9
|
+
component: "TextField" | "NumberField";
|
|
10
|
+
config?: {
|
|
11
|
+
type: "text" | "number";
|
|
12
|
+
max: number;
|
|
13
|
+
min: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type ColumnDef<T> = {
|
|
17
|
+
accessorKey: keyof T;
|
|
18
|
+
header: string;
|
|
19
|
+
cell?: CellDef;
|
|
20
|
+
};
|
|
8
21
|
export interface TableProps {
|
|
9
|
-
rows:
|
|
10
|
-
columns:
|
|
22
|
+
rows: any[];
|
|
23
|
+
columns: ColumnDef<any>[];
|
|
11
24
|
}
|
|
12
25
|
export interface SplitterTableProps extends TableProps {
|
|
13
|
-
|
|
14
|
-
onAddRow(item: string): void;
|
|
26
|
+
onAddRow(item?: unknown): void;
|
|
15
27
|
onRemoveRow(item: string | number): void;
|
|
16
|
-
onUpdateRow(id: string, value: string): void;
|
|
28
|
+
onUpdateRow(id: string, value: string | number, accessorKey: unknown): void;
|
|
29
|
+
removeButton?: boolean;
|
|
17
30
|
}
|
|
18
31
|
export declare const SplitterTable: React.FC<SplitterTableProps>;
|
|
19
32
|
export declare const Table: React.FC<TableProps>;
|
package/dist/index.es.js
CHANGED
|
@@ -1199,6 +1199,7 @@ var IconButton = styled("button", {
|
|
|
1199
1199
|
color: "$muted",
|
|
1200
1200
|
},
|
|
1201
1201
|
margin: 0,
|
|
1202
|
+
border: "2px solid transparent",
|
|
1202
1203
|
variants: {
|
|
1203
1204
|
ghost: {
|
|
1204
1205
|
true: {
|
|
@@ -1215,6 +1216,11 @@ var IconButton = styled("button", {
|
|
|
1215
1216
|
width: "$full",
|
|
1216
1217
|
},
|
|
1217
1218
|
},
|
|
1219
|
+
borderDisabled: {
|
|
1220
|
+
true: {
|
|
1221
|
+
border: "2px solid $bg04",
|
|
1222
|
+
},
|
|
1223
|
+
},
|
|
1218
1224
|
},
|
|
1219
1225
|
});
|
|
1220
1226
|
var IconButtonStory = modifyVariantsForStory(IconButton);
|
|
@@ -1357,17 +1363,19 @@ var TextFieldWithCopy = forwardRef(function (props, ref) {
|
|
|
1357
1363
|
TextFieldWithCopy.displayName = "TextFieldWithCopy";
|
|
1358
1364
|
|
|
1359
1365
|
var NumberField = forwardRef(function (_a, ref) {
|
|
1360
|
-
var _b = _a.max, max = _b === void 0 ? 10 : _b, _c = _a.min, min = _c === void 0 ?
|
|
1366
|
+
var _b = _a.max, max = _b === void 0 ? 10 : _b, _c = _a.min, min = _c === void 0 ? 0 : _c, value = _a.value, onChangeValue = _a.onChangeValue, onBlur = _a.onBlur, name = _a.name;
|
|
1361
1367
|
var _d = useState(value || min), qty = _d[0], setQty = _d[1];
|
|
1362
|
-
var handleOnDec = function () {
|
|
1363
|
-
|
|
1368
|
+
var handleOnDec = function (e) {
|
|
1369
|
+
e.preventDefault();
|
|
1370
|
+
if (qty < min) {
|
|
1364
1371
|
setQty(min);
|
|
1365
1372
|
}
|
|
1366
1373
|
else {
|
|
1367
1374
|
setQty(qty - 1);
|
|
1368
1375
|
}
|
|
1369
1376
|
};
|
|
1370
|
-
var handleOnInc = function () {
|
|
1377
|
+
var handleOnInc = function (e) {
|
|
1378
|
+
e.preventDefault();
|
|
1371
1379
|
if (qty >= max) {
|
|
1372
1380
|
setQty(max);
|
|
1373
1381
|
}
|
|
@@ -1394,6 +1402,7 @@ var NumberField = forwardRef(function (_a, ref) {
|
|
|
1394
1402
|
}, [qty, onChangeValue]);
|
|
1395
1403
|
return (jsxs(Box, __assign({ css: {
|
|
1396
1404
|
display: "flex",
|
|
1405
|
+
maxHeight: "$3xl",
|
|
1397
1406
|
"input::-webkit-inner-spin-button": {
|
|
1398
1407
|
"-webkit-appearance": "none",
|
|
1399
1408
|
margin: 0,
|
|
@@ -1425,7 +1434,7 @@ var NumberField = forwardRef(function (_a, ref) {
|
|
|
1425
1434
|
borderRadius: 0,
|
|
1426
1435
|
width: "95px",
|
|
1427
1436
|
},
|
|
1428
|
-
} }, { children: [jsx(IconButton, __assign({ disabled: qty <= min, className: "dec-button", onClick:
|
|
1437
|
+
} }, { children: [jsx(IconButton, __assign({ disabled: qty <= min, className: "dec-button", onClick: handleOnDec, borderDisabled: qty <= min }, { children: "-" })), jsx(TextField, { css: { borderRightStyle: "none", borderLeftStyle: "none" }, type: "number", ref: ref, value: qty, onChange: handleOnChange, onBlur: onBlur, name: name }), jsx(IconButton, __assign({ disabled: qty >= max, className: "inc-button", onClick: handleOnInc, borderDisabled: qty >= max }, { children: "+" }))] })));
|
|
1429
1438
|
});
|
|
1430
1439
|
NumberField.displayName = "NumberField";
|
|
1431
1440
|
|
|
@@ -1749,14 +1758,14 @@ var ProgressTracker = function (props) {
|
|
|
1749
1758
|
display: "flex",
|
|
1750
1759
|
justifyContent: "space-between",
|
|
1751
1760
|
alignItems: "center",
|
|
1752
|
-
} }, { children: items.map(function (item, index) { return (jsx(Link, __assign({ disabled: item.status === "incomplete", href: item.status === "incomplete" ? "
|
|
1761
|
+
} }, { 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))); }) }))] })) })));
|
|
1753
1762
|
};
|
|
1754
1763
|
|
|
1755
1764
|
var StyledRadio = styled(RadioGroupPrimitive.Item, {
|
|
1756
1765
|
all: "unset",
|
|
1757
1766
|
backgroundColor: "$obolGreen",
|
|
1758
|
-
width:
|
|
1759
|
-
height:
|
|
1767
|
+
width: 22,
|
|
1768
|
+
height: 22,
|
|
1760
1769
|
borderRadius: "100%",
|
|
1761
1770
|
"&:hover": { filter: "brightness(90%)", cursor: "pointer" },
|
|
1762
1771
|
});
|
|
@@ -1771,10 +1780,10 @@ var StyledIndicator = styled(RadioGroupPrimitive.Indicator, {
|
|
|
1771
1780
|
content: '""',
|
|
1772
1781
|
display: "absolute",
|
|
1773
1782
|
position: "absolute",
|
|
1774
|
-
width:
|
|
1775
|
-
height:
|
|
1783
|
+
width: 10,
|
|
1784
|
+
height: 10,
|
|
1776
1785
|
borderRadius: "50%",
|
|
1777
|
-
boxShadow: "0 0 0
|
|
1786
|
+
boxShadow: "0 0 0 3px #0E1E22",
|
|
1778
1787
|
backgroundColor: "#2FE4AB",
|
|
1779
1788
|
},
|
|
1780
1789
|
});
|
|
@@ -1784,6 +1793,7 @@ var RadioGroupRadio = StyledRadio;
|
|
|
1784
1793
|
var RadioGroupIndicator = StyledIndicator;
|
|
1785
1794
|
var RadioGroupItemLabel = styled("label", {
|
|
1786
1795
|
color: "$textLight",
|
|
1796
|
+
fontWeight: "$bold",
|
|
1787
1797
|
fontSize: "$3",
|
|
1788
1798
|
lineHeight: 1,
|
|
1789
1799
|
userSelect: "none",
|
|
@@ -1793,7 +1803,7 @@ var RadioGroupItemLabel = styled("label", {
|
|
|
1793
1803
|
var RadioGroupItem = function (_a) {
|
|
1794
1804
|
var value = _a.value, label = _a.label, _b = _a.index, index = _b === void 0 ? 1 : _b;
|
|
1795
1805
|
var id = "id-:r".concat(index, ":");
|
|
1796
|
-
return (jsxs(Box, __assign({ css: { display: "flex", margin: "10px 0", alignItems: "center" } }, { children: [jsx(RadioGroupRadio, __assign({ value: value, id: id }, { children: jsx(RadioGroupPrimitive.RadioGroupIndicator, {}) })), jsx(RadioGroupItemLabel, __assign({ htmlFor: id }, { children: label }))] })));
|
|
1806
|
+
return (jsxs(Box, __assign({ css: { display: "flex", margin: "10px 0", alignItems: "center" } }, { children: [jsx(RadioGroupRadio, __assign({ value: value, id: id }, { children: jsx(RadioGroupPrimitive.RadioGroupIndicator, { className: "indicator" }) })), jsx(RadioGroupItemLabel, __assign({ htmlFor: id }, { children: label }))] })));
|
|
1797
1807
|
};
|
|
1798
1808
|
var RadioGroupComponent = function (_a) {
|
|
1799
1809
|
var items = _a.items, value = _a.value, onValueChange = _a.onValueChange, props = __rest(_a, ["items", "value", "onValueChange"]);
|
|
@@ -1805,7 +1815,7 @@ var StyledTable = styled("table", {
|
|
|
1805
1815
|
borderRadius: "2px",
|
|
1806
1816
|
backgroundColor: "$bg02",
|
|
1807
1817
|
borderStyle: "hidden",
|
|
1808
|
-
boxShadow: "0 0 0 2px $bg04",
|
|
1818
|
+
boxShadow: "0 0 0 2px $colors$bg04",
|
|
1809
1819
|
width: "100%",
|
|
1810
1820
|
"& thead": {
|
|
1811
1821
|
color: "$body",
|
|
@@ -1838,6 +1848,7 @@ var Td = styled("td", {
|
|
|
1838
1848
|
noPadding: {
|
|
1839
1849
|
true: {
|
|
1840
1850
|
p: 0,
|
|
1851
|
+
backgroundColor: "$bg03",
|
|
1841
1852
|
},
|
|
1842
1853
|
},
|
|
1843
1854
|
size: {
|
|
@@ -1865,18 +1876,35 @@ var AddNewRow = function (props) {
|
|
|
1865
1876
|
};
|
|
1866
1877
|
// Components
|
|
1867
1878
|
var SplitterTable = function (_a) {
|
|
1868
|
-
var rows = _a.rows, columns = _a.columns,
|
|
1869
|
-
return (jsxs(StyledTable, { children: [jsxs("thead", { children: [jsx(Td, {}), columns.map(function (column, index) { return (jsx(Td, __assign({ css: { textAlign: "start" } }, { children: column }), "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 })),
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1879
|
+
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;
|
|
1880
|
+
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) {
|
|
1881
|
+
var _a;
|
|
1882
|
+
var isTextField = !!column.cell;
|
|
1883
|
+
return (jsx(Td, __assign({ noPadding: true, css: {
|
|
1884
|
+
"input::-webkit-inner-spin-button": {
|
|
1885
|
+
"-webkit-appearance": "none",
|
|
1886
|
+
margin: 0,
|
|
1887
|
+
},
|
|
1888
|
+
/* Firefox */
|
|
1889
|
+
"input[type=number]": {
|
|
1890
|
+
"-moz-appearance": "textfield",
|
|
1891
|
+
},
|
|
1892
|
+
} }, { children: isTextField ? (jsx(TextField, __assign({ defaultValue: row[column.accessorKey], onInput: function (e) {
|
|
1893
|
+
if (Number(e.target.value) > 100)
|
|
1894
|
+
e.target.value = 100;
|
|
1895
|
+
}, onChange: function (e) {
|
|
1896
|
+
var _a, _b;
|
|
1897
|
+
var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
|
|
1898
|
+
? Number(e.target.value)
|
|
1899
|
+
: e.target.value;
|
|
1900
|
+
onUpdateRow(row.id, value, column.accessorKey);
|
|
1901
|
+
} }, (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config))) : (row[column.accessorKey]) }), "cell ".concat(cellIndex)));
|
|
1902
|
+
}), 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(); } })] })] }));
|
|
1875
1903
|
};
|
|
1876
1904
|
var Table = function (_a) {
|
|
1877
1905
|
var rows = _a.rows, columns = _a.columns;
|
|
1878
|
-
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:
|
|
1879
|
-
return (jsx(Td, { children: row.
|
|
1906
|
+
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) {
|
|
1907
|
+
return (jsx(Td, { children: row[column.accessorKey] }, "cell ".concat(cellIndex)));
|
|
1880
1908
|
}) }, "row ".concat(rowIndex))); }) })] }));
|
|
1881
1909
|
};
|
|
1882
1910
|
|
package/dist/index.js
CHANGED
|
@@ -1231,6 +1231,7 @@ var IconButton = styled("button", {
|
|
|
1231
1231
|
color: "$muted",
|
|
1232
1232
|
},
|
|
1233
1233
|
margin: 0,
|
|
1234
|
+
border: "2px solid transparent",
|
|
1234
1235
|
variants: {
|
|
1235
1236
|
ghost: {
|
|
1236
1237
|
true: {
|
|
@@ -1247,6 +1248,11 @@ var IconButton = styled("button", {
|
|
|
1247
1248
|
width: "$full",
|
|
1248
1249
|
},
|
|
1249
1250
|
},
|
|
1251
|
+
borderDisabled: {
|
|
1252
|
+
true: {
|
|
1253
|
+
border: "2px solid $bg04",
|
|
1254
|
+
},
|
|
1255
|
+
},
|
|
1250
1256
|
},
|
|
1251
1257
|
});
|
|
1252
1258
|
var IconButtonStory = modifyVariantsForStory(IconButton);
|
|
@@ -1389,17 +1395,19 @@ var TextFieldWithCopy = React.forwardRef(function (props, ref) {
|
|
|
1389
1395
|
TextFieldWithCopy.displayName = "TextFieldWithCopy";
|
|
1390
1396
|
|
|
1391
1397
|
var NumberField = React.forwardRef(function (_a, ref) {
|
|
1392
|
-
var _b = _a.max, max = _b === void 0 ? 10 : _b, _c = _a.min, min = _c === void 0 ?
|
|
1398
|
+
var _b = _a.max, max = _b === void 0 ? 10 : _b, _c = _a.min, min = _c === void 0 ? 0 : _c, value = _a.value, onChangeValue = _a.onChangeValue, onBlur = _a.onBlur, name = _a.name;
|
|
1393
1399
|
var _d = React.useState(value || min), qty = _d[0], setQty = _d[1];
|
|
1394
|
-
var handleOnDec = function () {
|
|
1395
|
-
|
|
1400
|
+
var handleOnDec = function (e) {
|
|
1401
|
+
e.preventDefault();
|
|
1402
|
+
if (qty < min) {
|
|
1396
1403
|
setQty(min);
|
|
1397
1404
|
}
|
|
1398
1405
|
else {
|
|
1399
1406
|
setQty(qty - 1);
|
|
1400
1407
|
}
|
|
1401
1408
|
};
|
|
1402
|
-
var handleOnInc = function () {
|
|
1409
|
+
var handleOnInc = function (e) {
|
|
1410
|
+
e.preventDefault();
|
|
1403
1411
|
if (qty >= max) {
|
|
1404
1412
|
setQty(max);
|
|
1405
1413
|
}
|
|
@@ -1426,6 +1434,7 @@ var NumberField = React.forwardRef(function (_a, ref) {
|
|
|
1426
1434
|
}, [qty, onChangeValue]);
|
|
1427
1435
|
return (jsxRuntime.jsxs(Box, __assign({ css: {
|
|
1428
1436
|
display: "flex",
|
|
1437
|
+
maxHeight: "$3xl",
|
|
1429
1438
|
"input::-webkit-inner-spin-button": {
|
|
1430
1439
|
"-webkit-appearance": "none",
|
|
1431
1440
|
margin: 0,
|
|
@@ -1457,7 +1466,7 @@ var NumberField = React.forwardRef(function (_a, ref) {
|
|
|
1457
1466
|
borderRadius: 0,
|
|
1458
1467
|
width: "95px",
|
|
1459
1468
|
},
|
|
1460
|
-
} }, { children: [jsxRuntime.jsx(IconButton, __assign({ disabled: qty <= min, className: "dec-button", onClick:
|
|
1469
|
+
} }, { children: [jsxRuntime.jsx(IconButton, __assign({ disabled: qty <= min, className: "dec-button", onClick: handleOnDec, borderDisabled: qty <= min }, { children: "-" })), jsxRuntime.jsx(TextField, { css: { borderRightStyle: "none", borderLeftStyle: "none" }, type: "number", ref: ref, value: qty, onChange: handleOnChange, onBlur: onBlur, name: name }), jsxRuntime.jsx(IconButton, __assign({ disabled: qty >= max, className: "inc-button", onClick: handleOnInc, borderDisabled: qty >= max }, { children: "+" }))] })));
|
|
1461
1470
|
});
|
|
1462
1471
|
NumberField.displayName = "NumberField";
|
|
1463
1472
|
|
|
@@ -1781,14 +1790,14 @@ var ProgressTracker = function (props) {
|
|
|
1781
1790
|
display: "flex",
|
|
1782
1791
|
justifyContent: "space-between",
|
|
1783
1792
|
alignItems: "center",
|
|
1784
|
-
} }, { children: items.map(function (item, index) { return (jsxRuntime.jsx(Link, __assign({ disabled: item.status === "incomplete", href: item.status === "incomplete" ? "
|
|
1793
|
+
} }, { 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))); }) }))] })) })));
|
|
1785
1794
|
};
|
|
1786
1795
|
|
|
1787
1796
|
var StyledRadio = styled(RadioGroupPrimitive__namespace.Item, {
|
|
1788
1797
|
all: "unset",
|
|
1789
1798
|
backgroundColor: "$obolGreen",
|
|
1790
|
-
width:
|
|
1791
|
-
height:
|
|
1799
|
+
width: 22,
|
|
1800
|
+
height: 22,
|
|
1792
1801
|
borderRadius: "100%",
|
|
1793
1802
|
"&:hover": { filter: "brightness(90%)", cursor: "pointer" },
|
|
1794
1803
|
});
|
|
@@ -1803,10 +1812,10 @@ var StyledIndicator = styled(RadioGroupPrimitive__namespace.Indicator, {
|
|
|
1803
1812
|
content: '""',
|
|
1804
1813
|
display: "absolute",
|
|
1805
1814
|
position: "absolute",
|
|
1806
|
-
width:
|
|
1807
|
-
height:
|
|
1815
|
+
width: 10,
|
|
1816
|
+
height: 10,
|
|
1808
1817
|
borderRadius: "50%",
|
|
1809
|
-
boxShadow: "0 0 0
|
|
1818
|
+
boxShadow: "0 0 0 3px #0E1E22",
|
|
1810
1819
|
backgroundColor: "#2FE4AB",
|
|
1811
1820
|
},
|
|
1812
1821
|
});
|
|
@@ -1816,6 +1825,7 @@ var RadioGroupRadio = StyledRadio;
|
|
|
1816
1825
|
var RadioGroupIndicator = StyledIndicator;
|
|
1817
1826
|
var RadioGroupItemLabel = styled("label", {
|
|
1818
1827
|
color: "$textLight",
|
|
1828
|
+
fontWeight: "$bold",
|
|
1819
1829
|
fontSize: "$3",
|
|
1820
1830
|
lineHeight: 1,
|
|
1821
1831
|
userSelect: "none",
|
|
@@ -1825,7 +1835,7 @@ var RadioGroupItemLabel = styled("label", {
|
|
|
1825
1835
|
var RadioGroupItem = function (_a) {
|
|
1826
1836
|
var value = _a.value, label = _a.label, _b = _a.index, index = _b === void 0 ? 1 : _b;
|
|
1827
1837
|
var id = "id-:r".concat(index, ":");
|
|
1828
|
-
return (jsxRuntime.jsxs(Box, __assign({ css: { display: "flex", margin: "10px 0", alignItems: "center" } }, { children: [jsxRuntime.jsx(RadioGroupRadio, __assign({ value: value, id: id }, { children: jsxRuntime.jsx(RadioGroupPrimitive__namespace.RadioGroupIndicator, {}) })), jsxRuntime.jsx(RadioGroupItemLabel, __assign({ htmlFor: id }, { children: label }))] })));
|
|
1838
|
+
return (jsxRuntime.jsxs(Box, __assign({ css: { display: "flex", margin: "10px 0", alignItems: "center" } }, { children: [jsxRuntime.jsx(RadioGroupRadio, __assign({ value: value, id: id }, { children: jsxRuntime.jsx(RadioGroupPrimitive__namespace.RadioGroupIndicator, { className: "indicator" }) })), jsxRuntime.jsx(RadioGroupItemLabel, __assign({ htmlFor: id }, { children: label }))] })));
|
|
1829
1839
|
};
|
|
1830
1840
|
var RadioGroupComponent = function (_a) {
|
|
1831
1841
|
var items = _a.items, value = _a.value, onValueChange = _a.onValueChange, props = __rest(_a, ["items", "value", "onValueChange"]);
|
|
@@ -1837,7 +1847,7 @@ var StyledTable = styled("table", {
|
|
|
1837
1847
|
borderRadius: "2px",
|
|
1838
1848
|
backgroundColor: "$bg02",
|
|
1839
1849
|
borderStyle: "hidden",
|
|
1840
|
-
boxShadow: "0 0 0 2px $bg04",
|
|
1850
|
+
boxShadow: "0 0 0 2px $colors$bg04",
|
|
1841
1851
|
width: "100%",
|
|
1842
1852
|
"& thead": {
|
|
1843
1853
|
color: "$body",
|
|
@@ -1870,6 +1880,7 @@ var Td = styled("td", {
|
|
|
1870
1880
|
noPadding: {
|
|
1871
1881
|
true: {
|
|
1872
1882
|
p: 0,
|
|
1883
|
+
backgroundColor: "$bg03",
|
|
1873
1884
|
},
|
|
1874
1885
|
},
|
|
1875
1886
|
size: {
|
|
@@ -1897,18 +1908,35 @@ var AddNewRow = function (props) {
|
|
|
1897
1908
|
};
|
|
1898
1909
|
// Components
|
|
1899
1910
|
var SplitterTable = function (_a) {
|
|
1900
|
-
var rows = _a.rows, columns = _a.columns,
|
|
1901
|
-
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-".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 })),
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1911
|
+
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;
|
|
1912
|
+
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) {
|
|
1913
|
+
var _a;
|
|
1914
|
+
var isTextField = !!column.cell;
|
|
1915
|
+
return (jsxRuntime.jsx(Td, __assign({ noPadding: true, css: {
|
|
1916
|
+
"input::-webkit-inner-spin-button": {
|
|
1917
|
+
"-webkit-appearance": "none",
|
|
1918
|
+
margin: 0,
|
|
1919
|
+
},
|
|
1920
|
+
/* Firefox */
|
|
1921
|
+
"input[type=number]": {
|
|
1922
|
+
"-moz-appearance": "textfield",
|
|
1923
|
+
},
|
|
1924
|
+
} }, { children: isTextField ? (jsxRuntime.jsx(TextField, __assign({ defaultValue: row[column.accessorKey], onInput: function (e) {
|
|
1925
|
+
if (Number(e.target.value) > 100)
|
|
1926
|
+
e.target.value = 100;
|
|
1927
|
+
}, onChange: function (e) {
|
|
1928
|
+
var _a, _b;
|
|
1929
|
+
var value = ((_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.type) === "number"
|
|
1930
|
+
? Number(e.target.value)
|
|
1931
|
+
: e.target.value;
|
|
1932
|
+
onUpdateRow(row.id, value, column.accessorKey);
|
|
1933
|
+
} }, (_a = column.cell) === null || _a === void 0 ? void 0 : _a.config))) : (row[column.accessorKey]) }), "cell ".concat(cellIndex)));
|
|
1934
|
+
}), 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(); } })] })] }));
|
|
1907
1935
|
};
|
|
1908
1936
|
var Table = function (_a) {
|
|
1909
1937
|
var rows = _a.rows, columns = _a.columns;
|
|
1910
|
-
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:
|
|
1911
|
-
return (jsxRuntime.jsx(Td, { children: row.
|
|
1938
|
+
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) {
|
|
1939
|
+
return (jsxRuntime.jsx(Td, { children: row[column.accessorKey] }, "cell ".concat(cellIndex)));
|
|
1912
1940
|
}) }, "row ".concat(rowIndex))); }) })] }));
|
|
1913
1941
|
};
|
|
1914
1942
|
|