@cleartrip/ct-design-button 1.0.0-beta
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/button.browser.cjs.js +2 -0
- package/dist/button.browser.cjs.js.map +1 -0
- package/dist/button.browser.esm.js +2 -0
- package/dist/button.browser.esm.js.map +1 -0
- package/dist/button.cjs.js +304 -0
- package/dist/button.cjs.js.map +1 -0
- package/dist/button.esm.js +292 -0
- package/dist/button.esm.js.map +1 -0
- package/dist/button.umd.js +340 -0
- package/dist/button.umd.js.map +1 -0
- package/dist/src/Button.d.ts +6 -0
- package/dist/src/Button.d.ts.map +1 -0
- package/dist/src/StyledButton/style.d.ts +4 -0
- package/dist/src/StyledButton/style.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/style.d.ts +64 -0
- package/dist/src/style.d.ts.map +1 -0
- package/dist/src/type.d.ts +42 -0
- package/dist/src/type.d.ts.map +1 -0
- package/dist/stats.html +4838 -0
- package/dist/stories/Button.stories.d.ts +33 -0
- package/dist/stories/Button.stories.d.ts.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useCallback } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import Typography, { TypographyVariant } from '@cleartrip/ct-design-typography';
|
|
6
|
+
import Container from '@cleartrip/ct-design-container';
|
|
7
|
+
import useTheme from '@cleartrip/ct-design-use-theme';
|
|
8
|
+
import DottedLoader from '@cleartrip/ct-design-dotted-loader';
|
|
9
|
+
|
|
10
|
+
var getStyledButtonStyles = function (_a) {
|
|
11
|
+
var cursor = _a.cursor, backgroundColor = _a.backgroundColor, borderStyle = _a.borderStyle, height = _a.height, minWidth = _a.minWidth, paddingTop = _a.paddingTop, paddingBottom = _a.paddingBottom, borderColor = _a.borderColor, borderWidth = _a.borderWidth, theme = _a.theme, rest = __rest(_a, ["cursor", "backgroundColor", "borderStyle", "height", "minWidth", "paddingTop", "paddingBottom", "borderColor", "borderWidth", "theme"]);
|
|
12
|
+
return (__assign(__assign({ display: 'flex', border: 'none', justifyContent: 'center', alignItems: 'center', boxSizing: 'border-box', position: 'relative', userSelect: 'none', textDecoration: 'none', paddingLeft: theme.spacing[3], paddingRight: theme.spacing[3], cursor: cursor, borderRadius: theme.border.radius[8], borderWidth: borderWidth, backgroundColor: backgroundColor, borderStyle: borderStyle, height: height, paddingTop: paddingTop, paddingBottom: paddingBottom, borderColor: borderColor, minWidth: minWidth }, rest), { '&:hover': {
|
|
13
|
+
backgroundColor: theme.color.button.hover(backgroundColor),
|
|
14
|
+
} }));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var ButtonSize;
|
|
18
|
+
(function (ButtonSize) {
|
|
19
|
+
ButtonSize["SMALL"] = "small";
|
|
20
|
+
ButtonSize["MEDIUM"] = "medium";
|
|
21
|
+
ButtonSize["LARGE"] = "large";
|
|
22
|
+
})(ButtonSize || (ButtonSize = {}));
|
|
23
|
+
var IconPosition;
|
|
24
|
+
(function (IconPosition) {
|
|
25
|
+
IconPosition["LEFT"] = "left";
|
|
26
|
+
IconPosition["RIGHT"] = "right";
|
|
27
|
+
})(IconPosition || (IconPosition = {}));
|
|
28
|
+
var ButtonVariant;
|
|
29
|
+
(function (ButtonVariant) {
|
|
30
|
+
ButtonVariant["OUTLINE"] = "outline";
|
|
31
|
+
ButtonVariant["CONTAINED"] = "contained";
|
|
32
|
+
ButtonVariant["BARE"] = "bare";
|
|
33
|
+
})(ButtonVariant || (ButtonVariant = {}));
|
|
34
|
+
var ButtonColor;
|
|
35
|
+
(function (ButtonColor) {
|
|
36
|
+
ButtonColor["PRIMARY"] = "primary";
|
|
37
|
+
ButtonColor["SECONDARY"] = "secondary";
|
|
38
|
+
ButtonColor["TERTIARY"] = "tertiary";
|
|
39
|
+
})(ButtonColor || (ButtonColor = {}));
|
|
40
|
+
|
|
41
|
+
var getButtonSizeStyles = function (theme, size) {
|
|
42
|
+
switch (size) {
|
|
43
|
+
case ButtonSize.SMALL: {
|
|
44
|
+
return {
|
|
45
|
+
height: theme.size[8],
|
|
46
|
+
paddingTop: theme.spacing[1],
|
|
47
|
+
paddingBottom: theme.spacing[1],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
case ButtonSize.MEDIUM: {
|
|
51
|
+
return {
|
|
52
|
+
height: theme.size[10],
|
|
53
|
+
paddingTop: theme.spacing[2],
|
|
54
|
+
paddingBottom: theme.spacing[2],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
case ButtonSize.LARGE: {
|
|
58
|
+
return {
|
|
59
|
+
height: theme.size[12],
|
|
60
|
+
paddingTop: theme.spacing[3],
|
|
61
|
+
paddingBottom: theme.spacing[3],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
default: {
|
|
65
|
+
return {
|
|
66
|
+
height: theme.size[10],
|
|
67
|
+
paddingTop: theme.spacing[2],
|
|
68
|
+
paddingBottom: theme.spacing[2],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var getButtonVariantStyles = function (theme, variant, disabled) {
|
|
74
|
+
if (disabled) {
|
|
75
|
+
return {
|
|
76
|
+
borderWidth: theme.border.width.none,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
switch (variant) {
|
|
80
|
+
case ButtonVariant.OUTLINE: {
|
|
81
|
+
return {
|
|
82
|
+
borderWidth: theme.border.width.sm,
|
|
83
|
+
borderStyle: theme.border.style.solid,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
case ButtonVariant.CONTAINED:
|
|
87
|
+
case ButtonVariant.BARE: {
|
|
88
|
+
return {
|
|
89
|
+
borderWidth: theme.border.width.none,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
default: {
|
|
93
|
+
return {
|
|
94
|
+
borderWidth: theme.border.width.none,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var getContainedButtonColorStyles = function (theme, color, disabled) {
|
|
100
|
+
if (disabled) {
|
|
101
|
+
return {
|
|
102
|
+
backgroundColor: theme.color.button.containedDisabledBg,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
switch (color) {
|
|
106
|
+
case ButtonColor.PRIMARY: {
|
|
107
|
+
return {
|
|
108
|
+
backgroundColor: theme.color.button.containedPrimaryBg,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
case ButtonColor.SECONDARY: {
|
|
112
|
+
return {
|
|
113
|
+
backgroundColor: theme.color.button.containedSecondaryBg,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
case ButtonColor.TERTIARY: {
|
|
117
|
+
return {
|
|
118
|
+
backgroundColor: theme.color.button.containedTertiaryBg,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
default: {
|
|
122
|
+
return {
|
|
123
|
+
backgroundColor: theme.color.button.containedPrimaryBg,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var getOutlinedButtonColorStyles = function (theme, color, disabled) {
|
|
129
|
+
if (disabled) {
|
|
130
|
+
return {
|
|
131
|
+
backgroundColor: theme.color.button.outlinedDisabledBg,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
switch (color) {
|
|
135
|
+
case ButtonColor.PRIMARY: {
|
|
136
|
+
return {
|
|
137
|
+
backgroundColor: theme.color.button.outlinedPrimaryBg,
|
|
138
|
+
borderColor: theme.color.button.outlinedPrimaryBorder,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
case ButtonColor.SECONDARY: {
|
|
142
|
+
return {
|
|
143
|
+
backgroundColor: theme.color.button.outlinedSecondaryBg,
|
|
144
|
+
borderColor: theme.color.button.outlinedSecondaryBorder,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
case ButtonColor.TERTIARY: {
|
|
148
|
+
return {
|
|
149
|
+
backgroundColor: theme.color.button.outlinedTertiaryBg,
|
|
150
|
+
borderColor: theme.color.button.outlinedTertiaryBorder,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
default: {
|
|
154
|
+
return {
|
|
155
|
+
backgroundColor: theme.color.button.outlinedPrimaryBg,
|
|
156
|
+
borderColor: theme.color.button.outlinedPrimaryBorder,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
var getButtonVariantColorStyles = function (theme, color, variant, disabled) {
|
|
162
|
+
switch (variant) {
|
|
163
|
+
case ButtonVariant.CONTAINED: {
|
|
164
|
+
return getContainedButtonColorStyles(theme, color, disabled);
|
|
165
|
+
}
|
|
166
|
+
case ButtonVariant.OUTLINE:
|
|
167
|
+
case ButtonVariant.BARE: {
|
|
168
|
+
return getOutlinedButtonColorStyles(theme, color, disabled);
|
|
169
|
+
}
|
|
170
|
+
default: {
|
|
171
|
+
return getContainedButtonColorStyles(theme, color, disabled);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
var getContainedButtonLabelColor = function (color, disabled, theme) {
|
|
176
|
+
if (disabled) {
|
|
177
|
+
return theme.color.button.containedDisabledLabel;
|
|
178
|
+
}
|
|
179
|
+
switch (color) {
|
|
180
|
+
case ButtonColor.PRIMARY: {
|
|
181
|
+
return theme.color.button.containedPrimaryLabel;
|
|
182
|
+
}
|
|
183
|
+
case ButtonColor.SECONDARY: {
|
|
184
|
+
return theme.color.button.containedSecondaryLabel;
|
|
185
|
+
}
|
|
186
|
+
case ButtonColor.TERTIARY: {
|
|
187
|
+
return theme.color.button.containedTertiaryLabel;
|
|
188
|
+
}
|
|
189
|
+
default: {
|
|
190
|
+
return theme.color.button.containedPrimaryLabel;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var getOutlinedButtonLabelColor = function (color, disabled, theme) {
|
|
195
|
+
if (disabled) {
|
|
196
|
+
return theme.color.button.outlinedDisabledLabel;
|
|
197
|
+
}
|
|
198
|
+
switch (color) {
|
|
199
|
+
case ButtonColor.PRIMARY: {
|
|
200
|
+
return theme.color.button.outlinedPrimaryLabel;
|
|
201
|
+
}
|
|
202
|
+
case ButtonColor.SECONDARY: {
|
|
203
|
+
return theme.color.button.outlinedSecondaryLabel;
|
|
204
|
+
}
|
|
205
|
+
case ButtonColor.TERTIARY: {
|
|
206
|
+
return theme.color.button.outlinedTertiaryLabel;
|
|
207
|
+
}
|
|
208
|
+
default: {
|
|
209
|
+
return theme.color.button.outlinedPrimaryLabel;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
var getButtonVariantLabelColor = function (variant, color, disabled, theme, loading) {
|
|
214
|
+
switch (variant) {
|
|
215
|
+
case ButtonVariant.CONTAINED: {
|
|
216
|
+
return getContainedButtonLabelColor(color, disabled || loading, theme);
|
|
217
|
+
}
|
|
218
|
+
case ButtonVariant.OUTLINE: {
|
|
219
|
+
return getOutlinedButtonLabelColor(color, disabled || loading, theme);
|
|
220
|
+
}
|
|
221
|
+
case ButtonVariant.BARE: {
|
|
222
|
+
return getOutlinedButtonLabelColor(color, disabled, theme);
|
|
223
|
+
}
|
|
224
|
+
default: {
|
|
225
|
+
return getContainedButtonLabelColor(color, disabled || loading, theme);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var getTypographyVariant = function (size) {
|
|
230
|
+
switch (size) {
|
|
231
|
+
case ButtonSize.SMALL: {
|
|
232
|
+
return TypographyVariant.HM4;
|
|
233
|
+
}
|
|
234
|
+
case ButtonSize.MEDIUM: {
|
|
235
|
+
return TypographyVariant.HM4;
|
|
236
|
+
}
|
|
237
|
+
case ButtonSize.LARGE: {
|
|
238
|
+
return TypographyVariant.HM3;
|
|
239
|
+
}
|
|
240
|
+
default: {
|
|
241
|
+
return TypographyVariant.HM4;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
var getDefaultButtonStyles = function (disabled) {
|
|
246
|
+
if (disabled) {
|
|
247
|
+
return {
|
|
248
|
+
cursor: 'not-allowed',
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
return {
|
|
253
|
+
cursor: 'pointer',
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var getButtonStyles = function (_a) {
|
|
258
|
+
var theme = _a.theme, size = _a.size, variant = _a.variant, color = _a.color, disabled = _a.disabled, minWidth = _a.minWidth, isFullWidth = _a.isFullWidth, loading = _a.loading;
|
|
259
|
+
return __assign(__assign(__assign(__assign(__assign({}, getButtonSizeStyles(theme, size)), getButtonVariantStyles(theme, variant, disabled || loading)), getButtonVariantColorStyles(theme, color, variant, disabled || loading)), getDefaultButtonStyles(disabled || loading)), { minWidth: isFullWidth ? '100%' : minWidth || 'auto' });
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
var StyledButton = styled.button(function (_a) {
|
|
263
|
+
var css = _a.css, theme = _a.theme;
|
|
264
|
+
return getStyledButtonStyles(__assign(__assign({}, css), { theme: theme }));
|
|
265
|
+
});
|
|
266
|
+
var Button = forwardRef(function (_a, forwardedRef) {
|
|
267
|
+
var _b = _a.size, size = _b === void 0 ? ButtonSize.MEDIUM : _b, _c = _a.variant, variant = _c === void 0 ? ButtonVariant.CONTAINED : _c, _d = _a.color, color = _d === void 0 ? ButtonColor.PRIMARY : _d, _e = _a.isFullWidth, isFullWidth = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.onClick, onClick = _g === void 0 ? function () { } : _g, _h = _a.minWidth, minWidth = _h === void 0 ? '' : _h, _j = _a.showLeftIcon, showLeftIcon = _j === void 0 ? false : _j, _k = _a.LeftIcon, LeftIcon = _k === void 0 ? null : _k, _l = _a.showRightIcon, showRightIcon = _l === void 0 ? false : _l, _m = _a.RightIcon, RightIcon = _m === void 0 ? null : _m, css = _a.css, children = _a.children, _o = _a.loading, loading = _o === void 0 ? false : _o, rest = __rest(_a, ["size", "variant", "color", "isFullWidth", "disabled", "onClick", "minWidth", "showLeftIcon", "LeftIcon", "showRightIcon", "RightIcon", "css", "children", "loading"]);
|
|
268
|
+
var theme = useTheme();
|
|
269
|
+
var buttonStyles = getButtonStyles({
|
|
270
|
+
theme: theme,
|
|
271
|
+
size: size,
|
|
272
|
+
variant: variant,
|
|
273
|
+
color: color,
|
|
274
|
+
disabled: disabled,
|
|
275
|
+
minWidth: minWidth,
|
|
276
|
+
isFullWidth: isFullWidth,
|
|
277
|
+
loading: loading,
|
|
278
|
+
});
|
|
279
|
+
var Icon = useCallback(function (show, IconComponent) {
|
|
280
|
+
return show ? (jsx(Container, __assign({ paddingLeft: theme.spacing[1], display: 'flex', alignItems: 'center', justifyContent: 'center' }, { children: IconComponent }))) : null;
|
|
281
|
+
}, []);
|
|
282
|
+
var handleClick = useCallback(function (event) {
|
|
283
|
+
if (!disabled && onClick && !loading)
|
|
284
|
+
onClick(event);
|
|
285
|
+
if (disabled || loading)
|
|
286
|
+
event.preventDefault();
|
|
287
|
+
}, [disabled, onClick, loading]);
|
|
288
|
+
return (jsxs(StyledButton, __assign({ ref: forwardedRef, onClick: handleClick, css: __assign(__assign({}, buttonStyles), css), theme: theme }, rest, { children: [Icon(showLeftIcon, LeftIcon), jsx(Container, __assign({ paddingLeft: theme.spacing[1], paddingRight: theme.spacing[1] }, { children: jsx(Typography, __assign({ variant: getTypographyVariant(size), colorCode: getButtonVariantLabelColor(variant, color, disabled, theme, loading) }, { children: loading ? jsx(DottedLoader, {}) : children })) })), Icon(showRightIcon, RightIcon)] })));
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
export { ButtonColor, ButtonSize, ButtonVariant, IconPosition, Button as default };
|
|
292
|
+
//# sourceMappingURL=button.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.esm.js","sources":["../../packages/components/Button/src/StyledButton/style.ts","../../packages/components/Button/src/type.ts","../../packages/components/Button/src/style.ts","../../packages/components/Button/src/Button.tsx"],"sourcesContent":[null,null,null,null],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;AAGO,IAAM,qBAAqB,GAAG,UAAC,EAYvB,EAAA;AAXd,IAAA,IAAA,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,eAAe,qBAAA,EACf,WAAW,GAAA,EAAA,CAAA,WAAA,EACX,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,QAAQ,cAAA,EACR,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,aAAa,GAAA,EAAA,CAAA,aAAA,EACb,WAAW,iBAAA,EACX,WAAW,GAAA,EAAA,CAAA,WAAA,EACX,KAAK,GAAA,EAAA,CAAA,KAAA,EACF,IAAI,GAAA,MAAA,CAAA,EAAA,EAX8B,wIAYrC,CADO,CAAA;IACuB,QAAA,QAAA,CAAA,QAAA,CAAA,EAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,QAAQ,EACxB,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,UAAU,EACpB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAC7B,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAC9B,MAAM,QAAA,EACN,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EACpC,WAAW,EAAA,WAAA,EACX,eAAe,EAAA,eAAA,EACf,WAAW,EAAA,WAAA,EACX,MAAM,EAAA,MAAA,EACN,UAAU,EAAA,UAAA,EACV,aAAa,EAAA,aAAA,EACb,WAAW,EAAA,WAAA,EACX,QA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AC,EACnC,SAAS,EAAE,0BAA0B,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,EAE9E,EAAA,EAAA,QAAA,EAAA,OAAO,GAAGA,IAAC,YAAY,EAAA,EAAA,CAAG,GAAG,QAAQ,IAC1B,EACF,CAAA,CAAA,EACX,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CACjB,EAAA,CAAA,CAAA,EACd;AACH,CAAC;;;;"}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('styled-components'), require('@cleartrip/ct-design-typography'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-use-theme'), require('@cleartrip/ct-design-dotted-loader')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', 'styled-components', '@cleartrip/ct-design-typography', '@cleartrip/ct-design-container', '@cleartrip/ct-design-use-theme', '@cleartrip/ct-design-dotted-loader'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystem = {}, global.jsxRuntime, global.React, global.styled, global.Typography, global.Container, global.useTheme, global.DottedLoader));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, react, styled, Typography, Container, useTheme, DottedLoader) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
|
|
9
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
10
|
+
var Typography__default = /*#__PURE__*/_interopDefault(Typography);
|
|
11
|
+
var Container__default = /*#__PURE__*/_interopDefault(Container);
|
|
12
|
+
var useTheme__default = /*#__PURE__*/_interopDefault(useTheme);
|
|
13
|
+
var DottedLoader__default = /*#__PURE__*/_interopDefault(DottedLoader);
|
|
14
|
+
|
|
15
|
+
/******************************************************************************
|
|
16
|
+
Copyright (c) Microsoft Corporation.
|
|
17
|
+
|
|
18
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
19
|
+
purpose with or without fee is hereby granted.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
22
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
23
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
24
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
25
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
26
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
27
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
28
|
+
***************************************************************************** */
|
|
29
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
30
|
+
|
|
31
|
+
var __assign = function () {
|
|
32
|
+
__assign = Object.assign || function __assign(t) {
|
|
33
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
34
|
+
s = arguments[i];
|
|
35
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
36
|
+
}
|
|
37
|
+
return t;
|
|
38
|
+
};
|
|
39
|
+
return __assign.apply(this, arguments);
|
|
40
|
+
};
|
|
41
|
+
function __rest(s, e) {
|
|
42
|
+
var t = {};
|
|
43
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
44
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
45
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
46
|
+
}
|
|
47
|
+
return t;
|
|
48
|
+
}
|
|
49
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var getStyledButtonStyles = function (_a) {
|
|
55
|
+
var cursor = _a.cursor, backgroundColor = _a.backgroundColor, borderStyle = _a.borderStyle, height = _a.height, minWidth = _a.minWidth, paddingTop = _a.paddingTop, paddingBottom = _a.paddingBottom, borderColor = _a.borderColor, borderWidth = _a.borderWidth, theme = _a.theme, rest = __rest(_a, ["cursor", "backgroundColor", "borderStyle", "height", "minWidth", "paddingTop", "paddingBottom", "borderColor", "borderWidth", "theme"]);
|
|
56
|
+
return (__assign(__assign({ display: 'flex', border: 'none', justifyContent: 'center', alignItems: 'center', boxSizing: 'border-box', position: 'relative', userSelect: 'none', textDecoration: 'none', paddingLeft: theme.spacing[3], paddingRight: theme.spacing[3], cursor: cursor, borderRadius: theme.border.radius[8], borderWidth: borderWidth, backgroundColor: backgroundColor, borderStyle: borderStyle, height: height, paddingTop: paddingTop, paddingBottom: paddingBottom, borderColor: borderColor, minWidth: minWidth }, rest), { '&:hover': {
|
|
57
|
+
backgroundColor: theme.color.button.hover(backgroundColor),
|
|
58
|
+
} }));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.ButtonSize = void 0;
|
|
62
|
+
(function (ButtonSize) {
|
|
63
|
+
ButtonSize["SMALL"] = "small";
|
|
64
|
+
ButtonSize["MEDIUM"] = "medium";
|
|
65
|
+
ButtonSize["LARGE"] = "large";
|
|
66
|
+
})(exports.ButtonSize || (exports.ButtonSize = {}));
|
|
67
|
+
exports.IconPosition = void 0;
|
|
68
|
+
(function (IconPosition) {
|
|
69
|
+
IconPosition["LEFT"] = "left";
|
|
70
|
+
IconPosition["RIGHT"] = "right";
|
|
71
|
+
})(exports.IconPosition || (exports.IconPosition = {}));
|
|
72
|
+
exports.ButtonVariant = void 0;
|
|
73
|
+
(function (ButtonVariant) {
|
|
74
|
+
ButtonVariant["OUTLINE"] = "outline";
|
|
75
|
+
ButtonVariant["CONTAINED"] = "contained";
|
|
76
|
+
ButtonVariant["BARE"] = "bare";
|
|
77
|
+
})(exports.ButtonVariant || (exports.ButtonVariant = {}));
|
|
78
|
+
exports.ButtonColor = void 0;
|
|
79
|
+
(function (ButtonColor) {
|
|
80
|
+
ButtonColor["PRIMARY"] = "primary";
|
|
81
|
+
ButtonColor["SECONDARY"] = "secondary";
|
|
82
|
+
ButtonColor["TERTIARY"] = "tertiary";
|
|
83
|
+
})(exports.ButtonColor || (exports.ButtonColor = {}));
|
|
84
|
+
|
|
85
|
+
var getButtonSizeStyles = function (theme, size) {
|
|
86
|
+
switch (size) {
|
|
87
|
+
case exports.ButtonSize.SMALL: {
|
|
88
|
+
return {
|
|
89
|
+
height: theme.size[8],
|
|
90
|
+
paddingTop: theme.spacing[1],
|
|
91
|
+
paddingBottom: theme.spacing[1],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
case exports.ButtonSize.MEDIUM: {
|
|
95
|
+
return {
|
|
96
|
+
height: theme.size[10],
|
|
97
|
+
paddingTop: theme.spacing[2],
|
|
98
|
+
paddingBottom: theme.spacing[2],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
case exports.ButtonSize.LARGE: {
|
|
102
|
+
return {
|
|
103
|
+
height: theme.size[12],
|
|
104
|
+
paddingTop: theme.spacing[3],
|
|
105
|
+
paddingBottom: theme.spacing[3],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
default: {
|
|
109
|
+
return {
|
|
110
|
+
height: theme.size[10],
|
|
111
|
+
paddingTop: theme.spacing[2],
|
|
112
|
+
paddingBottom: theme.spacing[2],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var getButtonVariantStyles = function (theme, variant, disabled) {
|
|
118
|
+
if (disabled) {
|
|
119
|
+
return {
|
|
120
|
+
borderWidth: theme.border.width.none,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
switch (variant) {
|
|
124
|
+
case exports.ButtonVariant.OUTLINE: {
|
|
125
|
+
return {
|
|
126
|
+
borderWidth: theme.border.width.sm,
|
|
127
|
+
borderStyle: theme.border.style.solid,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
case exports.ButtonVariant.CONTAINED:
|
|
131
|
+
case exports.ButtonVariant.BARE: {
|
|
132
|
+
return {
|
|
133
|
+
borderWidth: theme.border.width.none,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
default: {
|
|
137
|
+
return {
|
|
138
|
+
borderWidth: theme.border.width.none,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
var getContainedButtonColorStyles = function (theme, color, disabled) {
|
|
144
|
+
if (disabled) {
|
|
145
|
+
return {
|
|
146
|
+
backgroundColor: theme.color.button.containedDisabledBg,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
switch (color) {
|
|
150
|
+
case exports.ButtonColor.PRIMARY: {
|
|
151
|
+
return {
|
|
152
|
+
backgroundColor: theme.color.button.containedPrimaryBg,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
case exports.ButtonColor.SECONDARY: {
|
|
156
|
+
return {
|
|
157
|
+
backgroundColor: theme.color.button.containedSecondaryBg,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
case exports.ButtonColor.TERTIARY: {
|
|
161
|
+
return {
|
|
162
|
+
backgroundColor: theme.color.button.containedTertiaryBg,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
default: {
|
|
166
|
+
return {
|
|
167
|
+
backgroundColor: theme.color.button.containedPrimaryBg,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
var getOutlinedButtonColorStyles = function (theme, color, disabled) {
|
|
173
|
+
if (disabled) {
|
|
174
|
+
return {
|
|
175
|
+
backgroundColor: theme.color.button.outlinedDisabledBg,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
switch (color) {
|
|
179
|
+
case exports.ButtonColor.PRIMARY: {
|
|
180
|
+
return {
|
|
181
|
+
backgroundColor: theme.color.button.outlinedPrimaryBg,
|
|
182
|
+
borderColor: theme.color.button.outlinedPrimaryBorder,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
case exports.ButtonColor.SECONDARY: {
|
|
186
|
+
return {
|
|
187
|
+
backgroundColor: theme.color.button.outlinedSecondaryBg,
|
|
188
|
+
borderColor: theme.color.button.outlinedSecondaryBorder,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
case exports.ButtonColor.TERTIARY: {
|
|
192
|
+
return {
|
|
193
|
+
backgroundColor: theme.color.button.outlinedTertiaryBg,
|
|
194
|
+
borderColor: theme.color.button.outlinedTertiaryBorder,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
default: {
|
|
198
|
+
return {
|
|
199
|
+
backgroundColor: theme.color.button.outlinedPrimaryBg,
|
|
200
|
+
borderColor: theme.color.button.outlinedPrimaryBorder,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
var getButtonVariantColorStyles = function (theme, color, variant, disabled) {
|
|
206
|
+
switch (variant) {
|
|
207
|
+
case exports.ButtonVariant.CONTAINED: {
|
|
208
|
+
return getContainedButtonColorStyles(theme, color, disabled);
|
|
209
|
+
}
|
|
210
|
+
case exports.ButtonVariant.OUTLINE:
|
|
211
|
+
case exports.ButtonVariant.BARE: {
|
|
212
|
+
return getOutlinedButtonColorStyles(theme, color, disabled);
|
|
213
|
+
}
|
|
214
|
+
default: {
|
|
215
|
+
return getContainedButtonColorStyles(theme, color, disabled);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
var getContainedButtonLabelColor = function (color, disabled, theme) {
|
|
220
|
+
if (disabled) {
|
|
221
|
+
return theme.color.button.containedDisabledLabel;
|
|
222
|
+
}
|
|
223
|
+
switch (color) {
|
|
224
|
+
case exports.ButtonColor.PRIMARY: {
|
|
225
|
+
return theme.color.button.containedPrimaryLabel;
|
|
226
|
+
}
|
|
227
|
+
case exports.ButtonColor.SECONDARY: {
|
|
228
|
+
return theme.color.button.containedSecondaryLabel;
|
|
229
|
+
}
|
|
230
|
+
case exports.ButtonColor.TERTIARY: {
|
|
231
|
+
return theme.color.button.containedTertiaryLabel;
|
|
232
|
+
}
|
|
233
|
+
default: {
|
|
234
|
+
return theme.color.button.containedPrimaryLabel;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
var getOutlinedButtonLabelColor = function (color, disabled, theme) {
|
|
239
|
+
if (disabled) {
|
|
240
|
+
return theme.color.button.outlinedDisabledLabel;
|
|
241
|
+
}
|
|
242
|
+
switch (color) {
|
|
243
|
+
case exports.ButtonColor.PRIMARY: {
|
|
244
|
+
return theme.color.button.outlinedPrimaryLabel;
|
|
245
|
+
}
|
|
246
|
+
case exports.ButtonColor.SECONDARY: {
|
|
247
|
+
return theme.color.button.outlinedSecondaryLabel;
|
|
248
|
+
}
|
|
249
|
+
case exports.ButtonColor.TERTIARY: {
|
|
250
|
+
return theme.color.button.outlinedTertiaryLabel;
|
|
251
|
+
}
|
|
252
|
+
default: {
|
|
253
|
+
return theme.color.button.outlinedPrimaryLabel;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var getButtonVariantLabelColor = function (variant, color, disabled, theme, loading) {
|
|
258
|
+
switch (variant) {
|
|
259
|
+
case exports.ButtonVariant.CONTAINED: {
|
|
260
|
+
return getContainedButtonLabelColor(color, disabled || loading, theme);
|
|
261
|
+
}
|
|
262
|
+
case exports.ButtonVariant.OUTLINE: {
|
|
263
|
+
return getOutlinedButtonLabelColor(color, disabled || loading, theme);
|
|
264
|
+
}
|
|
265
|
+
case exports.ButtonVariant.BARE: {
|
|
266
|
+
return getOutlinedButtonLabelColor(color, disabled, theme);
|
|
267
|
+
}
|
|
268
|
+
default: {
|
|
269
|
+
return getContainedButtonLabelColor(color, disabled || loading, theme);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
var getTypographyVariant = function (size) {
|
|
274
|
+
switch (size) {
|
|
275
|
+
case exports.ButtonSize.SMALL: {
|
|
276
|
+
return Typography.TypographyVariant.HM4;
|
|
277
|
+
}
|
|
278
|
+
case exports.ButtonSize.MEDIUM: {
|
|
279
|
+
return Typography.TypographyVariant.HM4;
|
|
280
|
+
}
|
|
281
|
+
case exports.ButtonSize.LARGE: {
|
|
282
|
+
return Typography.TypographyVariant.HM3;
|
|
283
|
+
}
|
|
284
|
+
default: {
|
|
285
|
+
return Typography.TypographyVariant.HM4;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
var getDefaultButtonStyles = function (disabled) {
|
|
290
|
+
if (disabled) {
|
|
291
|
+
return {
|
|
292
|
+
cursor: 'not-allowed',
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
return {
|
|
297
|
+
cursor: 'pointer',
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
var getButtonStyles = function (_a) {
|
|
302
|
+
var theme = _a.theme, size = _a.size, variant = _a.variant, color = _a.color, disabled = _a.disabled, minWidth = _a.minWidth, isFullWidth = _a.isFullWidth, loading = _a.loading;
|
|
303
|
+
return __assign(__assign(__assign(__assign(__assign({}, getButtonSizeStyles(theme, size)), getButtonVariantStyles(theme, variant, disabled || loading)), getButtonVariantColorStyles(theme, color, variant, disabled || loading)), getDefaultButtonStyles(disabled || loading)), { minWidth: isFullWidth ? '100%' : minWidth || 'auto' });
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
var StyledButton = styled__default.default.button(function (_a) {
|
|
307
|
+
var css = _a.css, theme = _a.theme;
|
|
308
|
+
return getStyledButtonStyles(__assign(__assign({}, css), { theme: theme }));
|
|
309
|
+
});
|
|
310
|
+
var Button = react.forwardRef(function (_a, forwardedRef) {
|
|
311
|
+
var _b = _a.size, size = _b === void 0 ? exports.ButtonSize.MEDIUM : _b, _c = _a.variant, variant = _c === void 0 ? exports.ButtonVariant.CONTAINED : _c, _d = _a.color, color = _d === void 0 ? exports.ButtonColor.PRIMARY : _d, _e = _a.isFullWidth, isFullWidth = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.onClick, onClick = _g === void 0 ? function () { } : _g, _h = _a.minWidth, minWidth = _h === void 0 ? '' : _h, _j = _a.showLeftIcon, showLeftIcon = _j === void 0 ? false : _j, _k = _a.LeftIcon, LeftIcon = _k === void 0 ? null : _k, _l = _a.showRightIcon, showRightIcon = _l === void 0 ? false : _l, _m = _a.RightIcon, RightIcon = _m === void 0 ? null : _m, css = _a.css, children = _a.children, _o = _a.loading, loading = _o === void 0 ? false : _o, rest = __rest(_a, ["size", "variant", "color", "isFullWidth", "disabled", "onClick", "minWidth", "showLeftIcon", "LeftIcon", "showRightIcon", "RightIcon", "css", "children", "loading"]);
|
|
312
|
+
var theme = useTheme__default.default();
|
|
313
|
+
var buttonStyles = getButtonStyles({
|
|
314
|
+
theme: theme,
|
|
315
|
+
size: size,
|
|
316
|
+
variant: variant,
|
|
317
|
+
color: color,
|
|
318
|
+
disabled: disabled,
|
|
319
|
+
minWidth: minWidth,
|
|
320
|
+
isFullWidth: isFullWidth,
|
|
321
|
+
loading: loading,
|
|
322
|
+
});
|
|
323
|
+
var Icon = react.useCallback(function (show, IconComponent) {
|
|
324
|
+
return show ? (jsxRuntime.jsx(Container__default.default, __assign({ paddingLeft: theme.spacing[1], display: 'flex', alignItems: 'center', justifyContent: 'center' }, { children: IconComponent }))) : null;
|
|
325
|
+
}, []);
|
|
326
|
+
var handleClick = react.useCallback(function (event) {
|
|
327
|
+
if (!disabled && onClick && !loading)
|
|
328
|
+
onClick(event);
|
|
329
|
+
if (disabled || loading)
|
|
330
|
+
event.preventDefault();
|
|
331
|
+
}, [disabled, onClick, loading]);
|
|
332
|
+
return (jsxRuntime.jsxs(StyledButton, __assign({ ref: forwardedRef, onClick: handleClick, css: __assign(__assign({}, buttonStyles), css), theme: theme }, rest, { children: [Icon(showLeftIcon, LeftIcon), jsxRuntime.jsx(Container__default.default, __assign({ paddingLeft: theme.spacing[1], paddingRight: theme.spacing[1] }, { children: jsxRuntime.jsx(Typography__default.default, __assign({ variant: getTypographyVariant(size), colorCode: getButtonVariantLabelColor(variant, color, disabled, theme, loading) }, { children: loading ? jsxRuntime.jsx(DottedLoader__default.default, {}) : children })) })), Icon(showRightIcon, RightIcon)] })));
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
exports.default = Button;
|
|
336
|
+
|
|
337
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
338
|
+
|
|
339
|
+
}));
|
|
340
|
+
//# sourceMappingURL=button.umd.js.map
|