@gobolt/genesis 0.3.22 → 0.3.23
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.
- package/dist/components/Badge/Badge.js +32 -9
- package/dist/components/Badge/styles.d.ts +10 -1
- package/dist/components/Badge/styles.js +14 -39
- package/dist/components/Button/Button.js +27 -4
- package/dist/components/Button/IconButton.js +27 -4
- package/dist/components/Button/components/Button/Button.d.ts +16 -0
- package/dist/components/Button/components/Button/Button.js +13 -0
- package/dist/components/Button/components/Button/styles.d.ts +1 -0
- package/dist/components/Button/components/Button/styles.js +118 -0
- package/dist/components/Button/constants/index.d.ts +163 -0
- package/dist/components/Button/constants/index.js +89 -0
- package/dist/components/Button/icon-button-styles.d.ts +12 -1
- package/dist/components/Button/icon-button-styles.js +16 -69
- package/dist/components/Button/styles.d.ts +16 -1
- package/dist/components/Button/styles.js +30 -88
- package/dist/components/Input/Input.js +29 -6
- package/dist/components/Input/styles.d.ts +18 -1
- package/dist/components/Input/styles.js +42 -146
- package/dist/components/Select/Select.js +125 -101
- package/dist/components/Select/SelectTrigger.js +57 -71
- package/dist/components/Table/Table.js +27 -8
- package/dist/components/Table/TableControls/CustomPagination.js +66 -50
- package/dist/components/Table/TableControls/PaginationNumber.js +43 -27
- package/dist/components/Table/TableControls/PrimaryTableControlsRow.js +17 -16
- package/dist/components/Table/TableControls/SecondaryTableControlsRow.js +36 -14
- package/dist/components/Table/TableControls/TableControls.js +4 -3
- package/dist/components/Table/TablePagination.js +21 -4
- package/dist/components/Table/__mocks__/table-mocks.js +24 -15
- package/dist/components/Table/styles.d.ts +15 -1
- package/dist/components/Table/styles.js +13 -57
- package/dist/components/Table/useTable.js +166 -69
- package/dist/components/TableWithControls/TableWithControls.js +7 -6
- package/dist/components/TableWithControls/components/Badge/Badge.d.ts +16 -0
- package/dist/components/TableWithControls/components/Badge/Badge.js +28 -0
- package/dist/components/TableWithControls/components/Badge/index.d.ts +2 -0
- package/dist/components/TableWithControls/components/Badge/index.js +1 -0
- package/dist/components/TableWithControls/components/Badge/styles.d.ts +4 -0
- package/dist/components/TableWithControls/components/Badge/styles.js +46 -0
- package/dist/components/TableWithControls/components/Button/Button.d.ts +16 -0
- package/dist/components/TableWithControls/components/Button/Button.js +13 -0
- package/dist/components/TableWithControls/components/Button/IconButton.d.ts +8 -0
- package/dist/components/TableWithControls/components/Button/IconButton.js +9 -0
- package/dist/components/TableWithControls/components/Button/icon-button-styles.d.ts +1 -0
- package/dist/components/TableWithControls/components/Button/icon-button-styles.js +76 -0
- package/dist/components/TableWithControls/components/Button/index.d.ts +4 -0
- package/dist/components/TableWithControls/components/Button/index.js +2 -0
- package/dist/components/TableWithControls/components/Button/styles.d.ts +1 -0
- package/dist/components/TableWithControls/components/Button/styles.js +118 -0
- package/dist/components/TableWithControls/components/Input/Input.d.ts +13 -0
- package/dist/components/TableWithControls/components/Input/Input.js +34 -0
- package/dist/components/TableWithControls/components/Input/index.d.ts +2 -0
- package/dist/components/TableWithControls/components/Input/index.js +1 -0
- package/dist/components/TableWithControls/components/Input/styles.d.ts +1 -0
- package/dist/components/TableWithControls/components/Input/styles.js +180 -0
- package/dist/components/TableWithControls/components/Select/Select.d.ts +26 -0
- package/dist/components/TableWithControls/components/Select/Select.js +175 -0
- package/dist/components/TableWithControls/components/Select/SelectTrigger.d.ts +23 -0
- package/dist/components/TableWithControls/components/Select/SelectTrigger.js +103 -0
- package/dist/components/TableWithControls/components/Select/index.d.ts +2 -0
- package/dist/components/TableWithControls/components/Select/index.js +1 -0
- package/dist/components/TableWithControls/components/Table/Table.d.ts +51 -0
- package/dist/components/TableWithControls/components/Table/Table.js +14 -0
- package/dist/components/TableWithControls/components/Table/TableControls/CustomPagination.d.ts +13 -0
- package/dist/components/TableWithControls/components/Table/TableControls/CustomPagination.js +158 -0
- package/dist/components/TableWithControls/components/Table/TableControls/PaginationNumber.d.ts +7 -0
- package/dist/components/TableWithControls/components/Table/TableControls/PaginationNumber.js +30 -0
- package/dist/components/TableWithControls/components/Table/TableControls/PrimaryTableControlsRow.d.ts +18 -0
- package/dist/components/TableWithControls/components/Table/TableControls/PrimaryTableControlsRow.js +77 -0
- package/dist/components/TableWithControls/components/Table/TableControls/SecondaryTableControlsRow.d.ts +11 -0
- package/dist/components/TableWithControls/components/Table/TableControls/SecondaryTableControlsRow.js +43 -0
- package/dist/components/TableWithControls/components/Table/TableControls/TableControls.d.ts +14 -0
- package/dist/components/TableWithControls/components/Table/TableControls/TableControls.js +13 -0
- package/dist/components/TableWithControls/components/Table/TableControls/index.d.ts +2 -0
- package/dist/components/TableWithControls/components/Table/TableControls/index.js +1 -0
- package/dist/components/TableWithControls/components/Table/TablePagination.d.ts +13 -0
- package/dist/components/TableWithControls/components/Table/TablePagination.js +11 -0
- package/dist/components/TableWithControls/components/Table/__mocks__/table-mocks.d.ts +20 -0
- package/dist/components/TableWithControls/components/Table/__mocks__/table-mocks.js +301 -0
- package/dist/components/TableWithControls/components/Table/index.d.ts +6 -0
- package/dist/components/TableWithControls/components/Table/index.js +3 -0
- package/dist/components/TableWithControls/components/Table/styles.d.ts +14 -0
- package/dist/components/TableWithControls/components/Table/styles.js +64 -0
- package/dist/components/TableWithControls/components/Table/useTable.d.ts +26 -0
- package/dist/components/TableWithControls/components/Table/useTable.js +141 -0
- package/dist/components/TableWithControls/components/TableWithControls/TableWithControls.d.ts +12 -0
- package/dist/components/TableWithControls/components/TableWithControls/TableWithControls.js +20 -0
- package/dist/components/TableWithControls/components/TableWithControls/useTableWithControls.d.ts +29 -0
- package/dist/components/TableWithControls/components/TableWithControls/useTableWithControls.js +136 -0
- package/dist/components/TableWithControls/components/Tooltip/Tooltip.d.ts +7 -0
- package/dist/components/TableWithControls/components/Tooltip/Tooltip.js +8 -0
- package/dist/components/TableWithControls/components/Tooltip/index.d.ts +2 -0
- package/dist/components/TableWithControls/components/Tooltip/index.js +1 -0
- package/dist/components/TableWithControls/components/Tooltip/styles.d.ts +6 -0
- package/dist/components/TableWithControls/components/Tooltip/styles.js +26 -0
- package/dist/components/TableWithControls/components/Typography/Typography.d.ts +17 -0
- package/dist/components/TableWithControls/components/Typography/Typography.js +16 -0
- package/dist/components/TableWithControls/components/Typography/index.d.ts +2 -0
- package/dist/components/TableWithControls/components/Typography/index.js +1 -0
- package/dist/components/TableWithControls/components/Typography/styles.d.ts +3 -0
- package/dist/components/TableWithControls/components/Typography/styles.js +54 -0
- package/dist/components/TableWithControls/components/UtilityButton/UtilityButton.d.ts +5 -0
- package/dist/components/TableWithControls/components/UtilityButton/UtilityButton.js +9 -0
- package/dist/components/TableWithControls/components/UtilityButton/index.d.ts +2 -0
- package/dist/components/TableWithControls/components/UtilityButton/index.js +1 -0
- package/dist/components/TableWithControls/components/shared/DropdownChevron.d.ts +2 -0
- package/dist/components/TableWithControls/components/shared/DropdownChevron.js +7 -0
- package/dist/components/TableWithControls/constants/index.d.ts +163 -0
- package/dist/components/TableWithControls/constants/index.js +89 -0
- package/dist/components/TableWithControls/types/events.d.ts +22 -0
- package/dist/components/TableWithControls/types/events.js +1 -0
- package/dist/components/TableWithControls/useTableWithControls.js +63 -82
- package/dist/components/TableWithControls/utils/icon-util.d.ts +3 -0
- package/dist/components/TableWithControls/utils/icon-util.js +116 -0
- package/dist/components/Tooltip/Tooltip.js +2 -1
- package/dist/components/Tooltip/styles.d.ts +14 -1
- package/dist/components/Tooltip/styles.js +14 -23
- package/dist/components/Typography/Typography.js +29 -6
- package/dist/components/Typography/styles.d.ts +21 -3
- package/dist/components/Typography/styles.js +24 -41
- package/dist/components/UtilityButton/UtilityButton.js +27 -4
- package/dist/components/UtilityButton/components/Button/Button.d.ts +16 -0
- package/dist/components/UtilityButton/components/Button/Button.js +13 -0
- package/dist/components/UtilityButton/components/Button/IconButton.d.ts +8 -0
- package/dist/components/UtilityButton/components/Button/IconButton.js +9 -0
- package/dist/components/UtilityButton/components/Button/icon-button-styles.d.ts +1 -0
- package/dist/components/UtilityButton/components/Button/icon-button-styles.js +76 -0
- package/dist/components/UtilityButton/components/Button/index.d.ts +4 -0
- package/dist/components/UtilityButton/components/Button/index.js +2 -0
- package/dist/components/UtilityButton/components/Button/styles.d.ts +1 -0
- package/dist/components/UtilityButton/components/Button/styles.js +118 -0
- package/dist/components/UtilityButton/components/UtilityButton/UtilityButton.d.ts +5 -0
- package/dist/components/UtilityButton/components/UtilityButton/UtilityButton.js +9 -0
- package/dist/components/UtilityButton/constants/index.d.ts +163 -0
- package/dist/components/UtilityButton/constants/index.js +89 -0
- package/dist/components/index.d.ts +6 -6
- package/dist/components/index.js +7 -0
- package/dist/components/index.ts +6 -6
- package/dist/components/shared/DropdownChevron.js +14 -3
- package/dist/index.d.ts +9 -9
- package/dist/index.js +10 -89
- package/dist/index.ts +9 -9
- package/dist/utils/icon-util.d.ts +2 -2
- package/dist/utils/icon-util.js +19 -16
- package/package.json +1 -1
- package/dist/components/Button/Button.tsx +0 -59
- package/dist/components/Table/Table.tsx +0 -112
- package/dist/components/Table/useTable.ts +0 -194
- package/dist/components/TableWithControls/TableWithControls.tsx +0 -54
- package/dist/components/TableWithControls/useTableWithControls.tsx +0 -161
- package/dist/components/UtilityButton/UtilityButton.tsx +0 -36
- package/dist/constants/index.ts +0 -98
- package/dist/genesis-theme.types.d.ts +0 -263
- package/dist/genesis-theme.types.js +0 -6
- package/dist/styled.d.ts +0 -1
- package/dist/styled.js +0 -44
- package/dist/styles/theme/genesis-theme.types.ts +0 -297
- package/dist/utils/styled.ts +0 -52
- /package/dist/{Table → components/Table/Table}/Table.d.ts +0 -0
- /package/dist/{Table → components/Table/Table}/Table.js +0 -0
- /package/dist/{Table → components/Table/Table}/TableControls/CustomPagination.d.ts +0 -0
- /package/dist/{Table → components/Table/Table}/TableControls/CustomPagination.js +0 -0
- /package/dist/{Table → components/Table/Table}/TableControls/PaginationNumber.d.ts +0 -0
- /package/dist/{Table → components/Table/Table}/TableControls/PaginationNumber.js +0 -0
- /package/dist/{Table → components/Table/Table}/styles.d.ts +0 -0
- /package/dist/{Table → components/Table/Table}/styles.js +0 -0
- /package/dist/{Table → components/Table/Table}/useTable.d.ts +0 -0
- /package/dist/{Table → components/Table/Table}/useTable.js +0 -0
- /package/dist/{Typography → components/Table/Typography}/Typography.d.ts +0 -0
- /package/dist/{Typography → components/Table/Typography}/Typography.js +0 -0
- /package/dist/{Typography → components/Table/Typography}/index.d.ts +0 -0
- /package/dist/{Typography → components/Table/Typography}/index.js +0 -0
- /package/dist/{Typography → components/Table/Typography}/styles.d.ts +0 -0
- /package/dist/{Typography → components/Table/Typography}/styles.js +0 -0
|
@@ -1,64 +1,20 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
1
5
|
import styled from "@gobolt/genesis/utils/styled";
|
|
2
6
|
import { Table as AntTable } from "antd";
|
|
3
|
-
export
|
|
7
|
+
export var getGenesisClass = function (_a, $isMainContentCell) {
|
|
4
8
|
// Log the hovered color and the entire tableCell object
|
|
5
|
-
|
|
6
|
-
&.ant-table-wrapper {
|
|
7
|
-
// Add your custom styles here
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.ant-table {
|
|
11
|
-
// Add your custom table styles here
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.ant-table-cell {
|
|
15
|
-
font-size: ${$isMainContentCell ? "16px" : "14px"} !important;
|
|
16
|
-
color: ${$isMainContentCell
|
|
9
|
+
var colors = _a.colors, borderRadius = _a.borderRadius, sizing = _a.sizing, typography = _a.typography, components = _a.components;
|
|
10
|
+
return "\n &.ant-table-wrapper {\n // Add your custom styles here\n }\n\n .ant-table {\n // Add your custom table styles here\n }\n\n .ant-table-cell {\n font-size: ".concat($isMainContentCell ? "16px" : "14px", " !important;\n color: ").concat($isMainContentCell
|
|
17
11
|
? colors.onsurface.copy
|
|
18
|
-
: colors.onsurface["copy-light"]} !important
|
|
19
|
-
background-color: ${components.tableCell.surface} !important;
|
|
20
|
-
transition: background-color 0.2s ease;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.ant-table-tbody > tr:hover > td,
|
|
24
|
-
.ant-table-tbody > tr:hover > .ant-table-cell {
|
|
25
|
-
background-color: ${components.tableCell.hover} !important;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.ant-table-cell-selected {
|
|
29
|
-
background-color: ${components.tableCell.selected} !important;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.ant-table-thead > tr > th {
|
|
33
|
-
// Add your custom header styles here
|
|
34
|
-
font-family: 'Inter', sans-serif;
|
|
35
|
-
font-size: ${$isMainContentCell ? "16px" : "14px"} !important;
|
|
36
|
-
font-weight: 400;
|
|
37
|
-
color: ${$isMainContentCell
|
|
12
|
+
: colors.onsurface["copy-light"], " !important;\n background-color: ").concat(components.tableCell.surface, " !important;\n transition: background-color 0.2s ease;\n }\n\n .ant-table-tbody > tr:hover > td,\n .ant-table-tbody > tr:hover > .ant-table-cell {\n background-color: ").concat(components.tableCell.hover, " !important;\n }\n\n .ant-table-cell-selected {\n background-color: ").concat(components.tableCell.selected, " !important;\n }\n\n .ant-table-thead > tr > th {\n // Add your custom header styles here\n font-family: 'Inter', sans-serif;\n font-size: ").concat($isMainContentCell ? "16px" : "14px", " !important;\n font-weight: 400;\n color: ").concat($isMainContentCell
|
|
38
13
|
? colors.onsurface.copy
|
|
39
|
-
: colors.onsurface["copy-light"]} !important;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.ant-table-tbody > tr {
|
|
43
|
-
// Add your custom row styles here
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ant-table-tbody > tr > td {
|
|
47
|
-
// Add your custom cell styles here
|
|
48
|
-
font-family: 'Inter', sans-serif;
|
|
49
|
-
font-size: 14px;
|
|
50
|
-
color: ${colors.onsurface["copy-light"]};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.ant-table-tbody > tr.ant-table-row-selected > td,
|
|
54
|
-
.ant-table-tbody > tr.ant-table-row-selected > .ant-table-cell {
|
|
55
|
-
background-color: ${components.tableCell.selected} !important;
|
|
56
|
-
color: #fff !important;
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
14
|
+
: colors.onsurface["copy-light"], " !important;\n }\n\n .ant-table-tbody > tr {\n // Add your custom row styles here\n }\n\n .ant-table-tbody > tr > td {\n // Add your custom cell styles here\n font-family: 'Inter', sans-serif;\n font-size: 14px;\n color: ").concat(colors.onsurface["copy-light"], ";\n }\n\n .ant-table-tbody > tr.ant-table-row-selected > td,\n .ant-table-tbody > tr.ant-table-row-selected > .ant-table-cell {\n background-color: ").concat(components.tableCell.selected, " !important;\n color: #fff !important;\n }\n ");
|
|
59
15
|
};
|
|
60
|
-
export
|
|
61
|
-
|
|
16
|
+
export var Table = styled(AntTable)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
17
|
+
var theme = _a.theme, $isMainContentCell = _a.$isMainContentCell;
|
|
62
18
|
return getGenesisClass(theme, $isMainContentCell);
|
|
63
|
-
}
|
|
64
|
-
|
|
19
|
+
});
|
|
20
|
+
var templateObject_1;
|
|
@@ -1,33 +1,127 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
49
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
50
|
+
if (!m) return o;
|
|
51
|
+
var i = m.call(o), r, ar = [], e;
|
|
52
|
+
try {
|
|
53
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
54
|
+
}
|
|
55
|
+
catch (error) { e = { error: error }; }
|
|
56
|
+
finally {
|
|
57
|
+
try {
|
|
58
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
59
|
+
}
|
|
60
|
+
finally { if (e) throw e.error; }
|
|
61
|
+
}
|
|
62
|
+
return ar;
|
|
63
|
+
};
|
|
64
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
65
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
66
|
+
if (ar || !(i in from)) {
|
|
67
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
68
|
+
ar[i] = from[i];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
72
|
+
};
|
|
73
|
+
var __values = (this && this.__values) || function(o) {
|
|
74
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
75
|
+
if (m) return m.call(o);
|
|
76
|
+
if (o && typeof o.length === "number") return {
|
|
77
|
+
next: function () {
|
|
78
|
+
if (o && i >= o.length) o = void 0;
|
|
79
|
+
return { value: o && o[i++], done: !o };
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
83
|
+
};
|
|
1
84
|
import { useState, useEffect, useCallback } from "react";
|
|
2
85
|
// Function to sort data by field and order
|
|
3
|
-
|
|
86
|
+
var sortData = function (data, sorter) {
|
|
4
87
|
// Handle case when no sorting is applied
|
|
5
88
|
if (!sorter || (Array.isArray(sorter) && sorter.length === 0)) {
|
|
6
|
-
return [
|
|
89
|
+
return __spreadArray([], __read(data), false);
|
|
7
90
|
}
|
|
8
91
|
// Handle multiple sorters
|
|
9
92
|
if (Array.isArray(sorter)) {
|
|
10
|
-
return [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
93
|
+
return __spreadArray([], __read(data), false).sort(function (a, b) {
|
|
94
|
+
var e_1, _a;
|
|
95
|
+
try {
|
|
96
|
+
for (var sorter_1 = __values(sorter), sorter_1_1 = sorter_1.next(); !sorter_1_1.done; sorter_1_1 = sorter_1.next()) {
|
|
97
|
+
var sort = sorter_1_1.value;
|
|
98
|
+
if (!sort.field)
|
|
99
|
+
continue;
|
|
100
|
+
var field = sort.field;
|
|
101
|
+
var aValue = a[field];
|
|
102
|
+
var bValue = b[field];
|
|
103
|
+
if (aValue < bValue)
|
|
104
|
+
return sort.order === "ascend" ? -1 : 1;
|
|
105
|
+
if (aValue > bValue)
|
|
106
|
+
return sort.order === "ascend" ? 1 : -1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
110
|
+
finally {
|
|
111
|
+
try {
|
|
112
|
+
if (sorter_1_1 && !sorter_1_1.done && (_a = sorter_1.return)) _a.call(sorter_1);
|
|
113
|
+
}
|
|
114
|
+
finally { if (e_1) throw e_1.error; }
|
|
21
115
|
}
|
|
22
116
|
return 0;
|
|
23
117
|
});
|
|
24
118
|
}
|
|
25
119
|
// Handle single sorter
|
|
26
120
|
if (sorter.field) {
|
|
27
|
-
|
|
28
|
-
return [
|
|
29
|
-
|
|
30
|
-
|
|
121
|
+
var field_1 = sorter.field;
|
|
122
|
+
return __spreadArray([], __read(data), false).sort(function (a, b) {
|
|
123
|
+
var aValue = a[field_1];
|
|
124
|
+
var bValue = b[field_1];
|
|
31
125
|
if (sorter.order === "ascend") {
|
|
32
126
|
if (aValue < bValue)
|
|
33
127
|
return -1;
|
|
@@ -45,7 +139,7 @@ const sortData = (data, sorter) => {
|
|
|
45
139
|
return 0;
|
|
46
140
|
});
|
|
47
141
|
}
|
|
48
|
-
return [
|
|
142
|
+
return __spreadArray([], __read(data), false);
|
|
49
143
|
};
|
|
50
144
|
/*
|
|
51
145
|
Example of disableRowSelection function which can be passed to the useTable hook
|
|
@@ -54,59 +148,71 @@ const disableRowSelection = (record: any) => ({
|
|
|
54
148
|
name: record.status.toString(),
|
|
55
149
|
});
|
|
56
150
|
*/
|
|
57
|
-
|
|
151
|
+
var defaultRowSelection = function (record) { return ({
|
|
58
152
|
disabled: false, // Add your disable logic here
|
|
59
153
|
name: record.id,
|
|
60
|
-
});
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
154
|
+
}); };
|
|
155
|
+
export var useTable = function (useTableConfig) {
|
|
156
|
+
var _a = __read(useState(true), 2), isLoading = _a[0], setLoading = _a[1];
|
|
157
|
+
var _b = useTableConfig, columns = _b.columns, _c = _b.filters, filters = _c === void 0 ? null : _c, _d = _b.fetchUrl, fetchUrl = _d === void 0 ? "/table/data" : _d, _e = _b.fetchOptions, fetchOptions = _e === void 0 ? {
|
|
64
158
|
method: "POST",
|
|
65
159
|
headers: {
|
|
66
160
|
"Content-Type": "application/json",
|
|
67
161
|
},
|
|
68
162
|
body: JSON.stringify(filters),
|
|
69
|
-
}, selectionType = "checkbox", simulateDelay = 0, disableRowSelection = defaultRowSelection, disableAutoFetch = false, dataSource
|
|
163
|
+
} : _e, _f = _b.selectionType, selectionType = _f === void 0 ? "checkbox" : _f, _g = _b.simulateDelay, simulateDelay = _g === void 0 ? 0 : _g, _h = _b.disableRowSelection, disableRowSelection = _h === void 0 ? defaultRowSelection : _h, _j = _b.disableAutoFetch, disableAutoFetch = _j === void 0 ? false : _j, _k = _b.dataSource, initialDataSource = _k === void 0 ? [] : _k;
|
|
70
164
|
// State to hold the original data and the current data
|
|
71
|
-
|
|
72
|
-
|
|
165
|
+
var _l = __read(useState(initialDataSource), 2), originalData = _l[0], setOriginalData = _l[1];
|
|
166
|
+
var _m = __read(useState({
|
|
73
167
|
dataSource: initialDataSource,
|
|
74
|
-
columns,
|
|
168
|
+
columns: columns,
|
|
75
169
|
error: null,
|
|
76
|
-
});
|
|
77
|
-
|
|
170
|
+
}), 2), data = _m[0], setData = _m[1];
|
|
171
|
+
var _o = __read(useState([]), 2), selectedRows = _o[0], setSelectedRows = _o[1];
|
|
78
172
|
// Load initial data
|
|
79
|
-
useEffect(()
|
|
173
|
+
useEffect(function () {
|
|
80
174
|
// If auto-fetch is disabled and we have initial data, skip fetching
|
|
81
175
|
if (disableAutoFetch && initialDataSource.length > 0) {
|
|
82
176
|
setLoading(false);
|
|
83
177
|
return;
|
|
84
178
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
179
|
+
var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
180
|
+
var response, result, sourceData, error_1;
|
|
181
|
+
return __generator(this, function (_a) {
|
|
182
|
+
switch (_a.label) {
|
|
183
|
+
case 0:
|
|
184
|
+
_a.trys.push([0, 3, 4, 5]);
|
|
185
|
+
return [4 /*yield*/, fetch(fetchUrl, fetchOptions)];
|
|
186
|
+
case 1:
|
|
187
|
+
response = _a.sent();
|
|
188
|
+
return [4 /*yield*/, response.json()];
|
|
189
|
+
case 2:
|
|
190
|
+
result = _a.sent();
|
|
191
|
+
sourceData = result.data || [];
|
|
192
|
+
setOriginalData(sourceData);
|
|
193
|
+
setData({
|
|
194
|
+
dataSource: sourceData,
|
|
195
|
+
columns: columns,
|
|
196
|
+
error: null,
|
|
197
|
+
});
|
|
198
|
+
return [3 /*break*/, 5];
|
|
199
|
+
case 3:
|
|
200
|
+
error_1 = _a.sent();
|
|
201
|
+
console.error("Error fetching table data:", error_1);
|
|
202
|
+
// Fallback to static data
|
|
203
|
+
setData({
|
|
204
|
+
dataSource: [],
|
|
205
|
+
columns: columns,
|
|
206
|
+
error: error_1 instanceof Error ? error_1 : new Error(String(error_1)),
|
|
207
|
+
});
|
|
208
|
+
return [3 /*break*/, 5];
|
|
209
|
+
case 4:
|
|
210
|
+
setLoading(false);
|
|
211
|
+
return [7 /*endfinally*/];
|
|
212
|
+
case 5: return [2 /*return*/];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}); };
|
|
110
216
|
if (simulateDelay > 0) {
|
|
111
217
|
setTimeout(fetchData, simulateDelay);
|
|
112
218
|
}
|
|
@@ -114,28 +220,19 @@ export const useTable = (useTableConfig) => {
|
|
|
114
220
|
fetchData();
|
|
115
221
|
}
|
|
116
222
|
}, [fetchOptions, disableAutoFetch, initialDataSource]);
|
|
117
|
-
|
|
223
|
+
var handleRowSelection = useCallback(function (selectedRowKeys, selectedRows) {
|
|
118
224
|
console.log("Row Selected:", selectedRowKeys, selectedRows);
|
|
119
225
|
setSelectedRows(selectedRows);
|
|
120
226
|
}, []);
|
|
121
227
|
// Function to manually update data source (for external data fetching)
|
|
122
|
-
|
|
228
|
+
var updateDataSource = useCallback(function (newDataSource) {
|
|
123
229
|
setOriginalData(newDataSource);
|
|
124
|
-
setData((prev)
|
|
125
|
-
...prev,
|
|
126
|
-
dataSource: newDataSource,
|
|
127
|
-
}));
|
|
230
|
+
setData(function (prev) { return (__assign(__assign({}, prev), { dataSource: newDataSource })); });
|
|
128
231
|
}, []);
|
|
129
|
-
|
|
232
|
+
var rowSelection = {
|
|
130
233
|
type: selectionType,
|
|
131
234
|
onChange: handleRowSelection,
|
|
132
235
|
getCheckboxProps: disableRowSelection,
|
|
133
236
|
};
|
|
134
|
-
return {
|
|
135
|
-
...data,
|
|
136
|
-
isLoading,
|
|
137
|
-
rowSelection,
|
|
138
|
-
selectedRows,
|
|
139
|
-
updateDataSource,
|
|
140
|
-
};
|
|
237
|
+
return __assign(__assign({}, data), { isLoading: isLoading, rowSelection: rowSelection, selectedRows: selectedRows, updateDataSource: updateDataSource });
|
|
141
238
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import TableControls from "../Table/TableControls";
|
|
3
3
|
import Table from "../Table";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
var TableWithControls = function (_a) {
|
|
5
|
+
var tableData = _a.tableData, tableControlsData = _a.tableControlsData, onChange = _a.onChange;
|
|
6
|
+
var primaryTableRowData = tableControlsData.primaryTableRowData, secondaryTableRowData = tableControlsData.secondaryTableRowData;
|
|
7
|
+
var dataSource = tableData.dataSource, columns = tableData.columns, rowSelection = tableData.rowSelection;
|
|
7
8
|
// handle changes from the table controls
|
|
8
|
-
|
|
9
|
+
var onTableControlsChange = function (event) {
|
|
9
10
|
onChange(event);
|
|
10
11
|
};
|
|
11
12
|
// handle changes from the table
|
|
12
|
-
|
|
13
|
+
var onTableChange = function (pagination, filters, sorter) {
|
|
13
14
|
onChange({
|
|
14
15
|
event: "tableChange",
|
|
15
|
-
payload: { pagination, filters, sorter },
|
|
16
|
+
payload: { pagination: pagination, filters: filters, sorter: sorter },
|
|
16
17
|
});
|
|
17
18
|
};
|
|
18
19
|
return (_jsxs(_Fragment, { children: [_jsx(TableControls, { primaryTableRowData: primaryTableRowData, secondaryTableRowData: secondaryTableRowData, onChange: onTableControlsChange }), _jsx(Table, { dataSource: dataSource, columns: columns, rowSelection: rowSelection, onChange: onTableChange })] }));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type State = "success" | "warning" | "error" | "info" | "generic" | "hollow";
|
|
2
|
+
export interface BadgeProps {
|
|
3
|
+
label?: string;
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
state?: State;
|
|
6
|
+
hasClose?: boolean;
|
|
7
|
+
hasIcon?: boolean;
|
|
8
|
+
customIcon?: React.ReactNode | null;
|
|
9
|
+
size?: "small" | "normal" | "large";
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
textColor?: string;
|
|
12
|
+
onClick?: () => void | null;
|
|
13
|
+
hasHover?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const Badge: ({ label, state, isDisabled, hasClose, onClick, size, hasIcon, customIcon, backgroundColor, textColor, hasHover, ...rest }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default Badge;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as S from "./styles";
|
|
3
|
+
import { Typography } from "@gobolt/genesis/components";
|
|
4
|
+
import { useGenesis } from "@gobolt/genesis/providers";
|
|
5
|
+
import { getBadgeStateIcon } from "@gobolt/genesis/utils/icon-util";
|
|
6
|
+
import { HiOutlineX } from "react-icons/hi";
|
|
7
|
+
const isBadgeIconFilled = false;
|
|
8
|
+
const Badge = ({ label, state = "info", isDisabled, hasClose = false, onClick = () => { }, size = "normal", hasIcon = true, customIcon = null, backgroundColor = null, textColor = null, hasHover = false, ...rest }) => {
|
|
9
|
+
const { theme } = useGenesis();
|
|
10
|
+
const role = hasClose ? "button" : "badge";
|
|
11
|
+
if (!label) {
|
|
12
|
+
return (_jsx(S.Badge, { label: label, role: "badge", state: state, disabled: isDisabled, style: {
|
|
13
|
+
padding: "4px 4px",
|
|
14
|
+
}, "$hasHover": hasHover, ...rest, children: _jsx("div", { style: {
|
|
15
|
+
display: "flex",
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
}, children: getBadgeStateIcon(state, backgroundColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon) }) }));
|
|
19
|
+
}
|
|
20
|
+
return (_jsxs(S.Badge, { label: label, role: role, onClick: onClick, state: state, disabled: isDisabled, style: { cursor: role === "button" ? "pointer" : "default" }, "$backgroundColor": backgroundColor, "$hasHover": hasHover, ...rest, children: [getBadgeStateIcon(state, isDisabled
|
|
21
|
+
? theme.colors.status.disabled.default
|
|
22
|
+
: textColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon), _jsx(Typography, { variant: size === "small" ? "label3" : "label2", color: isDisabled
|
|
23
|
+
? theme.colors.status.disabled.default
|
|
24
|
+
: textColor || theme.colors.status[state].onsurface,
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
isDisabled: isDisabled, children: label }), hasClose ? (_jsx(HiOutlineX, { color: theme.colors.status[state].onsurface })) : null] }));
|
|
27
|
+
};
|
|
28
|
+
export default Badge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Badge";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type GenesisTheme } from "@gobolt/genesis/styles/theme/genesis-theme.types";
|
|
2
|
+
import { type State } from "./Badge";
|
|
3
|
+
export declare const getGenesisClass: (theme: GenesisTheme, state: State, label?: string, disabled?: boolean, $backgroundColor?: string, $hasHover?: boolean) => string;
|
|
4
|
+
export declare const Badge: any;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import styled from "@gobolt/genesis/utils/styled";
|
|
2
|
+
const getBorderColor = (theme, state) => {
|
|
3
|
+
if (state === "hollow") {
|
|
4
|
+
return theme.colors.inputs.surface.border;
|
|
5
|
+
}
|
|
6
|
+
return theme.colors.status[state].surface;
|
|
7
|
+
};
|
|
8
|
+
export const getGenesisClass = (theme, state, label, disabled, $backgroundColor, $hasHover) => `
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-self: inherit;
|
|
11
|
+
gap: 4px;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
position: relative;
|
|
15
|
+
padding-top: ${theme.components.badge["ver-padding"]}px;
|
|
16
|
+
padding-bottom: ${theme.components.badge["ver-padding"]}px;
|
|
17
|
+
padding-left: ${theme.components.badge["left-padding"]}px;
|
|
18
|
+
padding-right: ${theme.components.badge["right-padding"]}px;
|
|
19
|
+
border-radius: ${theme.components.badge.radius}px;
|
|
20
|
+
border: 1px solid ${getBorderColor(theme, state)};
|
|
21
|
+
background-color: ${$backgroundColor || theme.colors.status[state].surface};
|
|
22
|
+
|
|
23
|
+
&:not(:disabled):hover {
|
|
24
|
+
${$hasHover
|
|
25
|
+
? `background-color: ${theme.colors.status[state]["surface-hover"]};`
|
|
26
|
+
: ""}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
${disabled
|
|
30
|
+
? `
|
|
31
|
+
background-color: ${theme.colors.status.disabled.surface} !important;
|
|
32
|
+
border-color: ${theme.colors.status.disabled} !important;
|
|
33
|
+
border: none;
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
}
|
|
39
|
+
`
|
|
40
|
+
: ""}
|
|
41
|
+
`;
|
|
42
|
+
export const Badge = styled.div `
|
|
43
|
+
${({ theme, state, label, disabled, $backgroundColor, $hasHover, }) => {
|
|
44
|
+
return getGenesisClass(theme, state, label, disabled, $backgroundColor, $hasHover);
|
|
45
|
+
}}
|
|
46
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { MouseEvent } from "react";
|
|
2
|
+
import type { ButtonProps as AntButtonProperties } from "antd/es/button";
|
|
3
|
+
import { STATE } from "../../constants";
|
|
4
|
+
type ButtonThemeType = "primary" | "secondary" | "tertiary" | "destructive" | "utility" | "icon";
|
|
5
|
+
export interface ButtonProps extends Omit<AntButtonProperties, "type" | "size"> {
|
|
6
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
themeType?: ButtonThemeType;
|
|
9
|
+
state?: keyof typeof STATE;
|
|
10
|
+
isIconButton?: boolean;
|
|
11
|
+
size?: "small" | "normal" | "large";
|
|
12
|
+
isSelected?: boolean;
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const Button: React.FC<ButtonProps>;
|
|
16
|
+
export default Button;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as S from "./styles";
|
|
3
|
+
const getState = (state, isSelected) => {
|
|
4
|
+
if (isSelected) {
|
|
5
|
+
return "selected";
|
|
6
|
+
}
|
|
7
|
+
return state === "active" || state === "disabled" ? state : "active";
|
|
8
|
+
};
|
|
9
|
+
const Button = ({ children, onClick, themeType = "primary", state = "active", isIconButton = false, size = "normal", isSelected, ...rest }) => {
|
|
10
|
+
const buttonState = getState(state, isSelected);
|
|
11
|
+
return (_jsx(S.Button, { onClick: onClick, "$themeType": themeType, "$state": buttonState, disabled: state === "disabled" || rest.disabled, "$isIconButton": isIconButton, size: size, ...rest, children: children }));
|
|
12
|
+
};
|
|
13
|
+
export default Button;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ButtonProps } from "./Button";
|
|
2
|
+
export interface IconButtonProps extends Omit<ButtonProps, "themeType" | "size"> {
|
|
3
|
+
icon: React.ReactNode;
|
|
4
|
+
size?: "small" | "normal" | "large";
|
|
5
|
+
isSelected?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const IconButton: ({ isSelected, state, onClick, icon, size, ...rest }: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default IconButton;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as S from "./icon-button-styles";
|
|
3
|
+
import { TYPE } from "../../constants";
|
|
4
|
+
const IconButton = ({ isSelected = false, state = "active", onClick, icon, size = "small", ...rest }) => {
|
|
5
|
+
const buttonState = state === "active" || state === "disabled" ? state : "active";
|
|
6
|
+
const themeType = TYPE.icon;
|
|
7
|
+
return (_jsx(S.Button, { onClick: onClick, "$themeType": themeType, "$state": buttonState, disabled: state === "disabled" || rest.disabled, size: size, "$isSelected": isSelected, ...rest, children: icon }));
|
|
8
|
+
};
|
|
9
|
+
export default IconButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Button: any;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import styled from "@gobolt/genesis/utils/styled";
|
|
2
|
+
const getPadding = (size, sizing) => {
|
|
3
|
+
if (size === "small") {
|
|
4
|
+
return `${sizing.Size1}px ${sizing.Size1}px`;
|
|
5
|
+
}
|
|
6
|
+
return `${sizing.Size2}px ${sizing.Size2}px`;
|
|
7
|
+
};
|
|
8
|
+
const getVariant = ({ colors, sizing, borderRadius, components }, $themeType, $state, size, $isSelected) => {
|
|
9
|
+
return `
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
text-align: center;
|
|
14
|
+
color: ${colors[$themeType][$state].color};
|
|
15
|
+
font-size: ${sizing.Size4}px;
|
|
16
|
+
line-height: ${sizing.Size6}px;
|
|
17
|
+
letter-spacing: 0;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
border-width: 1px;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
width: auto; !important;
|
|
22
|
+
height: auto; !important;
|
|
23
|
+
|
|
24
|
+
background-color:${$isSelected
|
|
25
|
+
? colors[$themeType].hover.backgroundColor
|
|
26
|
+
: colors[$themeType][$state].backgroundColor};
|
|
27
|
+
padding: ${getPadding(size, sizing)};
|
|
28
|
+
|
|
29
|
+
box-shadow: ${$themeType === "utility" ? "0px 1px 2px 0px #00000026" : "none"};
|
|
30
|
+
|
|
31
|
+
border-radius: ${borderRadius.BorderRadiusMd}px;
|
|
32
|
+
gap: ${components.button.gap}px;
|
|
33
|
+
border-style: solid;
|
|
34
|
+
border-color: ${colors[$themeType][$state].borderColor};
|
|
35
|
+
|
|
36
|
+
transition: all 0.2s ease-in-out;
|
|
37
|
+
|
|
38
|
+
&:hover {
|
|
39
|
+
color: ${colors[$themeType].hover.color};
|
|
40
|
+
background-color: ${colors[$themeType].hover.backgroundColor};
|
|
41
|
+
border-color: ${colors[$themeType].hover.borderColor};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:active {
|
|
45
|
+
color: ${colors[$themeType].pressed.color};
|
|
46
|
+
background-color: ${colors[$themeType].pressed.backgroundColor};
|
|
47
|
+
border-color: ${colors[$themeType].pressed.borderColor};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:focus-visible {
|
|
51
|
+
outline: none;
|
|
52
|
+
color: ${colors[$themeType].focussed.color};
|
|
53
|
+
background-color: ${colors[$themeType].focussed.backgroundColor};
|
|
54
|
+
box-shadow: 0 0 0 1px #fff, 0 0 0 4px ${colors[$themeType].focussed.ringColor};
|
|
55
|
+
border-radius: ${borderRadius.BorderRadiusMd}px;
|
|
56
|
+
border-color: ${colors[$themeType].focussed.borderColor};
|
|
57
|
+
transition: box-shadow 0.2s ease-in-out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:disabled {
|
|
61
|
+
color: ${colors[$themeType].disabled.color};
|
|
62
|
+
background-color: ${colors[$themeType].disabled.backgroundColor};
|
|
63
|
+
border-color: ${colors[$themeType].disabled.borderColor};
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
};
|
|
68
|
+
const getGenesisButtonClass = (theme, $themeType, $state, size, $isSelected) => `
|
|
69
|
+
font-family: 'Inter', sans-serif;
|
|
70
|
+
${getVariant(theme, $themeType, $state, size, $isSelected)}
|
|
71
|
+
`;
|
|
72
|
+
export const Button = styled.button `
|
|
73
|
+
${({ theme, $themeType, $state, size, $isSelected }) => {
|
|
74
|
+
return getGenesisButtonClass(theme, $themeType, $state, size, $isSelected);
|
|
75
|
+
}}
|
|
76
|
+
`;
|