@sanity/ui 1.0.0-next.3 → 1.0.1
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} +889 -2678
- package/dist/index.esm.js.map +1 -0
- package/dist/{sanity-ui.js → index.js} +883 -2688
- package/dist/index.js.map +1 -0
- package/package.json +114 -23
- package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- 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/global.ts +6 -0
- 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 +50 -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,17 +1,11 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
|
+
import styled from 'styled-components'
|
|
2
3
|
import {useArrayProp} from '../../hooks'
|
|
3
|
-
import {compose} from '../../styles'
|
|
4
4
|
import {
|
|
5
|
+
flexItemStyle,
|
|
5
6
|
FlexItemStyleProps,
|
|
7
|
+
responsiveFlexStyle,
|
|
6
8
|
ResponsiveFlexStyleProps,
|
|
7
|
-
__tmp_flexItemStyle,
|
|
8
|
-
__tmp_flexStyle,
|
|
9
|
-
responsiveFlexAlignStyle,
|
|
10
|
-
responsiveFlexDirectionStyle,
|
|
11
|
-
responsiveFlexGapStyle,
|
|
12
|
-
responsiveFlexItemStyle,
|
|
13
|
-
responsiveFlexJustifyStyle,
|
|
14
|
-
responsiveFlexWrapStyle,
|
|
15
9
|
} from '../../styles/internal'
|
|
16
10
|
import {Box, BoxProps} from '../box'
|
|
17
11
|
import {ResponsiveFlexProps, ResponsiveFlexItemProps} from '../types'
|
|
@@ -26,19 +20,9 @@ export interface FlexProps
|
|
|
26
20
|
gap?: number | number[]
|
|
27
21
|
}
|
|
28
22
|
|
|
29
|
-
const Root =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
__tmp_flexItemStyle,
|
|
33
|
-
responsiveFlexItemStyle,
|
|
34
|
-
// flex
|
|
35
|
-
__tmp_flexStyle,
|
|
36
|
-
responsiveFlexAlignStyle,
|
|
37
|
-
responsiveFlexGapStyle,
|
|
38
|
-
responsiveFlexWrapStyle,
|
|
39
|
-
responsiveFlexJustifyStyle,
|
|
40
|
-
responsiveFlexDirectionStyle,
|
|
41
|
-
])
|
|
23
|
+
const Root = styled(Box)<FlexItemStyleProps & ResponsiveFlexStyleProps>(
|
|
24
|
+
flexItemStyle,
|
|
25
|
+
responsiveFlexStyle
|
|
42
26
|
)
|
|
43
27
|
|
|
44
28
|
/**
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/grid',
|
|
6
|
+
title: 'Grid',
|
|
7
|
+
stories: [
|
|
8
|
+
{name: 'responsive', title: 'Responsive', component: lazy(() => import('./responsive'))},
|
|
9
|
+
],
|
|
10
|
+
})
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
|
+
import styled from 'styled-components'
|
|
2
3
|
import {useArrayProp} from '../../hooks'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
responsiveGridAutoColsStyle,
|
|
6
|
-
responsiveGridAutoFlowStyle,
|
|
7
|
-
responsiveGridAutoRowsStyle,
|
|
8
|
-
responsiveGridColumnsStyle,
|
|
9
|
-
responsiveGridGapStyle,
|
|
10
|
-
responsiveGridGapXStyle,
|
|
11
|
-
responsiveGridGapYStyle,
|
|
12
|
-
responsiveGridRowsStyle,
|
|
13
|
-
ResponsiveGridStyleProps,
|
|
14
|
-
__tmp_gridStyle,
|
|
15
|
-
} from '../../styles/internal'
|
|
4
|
+
import {responsiveGridStyle, ResponsiveGridStyleProps} from '../../styles/internal'
|
|
16
5
|
import {Box, BoxProps} from '../box'
|
|
17
6
|
import {ResponsiveGridProps} from '../types'
|
|
18
7
|
|
|
@@ -21,19 +10,7 @@ import {ResponsiveGridProps} from '../types'
|
|
|
21
10
|
*/
|
|
22
11
|
export interface GridProps extends Omit<BoxProps, 'display'>, ResponsiveGridProps {}
|
|
23
12
|
|
|
24
|
-
const Root =
|
|
25
|
-
compose<ResponsiveGridStyleProps>(Box, [
|
|
26
|
-
__tmp_gridStyle,
|
|
27
|
-
responsiveGridAutoFlowStyle,
|
|
28
|
-
responsiveGridAutoRowsStyle,
|
|
29
|
-
responsiveGridAutoColsStyle,
|
|
30
|
-
responsiveGridColumnsStyle,
|
|
31
|
-
responsiveGridRowsStyle,
|
|
32
|
-
responsiveGridGapStyle,
|
|
33
|
-
responsiveGridGapXStyle,
|
|
34
|
-
responsiveGridGapYStyle,
|
|
35
|
-
])
|
|
36
|
-
)
|
|
13
|
+
const Root = styled(Box)<ResponsiveGridStyleProps>(responsiveGridStyle)
|
|
37
14
|
|
|
38
15
|
/**
|
|
39
16
|
* @public
|
|
@@ -1,15 +1,19 @@
|
|
|
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
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/heading',
|
|
6
|
+
title: 'Heading',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'plain',
|
|
10
|
+
title: 'Plain',
|
|
11
|
+
component: lazy(() => import('./plain')),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'optical-alignment',
|
|
15
|
+
title: 'Optical alignment',
|
|
16
|
+
component: lazy(() => import('./opticalAlignment')),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
})
|
|
@@ -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
|
responsiveHeadingFont,
|
|
@@ -31,22 +30,16 @@ export interface HeadingProps {
|
|
|
31
30
|
weight?: ThemeFontWeightKey
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
const Root =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
responsiveTextAlignStyle,
|
|
38
|
-
responsiveHeadingFont,
|
|
39
|
-
])
|
|
40
|
-
)
|
|
33
|
+
const Root = styled.div<
|
|
34
|
+
HeadingStyleProps & ResponsiveTextAlignStyleProps & ResponsiveFontStyleProps
|
|
35
|
+
>(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont)
|
|
41
36
|
|
|
42
|
-
const SpanWithTextOverflow =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
49
|
-
)
|
|
37
|
+
const SpanWithTextOverflow = styled.span`
|
|
38
|
+
display: block;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
text-overflow: ellipsis;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
`
|
|
50
43
|
|
|
51
44
|
/**
|
|
52
45
|
* @public
|
|
@@ -1,42 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {css, FlattenSimpleInterpolation} from 'styled-components'
|
|
2
2
|
import {ThemeProps} from '../../styles'
|
|
3
3
|
import {HeadingStyleProps} from './types'
|
|
4
4
|
|
|
5
|
-
export function headingBaseStyle(
|
|
5
|
+
export function headingBaseStyle(
|
|
6
|
+
props: HeadingStyleProps & ThemeProps
|
|
7
|
+
): FlattenSimpleInterpolation {
|
|
6
8
|
const {$accent, $muted, theme} = props
|
|
7
9
|
|
|
8
|
-
return
|
|
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
|
-
|
|
10
|
+
return css`
|
|
11
|
+
${$accent &&
|
|
12
|
+
css`
|
|
13
|
+
color: var(--card-accent-fg-color);
|
|
14
|
+
`}
|
|
15
|
+
|
|
16
|
+
${$muted &&
|
|
17
|
+
css`
|
|
18
|
+
color: var(--card-muted-fg-color);
|
|
19
|
+
`}
|
|
20
|
+
|
|
21
|
+
& code {
|
|
22
|
+
font-family: ${theme.sanity.fonts.code.family};
|
|
23
|
+
border-radius: 1px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
& a {
|
|
27
|
+
text-decoration: none;
|
|
28
|
+
border-radius: 1px;
|
|
29
|
+
color: var(--card-link-color);
|
|
30
|
+
outline: none;
|
|
31
|
+
|
|
32
|
+
@media (hover: hover) {
|
|
33
|
+
&:hover {
|
|
34
|
+
text-decoration: underline;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&:focus {
|
|
39
|
+
box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:focus:not(:focus-visible) {
|
|
43
|
+
box-shadow: none;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
& [data-sanity-icon] {
|
|
48
|
+
vertical-align: baseline;
|
|
49
|
+
}
|
|
50
|
+
`
|
|
42
51
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/inline',
|
|
6
|
+
title: 'Inline',
|
|
7
|
+
stories: [{name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))}],
|
|
8
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {forwardRef,
|
|
1
|
+
import {forwardRef, useMemo} from 'react'
|
|
2
|
+
import styled from 'styled-components'
|
|
2
3
|
import {useArrayProp} from '../../hooks'
|
|
3
|
-
import {compose} from '../../styles'
|
|
4
4
|
import {Box, BoxProps} from '../box'
|
|
5
5
|
import {childrenToElementArray} from '../helpers'
|
|
6
6
|
import {inlineBaseStyle, inlineSpaceStyle} from './styles'
|
|
@@ -13,9 +13,7 @@ export interface InlineProps extends Omit<BoxProps, 'display'> {
|
|
|
13
13
|
space?: number | number[]
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const Root =
|
|
17
|
-
compose<ResponsiveInlineSpaceStyleProps>(Box, [inlineBaseStyle, inlineSpaceStyle])
|
|
18
|
-
)
|
|
16
|
+
const Root = styled(Box)<ResponsiveInlineSpaceStyleProps>(inlineBaseStyle, inlineSpaceStyle)
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
* @public
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/kbd',
|
|
6
|
+
title: 'KBD',
|
|
7
|
+
stories: [{name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))}],
|
|
8
|
+
})
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {forwardRef
|
|
2
|
-
import {
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
|
+
import styled, {css} from 'styled-components'
|
|
3
3
|
import {useArrayProp} from '../../hooks'
|
|
4
|
-
import {compose} from '../../styles'
|
|
5
4
|
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
6
5
|
import {Box} from '../box'
|
|
7
6
|
import {Code} from '../code'
|
|
@@ -16,19 +15,19 @@ export interface KBDProps {
|
|
|
16
15
|
radius?: number | number[]
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
function kbdStyle()
|
|
20
|
-
return
|
|
21
|
-
background:
|
|
22
|
-
font:
|
|
23
|
-
|
|
18
|
+
function kbdStyle() {
|
|
19
|
+
return css`
|
|
20
|
+
background: var(--card-bg-color);
|
|
21
|
+
font: inherit;
|
|
22
|
+
box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
display:
|
|
27
|
-
}
|
|
28
|
-
|
|
24
|
+
&:not([hidden]) {
|
|
25
|
+
display: inline-block;
|
|
26
|
+
}
|
|
27
|
+
`
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
const Root =
|
|
30
|
+
const Root = styled.kbd<ResponsiveRadiusStyleProps>(responsiveRadiusStyle, kbdStyle)
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
33
|
* @public
|
|
@@ -1,15 +1,19 @@
|
|
|
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
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/label',
|
|
6
|
+
title: 'Label',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'plain',
|
|
10
|
+
title: 'Plain',
|
|
11
|
+
component: lazy(() => import('./plain')),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'optical-alignment',
|
|
15
|
+
title: 'Optical alignment',
|
|
16
|
+
component: lazy(() => import('./opticalAlignment')),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
})
|
|
@@ -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 {responsiveLabelFont, responsiveTextAlignStyle} from '../../styles/internal'
|
|
6
5
|
import {ThemeFontWeightKey} from '../../theme'
|
|
7
6
|
import {TextAlign} from '../../types'
|
|
@@ -25,23 +24,19 @@ export interface LabelProps {
|
|
|
25
24
|
weight?: ThemeFontWeightKey
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
const Root =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}>('div', [responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle])
|
|
35
|
-
)
|
|
27
|
+
const Root = styled.div<{
|
|
28
|
+
$accent?: boolean
|
|
29
|
+
$align: TextAlign[]
|
|
30
|
+
$muted: boolean
|
|
31
|
+
$size: number[]
|
|
32
|
+
}>(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle)
|
|
36
33
|
|
|
37
|
-
const SpanWithTextOverflow =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
)
|
|
34
|
+
const SpanWithTextOverflow = styled.span`
|
|
35
|
+
display: block;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
text-overflow: ellipsis;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
`
|
|
45
40
|
|
|
46
41
|
/**
|
|
47
42
|
* @public
|
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {css, FlattenSimpleInterpolation} from 'styled-components'
|
|
2
2
|
import {ThemeProps} from '../../styles'
|
|
3
3
|
|
|
4
4
|
export function labelBaseStyle(
|
|
5
5
|
props: {$accent?: boolean; $muted: boolean} & ThemeProps
|
|
6
|
-
):
|
|
6
|
+
): FlattenSimpleInterpolation {
|
|
7
7
|
const {$accent, $muted, theme} = props
|
|
8
8
|
const {fonts} = theme.sanity
|
|
9
9
|
|
|
10
|
-
return
|
|
11
|
-
|
|
10
|
+
return css`
|
|
11
|
+
text-transform: uppercase;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
${$accent &&
|
|
14
|
+
css`
|
|
15
|
+
color: var(--card-accent-fg-color);
|
|
16
|
+
`}
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
${$muted &&
|
|
19
|
+
css`
|
|
20
|
+
color: var(--card-muted-fg-color);
|
|
21
|
+
`}
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
23
|
+
& code {
|
|
24
|
+
font-family: ${fonts.code.family};
|
|
25
|
+
border-radius: 1px;
|
|
26
|
+
}
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
28
|
+
& a {
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
border-radius: 1px;
|
|
31
|
+
}
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
33
|
+
& [data-sanity-icon] {
|
|
34
|
+
vertical-align: baseline;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
31
37
|
}
|
|
@@ -1,35 +1,39 @@
|
|
|
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
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/popover',
|
|
6
|
+
title: 'Popover',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'test',
|
|
10
|
+
title: 'Test',
|
|
11
|
+
component: lazy(() => import('./TestStory')),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'plain',
|
|
15
|
+
title: 'Plain',
|
|
16
|
+
component: lazy(() => import('./PlainStory')),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'recursive',
|
|
20
|
+
title: 'Recursive',
|
|
21
|
+
component: lazy(() => import('./RecursiveStory')),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'match-ref-width',
|
|
25
|
+
title: 'Match reference width',
|
|
26
|
+
component: lazy(() => import('./MatchReferenceWidthStory')),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'margins',
|
|
30
|
+
title: 'Margins',
|
|
31
|
+
component: lazy(() => import('./MarginsStory')),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'aligned',
|
|
35
|
+
title: 'Aligned',
|
|
36
|
+
component: lazy(() => import('./AlignedStory')),
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
})
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {PopoverMargins} from '../../types'
|
|
2
2
|
|
|
3
3
|
export const DEFAULT_POPOVER_DISTANCE = 4
|
|
4
|
-
|
|
5
4
|
export const DEFAULT_POPOVER_PADDING = 4
|
|
6
|
-
|
|
7
5
|
export const DEFAULT_POPOVER_ARROW_WIDTH = 27
|
|
8
6
|
export const DEFAULT_POPOVER_ARROW_HEIGHT = 11
|
|
9
|
-
|
|
10
7
|
export const DEFAULT_POPOVER_MARGINS: PopoverMargins = [0, 0, 0, 0]
|