@wireapp/react-ui-kit 9.16.4 → 9.17.0
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/lib/Form/Button.d.ts +1 -3
- package/lib/Form/Button.d.ts.map +1 -1
- package/lib/Form/Button.js +21 -92
- package/lib/Form/Button.styles.d.ts +5 -0
- package/lib/Form/Button.styles.d.ts.map +1 -0
- package/lib/Form/Button.styles.js +178 -0
- package/lib/Form/ButtonLink.d.ts.map +1 -1
- package/lib/Form/ButtonLink.js +2 -2
- package/lib/Form/RoundIconButton.d.ts.map +1 -1
- package/lib/Form/RoundIconButton.js +2 -1
- package/package.json +8 -8
package/lib/Form/Button.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { CSSObject } from '@emotion/react';
|
|
2
|
-
import { Theme } from '../Layout';
|
|
3
1
|
import { TextProps } from '../Text';
|
|
4
2
|
export declare enum ButtonVariant {
|
|
5
3
|
PRIMARY = "primary",
|
|
@@ -15,8 +13,8 @@ export interface ButtonProps<T = HTMLButtonElement> extends TextProps<T> {
|
|
|
15
13
|
loadingColor?: string;
|
|
16
14
|
noCapital?: boolean;
|
|
17
15
|
showLoading?: boolean;
|
|
16
|
+
isActive?: boolean;
|
|
18
17
|
}
|
|
19
|
-
export declare const buttonStyle: <T>(theme: Theme, props: ButtonProps<T>) => CSSObject;
|
|
20
18
|
export declare const Button: ({ showLoading, children, loadingColor, ...props }: ButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
21
19
|
export declare const filterButtonProps: (props: ButtonProps) => Object;
|
|
22
20
|
//# sourceMappingURL=Button.d.ts.map
|
package/lib/Form/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Form/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Form/Button.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAC,SAAS,EAAkB,MAAM,SAAS,CAAC;AAGnD,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,iBAAiB,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,sDAAmE,WAAW,qDAIhG,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,WAAW,WAEnD,CAAC"}
|
package/lib/Form/Button.js
CHANGED
|
@@ -11,10 +11,28 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.filterButtonProps = exports.Button = exports.
|
|
14
|
+
exports.filterButtonProps = exports.Button = exports.ButtonVariant = void 0;
|
|
15
15
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
16
|
+
/*
|
|
17
|
+
* Wire
|
|
18
|
+
* Copyright (C) 2018 Wire Swiss GmbH
|
|
19
|
+
*
|
|
20
|
+
* This program is free software: you can redistribute it and/or modify
|
|
21
|
+
* it under the terms of the GNU General Public License as published by
|
|
22
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
23
|
+
* (at your option) any later version.
|
|
24
|
+
*
|
|
25
|
+
* This program is distributed in the hope that it will be useful,
|
|
26
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
28
|
+
* GNU General Public License for more details.
|
|
29
|
+
*
|
|
30
|
+
* You should have received a copy of the GNU General Public License
|
|
31
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
const Button_styles_1 = require("./Button.styles");
|
|
16
35
|
const Identity_1 = require("../Identity");
|
|
17
|
-
const motions_1 = require("../Identity/motions");
|
|
18
36
|
const Misc_1 = require("../Misc");
|
|
19
37
|
const Text_1 = require("../Text");
|
|
20
38
|
const util_1 = require("../util");
|
|
@@ -27,98 +45,9 @@ var ButtonVariant;
|
|
|
27
45
|
ButtonVariant["SEND"] = "send";
|
|
28
46
|
ButtonVariant["CANCEL"] = "cancel";
|
|
29
47
|
})(ButtonVariant || (exports.ButtonVariant = ButtonVariant = {}));
|
|
30
|
-
const buttonStyle = (theme, _a) => {
|
|
31
|
-
var { variant = ButtonVariant.PRIMARY, backgroundColor, block = false, disabled = false, noCapital = false, bold = true, center = true, color = Identity_1.COLOR.WHITE, fontSize = theme.fontSizes.base, noWrap = true, textTransform = 'none', truncate = true } = _a, props = __rest(_a, ["variant", "backgroundColor", "block", "disabled", "noCapital", "bold", "center", "color", "fontSize", "noWrap", "textTransform", "truncate"]);
|
|
32
|
-
return (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, Text_1.textStyle)(theme, Object.assign({ block,
|
|
33
|
-
bold,
|
|
34
|
-
center,
|
|
35
|
-
disabled,
|
|
36
|
-
fontSize,
|
|
37
|
-
noWrap,
|
|
38
|
-
textTransform,
|
|
39
|
-
truncate }, props))), { border: 0, cursor: disabled ? 'default' : 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: '16px', padding: 0, outline: 'none', textDecoration: 'none', touchAction: 'manipulation', transition: motions_1.defaultTransition, width: block ? '100%' : 'auto', '&:hover, &:focus': {
|
|
40
|
-
textDecoration: 'none',
|
|
41
|
-
} }), (variant !== ButtonVariant.TERTIARY && Object.assign({ borderRadius: variant === ButtonVariant.SEND ? '100%' : '16px', height: variant === ButtonVariant.SEND ? '40px' : '48px', lineHeight: variant === ButtonVariant.SEND ? '40px' : '48px' }, (variant !== ButtonVariant.SEND && {
|
|
42
|
-
maxWidth: '100%',
|
|
43
|
-
minWidth: '125px',
|
|
44
|
-
padding: '0 16px',
|
|
45
|
-
})))), (variant === ButtonVariant.PRIMARY && Object.assign({ backgroundColor: backgroundColor || (disabled ? theme.Button.primaryDisabledBg : theme.Button.primaryBg), color: disabled ? theme.Button.primaryDisabledText : theme.general.contrastColor }, (!disabled && {
|
|
46
|
-
'&:hover, &:focus': {
|
|
47
|
-
backgroundColor: theme.Button.primaryHoverBg,
|
|
48
|
-
},
|
|
49
|
-
'&:focus': {
|
|
50
|
-
border: `1px solid ${theme.Button.primaryFocusBorder}`,
|
|
51
|
-
},
|
|
52
|
-
'&:active': {
|
|
53
|
-
backgroundColor: theme.Button.primaryActiveBg,
|
|
54
|
-
border: `1px solid ${theme.Button.primaryActiveBorder}`,
|
|
55
|
-
color: Identity_1.COLOR.WHITE,
|
|
56
|
-
},
|
|
57
|
-
})))), (variant === ButtonVariant.SECONDARY && Object.assign({ backgroundColor: backgroundColor || (disabled ? theme.IconButton.primaryDisabledBgColor : theme.IconButton.primaryBgColor), border: `1px solid ${theme.IconButton.primaryBorderColor}`, color: disabled ? theme.Input.placeholderColor : theme.general.color }, (!disabled && {
|
|
58
|
-
'&:hover, &:focus': {
|
|
59
|
-
border: `1px solid ${theme.Button.secondaryHoverBorder}`,
|
|
60
|
-
},
|
|
61
|
-
'&:focus': {
|
|
62
|
-
color: theme.IconButton.primaryActiveFillColor,
|
|
63
|
-
},
|
|
64
|
-
'&:active': {
|
|
65
|
-
backgroundColor: theme.Button.secondaryActiveBg,
|
|
66
|
-
border: `1px solid ${theme.Button.secondaryActiveBorder}`,
|
|
67
|
-
color: theme.general.primaryColor,
|
|
68
|
-
},
|
|
69
|
-
})))), (variant === ButtonVariant.TERTIARY && Object.assign({ backgroundColor: backgroundColor || (disabled ? theme.Button.tertiarydisabledBg : theme.Button.tertiaryBg), border: disabled ? `1px solid ${theme.Button.tertiaryDisabledBorder}` : `1px solid ${theme.Button.tertiaryBorder}`, borderRadius: '12px', color: disabled ? theme.Input.placeholderColor : theme.general.color, fontSize: theme.fontSizes.medium, fontWeight: 700, lineHeight: '1.5rem', padding: '4px 8px', '& > svg > path': {
|
|
70
|
-
fill: disabled ? theme.Input.placeholderColor : theme.general.color,
|
|
71
|
-
} }, (!disabled && {
|
|
72
|
-
'&:hover, &:focus': {
|
|
73
|
-
backgroundColor: theme.Button.tertiaryHoverBg,
|
|
74
|
-
border: `1px solid ${theme.Button.tertiaryHoverBorder}`,
|
|
75
|
-
},
|
|
76
|
-
'&:focus': {
|
|
77
|
-
border: `1px solid ${theme.general.focusColor}`,
|
|
78
|
-
},
|
|
79
|
-
'&:active': {
|
|
80
|
-
backgroundColor: theme.Button.tertiaryActiveBg,
|
|
81
|
-
color: theme.IconButton.primaryActiveFillColor,
|
|
82
|
-
'& > svg > path': {
|
|
83
|
-
fill: theme.IconButton.primaryActiveFillColor,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
})))), (variant === ButtonVariant.QUATERNARY && Object.assign({ backgroundColor: backgroundColor || (disabled ? Identity_1.COLOR_V2.GRAY_50 : Identity_1.COLOR_V2.GREEN), color: disabled ? Identity_1.COLOR_V2.GRAY_80 : Identity_1.COLOR_V2.WHITE, lineHeight: '1.5rem' }, (!disabled && {
|
|
87
|
-
'&:hover, &:focus': {
|
|
88
|
-
backgroundColor: Identity_1.COLOR_V2.GREEN_LIGHT_600,
|
|
89
|
-
},
|
|
90
|
-
'&:focus': {
|
|
91
|
-
border: `1px solid ${Identity_1.COLOR_V2.GREEN_LIGHT_700}`,
|
|
92
|
-
},
|
|
93
|
-
'&:active': {
|
|
94
|
-
backgroundColor: Identity_1.COLOR_V2.GREEN_LIGHT_700,
|
|
95
|
-
},
|
|
96
|
-
})))), (variant === ButtonVariant.CANCEL && Object.assign({ backgroundColor: backgroundColor || (disabled ? Identity_1.COLOR_V2.GRAY_50 : Identity_1.COLOR_V2.RED), color: disabled ? Identity_1.COLOR_V2.GRAY_80 : Identity_1.COLOR_V2.WHITE, lineHeight: '1.5rem' }, (!disabled && {
|
|
97
|
-
'&:hover, &:focus': {
|
|
98
|
-
backgroundColor: Identity_1.COLOR_V2.RED_LIGHT_600,
|
|
99
|
-
},
|
|
100
|
-
'&:focus': {
|
|
101
|
-
border: `1px solid ${Identity_1.COLOR_V2.RED_LIGHT_700}`,
|
|
102
|
-
},
|
|
103
|
-
'&:active': {
|
|
104
|
-
backgroundColor: Identity_1.COLOR_V2.RED_LIGHT_700,
|
|
105
|
-
},
|
|
106
|
-
})))), (variant === ButtonVariant.SEND && Object.assign({ backgroundColor: backgroundColor || (disabled ? Identity_1.COLOR_V2.GRAY_70 : Identity_1.COLOR_V2.BLUE), width: '40px' }, (!disabled && {
|
|
107
|
-
'&:hover, &:focus': {
|
|
108
|
-
backgroundColor: Identity_1.COLOR_V2.BLUE_LIGHT_600,
|
|
109
|
-
},
|
|
110
|
-
'&:focus': {
|
|
111
|
-
border: `1px solid ${Identity_1.COLOR_V2.BLUE_LIGHT_800}`,
|
|
112
|
-
},
|
|
113
|
-
'&:active': {
|
|
114
|
-
backgroundColor: Identity_1.COLOR_V2.BLUE_LIGHT_700,
|
|
115
|
-
},
|
|
116
|
-
})))));
|
|
117
|
-
};
|
|
118
|
-
exports.buttonStyle = buttonStyle;
|
|
119
48
|
const Button = (_a) => {
|
|
120
49
|
var { showLoading, children, loadingColor = Identity_1.COLOR.WHITE } = _a, props = __rest(_a, ["showLoading", "children", "loadingColor"]);
|
|
121
|
-
return ((0, jsx_runtime_1.jsx)("button", Object.assign({ css: (theme) => (0,
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)("button", Object.assign({ css: (theme) => (0, Button_styles_1.buttonStyle)(theme, props) }, (0, exports.filterButtonProps)(props), { children: showLoading ? (0, jsx_runtime_1.jsx)(Misc_1.Loading, { size: 30, color: loadingColor, style: { display: 'flex', margin: 'auto' } }) : children })));
|
|
122
51
|
};
|
|
123
52
|
exports.Button = Button;
|
|
124
53
|
const filterButtonProps = (props) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.styles.d.ts","sourceRoot":"","sources":["../../src/Form/Button.styles.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAC,WAAW,EAAgB,MAAM,UAAU,CAAC;AAKpD,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAmLrC,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,SAgErE,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2024 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
21
|
+
var t = {};
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
+
t[p] = s[p];
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
+
t[p[i]] = s[p[i]];
|
|
28
|
+
}
|
|
29
|
+
return t;
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.buttonStyle = void 0;
|
|
33
|
+
const Button_1 = require("./Button");
|
|
34
|
+
const Identity_1 = require("../Identity");
|
|
35
|
+
const motions_1 = require("../Identity/motions");
|
|
36
|
+
const Text_1 = require("../Text");
|
|
37
|
+
const buttonPrimaryStyles = (theme, { backgroundColor, disabled, isActive }) => {
|
|
38
|
+
const activeStyles = {
|
|
39
|
+
backgroundColor: theme.Button.primaryActiveBg,
|
|
40
|
+
border: `1px solid ${theme.Button.primaryActiveBorder}`,
|
|
41
|
+
color: Identity_1.COLOR.WHITE,
|
|
42
|
+
};
|
|
43
|
+
return Object.assign(Object.assign({}, (isActive
|
|
44
|
+
? activeStyles
|
|
45
|
+
: {
|
|
46
|
+
color: disabled ? theme.Button.primaryDisabledText : theme.general.contrastColor,
|
|
47
|
+
backgroundColor: backgroundColor || disabled ? theme.Button.primaryDisabledBg : theme.Button.primaryBg,
|
|
48
|
+
})), (!disabled && {
|
|
49
|
+
'&:hover, &:focus': {
|
|
50
|
+
backgroundColor: theme.Button.primaryHoverBg,
|
|
51
|
+
},
|
|
52
|
+
'&:focus': {
|
|
53
|
+
border: `1px solid ${theme.Button.primaryFocusBorder}`,
|
|
54
|
+
},
|
|
55
|
+
'&:active': activeStyles,
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
const buttonSecondaryStyles = (theme, { backgroundColor, disabled, isActive }) => {
|
|
59
|
+
const activeStyles = {
|
|
60
|
+
backgroundColor: theme.Button.secondaryActiveBg,
|
|
61
|
+
border: `1px solid ${theme.Button.secondaryActiveBorder}`,
|
|
62
|
+
color: theme.general.primaryColor,
|
|
63
|
+
};
|
|
64
|
+
return Object.assign(Object.assign({ border: `1px solid ${theme.IconButton.primaryBorderColor}` }, (isActive
|
|
65
|
+
? activeStyles
|
|
66
|
+
: {
|
|
67
|
+
color: disabled ? theme.Input.placeholderColor : theme.general.color,
|
|
68
|
+
backgroundColor: backgroundColor || disabled ? theme.IconButton.primaryDisabledBgColor : theme.IconButton.primaryBgColor,
|
|
69
|
+
})), (!disabled && {
|
|
70
|
+
'&:hover, &:focus': {
|
|
71
|
+
border: `1px solid ${theme.Button.secondaryHoverBorder}`,
|
|
72
|
+
},
|
|
73
|
+
'&:focus': {
|
|
74
|
+
color: theme.IconButton.primaryActiveFillColor,
|
|
75
|
+
},
|
|
76
|
+
'&:active': activeStyles,
|
|
77
|
+
}));
|
|
78
|
+
};
|
|
79
|
+
const buttonTertiaryStyles = (theme, { backgroundColor, disabled, isActive }) => {
|
|
80
|
+
const activeStyles = {
|
|
81
|
+
backgroundColor: theme.Button.tertiaryActiveBg,
|
|
82
|
+
color: theme.IconButton.primaryActiveFillColor,
|
|
83
|
+
'& > svg > path': {
|
|
84
|
+
fill: theme.IconButton.primaryActiveFillColor,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
return Object.assign(Object.assign({ border: disabled ? `1px solid ${theme.Button.tertiaryDisabledBorder}` : `1px solid ${theme.Button.tertiaryBorder}`, borderRadius: '12px', fontSize: theme.fontSizes.medium, fontWeight: 700, lineHeight: '1.5rem', padding: '4px 8px', '& > svg > path': {
|
|
88
|
+
fill: disabled ? theme.Input.placeholderColor : theme.general.color,
|
|
89
|
+
} }, (isActive
|
|
90
|
+
? activeStyles
|
|
91
|
+
: {
|
|
92
|
+
color: disabled ? theme.Input.placeholderColor : theme.general.color,
|
|
93
|
+
backgroundColor: backgroundColor || disabled ? theme.Button.tertiarydisabledBg : theme.Button.tertiaryBg,
|
|
94
|
+
})), (!disabled && {
|
|
95
|
+
'&:hover, &:focus': {
|
|
96
|
+
backgroundColor: theme.Button.tertiaryHoverBg,
|
|
97
|
+
border: `1px solid ${theme.Button.tertiaryHoverBorder}`,
|
|
98
|
+
},
|
|
99
|
+
'&:focus': {
|
|
100
|
+
border: `1px solid ${theme.general.focusColor}`,
|
|
101
|
+
},
|
|
102
|
+
'&:active': activeStyles,
|
|
103
|
+
}));
|
|
104
|
+
};
|
|
105
|
+
const buttonQuaternaryStyles = ({ backgroundColor, disabled, isActive }) => {
|
|
106
|
+
const activeStyles = {
|
|
107
|
+
backgroundColor: Identity_1.COLOR_V2.GREEN_LIGHT_700,
|
|
108
|
+
};
|
|
109
|
+
return Object.assign(Object.assign({ lineHeight: '1.5rem' }, (isActive
|
|
110
|
+
? activeStyles
|
|
111
|
+
: {
|
|
112
|
+
color: disabled ? Identity_1.COLOR_V2.GRAY_80 : Identity_1.COLOR_V2.WHITE,
|
|
113
|
+
backgroundColor: backgroundColor || disabled ? Identity_1.COLOR_V2.GRAY_50 : Identity_1.COLOR_V2.GREEN,
|
|
114
|
+
})), (!disabled && {
|
|
115
|
+
'&:hover, &:focus': {
|
|
116
|
+
backgroundColor: Identity_1.COLOR_V2.GREEN_LIGHT_600,
|
|
117
|
+
},
|
|
118
|
+
'&:focus': {
|
|
119
|
+
border: `1px solid ${Identity_1.COLOR_V2.GREEN_LIGHT_700}`,
|
|
120
|
+
},
|
|
121
|
+
'&:active': activeStyles,
|
|
122
|
+
}));
|
|
123
|
+
};
|
|
124
|
+
const buttonCancelStyles = ({ backgroundColor, disabled, isActive }) => {
|
|
125
|
+
const activeStyles = {
|
|
126
|
+
backgroundColor: Identity_1.COLOR_V2.RED_LIGHT_700,
|
|
127
|
+
};
|
|
128
|
+
return Object.assign(Object.assign({ lineHeight: '1.5rem' }, (isActive
|
|
129
|
+
? activeStyles
|
|
130
|
+
: {
|
|
131
|
+
color: disabled ? Identity_1.COLOR_V2.GRAY_80 : Identity_1.COLOR_V2.WHITE,
|
|
132
|
+
backgroundColor: backgroundColor || disabled ? Identity_1.COLOR_V2.GRAY_50 : Identity_1.COLOR_V2.RED,
|
|
133
|
+
})), (!disabled && {
|
|
134
|
+
'&:hover, &:focus': {
|
|
135
|
+
backgroundColor: Identity_1.COLOR_V2.RED_LIGHT_600,
|
|
136
|
+
},
|
|
137
|
+
'&:focus': {
|
|
138
|
+
border: `1px solid ${Identity_1.COLOR_V2.RED_LIGHT_700}`,
|
|
139
|
+
},
|
|
140
|
+
'&:active': activeStyles,
|
|
141
|
+
}));
|
|
142
|
+
};
|
|
143
|
+
const buttonSendStyles = ({ backgroundColor, disabled, isActive }) => {
|
|
144
|
+
const activeStyles = {
|
|
145
|
+
backgroundColor: Identity_1.COLOR_V2.BLUE_LIGHT_700,
|
|
146
|
+
};
|
|
147
|
+
return Object.assign(Object.assign({ width: '40px' }, (isActive
|
|
148
|
+
? activeStyles
|
|
149
|
+
: {
|
|
150
|
+
backgroundColor: backgroundColor || disabled ? Identity_1.COLOR_V2.GRAY_70 : Identity_1.COLOR_V2.BLUE,
|
|
151
|
+
})), (!disabled && {
|
|
152
|
+
'&:hover, &:focus': {
|
|
153
|
+
backgroundColor: Identity_1.COLOR_V2.BLUE_LIGHT_600,
|
|
154
|
+
},
|
|
155
|
+
'&:focus': {
|
|
156
|
+
border: `1px solid ${Identity_1.COLOR_V2.BLUE_LIGHT_800}`,
|
|
157
|
+
},
|
|
158
|
+
'&:active': activeStyles,
|
|
159
|
+
}));
|
|
160
|
+
};
|
|
161
|
+
const buttonStyle = (theme, _a) => {
|
|
162
|
+
var { variant = Button_1.ButtonVariant.PRIMARY, backgroundColor, block = false, disabled = false, noCapital = false, bold = true, center = true, color = Identity_1.COLOR.WHITE, fontSize = theme.fontSizes.base, noWrap = true, textTransform = 'none', truncate = true } = _a, props = __rest(_a, ["variant", "backgroundColor", "block", "disabled", "noCapital", "bold", "center", "color", "fontSize", "noWrap", "textTransform", "truncate"]);
|
|
163
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, Text_1.textStyle)(theme, Object.assign({ block,
|
|
164
|
+
bold,
|
|
165
|
+
center,
|
|
166
|
+
disabled,
|
|
167
|
+
fontSize,
|
|
168
|
+
noWrap,
|
|
169
|
+
textTransform,
|
|
170
|
+
truncate }, props))), { border: 0, cursor: disabled ? 'default' : 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: '16px', padding: 0, outline: 'none', textDecoration: 'none', touchAction: 'manipulation', transition: motions_1.defaultTransition, width: block ? '100%' : 'auto', '&:hover, &:focus': {
|
|
171
|
+
textDecoration: 'none',
|
|
172
|
+
} }), (variant !== Button_1.ButtonVariant.TERTIARY && Object.assign({ borderRadius: variant === Button_1.ButtonVariant.SEND ? '100%' : '16px', height: variant === Button_1.ButtonVariant.SEND ? '40px' : '48px', lineHeight: variant === Button_1.ButtonVariant.SEND ? '40px' : '48px' }, (variant !== Button_1.ButtonVariant.SEND && {
|
|
173
|
+
maxWidth: '100%',
|
|
174
|
+
minWidth: '125px',
|
|
175
|
+
padding: '0 16px',
|
|
176
|
+
})))), (variant === Button_1.ButtonVariant.PRIMARY && buttonPrimaryStyles(theme, props))), (variant === Button_1.ButtonVariant.SECONDARY && buttonSecondaryStyles(theme, props))), (variant === Button_1.ButtonVariant.TERTIARY && buttonTertiaryStyles(theme, props))), (variant === Button_1.ButtonVariant.QUATERNARY && buttonQuaternaryStyles(props))), (variant === Button_1.ButtonVariant.CANCEL && buttonCancelStyles(props))), (variant === Button_1.ButtonVariant.SEND && buttonSendStyles(props)));
|
|
177
|
+
};
|
|
178
|
+
exports.buttonStyle = buttonStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonLink.d.ts","sourceRoot":"","sources":["../../src/Form/ButtonLink.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"ButtonLink.d.ts","sourceRoot":"","sources":["../../src/Form/ButtonLink.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAIrC,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAKhC,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,KAAK,SAGrF,CAAC;AAUH,eAAO,MAAM,UAAU,sDAKpB,YAAY,iBAAiB,CAAC,qDAIhC,CAAC"}
|
package/lib/Form/ButtonLink.js
CHANGED
|
@@ -13,12 +13,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.ButtonLink = exports.buttonLinkStyle = void 0;
|
|
15
15
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
16
|
-
const
|
|
16
|
+
const Button_styles_1 = require("./Button.styles");
|
|
17
17
|
const Identity_1 = require("../Identity");
|
|
18
18
|
const Misc_1 = require("../Misc");
|
|
19
19
|
const Text_1 = require("../Text");
|
|
20
20
|
const util_1 = require("../util");
|
|
21
|
-
const buttonLinkStyle = (theme, props) => (Object.assign(Object.assign({}, (0,
|
|
21
|
+
const buttonLinkStyle = (theme, props) => (Object.assign(Object.assign({}, (0, Button_styles_1.buttonStyle)(theme, props)), { display: 'inline-flex !important' }));
|
|
22
22
|
exports.buttonLinkStyle = buttonLinkStyle;
|
|
23
23
|
const filterButtonLinkProps = (props) => {
|
|
24
24
|
return (0, util_1.filterProps)((0, Text_1.filterTextProps)(props), [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoundIconButton.d.ts","sourceRoot":"","sources":["../../src/Form/RoundIconButton.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"RoundIconButton.d.ts","sourceRoot":"","sources":["../../src/Form/RoundIconButton.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAC,WAAW,EAAoB,MAAM,UAAU,CAAC;AAKxD,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAGhC,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,iBAAiB,CAAE,SAAQ,WAAW,CAAC,CAAC,CAAC;CAAG;AAEtF,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,SAYtF,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAI1D,CAAC"}
|
|
@@ -14,9 +14,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.RoundIconButton = exports.roundIconButtonStyle = void 0;
|
|
15
15
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
16
16
|
const Button_1 = require("./Button");
|
|
17
|
+
const Button_styles_1 = require("./Button.styles");
|
|
17
18
|
const Identity_1 = require("../Identity");
|
|
18
19
|
const Misc_1 = require("../Misc/");
|
|
19
|
-
const roundIconButtonStyle = (theme, props) => (Object.assign(Object.assign({}, (0,
|
|
20
|
+
const roundIconButtonStyle = (theme, props) => (Object.assign(Object.assign({}, (0, Button_styles_1.buttonStyle)(theme, props)), { alignItems: 'center', borderRadius: '50%', display: 'flex', height: `${props.size}px`, justifyContent: 'center', lineHeight: 'initial', margin: '0 auto', minWidth: `${props.size}px`, padding: 0, width: `${props.size}px` }));
|
|
20
21
|
exports.roundIconButtonStyle = roundIconButtonStyle;
|
|
21
22
|
const RoundIconButton = (_a) => {
|
|
22
23
|
var { children } = _a, props = __rest(_a, ["children"]);
|
package/package.json
CHANGED
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"react-transition-group": "4.4.5"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@babel/cli": "7.
|
|
19
|
-
"@babel/core": "7.24.
|
|
20
|
-
"@babel/preset-env": "7.24.
|
|
21
|
-
"@babel/preset-react": "7.
|
|
22
|
-
"@babel/preset-typescript": "7.
|
|
18
|
+
"@babel/cli": "7.24.1",
|
|
19
|
+
"@babel/core": "7.24.3",
|
|
20
|
+
"@babel/preset-env": "7.24.3",
|
|
21
|
+
"@babel/preset-react": "7.24.1",
|
|
22
|
+
"@babel/preset-typescript": "7.24.1",
|
|
23
23
|
"@emotion/babel-preset-css-prop": "^11.10.0",
|
|
24
24
|
"@emotion/jest": "11.11.0",
|
|
25
25
|
"@emotion/react": "^11.10.4",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@swc/core": "^1.3.10",
|
|
28
28
|
"@swc/jest": "^0.2.23",
|
|
29
29
|
"@testing-library/jest-dom": "6.4.2",
|
|
30
|
-
"@testing-library/react": "14.2.
|
|
30
|
+
"@testing-library/react": "14.2.2",
|
|
31
31
|
"@testing-library/user-event": "14.5.2",
|
|
32
32
|
"@types/jest": "^29.2.0",
|
|
33
33
|
"@types/node": "^20.1.0",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"test:watch": "jest --watch",
|
|
71
71
|
"test:update": "jest --updateSnapshot"
|
|
72
72
|
},
|
|
73
|
-
"version": "9.
|
|
74
|
-
"gitHead": "
|
|
73
|
+
"version": "9.17.0",
|
|
74
|
+
"gitHead": "f8042b528feb53335f428367c9c540274024c51c"
|
|
75
75
|
}
|