@primer/components 31.2.1-rc.18690e3f → 31.2.1-rc.32ed6e21
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/CHANGELOG.md +7 -1
- package/dist/browser.esm.js +194 -190
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +204 -200
- package/dist/browser.umd.js.map +1 -1
- package/docs/content/ActionList2.mdx +8 -7
- package/docs/content/{Box.md → Box.mdx} +22 -0
- package/docs/src/component-checklist.js +81 -0
- package/lib/ActionList/Item.js +27 -52
- package/lib/ActionList/Item.jsx +17 -40
- package/lib/ActionList2/Description.js +8 -4
- package/lib/ActionList2/Description.jsx +2 -3
- package/lib/ActionList2/Group.d.ts +28 -2
- package/lib/ActionList2/Group.js +55 -6
- package/lib/ActionList2/Group.jsx +33 -4
- package/lib/ActionList2/Item.js +6 -7
- package/lib/ActionList2/Item.jsx +5 -5
- package/lib/ActionList2/List.d.ts +1 -1
- package/lib/Autocomplete/Autocomplete.d.ts +3 -3
- package/lib/Autocomplete/AutocompleteInput.d.ts +3 -3
- package/lib/Button/ButtonClose.d.ts +2 -2
- package/lib/CircleOcticon.d.ts +1 -1
- package/lib/Dialog.d.ts +3 -3
- package/lib/Dropdown.d.ts +4 -4
- package/lib/DropdownMenu/DropdownButton.d.ts +2 -2
- package/lib/FilterList.d.ts +1 -1
- package/lib/NewButton/button.js +34 -42
- package/lib/NewButton/button.jsx +24 -23
- package/lib/Position.d.ts +4 -4
- package/lib/SelectMenu/SelectMenu.d.ts +11 -11
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/TextInputWithTokens.d.ts +3 -3
- package/lib/Timeline.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/stories/ActionList2.stories.js +4 -3
- package/lib/utils/testing.d.ts +6 -60
- package/lib-esm/ActionList/Item.js +28 -53
- package/lib-esm/ActionList2/Description.js +8 -4
- package/lib-esm/ActionList2/Group.d.ts +28 -2
- package/lib-esm/ActionList2/Group.js +52 -5
- package/lib-esm/ActionList2/Item.js +6 -7
- package/lib-esm/ActionList2/List.d.ts +1 -1
- package/lib-esm/Autocomplete/Autocomplete.d.ts +3 -3
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +3 -3
- package/lib-esm/Button/ButtonClose.d.ts +2 -2
- package/lib-esm/CircleOcticon.d.ts +1 -1
- package/lib-esm/Dialog.d.ts +3 -3
- package/lib-esm/Dropdown.d.ts +4 -4
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +2 -2
- package/lib-esm/FilterList.d.ts +1 -1
- package/lib-esm/NewButton/button.js +31 -42
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -11
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/TextInputWithTokens.d.ts +3 -3
- package/lib-esm/Timeline.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/stories/ActionList2.stories.js +4 -3
- package/lib-esm/theme-preval.js +66 -366
- package/lib-esm/utils/testing.d.ts +6 -60
- package/package-lock.json +7 -7
- package/package.json +2 -2
- package/src/ActionList/Item.tsx +17 -46
- package/src/ActionList2/Description.tsx +7 -4
- package/src/ActionList2/Group.tsx +76 -7
- package/src/ActionList2/Item.tsx +6 -5
- package/src/ActionList2/List.tsx +1 -1
- package/src/NewButton/button.tsx +82 -78
- package/src/__tests__/__snapshots__/ActionList.test.tsx.snap +5 -5
- package/src/__tests__/__snapshots__/Autocomplete.test.tsx.snap +25 -25
- package/src/__tests__/__snapshots__/NewButton.test.tsx.snap +5 -0
- package/src/stories/ActionList2.stories.tsx +3 -3
- package/stats.html +1 -1
package/src/ActionList/Item.tsx
CHANGED
@@ -7,7 +7,7 @@ import {ItemInput} from './List'
|
|
7
7
|
import styled from 'styled-components'
|
8
8
|
import {StyledHeader} from './Header'
|
9
9
|
import {StyledDivider} from './Divider'
|
10
|
-
import {
|
10
|
+
import {useTheme} from '../ThemeProvider'
|
11
11
|
import {
|
12
12
|
activeDescendantActivatedDirectly,
|
13
13
|
activeDescendantActivatedIndirectly,
|
@@ -17,36 +17,6 @@ import {useSSRSafeId} from '@react-aria/ssr'
|
|
17
17
|
import {ForwardRefComponent as PolymorphicForwardRefComponent} from '@radix-ui/react-polymorphic'
|
18
18
|
import {AriaRole} from '../utils/types'
|
19
19
|
|
20
|
-
/**
|
21
|
-
* These colors are not yet in our default theme. Need to remove this once they are added.
|
22
|
-
*/
|
23
|
-
const customItemThemes = {
|
24
|
-
default: {
|
25
|
-
hover: {
|
26
|
-
light: 'rgba(46, 77, 108, 0.06)',
|
27
|
-
dark: 'rgba(201, 206, 212, 0.12)',
|
28
|
-
dark_dimmed: 'rgba(201, 206, 212, 0.12)'
|
29
|
-
},
|
30
|
-
focus: {
|
31
|
-
light: 'rgba(54, 77, 100, 0.16)',
|
32
|
-
dark: 'rgba(201, 206, 212, 0.24)',
|
33
|
-
dark_dimmed: 'rgba(201, 206, 212, 0.24)'
|
34
|
-
}
|
35
|
-
},
|
36
|
-
danger: {
|
37
|
-
hover: {
|
38
|
-
light: 'rgba(234, 74, 90, 0.08)',
|
39
|
-
dark: 'rgba(248, 81, 73, 0.16)',
|
40
|
-
dark_dimmed: 'rgba(248, 81, 73, 0.16)'
|
41
|
-
},
|
42
|
-
focus: {
|
43
|
-
light: 'rgba(234, 74, 90, 0.14)',
|
44
|
-
dark: 'rgba(248, 81, 73, 0.24)',
|
45
|
-
dark_dimmed: 'rgba(248, 81, 73, 0.24)'
|
46
|
-
}
|
47
|
-
}
|
48
|
-
} as const
|
49
|
-
|
50
20
|
/**
|
51
21
|
* Contract for props passed to the `Item` component.
|
52
22
|
*/
|
@@ -166,14 +136,19 @@ const getItemVariant = (variant = 'default', disabled?: boolean) => {
|
|
166
136
|
color: get('colors.danger.fg'),
|
167
137
|
iconColor: get('colors.danger.fg'),
|
168
138
|
annotationColor: get('colors.fg.muted'),
|
169
|
-
hoverCursor: 'pointer'
|
139
|
+
hoverCursor: 'pointer',
|
140
|
+
hoverBg: get('colors.actionListItem.danger.hoverBg'),
|
141
|
+
focusBg: get('colors.actionListItem.danger.activeBg'),
|
142
|
+
hoverText: get('colors.actionListItem.danger.hoverText')
|
170
143
|
}
|
171
144
|
default:
|
172
145
|
return {
|
173
146
|
color: get('colors.fg.default'),
|
174
147
|
iconColor: get('colors.fg.muted'),
|
175
148
|
annotationColor: get('colors.fg.muted'),
|
176
|
-
hoverCursor: 'pointer'
|
149
|
+
hoverCursor: 'pointer',
|
150
|
+
hoverBg: get('colors.actionListItem.default.hoverBg'),
|
151
|
+
focusBg: get('colors.actionListItem.default.activeBg')
|
177
152
|
}
|
178
153
|
}
|
179
154
|
}
|
@@ -200,8 +175,6 @@ const StyledItem = styled.div<
|
|
200
175
|
variant: ItemProps['variant']
|
201
176
|
showDivider: ItemProps['showDivider']
|
202
177
|
item?: ItemInput
|
203
|
-
hoverBackground: string
|
204
|
-
focusBackground: string
|
205
178
|
} & SxProp
|
206
179
|
>`
|
207
180
|
/* 6px vertical padding + 20px line height = 32px total height
|
@@ -220,7 +193,11 @@ const StyledItem = styled.div<
|
|
220
193
|
@media (hover: hover) and (pointer: fine) {
|
221
194
|
:hover {
|
222
195
|
// allow override in case another item in the list is active/focused
|
223
|
-
background: var(
|
196
|
+
background: var(
|
197
|
+
--item-hover-bg-override,
|
198
|
+
${({variant, item}) => getItemVariant(variant, item?.disabled).hoverBg}
|
199
|
+
);
|
200
|
+
color: ${({variant, item}) => getItemVariant(variant, item?.disabled).hoverText};
|
224
201
|
cursor: ${({variant, item}) => getItemVariant(variant, item?.disabled).hoverCursor};
|
225
202
|
}
|
226
203
|
}
|
@@ -266,19 +243,19 @@ const StyledItem = styled.div<
|
|
266
243
|
|
267
244
|
// Active Descendant
|
268
245
|
&[${isActiveDescendantAttribute}='${activeDescendantActivatedDirectly}'] {
|
269
|
-
background: ${({
|
246
|
+
background: ${({variant, item}) => getItemVariant(variant, item?.disabled).focusBg};
|
270
247
|
}
|
271
248
|
&[${isActiveDescendantAttribute}='${activeDescendantActivatedIndirectly}'] {
|
272
|
-
background: ${({
|
249
|
+
background: ${({variant, item}) => getItemVariant(variant, item?.disabled).hoverBg};
|
273
250
|
}
|
274
251
|
|
275
252
|
&:focus {
|
276
|
-
background: ${({
|
253
|
+
background: ${({variant, item}) => getItemVariant(variant, item?.disabled).focusBg};
|
277
254
|
outline: none;
|
278
255
|
}
|
279
256
|
|
280
257
|
&:active {
|
281
|
-
background: ${({
|
258
|
+
background: ${({variant, item}) => getItemVariant(variant, item?.disabled).focusBg};
|
282
259
|
}
|
283
260
|
|
284
261
|
${sx}
|
@@ -404,10 +381,6 @@ export const Item = React.forwardRef((itemProps, ref) => {
|
|
404
381
|
[onAction, disabled, itemProps, onClick]
|
405
382
|
)
|
406
383
|
|
407
|
-
const customItemTheme = customItemThemes[variant]
|
408
|
-
const hoverBackground = useColorSchemeVar(customItemTheme.hover, 'inherit')
|
409
|
-
const focusBackground = useColorSchemeVar(customItemTheme.focus, 'inherit')
|
410
|
-
|
411
384
|
const {theme} = useTheme()
|
412
385
|
|
413
386
|
return (
|
@@ -424,8 +397,6 @@ export const Item = React.forwardRef((itemProps, ref) => {
|
|
424
397
|
data-id={id}
|
425
398
|
onKeyPress={keyPressHandler}
|
426
399
|
onClick={clickHandler}
|
427
|
-
hoverBackground={disabled ? 'inherit' : hoverBackground}
|
428
|
-
focusBackground={disabled ? 'inherit' : focusBackground}
|
429
400
|
>
|
430
401
|
{!!selected === selected && (
|
431
402
|
<BaseVisualContainer>
|
@@ -16,7 +16,6 @@ export type DescriptionProps = {
|
|
16
16
|
|
17
17
|
export const Description: React.FC<DescriptionProps> = ({variant = 'inline', sx = {}, ...props}) => {
|
18
18
|
const styles = {
|
19
|
-
color: 'fg.muted',
|
20
19
|
fontSize: 0,
|
21
20
|
lineHeight: '16px',
|
22
21
|
flexGrow: 1,
|
@@ -27,15 +26,19 @@ export const Description: React.FC<DescriptionProps> = ({variant = 'inline', sx
|
|
27
26
|
|
28
27
|
return (
|
29
28
|
<Slot name={variant === 'block' ? 'BlockDescription' : 'InlineDescription'}>
|
30
|
-
{({blockDescriptionId, inlineDescriptionId}: ItemContext) =>
|
29
|
+
{({blockDescriptionId, inlineDescriptionId, disabled}: ItemContext) =>
|
31
30
|
variant === 'block' ? (
|
32
|
-
<Box
|
31
|
+
<Box
|
32
|
+
as="span"
|
33
|
+
sx={merge({...styles, color: disabled ? 'fg.disabled' : 'fg.muted'}, sx as SxProp)}
|
34
|
+
id={blockDescriptionId}
|
35
|
+
>
|
33
36
|
{props.children}
|
34
37
|
</Box>
|
35
38
|
) : (
|
36
39
|
<Truncate
|
37
40
|
id={inlineDescriptionId}
|
38
|
-
sx={merge(styles, sx as SxProp)}
|
41
|
+
sx={merge({...styles, color: disabled ? 'fg.disabled' : 'fg.muted'}, sx as SxProp)}
|
39
42
|
title={props.children as string}
|
40
43
|
inline={true}
|
41
44
|
maxWidth="100%"
|
@@ -1,18 +1,51 @@
|
|
1
1
|
import React from 'react'
|
2
|
+
import {useSSRSafeId} from '@react-aria/ssr'
|
2
3
|
import Box from '../Box'
|
3
4
|
import {SxProp} from '../sx'
|
4
|
-
import {
|
5
|
-
import {
|
5
|
+
import {ListContext, ListProps} from './List'
|
6
|
+
import {AriaRole} from '../utils/types'
|
6
7
|
|
7
|
-
export type GroupProps =
|
8
|
-
|
8
|
+
export type GroupProps = {
|
9
|
+
/**
|
10
|
+
* Style variations. Usage is discretionary.
|
11
|
+
*
|
12
|
+
* - `"filled"` - Superimposed on a background, offset from nearby content
|
13
|
+
* - `"subtle"` - Relatively less offset from nearby content
|
14
|
+
*/
|
15
|
+
variant?: 'subtle' | 'filled'
|
16
|
+
/**
|
17
|
+
* Primary text which names a `Group`.
|
18
|
+
*/
|
19
|
+
title?: string
|
20
|
+
/**
|
21
|
+
* Secondary text which provides additional information about a `Group`.
|
22
|
+
*/
|
23
|
+
auxiliaryText?: string
|
24
|
+
/**
|
25
|
+
* The ARIA role describing the function of the list inside `Group` component. `listbox` or `menu` are a common values.
|
26
|
+
*/
|
27
|
+
role?: AriaRole
|
28
|
+
} & SxProp & {
|
29
|
+
/**
|
30
|
+
* Whether multiple Items or a single Item can be selected in the Group. Overrides value on ActionList root.
|
31
|
+
*/
|
9
32
|
selectionVariant?: ListProps['selectionVariant'] | false
|
10
33
|
}
|
11
34
|
|
12
35
|
type ContextProps = Pick<GroupProps, 'selectionVariant'>
|
13
36
|
export const GroupContext = React.createContext<ContextProps>({})
|
14
37
|
|
15
|
-
export const Group: React.FC<GroupProps> = ({
|
38
|
+
export const Group: React.FC<GroupProps> = ({
|
39
|
+
title,
|
40
|
+
variant = 'subtle',
|
41
|
+
auxiliaryText,
|
42
|
+
selectionVariant,
|
43
|
+
role,
|
44
|
+
sx = {},
|
45
|
+
...props
|
46
|
+
}) => {
|
47
|
+
const labelId = useSSRSafeId()
|
48
|
+
|
16
49
|
return (
|
17
50
|
<Box
|
18
51
|
as="li"
|
@@ -23,12 +56,48 @@ export const Group: React.FC<GroupProps> = ({title, variant, auxiliaryText, sele
|
|
23
56
|
}}
|
24
57
|
{...props}
|
25
58
|
>
|
26
|
-
{title && <Header title={title} variant={variant} auxiliaryText={auxiliaryText} />}
|
59
|
+
{title && <Header title={title} variant={variant} auxiliaryText={auxiliaryText} labelId={labelId} />}
|
27
60
|
<GroupContext.Provider value={{selectionVariant}}>
|
28
|
-
<Box as="ul" sx={{paddingInlineStart: 0}}>
|
61
|
+
<Box as="ul" sx={{paddingInlineStart: 0}} aria-labelledby={title ? labelId : undefined} role={role}>
|
29
62
|
{props.children}
|
30
63
|
</Box>
|
31
64
|
</GroupContext.Provider>
|
32
65
|
</Box>
|
33
66
|
)
|
34
67
|
}
|
68
|
+
|
69
|
+
export type HeaderProps = Pick<GroupProps, 'variant' | 'title' | 'auxiliaryText'> & {
|
70
|
+
labelId: string
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Displays the name and description of a `Group`.
|
75
|
+
*
|
76
|
+
* For visual presentation only. It's hidden from screen readers.
|
77
|
+
*/
|
78
|
+
const Header: React.FC<HeaderProps> = ({variant, title, auxiliaryText, labelId, ...props}) => {
|
79
|
+
const {variant: listVariant} = React.useContext(ListContext)
|
80
|
+
|
81
|
+
const styles = {
|
82
|
+
paddingY: '6px',
|
83
|
+
paddingX: listVariant === 'full' ? 2 : 3,
|
84
|
+
fontSize: 0,
|
85
|
+
fontWeight: 'bold',
|
86
|
+
color: 'fg.muted',
|
87
|
+
...(variant === 'filled' && {
|
88
|
+
backgroundColor: 'canvas.subtle',
|
89
|
+
marginX: 0,
|
90
|
+
marginBottom: 2,
|
91
|
+
borderTop: '1px solid',
|
92
|
+
borderBottom: '1px solid',
|
93
|
+
borderColor: 'neutral.muted'
|
94
|
+
})
|
95
|
+
}
|
96
|
+
|
97
|
+
return (
|
98
|
+
<Box sx={styles} role="presentation" aria-hidden="true" {...props}>
|
99
|
+
<span id={labelId}>{title}</span>
|
100
|
+
{auxiliaryText && <span>{auxiliaryText}</span>}
|
101
|
+
</Box>
|
102
|
+
)
|
103
|
+
}
|
package/src/ActionList2/Item.tsx
CHANGED
@@ -13,9 +13,9 @@ import {Selection} from './Selection'
|
|
13
13
|
export const getVariantStyles = (variant: ItemProps['variant'], disabled: ItemProps['disabled']) => {
|
14
14
|
if (disabled) {
|
15
15
|
return {
|
16
|
-
color: 'fg.
|
17
|
-
iconColor: 'fg.
|
18
|
-
annotationColor: 'fg.
|
16
|
+
color: 'primer.fg.disabled',
|
17
|
+
iconColor: 'primer.fg.disabled',
|
18
|
+
annotationColor: 'primer.fg.disabled'
|
19
19
|
}
|
20
20
|
}
|
21
21
|
|
@@ -114,8 +114,9 @@ export const Item = React.forwardRef<HTMLLIElement, ItemProps>(
|
|
114
114
|
borderRadius: listVariant === 'inset' ? 2 : 0,
|
115
115
|
transition: 'background 33.333ms linear',
|
116
116
|
color: getVariantStyles(variant, disabled).color,
|
117
|
-
|
118
|
-
'
|
117
|
+
cursor: 'pointer',
|
118
|
+
'&[aria-disabled]': {cursor: 'not-allowed'},
|
119
|
+
|
119
120
|
'@media (hover: hover) and (pointer: fine)': {
|
120
121
|
':hover:not([aria-disabled])': {
|
121
122
|
backgroundColor: `actionListItem.${variant}.hoverBg`,
|
package/src/ActionList2/List.tsx
CHANGED
@@ -23,7 +23,7 @@ export type ListProps = {
|
|
23
23
|
role?: AriaRole
|
24
24
|
} & SxProp
|
25
25
|
|
26
|
-
type ContextProps =
|
26
|
+
type ContextProps = Pick<ListProps, 'variant' | 'selectionVariant' | 'showDividers'>
|
27
27
|
export const ListContext = React.createContext<ContextProps>({})
|
28
28
|
|
29
29
|
const ListBox = styled.ul<SxProp>(sx)
|
package/src/NewButton/button.tsx
CHANGED
@@ -5,6 +5,8 @@ import sx, {merge, SxProp} from '../sx'
|
|
5
5
|
import {useTheme, Theme} from '../ThemeProvider'
|
6
6
|
import {VariantType, ButtonProps} from './types'
|
7
7
|
|
8
|
+
const TEXT_ROW_HEIGHT = '20px' // custom value off the scale
|
9
|
+
|
8
10
|
const getVariantStyles = (variant: VariantType = 'default', theme?: Theme) => {
|
9
11
|
const style = {
|
10
12
|
default: {
|
@@ -130,7 +132,7 @@ const getVariantStyles = (variant: VariantType = 'default', theme?: Theme) => {
|
|
130
132
|
boxShadow: `${theme?.shadows.btn.outline.focusShadow}`
|
131
133
|
},
|
132
134
|
|
133
|
-
'&:active': {
|
135
|
+
'&:active:not([disabled])': {
|
134
136
|
color: 'btn.outline.selectedText',
|
135
137
|
backgroundColor: 'btn.outline.selectedBg',
|
136
138
|
boxShadow: `${theme?.shadows.btn.outline.selectedShadow}`,
|
@@ -191,86 +193,88 @@ const getSizeStyles = (size = 'medium', variant: VariantType = 'default', iconOn
|
|
191
193
|
|
192
194
|
const ButtonBase = styled.button<SxProp>(sx)
|
193
195
|
|
194
|
-
const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
const {theme} = useTheme()
|
196
|
+
const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
197
|
+
({children, sx: sxProp = {}, ...props}, forwardedRef): JSX.Element => {
|
198
|
+
const {
|
199
|
+
icon: Icon,
|
200
|
+
leadingIcon: LeadingIcon,
|
201
|
+
trailingIcon: TrailingIcon,
|
202
|
+
variant = 'default',
|
203
|
+
size = 'medium'
|
204
|
+
} = props
|
205
|
+
const iconOnly = !!Icon
|
206
|
+
const {theme} = useTheme()
|
206
207
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
208
|
+
const styles = {
|
209
|
+
borderRadius: '2',
|
210
|
+
border: '1px solid',
|
211
|
+
borderColor: theme?.colors.btn.border,
|
212
|
+
display: 'grid',
|
213
|
+
gridTemplateAreas: '"leadingIcon text trailingIcon"',
|
214
|
+
fontWeight: 'bold',
|
215
|
+
lineHeight: TEXT_ROW_HEIGHT,
|
216
|
+
whiteSpace: 'nowrap',
|
217
|
+
verticalAlign: 'middle',
|
218
|
+
cursor: 'pointer',
|
219
|
+
appearance: 'none',
|
220
|
+
userSelect: 'none',
|
221
|
+
textDecoration: 'none',
|
222
|
+
textAlign: 'center',
|
223
|
+
'& > :not(:last-child)': {
|
224
|
+
mr: '2'
|
225
|
+
},
|
226
|
+
'&:focus': {
|
227
|
+
outline: 'none'
|
228
|
+
},
|
229
|
+
'&:disabled': {
|
230
|
+
cursor: 'default'
|
231
|
+
},
|
232
|
+
'&:disabled svg': {
|
233
|
+
opacity: '0.6'
|
234
|
+
},
|
235
|
+
'[data-component="leadingIcon"]': {
|
236
|
+
gridArea: 'leadingIcon'
|
237
|
+
},
|
238
|
+
'[data-component="text"]': {
|
239
|
+
gridArea: 'text'
|
240
|
+
},
|
241
|
+
'[data-component="trailingIcon"]': {
|
242
|
+
gridArea: 'trailingIcon'
|
243
|
+
}
|
242
244
|
}
|
245
|
+
const iconWrapStyles = {
|
246
|
+
display: 'inline-block'
|
247
|
+
}
|
248
|
+
const sxStyles = merge.all([
|
249
|
+
styles,
|
250
|
+
getSizeStyles(size, variant, iconOnly),
|
251
|
+
getVariantStyles(variant, theme),
|
252
|
+
sxProp as SxProp
|
253
|
+
])
|
254
|
+
return (
|
255
|
+
<ButtonBase sx={sxStyles} ref={forwardedRef} {...props}>
|
256
|
+
{LeadingIcon && (
|
257
|
+
<Box as="span" data-component="leadingIcon" sx={iconWrapStyles} aria-hidden={!iconOnly}>
|
258
|
+
<LeadingIcon />
|
259
|
+
</Box>
|
260
|
+
)}
|
261
|
+
<span data-component="text" hidden={Icon ? true : false}>
|
262
|
+
{children}
|
263
|
+
</span>
|
264
|
+
{Icon && (
|
265
|
+
<Box data-component="icon-only" as="span" sx={{display: 'inline-block'}} aria-hidden={!iconOnly}>
|
266
|
+
<Icon />
|
267
|
+
</Box>
|
268
|
+
)}
|
269
|
+
{TrailingIcon && (
|
270
|
+
<Box as="span" data-component="trailingIcon" sx={{...iconWrapStyles, ml: 2}} aria-hidden={!iconOnly}>
|
271
|
+
<TrailingIcon />
|
272
|
+
</Box>
|
273
|
+
)}
|
274
|
+
</ButtonBase>
|
275
|
+
)
|
243
276
|
}
|
244
|
-
|
245
|
-
const componentStyles = {...styles, ...variableStyles}
|
246
|
-
const iconWrapStyles = {
|
247
|
-
display: 'inline-block'
|
248
|
-
}
|
249
|
-
return (
|
250
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
251
|
-
// @ts-ignore Why wont it accept the sx prop?
|
252
|
-
<ButtonBase sx={merge(componentStyles, sxProp as SxProp)} ref={forwardedRef} {...props}>
|
253
|
-
{LeadingIcon && (
|
254
|
-
<Box as="span" data-component="leadingIcon" sx={iconWrapStyles} aria-hidden={!iconOnly}>
|
255
|
-
<LeadingIcon />
|
256
|
-
</Box>
|
257
|
-
)}
|
258
|
-
<span data-component="text" hidden={Icon ? true : undefined}>
|
259
|
-
{children}
|
260
|
-
</span>
|
261
|
-
{Icon && (
|
262
|
-
<Box data-component="icon-only" as="span" sx={{display: 'inline-block'}} aria-hidden={!iconOnly}>
|
263
|
-
<Icon />
|
264
|
-
</Box>
|
265
|
-
)}
|
266
|
-
{TrailingIcon && (
|
267
|
-
<Box as="span" data-component="trailingIcon" sx={{...iconWrapStyles, ml: 2}} aria-hidden={!iconOnly}>
|
268
|
-
<TrailingIcon />
|
269
|
-
</Box>
|
270
|
-
)}
|
271
|
-
</ButtonBase>
|
272
|
-
)
|
273
|
-
})
|
277
|
+
)
|
274
278
|
|
275
279
|
Button.displayName = 'Button'
|
276
280
|
|
@@ -178,25 +178,25 @@ exports[`ActionList.Item renders consistently 1`] = `
|
|
178
178
|
}
|
179
179
|
|
180
180
|
.c1[data-is-active-descendant='activated-directly'] {
|
181
|
-
background: rgba(
|
181
|
+
background: rgba(208,215,222,0.48);
|
182
182
|
}
|
183
183
|
|
184
184
|
.c1[data-is-active-descendant='activated-indirectly'] {
|
185
|
-
background: rgba(
|
185
|
+
background: rgba(208,215,222,0.32);
|
186
186
|
}
|
187
187
|
|
188
188
|
.c1:focus {
|
189
|
-
background: rgba(
|
189
|
+
background: rgba(208,215,222,0.48);
|
190
190
|
outline: none;
|
191
191
|
}
|
192
192
|
|
193
193
|
.c1:active {
|
194
|
-
background: rgba(
|
194
|
+
background: rgba(208,215,222,0.48);
|
195
195
|
}
|
196
196
|
|
197
197
|
@media (hover:hover) and (pointer:fine) {
|
198
198
|
.c1:hover {
|
199
|
-
background: var(--item-hover-bg-override,rgba(
|
199
|
+
background: var( --item-hover-bg-override,rgba(208,215,222,0.32) );
|
200
200
|
cursor: pointer;
|
201
201
|
}
|
202
202
|
}
|