@toptal/picasso-button 4.0.24-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10 → 4.0.24-alpha-1757603192867.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/package.json +21 -21
- package/src/Button/Button.tsx +31 -24
- package/src/ButtonAction/ButtonAction.tsx +6 -1
- package/src/ButtonBase/ButtonBase.tsx +18 -13
- package/src/ButtonCircular/ButtonCircular.tsx +6 -1
- package/src/ButtonControlLabel/ButtonControlLabel.tsx +4 -0
- package/src/ButtonSplit/ButtonSplit.tsx +8 -4
- package/LICENSE +0 -20
- package/dist-package/src/Button/Button.d.ts +0 -39
- package/dist-package/src/Button/Button.d.ts.map +0 -1
- package/dist-package/src/Button/Button.js +0 -69
- package/dist-package/src/Button/Button.js.map +0 -1
- package/dist-package/src/Button/index.d.ts +0 -6
- package/dist-package/src/Button/index.d.ts.map +0 -1
- package/dist-package/src/Button/index.js +0 -4
- package/dist-package/src/Button/index.js.map +0 -1
- package/dist-package/src/Button/styles.d.ts +0 -21
- package/dist-package/src/Button/styles.d.ts.map +0 -1
- package/dist-package/src/Button/styles.js +0 -169
- package/dist-package/src/Button/styles.js.map +0 -1
- package/dist-package/src/ButtonAction/ButtonAction.d.ts +0 -28
- package/dist-package/src/ButtonAction/ButtonAction.d.ts.map +0 -1
- package/dist-package/src/ButtonAction/ButtonAction.js +0 -49
- package/dist-package/src/ButtonAction/ButtonAction.js.map +0 -1
- package/dist-package/src/ButtonAction/index.d.ts +0 -4
- package/dist-package/src/ButtonAction/index.d.ts.map +0 -1
- package/dist-package/src/ButtonAction/index.js +0 -2
- package/dist-package/src/ButtonAction/index.js.map +0 -1
- package/dist-package/src/ButtonAction/styles.d.ts +0 -12
- package/dist-package/src/ButtonAction/styles.d.ts.map +0 -1
- package/dist-package/src/ButtonAction/styles.js +0 -37
- package/dist-package/src/ButtonAction/styles.js.map +0 -1
- package/dist-package/src/ButtonBase/ButtonBase.d.ts +0 -29
- package/dist-package/src/ButtonBase/ButtonBase.d.ts.map +0 -1
- package/dist-package/src/ButtonBase/ButtonBase.js +0 -60
- package/dist-package/src/ButtonBase/ButtonBase.js.map +0 -1
- package/dist-package/src/ButtonBase/index.d.ts +0 -5
- package/dist-package/src/ButtonBase/index.d.ts.map +0 -1
- package/dist-package/src/ButtonBase/index.js +0 -2
- package/dist-package/src/ButtonBase/index.js.map +0 -1
- package/dist-package/src/ButtonBase/styles.d.ts +0 -6
- package/dist-package/src/ButtonBase/styles.d.ts.map +0 -1
- package/dist-package/src/ButtonBase/styles.js +0 -29
- package/dist-package/src/ButtonBase/styles.js.map +0 -1
- package/dist-package/src/ButtonCheckbox/ButtonCheckbox.d.ts +0 -10
- package/dist-package/src/ButtonCheckbox/ButtonCheckbox.d.ts.map +0 -1
- package/dist-package/src/ButtonCheckbox/ButtonCheckbox.js +0 -20
- package/dist-package/src/ButtonCheckbox/ButtonCheckbox.js.map +0 -1
- package/dist-package/src/ButtonCheckbox/index.d.ts +0 -4
- package/dist-package/src/ButtonCheckbox/index.d.ts.map +0 -1
- package/dist-package/src/ButtonCheckbox/index.js +0 -2
- package/dist-package/src/ButtonCheckbox/index.js.map +0 -1
- package/dist-package/src/ButtonCircular/ButtonCircular.d.ts +0 -30
- package/dist-package/src/ButtonCircular/ButtonCircular.d.ts.map +0 -1
- package/dist-package/src/ButtonCircular/ButtonCircular.js +0 -32
- package/dist-package/src/ButtonCircular/ButtonCircular.js.map +0 -1
- package/dist-package/src/ButtonCircular/index.d.ts +0 -5
- package/dist-package/src/ButtonCircular/index.d.ts.map +0 -1
- package/dist-package/src/ButtonCircular/index.js +0 -2
- package/dist-package/src/ButtonCircular/index.js.map +0 -1
- package/dist-package/src/ButtonCircular/styles.d.ts +0 -17
- package/dist-package/src/ButtonCircular/styles.d.ts.map +0 -1
- package/dist-package/src/ButtonCircular/styles.js +0 -93
- package/dist-package/src/ButtonCircular/styles.js.map +0 -1
- package/dist-package/src/ButtonCompound/index.d.ts +0 -12
- package/dist-package/src/ButtonCompound/index.d.ts.map +0 -1
- package/dist-package/src/ButtonCompound/index.js +0 -16
- package/dist-package/src/ButtonCompound/index.js.map +0 -1
- package/dist-package/src/ButtonControlLabel/ButtonControlLabel.d.ts +0 -30
- package/dist-package/src/ButtonControlLabel/ButtonControlLabel.d.ts.map +0 -1
- package/dist-package/src/ButtonControlLabel/ButtonControlLabel.js +0 -25
- package/dist-package/src/ButtonControlLabel/ButtonControlLabel.js.map +0 -1
- package/dist-package/src/ButtonControlLabel/index.d.ts +0 -4
- package/dist-package/src/ButtonControlLabel/index.d.ts.map +0 -1
- package/dist-package/src/ButtonControlLabel/index.js +0 -2
- package/dist-package/src/ButtonControlLabel/index.js.map +0 -1
- package/dist-package/src/ButtonControlLabel/styles.d.ts +0 -3
- package/dist-package/src/ButtonControlLabel/styles.d.ts.map +0 -1
- package/dist-package/src/ButtonControlLabel/styles.js +0 -17
- package/dist-package/src/ButtonControlLabel/styles.js.map +0 -1
- package/dist-package/src/ButtonGroup/ButtonGroup.d.ts +0 -13
- package/dist-package/src/ButtonGroup/ButtonGroup.d.ts.map +0 -1
- package/dist-package/src/ButtonGroup/ButtonGroup.js +0 -23
- package/dist-package/src/ButtonGroup/ButtonGroup.js.map +0 -1
- package/dist-package/src/ButtonGroup/index.d.ts +0 -5
- package/dist-package/src/ButtonGroup/index.d.ts.map +0 -1
- package/dist-package/src/ButtonGroup/index.js +0 -2
- package/dist-package/src/ButtonGroup/index.js.map +0 -1
- package/dist-package/src/ButtonGroup/styles.d.ts +0 -2
- package/dist-package/src/ButtonGroup/styles.d.ts.map +0 -1
- package/dist-package/src/ButtonGroup/styles.js +0 -24
- package/dist-package/src/ButtonGroup/styles.js.map +0 -1
- package/dist-package/src/ButtonGroupItem/ButtonGroupItem.d.ts +0 -7
- package/dist-package/src/ButtonGroupItem/ButtonGroupItem.d.ts.map +0 -1
- package/dist-package/src/ButtonGroupItem/ButtonGroupItem.js +0 -22
- package/dist-package/src/ButtonGroupItem/ButtonGroupItem.js.map +0 -1
- package/dist-package/src/ButtonGroupItem/index.d.ts +0 -2
- package/dist-package/src/ButtonGroupItem/index.d.ts.map +0 -1
- package/dist-package/src/ButtonGroupItem/index.js +0 -2
- package/dist-package/src/ButtonGroupItem/index.js.map +0 -1
- package/dist-package/src/ButtonGroupItem/styles.d.ts +0 -14
- package/dist-package/src/ButtonGroupItem/styles.d.ts.map +0 -1
- package/dist-package/src/ButtonGroupItem/styles.js +0 -40
- package/dist-package/src/ButtonGroupItem/styles.js.map +0 -1
- package/dist-package/src/ButtonRadio/ButtonRadio.d.ts +0 -10
- package/dist-package/src/ButtonRadio/ButtonRadio.d.ts.map +0 -1
- package/dist-package/src/ButtonRadio/ButtonRadio.js +0 -20
- package/dist-package/src/ButtonRadio/ButtonRadio.js.map +0 -1
- package/dist-package/src/ButtonRadio/index.d.ts +0 -4
- package/dist-package/src/ButtonRadio/index.d.ts.map +0 -1
- package/dist-package/src/ButtonRadio/index.js +0 -2
- package/dist-package/src/ButtonRadio/index.js.map +0 -1
- package/dist-package/src/ButtonSplit/ButtonSplit.d.ts +0 -27
- package/dist-package/src/ButtonSplit/ButtonSplit.d.ts.map +0 -1
- package/dist-package/src/ButtonSplit/ButtonSplit.js +0 -66
- package/dist-package/src/ButtonSplit/ButtonSplit.js.map +0 -1
- package/dist-package/src/ButtonSplit/index.d.ts +0 -5
- package/dist-package/src/ButtonSplit/index.d.ts.map +0 -1
- package/dist-package/src/ButtonSplit/index.js +0 -2
- package/dist-package/src/ButtonSplit/index.js.map +0 -1
- package/dist-package/src/ButtonSplit/styles.d.ts +0 -10
- package/dist-package/src/ButtonSplit/styles.d.ts.map +0 -1
- package/dist-package/src/ButtonSplit/styles.js +0 -14
- package/dist-package/src/ButtonSplit/styles.js.map +0 -1
- package/dist-package/src/index.d.ts +0 -11
- package/dist-package/src/index.d.ts.map +0 -1
- package/dist-package/src/index.js +0 -11
- package/dist-package/src/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/picasso-button",
|
|
3
|
-
"version": "4.0.24-alpha-
|
|
3
|
+
"version": "4.0.24-alpha-1757603192867.0",
|
|
4
4
|
"description": "Toptal UI components library - Button",
|
|
5
5
|
"publishConfig": {
|
|
6
|
-
"access": "public"
|
|
6
|
+
"access": "public",
|
|
7
|
+
"provenance": true
|
|
7
8
|
},
|
|
8
9
|
"main": "./dist-package/src/index.js",
|
|
9
10
|
"module": "./dist-package/src/index.js",
|
|
10
11
|
"scripts": {
|
|
11
12
|
"build:package": "tsc -b tsconfig.json",
|
|
12
|
-
"prepublishOnly": "
|
|
13
|
+
"prepublishOnly": "echo 0"
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
@@ -22,17 +23,17 @@
|
|
|
22
23
|
},
|
|
23
24
|
"homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"@toptal/picasso-
|
|
27
|
-
"@toptal/picasso-
|
|
28
|
-
"@toptal/picasso-
|
|
29
|
-
"@toptal/picasso-
|
|
30
|
-
"@toptal/picasso-
|
|
31
|
-
"@toptal/picasso-
|
|
32
|
-
"@toptal/picasso-
|
|
33
|
-
"@toptal/picasso-
|
|
34
|
-
"@toptal/picasso-utils": "3.1.1-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.31+7db07b500",
|
|
26
|
+
"@toptal/picasso-checkbox": "5.0.14-alpha-1757603192867.0",
|
|
27
|
+
"@toptal/picasso-container": "3.1.3-alpha-1757603192867.0",
|
|
28
|
+
"@toptal/picasso-dropdown": "4.2.4-alpha-1757603192867.0",
|
|
29
|
+
"@toptal/picasso-icons": "1.12.2-alpha-1757603192867.0",
|
|
30
|
+
"@toptal/picasso-loader": "3.0.4-alpha-1757603192867.0",
|
|
31
|
+
"@toptal/picasso-radio": "5.0.14-alpha-1757603192867.0",
|
|
32
|
+
"@toptal/picasso-shared": "15.0.1-alpha-1757603192867.0",
|
|
33
|
+
"@toptal/picasso-utils": "3.1.1-alpha-1757603192867.0",
|
|
34
|
+
"@toptal/picasso-link": "3.0.7-alpha-1757603192867.0",
|
|
35
35
|
"ap-style-title-case": "^1.1.2",
|
|
36
|
+
"@mui/base": "5.0.0-beta.58",
|
|
36
37
|
"classnames": "^2.5.1"
|
|
37
38
|
},
|
|
38
39
|
"sideEffects": [
|
|
@@ -40,23 +41,22 @@
|
|
|
40
41
|
"**/styles.js"
|
|
41
42
|
],
|
|
42
43
|
"peerDependencies": {
|
|
43
|
-
"@toptal/picasso-
|
|
44
|
-
"@toptal/picasso-tailwind": "
|
|
45
|
-
"@toptal/picasso-
|
|
44
|
+
"@toptal/picasso-tailwind-merge": "2.0.4-alpha-1757603192867.0",
|
|
45
|
+
"@toptal/picasso-tailwind": "3.0.1-alpha-1757603192867.0",
|
|
46
|
+
"@toptal/picasso-provider": "5.0.2-alpha-1757603192867.0",
|
|
46
47
|
"react": ">=16.12.0 < 19.0.0"
|
|
47
48
|
},
|
|
48
49
|
"exports": {
|
|
49
50
|
".": "./dist-package/src/index.js"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@toptal/picasso-
|
|
53
|
-
"@toptal/picasso-
|
|
54
|
-
"@toptal/picasso-test-utils": "1.1.2-alpha-
|
|
53
|
+
"@toptal/picasso-tailwind-merge": "2.0.4-alpha-1757603192867.0",
|
|
54
|
+
"@toptal/picasso-provider": "5.0.2-alpha-1757603192867.0",
|
|
55
|
+
"@toptal/picasso-test-utils": "1.1.2-alpha-1757603192867.0"
|
|
55
56
|
},
|
|
56
57
|
"files": [
|
|
57
58
|
"dist-package/**",
|
|
58
59
|
"!dist-package/tsconfig.tsbuildinfo",
|
|
59
60
|
"src"
|
|
60
|
-
]
|
|
61
|
-
"gitHead": "7db07b500402a91f0c09da3be294305a194fd1e4"
|
|
61
|
+
]
|
|
62
62
|
}
|
package/src/Button/Button.tsx
CHANGED
|
@@ -98,29 +98,24 @@ const getIcon = ({
|
|
|
98
98
|
export const Button: OverridableComponent<Props> = forwardRef<
|
|
99
99
|
HTMLButtonElement,
|
|
100
100
|
Props
|
|
101
|
-
>(function Button(
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
fullWidth = false,
|
|
109
|
-
hovered = false,
|
|
110
|
-
iconPosition = 'left',
|
|
111
|
-
loading = false,
|
|
112
|
-
onClick = noop,
|
|
113
|
-
size = 'medium',
|
|
114
|
-
type = 'button',
|
|
101
|
+
>(function Button(props, ref) {
|
|
102
|
+
const {
|
|
103
|
+
icon,
|
|
104
|
+
iconPosition,
|
|
105
|
+
loading,
|
|
106
|
+
className,
|
|
107
|
+
fullWidth,
|
|
115
108
|
variant = 'primary',
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
109
|
+
size = 'medium',
|
|
110
|
+
focused,
|
|
111
|
+
hovered,
|
|
112
|
+
disabled,
|
|
113
|
+
active,
|
|
114
|
+
...rest
|
|
115
|
+
} = props
|
|
121
116
|
|
|
122
117
|
const iconComponent = getIcon({
|
|
123
|
-
children,
|
|
118
|
+
children: rest.children,
|
|
124
119
|
icon,
|
|
125
120
|
iconPosition,
|
|
126
121
|
size,
|
|
@@ -173,14 +168,26 @@ export const Button: OverridableComponent<Props> = forwardRef<
|
|
|
173
168
|
iconPosition={iconPosition}
|
|
174
169
|
loading={loading}
|
|
175
170
|
disabled={disabled}
|
|
176
|
-
as={as}
|
|
177
|
-
type={type}
|
|
178
|
-
onClick={onClick}
|
|
179
|
-
children={children}
|
|
180
171
|
/>
|
|
181
172
|
)
|
|
182
173
|
})
|
|
183
174
|
|
|
175
|
+
Button.defaultProps = {
|
|
176
|
+
active: false,
|
|
177
|
+
as: 'button',
|
|
178
|
+
children: null,
|
|
179
|
+
disabled: false,
|
|
180
|
+
focused: false,
|
|
181
|
+
fullWidth: false,
|
|
182
|
+
hovered: false,
|
|
183
|
+
iconPosition: 'left',
|
|
184
|
+
loading: false,
|
|
185
|
+
onClick: noop,
|
|
186
|
+
size: 'medium',
|
|
187
|
+
type: 'button',
|
|
188
|
+
variant: 'primary',
|
|
189
|
+
}
|
|
190
|
+
|
|
184
191
|
Button.displayName = 'Button'
|
|
185
192
|
|
|
186
193
|
export default Button
|
|
@@ -62,7 +62,7 @@ const loaderIcon = <Loader size='small' variant='inherit' />
|
|
|
62
62
|
export const ButtonAction: OverridableComponent<Props> = forwardRef<
|
|
63
63
|
HTMLButtonElement,
|
|
64
64
|
Props
|
|
65
|
-
>(function ButtonAction(
|
|
65
|
+
>(function ButtonAction(props, ref) {
|
|
66
66
|
const {
|
|
67
67
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
68
68
|
// We use these props only to determine styles
|
|
@@ -74,6 +74,7 @@ export const ButtonAction: OverridableComponent<Props> = forwardRef<
|
|
|
74
74
|
disabled,
|
|
75
75
|
loading,
|
|
76
76
|
icon,
|
|
77
|
+
iconPosition,
|
|
77
78
|
onClick,
|
|
78
79
|
...rest
|
|
79
80
|
} = props
|
|
@@ -102,6 +103,10 @@ export const ButtonAction: OverridableComponent<Props> = forwardRef<
|
|
|
102
103
|
)
|
|
103
104
|
})
|
|
104
105
|
|
|
106
|
+
ButtonAction.defaultProps = {
|
|
107
|
+
iconPosition: 'left',
|
|
108
|
+
}
|
|
109
|
+
|
|
105
110
|
ButtonAction.displayName = 'ButtonAction'
|
|
106
111
|
|
|
107
112
|
export default ButtonAction
|
|
@@ -72,26 +72,21 @@ const RootElement = forwardRef(
|
|
|
72
72
|
export const ButtonBase: OverridableComponent<Props> = forwardRef<
|
|
73
73
|
HTMLButtonElement,
|
|
74
74
|
Props
|
|
75
|
-
>(function ButtonBase(
|
|
76
|
-
{
|
|
77
|
-
as = 'button',
|
|
78
|
-
children = null,
|
|
79
|
-
disabled = false,
|
|
80
|
-
iconPosition = 'left',
|
|
81
|
-
loading = false,
|
|
82
|
-
onClick = noop,
|
|
83
|
-
type = 'button',
|
|
84
|
-
...props
|
|
85
|
-
},
|
|
86
|
-
ref
|
|
87
|
-
) {
|
|
75
|
+
>(function ButtonBase(props, ref) {
|
|
88
76
|
const {
|
|
89
77
|
icon,
|
|
78
|
+
iconPosition,
|
|
79
|
+
loading,
|
|
80
|
+
children,
|
|
90
81
|
className,
|
|
91
82
|
contentClassName,
|
|
92
83
|
style,
|
|
84
|
+
disabled,
|
|
85
|
+
onClick,
|
|
93
86
|
title,
|
|
94
87
|
value,
|
|
88
|
+
type,
|
|
89
|
+
as = 'button',
|
|
95
90
|
titleCase: propsTitleCase,
|
|
96
91
|
...rest
|
|
97
92
|
} = props
|
|
@@ -155,6 +150,16 @@ export const ButtonBase: OverridableComponent<Props> = forwardRef<
|
|
|
155
150
|
)
|
|
156
151
|
})
|
|
157
152
|
|
|
153
|
+
ButtonBase.defaultProps = {
|
|
154
|
+
as: 'button',
|
|
155
|
+
children: null,
|
|
156
|
+
disabled: false,
|
|
157
|
+
iconPosition: 'left',
|
|
158
|
+
loading: false,
|
|
159
|
+
onClick: noop,
|
|
160
|
+
type: 'button',
|
|
161
|
+
}
|
|
162
|
+
|
|
158
163
|
ButtonBase.displayName = 'ButtonBase'
|
|
159
164
|
|
|
160
165
|
export default ButtonBase
|
|
@@ -40,9 +40,10 @@ export interface Props extends BaseProps, ButtonOrAnchorProps {
|
|
|
40
40
|
export const ButtonCircular: OverridableComponent<Props> = forwardRef<
|
|
41
41
|
HTMLButtonElement,
|
|
42
42
|
Props
|
|
43
|
-
>(function ButtonCircular(
|
|
43
|
+
>(function ButtonCircular(props, ref) {
|
|
44
44
|
const {
|
|
45
45
|
className,
|
|
46
|
+
variant = 'primary',
|
|
46
47
|
active,
|
|
47
48
|
focused,
|
|
48
49
|
hovered,
|
|
@@ -83,6 +84,10 @@ export const ButtonCircular: OverridableComponent<Props> = forwardRef<
|
|
|
83
84
|
)
|
|
84
85
|
})
|
|
85
86
|
|
|
87
|
+
ButtonCircular.defaultProps = {
|
|
88
|
+
variant: 'primary',
|
|
89
|
+
}
|
|
90
|
+
|
|
86
91
|
ButtonCircular.displayName = 'ButtonCircular'
|
|
87
92
|
|
|
88
93
|
export default ButtonCircular
|
|
@@ -63,13 +63,12 @@ const EventStopPropagation = ({ children }: { children: ReactNode }) => {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export const ButtonSplit = forwardRef<HTMLDivElement, Props>(
|
|
66
|
-
function ButtonSplit(
|
|
67
|
-
{ size = 'medium', variant = 'primary', ...props },
|
|
68
|
-
ref
|
|
69
|
-
) {
|
|
66
|
+
function ButtonSplit(props, ref) {
|
|
70
67
|
const {
|
|
68
|
+
size = 'medium',
|
|
71
69
|
menu,
|
|
72
70
|
children,
|
|
71
|
+
variant = 'primary',
|
|
73
72
|
disabled,
|
|
74
73
|
style,
|
|
75
74
|
className,
|
|
@@ -157,6 +156,11 @@ export const ButtonSplit = forwardRef<HTMLDivElement, Props>(
|
|
|
157
156
|
}
|
|
158
157
|
)
|
|
159
158
|
|
|
159
|
+
ButtonSplit.defaultProps = {
|
|
160
|
+
size: 'medium',
|
|
161
|
+
variant: 'primary',
|
|
162
|
+
}
|
|
163
|
+
|
|
160
164
|
ButtonSplit.displayName = 'ButtonSplit'
|
|
161
165
|
|
|
162
166
|
export default ButtonSplit
|
package/LICENSE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021-2022 Toptal, LLC
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the “Software”), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
-
subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ReactNode, ReactElement, MouseEvent, ElementType } from 'react';
|
|
2
|
-
import type { StandardProps, SizeType, ButtonOrAnchorProps, OverridableComponent, TextLabelProps } from '@toptal/picasso-shared';
|
|
3
|
-
export declare type VariantType = 'primary' | 'negative' | 'positive' | 'secondary' | 'transparent';
|
|
4
|
-
export declare type IconPositionType = 'left' | 'right';
|
|
5
|
-
export interface Props extends StandardProps, TextLabelProps, ButtonOrAnchorProps {
|
|
6
|
-
/** Show button in the active state (left mouse button down) */
|
|
7
|
-
active?: boolean;
|
|
8
|
-
as?: ElementType;
|
|
9
|
-
/** Disables button */
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
/** Content of Button component */
|
|
12
|
-
children?: ReactNode;
|
|
13
|
-
focused?: boolean;
|
|
14
|
-
/** Take the full width of a container */
|
|
15
|
-
fullWidth?: boolean;
|
|
16
|
-
/** Set hovered style for the button */
|
|
17
|
-
hovered?: boolean;
|
|
18
|
-
/** Add an `<Icon />` along Button's children */
|
|
19
|
-
icon?: ReactElement;
|
|
20
|
-
/** Icon can be positioned on the left or right */
|
|
21
|
-
iconPosition?: IconPositionType;
|
|
22
|
-
/** Shows a loading indicator and disables click events */
|
|
23
|
-
loading?: boolean;
|
|
24
|
-
/** Callback invoked when component is clicked */
|
|
25
|
-
onClick?: (event: MouseEvent<HTMLButtonElement & HTMLAnchorElement>) => void;
|
|
26
|
-
/** A button can have different sizes */
|
|
27
|
-
size?: SizeType<'small' | 'medium' | 'large'>;
|
|
28
|
-
/** The variant to use */
|
|
29
|
-
variant?: VariantType;
|
|
30
|
-
/** HTML Value of Button component */
|
|
31
|
-
value?: string | number;
|
|
32
|
-
/** HTML title of Button component */
|
|
33
|
-
title?: string;
|
|
34
|
-
/** HTML type of Button component */
|
|
35
|
-
type?: 'button' | 'reset' | 'submit';
|
|
36
|
-
}
|
|
37
|
-
export declare const Button: OverridableComponent<Props>;
|
|
38
|
-
export default Button;
|
|
39
|
-
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAI7E,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACf,MAAM,wBAAwB,CAAA;AAiB/B,oBAAY,WAAW,GACnB,SAAS,GACT,UAAU,GACV,UAAU,GACV,WAAW,GACX,aAAa,CAAA;AAEjB,oBAAY,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAAA;AAE/C,MAAM,WAAW,KACf,SAAQ,aAAa,EACnB,cAAc,EACd,mBAAmB;IACrB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,EAAE,CAAC,EAAE,WAAW,CAAA;IAChB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yCAAyC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gDAAgD;IAChD,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,kDAAkD;IAClD,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC5E,wCAAwC;IACxC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;IAC7C,yBAAyB;IACzB,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oCAAoC;IACpC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;CACrC;AA2BD,eAAO,MAAM,MAAM,EAAE,oBAAoB,CAAC,KAAK,CAoF7C,CAAA;AAIF,eAAe,MAAM,CAAA"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React, { forwardRef } from 'react';
|
|
13
|
-
import cx from 'classnames';
|
|
14
|
-
import { twMerge } from '@toptal/picasso-tailwind-merge';
|
|
15
|
-
import { noop } from '@toptal/picasso-utils';
|
|
16
|
-
// we need to ensure the correct order of styles import
|
|
17
|
-
// TODO: [FX-4614] To be removed when Link component is migrated to tailwind
|
|
18
|
-
import { Link } from '@toptal/picasso-link';
|
|
19
|
-
import { ButtonBase } from '../ButtonBase';
|
|
20
|
-
import { createVariantClassNames, createCoreClassNames, createSizeClassNames, createIconClassNames, } from './styles';
|
|
21
|
-
// HACK: This statement is only used to prevent webpack from tree shaking the import
|
|
22
|
-
void Link;
|
|
23
|
-
const getIcon = ({ children, icon, iconPosition, size, }) => {
|
|
24
|
-
if (!icon) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
const iconClassNames = createIconClassNames({
|
|
28
|
-
size,
|
|
29
|
-
iconPosition: children && iconPosition ? iconPosition : undefined,
|
|
30
|
-
});
|
|
31
|
-
return React.cloneElement(icon, {
|
|
32
|
-
className: twMerge(iconClassNames, icon.props.className),
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
export const Button = forwardRef(function Button(_a, ref) {
|
|
36
|
-
var { active = false, as = 'button', children = null, disabled = false, focused = false, fullWidth = false, hovered = false, iconPosition = 'left', loading = false, onClick = noop, size = 'medium', type = 'button', variant = 'primary' } = _a, props = __rest(_a, ["active", "as", "children", "disabled", "focused", "fullWidth", "hovered", "iconPosition", "loading", "onClick", "size", "type", "variant"]);
|
|
37
|
-
const { icon, className } = props, rest = __rest(props, ["icon", "className"]);
|
|
38
|
-
const iconComponent = getIcon({
|
|
39
|
-
children,
|
|
40
|
-
icon,
|
|
41
|
-
iconPosition,
|
|
42
|
-
size,
|
|
43
|
-
});
|
|
44
|
-
const coreClassNames = createCoreClassNames({
|
|
45
|
-
disabled,
|
|
46
|
-
focused,
|
|
47
|
-
hovered,
|
|
48
|
-
active,
|
|
49
|
-
});
|
|
50
|
-
const variantClassNames = createVariantClassNames(variant, {
|
|
51
|
-
disabled,
|
|
52
|
-
focused,
|
|
53
|
-
hovered,
|
|
54
|
-
active,
|
|
55
|
-
loading,
|
|
56
|
-
});
|
|
57
|
-
const sizeClassNames = createSizeClassNames(size);
|
|
58
|
-
const finalClassName = twMerge(coreClassNames, variantClassNames, sizeClassNames, fullWidth ? 'w-full' : '', className);
|
|
59
|
-
const contentSizeClassNames = {
|
|
60
|
-
small: ['text-button-small'],
|
|
61
|
-
medium: ['text-button-medium'],
|
|
62
|
-
large: ['text-button-large'],
|
|
63
|
-
};
|
|
64
|
-
const contentClassName = cx('font-semibold whitespace-nowrap', contentSizeClassNames[size], loading ? 'opacity-0' : '');
|
|
65
|
-
return (React.createElement(ButtonBase, Object.assign({}, rest, { ref: ref, className: finalClassName, contentClassName: contentClassName, icon: iconComponent, iconPosition: iconPosition, loading: loading, disabled: disabled, as: as, type: type, onClick: onClick, children: children })));
|
|
66
|
-
});
|
|
67
|
-
Button.displayName = 'Button';
|
|
68
|
-
export default Button;
|
|
69
|
-
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/Button/Button.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,oBAAY,WAAW,GAAG,KAAK,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Button/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAE5C,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { SizeType } from '@toptal/picasso-shared';
|
|
2
|
-
import type { IconPositionType, VariantType } from './Button';
|
|
3
|
-
export declare const createSizeClassNames: (size: 'small' | 'medium' | 'large') => string[];
|
|
4
|
-
export declare const createVariantClassNames: (variant: VariantType, { disabled, focused, hovered, active, loading, }: {
|
|
5
|
-
disabled?: boolean | undefined;
|
|
6
|
-
focused?: boolean | undefined;
|
|
7
|
-
hovered?: boolean | undefined;
|
|
8
|
-
active?: boolean | undefined;
|
|
9
|
-
loading?: boolean | undefined;
|
|
10
|
-
}) => string[];
|
|
11
|
-
export declare const createCoreClassNames: ({ disabled, focused, active, }: {
|
|
12
|
-
disabled?: boolean | undefined;
|
|
13
|
-
focused?: boolean | undefined;
|
|
14
|
-
hovered?: boolean | undefined;
|
|
15
|
-
active?: boolean | undefined;
|
|
16
|
-
}) => string[];
|
|
17
|
-
export declare const createIconClassNames: ({ iconPosition, size, }: {
|
|
18
|
-
iconPosition?: IconPositionType | undefined;
|
|
19
|
-
size: SizeType<'small' | 'medium' | 'large'>;
|
|
20
|
-
}) => string[];
|
|
21
|
-
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Button/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE7D,eAAO,MAAM,oBAAoB,SACzB,OAAO,GAAG,QAAQ,GAAG,OAAO,KACjC,MAAM,EAWR,CAAA;AAED,eAAO,MAAM,uBAAuB,YACzB,WAAW;;;;;;MAcnB,MAAM,EAoIR,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;MAS7B,MAAM,EAsBT,CAAA;AAED,eAAO,MAAM,oBAAoB;;UAKzB,SAAS,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;MAC1C,MAAM,EAeT,CAAA"}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
export const createSizeClassNames = (size) => {
|
|
2
|
-
const sizeClassNames = {
|
|
3
|
-
small: ['min-w-14', 'h-6', 'py-0', 'px-3'],
|
|
4
|
-
medium: ['min-w-16', 'h-8', 'py-0', 'px-4'],
|
|
5
|
-
large: ['min-w-24', 'h-12', 'py-0', 'px-8'],
|
|
6
|
-
};
|
|
7
|
-
return sizeClassNames[size];
|
|
8
|
-
};
|
|
9
|
-
export const createVariantClassNames = (variant, { disabled, focused, hovered, active, loading, }) => {
|
|
10
|
-
const variantClassNames = [];
|
|
11
|
-
switch (variant) {
|
|
12
|
-
case 'primary':
|
|
13
|
-
variantClassNames.push('border-none');
|
|
14
|
-
variantClassNames.push('text-white');
|
|
15
|
-
variantClassNames.push('visited:text-white');
|
|
16
|
-
if (disabled && !loading) {
|
|
17
|
-
variantClassNames.push('bg-gray-400');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
variantClassNames.push('hover:bg-[#4269D6]');
|
|
21
|
-
variantClassNames.push('active:bg-[#1A41AB]');
|
|
22
|
-
if (hovered) {
|
|
23
|
-
variantClassNames.push('bg-[#4269D6]');
|
|
24
|
-
}
|
|
25
|
-
else if (active) {
|
|
26
|
-
variantClassNames.push('bg-[#1A41AB]');
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
variantClassNames.push('bg-blue-500');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
break;
|
|
33
|
-
case 'negative':
|
|
34
|
-
variantClassNames.push('border-none');
|
|
35
|
-
variantClassNames.push('text-white');
|
|
36
|
-
variantClassNames.push('visited:text-white');
|
|
37
|
-
if (disabled && !loading) {
|
|
38
|
-
variantClassNames.push('bg-gray-400');
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
variantClassNames.push('hover:bg-[#DB466B]');
|
|
42
|
-
variantClassNames.push('active:bg-[#B01F43]');
|
|
43
|
-
if (hovered) {
|
|
44
|
-
variantClassNames.push('bg-[#DB466B]');
|
|
45
|
-
}
|
|
46
|
-
else if (active) {
|
|
47
|
-
variantClassNames.push('bg-[#B01F43]');
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
variantClassNames.push('bg-red-500');
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
break;
|
|
54
|
-
case 'positive':
|
|
55
|
-
variantClassNames.push('border-none');
|
|
56
|
-
variantClassNames.push('text-white');
|
|
57
|
-
variantClassNames.push('visited:text-white');
|
|
58
|
-
if (disabled && !loading) {
|
|
59
|
-
variantClassNames.push('bg-gray-400');
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
variantClassNames.push('hover:bg-[#27D496]');
|
|
63
|
-
variantClassNames.push('active:bg-[#00A96C]');
|
|
64
|
-
if (hovered) {
|
|
65
|
-
variantClassNames.push('bg-[#27D496]');
|
|
66
|
-
}
|
|
67
|
-
else if (active) {
|
|
68
|
-
variantClassNames.push('bg-[#00A96C]');
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
variantClassNames.push('bg-green-500');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
break;
|
|
75
|
-
case 'secondary':
|
|
76
|
-
variantClassNames.push('border border-solid');
|
|
77
|
-
if (disabled && !loading) {
|
|
78
|
-
variantClassNames.push('text-gray-500');
|
|
79
|
-
variantClassNames.push('visited:text-gray-500');
|
|
80
|
-
variantClassNames.push('border-gray-500');
|
|
81
|
-
variantClassNames.push('bg-white');
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
variantClassNames.push('text-black');
|
|
85
|
-
variantClassNames.push('hover:border-black');
|
|
86
|
-
variantClassNames.push('visited:text-black');
|
|
87
|
-
variantClassNames.push('active:bg-gray-200');
|
|
88
|
-
variantClassNames.push('active:border-black');
|
|
89
|
-
if (hovered) {
|
|
90
|
-
variantClassNames.push('border-black');
|
|
91
|
-
variantClassNames.push('bg-white');
|
|
92
|
-
}
|
|
93
|
-
else if (active) {
|
|
94
|
-
variantClassNames.push('border-black');
|
|
95
|
-
variantClassNames.push('bg-gray-200');
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
variantClassNames.push('bg-white');
|
|
99
|
-
variantClassNames.push('border-gray-400');
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
break;
|
|
103
|
-
case 'transparent':
|
|
104
|
-
variantClassNames.push('border border-solid');
|
|
105
|
-
if (disabled && !loading) {
|
|
106
|
-
variantClassNames.push('text-white/[0.32]');
|
|
107
|
-
variantClassNames.push('border-white/[0.32]');
|
|
108
|
-
variantClassNames.push('bg-transparent');
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
variantClassNames.push('text-white');
|
|
112
|
-
variantClassNames.push('visited:text-white');
|
|
113
|
-
variantClassNames.push('border-solid');
|
|
114
|
-
variantClassNames.push('hover:border-white');
|
|
115
|
-
variantClassNames.push('active:border-white');
|
|
116
|
-
variantClassNames.push('active:bg-white/[.16]');
|
|
117
|
-
variantClassNames.push('focus-visible:shadow-[0_0_0_3px_rgba(255,255,255,0.48)]');
|
|
118
|
-
if (hovered) {
|
|
119
|
-
variantClassNames.push('border-white');
|
|
120
|
-
variantClassNames.push('bg-transparent');
|
|
121
|
-
}
|
|
122
|
-
else if (active) {
|
|
123
|
-
variantClassNames.push('border-white');
|
|
124
|
-
variantClassNames.push('bg-white/[.16]');
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
variantClassNames.push('border-white/[0.32]');
|
|
128
|
-
variantClassNames.push('bg-transparent');
|
|
129
|
-
}
|
|
130
|
-
if (focused) {
|
|
131
|
-
variantClassNames.push('shadow-[0_0_0_3px_rgba(255,255,255,0.48)]');
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
return variantClassNames;
|
|
137
|
-
};
|
|
138
|
-
export const createCoreClassNames = ({ disabled, focused, active, }) => {
|
|
139
|
-
const classNames = [
|
|
140
|
-
'no-underline hover:no-underline',
|
|
141
|
-
'rounded-sm',
|
|
142
|
-
'shadow-none',
|
|
143
|
-
];
|
|
144
|
-
if (!disabled) {
|
|
145
|
-
classNames.push('focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)]');
|
|
146
|
-
classNames.push('focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)]');
|
|
147
|
-
if (focused) {
|
|
148
|
-
classNames.push('shadow-[0_0_0_3px_rgba(32,78,207,0.48)]');
|
|
149
|
-
}
|
|
150
|
-
if (active) {
|
|
151
|
-
classNames.push('shadow-none');
|
|
152
|
-
classNames.push('z-[1]');
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return classNames;
|
|
156
|
-
};
|
|
157
|
-
export const createIconClassNames = ({ iconPosition, size, }) => {
|
|
158
|
-
const sizeClassNames = {
|
|
159
|
-
small: [iconPosition === 'left' ? 'ml-[-0.125em]' : 'mr-[-0.125em]'],
|
|
160
|
-
medium: [iconPosition === 'left' ? 'ml-[-0.25em]' : 'mr-[-0.25em]'],
|
|
161
|
-
large: [iconPosition === 'left' ? 'ml-[-0.5em]' : 'mr-[-0.5em]'],
|
|
162
|
-
};
|
|
163
|
-
return [
|
|
164
|
-
sizeClassNames[size].join(' '),
|
|
165
|
-
iconPosition === 'left' ? 'mr-[0.5em]' : '',
|
|
166
|
-
iconPosition === 'right' ? 'ml-[0.5em]' : '',
|
|
167
|
-
];
|
|
168
|
-
};
|
|
169
|
-
//# sourceMappingURL=styles.js.map
|