@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
package/dist/components/TableWithControls/components/TableWithControls/useTableWithControls.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { useTable } from "../Table/useTable";
|
|
4
|
+
import { mockColumns, mockDataSource } from "../Table/__mocks__/table-mocks";
|
|
5
|
+
//import
|
|
6
|
+
const tableControlsData = {
|
|
7
|
+
primaryTableRowData: {
|
|
8
|
+
sortOptions: [
|
|
9
|
+
{ value: "status", label: _jsx("span", { children: "Status" }) },
|
|
10
|
+
{ value: "address", label: _jsx("span", { children: "Address" }) },
|
|
11
|
+
{ value: "job_subtype", label: _jsx("span", { children: "Type" }) },
|
|
12
|
+
],
|
|
13
|
+
searchByPlaceholder: "Search by Address",
|
|
14
|
+
isSortedAscending: true,
|
|
15
|
+
},
|
|
16
|
+
secondaryTableRowData: {
|
|
17
|
+
groups: {
|
|
18
|
+
orders: ["Cancelled", "Paused"],
|
|
19
|
+
warehouse: ["D2C"],
|
|
20
|
+
availability: ["Out of Stock"],
|
|
21
|
+
},
|
|
22
|
+
totalRecords: mockDataSource.appointments.length,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const startingUseTableConfig = {
|
|
26
|
+
columns: mockColumns,
|
|
27
|
+
filters: {
|
|
28
|
+
order: "asc",
|
|
29
|
+
},
|
|
30
|
+
// Disable auto-fetch to allow external data management
|
|
31
|
+
disableAutoFetch: true,
|
|
32
|
+
dataSource: [],
|
|
33
|
+
};
|
|
34
|
+
export const useTableWithControls = (tableConfig) => {
|
|
35
|
+
const [useTableConfig, setUseTableConfig] = useState(startingUseTableConfig);
|
|
36
|
+
const [groups, setGroups] = useState(tableControlsData.secondaryTableRowData.groups);
|
|
37
|
+
const [primaryTableRowData, setPrimaryTableRowData] = useState(tableControlsData.primaryTableRowData);
|
|
38
|
+
const { secondaryTableRowData } = tableControlsData;
|
|
39
|
+
const newSecondaryTableRowData = {
|
|
40
|
+
...secondaryTableRowData,
|
|
41
|
+
groups,
|
|
42
|
+
totalRecords: safeDataSource.length,
|
|
43
|
+
};
|
|
44
|
+
const { dataSource, columns, rowSelection, updateDataSource } = useTable(useTableConfig);
|
|
45
|
+
// Ensure we always return a valid object, even if dataSource is empty
|
|
46
|
+
const safeDataSource = dataSource || [];
|
|
47
|
+
const onGroupItemClick = (title, item) => {
|
|
48
|
+
const newGroups = { ...groups };
|
|
49
|
+
newGroups[title] = newGroups[title].filter((group) => group !== item);
|
|
50
|
+
setGroups(newGroups);
|
|
51
|
+
};
|
|
52
|
+
const onChange = (actionEvent) => {
|
|
53
|
+
if (actionEvent.event === "inputChange") {
|
|
54
|
+
const { value } = actionEvent.payload;
|
|
55
|
+
if (typeof value === "string") {
|
|
56
|
+
setUseTableConfig((previous) => ({
|
|
57
|
+
...previous,
|
|
58
|
+
filters: {
|
|
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
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (actionEvent.event === "primaryChange") {
|
|
75
|
+
const { value } = actionEvent.payload;
|
|
76
|
+
if (typeof value === "string") {
|
|
77
|
+
setUseTableConfig((previous) => ({
|
|
78
|
+
...previous,
|
|
79
|
+
filters: {
|
|
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
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (actionEvent.event === "groupItemClick") {
|
|
96
|
+
const { title, item } = actionEvent.payload;
|
|
97
|
+
if (typeof title === "string" && typeof item === "string") {
|
|
98
|
+
onGroupItemClick(title, item);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (actionEvent.event === "orderClick") {
|
|
102
|
+
setPrimaryTableRowData((previous) => ({
|
|
103
|
+
...previous,
|
|
104
|
+
isSortedAscending: !previous.isSortedAscending,
|
|
105
|
+
}));
|
|
106
|
+
const { value } = actionEvent.payload;
|
|
107
|
+
if (typeof value === "string") {
|
|
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
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
onChange,
|
|
129
|
+
primaryTableRowData,
|
|
130
|
+
secondaryTableRowData: newSecondaryTableRowData,
|
|
131
|
+
dataSource: safeDataSource,
|
|
132
|
+
columns,
|
|
133
|
+
rowSelection,
|
|
134
|
+
updateDataSource,
|
|
135
|
+
};
|
|
136
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface TooltipProps {
|
|
2
|
+
tip: string;
|
|
3
|
+
placement?: "top" | "bottom" | "left" | "right" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom";
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare const Tooltip: ({ tip, children }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default Tooltip;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as S from "./styles";
|
|
3
|
+
import { Typography } from "@gobolt/genesis/components";
|
|
4
|
+
import { TYPOGRAPHY_VARIANT } from "@gobolt/genesis/constants";
|
|
5
|
+
const Tooltip = ({ tip = "", children }) => {
|
|
6
|
+
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
|
+
export default Tooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Tooltip";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import styled from "@gobolt/genesis/utils/styled";
|
|
2
|
+
import { Tooltip as AntTooltip } from "antd";
|
|
3
|
+
export const getGenesisClass = ({ colors, borderRadius, sizing }, type = "primary", state = "active") => `
|
|
4
|
+
.ant-tooltip {
|
|
5
|
+
--antd-arrow-background-color: ${colors.surface.dark};
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ant-tooltip-inner {
|
|
9
|
+
background-color: ${colors.surface.dark};
|
|
10
|
+
border-radius: ${borderRadius.sm};
|
|
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 }) => {
|
|
24
|
+
return getGenesisClass(theme, type, state);
|
|
25
|
+
}}
|
|
26
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
|
+
import { TYPE, TYPOGRAPHY_VARIANT, STATE } from "@gobolt/genesis/constants";
|
|
3
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5;
|
|
4
|
+
export interface TypographyProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
variant?: keyof typeof TYPOGRAPHY_VARIANT;
|
|
7
|
+
themeType?: keyof typeof TYPE;
|
|
8
|
+
state?: keyof typeof STATE;
|
|
9
|
+
color?: string;
|
|
10
|
+
level?: HeadingLevel;
|
|
11
|
+
isText?: boolean;
|
|
12
|
+
isFullWidth?: boolean;
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
isDisabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const Typography: ({ children, themeType, variant, state, color, isText, isFullWidth, style, isDisabled, ...rest }: TypographyProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default Typography;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as S from "./styles";
|
|
3
|
+
import { useGenesis } from "@gobolt/genesis/providers";
|
|
4
|
+
import { TYPE, TYPOGRAPHY_VARIANT, STATE, } from "@gobolt/genesis/constants";
|
|
5
|
+
const Typography = ({ children, themeType = TYPE.secondary, variant = TYPOGRAPHY_VARIANT.body1, state = STATE.active, color, isText = false, isFullWidth, style, isDisabled, ...rest }) => {
|
|
6
|
+
const { breakpoint } = useGenesis();
|
|
7
|
+
if (variant.startsWith("display") || variant.startsWith("heading")) {
|
|
8
|
+
const level = variant.split("heading")[1] || variant.split("display")[1];
|
|
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, ...rest, children: children }));
|
|
10
|
+
}
|
|
11
|
+
if (isText) {
|
|
12
|
+
return (_jsx(S.Text, { state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, "$isFullWidth": isFullWidth, style: style, disabled: isDisabled, ...rest, children: children }));
|
|
13
|
+
}
|
|
14
|
+
return (_jsx(S.Paragraph, { state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, "$isFullWidth": isFullWidth, style: style, disabled: isDisabled, ...rest, children: children }));
|
|
15
|
+
};
|
|
16
|
+
export default Typography;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Typography";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import styled from "@gobolt/genesis/utils/styled";
|
|
2
|
+
import { Typography as AntTypography } from "antd";
|
|
3
|
+
const getVariant = (typography, variant, breakpoint) => {
|
|
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
|
+
`;
|
|
10
|
+
};
|
|
11
|
+
const getColor = (color, colors, $themeType) => {
|
|
12
|
+
if (color) {
|
|
13
|
+
return color;
|
|
14
|
+
}
|
|
15
|
+
return colors[$themeType].active.color;
|
|
16
|
+
};
|
|
17
|
+
const getFontFamily = (variant) => {
|
|
18
|
+
return `
|
|
19
|
+
${variant.includes("digits")
|
|
20
|
+
? "'Roboto Mono', sans-serif"
|
|
21
|
+
: "'Inter', sans-serif"} !important;
|
|
22
|
+
`;
|
|
23
|
+
};
|
|
24
|
+
const getGenesisTypographyClass = ({ colors, typography }, $themeType, variant, state, breakpoint, color, $isFullWidth) => `
|
|
25
|
+
&.ant-typography {
|
|
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, }) => {
|
|
42
|
+
return getGenesisTypographyClass(theme, $themeType, variant, state, breakpoint, color, $isFullWidth);
|
|
43
|
+
}}
|
|
44
|
+
`;
|
|
45
|
+
export const Paragraph = styled(AntTypography.Paragraph) `
|
|
46
|
+
${({ theme, $themeType, variant, state, breakpoint, color, $isFullWidth, }) => {
|
|
47
|
+
return getGenesisTypographyClass(theme, $themeType, variant, state, breakpoint, color, $isFullWidth);
|
|
48
|
+
}}
|
|
49
|
+
`;
|
|
50
|
+
export const Text = styled(AntTypography.Text) `
|
|
51
|
+
${({ theme, $themeType, variant, state, breakpoint, color, $isFullWidth, }) => {
|
|
52
|
+
return getGenesisTypographyClass(theme, $themeType, variant, state, breakpoint, color, $isFullWidth);
|
|
53
|
+
}}
|
|
54
|
+
`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ButtonProps } from "../Button";
|
|
2
|
+
export interface UtilityButtonProps extends Omit<ButtonProps, "themeType"> {
|
|
3
|
+
}
|
|
4
|
+
declare const UtilityButton: ({ children, onClick, state, isIconButton, size, ...rest }: UtilityButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default UtilityButton;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Button from "../Button";
|
|
3
|
+
import { TYPE } from "../../constants";
|
|
4
|
+
const UtilityButton = ({ children, onClick, state = "active", isIconButton = false, size = "normal", ...rest }) => {
|
|
5
|
+
const buttonState = state === "active" || state === "disabled" ? state : "active";
|
|
6
|
+
const themeType = TYPE.utility;
|
|
7
|
+
return (_jsx(Button, { onClick: onClick, themeType: themeType, state: buttonState, disabled: state === "disabled" || rest.disabled, isIconButton: isIconButton, size: size, ...rest, children: children }));
|
|
8
|
+
};
|
|
9
|
+
export default UtilityButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./UtilityButton";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useGenesis } from "@gobolt/genesis/providers";
|
|
3
|
+
const DropdownChevron = (properties) => {
|
|
4
|
+
const { theme } = useGenesis();
|
|
5
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 20, height: 20, fill: "none", ...properties, children: _jsx("path", { fill: "#222", fillRule: "evenodd", d: "M5.293 7.293a1 1 0 0 1 1.414 0L10 10.586l3.293-3.293a1 1 0 1 1 1.414 1.414l-4 4a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 0-1.414Z", clipRule: "evenodd" }) }));
|
|
6
|
+
};
|
|
7
|
+
export default DropdownChevron;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
export declare const TYPE: {
|
|
2
|
+
primary: string;
|
|
3
|
+
secondary: string;
|
|
4
|
+
tertiary: string;
|
|
5
|
+
destructive: string;
|
|
6
|
+
utility: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const BREAKPOINTS: {
|
|
10
|
+
wide: string;
|
|
11
|
+
medium: string;
|
|
12
|
+
narrow: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const STATE: {
|
|
15
|
+
active: string;
|
|
16
|
+
hover: string;
|
|
17
|
+
pressed: string;
|
|
18
|
+
focussed: string;
|
|
19
|
+
disabled: string;
|
|
20
|
+
error: string;
|
|
21
|
+
success: string;
|
|
22
|
+
warning: string;
|
|
23
|
+
progress: string;
|
|
24
|
+
info: string;
|
|
25
|
+
filled: string;
|
|
26
|
+
generic: string;
|
|
27
|
+
removed: string;
|
|
28
|
+
hollow: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const TYPOGRAPHY_VARIANT: {
|
|
31
|
+
display1: string;
|
|
32
|
+
display2: string;
|
|
33
|
+
display3: string;
|
|
34
|
+
heading1: string;
|
|
35
|
+
heading2: string;
|
|
36
|
+
heading3: string;
|
|
37
|
+
subHeading1: string;
|
|
38
|
+
subHeading2: string;
|
|
39
|
+
subHeading3: string;
|
|
40
|
+
body1: string;
|
|
41
|
+
body2: string;
|
|
42
|
+
body3: string;
|
|
43
|
+
body4: string;
|
|
44
|
+
body5: string;
|
|
45
|
+
message: string;
|
|
46
|
+
overline1: string;
|
|
47
|
+
overline2: string;
|
|
48
|
+
overline3: string;
|
|
49
|
+
label1: string;
|
|
50
|
+
label2: string;
|
|
51
|
+
label3: string;
|
|
52
|
+
link1: string;
|
|
53
|
+
link2: string;
|
|
54
|
+
link3: string;
|
|
55
|
+
digits1: string;
|
|
56
|
+
digits2: string;
|
|
57
|
+
digits3: string;
|
|
58
|
+
};
|
|
59
|
+
export declare const BUTTON_VARIANT: {
|
|
60
|
+
primary: string;
|
|
61
|
+
secondary: string;
|
|
62
|
+
tertiary: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const SIZE: {
|
|
65
|
+
small: string;
|
|
66
|
+
medium: string;
|
|
67
|
+
large: string;
|
|
68
|
+
standard: string;
|
|
69
|
+
};
|
|
70
|
+
export declare const BADGE: {
|
|
71
|
+
appointment: string;
|
|
72
|
+
asn: string;
|
|
73
|
+
inventory: string;
|
|
74
|
+
parcel: string;
|
|
75
|
+
product: string;
|
|
76
|
+
route: string;
|
|
77
|
+
shipment: string;
|
|
78
|
+
shoppingCart: string;
|
|
79
|
+
system: string;
|
|
80
|
+
};
|
|
81
|
+
declare const _default: {
|
|
82
|
+
TYPE: {
|
|
83
|
+
primary: string;
|
|
84
|
+
secondary: string;
|
|
85
|
+
tertiary: string;
|
|
86
|
+
destructive: string;
|
|
87
|
+
utility: string;
|
|
88
|
+
icon: string;
|
|
89
|
+
};
|
|
90
|
+
BREAKPOINTS: {
|
|
91
|
+
wide: string;
|
|
92
|
+
medium: string;
|
|
93
|
+
narrow: string;
|
|
94
|
+
};
|
|
95
|
+
STATE: {
|
|
96
|
+
active: string;
|
|
97
|
+
hover: string;
|
|
98
|
+
pressed: string;
|
|
99
|
+
focussed: string;
|
|
100
|
+
disabled: string;
|
|
101
|
+
error: string;
|
|
102
|
+
success: string;
|
|
103
|
+
warning: string;
|
|
104
|
+
progress: string;
|
|
105
|
+
info: string;
|
|
106
|
+
filled: string;
|
|
107
|
+
generic: string;
|
|
108
|
+
removed: string;
|
|
109
|
+
hollow: string;
|
|
110
|
+
};
|
|
111
|
+
TYPOGRAPHY_VARIANT: {
|
|
112
|
+
display1: string;
|
|
113
|
+
display2: string;
|
|
114
|
+
display3: string;
|
|
115
|
+
heading1: string;
|
|
116
|
+
heading2: string;
|
|
117
|
+
heading3: string;
|
|
118
|
+
subHeading1: string;
|
|
119
|
+
subHeading2: string;
|
|
120
|
+
subHeading3: string;
|
|
121
|
+
body1: string;
|
|
122
|
+
body2: string;
|
|
123
|
+
body3: string;
|
|
124
|
+
body4: string;
|
|
125
|
+
body5: string;
|
|
126
|
+
message: string;
|
|
127
|
+
overline1: string;
|
|
128
|
+
overline2: string;
|
|
129
|
+
overline3: string;
|
|
130
|
+
label1: string;
|
|
131
|
+
label2: string;
|
|
132
|
+
label3: string;
|
|
133
|
+
link1: string;
|
|
134
|
+
link2: string;
|
|
135
|
+
link3: string;
|
|
136
|
+
digits1: string;
|
|
137
|
+
digits2: string;
|
|
138
|
+
digits3: string;
|
|
139
|
+
};
|
|
140
|
+
BUTTON_VARIANT: {
|
|
141
|
+
primary: string;
|
|
142
|
+
secondary: string;
|
|
143
|
+
tertiary: string;
|
|
144
|
+
};
|
|
145
|
+
SIZE: {
|
|
146
|
+
small: string;
|
|
147
|
+
medium: string;
|
|
148
|
+
large: string;
|
|
149
|
+
standard: string;
|
|
150
|
+
};
|
|
151
|
+
BADGE: {
|
|
152
|
+
appointment: string;
|
|
153
|
+
asn: string;
|
|
154
|
+
inventory: string;
|
|
155
|
+
parcel: string;
|
|
156
|
+
product: string;
|
|
157
|
+
route: string;
|
|
158
|
+
shipment: string;
|
|
159
|
+
shoppingCart: string;
|
|
160
|
+
system: string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
export default _default;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export const TYPE = {
|
|
2
|
+
primary: "primary",
|
|
3
|
+
secondary: "secondary",
|
|
4
|
+
tertiary: "tertiary",
|
|
5
|
+
destructive: "destructive",
|
|
6
|
+
utility: "utility",
|
|
7
|
+
icon: "icon",
|
|
8
|
+
};
|
|
9
|
+
export const BREAKPOINTS = {
|
|
10
|
+
wide: "wide",
|
|
11
|
+
medium: "medium",
|
|
12
|
+
narrow: "narrow",
|
|
13
|
+
};
|
|
14
|
+
export const STATE = {
|
|
15
|
+
active: "active",
|
|
16
|
+
hover: "hover",
|
|
17
|
+
pressed: "pressed",
|
|
18
|
+
focussed: "focus",
|
|
19
|
+
disabled: "disabled",
|
|
20
|
+
error: "error",
|
|
21
|
+
success: "success",
|
|
22
|
+
warning: "warning",
|
|
23
|
+
progress: "progress",
|
|
24
|
+
info: "info",
|
|
25
|
+
filled: "filled",
|
|
26
|
+
generic: "generic",
|
|
27
|
+
removed: "removed",
|
|
28
|
+
hollow: "hollow",
|
|
29
|
+
};
|
|
30
|
+
export const TYPOGRAPHY_VARIANT = {
|
|
31
|
+
display1: "display1",
|
|
32
|
+
display2: "display2",
|
|
33
|
+
display3: "display3",
|
|
34
|
+
heading1: "heading1",
|
|
35
|
+
heading2: "heading2",
|
|
36
|
+
heading3: "heading3",
|
|
37
|
+
subHeading1: "subHeading1",
|
|
38
|
+
subHeading2: "subHeading2",
|
|
39
|
+
subHeading3: "subHeading3",
|
|
40
|
+
body1: "body1",
|
|
41
|
+
body2: "body2",
|
|
42
|
+
body3: "body3",
|
|
43
|
+
body4: "body4",
|
|
44
|
+
body5: "body5",
|
|
45
|
+
message: "message",
|
|
46
|
+
overline1: "overline1",
|
|
47
|
+
overline2: "overline2",
|
|
48
|
+
overline3: "overline3",
|
|
49
|
+
label1: "label1",
|
|
50
|
+
label2: "label2",
|
|
51
|
+
label3: "label3",
|
|
52
|
+
link1: "link1",
|
|
53
|
+
link2: "link2",
|
|
54
|
+
link3: "link3",
|
|
55
|
+
digits1: "digits1",
|
|
56
|
+
digits2: "digits2",
|
|
57
|
+
digits3: "digits3",
|
|
58
|
+
};
|
|
59
|
+
export const BUTTON_VARIANT = {
|
|
60
|
+
primary: "primary",
|
|
61
|
+
secondary: "secondary",
|
|
62
|
+
tertiary: "tertiary",
|
|
63
|
+
};
|
|
64
|
+
export const SIZE = {
|
|
65
|
+
small: "small",
|
|
66
|
+
medium: "medium",
|
|
67
|
+
large: "large",
|
|
68
|
+
standard: "standard",
|
|
69
|
+
};
|
|
70
|
+
export const BADGE = {
|
|
71
|
+
appointment: "appointment",
|
|
72
|
+
asn: "asn",
|
|
73
|
+
inventory: "inventory",
|
|
74
|
+
parcel: "parcel",
|
|
75
|
+
product: "product",
|
|
76
|
+
route: "route",
|
|
77
|
+
shipment: "shipment",
|
|
78
|
+
shoppingCart: "shopping cart",
|
|
79
|
+
system: "system",
|
|
80
|
+
};
|
|
81
|
+
export default {
|
|
82
|
+
TYPE,
|
|
83
|
+
BREAKPOINTS,
|
|
84
|
+
STATE,
|
|
85
|
+
TYPOGRAPHY_VARIANT,
|
|
86
|
+
BUTTON_VARIANT,
|
|
87
|
+
SIZE,
|
|
88
|
+
BADGE,
|
|
89
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface BaseEventPayload {
|
|
2
|
+
value: string;
|
|
3
|
+
}
|
|
4
|
+
export interface TableEventPayload {
|
|
5
|
+
title?: string;
|
|
6
|
+
item?: unknown;
|
|
7
|
+
value?: string | number;
|
|
8
|
+
}
|
|
9
|
+
export interface ActionEvent<T = Record<string, unknown>> {
|
|
10
|
+
event?: string;
|
|
11
|
+
payload: T;
|
|
12
|
+
type?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FilterChangeEvent {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
type: string;
|
|
18
|
+
value: string;
|
|
19
|
+
onChange: (event: ActionEvent) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface InputEvent extends ActionEvent<BaseEventPayload> {
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|