@toptal/picasso-button 4.0.6-alpha-fx-null-button-overridable-a6bdbbaa2.0 → 4.0.7

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 (49) hide show
  1. package/dist-package/src/Button/Button.d.ts +2 -3
  2. package/dist-package/src/Button/Button.d.ts.map +1 -1
  3. package/dist-package/src/Button/Button.js.map +1 -1
  4. package/dist-package/src/ButtonAction/ButtonAction.d.ts +2 -3
  5. package/dist-package/src/ButtonAction/ButtonAction.d.ts.map +1 -1
  6. package/dist-package/src/ButtonAction/ButtonAction.js.map +1 -1
  7. package/dist-package/src/ButtonBase/ButtonBase.d.ts +3 -4
  8. package/dist-package/src/ButtonBase/ButtonBase.d.ts.map +1 -1
  9. package/dist-package/src/ButtonBase/ButtonBase.js.map +1 -1
  10. package/dist-package/src/ButtonBase/styles.js +1 -1
  11. package/dist-package/src/ButtonBase/styles.js.map +1 -1
  12. package/dist-package/src/ButtonCircular/ButtonCircular.d.ts +2 -3
  13. package/dist-package/src/ButtonCircular/ButtonCircular.d.ts.map +1 -1
  14. package/dist-package/src/ButtonCircular/ButtonCircular.js.map +1 -1
  15. package/dist-package/src/ButtonCompound/index.d.ts +10 -16
  16. package/dist-package/src/ButtonCompound/index.d.ts.map +1 -1
  17. package/dist-package/src/ButtonCompound/index.js.map +1 -1
  18. package/dist-package/src/ButtonControlLabel/ButtonControlLabel.d.ts.map +1 -1
  19. package/dist-package/src/ButtonControlLabel/ButtonControlLabel.js +3 -10
  20. package/dist-package/src/ButtonControlLabel/ButtonControlLabel.js.map +1 -1
  21. package/dist-package/src/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  22. package/dist-package/src/ButtonGroup/ButtonGroup.js +1 -1
  23. package/dist-package/src/ButtonGroup/ButtonGroup.js.map +1 -1
  24. package/dist-package/src/ButtonGroup/styles.d.ts.map +1 -1
  25. package/dist-package/src/ButtonGroup/styles.js +2 -0
  26. package/dist-package/src/ButtonGroup/styles.js.map +1 -1
  27. package/dist-package/src/ButtonSplit/ButtonSplit.js +1 -1
  28. package/dist-package/src/ButtonSplit/ButtonSplit.js.map +1 -1
  29. package/package.json +17 -18
  30. package/src/Button/Button.tsx +5 -4
  31. package/src/Button/__snapshots__/test.tsx.snap +2 -2
  32. package/src/ButtonAction/ButtonAction.tsx +45 -40
  33. package/src/ButtonBase/ButtonBase.tsx +78 -79
  34. package/src/ButtonBase/__snapshots__/test.tsx.snap +11 -11
  35. package/src/ButtonBase/styles.ts +1 -1
  36. package/src/ButtonCheckbox/__snapshots__/test.tsx.snap +1 -1
  37. package/src/ButtonCircular/ButtonCircular.tsx +47 -42
  38. package/src/ButtonCompound/index.ts +1 -10
  39. package/src/ButtonControlLabel/ButtonControlLabel.tsx +16 -26
  40. package/src/ButtonGroup/ButtonGroup.tsx +7 -1
  41. package/src/ButtonGroup/__snapshots__/test.tsx.snap +5 -4
  42. package/src/ButtonGroup/styles.ts +2 -0
  43. package/src/ButtonRadio/__snapshots__/test.tsx.snap +1 -1
  44. package/src/ButtonSplit/ButtonSplit.tsx +1 -1
  45. package/src/ButtonSplit/__snapshots__/test.tsx.snap +5 -4
  46. package/src/ButtonSplit/story/Sizes.example.tsx +1 -2
  47. package/src/ButtonSplit/story/States.example.tsx +1 -9
  48. package/src/ButtonSplit/story/Variants.example.tsx +1 -2
  49. package/LICENSE +0 -20
@@ -5,6 +5,7 @@ import { twMerge } from '@toptal/picasso-tailwind-merge'
5
5
  import type {
6
6
  StandardProps,
7
7
  ButtonOrAnchorProps,
8
+ OverridableComponent,
8
9
  TextLabelProps,
9
10
  } from '@toptal/picasso-shared'
10
11
  import { useTitleCase } from '@toptal/picasso-shared'
@@ -30,7 +31,7 @@ export interface Props
30
31
  /** ClassName for the content */
31
32
  contentClassName?: string
32
33
  /** Add an `<Icon />` along Button's children */
33
- icon?: ReactElement | null
34
+ icon?: ReactElement
34
35
  /** Icon can be positioned on the left or right */
35
36
  iconPosition?: IconPositionType
36
37
  /** Shows a loading indicator and disables click events */
@@ -68,88 +69,86 @@ const RootElement = forwardRef(
68
69
  }
69
70
  )
70
71
 
71
- export const ButtonBase = forwardRef<HTMLButtonElement, Props>(
72
- function ButtonBase(props, ref) {
73
- const {
74
- icon,
75
- iconPosition,
76
- loading,
77
- children,
78
- className,
79
- contentClassName,
80
- style,
81
- disabled,
82
- onClick,
83
- title,
84
- value,
85
- type,
86
- as = 'button',
87
- titleCase: propsTitleCase,
88
- ...rest
89
- } = props
90
-
91
- const titleCase = useTitleCase(propsTitleCase)
92
- const finalChildren = [titleCase ? toTitleCase(children) : children]
93
- const finalRootElementName = typeof as === 'string' ? as : 'a'
94
-
95
- if (icon) {
96
- const iconComponent = getIcon({ icon })
97
-
98
- if (iconPosition === 'left') {
99
- finalChildren.unshift(iconComponent)
100
- } else {
101
- finalChildren.push(iconComponent)
102
- }
72
+ export const ButtonBase: OverridableComponent<Props> = forwardRef<
73
+ HTMLButtonElement,
74
+ Props
75
+ >(function ButtonBase(props, ref) {
76
+ const {
77
+ icon,
78
+ iconPosition,
79
+ loading,
80
+ children,
81
+ className,
82
+ contentClassName,
83
+ style,
84
+ disabled,
85
+ onClick,
86
+ title,
87
+ value,
88
+ type,
89
+ as = 'button',
90
+ titleCase: propsTitleCase,
91
+ ...rest
92
+ } = props
93
+
94
+ const titleCase = useTitleCase(propsTitleCase)
95
+ const finalChildren = [titleCase ? toTitleCase(children) : children]
96
+ const finalRootElementName = typeof as === 'string' ? as : 'a'
97
+
98
+ if (icon) {
99
+ const iconComponent = getIcon({ icon })
100
+
101
+ if (iconPosition === 'left') {
102
+ finalChildren.unshift(iconComponent)
103
+ } else {
104
+ finalChildren.push(iconComponent)
103
105
  }
106
+ }
104
107
 
105
- const finalClassName = twMerge(
106
- createCoreClassNames({ disabled }),
107
- className
108
- )
109
-
110
- return (
111
- <MUIButtonBase
112
- {...rest}
113
- ref={ref}
114
- onClick={getClickHandler(loading, onClick)}
115
- className={finalClassName}
116
- style={style}
117
- aria-disabled={disabled}
118
- disabled={disabled}
119
- title={title}
120
- value={value}
121
- type={type}
122
- data-component-type='button'
123
- tabIndex={rest.tabIndex ?? disabled ? -1 : 0}
124
- role={rest.role ?? 'button'}
125
- rootElementName={finalRootElementName as keyof HTMLElementTagNameMap}
126
- slots={{ root: RootElement }}
127
- // @ts-ignore
128
- slotProps={{ root: { as } }}
108
+ const finalClassName = twMerge(createCoreClassNames({ disabled }), className)
109
+
110
+ return (
111
+ <MUIButtonBase
112
+ {...rest}
113
+ ref={ref}
114
+ onClick={getClickHandler(loading, onClick)}
115
+ className={finalClassName}
116
+ style={style}
117
+ aria-disabled={disabled}
118
+ disabled={disabled}
119
+ title={title}
120
+ value={value}
121
+ type={type}
122
+ data-component-type='button'
123
+ tabIndex={rest.tabIndex ?? disabled ? -1 : 0}
124
+ role={rest.role ?? 'button'}
125
+ rootElementName={finalRootElementName as keyof HTMLElementTagNameMap}
126
+ slots={{ root: RootElement }}
127
+ // @ts-ignore
128
+ slotProps={{ root: { as } }}
129
+ >
130
+ <Container
131
+ as='span'
132
+ inline
133
+ flex
134
+ direction='row'
135
+ alignItems='center'
136
+ className={contentClassName}
129
137
  >
130
- <Container
131
- as='span'
138
+ {finalChildren}
139
+ </Container>
140
+
141
+ {loading && (
142
+ <Loader
143
+ variant='inherit'
144
+ className='absolute top-1/2 left-1/2 translate-x-[-50%] translate-y-[-50%]'
132
145
  inline
133
- flex
134
- direction='row'
135
- alignItems='center'
136
- className={contentClassName}
137
- >
138
- {finalChildren}
139
- </Container>
140
-
141
- {loading && (
142
- <Loader
143
- variant='inherit'
144
- className='absolute top-1/2 left-1/2 translate-x-[-50%] translate-y-[-50%]'
145
- inline
146
- size='small'
147
- />
148
- )}
149
- </MUIButtonBase>
150
- )
151
- }
152
- )
146
+ size='small'
147
+ />
148
+ )}
149
+ </MUIButtonBase>
150
+ )
151
+ })
153
152
 
154
153
  ButtonBase.defaultProps = {
155
154
  as: 'button',
@@ -7,7 +7,7 @@ exports[`ButtonBase when "as" prop is passed when "as" prop does not equal "butt
7
7
  >
8
8
  <span
9
9
  aria-disabled="false"
10
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer"
10
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer"
11
11
  data-component-type="button"
12
12
  href="/"
13
13
  role="button"
@@ -31,7 +31,7 @@ exports[`ButtonBase when "as" prop is passed when "as" prop does not equal "butt
31
31
  >
32
32
  <span
33
33
  aria-disabled="false"
34
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer"
34
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer"
35
35
  data-component-type="button"
36
36
  role="button"
37
37
  tabindex="0"
@@ -55,7 +55,7 @@ exports[`ButtonBase when "as" prop is passed when "as" prop equals "Link" compon
55
55
  >
56
56
  <a
57
57
  aria-disabled="false"
58
- class="font-inherit focus:outline-none hover:underline text-blue visited:text-purple no-underline base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer"
58
+ class="font-inherit focus:outline-none hover:underline text-blue visited:text-purple no-underline base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer"
59
59
  data-component-type="button"
60
60
  href="URL"
61
61
  role="button"
@@ -79,7 +79,7 @@ exports[`ButtonBase when "as" prop is passed when "as" prop equals "Link" compon
79
79
  >
80
80
  <a
81
81
  aria-disabled="true"
82
- class="font-inherit focus:outline-none hover:underline text-blue visited:text-purple no-underline base-Button base- text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-default pointer-events"
82
+ class="font-inherit focus:outline-none hover:underline text-blue visited:text-purple no-underline base-Button base- text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-default pointer-events"
83
83
  data-component-type="button"
84
84
  href="URL"
85
85
  role="button"
@@ -103,7 +103,7 @@ exports[`ButtonBase when "as" prop is passed when "as" prop equals "Link" compon
103
103
  >
104
104
  <a
105
105
  aria-disabled="false"
106
- class="font-inherit focus:outline-none hover:underline text-blue visited:text-purple no-underline base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer"
106
+ class="font-inherit focus:outline-none hover:underline text-blue visited:text-purple no-underline base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer"
107
107
  data-component-type="button"
108
108
  href=""
109
109
  role="button"
@@ -127,7 +127,7 @@ exports[`ButtonBase when "as" prop is passed when "as" prop equals "a" renders B
127
127
  >
128
128
  <a
129
129
  aria-disabled="false"
130
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer"
130
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer"
131
131
  data-component-type="button"
132
132
  href="/"
133
133
  role="button"
@@ -151,7 +151,7 @@ exports[`ButtonBase when "disabled" prop is false renders Button and does not tr
151
151
  >
152
152
  <button
153
153
  aria-disabled="false"
154
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer"
154
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer"
155
155
  data-component-type="button"
156
156
  role="button"
157
157
  tabindex="0"
@@ -174,7 +174,7 @@ exports[`ButtonBase when "disabled" prop is true renders Button and does not tri
174
174
  >
175
175
  <button
176
176
  aria-disabled="true"
177
- class="base-Button base- text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-default pointer-events"
177
+ class="base-Button base- text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-default pointer-events"
178
178
  data-component-type="button"
179
179
  disabled=""
180
180
  role="button"
@@ -198,7 +198,7 @@ exports[`ButtonBase when "loading" prop is true renders Button with loading stat
198
198
  >
199
199
  <button
200
200
  aria-disabled="false"
201
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer"
201
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer"
202
202
  data-component-type="button"
203
203
  role="button"
204
204
  tabindex="0"
@@ -248,7 +248,7 @@ exports[`ButtonBase when "role" prop is passed renders Button with a custom role
248
248
  >
249
249
  <button
250
250
  aria-disabled="false"
251
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer"
251
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer"
252
252
  data-component-type="button"
253
253
  role="custom"
254
254
  tabindex="0"
@@ -271,7 +271,7 @@ exports[`ButtonBase when "titleCase" prop is true renders Button with transforme
271
271
  >
272
272
  <button
273
273
  aria-disabled="false"
274
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer"
274
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer"
275
275
  data-component-type="button"
276
276
  role="button"
277
277
  tabindex="0"
@@ -22,7 +22,7 @@ export const createCoreClassNames = ({
22
22
  'ease-out',
23
23
  'shrink-0',
24
24
  'outline-none',
25
- '[&+&]:ml-4',
25
+ '[[data-component-type="button"]+&]:ml-4',
26
26
  ]
27
27
 
28
28
  if (!disabled && !loading) {
@@ -7,7 +7,7 @@ exports[`ButtonCheckbox renders 1`] = `
7
7
  >
8
8
  <label
9
9
  aria-disabled="false"
10
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border border-solid text-black hover:border-black visited:text-black active:bg-gray active:border-black bg-white border-gray min-w h-8 px-4 text-center py-2 pr-6 pl-4"
10
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border border-solid text-black hover:border-black visited:text-black active:bg-gray active:border-black bg-white border-gray min-w h-8 px-4 text-center py-2 pr-6 pl-4"
11
11
  data-component-type="button"
12
12
  role="button"
13
13
  tabindex="0"
@@ -1,7 +1,11 @@
1
1
  import type { ReactElement, MouseEvent, ElementType } from 'react'
2
2
  import React, { forwardRef } from 'react'
3
3
  import cx from 'classnames'
4
- import type { BaseProps, ButtonOrAnchorProps } from '@toptal/picasso-shared'
4
+ import type {
5
+ BaseProps,
6
+ ButtonOrAnchorProps,
7
+ OverridableComponent,
8
+ } from '@toptal/picasso-shared'
5
9
 
6
10
  import { ButtonBase } from '../ButtonBase'
7
11
  import { createRootClassNames, createVariantClassNames } from './styles'
@@ -33,50 +37,51 @@ export interface Props extends BaseProps, ButtonOrAnchorProps {
33
37
  responsive?: boolean
34
38
  }
35
39
 
36
- export const ButtonCircular = forwardRef<HTMLButtonElement, Props>(
37
- function ButtonCircular(props, ref) {
38
- const {
39
- className,
40
- variant = 'primary',
41
- active,
42
- focused,
43
- hovered,
44
- disabled,
45
- responsive,
46
- loading,
47
- ...rest
48
- } = props
49
- const variantClassNames = createVariantClassNames(variant, {
50
- disabled,
51
- focused,
52
- hovered,
53
- active,
54
- })
40
+ export const ButtonCircular: OverridableComponent<Props> = forwardRef<
41
+ HTMLButtonElement,
42
+ Props
43
+ >(function ButtonCircular(props, ref) {
44
+ const {
45
+ className,
46
+ variant = 'primary',
47
+ active,
48
+ focused,
49
+ hovered,
50
+ disabled,
51
+ responsive,
52
+ loading,
53
+ ...rest
54
+ } = props
55
+ const variantClassNames = createVariantClassNames(variant, {
56
+ disabled,
57
+ focused,
58
+ hovered,
59
+ active,
60
+ })
55
61
 
56
- const finalClassName = cx(
57
- createRootClassNames({ responsive, active, disabled, focused, hovered }),
58
- variantClassNames,
59
- className
60
- )
62
+ const finalClassName = cx(
63
+ createRootClassNames({ responsive, active, disabled, focused, hovered }),
64
+ variantClassNames,
65
+ className
66
+ )
61
67
 
62
- const contentClassName = cx(
63
- 'font-semibold whitespace-nowrap',
64
- 'text-button-small',
65
- loading ? 'opacity-0' : ''
66
- )
68
+ const contentClassName = cx(
69
+ 'font-semibold whitespace-nowrap',
70
+ 'text-button-small',
71
+ loading ? 'opacity-0' : ''
72
+ )
67
73
 
68
- return (
69
- <ButtonBase
70
- {...rest}
71
- ref={ref}
72
- loading={loading}
73
- className={finalClassName}
74
- contentClassName={contentClassName}
75
- disabled={disabled}
76
- />
77
- )
78
- }
79
- )
74
+ return (
75
+ <ButtonBase
76
+ {...rest}
77
+ ref={ref}
78
+ loading={loading}
79
+ className={finalClassName}
80
+ contentClassName={contentClassName}
81
+ disabled={disabled}
82
+ />
83
+ )
84
+ })
80
85
 
81
86
  ButtonCircular.defaultProps = {
82
87
  variant: 'primary',
@@ -6,16 +6,7 @@ import { ButtonSplit } from '../ButtonSplit'
6
6
  import { ButtonCheckbox } from '../ButtonCheckbox'
7
7
  import { ButtonRadio } from '../ButtonRadio'
8
8
 
9
- type ButtonCompoundType = typeof Button & {
10
- Group: typeof ButtonGroup
11
- Circular: typeof ButtonCircular
12
- Action: typeof ButtonAction
13
- Split: typeof ButtonSplit
14
- Checkbox: typeof ButtonCheckbox
15
- Radio: typeof ButtonRadio
16
- }
17
-
18
- export const ButtonCompound: ButtonCompoundType = Object.assign(Button, {
9
+ export const ButtonCompound = Object.assign(Button, {
19
10
  Group: ButtonGroup,
20
11
  Circular: ButtonCircular,
21
12
  Action: ButtonAction,
@@ -50,33 +50,23 @@ const ButtonControlLabel = ({
50
50
  const contentLeftSpacing = size === 'large' ? 1 : 0.5
51
51
 
52
52
  return (
53
- <label htmlFor={id} aria-disabled={disabled}>
54
- <Button
55
- {...props}
56
- className={twMerge(
57
- 'text-center',
58
- createSizeClassNames(size),
59
- className
60
- )}
61
- variant='secondary'
62
- size={size}
63
- disabled={disabled}
53
+ <Button
54
+ {...props}
55
+ className={twMerge('text-center', createSizeClassNames(size), className)}
56
+ variant='secondary'
57
+ size={size}
58
+ as='label'
59
+ htmlFor={id}
60
+ disabled={disabled}
61
+ >
62
+ {React.cloneElement(control, { id, checked, value, onChange, disabled })}
63
+ <Container
64
+ className={createContentSizeClassNames(size)}
65
+ left={contentLeftSpacing}
64
66
  >
65
- {React.cloneElement(control, {
66
- id,
67
- checked,
68
- value,
69
- onChange,
70
- disabled,
71
- })}
72
- <Container
73
- className={createContentSizeClassNames(size)}
74
- left={contentLeftSpacing}
75
- >
76
- {children}
77
- </Container>
78
- </Button>
79
- </label>
67
+ {children}
68
+ </Container>
69
+ </Button>
80
70
  )
81
71
  }
82
72
 
@@ -18,7 +18,13 @@ export const ButtonGroup = forwardRef<HTMLDivElement, Props>(
18
18
  const finalClassName = twMerge(createRootClassNames(), className)
19
19
 
20
20
  return (
21
- <div {...rest} ref={ref} className={finalClassName} style={style}>
21
+ <div
22
+ {...rest}
23
+ ref={ref}
24
+ data-component-type='button'
25
+ className={finalClassName}
26
+ style={style}
27
+ >
22
28
  {children}
23
29
  </div>
24
30
  )
@@ -6,11 +6,12 @@ exports[`ButtonGroup render 1`] = `
6
6
  class="Picasso-root"
7
7
  >
8
8
  <div
9
- class="flex justify-start [&>[data-component-type="button"]:hover]:z [&>[data-component-type="button"]:first-child:not(:last-child)]:rounded-r [&>[data-component-type="button"]:first-child:not(:last-child)]:ml [&>[data-component-type="button"]:not(:first-child):not(:last-child)]:rounded [&>[data-component-type="button"]:not(:first-child):not(:last-child)]:ml-[ [&>[data-component-type="button"]:last-child:not(:first-child)]:rounded-l [&>[data-component-type="button"]:last-child:not(:first-child)]:ml-[ [&_:first-child:not(:last-child)_[data-component-type="button"]]:rounded-r [&_:first-child:not(:last-child)_[data-component-type="button"]]:ml [&_:not(:first-child):not(:last-child)_[data-component-type="button"]]:rounded [&_:not(:first-child):not(:last-child)_[data-component-type="button"]]:ml-[ [&_:last-child:not(:first-child)_[data-component-type="button"]]:rounded-l [&_:last-child:not(:first-child)_[data-component-type="button"]]:ml-["
9
+ class="flex justify-start items-start [[data-component-type="button"]+&]:ml [&>[data-component-type="button"]:hover]:z [&>[data-component-type="button"]:first-child:not(:last-child)]:rounded-r [&>[data-component-type="button"]:first-child:not(:last-child)]:ml [&>[data-component-type="button"]:not(:first-child):not(:last-child)]:rounded [&>[data-component-type="button"]:not(:first-child):not(:last-child)]:ml-[ [&>[data-component-type="button"]:last-child:not(:first-child)]:rounded-l [&>[data-component-type="button"]:last-child:not(:first-child)]:ml-[ [&_:first-child:not(:last-child)_[data-component-type="button"]]:rounded-r [&_:first-child:not(:last-child)_[data-component-type="button"]]:ml [&_:not(:first-child):not(:last-child)_[data-component-type="button"]]:rounded [&_:not(:first-child):not(:last-child)_[data-component-type="button"]]:ml-[ [&_:last-child:not(:first-child)_[data-component-type="button"]]:rounded-l [&_:last-child:not(:first-child)_[data-component-type="button"]]:ml-["
10
+ data-component-type="button"
10
11
  >
11
12
  <button
12
13
  aria-disabled="false"
13
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border bg-white min-w h-8 py-0 px-4 transition-[color,background] active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] visited:text-black border-solid active:bg-graphite active:border-graphite active:text-white hover:border-black border-gray text-black"
14
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border bg-white min-w h-8 py-0 px-4 transition-[color,background] active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] visited:text-black border-solid active:bg-graphite active:border-graphite active:text-white hover:border-black border-gray text-black"
14
15
  data-component-type="button"
15
16
  role="button"
16
17
  tabindex="0"
@@ -24,7 +25,7 @@ exports[`ButtonGroup render 1`] = `
24
25
  </button>
25
26
  <button
26
27
  aria-disabled="false"
27
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border min-w h-8 py-0 px-4 transition-[color,background] active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] z-[1] visited:text-black border-solid active:bg-graphite active:border-graphite active:text-white hover:border-black bg-graphite border-graphite text-white shadow-none"
28
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border min-w h-8 py-0 px-4 transition-[color,background] active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] z-[1] visited:text-black border-solid active:bg-graphite active:border-graphite active:text-white hover:border-black bg-graphite border-graphite text-white shadow-none"
28
29
  data-component-type="button"
29
30
  role="button"
30
31
  tabindex="0"
@@ -38,7 +39,7 @@ exports[`ButtonGroup render 1`] = `
38
39
  </button>
39
40
  <button
40
41
  aria-disabled="false"
41
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border bg-white min-w h-8 py-0 px-4 transition-[color,background] active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] visited:text-black border-solid active:bg-graphite active:border-graphite active:text-white hover:border-black border-gray text-black"
42
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border bg-white min-w h-8 py-0 px-4 transition-[color,background] active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] visited:text-black border-solid active:bg-graphite active:border-graphite active:text-white hover:border-black border-gray text-black"
42
43
  data-component-type="button"
43
44
  role="button"
44
45
  tabindex="0"
@@ -2,6 +2,8 @@ export const createRootClassNames = () => {
2
2
  const classNames: string[] = [
3
3
  'flex',
4
4
  'justify-start',
5
+ 'items-start',
6
+ '[[data-component-type="button"]+&]:ml-4',
5
7
 
6
8
  '[&>[data-component-type="button"]:hover]:z-[1]',
7
9
 
@@ -7,7 +7,7 @@ exports[`ButtonRadio renders 1`] = `
7
7
  >
8
8
  <label
9
9
  aria-disabled="false"
10
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border border-solid text-black hover:border-black visited:text-black active:bg-gray active:border-black bg-white border-gray min-w h-8 px-4 text-center py-2 pr-6 pl-4"
10
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border border-solid text-black hover:border-black visited:text-black active:bg-gray active:border-black bg-white border-gray min-w h-8 px-4 text-center py-2 pr-6 pl-4"
11
11
  data-component-type="button"
12
12
  role="button"
13
13
  tabindex="0"
@@ -131,7 +131,7 @@ export const ButtonSplit = forwardRef<HTMLDivElement, Props>(
131
131
  )
132
132
 
133
133
  const dropdownClassName = twMerge(
134
- 'block cursor-pointer',
134
+ 'inline-flex cursor-pointer',
135
135
  disabled && '[&>div]:cursor-auto'
136
136
  )
137
137
 
@@ -18,11 +18,12 @@ exports[`ButtonSplit default render 1`] = `
18
18
  class="Picasso-root"
19
19
  >
20
20
  <div
21
- class="flex justify-start [&>[data-component-type="button"]:hover]:z [&>[data-component-type="button"]:first-child:not(:last-child)]:rounded-r [&>[data-component-type="button"]:first-child:not(:last-child)]:ml [&>[data-component-type="button"]:not(:first-child):not(:last-child)]:rounded [&>[data-component-type="button"]:not(:first-child):not(:last-child)]:ml-[ [&>[data-component-type="button"]:last-child:not(:first-child)]:rounded-l [&>[data-component-type="button"]:last-child:not(:first-child)]:ml-[ [&_:first-child:not(:last-child)_[data-component-type="button"]]:rounded-r [&_:first-child:not(:last-child)_[data-component-type="button"]]:ml [&_:not(:first-child):not(:last-child)_[data-component-type="button"]]:rounded [&_:not(:first-child):not(:last-child)_[data-component-type="button"]]:ml-[ [&_:last-child:not(:first-child)_[data-component-type="button"]]:rounded-l [&_:last-child:not(:first-child)_[data-component-type="button"]]:ml-["
21
+ class="flex justify-start items-start [[data-component-type="button"]+&]:ml [&>[data-component-type="button"]:hover]:z [&>[data-component-type="button"]:first-child:not(:last-child)]:rounded-r [&>[data-component-type="button"]:first-child:not(:last-child)]:ml [&>[data-component-type="button"]:not(:first-child):not(:last-child)]:rounded [&>[data-component-type="button"]:not(:first-child):not(:last-child)]:ml-[ [&>[data-component-type="button"]:last-child:not(:first-child)]:rounded-l [&>[data-component-type="button"]:last-child:not(:first-child)]:ml-[ [&_:first-child:not(:last-child)_[data-component-type="button"]]:rounded-r [&_:first-child:not(:last-child)_[data-component-type="button"]]:ml [&_:not(:first-child):not(:last-child)_[data-component-type="button"]]:rounded [&_:not(:first-child):not(:last-child)_[data-component-type="button"]]:ml-[ [&_:last-child:not(:first-child)_[data-component-type="button"]]:rounded-l [&_:last-child:not(:first-child)_[data-component-type="button"]]:ml-["
22
+ data-component-type="button"
22
23
  >
23
24
  <button
24
25
  aria-disabled="false"
25
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue min-w h-8 py-0 px-4 active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] transition-[color,background] border-r border-l border-y border-solid border-blue"
26
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue min-w h-8 py-0 px-4 active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] transition-[color,background] border-r border-l border-y border-solid border-blue"
26
27
  data-component-type="button"
27
28
  role="button"
28
29
  tabindex="0"
@@ -35,14 +36,14 @@ exports[`ButtonSplit default render 1`] = `
35
36
  </span>
36
37
  </button>
37
38
  <div
38
- class="items-center block cursor-pointer"
39
+ class="items-center inline-flex cursor-pointer"
39
40
  >
40
41
  <div
41
42
  class="inline-flex items-center cursor-pointer"
42
43
  >
43
44
  <button
44
45
  aria-disabled="false"
45
- class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [&+&]:ml-4 cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue h-8 py-0 transition-[color,background] active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] min-w px-[0.5em] border-l border-r border-y border-solid border-blue"
46
+ class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle duration-350 ease-out shrink-0 outline-none [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue h-8 py-0 transition-[color,background] active:z-[1] hover:z-[1] focus-visible:z-[1] disabled:z-[1] min-w px-[0.5em] border-l border-r border-y border-solid border-blue"
46
47
  data-component-type="button"
47
48
  role="button"
48
49
  tabindex="0"
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
2
  import { Button, Menu, Container } from '@toptal/picasso'
3
- import { SPACING_4 } from '@toptal/picasso-utils'
4
3
 
5
4
  const Example = () => {
6
5
  const handleClick = () => console.info('Item is clicked')
@@ -14,7 +13,7 @@ const Example = () => {
14
13
  )
15
14
 
16
15
  return (
17
- <Container flex gap={SPACING_4}>
16
+ <Container flex>
18
17
  <Button.Split size='small' menu={menu}>
19
18
  Button
20
19
  </Button.Split>