@sanity/ui 1.0.0-next.3 → 1.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.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/{types/src/index.d.ts → index.d.ts} +4450 -4398
- package/dist/{sanity-ui.esm.js → index.esm.js} +888 -2678
- package/dist/index.esm.js.map +1 -0
- package/dist/{sanity-ui.js → index.js} +882 -2688
- package/dist/index.js.map +1 -0
- package/package.json +112 -23
- package/src/components/autocomplete/__workshop__/example.tsx +1 -1
- package/src/components/autocomplete/__workshop__/index.ts +36 -32
- package/src/components/autocomplete/autocomplete.styles.tsx +22 -28
- package/src/components/autocomplete/autocomplete.tsx +1 -2
- package/src/components/autocomplete/constants.ts +3 -8
- package/src/components/breadcrumbs/__workshop__/index.ts +11 -7
- package/src/components/breadcrumbs/breadcrumbs.styles.ts +13 -18
- package/src/components/dialog/__workshop__/index.ts +13 -9
- package/src/components/dialog/dialog.tsx +53 -67
- package/src/components/hotkeys/__workshop__/index.ts +11 -3
- package/src/components/hotkeys/hotkeys.tsx +12 -16
- package/src/components/menu/__workshop__/index.ts +71 -67
- package/src/components/menu/menu.tsx +5 -7
- package/src/components/menu/menuButton.tsx +16 -14
- package/src/components/menu/menuDivider.ts +8 -10
- package/src/components/skeleton/__workshop__/index.ts +8 -4
- package/src/components/skeleton/skeleton.tsx +4 -6
- package/src/components/skeleton/styles.ts +13 -9
- package/src/components/skeleton/textSkeleton.tsx +12 -14
- package/src/components/tab/__workshop__/index.ts +11 -3
- package/src/components/toast/__workshop__/index.ts +16 -4
- package/src/components/toast/toast.tsx +6 -11
- package/src/components/toast/toastProvider.tsx +18 -22
- package/src/components/tree/__workshop__/basic.perf.ts +1 -14
- package/src/components/tree/__workshop__/basic.tsx +1 -1
- package/src/components/tree/__workshop__/index.ts +12 -8
- package/src/components/tree/style.ts +78 -76
- package/src/components/tree/treeItem.tsx +7 -12
- package/src/hooks/useElementRect/__workshop__/index.ts +11 -3
- package/src/hooks/useMediaIndex/__workshop__/index.ts +11 -3
- package/src/primitives/_selectable/selectable.tsx +4 -7
- package/src/primitives/_selectable/style.ts +85 -82
- package/src/primitives/avatar/__workshop__/index.ts +16 -12
- package/src/primitives/avatar/avatar.tsx +9 -12
- package/src/primitives/avatar/avatarCounter.tsx +22 -24
- package/src/primitives/avatar/avatarStack.tsx +16 -14
- package/src/primitives/avatar/styles.ts +1 -1
- package/src/primitives/badge/__workshop__/index.ts +16 -12
- package/src/primitives/badge/__workshop__/tones.tsx +1 -1
- package/src/primitives/badge/badge.tsx +6 -5
- package/src/primitives/box/__workshop__/index.ts +16 -4
- package/src/primitives/box/box.tsx +21 -49
- package/src/primitives/button/__workshop__/index.ts +51 -47
- package/src/primitives/button/__workshop__/sanityUploadButton.tsx +19 -20
- package/src/primitives/button/__workshop__/styled1.tsx +6 -6
- package/src/primitives/button/button.tsx +20 -26
- package/src/primitives/button/styles.ts +30 -29
- package/src/primitives/card/__workshop__/index.ts +15 -11
- package/src/primitives/card/card.tsx +9 -25
- package/src/primitives/card/styles.ts +119 -114
- package/src/primitives/checkbox/__workshop__/index.ts +10 -6
- package/src/primitives/checkbox/checkbox.tsx +4 -4
- package/src/primitives/checkbox/styles.ts +71 -69
- package/src/primitives/code/__workshop__/index.ts +16 -12
- package/src/primitives/code/code.tsx +3 -5
- package/src/primitives/code/styles.ts +20 -18
- package/src/primitives/container/__workshop__/index.ts +5 -3
- package/src/primitives/container/container.tsx +5 -4
- package/src/primitives/flex/__workshop__/index.ts +8 -4
- package/src/primitives/flex/flex.tsx +7 -23
- package/src/primitives/grid/__workshop__/index.ts +7 -3
- package/src/primitives/grid/grid.tsx +4 -27
- package/src/primitives/heading/__workshop__/index.ts +16 -12
- package/src/primitives/heading/heading.tsx +10 -17
- package/src/primitives/heading/styles.ts +45 -36
- package/src/primitives/inline/__workshop__/index.ts +5 -3
- package/src/primitives/inline/inline.tsx +3 -5
- package/src/primitives/kbd/__workshop__/index.ts +5 -3
- package/src/primitives/kbd/kbd.tsx +12 -13
- package/src/primitives/label/__workshop__/index.ts +16 -12
- package/src/primitives/label/label.tsx +13 -18
- package/src/primitives/label/styles.ts +24 -18
- package/src/primitives/popover/__workshop__/PlainStory.tsx +0 -1
- package/src/primitives/popover/__workshop__/TestStory.tsx +0 -1
- package/src/primitives/popover/__workshop__/index.ts +36 -32
- package/src/primitives/popover/constants.ts +0 -3
- package/src/primitives/popover/floating-ui/size.ts +40 -25
- package/src/primitives/popover/popover.tsx +220 -196
- package/src/primitives/popover/popoverArrow.tsx +42 -48
- package/src/primitives/popover/popoverCard.tsx +12 -22
- package/src/primitives/radio/__workshop__/index.ts +8 -4
- package/src/primitives/radio/radio.tsx +3 -3
- package/src/primitives/radio/styles.ts +73 -73
- package/src/primitives/select/__workshop__/index.ts +8 -4
- package/src/primitives/select/select.tsx +9 -11
- package/src/primitives/select/styles.ts +77 -77
- package/src/primitives/spinner/__workshop__/index.ts +11 -7
- package/src/primitives/spinner/spinner.tsx +2 -5
- package/src/primitives/stack/__workshop__/index.ts +11 -7
- package/src/primitives/stack/stack.tsx +3 -5
- package/src/primitives/switch/__workshop__/index.ts +8 -4
- package/src/primitives/switch/styles.ts +119 -112
- package/src/primitives/switch/switch.tsx +6 -6
- package/src/primitives/text/__workshop__/index.ts +21 -17
- package/src/primitives/text/styles.ts +51 -45
- package/src/primitives/text/text.tsx +11 -16
- package/src/primitives/textArea/__workshop__/index.ts +11 -7
- package/src/primitives/textArea/textArea.tsx +15 -22
- package/src/primitives/textInput/__workshop__/index.ts +46 -42
- package/src/primitives/textInput/__workshop__/plain.tsx +2 -1
- package/src/primitives/textInput/textInput.tsx +49 -69
- package/src/primitives/tooltip/__workshop__/index.ts +11 -7
- package/src/primitives/tooltip/tooltip.tsx +3 -6
- package/src/primitives/tooltip/tooltipArrow.tsx +69 -59
- package/src/styles/border/borderStyle.ts +10 -18
- package/src/styles/box/boxStyle.ts +14 -18
- package/src/styles/flex/flexItemStyle.ts +7 -1
- package/src/styles/flex/flexStyle.ts +14 -9
- package/src/styles/grid/gridItemStyle.ts +18 -30
- package/src/styles/grid/gridStyle.ts +25 -33
- package/src/styles/helpers.ts +2 -2
- package/src/styles/index.ts +0 -1
- package/src/styles/input/textInputStyle.ts +127 -123
- package/src/styles/margin/marginStyle.ts +11 -10
- package/src/styles/margin/marginsStyle.test.ts +12 -10
- package/src/styles/padding/paddingStyle.test.ts +12 -10
- package/src/styles/padding/paddingStyle.ts +9 -10
- package/src/theme/__workshop__/index.ts +26 -22
- package/src/theme/{ThemeContext.ts → themeContext.ts} +0 -0
- package/src/utils/boundaryElement/__workshop__/index.ts +11 -7
- package/src/utils/elementQuery/__workshop__/index.ts +11 -7
- package/src/utils/layer/__workshop__/index.ts +21 -17
- package/src/utils/layer/layer.tsx +4 -6
- package/src/utils/portal/__workshop__/index.ts +11 -7
- package/src/utils/srOnly/srOnly.tsx +8 -10
- package/src/utils/virtualList/__workshop__/index.ts +26 -22
- package/src/utils/virtualList/virtualList.tsx +10 -14
- package/dist/sanity-ui.esm.js.map +0 -1
- package/dist/sanity-ui.js.map +0 -1
- package/src/__workshop__/color/overview.tsx +0 -101
- package/src/__workshop__/index.ts +0 -10
- package/src/icons/__workshop__/.eslintrc +0 -5
- package/src/icons/__workshop__/index.tsx +0 -6
- package/src/icons/__workshop__/overview.tsx +0 -76
- package/src/styles/compose.ts +0 -35
- package/src/utils/srOnly/__workshop__/.eslintrc +0 -5
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/text',
|
|
6
|
+
title: 'Text',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'default',
|
|
10
|
+
title: 'Text',
|
|
11
|
+
component: lazy(() => import('./example')),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'colored',
|
|
15
|
+
title: 'Colored text',
|
|
16
|
+
component: lazy(() => import('./colored')),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'optical-alignment',
|
|
20
|
+
title: 'Optical alignment',
|
|
21
|
+
component: lazy(() => import('./opticalAlignment')),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
})
|
|
@@ -1,53 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {css, FlattenSimpleInterpolation} from 'styled-components'
|
|
2
2
|
import {ThemeProps} from '../../styles'
|
|
3
3
|
|
|
4
4
|
export function textBaseStyle(
|
|
5
5
|
props: {$accent?: boolean; $muted?: boolean} & ThemeProps
|
|
6
|
-
):
|
|
6
|
+
): FlattenSimpleInterpolation {
|
|
7
7
|
const {$accent, $muted, theme} = props
|
|
8
8
|
const {weights} = theme.sanity.fonts.text
|
|
9
9
|
|
|
10
|
-
return
|
|
11
|
-
color:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
color:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
10
|
+
return css`
|
|
11
|
+
color: var(--card-fg-color);
|
|
12
|
+
|
|
13
|
+
${$accent &&
|
|
14
|
+
css`
|
|
15
|
+
color: var(--card-accent-fg-color);
|
|
16
|
+
`}
|
|
17
|
+
|
|
18
|
+
${$muted &&
|
|
19
|
+
css`
|
|
20
|
+
color: var(--card-muted-fg-color);
|
|
21
|
+
`}
|
|
22
|
+
|
|
23
|
+
& code {
|
|
24
|
+
font-family: ${theme.sanity.fonts.code.family};
|
|
25
|
+
border-radius: 1px;
|
|
26
|
+
background-color: var(--card-code-bg-color);
|
|
27
|
+
color: var(--card-code-fg-color);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
& a {
|
|
31
|
+
text-decoration: none;
|
|
32
|
+
border-radius: 1px;
|
|
33
|
+
color: var(--card-link-color);
|
|
34
|
+
outline: none;
|
|
35
|
+
|
|
36
|
+
@media (hover: hover) {
|
|
37
|
+
&:hover {
|
|
38
|
+
text-decoration: underline;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:focus {
|
|
43
|
+
box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:focus:not(:focus-visible) {
|
|
47
|
+
box-shadow: none;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
& strong {
|
|
52
|
+
font-weight: ${weights.bold};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
& [data-sanity-icon] {
|
|
56
|
+
vertical-align: baseline;
|
|
57
|
+
}
|
|
58
|
+
`
|
|
53
59
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
2
|
import styled from 'styled-components'
|
|
3
3
|
import {useArrayProp} from '../../hooks'
|
|
4
|
-
import {compose} from '../../styles'
|
|
5
4
|
import {
|
|
6
5
|
ResponsiveFontStyleProps,
|
|
7
6
|
responsiveTextAlignStyle,
|
|
@@ -29,22 +28,18 @@ export interface TextProps {
|
|
|
29
28
|
weight?: ThemeFontWeightKey
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
const Root =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
textBaseStyle,
|
|
37
|
-
])
|
|
31
|
+
const Root = styled.div<ResponsiveFontStyleProps>(
|
|
32
|
+
responsiveTextFont,
|
|
33
|
+
responsiveTextAlignStyle,
|
|
34
|
+
textBaseStyle
|
|
38
35
|
)
|
|
39
36
|
|
|
40
|
-
const SpanWithTextOverflow =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
47
|
-
)
|
|
37
|
+
const SpanWithTextOverflow = styled.span`
|
|
38
|
+
display: block;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
text-overflow: ellipsis;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
`
|
|
48
43
|
|
|
49
44
|
/**
|
|
50
45
|
* @public
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/text-area',
|
|
6
|
+
title: 'TextArea',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'plain',
|
|
10
|
+
title: 'Plain',
|
|
11
|
+
component: lazy(() => import('./plain')),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
})
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
2
|
import styled from 'styled-components'
|
|
3
3
|
import {useForwardedRef, useCustomValidity, useArrayProp} from '../../hooks'
|
|
4
|
-
import {compose} from '../../styles'
|
|
5
4
|
import {
|
|
6
5
|
responsiveInputPaddingStyle,
|
|
7
6
|
responsiveRadiusStyle,
|
|
@@ -28,30 +27,24 @@ export interface TextAreaProps extends ResponsiveRadiusProps {
|
|
|
28
27
|
weight?: ThemeFontWeightKey
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
const Root =
|
|
30
|
+
const Root = styled.span(textInputRootStyle)
|
|
32
31
|
|
|
33
|
-
const InputRoot =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
})
|
|
40
|
-
)
|
|
32
|
+
const InputRoot = styled.span`
|
|
33
|
+
flex: 1;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
display: block;
|
|
36
|
+
position: relative;
|
|
37
|
+
`
|
|
41
38
|
|
|
42
|
-
const Input =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
textInputFontSizeStyle,
|
|
47
|
-
])
|
|
39
|
+
const Input = styled.textarea<TextInputResponsivePaddingStyleProps & TextInputInputStyleProps>(
|
|
40
|
+
responsiveInputPaddingStyle,
|
|
41
|
+
textInputBaseStyle,
|
|
42
|
+
textInputFontSizeStyle
|
|
48
43
|
)
|
|
49
44
|
|
|
50
|
-
const Presentation =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
textInputRepresentationStyle,
|
|
54
|
-
])
|
|
45
|
+
const Presentation = styled.div<ResponsiveRadiusStyleProps & TextInputRepresentationStyleProps>(
|
|
46
|
+
responsiveRadiusStyle,
|
|
47
|
+
textInputRepresentationStyle
|
|
55
48
|
)
|
|
56
49
|
|
|
57
50
|
/**
|
|
@@ -1,45 +1,49 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/text-input',
|
|
6
|
+
title: 'TextInput',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'plain',
|
|
10
|
+
title: 'Plain',
|
|
11
|
+
component: lazy(() => import('./plain')),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'custom-validity',
|
|
15
|
+
title: 'Custom validity',
|
|
16
|
+
component: lazy(() => import('./customValidity')),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'typed',
|
|
20
|
+
title: 'Typed',
|
|
21
|
+
component: lazy(() => import('./typed')),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'tones',
|
|
25
|
+
title: 'Tones',
|
|
26
|
+
component: lazy(() => import('./tones')),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'clear-button',
|
|
30
|
+
title: 'Clear button',
|
|
31
|
+
component: lazy(() => import('./clearButton')),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'read-only',
|
|
35
|
+
title: 'Read only',
|
|
36
|
+
component: lazy(() => import('./readOnly')),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'multiple-tones',
|
|
40
|
+
title: 'Multiple tones',
|
|
41
|
+
component: lazy(() => import('./multipleTones')),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'states',
|
|
45
|
+
title: 'States',
|
|
46
|
+
component: lazy(() => import('./states')),
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {icons, IconSymbol} from '@sanity/icons'
|
|
2
2
|
import {Container, Flex, Stack, Text, TextInput} from '@sanity/ui'
|
|
3
|
-
import {
|
|
3
|
+
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
4
|
+
import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop/plugin-perf'
|
|
4
5
|
import {fireEvent} from '@testing-library/dom'
|
|
5
6
|
import {useCallback, useState} from 'react'
|
|
6
7
|
import {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {createElement, forwardRef, isValidElement,
|
|
2
|
+
import {createElement, forwardRef, isValidElement, useCallback, useMemo} from 'react'
|
|
3
3
|
import {isValidElementType} from 'react-is'
|
|
4
4
|
import styled from 'styled-components'
|
|
5
5
|
import {EMPTY_RECORD} from '../../constants'
|
|
6
6
|
import {useArrayProp, useForwardedRef, useCustomValidity} from '../../hooks'
|
|
7
|
-
import {compose} from '../../styles'
|
|
8
7
|
import {
|
|
9
8
|
responsiveRadiusStyle,
|
|
10
9
|
ResponsiveRadiusStyleProps,
|
|
@@ -74,83 +73,64 @@ export interface TextInputProps {
|
|
|
74
73
|
|
|
75
74
|
const CLEAR_BUTTON_BOX_STYLE: React.CSSProperties = {zIndex: 2}
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
const Root = memo(styled(Card)['attrs']({forwardedAs: 'span'})(textInputRootStyle))
|
|
76
|
+
const Root = styled(Card).attrs({forwardedAs: 'span'})(textInputRootStyle)
|
|
79
77
|
|
|
80
|
-
const InputRoot =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
})
|
|
87
|
-
)
|
|
78
|
+
const InputRoot = styled.span`
|
|
79
|
+
flex: 1;
|
|
80
|
+
min-width: 0;
|
|
81
|
+
display: block;
|
|
82
|
+
position: relative;
|
|
83
|
+
`
|
|
88
84
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
borderTopRightRadius: 0,
|
|
93
|
-
borderBottomRightRadius: 0,
|
|
85
|
+
const Prefix = styled(Card).attrs({forwardedAs: 'span'})`
|
|
86
|
+
border-top-right-radius: 0;
|
|
87
|
+
border-bottom-right-radius: 0;
|
|
94
88
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
)
|
|
89
|
+
& > span {
|
|
90
|
+
display: block;
|
|
91
|
+
margin: -1px;
|
|
92
|
+
}
|
|
93
|
+
`
|
|
101
94
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
borderTopLeftRadius: 0,
|
|
106
|
-
borderBottomLeftRadius: 0,
|
|
95
|
+
const Suffix = styled(Card).attrs({forwardedAs: 'span'})`
|
|
96
|
+
border-top-left-radius: 0;
|
|
97
|
+
border-bottom-left-radius: 0;
|
|
107
98
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
const Input = memo(
|
|
116
|
-
compose<TextInputResponsivePaddingStyleProps & TextInputInputStyleProps>('input', [
|
|
117
|
-
responsiveInputPaddingStyle,
|
|
118
|
-
textInputBaseStyle,
|
|
119
|
-
textInputFontSizeStyle,
|
|
120
|
-
])
|
|
121
|
-
)
|
|
99
|
+
& > span {
|
|
100
|
+
display: block;
|
|
101
|
+
margin: -1px;
|
|
102
|
+
}
|
|
103
|
+
`
|
|
122
104
|
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
])
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
const LeftBox = memo(
|
|
131
|
-
styled(Box)({
|
|
132
|
-
position: 'absolute',
|
|
133
|
-
top: 0,
|
|
134
|
-
left: 0,
|
|
135
|
-
})
|
|
105
|
+
const Input = styled.input<TextInputResponsivePaddingStyleProps & TextInputInputStyleProps>(
|
|
106
|
+
responsiveInputPaddingStyle,
|
|
107
|
+
textInputBaseStyle,
|
|
108
|
+
textInputFontSizeStyle
|
|
136
109
|
)
|
|
137
110
|
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
top: 0,
|
|
142
|
-
right: 0,
|
|
143
|
-
})
|
|
111
|
+
const Presentation = styled.span<ResponsiveRadiusStyleProps & TextInputRepresentationStyleProps>(
|
|
112
|
+
responsiveRadiusStyle,
|
|
113
|
+
textInputRepresentationStyle
|
|
144
114
|
)
|
|
145
115
|
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
116
|
+
const LeftBox = styled(Box)`
|
|
117
|
+
position: absolute;
|
|
118
|
+
top: 0;
|
|
119
|
+
left: 0;
|
|
120
|
+
`
|
|
121
|
+
|
|
122
|
+
const RightBox = styled(Box)`
|
|
123
|
+
position: absolute;
|
|
124
|
+
top: 0;
|
|
125
|
+
right: 0;
|
|
126
|
+
`
|
|
127
|
+
|
|
128
|
+
const RightCard = styled(Card)`
|
|
129
|
+
background-color: transparent;
|
|
130
|
+
position: absolute;
|
|
131
|
+
top: 0;
|
|
132
|
+
right: 0;
|
|
133
|
+
`
|
|
154
134
|
|
|
155
135
|
/**
|
|
156
136
|
* @public
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/tooltip',
|
|
6
|
+
title: 'Tooltip',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'props',
|
|
10
|
+
title: 'Props',
|
|
11
|
+
component: lazy(() => import('./props')),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
})
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
useState,
|
|
19
19
|
CSSProperties,
|
|
20
20
|
ForwardedRef,
|
|
21
|
-
memo,
|
|
22
21
|
} from 'react'
|
|
23
22
|
import styled from 'styled-components'
|
|
24
23
|
import {FLOATING_STATIC_SIDES} from '../../constants'
|
|
@@ -47,11 +46,9 @@ export interface TooltipProps extends Omit<LayerProps, 'as'> {
|
|
|
47
46
|
shadow?: number | number[]
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
const Root =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
)
|
|
49
|
+
const Root = styled(Layer)`
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
`
|
|
55
52
|
|
|
56
53
|
/**
|
|
57
54
|
* @public
|