@sanity/ui 2.10.0-corel.0 → 2.10.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/dist/_chunks-cjs/getTheme_v2.js +110 -54
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +110 -54
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +110 -54
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.d.mts +43 -54
- package/dist/index.d.ts +43 -54
- package/dist/index.esm.js +3323 -3046
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3322 -3046
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3323 -3046
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +9 -9
- package/dist/theme.d.ts +9 -9
- package/dist/theme.esm.js +1144 -592
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +1144 -592
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1144 -592
- package/dist/theme.mjs.map +1 -1
- package/package.json +73 -59
- package/src/core/__workshop__/constants.ts +15 -19
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +4 -3
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -3
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -5
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +13 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +31 -39
- package/src/core/components/dialog/dialog.tsx +5 -3
- package/src/core/components/dialog/dialogProvider.tsx +1 -1
- package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/core/components/menu/__workshop__/tones.tsx +5 -6
- package/src/core/components/menu/menu.test.tsx +0 -2
- package/src/core/components/menu/menu.tsx +15 -11
- package/src/core/components/menu/menuButton.tsx +16 -38
- package/src/core/components/menu/menuGroup.tsx +4 -3
- package/src/core/components/menu/menuItem.tsx +5 -2
- package/src/core/components/tab/tabList.tsx +4 -12
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/toast.test.tsx +0 -1
- package/src/core/components/toast/toast.tsx +3 -3
- package/src/core/components/toast/toastProvider.tsx +8 -8
- package/src/core/components/toast/toastState.ts +6 -0
- package/src/core/components/tree/tree.tsx +1 -1
- package/src/core/components/tree/treeGroup.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +1 -1
- package/src/core/constants.ts +1 -1
- package/src/core/hooks/useArrayProp.ts +14 -9
- package/src/core/hooks/useDelayedState.ts +1 -1
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +2 -2
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -1
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -1
- package/src/core/lib/globalScope.ts +0 -1
- package/src/core/primitives/avatar/avatar.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +2 -5
- package/src/core/primitives/badge/__workshop__/tones.tsx +6 -13
- package/src/core/primitives/badge/badge.tsx +1 -1
- package/src/core/primitives/box/box.tsx +1 -1
- package/src/core/primitives/button/__workshop__/custom.tsx +4 -3
- package/src/core/primitives/button/__workshop__/props.tsx +1 -1
- package/src/core/primitives/button/button.tsx +7 -12
- package/src/core/primitives/button/styles.ts +1 -1
- package/src/core/primitives/card/__workshop__/allTones.tsx +6 -8
- package/src/core/primitives/card/__workshop__/asButton.tsx +42 -24
- package/src/core/primitives/card/__workshop__/asComponent.tsx +2 -2
- package/src/core/primitives/card/__workshop__/checkered.tsx +17 -7
- package/src/core/primitives/card/__workshop__/interactive.tsx +10 -3
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +5 -3
- package/src/core/primitives/card/__workshop__/props.tsx +7 -5
- package/src/core/primitives/card/__workshop__/selected.tsx +4 -1
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +6 -0
- package/src/core/primitives/code/__workshop__/props.tsx +1 -1
- package/src/core/primitives/code/code.tsx +1 -2
- package/src/core/primitives/container/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +3 -3
- package/src/core/primitives/flex/flex.tsx +1 -5
- package/src/core/primitives/grid/__workshop__/responsive.tsx +12 -12
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +13 -25
- package/src/core/primitives/heading/heading.tsx +2 -2
- package/src/core/primitives/inline/__workshop__/plain.tsx +3 -3
- package/src/core/primitives/inline/inline.tsx +0 -1
- package/src/core/primitives/kbd/kbd.tsx +1 -1
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +6 -6
- package/src/core/primitives/label/label.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -2
- package/src/core/primitives/popover/popover.tsx +10 -10
- package/src/core/primitives/radio/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +1 -1
- package/src/core/primitives/text/__workshop__/example.tsx +6 -6
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +11 -21
- package/src/core/primitives/text/styles.ts +0 -1
- package/src/core/primitives/text/text.tsx +3 -5
- package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -5
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -2
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +6 -2
- package/src/core/primitives/textInput/__workshop__/tones.tsx +38 -0
- package/src/core/primitives/tooltip/tooltip.tsx +1 -2
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -1
- package/src/core/styles/card/_cardColorStyle.ts +8 -8
- package/src/core/styles/flex/flexStyle.ts +0 -18
- package/src/core/styles/flex/types.ts +0 -2
- package/src/core/theme/__workshop__/build/story.tsx +1 -3
- package/src/core/theme/__workshop__/debug/story.tsx +18 -13
- package/src/core/theme/theme.test.tsx +0 -1
- package/src/core/theme/themeColorProvider.tsx +1 -1
- package/src/core/theme/themeProvider.tsx +5 -7
- package/src/core/utils/arrow/arrow.tsx +1 -1
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -1
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +3 -1
- package/src/core/utils/elementQuery/elementQuery.tsx +16 -17
- package/src/core/utils/layer/layer.test.tsx +0 -1
- package/src/core/utils/layer/layer.tsx +9 -1
- package/src/core/utils/layer/layerProvider.tsx +2 -2
- package/src/core/utils/portal/portal.test.tsx +0 -1
- package/src/core/utils/portal/portalProvider.tsx +1 -1
- package/src/core/utils/srOnly/srOnly.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +10 -3
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +12 -8
- package/src/theme/build/merge.ts +0 -2
- package/src/theme/build/renderColorTheme.ts +54 -232
- package/src/theme/defaults/colorTokens.ts +13 -18
- package/src/theme/system/color/_constants.ts +6 -10
- package/src/theme/system/css.ts +1 -2
- package/src/theme/versioning/themeColor_v0_v2.ts +26 -26
- package/src/theme/versioning/v0_v2.ts +4 -4
- package/src/core/components/autocomplete/__workshop__/.eslintrc +0 -5
- package/src/core/components/breadcrumbs/__workshop__/.eslintrc +0 -5
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
- package/src/core/components/dialog/__workshop__/.eslintrc +0 -5
- package/src/core/components/hotkeys/__workshop__/.eslintrc +0 -5
- package/src/core/components/menu/__workshop__/.eslintrc +0 -5
- package/src/core/components/skeleton/__workshop__/.eslintrc +0 -5
- package/src/core/components/tab/__workshop__/.eslintrc +0 -5
- package/src/core/components/toast/__workshop__/.eslintrc +0 -5
- package/src/core/components/tree/__workshop__/.eslintrc +0 -5
- package/src/core/hooks/useElementRect/__workshop__/.eslintrc +0 -5
- package/src/core/hooks/useMediaIndex/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/avatar/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/badge/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/box/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/button/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/card/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/checkbox/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/code/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/container/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/flex/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/grid/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/heading/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/inline/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/kbd/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/label/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/popover/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/radio/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/select/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/spinner/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/stack/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/switch/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/text/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/textArea/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/textInput/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/textInput/__workshop__/multipleTones.tsx +0 -20
- package/src/core/primitives/tooltip/__workshop__/.eslintrc +0 -5
- package/src/core/theme/__workshop__/.eslintrc +0 -5
- package/src/core/utils/boundaryElement/__workshop__/.eslintrc +0 -5
- package/src/core/utils/elementQuery/__workshop__/.eslintrc +0 -5
- package/src/core/utils/layer/__workshop__/.eslintrc +0 -5
- package/src/core/utils/portal/__workshop__/.eslintrc +0 -5
- package/src/core/utils/virtualList/__workshop__/.eslintrc +0 -5
|
@@ -5,7 +5,7 @@ export default function AsButtonStory() {
|
|
|
5
5
|
const tones = Object.entries(WORKSHOP_CARD_TONE_OPTIONS)
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
|
-
<Flex align="center" height="fill" justify="center" padding={
|
|
8
|
+
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
9
9
|
<Container>
|
|
10
10
|
<Grid columns={3} gap={2}>
|
|
11
11
|
<Box>
|
|
@@ -18,14 +18,20 @@ export default function AsButtonStory() {
|
|
|
18
18
|
__unstable_focusRing
|
|
19
19
|
as="button"
|
|
20
20
|
key={tone}
|
|
21
|
-
padding={
|
|
21
|
+
padding={3}
|
|
22
22
|
style={{textAlign: 'center'}}
|
|
23
23
|
tone={tone}
|
|
24
24
|
>
|
|
25
25
|
<Stack space={2}>
|
|
26
|
-
<Text weight="medium">
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
<Text size={1} weight="medium">
|
|
27
|
+
{title}
|
|
28
|
+
</Text>
|
|
29
|
+
<Text muted size={1}>
|
|
30
|
+
Muted
|
|
31
|
+
</Text>
|
|
32
|
+
<Text accent size={1}>
|
|
33
|
+
Accent
|
|
34
|
+
</Text>
|
|
29
35
|
</Stack>
|
|
30
36
|
</Card>
|
|
31
37
|
))}
|
|
@@ -43,14 +49,20 @@ export default function AsButtonStory() {
|
|
|
43
49
|
as="button"
|
|
44
50
|
disabled
|
|
45
51
|
key={tone}
|
|
46
|
-
padding={
|
|
52
|
+
padding={3}
|
|
47
53
|
style={{textAlign: 'center'}}
|
|
48
54
|
tone={tone}
|
|
49
55
|
>
|
|
50
56
|
<Stack space={2}>
|
|
51
|
-
<Text weight="medium">
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
<Text size={1} weight="medium">
|
|
58
|
+
{title}
|
|
59
|
+
</Text>
|
|
60
|
+
<Text size={1} muted>
|
|
61
|
+
Muted
|
|
62
|
+
</Text>
|
|
63
|
+
<Text accent size={1}>
|
|
64
|
+
Accent
|
|
65
|
+
</Text>
|
|
54
66
|
</Stack>
|
|
55
67
|
</Card>
|
|
56
68
|
))}
|
|
@@ -63,21 +75,27 @@ export default function AsButtonStory() {
|
|
|
63
75
|
</Text>
|
|
64
76
|
<Stack marginTop={3} space={2}>
|
|
65
77
|
{tones.map(([title, tone]) => (
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
</
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
<Card
|
|
79
|
+
__unstable_focusRing
|
|
80
|
+
as="button"
|
|
81
|
+
key={tone}
|
|
82
|
+
padding={3}
|
|
83
|
+
selected
|
|
84
|
+
style={{textAlign: 'center'}}
|
|
85
|
+
tone={tone}
|
|
86
|
+
>
|
|
87
|
+
<Stack space={2}>
|
|
88
|
+
<Text size={1} weight="medium">
|
|
89
|
+
{title}
|
|
90
|
+
</Text>
|
|
91
|
+
<Text size={1} muted>
|
|
92
|
+
Muted
|
|
93
|
+
</Text>
|
|
94
|
+
<Text accent size={1}>
|
|
95
|
+
Accent
|
|
96
|
+
</Text>
|
|
97
|
+
</Stack>
|
|
98
|
+
</Card>
|
|
81
99
|
))}
|
|
82
100
|
</Stack>
|
|
83
101
|
</Box>
|
|
@@ -4,7 +4,7 @@ import {forwardRef} from 'react'
|
|
|
4
4
|
const CustomLink = forwardRef(function CustomLink(
|
|
5
5
|
props: {req: string} & Omit<React.HTMLProps<HTMLAnchorElement>, 'as' | 'href'>,
|
|
6
6
|
ref: React.ForwardedRef<HTMLAnchorElement>,
|
|
7
|
-
): React.ReactElement {
|
|
7
|
+
): React.ReactElement<any> {
|
|
8
8
|
const {children, req, ...restProps} = props
|
|
9
9
|
|
|
10
10
|
return (
|
|
@@ -20,7 +20,7 @@ export default function AsComponentStory() {
|
|
|
20
20
|
return (
|
|
21
21
|
<Flex align="center" height="fill" justify="center">
|
|
22
22
|
<Card as={CustomLink} data-as="a" {...props} padding={3}>
|
|
23
|
-
<Text>As component</Text>
|
|
23
|
+
<Text size={1}>As component</Text>
|
|
24
24
|
</Card>
|
|
25
25
|
</Flex>
|
|
26
26
|
)
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import {Card, Flex, Stack} from '@sanity/ui'
|
|
1
|
+
import {Card, Flex, Stack, Text} from '@sanity/ui'
|
|
2
|
+
import {THEME_COLOR_CARD_TONES} from '@sanity/ui/theme'
|
|
2
3
|
|
|
3
4
|
export default function CheckeredStory() {
|
|
4
5
|
return (
|
|
5
6
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
6
7
|
<Stack space={1}>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
{THEME_COLOR_CARD_TONES.map((tone) => (
|
|
9
|
+
<Card
|
|
10
|
+
__unstable_checkered
|
|
11
|
+
border
|
|
12
|
+
key={tone}
|
|
13
|
+
padding={3}
|
|
14
|
+
sizing="border"
|
|
15
|
+
style={{width: 120, height: 60}}
|
|
16
|
+
tone={tone}
|
|
17
|
+
>
|
|
18
|
+
<Text muted size={1}>
|
|
19
|
+
{tone}
|
|
20
|
+
</Text>
|
|
21
|
+
</Card>
|
|
22
|
+
))}
|
|
13
23
|
</Stack>
|
|
14
24
|
</Flex>
|
|
15
25
|
)
|
|
@@ -2,13 +2,20 @@ import {Card, Flex, Stack, Text} from '@sanity/ui'
|
|
|
2
2
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
3
3
|
|
|
4
4
|
export default function InteractiveCardStory() {
|
|
5
|
-
const selected = useBoolean('Selected', false, 'Props')
|
|
6
5
|
const pressed = useBoolean('Pressed', false, 'Props')
|
|
6
|
+
const selected = useBoolean('Selected', false, 'Props')
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
9
|
<Flex align="center" height="fill" justify="center">
|
|
10
|
-
<div
|
|
11
|
-
<Card
|
|
10
|
+
<div>
|
|
11
|
+
<Card
|
|
12
|
+
__unstable_focusRing
|
|
13
|
+
as="button"
|
|
14
|
+
padding={3}
|
|
15
|
+
pressed={pressed}
|
|
16
|
+
selected={selected}
|
|
17
|
+
tabIndex={0}
|
|
18
|
+
>
|
|
12
19
|
<Stack space={3}>
|
|
13
20
|
<Text>
|
|
14
21
|
Text <code>Code</code>
|
|
@@ -64,10 +64,12 @@ function List2() {
|
|
|
64
64
|
|
|
65
65
|
function Preview() {
|
|
66
66
|
return (
|
|
67
|
-
<Flex align="center">
|
|
68
|
-
<Skeleton
|
|
67
|
+
<Flex align="center" gap={2}>
|
|
68
|
+
<Skeleton radius="full" style={{width: 33, height: 33}} />
|
|
69
69
|
<Stack flex={1} space={2}>
|
|
70
|
-
<Text>
|
|
70
|
+
<Text size={1} weight="medium">
|
|
71
|
+
Preview
|
|
72
|
+
</Text>
|
|
71
73
|
<Text muted size={1}>
|
|
72
74
|
Preview
|
|
73
75
|
</Text>
|
|
@@ -13,14 +13,14 @@ export default function PropsStory() {
|
|
|
13
13
|
const border = useBoolean('Border', false, 'Props')
|
|
14
14
|
const checkered = useBoolean('Checkered', false, 'Props')
|
|
15
15
|
const muted = useBoolean('Muted', false, 'Props')
|
|
16
|
-
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS,
|
|
16
|
+
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
17
17
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 0, 'Props')
|
|
18
18
|
const selected = useBoolean('Selected', false, 'Props')
|
|
19
19
|
const shadow = useSelect('Shadow', WORKSHOP_SHADOW_OPTIONS, 0, 'Props')
|
|
20
20
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS, 'default', 'Props')
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<Flex align="center" height="fill" justify="center">
|
|
23
|
+
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
24
24
|
<Card
|
|
25
25
|
__unstable_checkered={checkered}
|
|
26
26
|
as={as}
|
|
@@ -34,14 +34,16 @@ export default function PropsStory() {
|
|
|
34
34
|
tone={tone}
|
|
35
35
|
>
|
|
36
36
|
<Stack space={3}>
|
|
37
|
-
<Text>
|
|
37
|
+
<Text size={1}>
|
|
38
38
|
Card with <code>padding={padding}</code>, <code>tone={tone}</code>, and{' '}
|
|
39
39
|
<code>shadow={shadow}</code>.
|
|
40
40
|
</Text>
|
|
41
|
-
<Text>
|
|
41
|
+
<Text size={1}>
|
|
42
42
|
Text with <a>link</a>.
|
|
43
43
|
</Text>
|
|
44
|
-
<Text accent
|
|
44
|
+
<Text accent size={1}>
|
|
45
|
+
Text with accent color.
|
|
46
|
+
</Text>
|
|
45
47
|
</Stack>
|
|
46
48
|
</Card>
|
|
47
49
|
</Flex>
|
|
@@ -68,12 +68,14 @@ function Preview({selected}: {selected: boolean}) {
|
|
|
68
68
|
return (
|
|
69
69
|
<Flex>
|
|
70
70
|
<Box flex={1}>
|
|
71
|
-
<Text>Title</Text>
|
|
71
|
+
<Text size={1}>Title</Text>
|
|
72
72
|
</Box>
|
|
73
73
|
<Inline space={3}>
|
|
74
74
|
<TextWithTone
|
|
75
75
|
data-selected={selected ? '' : undefined}
|
|
76
76
|
muted
|
|
77
|
+
size={1}
|
|
78
|
+
weight="medium"
|
|
77
79
|
$tone={rootTheme.tone === 'default' ? 'caution' : 'default'}
|
|
78
80
|
>
|
|
79
81
|
<EditIcon />
|
|
@@ -81,6 +83,7 @@ function Preview({selected}: {selected: boolean}) {
|
|
|
81
83
|
<TextWithTone
|
|
82
84
|
data-selected={selected ? '' : undefined}
|
|
83
85
|
muted
|
|
86
|
+
size={1}
|
|
84
87
|
$tone={rootTheme.tone === 'default' ? 'positive' : 'default'}
|
|
85
88
|
>
|
|
86
89
|
<PublishIcon />
|
|
@@ -4,9 +4,15 @@ export default function MultipleTonesStory() {
|
|
|
4
4
|
return (
|
|
5
5
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
6
6
|
<Stack>
|
|
7
|
+
<Card padding={3} tone="neutral">
|
|
8
|
+
<Checkbox />
|
|
9
|
+
</Card>
|
|
7
10
|
<Card padding={3} tone="primary">
|
|
8
11
|
<Checkbox />
|
|
9
12
|
</Card>
|
|
13
|
+
<Card padding={3} tone="suggest">
|
|
14
|
+
<Checkbox />
|
|
15
|
+
</Card>
|
|
10
16
|
<Card padding={3} tone="positive">
|
|
11
17
|
<Checkbox />
|
|
12
18
|
</Card>
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
export default function PropsStory() {
|
|
9
9
|
const code = useText('Code', `console.log('Hello, world')`, 'Props')
|
|
10
10
|
const language = useSelect('Language', WORKSHOP_CODE_LANGUAGE_OPTIONS, 'typescript', 'Props')
|
|
11
|
-
const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
|
|
11
|
+
const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 1, 'Props')
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<Box padding={[4, 5, 6]}>
|
|
@@ -9,7 +9,7 @@ export default function PlainStory() {
|
|
|
9
9
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
10
10
|
<Container onClick={useAction('onClick')} width={width}>
|
|
11
11
|
<Card padding={4} shadow={1}>
|
|
12
|
-
<Text>
|
|
12
|
+
<Text size={1}>
|
|
13
13
|
Container with <code>max-width={width}</code>
|
|
14
14
|
</Text>
|
|
15
15
|
</Card>
|
|
@@ -18,15 +18,15 @@ export default function ExampleStory() {
|
|
|
18
18
|
return (
|
|
19
19
|
<Flex direction={direction} height="fill" style={{width: '100%'}}>
|
|
20
20
|
<DebugCard flex={1}>
|
|
21
|
-
<Code>1</Code>
|
|
21
|
+
<Code size={1}>1</Code>
|
|
22
22
|
</DebugCard>
|
|
23
23
|
|
|
24
24
|
<DebugCard flex={[1, 2, 3]}>
|
|
25
|
-
<Code>[1,2,3]</Code>
|
|
25
|
+
<Code size={1}>[1,2,3]</Code>
|
|
26
26
|
</DebugCard>
|
|
27
27
|
|
|
28
28
|
<DebugCard flex={['none', 'none', 1]}>
|
|
29
|
-
<Code>['none', 'none', 1]</Code>
|
|
29
|
+
<Code size={1}>['none', 'none', 1]</Code>
|
|
30
30
|
</DebugCard>
|
|
31
31
|
</Flex>
|
|
32
32
|
)
|
|
@@ -18,8 +18,6 @@ export interface FlexProps
|
|
|
18
18
|
ResponsiveFlexProps,
|
|
19
19
|
ResponsiveFlexItemProps {
|
|
20
20
|
gap?: number | number[]
|
|
21
|
-
gapX?: number | number[]
|
|
22
|
-
gapY?: number | number[]
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
const Root = styled(Box)<FlexItemStyleProps & ResponsiveFlexStyleProps>(
|
|
@@ -36,7 +34,7 @@ export const Flex = forwardRef(function Flex(
|
|
|
36
34
|
props: FlexProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'wrap'>,
|
|
37
35
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
38
36
|
) {
|
|
39
|
-
const {align, as, direction = 'row', gap,
|
|
37
|
+
const {align, as, direction = 'row', gap, justify, wrap, ...restProps} = props
|
|
40
38
|
|
|
41
39
|
return (
|
|
42
40
|
<Root
|
|
@@ -45,8 +43,6 @@ export const Flex = forwardRef(function Flex(
|
|
|
45
43
|
$align={useArrayProp(align)}
|
|
46
44
|
$direction={useArrayProp(direction)}
|
|
47
45
|
$gap={useArrayProp(gap)}
|
|
48
|
-
$gapX={useArrayProp(gapX)}
|
|
49
|
-
$gapY={useArrayProp(gapY)}
|
|
50
46
|
$justify={useArrayProp(justify)}
|
|
51
47
|
$wrap={useArrayProp(wrap)}
|
|
52
48
|
forwardedAs={as}
|
|
@@ -11,40 +11,40 @@ export default function ResponsiveStory() {
|
|
|
11
11
|
rows={[1, 2, 3, 4, 5, 6, 7]}
|
|
12
12
|
style={{textAlign: 'center'}}
|
|
13
13
|
>
|
|
14
|
-
<Card padding={[1, 2, 3]} tone="
|
|
14
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
15
15
|
<Code>1</Code>
|
|
16
16
|
</Card>
|
|
17
|
-
<Card padding={[1, 2, 3]} tone="
|
|
17
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
18
18
|
<Code>2</Code>
|
|
19
19
|
</Card>
|
|
20
|
-
<Card padding={[1, 2, 3]} tone="
|
|
20
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
21
21
|
<Code>3</Code>
|
|
22
22
|
</Card>
|
|
23
|
-
<Card padding={[1, 2, 3]} tone="
|
|
23
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
24
24
|
<Code>4</Code>
|
|
25
25
|
</Card>
|
|
26
|
-
<Card padding={[1, 2, 3]} tone="
|
|
26
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
27
27
|
<Code>5</Code>
|
|
28
28
|
</Card>
|
|
29
|
-
<Card padding={[1, 2, 3]} tone="
|
|
29
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
30
30
|
<Code>6</Code>
|
|
31
31
|
</Card>
|
|
32
|
-
<Card padding={[1, 2, 3]} tone="
|
|
32
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
33
33
|
<Code>7</Code>
|
|
34
34
|
</Card>
|
|
35
|
-
<Card padding={[1, 2, 3]} tone="
|
|
35
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
36
36
|
<Code>8</Code>
|
|
37
37
|
</Card>
|
|
38
|
-
<Card padding={[1, 2, 3]} tone="
|
|
38
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
39
39
|
<Code>9</Code>
|
|
40
40
|
</Card>
|
|
41
|
-
<Card padding={[1, 2, 3]} tone="
|
|
41
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
42
42
|
<Code>10</Code>
|
|
43
43
|
</Card>
|
|
44
|
-
<Card padding={[1, 2, 3]} tone="
|
|
44
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
45
45
|
<Code>11</Code>
|
|
46
46
|
</Card>
|
|
47
|
-
<Card padding={[1, 2, 3]} tone="
|
|
47
|
+
<Card padding={[1, 2, 3]} tone="neutral">
|
|
48
48
|
<Code>12</Code>
|
|
49
49
|
</Card>
|
|
50
50
|
</Grid>
|
|
@@ -6,55 +6,43 @@ export default function OpticalAlignment() {
|
|
|
6
6
|
<Box padding={[4, 5, 6]}>
|
|
7
7
|
<Stack space={1}>
|
|
8
8
|
<Flex>
|
|
9
|
-
<Card padding={0}
|
|
10
|
-
<Heading
|
|
11
|
-
Hamburgefonstiv M
|
|
12
|
-
</Heading>
|
|
9
|
+
<Card padding={0} tone="neutral">
|
|
10
|
+
<Heading size={5}>Hamburgefonstiv M</Heading>
|
|
13
11
|
</Card>
|
|
14
12
|
</Flex>
|
|
15
13
|
|
|
16
14
|
<Flex>
|
|
17
|
-
<Card padding={0}
|
|
18
|
-
<Heading
|
|
19
|
-
Hamburgefonstiv M
|
|
20
|
-
</Heading>
|
|
15
|
+
<Card padding={0} tone="neutral">
|
|
16
|
+
<Heading size={4}>Hamburgefonstiv M</Heading>
|
|
21
17
|
</Card>
|
|
22
18
|
</Flex>
|
|
23
19
|
|
|
24
20
|
<Flex>
|
|
25
|
-
<Card padding={0}
|
|
26
|
-
<Heading
|
|
27
|
-
Hamburgefonstiv M
|
|
28
|
-
</Heading>
|
|
21
|
+
<Card padding={0} tone="neutral">
|
|
22
|
+
<Heading size={3}>Hamburgefonstiv M</Heading>
|
|
29
23
|
</Card>
|
|
30
24
|
</Flex>
|
|
31
25
|
|
|
32
26
|
<Flex>
|
|
33
|
-
<Card padding={0}
|
|
34
|
-
<Heading
|
|
35
|
-
Hamburgefonstiv M
|
|
36
|
-
</Heading>
|
|
27
|
+
<Card padding={0} tone="neutral">
|
|
28
|
+
<Heading size={2}>Hamburgefonstiv M</Heading>
|
|
37
29
|
</Card>
|
|
38
30
|
</Flex>
|
|
39
31
|
|
|
40
32
|
<Flex>
|
|
41
|
-
<Card padding={0}
|
|
42
|
-
<Heading
|
|
43
|
-
Hamburgefonstiv M
|
|
44
|
-
</Heading>
|
|
33
|
+
<Card padding={0} tone="neutral">
|
|
34
|
+
<Heading size={1}>Hamburgefonstiv M</Heading>
|
|
45
35
|
</Card>
|
|
46
36
|
</Flex>
|
|
47
37
|
|
|
48
38
|
<Flex>
|
|
49
|
-
<Card padding={0}
|
|
50
|
-
<Heading
|
|
51
|
-
Hamburgefonstiv M
|
|
52
|
-
</Heading>
|
|
39
|
+
<Card padding={0} tone="neutral">
|
|
40
|
+
<Heading size={0}>Hamburgefonstiv M</Heading>
|
|
53
41
|
</Card>
|
|
54
42
|
</Flex>
|
|
55
43
|
|
|
56
44
|
<Flex>
|
|
57
|
-
<Card padding={2}
|
|
45
|
+
<Card padding={2} tone="neutral">
|
|
58
46
|
<Heading accent>
|
|
59
47
|
<AddCircleIcon />
|
|
60
48
|
</Heading>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef} from 'react'
|
|
2
|
+
import {forwardRef, type JSX} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
5
5
|
import {
|
|
@@ -26,7 +26,7 @@ export interface HeadingProps {
|
|
|
26
26
|
* Use `textOverflow="ellipsis"` to render text as a single line which is concatenated with a `…` symbol.
|
|
27
27
|
* @beta
|
|
28
28
|
*/
|
|
29
|
-
textOverflow?: 'ellipsis'
|
|
29
|
+
textOverflow?: 'ellipsis'
|
|
30
30
|
weight?: ThemeFontWeightKey
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -10,15 +10,15 @@ export default function PlainStory() {
|
|
|
10
10
|
space={useSelect('Space', WORKSHOP_SPACE_OPTIONS, 0, 'Props')}
|
|
11
11
|
>
|
|
12
12
|
<Card padding={1} shadow={1}>
|
|
13
|
-
<Text>Inline item</Text>
|
|
13
|
+
<Text size={1}>Inline item</Text>
|
|
14
14
|
</Card>
|
|
15
15
|
|
|
16
16
|
<Card padding={2} shadow={1}>
|
|
17
|
-
<Text>Inline item</Text>
|
|
17
|
+
<Text size={1}>Inline item</Text>
|
|
18
18
|
</Card>
|
|
19
19
|
|
|
20
20
|
<Card padding={3} shadow={1}>
|
|
21
|
-
<Text>Inline item</Text>
|
|
21
|
+
<Text size={1}>Inline item</Text>
|
|
22
22
|
</Card>
|
|
23
23
|
</Inline>
|
|
24
24
|
</Flex>
|
|
@@ -6,37 +6,37 @@ export default function OpticalAlignment() {
|
|
|
6
6
|
<Box padding={[4, 5, 6]}>
|
|
7
7
|
<Stack space={1}>
|
|
8
8
|
<Flex>
|
|
9
|
-
<Card padding={0}
|
|
9
|
+
<Card padding={0} tone="suggest">
|
|
10
10
|
<Label size={4}>Hamburgefonstiv M</Label>
|
|
11
11
|
</Card>
|
|
12
12
|
</Flex>
|
|
13
13
|
|
|
14
14
|
<Flex>
|
|
15
|
-
<Card padding={0}
|
|
15
|
+
<Card padding={0} tone="suggest">
|
|
16
16
|
<Label size={3}>Hamburgefonstiv M</Label>
|
|
17
17
|
</Card>
|
|
18
18
|
</Flex>
|
|
19
19
|
|
|
20
20
|
<Flex>
|
|
21
|
-
<Card padding={0}
|
|
21
|
+
<Card padding={0} tone="suggest">
|
|
22
22
|
<Label size={2}>Hamburgefonstiv M</Label>
|
|
23
23
|
</Card>
|
|
24
24
|
</Flex>
|
|
25
25
|
|
|
26
26
|
<Flex>
|
|
27
|
-
<Card padding={0}
|
|
27
|
+
<Card padding={0} tone="suggest">
|
|
28
28
|
<Label size={1}>Hamburgefonstiv M</Label>
|
|
29
29
|
</Card>
|
|
30
30
|
</Flex>
|
|
31
31
|
|
|
32
32
|
<Flex>
|
|
33
|
-
<Card padding={0}
|
|
33
|
+
<Card padding={0} tone="suggest">
|
|
34
34
|
<Label size={0}>Hamburgefonstiv M</Label>
|
|
35
35
|
</Card>
|
|
36
36
|
</Flex>
|
|
37
37
|
|
|
38
38
|
<Flex>
|
|
39
|
-
<Card padding={2}
|
|
39
|
+
<Card padding={2} tone="suggest">
|
|
40
40
|
<Label>
|
|
41
41
|
<AddCircleIcon />
|
|
42
42
|
</Label>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef} from 'react'
|
|
2
|
+
import {forwardRef, type JSX} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
5
5
|
import {responsiveLabelFont, responsiveTextAlignStyle} from '../../styles/internal'
|
|
@@ -24,7 +24,7 @@ export default function AlignedStory() {
|
|
|
24
24
|
const popoverElementRef = useRef<HTMLDivElement | null>(null)
|
|
25
25
|
|
|
26
26
|
const content = (
|
|
27
|
-
<Text>
|
|
27
|
+
<Text size={1}>
|
|
28
28
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque at nisl at sem tempor
|
|
29
29
|
hendrerit scelerisque ut libero. Maecenas iaculis efficitur lorem, ac faucibus mi imperdiet
|
|
30
30
|
quis. Cras a consectetur erat. Fusce imperdiet, dolor et pellentesque iaculis, ex quam luctus
|
|
@@ -11,8 +11,8 @@ export default function MatchReferenceWidthStory() {
|
|
|
11
11
|
<Popover
|
|
12
12
|
arrow={arrow}
|
|
13
13
|
content={
|
|
14
|
-
<Box padding={
|
|
15
|
-
<Text>Content</Text>
|
|
14
|
+
<Box padding={3}>
|
|
15
|
+
<Text size={1}>Content</Text>
|
|
16
16
|
</Box>
|
|
17
17
|
}
|
|
18
18
|
matchReferenceWidth
|
|
@@ -22,7 +22,7 @@ export default function MatchReferenceWidthStory() {
|
|
|
22
22
|
>
|
|
23
23
|
<Container width={0}>
|
|
24
24
|
<Stack>
|
|
25
|
-
<Button fontSize={
|
|
25
|
+
<Button fontSize={1} mode="ghost" selected text="Button" />
|
|
26
26
|
</Stack>
|
|
27
27
|
</Container>
|
|
28
28
|
</Popover>
|
|
@@ -3,7 +3,7 @@ import {Button, Card, Popover, Text} from '@sanity/ui'
|
|
|
3
3
|
export default function OpenOnMountStory() {
|
|
4
4
|
return (
|
|
5
5
|
<Card height="fill" padding={3} sizing="border">
|
|
6
|
-
<Popover content={<Text>popover content</Text>} open padding={3}>
|
|
6
|
+
<Popover content={<Text size={1}>popover content</Text>} open padding={3}>
|
|
7
7
|
<Button text="This button is the popover reference" />
|
|
8
8
|
</Popover>
|
|
9
9
|
</Card>
|
|
@@ -48,7 +48,7 @@ export default function PlainStory() {
|
|
|
48
48
|
arrow={arrow}
|
|
49
49
|
boundaryElement={boundaryElementFlag ? boundaryElement : undefined}
|
|
50
50
|
constrainSize={constrainSize}
|
|
51
|
-
content={<Text>popover content</Text>}
|
|
51
|
+
content={<Text size={1}>popover content</Text>}
|
|
52
52
|
fallbackPlacements={['top', 'bottom']}
|
|
53
53
|
matchReferenceWidth={matchReferenceWidth}
|
|
54
54
|
open={open}
|
|
@@ -18,7 +18,7 @@ const SIDE_PANEL_WIDTH = {
|
|
|
18
18
|
export default function SidePanelStory() {
|
|
19
19
|
const sidePanelWidth = useSelect('Side panel width', SIDE_PANEL_WIDTH, SIDE_PANEL_WIDTH.md)
|
|
20
20
|
const [sidePanel, setSidePanel] = useState<HTMLDivElement | null>(null)
|
|
21
|
-
const updateRef = useRef<PopoverUpdateCallback>()
|
|
21
|
+
const updateRef = useRef<PopoverUpdateCallback>(undefined)
|
|
22
22
|
|
|
23
23
|
useEffect(() => updateRef.current?.(), [sidePanelWidth])
|
|
24
24
|
|