@toptal/picasso-button 1.0.13 → 2.0.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.
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 +39 -47
  3. package/dist-package/src/Button/Button.js.map +1 -1
  4. package/dist-package/src/Button/styles.d.ts +19 -45
  5. package/dist-package/src/Button/styles.d.ts.map +1 -1
  6. package/dist-package/src/Button/styles.js +161 -178
  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 +20 -28
  10. package/dist-package/src/ButtonAction/ButtonAction.js.map +1 -1
  11. package/dist-package/src/ButtonAction/styles.d.ts +11 -3
  12. package/dist-package/src/ButtonAction/styles.d.ts.map +1 -1
  13. package/dist-package/src/ButtonAction/styles.js +36 -55
  14. package/dist-package/src/ButtonAction/styles.js.map +1 -1
  15. package/dist-package/src/ButtonBase/ButtonBase.d.ts +29 -0
  16. package/dist-package/src/ButtonBase/ButtonBase.d.ts.map +1 -0
  17. package/dist-package/src/ButtonBase/ButtonBase.js +82 -0
  18. package/dist-package/src/ButtonBase/ButtonBase.js.map +1 -0
  19. package/dist-package/src/ButtonBase/index.d.ts +5 -0
  20. package/dist-package/src/ButtonBase/index.d.ts.map +1 -0
  21. package/dist-package/src/ButtonBase/index.js +2 -0
  22. package/dist-package/src/ButtonBase/index.js.map +1 -0
  23. package/dist-package/src/ButtonBase/styles.d.ts +6 -0
  24. package/dist-package/src/ButtonBase/styles.d.ts.map +1 -0
  25. package/dist-package/src/ButtonBase/styles.js +29 -0
  26. package/dist-package/src/ButtonBase/styles.js.map +1 -0
  27. package/dist-package/src/ButtonCircular/ButtonCircular.d.ts.map +1 -1
  28. package/dist-package/src/ButtonCircular/ButtonCircular.js +12 -26
  29. package/dist-package/src/ButtonCircular/ButtonCircular.js.map +1 -1
  30. package/dist-package/src/ButtonCircular/styles.d.ts +15 -3
  31. package/dist-package/src/ButtonCircular/styles.d.ts.map +1 -1
  32. package/dist-package/src/ButtonCircular/styles.js +92 -57
  33. package/dist-package/src/ButtonCircular/styles.js.map +1 -1
  34. package/dist-package/src/ButtonCompound/index.d.ts +1 -1
  35. package/dist-package/src/ButtonControlLabel/ButtonControlLabel.d.ts.map +1 -1
  36. package/dist-package/src/ButtonControlLabel/ButtonControlLabel.js +4 -13
  37. package/dist-package/src/ButtonControlLabel/ButtonControlLabel.js.map +1 -1
  38. package/dist-package/src/ButtonControlLabel/styles.d.ts +2 -2
  39. package/dist-package/src/ButtonControlLabel/styles.d.ts.map +1 -1
  40. package/dist-package/src/ButtonControlLabel/styles.js +16 -25
  41. package/dist-package/src/ButtonControlLabel/styles.js.map +1 -1
  42. package/dist-package/src/ButtonGroup/ButtonGroup.d.ts +1 -1
  43. package/dist-package/src/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  44. package/dist-package/src/ButtonGroup/ButtonGroup.js +5 -27
  45. package/dist-package/src/ButtonGroup/ButtonGroup.js.map +1 -1
  46. package/dist-package/src/ButtonGroup/styles.d.ts +1 -2
  47. package/dist-package/src/ButtonGroup/styles.d.ts.map +1 -1
  48. package/dist-package/src/ButtonGroup/styles.js +20 -47
  49. package/dist-package/src/ButtonGroup/styles.js.map +1 -1
  50. package/dist-package/src/ButtonGroupItem/ButtonGroupItem.d.ts +1 -1
  51. package/dist-package/src/ButtonGroupItem/ButtonGroupItem.d.ts.map +1 -1
  52. package/dist-package/src/ButtonGroupItem/ButtonGroupItem.js +17 -12
  53. package/dist-package/src/ButtonGroupItem/ButtonGroupItem.js.map +1 -1
  54. package/dist-package/src/ButtonGroupItem/styles.d.ts +13 -3
  55. package/dist-package/src/ButtonGroupItem/styles.d.ts.map +1 -1
  56. package/dist-package/src/ButtonGroupItem/styles.js +39 -17
  57. package/dist-package/src/ButtonGroupItem/styles.js.map +1 -1
  58. package/dist-package/src/ButtonSplit/ButtonSplit.d.ts.map +1 -1
  59. package/dist-package/src/ButtonSplit/ButtonSplit.js +28 -24
  60. package/dist-package/src/ButtonSplit/ButtonSplit.js.map +1 -1
  61. package/dist-package/src/ButtonSplit/styles.d.ts +9 -3
  62. package/dist-package/src/ButtonSplit/styles.d.ts.map +1 -1
  63. package/dist-package/src/ButtonSplit/styles.js +13 -50
  64. package/dist-package/src/ButtonSplit/styles.js.map +1 -1
  65. package/package.json +17 -13
  66. package/src/Button/Button.tsx +69 -100
  67. package/src/Button/__snapshots__/test.tsx.snap +8 -4
  68. package/src/Button/styles.ts +214 -221
  69. package/src/Button/test.tsx +3 -1
  70. package/src/ButtonAction/ButtonAction.tsx +36 -48
  71. package/src/ButtonAction/styles.ts +57 -57
  72. package/src/ButtonBase/ButtonBase.tsx +186 -0
  73. package/src/ButtonBase/__snapshots__/test.tsx.snap +286 -0
  74. package/src/ButtonBase/index.ts +5 -0
  75. package/src/ButtonBase/styles.ts +36 -0
  76. package/src/ButtonBase/test.tsx +230 -0
  77. package/src/ButtonCheckbox/__snapshots__/test.tsx.snap +4 -3
  78. package/src/ButtonCircular/ButtonCircular.tsx +22 -37
  79. package/src/ButtonCircular/styles.ts +127 -75
  80. package/src/ButtonControlLabel/ButtonControlLabel.tsx +7 -16
  81. package/src/ButtonControlLabel/styles.ts +30 -26
  82. package/src/ButtonGroup/ButtonGroup.tsx +9 -44
  83. package/src/ButtonGroup/__snapshots__/test.tsx.snap +13 -7
  84. package/src/ButtonGroup/styles.ts +21 -63
  85. package/src/ButtonGroupItem/ButtonGroupItem.tsx +24 -15
  86. package/src/ButtonGroupItem/styles.ts +62 -28
  87. package/src/ButtonRadio/__snapshots__/test.tsx.snap +4 -3
  88. package/src/ButtonSplit/ButtonSplit.tsx +46 -42
  89. package/src/ButtonSplit/__snapshots__/test.tsx.snap +13 -9
  90. package/src/ButtonSplit/styles.ts +37 -56
@@ -1,222 +1,215 @@
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
- })
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
+ ]
222
215
  }
@@ -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 } = props
17
+ const { children, disabled, loading, onClick, titleCase, as, href } = props
18
18
 
19
19
  return render(
20
20
  <Button
@@ -23,6 +23,7 @@ const renderButton = (
23
23
  onClick={onClick}
24
24
  titleCase={titleCase}
25
25
  as={as}
26
+ href={href}
26
27
  >
27
28
  {children}
28
29
  </Button>,
@@ -119,6 +120,7 @@ describe('Button', () => {
119
120
  children: 'Click me!',
120
121
  disabled: true,
121
122
  as: Link,
123
+ href: 'URL',
122
124
  })
123
125
 
124
126
  expect(container).toMatchSnapshot()
@@ -1,8 +1,6 @@
1
- import type { ReactElement, MouseEvent, ElementType } from 'react'
1
+ import type { ReactElement, MouseEvent, ElementType, ReactNode } 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'
6
4
  import type {
7
5
  BaseProps,
8
6
  ButtonOrAnchorProps,
@@ -11,8 +9,30 @@ import type {
11
9
  import { Loader } from '@toptal/picasso-loader'
12
10
 
13
11
  import type { IconPositionType } from '../Button'
14
- import { Button } from '../Button'
15
- import styles from './styles'
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
+ }
16
36
 
17
37
  export interface Props extends BaseProps, ButtonOrAnchorProps {
18
38
  /** Show button in the active state (left mouse button down) */
@@ -37,14 +57,6 @@ export interface Props extends BaseProps, ButtonOrAnchorProps {
37
57
  value?: string | number
38
58
  }
39
59
 
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
-
48
60
  const loaderIcon = <Loader size='small' variant='inherit' />
49
61
 
50
62
  export const ButtonAction: OverridableComponent<Props> = forwardRef<
@@ -63,50 +75,26 @@ export const ButtonAction: OverridableComponent<Props> = forwardRef<
63
75
  onClick,
64
76
  ...rest
65
77
  } = 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
- )
88
78
 
89
79
  const usedIcon = loading ? loaderIcon : icon
90
80
  const usedIconPosition = icon ? iconPosition : 'right'
91
81
 
82
+ const finalClassName = cx(createRootClassNames(props), className)
83
+ const finalIcon = getIcon({
84
+ children: rest.children,
85
+ icon: usedIcon,
86
+ iconPosition: usedIconPosition,
87
+ })
88
+
92
89
  return (
93
- <Button
90
+ <ButtonBase
94
91
  {...rest}
95
92
  ref={ref}
96
- icon={usedIcon}
93
+ icon={finalIcon}
97
94
  iconPosition={usedIconPosition}
98
95
  onClick={loading ? undefined : onClick}
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'
96
+ className={finalClassName}
97
+ contentClassName='font-semibold text-blue-500 text-md'
110
98
  active={active}
111
99
  hovered={hovered}
112
100
  focused={focused}