@toptal/picasso-button 1.0.13-alpha-fx-5263-merge-feature-branch-d124b1f9a.10 → 1.0.13-alpha-fx-4594-migrate-griditem-4e798b92d.27

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.
Files changed (90) hide show
  1. package/dist-package/src/Button/Button.d.ts.map +1 -1
  2. package/dist-package/src/Button/Button.js +47 -39
  3. package/dist-package/src/Button/Button.js.map +1 -1
  4. package/dist-package/src/Button/styles.d.ts +45 -19
  5. package/dist-package/src/Button/styles.d.ts.map +1 -1
  6. package/dist-package/src/Button/styles.js +178 -161
  7. package/dist-package/src/Button/styles.js.map +1 -1
  8. package/dist-package/src/ButtonAction/ButtonAction.d.ts.map +1 -1
  9. package/dist-package/src/ButtonAction/ButtonAction.js +28 -20
  10. package/dist-package/src/ButtonAction/ButtonAction.js.map +1 -1
  11. package/dist-package/src/ButtonAction/styles.d.ts +3 -11
  12. package/dist-package/src/ButtonAction/styles.d.ts.map +1 -1
  13. package/dist-package/src/ButtonAction/styles.js +55 -36
  14. package/dist-package/src/ButtonAction/styles.js.map +1 -1
  15. package/dist-package/src/ButtonCircular/ButtonCircular.d.ts.map +1 -1
  16. package/dist-package/src/ButtonCircular/ButtonCircular.js +26 -12
  17. package/dist-package/src/ButtonCircular/ButtonCircular.js.map +1 -1
  18. package/dist-package/src/ButtonCircular/styles.d.ts +3 -15
  19. package/dist-package/src/ButtonCircular/styles.d.ts.map +1 -1
  20. package/dist-package/src/ButtonCircular/styles.js +57 -92
  21. package/dist-package/src/ButtonCircular/styles.js.map +1 -1
  22. package/dist-package/src/ButtonCompound/index.d.ts +1 -1
  23. package/dist-package/src/ButtonControlLabel/ButtonControlLabel.d.ts.map +1 -1
  24. package/dist-package/src/ButtonControlLabel/ButtonControlLabel.js +13 -4
  25. package/dist-package/src/ButtonControlLabel/ButtonControlLabel.js.map +1 -1
  26. package/dist-package/src/ButtonControlLabel/styles.d.ts +2 -2
  27. package/dist-package/src/ButtonControlLabel/styles.d.ts.map +1 -1
  28. package/dist-package/src/ButtonControlLabel/styles.js +25 -16
  29. package/dist-package/src/ButtonControlLabel/styles.js.map +1 -1
  30. package/dist-package/src/ButtonGroup/ButtonGroup.d.ts +1 -1
  31. package/dist-package/src/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  32. package/dist-package/src/ButtonGroup/ButtonGroup.js +27 -5
  33. package/dist-package/src/ButtonGroup/ButtonGroup.js.map +1 -1
  34. package/dist-package/src/ButtonGroup/styles.d.ts +2 -1
  35. package/dist-package/src/ButtonGroup/styles.d.ts.map +1 -1
  36. package/dist-package/src/ButtonGroup/styles.js +47 -20
  37. package/dist-package/src/ButtonGroup/styles.js.map +1 -1
  38. package/dist-package/src/ButtonGroupItem/ButtonGroupItem.d.ts +1 -1
  39. package/dist-package/src/ButtonGroupItem/ButtonGroupItem.d.ts.map +1 -1
  40. package/dist-package/src/ButtonGroupItem/ButtonGroupItem.js +12 -17
  41. package/dist-package/src/ButtonGroupItem/ButtonGroupItem.js.map +1 -1
  42. package/dist-package/src/ButtonGroupItem/styles.d.ts +3 -13
  43. package/dist-package/src/ButtonGroupItem/styles.d.ts.map +1 -1
  44. package/dist-package/src/ButtonGroupItem/styles.js +17 -39
  45. package/dist-package/src/ButtonGroupItem/styles.js.map +1 -1
  46. package/dist-package/src/ButtonSplit/ButtonSplit.d.ts.map +1 -1
  47. package/dist-package/src/ButtonSplit/ButtonSplit.js +24 -28
  48. package/dist-package/src/ButtonSplit/ButtonSplit.js.map +1 -1
  49. package/dist-package/src/ButtonSplit/styles.d.ts +3 -9
  50. package/dist-package/src/ButtonSplit/styles.d.ts.map +1 -1
  51. package/dist-package/src/ButtonSplit/styles.js +50 -13
  52. package/dist-package/src/ButtonSplit/styles.js.map +1 -1
  53. package/package.json +15 -19
  54. package/src/Button/Button.tsx +100 -69
  55. package/src/Button/__snapshots__/test.tsx.snap +4 -8
  56. package/src/Button/styles.ts +221 -214
  57. package/src/Button/test.tsx +1 -3
  58. package/src/ButtonAction/ButtonAction.tsx +48 -36
  59. package/src/ButtonAction/styles.ts +57 -57
  60. package/src/ButtonCheckbox/__snapshots__/test.tsx.snap +3 -4
  61. package/src/ButtonCircular/ButtonCircular.tsx +37 -22
  62. package/src/ButtonCircular/styles.ts +75 -127
  63. package/src/ButtonControlLabel/ButtonControlLabel.tsx +16 -7
  64. package/src/ButtonControlLabel/styles.ts +26 -30
  65. package/src/ButtonGroup/ButtonGroup.tsx +44 -9
  66. package/src/ButtonGroup/__snapshots__/test.tsx.snap +7 -13
  67. package/src/ButtonGroup/styles.ts +63 -21
  68. package/src/ButtonGroupItem/ButtonGroupItem.tsx +15 -24
  69. package/src/ButtonGroupItem/styles.ts +28 -62
  70. package/src/ButtonRadio/__snapshots__/test.tsx.snap +3 -4
  71. package/src/ButtonSplit/ButtonSplit.tsx +42 -46
  72. package/src/ButtonSplit/__snapshots__/test.tsx.snap +9 -13
  73. package/src/ButtonSplit/styles.ts +56 -37
  74. package/dist-package/src/ButtonBase/ButtonBase.d.ts +0 -29
  75. package/dist-package/src/ButtonBase/ButtonBase.d.ts.map +0 -1
  76. package/dist-package/src/ButtonBase/ButtonBase.js +0 -78
  77. package/dist-package/src/ButtonBase/ButtonBase.js.map +0 -1
  78. package/dist-package/src/ButtonBase/index.d.ts +0 -5
  79. package/dist-package/src/ButtonBase/index.d.ts.map +0 -1
  80. package/dist-package/src/ButtonBase/index.js +0 -2
  81. package/dist-package/src/ButtonBase/index.js.map +0 -1
  82. package/dist-package/src/ButtonBase/styles.d.ts +0 -6
  83. package/dist-package/src/ButtonBase/styles.d.ts.map +0 -1
  84. package/dist-package/src/ButtonBase/styles.js +0 -29
  85. package/dist-package/src/ButtonBase/styles.js.map +0 -1
  86. package/src/ButtonBase/ButtonBase.tsx +0 -182
  87. package/src/ButtonBase/__snapshots__/test.tsx.snap +0 -262
  88. package/src/ButtonBase/index.ts +0 -5
  89. package/src/ButtonBase/styles.ts +0 -36
  90. package/src/ButtonBase/test.tsx +0 -212
@@ -1,215 +1,222 @@
1
- import type { SizeType } from '@toptal/picasso-shared'
2
-
3
- import type { IconPositionType, VariantType } from './Button'
4
-
5
- export const createSizeClassNames = (
6
- size: 'small' | 'medium' | 'large'
7
- ): string[] => {
8
- const sizeClassNames: Record<
9
- SizeType<'small' | 'medium' | 'large'>,
10
- string[]
11
- > = {
12
- small: ['min-w-14', 'h-6', 'py-0', 'px-3'],
13
- medium: ['min-w-16', 'h-8', 'py-0', 'px-4'],
14
- large: ['min-w-24', 'h-12', 'py-0', 'px-8'],
15
- }
16
-
17
- return sizeClassNames[size]
18
- }
19
-
20
- export const createVariantClassNames = (
21
- variant: VariantType,
22
- {
23
- disabled,
24
- focused,
25
- hovered,
26
- active,
27
- }: {
28
- disabled?: boolean
29
- focused?: boolean
30
- hovered?: boolean
31
- active?: boolean
32
- }
33
- ): string[] => {
34
- const variantClassNames = []
35
-
36
- switch (variant) {
37
- case 'primary':
38
- variantClassNames.push('border-none')
39
- variantClassNames.push('text-white')
40
- variantClassNames.push('visited:text-white')
41
-
42
- if (disabled) {
43
- variantClassNames.push('bg-gray-400')
44
- } else {
45
- variantClassNames.push('hover:bg-[#4269D6]')
46
- variantClassNames.push('active:bg-[#1A41AB]')
47
-
48
- if (hovered) {
49
- variantClassNames.push('bg-[#4269D6]')
50
- } else if (active) {
51
- variantClassNames.push('bg-[#1A41AB]')
52
- } else {
53
- variantClassNames.push('bg-blue-500')
54
- }
55
- }
56
-
57
- break
58
- case 'negative':
59
- variantClassNames.push('border-none')
60
- variantClassNames.push('text-white')
61
- variantClassNames.push('visited:text-white')
62
-
63
- if (disabled) {
64
- variantClassNames.push('bg-gray-400')
65
- } else {
66
- variantClassNames.push('hover:bg-[#DB466B]')
67
- variantClassNames.push('active:bg-[#B01F43]')
68
-
69
- if (hovered) {
70
- variantClassNames.push('bg-[#DB466B]')
71
- } else if (active) {
72
- variantClassNames.push('bg-[#B01F43]')
73
- } else {
74
- variantClassNames.push('bg-red-500')
75
- }
76
- }
77
- break
78
- case 'positive':
79
- variantClassNames.push('border-none')
80
- variantClassNames.push('text-white')
81
- variantClassNames.push('visited:text-white')
82
-
83
- if (disabled) {
84
- variantClassNames.push('bg-gray-400')
85
- } else {
86
- variantClassNames.push('hover:bg-[#27D496]')
87
- variantClassNames.push('active:bg-[#00A96C]')
88
-
89
- if (hovered) {
90
- variantClassNames.push('bg-[#27D496]')
91
- } else if (active) {
92
- variantClassNames.push('bg-[#00A96C]')
93
- } else {
94
- variantClassNames.push('bg-green-500')
95
- }
96
- }
97
- break
98
- case 'secondary':
99
- variantClassNames.push('border border-solid')
100
-
101
- if (disabled) {
102
- variantClassNames.push('text-gray-500')
103
- variantClassNames.push('border-gray-500')
104
- variantClassNames.push('bg-white')
105
- } else {
106
- variantClassNames.push('text-black')
107
-
108
- variantClassNames.push('hover:border-black')
109
- variantClassNames.push('visited:text-black')
110
-
111
- variantClassNames.push('active:bg-gray-200')
112
- variantClassNames.push('active:border-black')
113
-
114
- if (hovered) {
115
- variantClassNames.push('border-black')
116
- variantClassNames.push('bg-white')
117
- } else if (active) {
118
- variantClassNames.push('border-black')
119
- variantClassNames.push('bg-gray-200')
120
- } else {
121
- variantClassNames.push('bg-white')
122
- variantClassNames.push('border-gray-400')
123
- }
124
- }
125
-
126
- break
127
- case 'transparent':
128
- variantClassNames.push('border border-solid')
129
- if (disabled) {
130
- variantClassNames.push('text-white/[0.32]')
131
- variantClassNames.push('border-white/[0.32]')
132
- variantClassNames.push('bg-transparent')
133
- } else {
134
- variantClassNames.push('text-white')
135
- variantClassNames.push('visited:text-white')
136
- variantClassNames.push('border-solid')
137
-
138
- variantClassNames.push('hover:border-white')
139
- variantClassNames.push('active:border-white')
140
- variantClassNames.push('active:bg-white/[.16]')
141
- variantClassNames.push(
142
- 'focus-visible:shadow-[0_0_0_3px_rgba(255,255,255,0.48)]'
143
- )
144
-
145
- if (hovered) {
146
- variantClassNames.push('border-white')
147
- variantClassNames.push('bg-transparent')
148
- } else if (active) {
149
- variantClassNames.push('border-white')
150
- variantClassNames.push('bg-white/[.16]')
151
- } else {
152
- variantClassNames.push('border-white/[0.32]')
153
- variantClassNames.push('bg-transparent')
154
- }
155
-
156
- if (focused) {
157
- variantClassNames.push('shadow-[0_0_0_3px_rgba(255,255,255,0.48)]')
158
- }
159
- }
160
- break
161
- }
162
-
163
- return variantClassNames
164
- }
165
-
166
- export const createCoreClassNames = ({
167
- disabled,
168
- focused,
169
- active,
170
- }: {
171
- disabled?: boolean
172
- focused?: boolean
173
- hovered?: boolean
174
- active?: boolean
175
- }): string[] => {
176
- const classNames = ['no-underline', 'rounded-sm', 'shadow-none']
177
-
178
- if (!disabled) {
179
- classNames.push('focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)]')
180
- classNames.push('focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)]')
181
-
182
- if (focused) {
183
- classNames.push('shadow-[0_0_0_3px_rgba(32,78,207,0.48)]')
184
- }
185
-
186
- if (active) {
187
- classNames.push('shadow-none')
188
- }
189
- }
190
-
191
- return classNames
192
- }
193
-
194
- export const createIconClassNames = ({
195
- iconPosition,
196
- size,
197
- }: {
198
- iconPosition?: IconPositionType
199
- size: SizeType<'small' | 'medium' | 'large'>
200
- }): string[] => {
201
- const sizeClassNames: Record<
202
- SizeType<'small' | 'medium' | 'large'>,
203
- string[]
204
- > = {
205
- small: [iconPosition === 'left' ? 'ml-[-0.125em]' : 'mr-[-0.125em]'],
206
- medium: [iconPosition === 'left' ? 'ml-[-0.25em]' : 'mr-[-0.25em]'],
207
- large: [iconPosition === 'left' ? 'ml-[-0.5em]' : 'mr-[-0.5em]'],
208
- }
209
-
210
- return [
211
- sizeClassNames[size].join(' '),
212
- iconPosition === 'left' ? 'mr-[0.5em]' : '',
213
- iconPosition === 'right' ? 'ml-[0.5em]' : '',
214
- ]
1
+ import type { Theme } from '@material-ui/core/styles'
2
+ import { createStyles } from '@material-ui/core/styles'
3
+ import { alpha, outline, mix } from '@toptal/picasso-shared'
4
+
5
+ const ICON_SPACING = '0.5em'
6
+
7
+ export const createOutlineCommons = ({ palette }: Theme) => ({
8
+ color: palette.common.black,
9
+ backgroundColor: palette.common.white,
10
+
11
+ '&:hover, &$hovered': {
12
+ borderColor: palette.common.black,
13
+ },
14
+
15
+ // when we use <Button as={Link} />
16
+ '&&&:visited': {
17
+ color: palette.common.black,
18
+ },
19
+
20
+ '&$disabled': {
21
+ color: palette.grey.main,
22
+ borderColor: palette.grey.main,
23
+ backgroundColor: palette.common.white,
24
+ },
25
+ })
26
+
27
+ export const activeGroup = ({ palette }: Theme) => ({
28
+ backgroundColor: palette.grey.dark,
29
+ borderColor: palette.grey.dark,
30
+ color: palette.common.white,
31
+ })
32
+
33
+ export const disabledGroup = ({ palette }: Theme) => ({
34
+ color: palette.grey.main,
35
+ cursor: 'not-allowed',
36
+ pointerEvents: 'all',
37
+ })
38
+
39
+ export const createVariant = (mainColor: string, { palette }: Theme) => ({
40
+ border: 'none',
41
+ color: palette.common.white,
42
+ backgroundColor: mainColor,
43
+
44
+ '&:hover, &$hovered': {
45
+ backgroundColor: mix(mainColor, palette.common.white, 0.152),
46
+ },
47
+
48
+ '&:active, &$active': {
49
+ backgroundColor: mix(mainColor, palette.common.black, 0.172),
50
+ },
51
+
52
+ // when we use <Button as={Link} />
53
+ '&&&:visited': {
54
+ color: palette.common.white,
55
+ },
56
+ '&$disabled': {
57
+ backgroundColor: palette.grey.light2,
58
+ },
59
+ })
60
+
61
+ export default (theme: Theme) => {
62
+ const { palette, sizes, transitions, typography } = theme
63
+
64
+ return createStyles({
65
+ root: {
66
+ position: 'relative',
67
+ textTransform: 'none',
68
+ borderRadius: sizes.borderRadius.small,
69
+ border: `solid ${sizes.borderWidth} ${palette.grey.light2}`,
70
+ fontSize: '1rem',
71
+ transitionDuration: `${transitions.duration.short}ms`,
72
+ transitionTimingFunction: transitions.easing.easeOut,
73
+ transitionProperty: 'border, color, background',
74
+ boxShadow: 'none',
75
+ flexShrink: 0,
76
+
77
+ '&$focusVisible, &$focused': {
78
+ ...outline(palette.primary.main),
79
+ },
80
+
81
+ '&+&': {
82
+ marginLeft: '1rem',
83
+ },
84
+ },
85
+ content: {
86
+ lineHeight: '1.5em',
87
+ fontWeight: typography.fontWeights.semibold,
88
+ whiteSpace: 'nowrap',
89
+ },
90
+ loader: {
91
+ position: 'absolute',
92
+ left: '50%',
93
+ top: '50%',
94
+ transform: 'translate(-50%, -50%)',
95
+ },
96
+
97
+ // sizes
98
+ small: {
99
+ minWidth: '3.5em',
100
+ height: '1.5em',
101
+ padding: '0 0.75em',
102
+
103
+ '& $content': {
104
+ fontSize: typography.buttons.fontSizeSmall,
105
+ lineHeight: typography.buttons.lineHeightSmall,
106
+ },
107
+
108
+ '& $iconLeft': {
109
+ marginLeft: '-0.125em',
110
+ },
111
+
112
+ '& $iconRight': {
113
+ marginRight: '-0.125em',
114
+ },
115
+ },
116
+ medium: {
117
+ minWidth: '4em',
118
+ height: '2em',
119
+ padding: '0 1em',
120
+
121
+ '& $content': {
122
+ fontSize: typography.buttons.fontSizeMedium,
123
+ lineHeight: typography.buttons.lineHeightMedium,
124
+ },
125
+
126
+ '& $iconLeft': {
127
+ marginLeft: '-0.25em',
128
+ },
129
+
130
+ '& $iconRight': {
131
+ marginRight: '-0.25em',
132
+ },
133
+ },
134
+ large: {
135
+ minWidth: '6em',
136
+ height: '3em',
137
+ padding: '0 2em',
138
+
139
+ '& $content': {
140
+ fontSize: typography.buttons.fontSizeLarge,
141
+ lineHeight: typography.buttons.lineHeightLarge,
142
+ },
143
+
144
+ '& $iconLeft': {
145
+ marginLeft: '-0.5em',
146
+ },
147
+
148
+ '& $iconRight': {
149
+ marginRight: '-0.5em',
150
+ },
151
+ },
152
+
153
+ // variants
154
+ primary: createVariant(palette.primary.main, theme),
155
+ negative: createVariant(palette.red.main, theme),
156
+ positive: createVariant(palette.green.main, theme),
157
+
158
+ secondary: {
159
+ ...createOutlineCommons(theme),
160
+ '&:active, &$active': {
161
+ backgroundColor: palette.grey.lighter2,
162
+ borderColor: palette.common.black,
163
+ },
164
+ },
165
+
166
+ transparent: {
167
+ color: palette.common.white,
168
+ border: `solid ${sizes.borderWidth} ${alpha(palette.common.white, 0.32)}`,
169
+
170
+ // when we use <Button as={Link} />
171
+ '&&&:visited': {
172
+ color: palette.common.white,
173
+ },
174
+
175
+ '&$focusVisible, &$focused': {
176
+ ...outline(palette.common.white),
177
+ },
178
+
179
+ '&:hover, &$hovered': {
180
+ borderColor: palette.common.white,
181
+ },
182
+
183
+ '&:active, &$active': {
184
+ backgroundColor: alpha(palette.common.white, 0.16),
185
+ borderColor: palette.common.white,
186
+ },
187
+
188
+ '&$disabled': {
189
+ color: alpha(palette.common.white, 0.32),
190
+ borderColor: alpha(palette.common.white, 0.32),
191
+ backgroundColor: 'initial',
192
+ },
193
+ },
194
+
195
+ // Other props
196
+ fullWidth: {
197
+ width: '100%',
198
+ },
199
+ hovered: {},
200
+ focused: {},
201
+ active: {
202
+ boxShadow: 'none',
203
+ },
204
+ disabled: {},
205
+ focusVisible: {},
206
+
207
+ // Child elements
208
+ icon: {
209
+ fontSize: '1.2em !important',
210
+ flex: '1 1 0%', // IE11 fix
211
+ },
212
+ iconLeft: {
213
+ marginRight: ICON_SPACING,
214
+ },
215
+ iconRight: {
216
+ marginLeft: ICON_SPACING,
217
+ },
218
+ hidden: {
219
+ opacity: 0,
220
+ },
221
+ })
215
222
  }
@@ -14,7 +14,7 @@ const renderButton = (
14
14
  props: OmitInternalProps<Props>,
15
15
  picassoConfig?: PicassoConfig
16
16
  ) => {
17
- const { children, disabled, loading, onClick, titleCase, as, href } = props
17
+ const { children, disabled, loading, onClick, titleCase, as } = props
18
18
 
19
19
  return render(
20
20
  <Button
@@ -23,7 +23,6 @@ const renderButton = (
23
23
  onClick={onClick}
24
24
  titleCase={titleCase}
25
25
  as={as}
26
- href={href}
27
26
  >
28
27
  {children}
29
28
  </Button>,
@@ -120,7 +119,6 @@ describe('Button', () => {
120
119
  children: 'Click me!',
121
120
  disabled: true,
122
121
  as: Link,
123
- href: 'URL',
124
122
  })
125
123
 
126
124
  expect(container).toMatchSnapshot()
@@ -1,6 +1,8 @@
1
- import type { ReactElement, MouseEvent, ElementType, ReactNode } from 'react'
1
+ import type { ReactElement, MouseEvent, ElementType } from 'react'
2
2
  import React, { forwardRef } from 'react'
3
3
  import cx from 'classnames'
4
+ import type { Theme } from '@material-ui/core/styles'
5
+ import { makeStyles } from '@material-ui/core/styles'
4
6
  import type {
5
7
  BaseProps,
6
8
  ButtonOrAnchorProps,
@@ -9,30 +11,8 @@ import type {
9
11
  import { Loader } from '@toptal/picasso-loader'
10
12
 
11
13
  import type { IconPositionType } from '../Button'
12
- import { ButtonBase } from '../ButtonBase'
13
- import { createRootClassNames, createIconClassNames } from './styles'
14
-
15
- const getIcon = ({
16
- children,
17
- icon,
18
- iconPosition,
19
- }: {
20
- children: ReactNode
21
- icon?: ReactElement
22
- iconPosition?: IconPositionType
23
- }) => {
24
- if (!icon) {
25
- return null
26
- }
27
-
28
- const iconClassNames = createIconClassNames({
29
- iconPosition: children && iconPosition ? iconPosition : undefined,
30
- })
31
-
32
- return React.cloneElement(icon, {
33
- className: cx(iconClassNames, icon.props.className),
34
- })
35
- }
14
+ import { Button } from '../Button'
15
+ import styles from './styles'
36
16
 
37
17
  export interface Props extends BaseProps, ButtonOrAnchorProps {
38
18
  /** Show button in the active state (left mouse button down) */
@@ -57,6 +37,14 @@ export interface Props extends BaseProps, ButtonOrAnchorProps {
57
37
  value?: string | number
58
38
  }
59
39
 
40
+ // Using { index: -1 } to inject CSS link to the bottom of the head
41
+ // in order to prevent Button's styles to override ButtonAction's ones
42
+ // Related Jira issue: https://toptal-core.atlassian.net/browse/FX-1520
43
+ const useStyles = makeStyles<Theme>(styles, {
44
+ name: 'PicassoButtonAction',
45
+ index: -1,
46
+ })
47
+
60
48
  const loaderIcon = <Loader size='small' variant='inherit' />
61
49
 
62
50
  export const ButtonAction: OverridableComponent<Props> = forwardRef<
@@ -75,26 +63,50 @@ export const ButtonAction: OverridableComponent<Props> = forwardRef<
75
63
  onClick,
76
64
  ...rest
77
65
  } = props
66
+ const classes = useStyles()
67
+
68
+ const {
69
+ root: rootClass,
70
+ content,
71
+ icon: iconClassName,
72
+ iconLeft,
73
+ iconRight,
74
+ small,
75
+ } = classes
76
+
77
+ const rootClassName = cx(
78
+ {
79
+ [classes.active]: active,
80
+ [classes.focused]: focused,
81
+ [classes.hovered]: hovered,
82
+ [classes.disabled]: disabled,
83
+ [classes.loading]: loading,
84
+ [classes.iconless]: !icon,
85
+ },
86
+ rootClass
87
+ )
78
88
 
79
89
  const usedIcon = loading ? loaderIcon : icon
80
90
  const usedIconPosition = icon ? iconPosition : 'right'
81
91
 
82
- const finalClassName = cx(createRootClassNames(props), className)
83
- const finalIcon = getIcon({
84
- children: rest.children,
85
- icon: usedIcon,
86
- iconPosition: usedIconPosition,
87
- })
88
-
89
92
  return (
90
- <ButtonBase
93
+ <Button
91
94
  {...rest}
92
95
  ref={ref}
93
- icon={finalIcon}
96
+ icon={usedIcon}
94
97
  iconPosition={usedIconPosition}
95
98
  onClick={loading ? undefined : onClick}
96
- className={finalClassName}
97
- contentClassName='font-semibold text-blue-500 text-md'
99
+ variant='secondary'
100
+ classes={{
101
+ root: rootClassName,
102
+ content,
103
+ icon: iconClassName,
104
+ iconLeft,
105
+ iconRight,
106
+ small,
107
+ }}
108
+ className={className}
109
+ size='small'
98
110
  active={active}
99
111
  hovered={hovered}
100
112
  focused={focused}