@gobolt/genesis 0.3.21 → 0.3.22
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/Table/Table.d.ts +51 -0
- package/dist/Table/Table.js +14 -0
- package/dist/Table/TableControls/CustomPagination.d.ts +13 -0
- package/dist/Table/TableControls/CustomPagination.js +158 -0
- package/dist/Table/TableControls/PaginationNumber.d.ts +7 -0
- package/dist/Table/TableControls/PaginationNumber.js +30 -0
- package/dist/Table/styles.d.ts +14 -0
- package/dist/Table/styles.js +64 -0
- package/dist/Table/useTable.d.ts +26 -0
- package/dist/Table/useTable.js +141 -0
- package/dist/Typography/Typography.d.ts +17 -0
- package/dist/Typography/Typography.js +16 -0
- package/dist/Typography/index.d.ts +2 -0
- package/dist/Typography/index.js +1 -0
- package/dist/Typography/styles.d.ts +3 -0
- package/dist/Typography/styles.js +54 -0
- package/dist/components/Badge/Badge.js +9 -32
- package/dist/components/Badge/styles.d.ts +1 -10
- package/dist/components/Badge/styles.js +39 -14
- package/dist/components/Button/Button.js +4 -27
- package/dist/components/Button/IconButton.js +4 -27
- package/dist/components/Button/icon-button-styles.d.ts +1 -12
- package/dist/components/Button/icon-button-styles.js +69 -16
- package/dist/components/Button/styles.d.ts +1 -16
- package/dist/components/Button/styles.js +88 -30
- package/dist/components/Input/Input.js +6 -29
- package/dist/components/Input/styles.d.ts +1 -18
- package/dist/components/Input/styles.js +146 -42
- package/dist/components/Select/Select.js +101 -125
- package/dist/components/Select/SelectTrigger.js +71 -57
- package/dist/components/Table/Table.js +8 -27
- package/dist/components/Table/TableControls/CustomPagination.js +50 -66
- package/dist/components/Table/TableControls/PaginationNumber.js +27 -43
- package/dist/components/Table/TableControls/PrimaryTableControlsRow.js +16 -17
- package/dist/components/Table/TableControls/SecondaryTableControlsRow.js +14 -36
- package/dist/components/Table/TableControls/TableControls.js +3 -4
- package/dist/components/Table/TablePagination.js +4 -21
- package/dist/components/Table/__mocks__/table-mocks.js +15 -24
- package/dist/components/Table/styles.d.ts +1 -15
- package/dist/components/Table/styles.js +57 -13
- package/dist/components/Table/useTable.js +69 -166
- package/dist/components/TableWithControls/TableWithControls.js +6 -7
- package/dist/components/TableWithControls/useTableWithControls.js +82 -63
- package/dist/components/Tooltip/Tooltip.js +1 -2
- package/dist/components/Tooltip/styles.d.ts +1 -14
- package/dist/components/Tooltip/styles.js +23 -14
- package/dist/components/Typography/Typography.js +6 -29
- package/dist/components/Typography/styles.d.ts +3 -21
- package/dist/components/Typography/styles.js +41 -24
- package/dist/components/UtilityButton/UtilityButton.js +4 -27
- package/dist/components/shared/DropdownChevron.js +3 -14
- package/dist/constants/index.js +14 -14
- package/dist/genesis-theme.types.d.ts +263 -0
- package/dist/genesis-theme.types.js +6 -0
- package/dist/index.js +89 -0
- package/dist/styled.d.ts +1 -0
- package/dist/styled.js +44 -0
- package/dist/utils/icon-util.d.ts +2 -2
- package/dist/utils/icon-util.js +16 -19
- package/package.json +1 -1
|
@@ -1,36 +1,9 @@
|
|
|
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
|
-
};
|
|
28
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
2
|
import { useState } from "react";
|
|
30
3
|
import { useTable } from "../Table/useTable";
|
|
31
4
|
import { mockColumns, mockDataSource } from "../Table/__mocks__/table-mocks";
|
|
32
5
|
//import
|
|
33
|
-
|
|
6
|
+
const tableControlsData = {
|
|
34
7
|
primaryTableRowData: {
|
|
35
8
|
sortOptions: [
|
|
36
9
|
{ value: "status", label: _jsx("span", { children: "Status" }) },
|
|
@@ -49,7 +22,7 @@ var tableControlsData = {
|
|
|
49
22
|
totalRecords: mockDataSource.appointments.length,
|
|
50
23
|
},
|
|
51
24
|
};
|
|
52
|
-
|
|
25
|
+
const startingUseTableConfig = {
|
|
53
26
|
columns: mockColumns,
|
|
54
27
|
filters: {
|
|
55
28
|
order: "asc",
|
|
@@ -58,60 +31,106 @@ var startingUseTableConfig = {
|
|
|
58
31
|
disableAutoFetch: true,
|
|
59
32
|
dataSource: [],
|
|
60
33
|
};
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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);
|
|
68
45
|
// Ensure we always return a valid object, even if dataSource is empty
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
newGroups[title] = newGroups[title].filter(
|
|
46
|
+
const safeDataSource = dataSource || [];
|
|
47
|
+
const onGroupItemClick = (title, item) => {
|
|
48
|
+
const newGroups = { ...groups };
|
|
49
|
+
newGroups[title] = newGroups[title].filter((group) => group !== item);
|
|
73
50
|
setGroups(newGroups);
|
|
74
51
|
};
|
|
75
|
-
|
|
52
|
+
const onChange = (actionEvent) => {
|
|
76
53
|
if (actionEvent.event === "inputChange") {
|
|
77
|
-
|
|
78
|
-
if (typeof
|
|
79
|
-
setUseTableConfig(
|
|
80
|
-
|
|
81
|
-
|
|
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
|
+
}));
|
|
82
72
|
}
|
|
83
73
|
}
|
|
84
74
|
if (actionEvent.event === "primaryChange") {
|
|
85
|
-
|
|
86
|
-
if (typeof
|
|
87
|
-
setUseTableConfig(
|
|
88
|
-
|
|
89
|
-
|
|
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
|
+
}));
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
95
|
if (actionEvent.event === "groupItemClick") {
|
|
93
|
-
|
|
96
|
+
const { title, item } = actionEvent.payload;
|
|
94
97
|
if (typeof title === "string" && typeof item === "string") {
|
|
95
98
|
onGroupItemClick(title, item);
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
if (actionEvent.event === "orderClick") {
|
|
99
|
-
setPrimaryTableRowData(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
+
}));
|
|
105
124
|
}
|
|
106
125
|
}
|
|
107
126
|
};
|
|
108
127
|
return {
|
|
109
|
-
onChange
|
|
110
|
-
primaryTableRowData
|
|
128
|
+
onChange,
|
|
129
|
+
primaryTableRowData,
|
|
111
130
|
secondaryTableRowData: newSecondaryTableRowData,
|
|
112
131
|
dataSource: safeDataSource,
|
|
113
|
-
columns
|
|
114
|
-
rowSelection
|
|
115
|
-
updateDataSource
|
|
132
|
+
columns,
|
|
133
|
+
rowSelection,
|
|
134
|
+
updateDataSource,
|
|
116
135
|
};
|
|
117
136
|
};
|
|
@@ -2,8 +2,7 @@ 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
|
-
|
|
6
|
-
var _b = _a.tip, tip = _b === void 0 ? "" : _b, children = _a.children;
|
|
5
|
+
const Tooltip = ({ tip = "", children }) => {
|
|
7
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 }));
|
|
8
7
|
};
|
|
9
8
|
export default Tooltip;
|
|
@@ -1,19 +1,6 @@
|
|
|
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
|
-
}
|
|
7
1
|
export declare const getGenesisClass: ({ colors, borderRadius, sizing }: {
|
|
8
2
|
colors: any;
|
|
9
3
|
borderRadius: any;
|
|
10
4
|
sizing: any;
|
|
11
5
|
}, type?: string, state?: string) => string;
|
|
12
|
-
export declare const Tooltip:
|
|
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 {};
|
|
6
|
+
export declare const Tooltip: any;
|
|
@@ -1,17 +1,26 @@
|
|
|
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
|
-
};
|
|
5
1
|
import styled from "@gobolt/genesis/utils/styled";
|
|
6
2
|
import { Tooltip as AntTooltip } from "antd";
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 }) => {
|
|
15
24
|
return getGenesisClass(theme, type, state);
|
|
16
|
-
}
|
|
17
|
-
|
|
25
|
+
}}
|
|
26
|
+
`;
|
|
@@ -1,39 +1,16 @@
|
|
|
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
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import * as S from "./styles";
|
|
25
3
|
import { useGenesis } from "@gobolt/genesis/providers";
|
|
26
4
|
import { TYPE, TYPOGRAPHY_VARIANT, STATE, } from "@gobolt/genesis/constants";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var breakpoint = useGenesis().breakpoint;
|
|
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();
|
|
30
7
|
if (variant.startsWith("display") || variant.startsWith("heading")) {
|
|
31
|
-
|
|
32
|
-
return (_jsx(S.Headline,
|
|
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 }));
|
|
33
10
|
}
|
|
34
11
|
if (isText) {
|
|
35
|
-
return (_jsx(S.Text,
|
|
12
|
+
return (_jsx(S.Text, { state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, "$isFullWidth": isFullWidth, style: style, disabled: isDisabled, ...rest, children: children }));
|
|
36
13
|
}
|
|
37
|
-
return (_jsx(S.Paragraph,
|
|
14
|
+
return (_jsx(S.Paragraph, { state: state, "$themeType": themeType, variant: variant, breakpoint: breakpoint, color: color, "$isFullWidth": isFullWidth, style: style, disabled: isDisabled, ...rest, children: children }));
|
|
38
15
|
};
|
|
39
16
|
export default Typography;
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
export declare const Headline: any;
|
|
2
|
+
export declare const Paragraph: any;
|
|
3
|
+
export declare const Text: any;
|
|
@@ -1,37 +1,54 @@
|
|
|
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
|
-
};
|
|
5
1
|
import styled from "@gobolt/genesis/utils/styled";
|
|
6
2
|
import { Typography as AntTypography } from "antd";
|
|
7
|
-
|
|
8
|
-
return
|
|
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
|
+
`;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
const getColor = (color, colors, $themeType) => {
|
|
11
12
|
if (color) {
|
|
12
13
|
return color;
|
|
13
14
|
}
|
|
14
15
|
return colors[$themeType].active.color;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
-
return
|
|
17
|
+
const getFontFamily = (variant) => {
|
|
18
|
+
return `
|
|
19
|
+
${variant.includes("digits")
|
|
18
20
|
? "'Roboto Mono', sans-serif"
|
|
19
|
-
: "'Inter', sans-serif"
|
|
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");
|
|
21
|
+
: "'Inter', sans-serif"} !important;
|
|
22
|
+
`;
|
|
24
23
|
};
|
|
25
|
-
|
|
26
|
-
|
|
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, }) => {
|
|
27
42
|
return getGenesisTypographyClass(theme, $themeType, variant, state, breakpoint, color, $isFullWidth);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
}}
|
|
44
|
+
`;
|
|
45
|
+
export const Paragraph = styled(AntTypography.Paragraph) `
|
|
46
|
+
${({ theme, $themeType, variant, state, breakpoint, color, $isFullWidth, }) => {
|
|
31
47
|
return getGenesisTypographyClass(theme, $themeType, variant, state, breakpoint, color, $isFullWidth);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
}}
|
|
49
|
+
`;
|
|
50
|
+
export const Text = styled(AntTypography.Text) `
|
|
51
|
+
${({ theme, $themeType, variant, state, breakpoint, color, $isFullWidth, }) => {
|
|
35
52
|
return getGenesisTypographyClass(theme, $themeType, variant, state, breakpoint, color, $isFullWidth);
|
|
36
|
-
}
|
|
37
|
-
|
|
53
|
+
}}
|
|
54
|
+
`;
|
|
@@ -1,32 +1,9 @@
|
|
|
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
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import Button from "../Button";
|
|
25
3
|
import { TYPE } from "../../constants";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return (_jsx(Button, __assign({ onClick: onClick, themeType: themeType, state: buttonState, disabled: state === "disabled" || rest.disabled, isIconButton: isIconButton, size: size }, rest, { children: children })));
|
|
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 }));
|
|
31
8
|
};
|
|
32
9
|
export default UtilityButton;
|
|
@@ -1,18 +1,7 @@
|
|
|
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
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import { useGenesis } from "@gobolt/genesis/providers";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return (_jsx("svg",
|
|
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" }) }));
|
|
17
6
|
};
|
|
18
7
|
export default DropdownChevron;
|
package/dist/constants/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const TYPE = {
|
|
2
2
|
primary: "primary",
|
|
3
3
|
secondary: "secondary",
|
|
4
4
|
tertiary: "tertiary",
|
|
@@ -6,12 +6,12 @@ export var TYPE = {
|
|
|
6
6
|
utility: "utility",
|
|
7
7
|
icon: "icon",
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export const BREAKPOINTS = {
|
|
10
10
|
wide: "wide",
|
|
11
11
|
medium: "medium",
|
|
12
12
|
narrow: "narrow",
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export const STATE = {
|
|
15
15
|
active: "active",
|
|
16
16
|
hover: "hover",
|
|
17
17
|
pressed: "pressed",
|
|
@@ -27,7 +27,7 @@ export var STATE = {
|
|
|
27
27
|
removed: "removed",
|
|
28
28
|
hollow: "hollow",
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export const TYPOGRAPHY_VARIANT = {
|
|
31
31
|
display1: "display1",
|
|
32
32
|
display2: "display2",
|
|
33
33
|
display3: "display3",
|
|
@@ -56,18 +56,18 @@ export var TYPOGRAPHY_VARIANT = {
|
|
|
56
56
|
digits2: "digits2",
|
|
57
57
|
digits3: "digits3",
|
|
58
58
|
};
|
|
59
|
-
export
|
|
59
|
+
export const BUTTON_VARIANT = {
|
|
60
60
|
primary: "primary",
|
|
61
61
|
secondary: "secondary",
|
|
62
62
|
tertiary: "tertiary",
|
|
63
63
|
};
|
|
64
|
-
export
|
|
64
|
+
export const SIZE = {
|
|
65
65
|
small: "small",
|
|
66
66
|
medium: "medium",
|
|
67
67
|
large: "large",
|
|
68
68
|
standard: "standard",
|
|
69
69
|
};
|
|
70
|
-
export
|
|
70
|
+
export const BADGE = {
|
|
71
71
|
appointment: "appointment",
|
|
72
72
|
asn: "asn",
|
|
73
73
|
inventory: "inventory",
|
|
@@ -79,11 +79,11 @@ export var BADGE = {
|
|
|
79
79
|
system: "system",
|
|
80
80
|
};
|
|
81
81
|
export default {
|
|
82
|
-
TYPE
|
|
83
|
-
BREAKPOINTS
|
|
84
|
-
STATE
|
|
85
|
-
TYPOGRAPHY_VARIANT
|
|
86
|
-
BUTTON_VARIANT
|
|
87
|
-
SIZE
|
|
88
|
-
BADGE
|
|
82
|
+
TYPE,
|
|
83
|
+
BREAKPOINTS,
|
|
84
|
+
STATE,
|
|
85
|
+
TYPOGRAPHY_VARIANT,
|
|
86
|
+
BUTTON_VARIANT,
|
|
87
|
+
SIZE,
|
|
88
|
+
BADGE,
|
|
89
89
|
};
|