@sanity/ui 2.10.17 → 2.10.18
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/dist/index.esm.js +370 -310
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +370 -310
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +370 -310
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/src/core/components/autocomplete/autocomplete.styles.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +3 -3
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -3
- package/src/core/components/dialog/dialog.tsx +3 -3
- package/src/core/components/hotkeys/hotkeys.tsx +3 -3
- package/src/core/components/menu/menu.tsx +3 -3
- package/src/core/components/skeleton/skeleton.tsx +4 -5
- package/src/core/components/skeleton/textSkeleton.tsx +5 -5
- package/src/core/components/toast/toast.tsx +3 -3
- package/src/core/components/toast/toastProvider.tsx +3 -3
- package/src/core/components/tree/treeItem.tsx +5 -5
- package/src/core/primitives/avatar/avatar.tsx +6 -6
- package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
- package/src/core/primitives/avatar/avatarStack.tsx +6 -3
- package/src/core/primitives/badge/badge.tsx +3 -3
- package/src/core/primitives/box/box.tsx +3 -3
- package/src/core/primitives/button/button.tsx +3 -3
- package/src/core/primitives/card/card.tsx +2 -2
- package/src/core/primitives/checkbox/checkbox.tsx +3 -3
- package/src/core/primitives/code/code.tsx +3 -3
- package/src/core/primitives/container/container.tsx +2 -2
- package/src/core/primitives/flex/flex.tsx +2 -2
- package/src/core/primitives/grid/grid.tsx +3 -3
- package/src/core/primitives/heading/heading.tsx +4 -11
- package/src/core/primitives/inline/inline.tsx +3 -3
- package/src/core/primitives/kbd/kbd.tsx +3 -3
- package/src/core/primitives/label/label.tsx +4 -11
- package/src/core/primitives/radio/radio.tsx +3 -3
- package/src/core/primitives/select/select.tsx +3 -3
- package/src/core/primitives/spinner/spinner.tsx +3 -3
- package/src/core/primitives/stack/stack.tsx +5 -2
- package/src/core/primitives/switch/switch.tsx +3 -3
- package/src/core/primitives/text/text.tsx +4 -11
- package/src/core/primitives/textArea/textArea.tsx +3 -3
- package/src/core/primitives/textInput/textInput.tsx +3 -3
- package/src/core/primitives/tooltip/tooltip.tsx +3 -3
- package/src/core/utils/arrow/arrow.tsx +3 -3
- package/src/core/utils/layer/layer.tsx +9 -3
- package/src/core/utils/spanWithTextOverflow.tsx +10 -0
- package/src/core/utils/srOnly/srOnly.tsx +3 -3
- package/src/core/utils/virtualList/virtualList.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.18",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"@commitlint/cli": "^19.6.1",
|
|
123
123
|
"@commitlint/config-conventional": "^19.6.0",
|
|
124
124
|
"@juggle/resize-observer": "^3.4.0",
|
|
125
|
-
"@sanity/pkg-utils": "^6.
|
|
125
|
+
"@sanity/pkg-utils": "^6.13.0",
|
|
126
126
|
"@sanity/prettier-config": "^1.0.3",
|
|
127
127
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
128
128
|
"@sanity/ui-workshop": "^2.0.20",
|
|
@@ -155,6 +155,7 @@
|
|
|
155
155
|
"@typescript-eslint/parser": "^7.18.0",
|
|
156
156
|
"@vitejs/plugin-react": "^4.3.4",
|
|
157
157
|
"babel-plugin-react-compiler": "19.0.0-beta-55955c9-20241229",
|
|
158
|
+
"babel-plugin-styled-components": "^2.1.4",
|
|
158
159
|
"commitizen": "^4.3.1",
|
|
159
160
|
"cypress": "^13.17.0",
|
|
160
161
|
"cypress-real-events": "^1.13.0",
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
TextInput,
|
|
34
34
|
} from '../../primitives'
|
|
35
35
|
import {Radius} from '../../types'
|
|
36
|
-
import {AnimatedSpinnerIcon, ListBox,
|
|
36
|
+
import {AnimatedSpinnerIcon, ListBox, StyledAutocomplete} from './autocomplete.styles'
|
|
37
37
|
import {AutocompleteOption} from './autocompleteOption'
|
|
38
38
|
import {autocompleteReducer} from './autocompleteReducer'
|
|
39
39
|
import {
|
|
@@ -679,7 +679,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
679
679
|
])
|
|
680
680
|
|
|
681
681
|
return (
|
|
682
|
-
<
|
|
682
|
+
<StyledAutocomplete
|
|
683
683
|
data-ui="Autocomplete"
|
|
684
684
|
onBlur={handleRootBlur}
|
|
685
685
|
onFocus={handleRootFocus}
|
|
@@ -688,7 +688,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
688
688
|
>
|
|
689
689
|
{input}
|
|
690
690
|
{results}
|
|
691
|
-
</
|
|
691
|
+
</StyledAutocomplete>
|
|
692
692
|
)
|
|
693
693
|
})
|
|
694
694
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from 'react'
|
|
11
11
|
import {useArrayProp, useClickOutsideEvent} from '../../hooks'
|
|
12
12
|
import {Box, Popover, Stack, Text} from '../../primitives'
|
|
13
|
-
import {ExpandButton,
|
|
13
|
+
import {ExpandButton, StyledBreadcrumbs} from './breadcrumbs.styles'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @beta
|
|
@@ -81,7 +81,7 @@ export const Breadcrumbs = forwardRef(function Breadcrumbs(
|
|
|
81
81
|
}, [collapse, expand, maxLength, open, rawItems, space])
|
|
82
82
|
|
|
83
83
|
return (
|
|
84
|
-
<
|
|
84
|
+
<StyledBreadcrumbs data-ui="Breadcrumbs" {...restProps} ref={ref}>
|
|
85
85
|
{items.map((item, itemIndex) => (
|
|
86
86
|
<Fragment key={itemIndex}>
|
|
87
87
|
{itemIndex > 0 && (
|
|
@@ -92,7 +92,7 @@ export const Breadcrumbs = forwardRef(function Breadcrumbs(
|
|
|
92
92
|
<Box as="li">{item}</Box>
|
|
93
93
|
</Fragment>
|
|
94
94
|
))}
|
|
95
|
-
</
|
|
95
|
+
</StyledBreadcrumbs>
|
|
96
96
|
)
|
|
97
97
|
})
|
|
98
98
|
Breadcrumbs.displayName = 'ForwardRef(Breadcrumbs)'
|
|
@@ -99,7 +99,7 @@ function isTargetWithinScope(
|
|
|
99
99
|
)
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
const
|
|
102
|
+
const StyledDialog = styled(Layer)<
|
|
103
103
|
ResponsiveDialogPositionStyleProps & ResponsivePaddingStyleProps & AnimationDialogStyleProps
|
|
104
104
|
>(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle, animationDialogStyle)
|
|
105
105
|
|
|
@@ -388,7 +388,7 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
388
388
|
|
|
389
389
|
return (
|
|
390
390
|
<Portal __unstable_name={portalProp}>
|
|
391
|
-
<
|
|
391
|
+
<StyledDialog
|
|
392
392
|
{...restProps}
|
|
393
393
|
$animate={animate}
|
|
394
394
|
$padding={padding}
|
|
@@ -424,7 +424,7 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
424
424
|
{children}
|
|
425
425
|
</DialogCard>
|
|
426
426
|
<div ref={postDivRef} tabIndex={0} />
|
|
427
|
-
</
|
|
427
|
+
</StyledDialog>
|
|
428
428
|
</Portal>
|
|
429
429
|
)
|
|
430
430
|
})
|
|
@@ -15,7 +15,7 @@ export interface HotkeysProps {
|
|
|
15
15
|
keys?: string[]
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const StyledHotkeys = styled.kbd`
|
|
19
19
|
font: inherit;
|
|
20
20
|
padding: 1px;
|
|
21
21
|
|
|
@@ -47,7 +47,7 @@ export const Hotkeys = forwardRef(function Hotkeys(
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
|
-
<
|
|
50
|
+
<StyledHotkeys data-ui="Hotkeys" {...restProps} ref={ref}>
|
|
51
51
|
<Inline as="span" space={space}>
|
|
52
52
|
{keys.map((key, i) => (
|
|
53
53
|
<Key fontSize={fontSize} key={i} padding={padding} radius={radius}>
|
|
@@ -55,7 +55,7 @@ export const Hotkeys = forwardRef(function Hotkeys(
|
|
|
55
55
|
</Key>
|
|
56
56
|
))}
|
|
57
57
|
</Inline>
|
|
58
|
-
</
|
|
58
|
+
</StyledHotkeys>
|
|
59
59
|
)
|
|
60
60
|
})
|
|
61
61
|
Hotkeys.displayName = 'ForwardRef(Hotkeys)'
|
|
@@ -31,7 +31,7 @@ export interface MenuProps extends ResponsivePaddingProps {
|
|
|
31
31
|
'onBlurCapture'?: (event: FocusEvent) => void
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const StyledMenu = styled(Box)`
|
|
35
35
|
outline: none;
|
|
36
36
|
overflow: auto;
|
|
37
37
|
`
|
|
@@ -159,7 +159,7 @@ export const Menu = forwardRef(function Menu(
|
|
|
159
159
|
|
|
160
160
|
return (
|
|
161
161
|
<MenuContext.Provider value={value}>
|
|
162
|
-
<
|
|
162
|
+
<StyledMenu
|
|
163
163
|
data-ui="Menu"
|
|
164
164
|
{...restProps}
|
|
165
165
|
onKeyDown={handleKeyDown}
|
|
@@ -169,7 +169,7 @@ export const Menu = forwardRef(function Menu(
|
|
|
169
169
|
tabIndex={-1}
|
|
170
170
|
>
|
|
171
171
|
<Stack space={space}>{children}</Stack>
|
|
172
|
-
</
|
|
172
|
+
</StyledMenu>
|
|
173
173
|
</MenuContext.Provider>
|
|
174
174
|
)
|
|
175
175
|
})
|
|
@@ -6,10 +6,9 @@ import {BoxProps, ResponsiveRadiusProps} from '../../primitives'
|
|
|
6
6
|
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
7
7
|
import {skeletonStyle} from './styles'
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
)
|
|
9
|
+
const StyledSkeleton = styled(Box)<
|
|
10
|
+
{$animated: boolean; $visible: boolean} & ResponsiveRadiusStyleProps
|
|
11
|
+
>(responsiveRadiusStyle, skeletonStyle)
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
@@ -46,7 +45,7 @@ export const Skeleton = forwardRef(function Skeleton(
|
|
|
46
45
|
}, [delay])
|
|
47
46
|
|
|
48
47
|
return (
|
|
49
|
-
<
|
|
48
|
+
<StyledSkeleton
|
|
50
49
|
{...restProps}
|
|
51
50
|
$animated={animated}
|
|
52
51
|
$radius={useArrayProp(radius)}
|
|
@@ -5,7 +5,7 @@ import {useArrayProp} from '../../hooks'
|
|
|
5
5
|
import {ThemeProps, _responsive} from '../../styles'
|
|
6
6
|
import {Skeleton, SkeletonProps} from './skeleton'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const StyledSkeleton = styled(Skeleton)<{$size: number[]; $style: ThemeFontKey}>((
|
|
9
9
|
props: {
|
|
10
10
|
$size: number[]
|
|
11
11
|
$style: ThemeFontKey
|
|
@@ -69,7 +69,7 @@ export const TextSkeleton = forwardRef(function TextSkeleton(
|
|
|
69
69
|
const {size = 2, ...restProps} = props
|
|
70
70
|
const $size = useArrayProp(size)
|
|
71
71
|
|
|
72
|
-
return <
|
|
72
|
+
return <StyledSkeleton {...restProps} $size={$size} ref={ref} $style="text" />
|
|
73
73
|
})
|
|
74
74
|
TextSkeleton.displayName = 'ForwardRef(TextSkeleton)'
|
|
75
75
|
|
|
@@ -85,7 +85,7 @@ export const LabelSkeleton = forwardRef(function TextSkeleton(
|
|
|
85
85
|
const {size = 2, ...restProps} = props
|
|
86
86
|
const $size = useArrayProp(size)
|
|
87
87
|
|
|
88
|
-
return <
|
|
88
|
+
return <StyledSkeleton {...restProps} $size={$size} ref={ref} $style="label" />
|
|
89
89
|
})
|
|
90
90
|
LabelSkeleton.displayName = 'ForwardRef(LabelSkeleton)'
|
|
91
91
|
|
|
@@ -101,7 +101,7 @@ export const HeadingSkeleton = forwardRef(function TextSkeleton(
|
|
|
101
101
|
const {size = 2, ...restProps} = props
|
|
102
102
|
const $size = useArrayProp(size)
|
|
103
103
|
|
|
104
|
-
return <
|
|
104
|
+
return <StyledSkeleton {...restProps} $size={$size} ref={ref} $style="heading" />
|
|
105
105
|
})
|
|
106
106
|
HeadingSkeleton.displayName = 'ForwardRef(HeadingSkeleton)'
|
|
107
107
|
|
|
@@ -117,6 +117,6 @@ export const CodeSkeleton = forwardRef(function TextSkeleton(
|
|
|
117
117
|
const {size = 2, ...restProps} = props
|
|
118
118
|
const $size = useArrayProp(size)
|
|
119
119
|
|
|
120
|
-
return <
|
|
120
|
+
return <StyledSkeleton {...restProps} $size={$size} ref={ref} $style="code" />
|
|
121
121
|
})
|
|
122
122
|
CodeSkeleton.displayName = 'ForwardRef(CodeSkeleton)'
|
|
@@ -40,7 +40,7 @@ const ROLES = {
|
|
|
40
40
|
info: 'alert',
|
|
41
41
|
} as const
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const StyledToast = styled(Card)<{$duration?: number; tone: ThemeColorStateToneKey} & ThemeProps>(
|
|
44
44
|
rootStyles,
|
|
45
45
|
)
|
|
46
46
|
|
|
@@ -60,7 +60,7 @@ export function Toast(
|
|
|
60
60
|
const role = status ? ROLES[status] : 'status'
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
|
-
<
|
|
63
|
+
<StyledToast
|
|
64
64
|
data-ui="Toast"
|
|
65
65
|
role={role}
|
|
66
66
|
{...restProps}
|
|
@@ -100,7 +100,7 @@ export function Toast(
|
|
|
100
100
|
</Box>
|
|
101
101
|
)}
|
|
102
102
|
</Flex>
|
|
103
|
-
</
|
|
103
|
+
</StyledToast>
|
|
104
104
|
)
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -28,7 +28,7 @@ export interface ToastProviderProps {
|
|
|
28
28
|
zOffset?: number | number[]
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
const StyledToastProvider = styled(Layer)`
|
|
32
32
|
position: fixed;
|
|
33
33
|
top: 0;
|
|
34
34
|
left: 0;
|
|
@@ -153,7 +153,7 @@ export function ToastProvider(props: ToastProviderProps): React.ReactElement<any
|
|
|
153
153
|
<ToastContext.Provider value={value}>
|
|
154
154
|
{children}
|
|
155
155
|
{mounted && (
|
|
156
|
-
<
|
|
156
|
+
<StyledToastProvider data-ui="ToastProvider" zOffset={zOffset}>
|
|
157
157
|
<ToastContainer>
|
|
158
158
|
<Box padding={padding} paddingX={paddingX} paddingY={paddingY}>
|
|
159
159
|
<AnimatePresence initial={false}>
|
|
@@ -184,7 +184,7 @@ export function ToastProvider(props: ToastProviderProps): React.ReactElement<any
|
|
|
184
184
|
</AnimatePresence>
|
|
185
185
|
</Box>
|
|
186
186
|
</ToastContainer>
|
|
187
|
-
</
|
|
187
|
+
</StyledToastProvider>
|
|
188
188
|
)}
|
|
189
189
|
</ToastContext.Provider>
|
|
190
190
|
)
|
|
@@ -30,7 +30,7 @@ export interface TreeItemProps {
|
|
|
30
30
|
weight?: ThemeFontWeightKey
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const StyledTreeItem = memo(styled.li(treeItemRootStyle, treeItemRootColorStyle))
|
|
34
34
|
|
|
35
35
|
const TreeItemBox = styled(Box).attrs({forwardedAs: 'a'})<TreeItemBoxStyleProps>(treeItemBoxStyle)
|
|
36
36
|
|
|
@@ -147,7 +147,7 @@ export const TreeItem = memo(function TreeItem(
|
|
|
147
147
|
|
|
148
148
|
if (href) {
|
|
149
149
|
return (
|
|
150
|
-
<
|
|
150
|
+
<StyledTreeItem
|
|
151
151
|
data-selected={selected ? '' : undefined}
|
|
152
152
|
data-tree-id={id}
|
|
153
153
|
data-tree-key={itemKey}
|
|
@@ -173,12 +173,12 @@ export const TreeItem = memo(function TreeItem(
|
|
|
173
173
|
<TreeContext.Provider value={contextValue}>
|
|
174
174
|
{children && <TreeGroup hidden={!expanded}>{children}</TreeGroup>}
|
|
175
175
|
</TreeContext.Provider>
|
|
176
|
-
</
|
|
176
|
+
</StyledTreeItem>
|
|
177
177
|
)
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
return (
|
|
181
|
-
<
|
|
181
|
+
<StyledTreeItem
|
|
182
182
|
data-selected={selected ? '' : undefined}
|
|
183
183
|
data-ui="TreeItem"
|
|
184
184
|
data-tree-id={id}
|
|
@@ -198,7 +198,7 @@ export const TreeItem = memo(function TreeItem(
|
|
|
198
198
|
<TreeContext.Provider value={contextValue}>
|
|
199
199
|
{children && <TreeGroup expanded={expanded}>{children}</TreeGroup>}
|
|
200
200
|
</TreeContext.Provider>
|
|
201
|
-
</
|
|
201
|
+
</StyledTreeItem>
|
|
202
202
|
)
|
|
203
203
|
})
|
|
204
204
|
TreeItem.displayName = 'Memo(TreeItem)'
|
|
@@ -30,7 +30,7 @@ export interface AvatarProps {
|
|
|
30
30
|
title?: string
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const StyledAvatar = styled.div<{$color: ThemeColorAvatarColorKey; $size: AvatarSize[]}>(
|
|
34
34
|
responsiveAvatarSizeStyle,
|
|
35
35
|
avatarStyle.root,
|
|
36
36
|
)
|
|
@@ -47,7 +47,7 @@ const InitialsLabel = styled(Label)({
|
|
|
47
47
|
color: 'inherit',
|
|
48
48
|
})
|
|
49
49
|
|
|
50
|
-
const
|
|
50
|
+
const AvatarImage = styled.svg(avatarStyle.image)
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Avatars are used to represent people and other agents (e.g. bots).
|
|
@@ -124,7 +124,7 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
124
124
|
)
|
|
125
125
|
|
|
126
126
|
return (
|
|
127
|
-
<
|
|
127
|
+
<StyledAvatar
|
|
128
128
|
as={as}
|
|
129
129
|
data-as={typeof as === 'string' ? as : undefined}
|
|
130
130
|
data-ui="Avatar"
|
|
@@ -147,7 +147,7 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
147
147
|
</Arrow>
|
|
148
148
|
|
|
149
149
|
{!imageFailed && src && (
|
|
150
|
-
<
|
|
150
|
+
<AvatarImage viewBox={`0 0 ${_sizeRem} ${_sizeRem}`} fill="none">
|
|
151
151
|
<defs>
|
|
152
152
|
<pattern id={imageId} patternContentUnits="objectBoundingBox" width="1" height="1">
|
|
153
153
|
<image
|
|
@@ -179,7 +179,7 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
179
179
|
ry={_radius}
|
|
180
180
|
vectorEffect="non-scaling-stroke"
|
|
181
181
|
/>
|
|
182
|
-
</
|
|
182
|
+
</AvatarImage>
|
|
183
183
|
)}
|
|
184
184
|
|
|
185
185
|
{(imageFailed || !src) && initials && (
|
|
@@ -191,7 +191,7 @@ export const Avatar = forwardRef(function Avatar(
|
|
|
191
191
|
</Initials>
|
|
192
192
|
</>
|
|
193
193
|
)}
|
|
194
|
-
</
|
|
194
|
+
</StyledAvatar>
|
|
195
195
|
)
|
|
196
196
|
})
|
|
197
197
|
Avatar.displayName = 'ForwardRef(Avatar)'
|
|
@@ -45,7 +45,7 @@ function _avatarCounterBaseStyle(props: ThemeProps) {
|
|
|
45
45
|
`
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const StyledAvatarCounter = styled.div<{$size: AvatarSize[]}>(
|
|
49
49
|
_responsiveAvatarCounterSizeStyle,
|
|
50
50
|
_avatarCounterBaseStyle,
|
|
51
51
|
)
|
|
@@ -83,11 +83,11 @@ export const AvatarCounter = forwardRef(function AvatarCounter(
|
|
|
83
83
|
)
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
|
-
<
|
|
86
|
+
<StyledAvatarCounter $size={size} data-ui="AvatarCounter" ref={ref}>
|
|
87
87
|
<Label as="span" size={fontSize} weight="medium">
|
|
88
88
|
{count}
|
|
89
89
|
</Label>
|
|
90
|
-
</
|
|
90
|
+
</StyledAvatarCounter>
|
|
91
91
|
)
|
|
92
92
|
})
|
|
93
93
|
AvatarCounter.displayName = 'ForwardRef(AvatarCounter)'
|
|
@@ -39,7 +39,10 @@ function responsiveAvatarStackSizeStyle(props: {$size: AvatarSize[]} & ThemeProp
|
|
|
39
39
|
})
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const
|
|
42
|
+
const StyledAvatarStack = styled.div<{$size: AvatarSize[]}>(
|
|
43
|
+
responsiveAvatarStackSizeStyle,
|
|
44
|
+
avatarStackStyle,
|
|
45
|
+
)
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
48
|
* @public
|
|
@@ -75,7 +78,7 @@ export const AvatarStack = forwardRef(function AvatarStack(
|
|
|
75
78
|
const visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children
|
|
76
79
|
|
|
77
80
|
return (
|
|
78
|
-
<
|
|
81
|
+
<StyledAvatarStack data-ui="AvatarStack" {...restProps} ref={ref} $size={size}>
|
|
79
82
|
{len === 0 && (
|
|
80
83
|
<div>
|
|
81
84
|
<AvatarCounter count={len} size={size} />
|
|
@@ -91,7 +94,7 @@ export const AvatarStack = forwardRef(function AvatarStack(
|
|
|
91
94
|
{visibleChildren.map((child, childIndex) => (
|
|
92
95
|
<div key={String(childIndex)}>{cloneElement(child, {size})}</div>
|
|
93
96
|
))}
|
|
94
|
-
</
|
|
97
|
+
</StyledAvatarStack>
|
|
95
98
|
)
|
|
96
99
|
})
|
|
97
100
|
AvatarStack.displayName = 'ForwardRef(AvatarStack)'
|
|
@@ -20,7 +20,7 @@ export interface BadgeProps extends BoxProps, ResponsiveRadiusProps {
|
|
|
20
20
|
tone?: BadgeTone
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const StyledBadge = styled(Box)<BadgeStyleProps & ResponsiveRadiusStyleProps>(
|
|
24
24
|
responsiveRadiusStyle,
|
|
25
25
|
badgeStyle,
|
|
26
26
|
)
|
|
@@ -46,7 +46,7 @@ export const Badge = forwardRef(function Badge(
|
|
|
46
46
|
} = props
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
|
-
<
|
|
49
|
+
<StyledBadge
|
|
50
50
|
data-ui="Badge"
|
|
51
51
|
{...restProps}
|
|
52
52
|
$tone={tone}
|
|
@@ -55,7 +55,7 @@ export const Badge = forwardRef(function Badge(
|
|
|
55
55
|
ref={ref}
|
|
56
56
|
>
|
|
57
57
|
<Text size={fontSize}>{children}</Text>
|
|
58
|
-
</
|
|
58
|
+
</StyledBadge>
|
|
59
59
|
)
|
|
60
60
|
})
|
|
61
61
|
Badge.displayName = 'ForwardRef(Badge)'
|
|
@@ -35,7 +35,7 @@ export interface BoxProps
|
|
|
35
35
|
forwardedAs?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const
|
|
38
|
+
const StyledBox = styled.div<
|
|
39
39
|
FlexItemStyleProps &
|
|
40
40
|
ResponsiveBoxStyleProps &
|
|
41
41
|
ResponsiveGridItemStyleProps &
|
|
@@ -91,7 +91,7 @@ export const Box = forwardRef(function Box(
|
|
|
91
91
|
} = props
|
|
92
92
|
|
|
93
93
|
return (
|
|
94
|
-
<
|
|
94
|
+
<StyledBox
|
|
95
95
|
data-as={typeof asProp === 'string' ? asProp : undefined}
|
|
96
96
|
data-ui="Box"
|
|
97
97
|
{...restProps}
|
|
@@ -124,7 +124,7 @@ export const Box = forwardRef(function Box(
|
|
|
124
124
|
ref={ref}
|
|
125
125
|
>
|
|
126
126
|
{props.children}
|
|
127
|
-
</
|
|
127
|
+
</StyledBox>
|
|
128
128
|
)
|
|
129
129
|
})
|
|
130
130
|
Box.displayName = 'ForwardRef(Box)'
|
|
@@ -37,7 +37,7 @@ export interface ButtonProps extends ResponsivePaddingProps, ResponsiveRadiusPro
|
|
|
37
37
|
width?: ButtonWidth
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const StyledButton = styled.button<
|
|
41
41
|
{$mode: ButtonMode; $tone: ButtonTone; $width?: ButtonWidth} & ResponsiveRadiusStyleProps &
|
|
42
42
|
ThemeProps
|
|
43
43
|
>(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles)
|
|
@@ -119,7 +119,7 @@ export const Button = forwardRef(function Button(
|
|
|
119
119
|
)
|
|
120
120
|
|
|
121
121
|
return (
|
|
122
|
-
<
|
|
122
|
+
<StyledButton
|
|
123
123
|
data-ui="Button"
|
|
124
124
|
{...restProps}
|
|
125
125
|
$mode={mode}
|
|
@@ -177,7 +177,7 @@ export const Button = forwardRef(function Button(
|
|
|
177
177
|
{children}
|
|
178
178
|
</Box>
|
|
179
179
|
)}
|
|
180
|
-
</
|
|
180
|
+
</StyledButton>
|
|
181
181
|
)
|
|
182
182
|
})
|
|
183
183
|
Button.displayName = 'ForwardRef(Button)'
|
|
@@ -42,7 +42,7 @@ export interface CardProps
|
|
|
42
42
|
tone?: CardTone
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const StyledCard = styled(Box)<
|
|
46
46
|
CardStyleProps &
|
|
47
47
|
ResponsiveRadiusStyleProps &
|
|
48
48
|
ResponsiveBorderStyleProps &
|
|
@@ -85,7 +85,7 @@ export const Card = forwardRef(function Card(
|
|
|
85
85
|
// todo: Consider adding the wrapper approach for nested cards in which the tones are not changing, avoid unnecessary ThemeColorProvider
|
|
86
86
|
return (
|
|
87
87
|
<ThemeColorProvider scheme={scheme} tone={tone}>
|
|
88
|
-
<
|
|
88
|
+
<StyledCard
|
|
89
89
|
data-as={typeof as === 'string' ? as : undefined}
|
|
90
90
|
data-scheme={rootTheme.scheme}
|
|
91
91
|
data-ui="Card"
|
|
@@ -12,7 +12,7 @@ export interface CheckboxProps {
|
|
|
12
12
|
customValidity?: string
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const StyledCheckbox = styled.div(checkboxBaseStyles)
|
|
16
16
|
const Input = styled.input(inputElementStyles)
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -51,7 +51,7 @@ export const Checkbox = forwardRef(function Checkbox(
|
|
|
51
51
|
useCustomValidity(ref, customValidity)
|
|
52
52
|
|
|
53
53
|
return (
|
|
54
|
-
<
|
|
54
|
+
<StyledCheckbox className={className} data-ui="Checkbox" style={style}>
|
|
55
55
|
<Input
|
|
56
56
|
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
57
57
|
data-error={customValidity ? '' : undefined}
|
|
@@ -66,7 +66,7 @@ export const Checkbox = forwardRef(function Checkbox(
|
|
|
66
66
|
<CheckmarkIcon />
|
|
67
67
|
<RemoveIcon />
|
|
68
68
|
</span>
|
|
69
|
-
</
|
|
69
|
+
</StyledCheckbox>
|
|
70
70
|
)
|
|
71
71
|
})
|
|
72
72
|
Checkbox.displayName = 'ForwardRef(Checkbox)'
|
|
@@ -16,7 +16,7 @@ export interface CodeProps {
|
|
|
16
16
|
weight?: string
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const StyledCode = styled.pre<ResponsiveFontStyleProps>(codeBaseStyle, responsiveCodeFontStyle)
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @public
|
|
@@ -30,10 +30,10 @@ export const Code = forwardRef(function Code(
|
|
|
30
30
|
const registered = language ? Refractor.hasLanguage(language as any) : false
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<
|
|
33
|
+
<StyledCode data-ui="Code" {...restProps} $size={useArrayProp(size)} $weight={weight} ref={ref}>
|
|
34
34
|
{!(language && registered) && <code>{children}</code>}
|
|
35
35
|
{language && registered && <Refractor inline language={language} value={String(children)} />}
|
|
36
|
-
</
|
|
36
|
+
</StyledCode>
|
|
37
37
|
)
|
|
38
38
|
})
|
|
39
39
|
Code.displayName = 'ForwardRef(Code)'
|
|
@@ -11,7 +11,7 @@ import {ResponsiveWidthStyleProps} from './types'
|
|
|
11
11
|
*/
|
|
12
12
|
export interface ContainerProps extends BoxProps, ResponsiveWidthProps {}
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const StyledContainer = styled(Box)<ResponsiveWidthStyleProps>(
|
|
15
15
|
containerBaseStyle,
|
|
16
16
|
responsiveContainerWidthStyle,
|
|
17
17
|
)
|
|
@@ -28,7 +28,7 @@ export const Container = forwardRef(function Container(
|
|
|
28
28
|
const {as, width = 2, ...restProps} = props
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<
|
|
31
|
+
<StyledContainer
|
|
32
32
|
data-ui="Container"
|
|
33
33
|
{...restProps}
|
|
34
34
|
$width={useArrayProp(width)}
|
|
@@ -20,7 +20,7 @@ export interface FlexProps
|
|
|
20
20
|
gap?: number | number[]
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const StyledFlex = styled(Box)<FlexItemStyleProps & ResponsiveFlexStyleProps>(
|
|
24
24
|
flexItemStyle,
|
|
25
25
|
responsiveFlexStyle,
|
|
26
26
|
)
|
|
@@ -37,7 +37,7 @@ export const Flex = forwardRef(function Flex(
|
|
|
37
37
|
const {align, as, direction = 'row', gap, justify, wrap, ...restProps} = props
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
|
-
<
|
|
40
|
+
<StyledFlex
|
|
41
41
|
data-ui="Flex"
|
|
42
42
|
{...restProps}
|
|
43
43
|
$align={useArrayProp(align)}
|
|
@@ -10,7 +10,7 @@ import {ResponsiveGridProps} from '../types'
|
|
|
10
10
|
*/
|
|
11
11
|
export interface GridProps extends Omit<BoxProps, 'display'>, ResponsiveGridProps {}
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const StyledGrid = styled(Box)<ResponsiveGridStyleProps>(responsiveGridStyle)
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* The `Grid` component is for building 2-dimensional layers (based on CSS grid).
|
|
@@ -25,7 +25,7 @@ export const Grid = forwardRef(function Grid(
|
|
|
25
25
|
props
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<
|
|
28
|
+
<StyledGrid
|
|
29
29
|
data-as={typeof as === 'string' ? as : undefined}
|
|
30
30
|
data-ui="Grid"
|
|
31
31
|
{...restProps}
|
|
@@ -41,7 +41,7 @@ export const Grid = forwardRef(function Grid(
|
|
|
41
41
|
ref={ref}
|
|
42
42
|
>
|
|
43
43
|
{children}
|
|
44
|
-
</
|
|
44
|
+
</StyledGrid>
|
|
45
45
|
)
|
|
46
46
|
})
|
|
47
47
|
Grid.displayName = 'ForwardRef(Grid)'
|