@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,51 +1,28 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
2
|
import * as S from "./styles";
|
|
25
3
|
import { Typography } from "@gobolt/genesis/components";
|
|
26
4
|
import { useGenesis } from "@gobolt/genesis/providers";
|
|
27
5
|
import { getBadgeStateIcon } from "@gobolt/genesis/utils/icon-util";
|
|
28
6
|
import { HiOutlineX } from "react-icons/hi";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var role = hasClose ? "button" : "badge";
|
|
7
|
+
const isBadgeIconFilled = false;
|
|
8
|
+
const Badge = ({ label, state = "info", isDisabled, hasClose = false, onClick = () => { }, size = "normal", hasIcon = true, customIcon = null, backgroundColor = null, textColor = null, hasHover = false, ...rest }) => {
|
|
9
|
+
const { theme } = useGenesis();
|
|
10
|
+
const role = hasClose ? "button" : "badge";
|
|
34
11
|
if (!label) {
|
|
35
|
-
return (_jsx(S.Badge,
|
|
12
|
+
return (_jsx(S.Badge, { label: label, role: "badge", state: state, disabled: isDisabled, style: {
|
|
36
13
|
padding: "4px 4px",
|
|
37
|
-
}, "$hasHover": hasHover
|
|
14
|
+
}, "$hasHover": hasHover, ...rest, children: _jsx("div", { style: {
|
|
38
15
|
display: "flex",
|
|
39
16
|
justifyContent: "center",
|
|
40
17
|
alignItems: "center",
|
|
41
|
-
}, children: getBadgeStateIcon(state, backgroundColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon) }) }))
|
|
18
|
+
}, children: getBadgeStateIcon(state, backgroundColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon) }) }));
|
|
42
19
|
}
|
|
43
|
-
return (_jsxs(S.Badge,
|
|
20
|
+
return (_jsxs(S.Badge, { label: label, role: role, onClick: onClick, state: state, disabled: isDisabled, style: { cursor: role === "button" ? "pointer" : "default" }, "$backgroundColor": backgroundColor, "$hasHover": hasHover, ...rest, children: [getBadgeStateIcon(state, isDisabled
|
|
44
21
|
? theme.colors.status.disabled.default
|
|
45
22
|
: textColor || theme.colors.status[state].onsurface, isBadgeIconFilled, hasIcon, customIcon), _jsx(Typography, { variant: size === "small" ? "label3" : "label2", color: isDisabled
|
|
46
23
|
? theme.colors.status.disabled.default
|
|
47
24
|
: textColor || theme.colors.status[state].onsurface,
|
|
48
25
|
// @ts-ignore
|
|
49
|
-
isDisabled: isDisabled, children: label }), hasClose ? (_jsx(HiOutlineX, { color: theme.colors.status[state].onsurface })) : null] }))
|
|
26
|
+
isDisabled: isDisabled, children: label }), hasClose ? (_jsx(HiOutlineX, { color: theme.colors.status[state].onsurface })) : null] }));
|
|
50
27
|
};
|
|
51
28
|
export default Badge;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import { type GenesisTheme } from "@gobolt/genesis/styles/theme/genesis-theme.types";
|
|
2
2
|
import { type State } from "./Badge";
|
|
3
|
-
interface StyledBadgeProperties {
|
|
4
|
-
theme?: GenesisTheme;
|
|
5
|
-
state?: State;
|
|
6
|
-
label?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
$backgroundColor?: string;
|
|
9
|
-
$hasHover?: boolean;
|
|
10
|
-
}
|
|
11
3
|
export declare const getGenesisClass: (theme: GenesisTheme, state: State, label?: string, disabled?: boolean, $backgroundColor?: string, $hasHover?: boolean) => string;
|
|
12
|
-
export declare const Badge:
|
|
13
|
-
export {};
|
|
4
|
+
export declare const Badge: any;
|
|
@@ -1,21 +1,46 @@
|
|
|
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
|
+
const getBorderColor = (theme, state) => {
|
|
7
3
|
if (state === "hollow") {
|
|
8
4
|
return theme.colors.inputs.surface.border;
|
|
9
5
|
}
|
|
10
6
|
return theme.colors.status[state].surface;
|
|
11
7
|
};
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
export const getGenesisClass = (theme, state, label, disabled, $backgroundColor, $hasHover) => `
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-self: inherit;
|
|
11
|
+
gap: 4px;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
position: relative;
|
|
15
|
+
padding-top: ${theme.components.badge["ver-padding"]}px;
|
|
16
|
+
padding-bottom: ${theme.components.badge["ver-padding"]}px;
|
|
17
|
+
padding-left: ${theme.components.badge["left-padding"]}px;
|
|
18
|
+
padding-right: ${theme.components.badge["right-padding"]}px;
|
|
19
|
+
border-radius: ${theme.components.badge.radius}px;
|
|
20
|
+
border: 1px solid ${getBorderColor(theme, state)};
|
|
21
|
+
background-color: ${$backgroundColor || theme.colors.status[state].surface};
|
|
22
|
+
|
|
23
|
+
&:not(:disabled):hover {
|
|
24
|
+
${$hasHover
|
|
25
|
+
? `background-color: ${theme.colors.status[state]["surface-hover"]};`
|
|
26
|
+
: ""}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
${disabled
|
|
30
|
+
? `
|
|
31
|
+
background-color: ${theme.colors.status.disabled.surface} !important;
|
|
32
|
+
border-color: ${theme.colors.status.disabled} !important;
|
|
33
|
+
border: none;
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
}
|
|
39
|
+
`
|
|
40
|
+
: ""}
|
|
41
|
+
`;
|
|
42
|
+
export const Badge = styled.div `
|
|
43
|
+
${({ theme, state, label, disabled, $backgroundColor, $hasHover, }) => {
|
|
19
44
|
return getGenesisClass(theme, state, label, disabled, $backgroundColor, $hasHover);
|
|
20
|
-
}
|
|
21
|
-
|
|
45
|
+
}}
|
|
46
|
+
`;
|
|
@@ -1,36 +1,13 @@
|
|
|
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
|
+
const getState = (state, isSelected) => {
|
|
26
4
|
if (isSelected) {
|
|
27
5
|
return "selected";
|
|
28
6
|
}
|
|
29
7
|
return state === "active" || state === "disabled" ? state : "active";
|
|
30
8
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return (_jsx(S.Button, __assign({ onClick: onClick, "$themeType": themeType, "$state": buttonState, disabled: state === "disabled" || rest.disabled, "$isIconButton": isIconButton, size: size }, rest, { children: children })));
|
|
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 }));
|
|
35
12
|
};
|
|
36
13
|
export default Button;
|
|
@@ -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 * as S from "./icon-button-styles";
|
|
25
3
|
import { TYPE } from "../../constants";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return (_jsx(S.Button, __assign({ onClick: onClick, "$themeType": themeType, "$state": buttonState, disabled: state === "disabled" || rest.disabled, size: size, "$isSelected": isSelected }, rest, { children: icon })));
|
|
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 }));
|
|
31
8
|
};
|
|
32
9
|
export default IconButton;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
interface StyledIconButtonProperties {
|
|
3
|
-
theme?: GenesisTheme;
|
|
4
|
-
$themeType?: "primary" | "secondary" | "tertiary" | "destructive" | "utility" | "icon";
|
|
5
|
-
$state?: "active" | "hover" | "pressed" | "focus" | "disabled" | "selected";
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
$isIconButton?: boolean;
|
|
8
|
-
$isSelected?: boolean;
|
|
9
|
-
size?: "small" | "normal" | "large";
|
|
10
|
-
}
|
|
11
|
-
export declare const Button: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, StyledIconButtonProperties>> & string;
|
|
12
|
-
export {};
|
|
1
|
+
export declare const Button: any;
|
|
@@ -1,23 +1,76 @@
|
|
|
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
|
+
const getPadding = (size, sizing) => {
|
|
7
3
|
if (size === "small") {
|
|
8
|
-
return
|
|
4
|
+
return `${sizing.Size1}px ${sizing.Size1}px`;
|
|
9
5
|
}
|
|
10
|
-
return
|
|
6
|
+
return `${sizing.Size2}px ${sizing.Size2}px`;
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const getVariant = ({ colors, sizing, borderRadius, components }, $themeType, $state, size, $isSelected) => {
|
|
9
|
+
return `
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
text-align: center;
|
|
14
|
+
color: ${colors[$themeType][$state].color};
|
|
15
|
+
font-size: ${sizing.Size4}px;
|
|
16
|
+
line-height: ${sizing.Size6}px;
|
|
17
|
+
letter-spacing: 0;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
border-width: 1px;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
width: auto; !important;
|
|
22
|
+
height: auto; !important;
|
|
23
|
+
|
|
24
|
+
background-color:${$isSelected
|
|
15
25
|
? colors[$themeType].hover.backgroundColor
|
|
16
|
-
: colors[$themeType][$state].backgroundColor
|
|
26
|
+
: colors[$themeType][$state].backgroundColor};
|
|
27
|
+
padding: ${getPadding(size, sizing)};
|
|
28
|
+
|
|
29
|
+
box-shadow: ${$themeType === "utility" ? "0px 1px 2px 0px #00000026" : "none"};
|
|
30
|
+
|
|
31
|
+
border-radius: ${borderRadius.BorderRadiusMd}px;
|
|
32
|
+
gap: ${components.button.gap}px;
|
|
33
|
+
border-style: solid;
|
|
34
|
+
border-color: ${colors[$themeType][$state].borderColor};
|
|
35
|
+
|
|
36
|
+
transition: all 0.2s ease-in-out;
|
|
37
|
+
|
|
38
|
+
&:hover {
|
|
39
|
+
color: ${colors[$themeType].hover.color};
|
|
40
|
+
background-color: ${colors[$themeType].hover.backgroundColor};
|
|
41
|
+
border-color: ${colors[$themeType].hover.borderColor};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:active {
|
|
45
|
+
color: ${colors[$themeType].pressed.color};
|
|
46
|
+
background-color: ${colors[$themeType].pressed.backgroundColor};
|
|
47
|
+
border-color: ${colors[$themeType].pressed.borderColor};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:focus-visible {
|
|
51
|
+
outline: none;
|
|
52
|
+
color: ${colors[$themeType].focussed.color};
|
|
53
|
+
background-color: ${colors[$themeType].focussed.backgroundColor};
|
|
54
|
+
box-shadow: 0 0 0 1px #fff, 0 0 0 4px ${colors[$themeType].focussed.ringColor};
|
|
55
|
+
border-radius: ${borderRadius.BorderRadiusMd}px;
|
|
56
|
+
border-color: ${colors[$themeType].focussed.borderColor};
|
|
57
|
+
transition: box-shadow 0.2s ease-in-out;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:disabled {
|
|
61
|
+
color: ${colors[$themeType].disabled.color};
|
|
62
|
+
background-color: ${colors[$themeType].disabled.backgroundColor};
|
|
63
|
+
border-color: ${colors[$themeType].disabled.borderColor};
|
|
64
|
+
cursor: not-allowed;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
17
67
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
68
|
+
const getGenesisButtonClass = (theme, $themeType, $state, size, $isSelected) => `
|
|
69
|
+
font-family: 'Inter', sans-serif;
|
|
70
|
+
${getVariant(theme, $themeType, $state, size, $isSelected)}
|
|
71
|
+
`;
|
|
72
|
+
export const Button = styled.button `
|
|
73
|
+
${({ theme, $themeType, $state, size, $isSelected }) => {
|
|
21
74
|
return getGenesisButtonClass(theme, $themeType, $state, size, $isSelected);
|
|
22
|
-
}
|
|
23
|
-
|
|
75
|
+
}}
|
|
76
|
+
`;
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { type GenesisTheme } from "@gobolt/genesis/styles/theme/genesis-theme.types";
|
|
3
|
-
interface StyledButtonProperties extends Omit<AntButtonProperties, "type" | "size"> {
|
|
4
|
-
theme?: GenesisTheme;
|
|
5
|
-
$themeType?: "primary" | "secondary" | "tertiary" | "destructive" | "utility" | "icon";
|
|
6
|
-
$state?: "active" | "hover" | "pressed" | "focus" | "disabled" | "selected";
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
$isIconButton?: boolean;
|
|
9
|
-
size?: "small" | "normal" | "large";
|
|
10
|
-
}
|
|
11
|
-
export declare const Button: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<AntButtonProperties & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>, "ref"> & {
|
|
12
|
-
ref?: ((instance: HTMLButtonElement | HTMLAnchorElement | 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<HTMLButtonElement | HTMLAnchorElement> | null | undefined;
|
|
13
|
-
}, StyledButtonProperties>> & string & Omit<import("react").ForwardRefExoticComponent<AntButtonProperties & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
|
|
14
|
-
Group: import("react").FC<import("antd/es/button").ButtonGroupProps>;
|
|
15
|
-
}, keyof import("react").Component<any, {}, any>>;
|
|
16
|
-
export {};
|
|
1
|
+
export declare const Button: any;
|
|
@@ -1,60 +1,118 @@
|
|
|
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 { Button as AntButton } from "antd";
|
|
7
|
-
|
|
3
|
+
const getPadding = (size, $themeType, sizing, $isIconButton) => {
|
|
8
4
|
if ($isIconButton && (size === "normal" || size === "large")) {
|
|
9
|
-
return
|
|
5
|
+
return `${sizing.Size2}px ${sizing.Size2}px`;
|
|
10
6
|
}
|
|
11
7
|
if ($isIconButton && size === "small") {
|
|
12
|
-
return
|
|
8
|
+
return `${sizing.Size1}px ${sizing.Size1}px`;
|
|
13
9
|
}
|
|
14
10
|
// utility button padding is different from the main button
|
|
15
11
|
if ($themeType === "utility" && size === "small") {
|
|
16
|
-
return
|
|
12
|
+
return `${sizing.Size1_5}px ${sizing.Size2}px`;
|
|
17
13
|
}
|
|
18
14
|
if ($themeType === "utility" && (size === "normal" || size === "large")) {
|
|
19
|
-
return
|
|
15
|
+
return `${sizing.Size2_5}px ${sizing.Size3}px`;
|
|
20
16
|
}
|
|
21
17
|
if (size === "small") {
|
|
22
|
-
return
|
|
18
|
+
return `${sizing.Size1_5}px ${sizing.Size4}px`;
|
|
23
19
|
}
|
|
24
20
|
if (size === "normal" || size === "large") {
|
|
25
|
-
return
|
|
21
|
+
return `${sizing.Size2_5}px ${sizing.Size6}px`;
|
|
26
22
|
}
|
|
27
|
-
return
|
|
23
|
+
return `${sizing.Size2}px ${sizing.Size2}px`;
|
|
28
24
|
};
|
|
29
|
-
|
|
25
|
+
const getHeight = (size) => {
|
|
30
26
|
if (size === "normal" || size === "large") {
|
|
31
|
-
return
|
|
27
|
+
return `40px`;
|
|
32
28
|
}
|
|
33
29
|
if (size === "small") {
|
|
34
|
-
return
|
|
30
|
+
return `32px`;
|
|
35
31
|
}
|
|
36
|
-
return
|
|
32
|
+
return `40px`;
|
|
37
33
|
};
|
|
38
|
-
|
|
34
|
+
const getWidth = (size, $isIconButton) => {
|
|
39
35
|
if (!$isIconButton) {
|
|
40
|
-
return
|
|
36
|
+
return `auto`;
|
|
41
37
|
}
|
|
42
38
|
if (size === "normal" || size === "large") {
|
|
43
|
-
return
|
|
39
|
+
return `40px`;
|
|
44
40
|
}
|
|
45
41
|
if (size === "small") {
|
|
46
|
-
return
|
|
42
|
+
return `32px`;
|
|
47
43
|
}
|
|
48
|
-
return
|
|
44
|
+
return `40px`;
|
|
49
45
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
const getVariant = ({ colors, sizing, borderRadius, components }, $themeType, $state, size, $isIconButton) => {
|
|
47
|
+
const backgroundColor = colors[$themeType][$state].backgroundColor;
|
|
48
|
+
return `
|
|
49
|
+
&.ant-btn {
|
|
50
|
+
|
|
51
|
+
color: ${colors[$themeType][$state].color};
|
|
52
|
+
font-size: ${sizing.Size4}px;
|
|
53
|
+
line-height: ${sizing.Size6}px;
|
|
54
|
+
letter-spacing: 0;
|
|
55
|
+
font-weight: 400;
|
|
56
|
+
border-width: 1px;
|
|
57
|
+
line-height: 1 !important;
|
|
58
|
+
|
|
59
|
+
width: ${getWidth(size, $isIconButton)}; !important;
|
|
60
|
+
height: ${getHeight(size)}; !important;
|
|
61
|
+
|
|
62
|
+
background-color: ${colors[$themeType][$state].backgroundColor};
|
|
63
|
+
padding: ${getPadding(size, $themeType, sizing, $isIconButton)};
|
|
64
|
+
|
|
65
|
+
box-shadow: ${$themeType === "utility" ? "0px 1px 2px 0px #00000026" : "none"};
|
|
66
|
+
|
|
67
|
+
border-radius: ${borderRadius.BorderRadiusMd}px;
|
|
68
|
+
gap: ${components.button.gap}px;
|
|
69
|
+
border-style: solid;
|
|
70
|
+
border-color: ${colors[$themeType][$state].borderColor};
|
|
71
|
+
|
|
72
|
+
transition: all 0.2s ease-in-out;
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
color: ${colors[$themeType].hover.color};
|
|
76
|
+
background-color: ${colors[$themeType].hover.backgroundColor};
|
|
77
|
+
border-color: ${colors[$themeType].hover.borderColor};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:active {
|
|
81
|
+
color: ${colors[$themeType].pressed.color};
|
|
82
|
+
background-color: ${colors[$themeType].pressed.backgroundColor};
|
|
83
|
+
border-color: ${colors[$themeType].pressed.borderColor};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&:focus-visible {
|
|
87
|
+
outline: none;
|
|
88
|
+
color: ${colors[$themeType].focussed.color};
|
|
89
|
+
background-color: ${colors[$themeType].focussed.backgroundColor};
|
|
90
|
+
box-shadow: 0 0 0 1px #fff, 0 0 0 4px ${colors[$themeType].focussed.ringColor};
|
|
91
|
+
border-radius: ${borderRadius.BorderRadiusMd}px;
|
|
92
|
+
border-color: ${colors[$themeType].focussed.borderColor};
|
|
93
|
+
transition: box-shadow 0.2s ease-in-out;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:disabled {
|
|
97
|
+
color: ${colors[$themeType].disabled.color};
|
|
98
|
+
background-color: ${colors[$themeType].disabled.backgroundColor};
|
|
99
|
+
border-color: ${colors[$themeType].disabled.borderColor};
|
|
100
|
+
cursor: not-allowed;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
`;
|
|
54
106
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
107
|
+
const getGenesisButtonClass = (theme, $themeType, $state, $isIconButton, size) => `
|
|
108
|
+
&.ant-btn {
|
|
109
|
+
font-family: 'Inter', sans-serif;
|
|
110
|
+
|
|
111
|
+
${getVariant(theme, $themeType, $state, size, $isIconButton)}
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
114
|
+
export const Button = styled(AntButton) `
|
|
115
|
+
${({ theme, $themeType, $state, children, $isIconButton, size }) => {
|
|
58
116
|
return getGenesisButtonClass(theme, $themeType, $state, $isIconButton, size);
|
|
59
|
-
}
|
|
60
|
-
|
|
117
|
+
}}
|
|
118
|
+
`;
|
|
@@ -1,44 +1,21 @@
|
|
|
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 React from "react";
|
|
25
3
|
import * as S from "./styles";
|
|
26
4
|
import { STATE } from "../../constants";
|
|
27
5
|
import DropdownChevron from "../shared/DropdownChevron";
|
|
28
6
|
import { Select } from "antd";
|
|
29
|
-
|
|
30
|
-
var _b = _a.state, state = _b === void 0 ? STATE.active : _b, _c = _a.size, size = _c === void 0 ? "normal" : _c, onChange = _a.onChange, value = _a.value, rest = __rest(_a, ["state", "size", "onChange", "value"]);
|
|
7
|
+
const Input = React.forwardRef(({ state = STATE.active, size = "normal", onChange, value, ...rest }, ref) => {
|
|
31
8
|
// make sure rest.type is ignored in the final output
|
|
32
9
|
// we don't want the rest type "number" to be passed to the input
|
|
33
10
|
// since we have our own version of type
|
|
34
|
-
|
|
11
|
+
const { type, ...validRest } = rest;
|
|
35
12
|
// If addonAfter is a Select, use our custom chevron
|
|
36
|
-
|
|
13
|
+
const addonAfter = React.isValidElement(rest.addonAfter) && rest.addonAfter.type === Select
|
|
37
14
|
? React.cloneElement(rest.addonAfter, {
|
|
38
15
|
suffixIcon: _jsx(DropdownChevron, {}),
|
|
39
16
|
})
|
|
40
17
|
: rest.addonAfter;
|
|
41
|
-
|
|
18
|
+
const handleChange = React.useCallback((e) => {
|
|
42
19
|
if (onChange) {
|
|
43
20
|
onChange({
|
|
44
21
|
event: "inputChange",
|
|
@@ -48,9 +25,9 @@ var Input = React.forwardRef(function (_a, ref) {
|
|
|
48
25
|
});
|
|
49
26
|
}
|
|
50
27
|
}, [onChange]);
|
|
51
|
-
return (_jsx(S.Input,
|
|
28
|
+
return (_jsx(S.Input, { ...validRest, ref: ref, size: size, state: state, disabled: state === "disabled" || rest.disabled, addonAfter: addonAfter, style: {
|
|
52
29
|
height: size === "normal" || size === "large" ? "40px" : "32px",
|
|
53
|
-
}, onChange: handleChange, value: value }))
|
|
30
|
+
}, onChange: handleChange, value: value }));
|
|
54
31
|
});
|
|
55
32
|
Input.displayName = "Input";
|
|
56
33
|
Input.__ANT_INPUT = true;
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { STATE } from "@gobolt/genesis/constants";
|
|
3
|
-
import type { InputRef } from "antd";
|
|
4
|
-
interface InputStyledProperties extends Omit<AntInputProperties, "size"> {
|
|
5
|
-
state?: keyof typeof STATE;
|
|
6
|
-
size?: "normal" | "small" | "large";
|
|
7
|
-
value?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const Input: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<AntInputProperties & import("react").RefAttributes<InputRef>, "ref"> & {
|
|
10
|
-
ref?: ((instance: InputRef | 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<InputRef> | null | undefined;
|
|
11
|
-
}, InputStyledProperties>> & string & Omit<import("react").ForwardRefExoticComponent<AntInputProperties & import("react").RefAttributes<InputRef>> & {
|
|
12
|
-
Group: import("react").FC<import("antd/es/input").GroupProps>;
|
|
13
|
-
Search: import("react").ForwardRefExoticComponent<import("antd/es/input").SearchProps & import("react").RefAttributes<InputRef>>;
|
|
14
|
-
TextArea: import("react").ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
|
|
15
|
-
Password: import("react").ForwardRefExoticComponent<import("antd/es/input").PasswordProps & import("react").RefAttributes<InputRef>>;
|
|
16
|
-
OTP: import("react").ForwardRefExoticComponent<import("antd/es/input/OTP").OTPProps & import("react").RefAttributes<import("antd/es/input/OTP").OTPRef>>;
|
|
17
|
-
}, keyof import("react").Component<any, {}, any>>;
|
|
18
|
-
export {};
|
|
1
|
+
export declare const Input: any;
|