@gobolt/genesis 0.3.22 → 0.3.24
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.js +7 -0
- package/dist/components/shared/DropdownChevron.js +14 -3
- package/dist/index.js +10 -89
- 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/components/index.ts +0 -7
- 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/index.ts +0 -10
- 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,9 +1,36 @@
|
|
|
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 __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
1
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
29
|
import { useState } from "react";
|
|
3
30
|
import { useTable } from "../Table/useTable";
|
|
4
31
|
import { mockColumns, mockDataSource } from "../Table/__mocks__/table-mocks";
|
|
5
32
|
//import
|
|
6
|
-
|
|
33
|
+
var tableControlsData = {
|
|
7
34
|
primaryTableRowData: {
|
|
8
35
|
sortOptions: [
|
|
9
36
|
{ value: "status", label: _jsx("span", { children: "Status" }) },
|
|
@@ -22,7 +49,7 @@ const tableControlsData = {
|
|
|
22
49
|
totalRecords: mockDataSource.appointments.length,
|
|
23
50
|
},
|
|
24
51
|
};
|
|
25
|
-
|
|
52
|
+
var startingUseTableConfig = {
|
|
26
53
|
columns: mockColumns,
|
|
27
54
|
filters: {
|
|
28
55
|
order: "asc",
|
|
@@ -31,106 +58,60 @@ const startingUseTableConfig = {
|
|
|
31
58
|
disableAutoFetch: true,
|
|
32
59
|
dataSource: [],
|
|
33
60
|
};
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
groups,
|
|
42
|
-
totalRecords: safeDataSource.length,
|
|
43
|
-
};
|
|
44
|
-
const { dataSource, columns, rowSelection, updateDataSource } = useTable(useTableConfig);
|
|
61
|
+
export var useTableWithControls = function (tableConfig) {
|
|
62
|
+
var _a = __read(useState(startingUseTableConfig), 2), useTableConfig = _a[0], setUseTableConfig = _a[1];
|
|
63
|
+
var _b = __read(useState(tableControlsData.secondaryTableRowData.groups), 2), groups = _b[0], setGroups = _b[1];
|
|
64
|
+
var _c = __read(useState(tableControlsData.primaryTableRowData), 2), primaryTableRowData = _c[0], setPrimaryTableRowData = _c[1];
|
|
65
|
+
var secondaryTableRowData = tableControlsData.secondaryTableRowData;
|
|
66
|
+
var newSecondaryTableRowData = __assign(__assign({}, secondaryTableRowData), { groups: groups, totalRecords: safeDataSource.length });
|
|
67
|
+
var _d = useTable(useTableConfig), dataSource = _d.dataSource, columns = _d.columns, rowSelection = _d.rowSelection, updateDataSource = _d.updateDataSource;
|
|
45
68
|
// Ensure we always return a valid object, even if dataSource is empty
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
newGroups[title] = newGroups[title].filter((group)
|
|
69
|
+
var safeDataSource = dataSource || [];
|
|
70
|
+
var onGroupItemClick = function (title, item) {
|
|
71
|
+
var newGroups = __assign({}, groups);
|
|
72
|
+
newGroups[title] = newGroups[title].filter(function (group) { return group !== item; });
|
|
50
73
|
setGroups(newGroups);
|
|
51
74
|
};
|
|
52
|
-
|
|
75
|
+
var onChange = function (actionEvent) {
|
|
53
76
|
if (actionEvent.event === "inputChange") {
|
|
54
|
-
|
|
55
|
-
if (typeof
|
|
56
|
-
setUseTableConfig((previous)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
...previous.filters,
|
|
60
|
-
search: value,
|
|
61
|
-
},
|
|
62
|
-
fetchOptions: {
|
|
63
|
-
...previous.fetchOptions,
|
|
64
|
-
body: JSON.stringify({
|
|
65
|
-
filters: {
|
|
66
|
-
...previous.filters,
|
|
67
|
-
search: value,
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
}));
|
|
77
|
+
var value_1 = actionEvent.payload.value;
|
|
78
|
+
if (typeof value_1 === "string") {
|
|
79
|
+
setUseTableConfig(function (previous) { return (__assign(__assign({}, previous), { filters: __assign(__assign({}, previous.filters), { search: value_1 }), fetchOptions: __assign(__assign({}, previous.fetchOptions), { body: JSON.stringify({
|
|
80
|
+
filters: __assign(__assign({}, previous.filters), { search: value_1 }),
|
|
81
|
+
}) }) })); });
|
|
72
82
|
}
|
|
73
83
|
}
|
|
74
84
|
if (actionEvent.event === "primaryChange") {
|
|
75
|
-
|
|
76
|
-
if (typeof
|
|
77
|
-
setUseTableConfig((previous)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
...previous.filters,
|
|
81
|
-
sort: value,
|
|
82
|
-
},
|
|
83
|
-
fetchOptions: {
|
|
84
|
-
...previous.fetchOptions,
|
|
85
|
-
body: JSON.stringify({
|
|
86
|
-
filters: {
|
|
87
|
-
...previous.filters,
|
|
88
|
-
sort: value,
|
|
89
|
-
},
|
|
90
|
-
}),
|
|
91
|
-
},
|
|
92
|
-
}));
|
|
85
|
+
var value_2 = actionEvent.payload.value;
|
|
86
|
+
if (typeof value_2 === "string") {
|
|
87
|
+
setUseTableConfig(function (previous) { return (__assign(__assign({}, previous), { filters: __assign(__assign({}, previous.filters), { sort: value_2 }), fetchOptions: __assign(__assign({}, previous.fetchOptions), { body: JSON.stringify({
|
|
88
|
+
filters: __assign(__assign({}, previous.filters), { sort: value_2 }),
|
|
89
|
+
}) }) })); });
|
|
93
90
|
}
|
|
94
91
|
}
|
|
95
92
|
if (actionEvent.event === "groupItemClick") {
|
|
96
|
-
|
|
93
|
+
var _a = actionEvent.payload, title = _a.title, item = _a.item;
|
|
97
94
|
if (typeof title === "string" && typeof item === "string") {
|
|
98
95
|
onGroupItemClick(title, item);
|
|
99
96
|
}
|
|
100
97
|
}
|
|
101
98
|
if (actionEvent.event === "orderClick") {
|
|
102
|
-
setPrimaryTableRowData((previous)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
setUseTableConfig((previous) => ({
|
|
109
|
-
...previous,
|
|
110
|
-
filters: {
|
|
111
|
-
...previous.filters,
|
|
112
|
-
order: value,
|
|
113
|
-
},
|
|
114
|
-
fetchOptions: {
|
|
115
|
-
...previous.fetchOptions,
|
|
116
|
-
body: JSON.stringify({
|
|
117
|
-
filters: {
|
|
118
|
-
...previous.filters,
|
|
119
|
-
order: value,
|
|
120
|
-
},
|
|
121
|
-
}),
|
|
122
|
-
},
|
|
123
|
-
}));
|
|
99
|
+
setPrimaryTableRowData(function (previous) { return (__assign(__assign({}, previous), { isSortedAscending: !previous.isSortedAscending })); });
|
|
100
|
+
var value_3 = actionEvent.payload.value;
|
|
101
|
+
if (typeof value_3 === "string") {
|
|
102
|
+
setUseTableConfig(function (previous) { return (__assign(__assign({}, previous), { filters: __assign(__assign({}, previous.filters), { order: value_3 }), fetchOptions: __assign(__assign({}, previous.fetchOptions), { body: JSON.stringify({
|
|
103
|
+
filters: __assign(__assign({}, previous.filters), { order: value_3 }),
|
|
104
|
+
}) }) })); });
|
|
124
105
|
}
|
|
125
106
|
}
|
|
126
107
|
};
|
|
127
108
|
return {
|
|
128
|
-
onChange,
|
|
129
|
-
primaryTableRowData,
|
|
109
|
+
onChange: onChange,
|
|
110
|
+
primaryTableRowData: primaryTableRowData,
|
|
130
111
|
secondaryTableRowData: newSecondaryTableRowData,
|
|
131
112
|
dataSource: safeDataSource,
|
|
132
|
-
columns,
|
|
133
|
-
rowSelection,
|
|
134
|
-
updateDataSource,
|
|
113
|
+
columns: columns,
|
|
114
|
+
rowSelection: rowSelection,
|
|
115
|
+
updateDataSource: updateDataSource,
|
|
135
116
|
};
|
|
136
117
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const getIcon: (name: string) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const getIconColor: (state: any, theme: any) => any;
|
|
3
|
+
export declare const getBadgeStateIcon: (state: any, color: any, isFilled?: boolean, hasIcon?: boolean, customIcon?: any) => any;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { STATE } from "@gobolt/genesis/constants";
|
|
3
|
+
const iconSize = 18;
|
|
4
|
+
// check circle filled & outline
|
|
5
|
+
import { FaCircleCheck } from "react-icons/fa6";
|
|
6
|
+
import { HiOutlineCheckCircle } from "react-icons/hi";
|
|
7
|
+
// info circle filled & outline
|
|
8
|
+
import { PiInfoFill, PiInfo } from "react-icons/pi";
|
|
9
|
+
// error circle filled & outline
|
|
10
|
+
import { HiXCircle } from "react-icons/hi";
|
|
11
|
+
import { HiOutlineXCircle } from "react-icons/hi";
|
|
12
|
+
// warning circle filled & outline
|
|
13
|
+
import { HiExclamationCircle } from "react-icons/hi";
|
|
14
|
+
import { HiOutlineExclamationCircle } from "react-icons/hi";
|
|
15
|
+
// minus circle filled & outline
|
|
16
|
+
import { HiMinusCircle } from "react-icons/hi";
|
|
17
|
+
import { HiOutlineMinusCircle } from "react-icons/hi";
|
|
18
|
+
// clock circle filled & outline
|
|
19
|
+
import { HiClock } from "react-icons/hi";
|
|
20
|
+
import { HiOutlineClock } from "react-icons/hi";
|
|
21
|
+
import { HiOutlineGlobe } from "react-icons/hi";
|
|
22
|
+
import { TbFiles } from "react-icons/tb";
|
|
23
|
+
import { LuTag } from "react-icons/lu";
|
|
24
|
+
export const getIcon = (name) => {
|
|
25
|
+
switch (name.toLowerCase()) {
|
|
26
|
+
case "orders": {
|
|
27
|
+
return _jsx(LuTag, {});
|
|
28
|
+
}
|
|
29
|
+
case "warehouse": {
|
|
30
|
+
return _jsx(HiOutlineGlobe, {});
|
|
31
|
+
}
|
|
32
|
+
case "availability": {
|
|
33
|
+
return _jsx(TbFiles, {});
|
|
34
|
+
}
|
|
35
|
+
default: {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export const getIconColor = (state, theme) => {
|
|
41
|
+
switch (state) {
|
|
42
|
+
case STATE.error: {
|
|
43
|
+
return theme.colors.status.error.onsurface;
|
|
44
|
+
}
|
|
45
|
+
case STATE.success: {
|
|
46
|
+
return theme.colors.status.success.onsurface;
|
|
47
|
+
}
|
|
48
|
+
case STATE.warning: {
|
|
49
|
+
return theme.colors.status.warning.default;
|
|
50
|
+
}
|
|
51
|
+
case STATE.removed: {
|
|
52
|
+
return theme.colors.status.generic.default;
|
|
53
|
+
}
|
|
54
|
+
case STATE.progress: {
|
|
55
|
+
return theme.colors.timebox.evening.default;
|
|
56
|
+
}
|
|
57
|
+
case STATE.info:
|
|
58
|
+
default: {
|
|
59
|
+
return theme.colors.status.info.onsurface;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export const getBadgeStateIcon = (state, color, isFilled = true, hasIcon = true, customIcon = null) => {
|
|
64
|
+
if (!state || !hasIcon) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
if (customIcon) {
|
|
68
|
+
return customIcon;
|
|
69
|
+
}
|
|
70
|
+
if (!isFilled) {
|
|
71
|
+
switch (state) {
|
|
72
|
+
// isFilled is false
|
|
73
|
+
case STATE.warning: {
|
|
74
|
+
return _jsx(HiOutlineExclamationCircle, { size: iconSize, style: { color } });
|
|
75
|
+
}
|
|
76
|
+
case STATE.error: {
|
|
77
|
+
return _jsx(HiOutlineXCircle, { size: iconSize, style: { color } });
|
|
78
|
+
}
|
|
79
|
+
case STATE.success: {
|
|
80
|
+
return _jsx(HiOutlineCheckCircle, { size: iconSize, style: { color } });
|
|
81
|
+
}
|
|
82
|
+
case STATE.progress: {
|
|
83
|
+
return _jsx(HiOutlineClock, { size: iconSize, style: { color } });
|
|
84
|
+
}
|
|
85
|
+
case STATE.removed: {
|
|
86
|
+
return _jsx(HiOutlineMinusCircle, { size: iconSize, style: { color } });
|
|
87
|
+
}
|
|
88
|
+
case STATE.info:
|
|
89
|
+
default: {
|
|
90
|
+
return _jsx(PiInfo, { size: iconSize, style: { color } });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
switch (state) {
|
|
95
|
+
// isFilled is true
|
|
96
|
+
case STATE.warning: {
|
|
97
|
+
return _jsx(HiExclamationCircle, { size: iconSize, style: { color } });
|
|
98
|
+
}
|
|
99
|
+
case STATE.error: {
|
|
100
|
+
return _jsx(HiXCircle, { size: iconSize, style: { color } });
|
|
101
|
+
}
|
|
102
|
+
case STATE.success: {
|
|
103
|
+
return _jsx(FaCircleCheck, { size: iconSize, style: { color } });
|
|
104
|
+
}
|
|
105
|
+
case STATE.progress: {
|
|
106
|
+
return _jsx(HiClock, { size: iconSize, style: { color } });
|
|
107
|
+
}
|
|
108
|
+
case STATE.removed: {
|
|
109
|
+
return _jsx(HiMinusCircle, { size: iconSize, style: { color } });
|
|
110
|
+
}
|
|
111
|
+
case STATE.info:
|
|
112
|
+
default: {
|
|
113
|
+
return _jsx(PiInfoFill, { size: iconSize, style: { color } });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as S from "./styles";
|
|
3
3
|
import { Typography } from "@gobolt/genesis/components";
|
|
4
4
|
import { TYPOGRAPHY_VARIANT } from "@gobolt/genesis/constants";
|
|
5
|
-
|
|
5
|
+
var Tooltip = function (_a) {
|
|
6
|
+
var _b = _a.tip, tip = _b === void 0 ? "" : _b, children = _a.children;
|
|
6
7
|
return (_jsx(S.Tooltip, { "data-testid": "Tooltip", placement: "top", title: _jsx("div", { style: { marginTop: 2 }, children: _jsx(Typography, { variant: TYPOGRAPHY_VARIANT.body2, color: "white", children: tip }) }), children: children }));
|
|
7
8
|
};
|
|
8
9
|
export default Tooltip;
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
import { type GenesisTheme } from "@gobolt/genesis/styles/theme/genesis-theme.types";
|
|
2
|
+
interface StyledTooltipProperties {
|
|
3
|
+
theme?: GenesisTheme;
|
|
4
|
+
type?: "primary" | "secondary";
|
|
5
|
+
state?: "active" | "disabled";
|
|
6
|
+
}
|
|
1
7
|
export declare const getGenesisClass: ({ colors, borderRadius, sizing }: {
|
|
2
8
|
colors: any;
|
|
3
9
|
borderRadius: any;
|
|
4
10
|
sizing: any;
|
|
5
11
|
}, type?: string, state?: string) => string;
|
|
6
|
-
export declare const Tooltip:
|
|
12
|
+
export declare const Tooltip: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<import("antd/es/tooltip").TooltipPropsWithTitle & import("react").RefAttributes<import("antd/es/tooltip").TooltipRef>, "ref"> & {
|
|
13
|
+
ref?: ((instance: import("antd/es/tooltip").TooltipRef | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<import("antd/es/tooltip").TooltipRef> | null | undefined;
|
|
14
|
+
}) | (Omit<import("antd/es/tooltip").TooltipPropsWithOverlay & import("react").RefAttributes<import("antd/es/tooltip").TooltipRef>, "ref"> & {
|
|
15
|
+
ref?: ((instance: import("antd/es/tooltip").TooltipRef | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<import("antd/es/tooltip").TooltipRef> | null | undefined;
|
|
16
|
+
}), StyledTooltipProperties>> & string & Omit<import("react").ForwardRefExoticComponent<import("antd").TooltipProps & import("react").RefAttributes<import("antd/es/tooltip").TooltipRef>> & {
|
|
17
|
+
_InternalPanelDoNotUseOrYouWillBeFired: import("react").FC<import("antd/es/tooltip/PurePanel").PurePanelProps>;
|
|
18
|
+
}, keyof import("react").Component<any, {}, any>>;
|
|
19
|
+
export {};
|
|
@@ -1,26 +1,17 @@
|
|
|
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 { Tooltip as AntTooltip } from "antd";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
padding: ${sizing.xs} ${sizing.sm};
|
|
12
|
-
font-size: 14px;
|
|
13
|
-
line-height: 20px;
|
|
14
|
-
color: ${colors.onsurface.white};
|
|
15
|
-
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.ant-tooltip-arrow-content {
|
|
19
|
-
background-color: ${colors.surface.dark};
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
export const Tooltip = styled(AntTooltip) `
|
|
23
|
-
${({ theme, type, state }) => {
|
|
7
|
+
export var getGenesisClass = function (_a, type, state) {
|
|
8
|
+
var colors = _a.colors, borderRadius = _a.borderRadius, sizing = _a.sizing;
|
|
9
|
+
if (type === void 0) { type = "primary"; }
|
|
10
|
+
if (state === void 0) { state = "active"; }
|
|
11
|
+
return "\n .ant-tooltip {\n --antd-arrow-background-color: ".concat(colors.surface.dark, ";\n }\n\n .ant-tooltip-inner {\n background-color: ").concat(colors.surface.dark, ";\n border-radius: ").concat(borderRadius.sm, ";\n padding: ").concat(sizing.xs, " ").concat(sizing.sm, ";\n font-size: 14px;\n line-height: 20px;\n color: ").concat(colors.onsurface.white, ";\n box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .ant-tooltip-arrow-content {\n background-color: ").concat(colors.surface.dark, ";\n }\n");
|
|
12
|
+
};
|
|
13
|
+
export var Tooltip = styled(AntTooltip)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
14
|
+
var theme = _a.theme, type = _a.type, state = _a.state;
|
|
24
15
|
return getGenesisClass(theme, type, state);
|
|
25
|
-
}
|
|
26
|
-
|
|
16
|
+
});
|
|
17
|
+
var templateObject_1;
|
|
@@ -1,16 +1,39 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
1
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
24
|
import * as S from "./styles";
|
|
3
25
|
import { useGenesis } from "@gobolt/genesis/providers";
|
|
4
26
|
import { TYPE, TYPOGRAPHY_VARIANT, STATE, } from "@gobolt/genesis/constants";
|
|
5
|
-
|
|
6
|
-
|
|
27
|
+
var Typography = function (_a) {
|
|
28
|
+
var children = _a.children, _b = _a.themeType, themeType = _b === void 0 ? TYPE.secondary : _b, _c = _a.variant, variant = _c === void 0 ? TYPOGRAPHY_VARIANT.body1 : _c, _d = _a.state, state = _d === void 0 ? STATE.active : _d, color = _a.color, _e = _a.isText, isText = _e === void 0 ? false : _e, isFullWidth = _a.isFullWidth, style = _a.style, isDisabled = _a.isDisabled, rest = __rest(_a, ["children", "themeType", "variant", "state", "color", "isText", "isFullWidth", "style", "isDisabled"]);
|
|
29
|
+
var breakpoint = useGenesis().breakpoint;
|
|
7
30
|
if (variant.startsWith("display") || variant.startsWith("heading")) {
|
|
8
|
-
|
|
9
|
-
return (_jsx(S.Headline, { state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, level: Number.parseInt(level), "$isFullWidth": isFullWidth, style: style, disabled: isDisabled,
|
|
31
|
+
var level = variant.split("heading")[1] || variant.split("display")[1];
|
|
32
|
+
return (_jsx(S.Headline, __assign({ state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, level: Number.parseInt(level), "$isFullWidth": isFullWidth, style: style, disabled: isDisabled }, rest, { children: children })));
|
|
10
33
|
}
|
|
11
34
|
if (isText) {
|
|
12
|
-
return (_jsx(S.Text, { state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, "$isFullWidth": isFullWidth, style: style, disabled: isDisabled,
|
|
35
|
+
return (_jsx(S.Text, __assign({ state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, "$isFullWidth": isFullWidth, style: style, disabled: isDisabled }, rest, { children: children })));
|
|
13
36
|
}
|
|
14
|
-
return (_jsx(S.Paragraph, { state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, "$isFullWidth": isFullWidth, style: style, disabled: isDisabled,
|
|
37
|
+
return (_jsx(S.Paragraph, __assign({ state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, "$isFullWidth": isFullWidth, style: style, disabled: isDisabled }, rest, { children: children })));
|
|
15
38
|
};
|
|
16
39
|
export default Typography;
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { GenesisTheme } from "@/lib/styles/theme/genesis-theme.types";
|
|
2
|
+
import { TYPE, STATE } from "@gobolt/genesis/constants";
|
|
3
|
+
interface TypographyStyledProperties {
|
|
4
|
+
theme: GenesisTheme;
|
|
5
|
+
$themeType?: keyof typeof TYPE;
|
|
6
|
+
variant?: string;
|
|
7
|
+
state?: keyof typeof STATE;
|
|
8
|
+
breakpoint?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
$isFullWidth?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const Headline: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("antd/es/typography/Title").TitleProps & import("react").RefAttributes<HTMLElement>, "ref"> & {
|
|
13
|
+
ref?: ((instance: HTMLElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLElement> | null | undefined;
|
|
14
|
+
}, TypographyStyledProperties>> & string & Omit<import("react").ForwardRefExoticComponent<import("antd/es/typography/Title").TitleProps & import("react").RefAttributes<HTMLElement>>, keyof import("react").Component<any, {}, any>>;
|
|
15
|
+
export declare const Paragraph: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("antd/es/typography/Paragraph").ParagraphProps & import("react").RefAttributes<HTMLElement>, "ref"> & {
|
|
16
|
+
ref?: ((instance: HTMLElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLElement> | null | undefined;
|
|
17
|
+
}, TypographyStyledProperties>> & string & Omit<import("react").ForwardRefExoticComponent<import("antd/es/typography/Paragraph").ParagraphProps & import("react").RefAttributes<HTMLElement>>, keyof import("react").Component<any, {}, any>>;
|
|
18
|
+
export declare const Text: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("antd/es/typography/Text").TextProps & import("react").RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
19
|
+
ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
20
|
+
}, TypographyStyledProperties>> & string & Omit<import("react").ForwardRefExoticComponent<import("antd/es/typography/Text").TextProps & import("react").RefAttributes<HTMLSpanElement>>, keyof import("react").Component<any, {}, any>>;
|
|
21
|
+
export {};
|
|
@@ -1,54 +1,37 @@
|
|
|
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 { Typography as AntTypography } from "antd";
|
|
3
|
-
|
|
4
|
-
return
|
|
5
|
-
font-size: ${typography[breakpoint][variant].fontSize}px !important;
|
|
6
|
-
line-height: ${typography[breakpoint][variant].lineHeight};
|
|
7
|
-
letter-spacing: ${typography[breakpoint][variant].letterSpacing}px;
|
|
8
|
-
font-weight: ${typography[breakpoint][variant].fontWeight};
|
|
9
|
-
`;
|
|
7
|
+
var getVariant = function (typography, variant, breakpoint) {
|
|
8
|
+
return "\n font-size: ".concat(typography[breakpoint][variant].fontSize, "px !important;\n line-height: ").concat(typography[breakpoint][variant].lineHeight, ";\n letter-spacing: ").concat(typography[breakpoint][variant].letterSpacing, "px;\n font-weight: ").concat(typography[breakpoint][variant].fontWeight, ";\n ");
|
|
10
9
|
};
|
|
11
|
-
|
|
10
|
+
var getColor = function (color, colors, $themeType) {
|
|
12
11
|
if (color) {
|
|
13
12
|
return color;
|
|
14
13
|
}
|
|
15
14
|
return colors[$themeType].active.color;
|
|
16
15
|
};
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
${variant.includes("digits")
|
|
16
|
+
var getFontFamily = function (variant) {
|
|
17
|
+
return "\n ".concat(variant.includes("digits")
|
|
20
18
|
? "'Roboto Mono', sans-serif"
|
|
21
|
-
: "'Inter', sans-serif"
|
|
22
|
-
|
|
19
|
+
: "'Inter', sans-serif", " !important;\n ");
|
|
20
|
+
};
|
|
21
|
+
var getGenesisTypographyClass = function (_a, $themeType, variant, state, breakpoint, color, $isFullWidth) {
|
|
22
|
+
var colors = _a.colors, typography = _a.typography;
|
|
23
|
+
return "\n &.ant-typography {\n font-family: ".concat(getFontFamily(variant), ";\n color: ").concat(getColor(color, colors, $themeType), " !important;\n ").concat(getVariant(typography, variant, breakpoint), "\n margin-bottom: 0 !important;\n width: ").concat($isFullWidth ? "100%" : "auto", ";\n line-height: 1;\n\n &:disabled {\n color: ").concat(colors.status.disabled.default, " !important;\n userSelect: none;\n cursor: not-allowed;\n }\n } \n");
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
font-family: ${getFontFamily(variant)};
|
|
27
|
-
color: ${getColor(color, colors, $themeType)} !important;
|
|
28
|
-
${getVariant(typography, variant, breakpoint)}
|
|
29
|
-
margin-bottom: 0 !important;
|
|
30
|
-
width: ${$isFullWidth ? "100%" : "auto"};
|
|
31
|
-
line-height: 1;
|
|
32
|
-
|
|
33
|
-
&:disabled {
|
|
34
|
-
color: ${colors.status.disabled.default} !important;
|
|
35
|
-
userSelect: none;
|
|
36
|
-
cursor: not-allowed;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
export const Headline = styled(AntTypography.Title) `
|
|
41
|
-
${({ theme, $themeType, variant, state, breakpoint, color, $isFullWidth, }) => {
|
|
25
|
+
export var Headline = styled(AntTypography.Title)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
26
|
+
var theme = _a.theme, $themeType = _a.$themeType, variant = _a.variant, state = _a.state, breakpoint = _a.breakpoint, color = _a.color, $isFullWidth = _a.$isFullWidth;
|
|
42
27
|
return getGenesisTypographyClass(theme, $themeType, variant, state, breakpoint, color, $isFullWidth);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
${({ theme, $themeType, variant, state, breakpoint, color, $isFullWidth, }) => {
|
|
28
|
+
});
|
|
29
|
+
export var Paragraph = styled(AntTypography.Paragraph)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
30
|
+
var theme = _a.theme, $themeType = _a.$themeType, variant = _a.variant, state = _a.state, breakpoint = _a.breakpoint, color = _a.color, $isFullWidth = _a.$isFullWidth;
|
|
47
31
|
return getGenesisTypographyClass(theme, $themeType, variant, state, breakpoint, color, $isFullWidth);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
${({ theme, $themeType, variant, state, breakpoint, color, $isFullWidth, }) => {
|
|
32
|
+
});
|
|
33
|
+
export var Text = styled(AntTypography.Text)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
34
|
+
var theme = _a.theme, $themeType = _a.$themeType, variant = _a.variant, state = _a.state, breakpoint = _a.breakpoint, color = _a.color, $isFullWidth = _a.$isFullWidth;
|
|
52
35
|
return getGenesisTypographyClass(theme, $themeType, variant, state, breakpoint, color, $isFullWidth);
|
|
53
|
-
}
|
|
54
|
-
|
|
36
|
+
});
|
|
37
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -1,9 +1,32 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
1
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
24
|
import Button from "../Button";
|
|
3
25
|
import { TYPE } from "../../constants";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
26
|
+
var UtilityButton = function (_a) {
|
|
27
|
+
var children = _a.children, onClick = _a.onClick, _b = _a.state, state = _b === void 0 ? "active" : _b, _c = _a.isIconButton, isIconButton = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? "normal" : _d, rest = __rest(_a, ["children", "onClick", "state", "isIconButton", "size"]);
|
|
28
|
+
var buttonState = state === "active" || state === "disabled" ? state : "active";
|
|
29
|
+
var themeType = TYPE.utility;
|
|
30
|
+
return (_jsx(Button, __assign({ onClick: onClick, themeType: themeType, state: buttonState, disabled: state === "disabled" || rest.disabled, isIconButton: isIconButton, size: size }, rest, { children: children })));
|
|
8
31
|
};
|
|
9
32
|
export default UtilityButton;
|
|
@@ -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;
|