@sanity/ui 0.37.19 → 0.37.21
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/lib/dts/src/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/lib/dts/src/components/dialog/dialog.d.ts.map +1 -1
- package/lib/dts/src/components/dialog/styles.d.ts +1 -1
- package/lib/dts/src/components/dialog/styles.d.ts.map +1 -1
- package/lib/dts/src/components/hotkeys/hotkeys.d.ts.map +1 -1
- package/lib/dts/src/components/menu/menuGroup.d.ts.map +1 -1
- package/lib/dts/src/components/skeleton/skeleton.d.ts.map +1 -1
- package/lib/dts/src/hooks/index.d.ts +1 -2
- package/lib/dts/src/hooks/index.d.ts.map +1 -1
- package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts +1 -1
- package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts.map +1 -1
- package/lib/dts/src/hooks/useResponsiveProp.d.ts +6 -0
- package/lib/dts/src/hooks/useResponsiveProp.d.ts.map +1 -0
- package/lib/dts/src/index.d.ts +0 -1
- package/lib/dts/src/index.d.ts.map +1 -1
- package/lib/dts/src/primitives/_selectable/selectable.d.ts +2 -1
- package/lib/dts/src/primitives/_selectable/selectable.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/avatar.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/avatarCounter.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/avatarStack.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/badge/badge.d.ts.map +1 -1
- package/lib/dts/src/primitives/box/box.d.ts.map +1 -1
- package/lib/dts/src/primitives/button/button.d.ts.map +1 -1
- package/lib/dts/src/primitives/card/card.d.ts.map +1 -1
- package/lib/dts/src/primitives/code/code.d.ts.map +1 -1
- package/lib/dts/src/primitives/container/container.d.ts.map +1 -1
- package/lib/dts/src/primitives/container/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/container/types.d.ts +1 -1
- package/lib/dts/src/primitives/container/types.d.ts.map +1 -1
- package/lib/dts/src/primitives/flex/flex.d.ts.map +1 -1
- package/lib/dts/src/primitives/grid/grid.d.ts.map +1 -1
- package/lib/dts/src/primitives/heading/heading.d.ts.map +1 -1
- package/lib/dts/src/primitives/inline/inline.d.ts.map +1 -1
- package/lib/dts/src/primitives/inline/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/inline/types.d.ts +1 -1
- package/lib/dts/src/primitives/inline/types.d.ts.map +1 -1
- package/lib/dts/src/primitives/kbd/kbd.d.ts.map +1 -1
- package/lib/dts/src/primitives/label/label.d.ts.map +1 -1
- package/lib/dts/src/primitives/popover/popover.d.ts.map +1 -1
- package/lib/dts/src/primitives/select/styles.d.ts +1 -5
- package/lib/dts/src/primitives/select/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/stack/stack.d.ts.map +1 -1
- package/lib/dts/src/primitives/stack/styles.d.ts +1 -1
- package/lib/dts/src/primitives/stack/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/text/text.d.ts.map +1 -1
- package/lib/dts/src/primitives/textArea/textArea.d.ts.map +1 -1
- package/lib/dts/src/primitives/textInput/textInput.d.ts.map +1 -1
- package/lib/dts/src/primitives/tooltip/tooltip.d.ts.map +1 -1
- package/lib/dts/src/primitives/types.d.ts +1 -1
- package/lib/dts/src/primitives/types.d.ts.map +1 -1
- package/lib/dts/src/styles/border/types.d.ts +5 -5
- package/lib/dts/src/styles/border/types.d.ts.map +1 -1
- package/lib/dts/src/styles/box/types.d.ts +4 -4
- package/lib/dts/src/styles/box/types.d.ts.map +1 -1
- package/lib/dts/src/styles/flex/flexItemStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/flex/types.d.ts +6 -6
- package/lib/dts/src/styles/flex/types.d.ts.map +1 -1
- package/lib/dts/src/styles/font/responsiveFont.d.ts.map +1 -1
- package/lib/dts/src/styles/font/types.d.ts +3 -3
- package/lib/dts/src/styles/font/types.d.ts.map +1 -1
- package/lib/dts/src/styles/grid/types.d.ts +14 -14
- package/lib/dts/src/styles/grid/types.d.ts.map +1 -1
- package/lib/dts/src/styles/helpers.d.ts +4 -4
- package/lib/dts/src/styles/helpers.d.ts.map +1 -1
- package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts +12 -12
- package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/input/textInputStyle.d.ts +2 -7
- package/lib/dts/src/styles/input/textInputStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/margin/types.d.ts +7 -7
- package/lib/dts/src/styles/margin/types.d.ts.map +1 -1
- package/lib/dts/src/styles/padding/types.d.ts +7 -7
- package/lib/dts/src/styles/padding/types.d.ts.map +1 -1
- package/lib/dts/src/styles/radius/types.d.ts +1 -1
- package/lib/dts/src/styles/radius/types.d.ts.map +1 -1
- package/lib/dts/src/styles/shadow/shadowStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/shadow/types.d.ts +1 -1
- package/lib/dts/src/styles/shadow/types.d.ts.map +1 -1
- package/lib/dts/src/theme/studioTheme/color.d.ts.map +1 -1
- package/lib/dts/src/utils/elementQuery/elementQuery.d.ts.map +1 -1
- package/lib/dts/src/utils/index.d.ts +1 -0
- package/lib/dts/src/utils/index.d.ts.map +1 -1
- package/lib/dts/src/utils/resizeObserver.d.ts +6 -0
- package/lib/dts/src/utils/resizeObserver.d.ts.map +1 -0
- package/lib/dts/src/utils/virtualList/virtualList.d.ts.map +1 -1
- package/lib/sanity-ui.js +574 -734
- package/lib/sanity-ui.js.map +1 -1
- package/lib/sanity-ui.modern.js +595 -765
- package/lib/sanity-ui.modern.js.map +1 -1
- package/lib/sanity-ui.module.js +570 -728
- package/lib/sanity-ui.module.js.map +1 -1
- package/package.json +11 -11
- package/src/__workshop__/color/overview.tsx +11 -9
- package/src/components/autocomplete/__workshop__/async.tsx +12 -14
- package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -36
- package/src/components/autocomplete/autocomplete.tsx +2 -2
- package/src/components/breadcrumbs/breadcrumbs.tsx +2 -3
- package/src/components/dialog/dialog.tsx +9 -17
- package/src/components/dialog/styles.ts +4 -4
- package/src/components/hotkeys/hotkeys.tsx +1 -3
- package/src/components/menu/__workshop__/constrainedInBoundary.tsx +14 -11
- package/src/components/menu/__workshop__/groups.tsx +1 -1
- package/src/components/menu/menuGroup.tsx +2 -3
- package/src/components/menu/menuItem.tsx +3 -3
- package/src/components/skeleton/skeleton.tsx +1 -10
- package/src/components/skeleton/textSkeleton.tsx +7 -7
- package/src/hooks/index.ts +1 -2
- package/src/hooks/useElementRect/useElementRect.ts +16 -4
- package/src/hooks/useResponsiveProp.ts +10 -0
- package/src/index.ts +0 -1
- package/src/primitives/_selectable/selectable.tsx +4 -5
- package/src/primitives/avatar/avatar.tsx +5 -7
- package/src/primitives/avatar/avatarCounter.tsx +11 -12
- package/src/primitives/avatar/avatarStack.tsx +10 -15
- package/src/primitives/avatar/styles.ts +2 -2
- package/src/primitives/badge/badge.tsx +2 -3
- package/src/primitives/box/box.tsx +25 -26
- package/src/primitives/button/button.tsx +10 -22
- package/src/primitives/card/card.tsx +7 -8
- package/src/primitives/checkbox/__workshop__/example.tsx +2 -4
- package/src/primitives/checkbox/__workshop__/props.tsx +2 -4
- package/src/primitives/checkbox/__workshop__/readOnly.tsx +2 -4
- package/src/primitives/code/__workshop__/props.tsx +1 -1
- package/src/primitives/code/code.tsx +1 -2
- package/src/primitives/container/container.tsx +1 -10
- package/src/primitives/container/styles.ts +2 -2
- package/src/primitives/container/types.ts +1 -1
- package/src/primitives/flex/flex.tsx +5 -6
- package/src/primitives/grid/__workshop__/responsive.tsx +12 -13
- package/src/primitives/grid/grid.tsx +8 -9
- package/src/primitives/heading/__workshop__/opticalAlignment.tsx +7 -19
- package/src/primitives/heading/heading.tsx +2 -3
- package/src/primitives/inline/inline.tsx +6 -12
- package/src/primitives/inline/styles.ts +2 -2
- package/src/primitives/inline/types.ts +1 -1
- package/src/primitives/kbd/kbd.tsx +1 -2
- package/src/primitives/label/label.tsx +3 -4
- package/src/primitives/popover/__workshop__/index.ts +5 -10
- package/src/primitives/popover/__workshop__/{MarginsStory.tsx → margins.tsx} +1 -1
- package/src/primitives/popover/__workshop__/{MatchReferenceWidthStory.tsx → matchReferenceWidth.tsx} +0 -0
- package/src/primitives/popover/__workshop__/{PlainStory.tsx → plain.tsx} +14 -12
- package/src/primitives/popover/__workshop__/{RecursiveStory.tsx → recursive.tsx} +1 -4
- package/src/primitives/popover/__workshop__/rightAligned.tsx +57 -0
- package/src/primitives/popover/popover.tsx +10 -29
- package/src/primitives/select/select.tsx +9 -9
- package/src/primitives/select/styles.ts +4 -10
- package/src/primitives/stack/stack.tsx +1 -2
- package/src/primitives/stack/styles.ts +3 -3
- package/src/primitives/text/__workshop__/opticalAlignment.tsx +5 -15
- package/src/primitives/text/text.tsx +2 -3
- package/src/primitives/textArea/__workshop__/plain.tsx +18 -23
- package/src/primitives/textArea/textArea.tsx +5 -21
- package/src/primitives/textInput/__workshop__/clearButton.tsx +8 -14
- package/src/primitives/textInput/__workshop__/index.ts +2 -2
- package/src/primitives/textInput/__workshop__/plain.tsx +32 -39
- package/src/primitives/textInput/__workshop__/tones.tsx +95 -234
- package/src/primitives/textInput/__workshop__/typed.tsx +2 -8
- package/src/primitives/textInput/textInput.tsx +12 -47
- package/src/primitives/tooltip/__workshop__/props.tsx +2 -7
- package/src/primitives/tooltip/tooltip.tsx +9 -19
- package/src/primitives/types.ts +1 -1
- package/src/styles/border/borderStyle.ts +6 -6
- package/src/styles/border/types.ts +5 -5
- package/src/styles/box/boxStyle.ts +5 -5
- package/src/styles/box/types.ts +4 -4
- package/src/styles/flex/flexItemStyle.ts +4 -5
- package/src/styles/flex/flexStyle.ts +6 -6
- package/src/styles/flex/types.ts +6 -6
- package/src/styles/font/responsiveFont.ts +4 -2
- package/src/styles/font/textAlignStyle.ts +2 -2
- package/src/styles/font/types.ts +3 -4
- package/src/styles/grid/gridItemStyle.ts +7 -7
- package/src/styles/grid/gridStyle.ts +9 -9
- package/src/styles/grid/types.ts +14 -14
- package/src/styles/helpers.ts +9 -9
- package/src/styles/input/responsiveInputPaddingStyle.ts +27 -24
- package/src/styles/input/textInputStyle.ts +80 -92
- package/src/styles/margin/marginStyle.ts +8 -8
- package/src/styles/margin/marginsStyle.test.ts +1 -1
- package/src/styles/margin/types.ts +7 -7
- package/src/styles/padding/paddingStyle.test.ts +1 -1
- package/src/styles/padding/paddingStyle.ts +8 -8
- package/src/styles/padding/types.ts +7 -7
- package/src/styles/radius/radiusStyle.ts +2 -2
- package/src/styles/radius/types.ts +1 -1
- package/src/styles/shadow/shadowStyle.ts +5 -2
- package/src/styles/shadow/types.ts +1 -1
- package/src/theme/studioTheme/color.ts +14 -15
- package/src/theme/studioTheme/fonts.ts +4 -4
- package/src/utils/elementQuery/elementQuery.tsx +18 -5
- package/src/utils/index.ts +1 -0
- package/src/utils/layer/layerProvider.tsx +2 -2
- package/src/{observers → utils}/resizeObserver.ts +3 -1
- package/src/utils/virtualList/virtualList.tsx +7 -8
- package/lib/dts/src/hooks/useArrayProp.d.ts +0 -7
- package/lib/dts/src/hooks/useArrayProp.d.ts.map +0 -1
- package/lib/dts/src/hooks/useElementSize.d.ts +0 -7
- package/lib/dts/src/hooks/useElementSize.d.ts.map +0 -1
- package/lib/dts/src/observers/elementSizeObserver.d.ts +0 -37
- package/lib/dts/src/observers/elementSizeObserver.d.ts.map +0 -1
- package/lib/dts/src/observers/index.d.ts +0 -3
- package/lib/dts/src/observers/index.d.ts.map +0 -1
- package/lib/dts/src/observers/resizeObserver.d.ts +0 -5
- package/lib/dts/src/observers/resizeObserver.d.ts.map +0 -1
- package/src/hooks/useArrayProp.ts +0 -23
- package/src/hooks/useElementSize.ts +0 -18
- package/src/observers/elementSizeObserver.ts +0 -116
- package/src/observers/index.ts +0 -2
- package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +0 -60
- package/src/primitives/popover/__workshop__/TestStory.tsx +0 -79
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {forwardRef} from 'react'
|
|
2
2
|
import styled from 'styled-components'
|
|
3
|
-
import {useForwardedRef, useCustomValidity
|
|
3
|
+
import {useForwardedRef, useCustomValidity} from '../../hooks'
|
|
4
4
|
import {
|
|
5
5
|
responsiveInputPaddingStyle,
|
|
6
6
|
responsiveRadiusStyle,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
textInputFontSizeStyle,
|
|
14
14
|
textInputRepresentationStyle,
|
|
15
15
|
} from '../../styles/internal'
|
|
16
|
-
import {ThemeFontWeightKey
|
|
16
|
+
import {ThemeFontWeightKey} from '../../theme'
|
|
17
17
|
import {ResponsiveRadiusProps} from '../types'
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -61,14 +61,11 @@ export const TextArea = forwardRef(function TextArea(
|
|
|
61
61
|
fontSize = 2,
|
|
62
62
|
padding = 3,
|
|
63
63
|
radius = 1,
|
|
64
|
-
weight,
|
|
65
64
|
...restProps
|
|
66
65
|
} = props
|
|
67
66
|
|
|
68
67
|
const ref = useForwardedRef(forwardedRef)
|
|
69
68
|
|
|
70
|
-
const rootTheme = useRootTheme()
|
|
71
|
-
|
|
72
69
|
useCustomValidity(ref, customValidity)
|
|
73
70
|
|
|
74
71
|
return (
|
|
@@ -76,26 +73,13 @@ export const TextArea = forwardRef(function TextArea(
|
|
|
76
73
|
<InputRoot>
|
|
77
74
|
<Input
|
|
78
75
|
data-as="textarea"
|
|
79
|
-
data-scheme={rootTheme.scheme}
|
|
80
|
-
data-tone={rootTheme.tone}
|
|
81
76
|
{...restProps}
|
|
82
|
-
$fontSize={
|
|
83
|
-
$padding={
|
|
84
|
-
$scheme={rootTheme.scheme}
|
|
85
|
-
$space={useArrayProp(0)}
|
|
86
|
-
$tone={rootTheme.tone}
|
|
87
|
-
$weight={weight}
|
|
77
|
+
$fontSize={fontSize}
|
|
78
|
+
$padding={padding}
|
|
88
79
|
disabled={disabled}
|
|
89
80
|
ref={ref}
|
|
90
81
|
/>
|
|
91
|
-
<Presentation
|
|
92
|
-
$border={border}
|
|
93
|
-
$radius={useArrayProp(radius)}
|
|
94
|
-
$scheme={rootTheme.scheme}
|
|
95
|
-
$tone={rootTheme.tone}
|
|
96
|
-
data-scheme={rootTheme.scheme}
|
|
97
|
-
data-tone={rootTheme.tone}
|
|
98
|
-
/>
|
|
82
|
+
<Presentation $border={border} $radius={radius} />
|
|
99
83
|
</InputRoot>
|
|
100
84
|
</Root>
|
|
101
85
|
)
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {useText} from '@sanity/ui-workshop'
|
|
1
|
+
import {TextInput} from '@sanity/ui'
|
|
3
2
|
import React, {useCallback, useState} from 'react'
|
|
4
3
|
|
|
5
4
|
export default function ClearButtonStory() {
|
|
6
|
-
const customValidity = useText('Custom validitiy')
|
|
7
|
-
|
|
8
5
|
const [value, setValue] = useState('')
|
|
9
6
|
|
|
10
7
|
const handleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
|
|
@@ -16,15 +13,12 @@ export default function ClearButtonStory() {
|
|
|
16
13
|
}, [])
|
|
17
14
|
|
|
18
15
|
return (
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
value={value}
|
|
27
|
-
/>
|
|
28
|
-
</Box>
|
|
16
|
+
<TextInput
|
|
17
|
+
clearButton
|
|
18
|
+
onChange={handleChange}
|
|
19
|
+
onClear={handleClear}
|
|
20
|
+
placeholder="Enter text"
|
|
21
|
+
value={value}
|
|
22
|
+
/>
|
|
29
23
|
)
|
|
30
24
|
}
|
|
@@ -13,8 +13,8 @@ export default defineScope('primitives/text-input', 'TextInput', [
|
|
|
13
13
|
component: lazy(() => import('./customValidity')),
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
name: '
|
|
17
|
-
title: '
|
|
16
|
+
name: 'types',
|
|
17
|
+
title: 'Types',
|
|
18
18
|
component: lazy(() => import('./typed')),
|
|
19
19
|
},
|
|
20
20
|
{
|
|
@@ -30,33 +30,15 @@ const typingPerfTest: PerfTestProps<HTMLInputElement> = {
|
|
|
30
30
|
export default function PlainStory() {
|
|
31
31
|
const {ref, Wrapper} = usePerfTest(typingPerfTest)
|
|
32
32
|
|
|
33
|
-
return (
|
|
34
|
-
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
35
|
-
<Container width={0}>
|
|
36
|
-
<Stack space={3}>
|
|
37
|
-
<Text as="label" htmlFor="text-input-example" size={1} weight="semibold">
|
|
38
|
-
TextInput
|
|
39
|
-
</Text>
|
|
40
|
-
<Wrapper>
|
|
41
|
-
<TextInputTest inputRef={ref} />
|
|
42
|
-
</Wrapper>
|
|
43
|
-
</Stack>
|
|
44
|
-
</Container>
|
|
45
|
-
</Flex>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
|
|
50
|
-
const {inputRef: ref} = props
|
|
51
33
|
const border = useBoolean('Border', true, 'Props')
|
|
52
34
|
const customValidity = useText('Custom validity', '', 'Props') || undefined
|
|
53
35
|
const disabled = useBoolean('Disabled', false, 'Props')
|
|
54
36
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2, 'Props')
|
|
55
|
-
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, '
|
|
37
|
+
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'add-circle', 'Props') as IconSymbol
|
|
56
38
|
const iconRight = useSelect(
|
|
57
39
|
'Icon (right)',
|
|
58
40
|
WORKSHOP_ICON_SYMBOL_OPTIONS,
|
|
59
|
-
'
|
|
41
|
+
'add-circle',
|
|
60
42
|
'Props'
|
|
61
43
|
) as IconSymbol
|
|
62
44
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
@@ -74,24 +56,35 @@ function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
|
|
|
74
56
|
)
|
|
75
57
|
|
|
76
58
|
return (
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
59
|
+
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
60
|
+
<Container width={0}>
|
|
61
|
+
<Stack space={3}>
|
|
62
|
+
<Text as="label" htmlFor="text-input-example" size={1} weight="semibold">
|
|
63
|
+
TextInput
|
|
64
|
+
</Text>
|
|
65
|
+
<Wrapper>
|
|
66
|
+
<TextInput
|
|
67
|
+
border={border}
|
|
68
|
+
customValidity={customValidity}
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
fontSize={fontSize}
|
|
71
|
+
icon={icon && icons[icon]}
|
|
72
|
+
iconRight={iconRight && icons[iconRight]}
|
|
73
|
+
id="text-input-example"
|
|
74
|
+
name="email"
|
|
75
|
+
onChange={handleChange}
|
|
76
|
+
padding={padding}
|
|
77
|
+
placeholder={placeholder}
|
|
78
|
+
radius={radius}
|
|
79
|
+
readOnly={readOnly}
|
|
80
|
+
ref={ref}
|
|
81
|
+
space={space}
|
|
82
|
+
value={value}
|
|
83
|
+
weight={weight}
|
|
84
|
+
/>
|
|
85
|
+
</Wrapper>
|
|
86
|
+
</Stack>
|
|
87
|
+
</Container>
|
|
88
|
+
</Flex>
|
|
96
89
|
)
|
|
97
90
|
}
|
|
@@ -1,240 +1,101 @@
|
|
|
1
|
-
import {Box, Card, Container,
|
|
2
|
-
import {useBoolean} from '@sanity/ui-workshop'
|
|
1
|
+
import {Box, Card, Container, Stack, Text, TextInput} from '@sanity/ui'
|
|
3
2
|
import React from 'react'
|
|
4
3
|
|
|
5
4
|
export default function TonesStory() {
|
|
6
|
-
const transparentTone = useBoolean('Transparent', true)
|
|
7
|
-
const primaryTone = useBoolean('Primary', true)
|
|
8
|
-
const positiveTone = useBoolean('Positive', true)
|
|
9
|
-
const cautionTone = useBoolean('Caution', true)
|
|
10
|
-
const criticalTone = useBoolean('Critical', true)
|
|
11
|
-
|
|
12
5
|
return (
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{criticalTone && (
|
|
108
|
-
<Card padding={3} tone="critical">
|
|
109
|
-
<TextInput
|
|
110
|
-
placeholder="critical"
|
|
111
|
-
prefix={
|
|
112
|
-
<Box padding={3}>
|
|
113
|
-
<Text>prefix</Text>
|
|
114
|
-
</Box>
|
|
115
|
-
}
|
|
116
|
-
suffix={
|
|
117
|
-
<Box padding={3}>
|
|
118
|
-
<Text>suffix</Text>
|
|
119
|
-
</Box>
|
|
120
|
-
}
|
|
121
|
-
/>
|
|
122
|
-
</Card>
|
|
123
|
-
)}
|
|
124
|
-
</Stack>
|
|
125
|
-
</Card>
|
|
126
|
-
<Card flex={1} scheme="dark">
|
|
127
|
-
<Stack padding={[3, 4, 5]} space={4}>
|
|
128
|
-
<Card padding={3}>
|
|
129
|
-
<TextInput
|
|
130
|
-
placeholder="default"
|
|
131
|
-
prefix={
|
|
132
|
-
<Box padding={3}>
|
|
133
|
-
<Text>prefix</Text>
|
|
134
|
-
</Box>
|
|
135
|
-
}
|
|
136
|
-
suffix={
|
|
137
|
-
<Box padding={3}>
|
|
138
|
-
<Text>suffix</Text>
|
|
139
|
-
</Box>
|
|
140
|
-
}
|
|
141
|
-
/>
|
|
142
|
-
</Card>
|
|
143
|
-
|
|
144
|
-
{transparentTone && (
|
|
145
|
-
<Card padding={3} tone="transparent">
|
|
146
|
-
<TextInput
|
|
147
|
-
placeholder="transparent"
|
|
148
|
-
prefix={
|
|
149
|
-
<Box padding={3}>
|
|
150
|
-
<Text>prefix</Text>
|
|
151
|
-
</Box>
|
|
152
|
-
}
|
|
153
|
-
suffix={
|
|
154
|
-
<Box padding={3}>
|
|
155
|
-
<Text>suffix</Text>
|
|
156
|
-
</Box>
|
|
157
|
-
}
|
|
158
|
-
/>
|
|
159
|
-
</Card>
|
|
160
|
-
)}
|
|
161
|
-
|
|
162
|
-
{primaryTone && (
|
|
163
|
-
<Card padding={3} tone="primary">
|
|
164
|
-
<TextInput
|
|
165
|
-
placeholder="primary"
|
|
166
|
-
prefix={
|
|
167
|
-
<Box padding={3}>
|
|
168
|
-
<Text>prefix</Text>
|
|
169
|
-
</Box>
|
|
170
|
-
}
|
|
171
|
-
suffix={
|
|
172
|
-
<Box padding={3}>
|
|
173
|
-
<Text>suffix</Text>
|
|
174
|
-
</Box>
|
|
175
|
-
}
|
|
176
|
-
/>
|
|
177
|
-
</Card>
|
|
178
|
-
)}
|
|
179
|
-
|
|
180
|
-
{positiveTone && (
|
|
181
|
-
<Card padding={3} tone="positive">
|
|
182
|
-
<TextInput
|
|
183
|
-
placeholder="positive"
|
|
184
|
-
prefix={
|
|
185
|
-
<Box padding={3}>
|
|
186
|
-
<Text>prefix</Text>
|
|
187
|
-
</Box>
|
|
188
|
-
}
|
|
189
|
-
suffix={
|
|
190
|
-
<Box padding={3}>
|
|
191
|
-
<Text>suffix</Text>
|
|
192
|
-
</Box>
|
|
193
|
-
}
|
|
194
|
-
/>
|
|
195
|
-
</Card>
|
|
196
|
-
)}
|
|
197
|
-
|
|
198
|
-
{cautionTone && (
|
|
199
|
-
<Card padding={3} tone="caution">
|
|
200
|
-
<TextInput
|
|
201
|
-
placeholder="caution"
|
|
202
|
-
prefix={
|
|
203
|
-
<Box padding={3}>
|
|
204
|
-
<Text>prefix</Text>
|
|
205
|
-
</Box>
|
|
206
|
-
}
|
|
207
|
-
suffix={
|
|
208
|
-
<Box padding={3}>
|
|
209
|
-
<Text>suffix</Text>
|
|
210
|
-
</Box>
|
|
211
|
-
}
|
|
212
|
-
/>
|
|
213
|
-
</Card>
|
|
214
|
-
)}
|
|
215
|
-
|
|
216
|
-
{criticalTone && (
|
|
217
|
-
<Card padding={3} tone="critical">
|
|
218
|
-
<TextInput
|
|
219
|
-
placeholder="critical"
|
|
220
|
-
prefix={
|
|
221
|
-
<Box padding={3}>
|
|
222
|
-
<Text>prefix</Text>
|
|
223
|
-
</Box>
|
|
224
|
-
}
|
|
225
|
-
suffix={
|
|
226
|
-
<Box padding={3}>
|
|
227
|
-
<Text>suffix</Text>
|
|
228
|
-
</Box>
|
|
229
|
-
}
|
|
230
|
-
/>
|
|
231
|
-
</Card>
|
|
232
|
-
)}
|
|
233
|
-
</Stack>
|
|
234
|
-
</Card>
|
|
235
|
-
</Flex>
|
|
236
|
-
</Container>
|
|
237
|
-
</Flex>
|
|
238
|
-
</Card>
|
|
6
|
+
<Container width={1}>
|
|
7
|
+
<Stack padding={[3, 4, 5]} space={4}>
|
|
8
|
+
<Card padding={3}>
|
|
9
|
+
<TextInput
|
|
10
|
+
placeholder="default"
|
|
11
|
+
prefix={
|
|
12
|
+
<Box padding={3}>
|
|
13
|
+
<Text>prefix</Text>
|
|
14
|
+
</Box>
|
|
15
|
+
}
|
|
16
|
+
suffix={
|
|
17
|
+
<Box padding={3}>
|
|
18
|
+
<Text>suffix</Text>
|
|
19
|
+
</Box>
|
|
20
|
+
}
|
|
21
|
+
/>
|
|
22
|
+
</Card>
|
|
23
|
+
<Card padding={3} tone="transparent">
|
|
24
|
+
<TextInput
|
|
25
|
+
placeholder="transparent"
|
|
26
|
+
prefix={
|
|
27
|
+
<Box padding={3}>
|
|
28
|
+
<Text>prefix</Text>
|
|
29
|
+
</Box>
|
|
30
|
+
}
|
|
31
|
+
suffix={
|
|
32
|
+
<Box padding={3}>
|
|
33
|
+
<Text>suffix</Text>
|
|
34
|
+
</Box>
|
|
35
|
+
}
|
|
36
|
+
/>
|
|
37
|
+
</Card>
|
|
38
|
+
<Card padding={3} tone="primary">
|
|
39
|
+
<TextInput
|
|
40
|
+
placeholder="primary"
|
|
41
|
+
prefix={
|
|
42
|
+
<Box padding={3}>
|
|
43
|
+
<Text>prefix</Text>
|
|
44
|
+
</Box>
|
|
45
|
+
}
|
|
46
|
+
suffix={
|
|
47
|
+
<Box padding={3}>
|
|
48
|
+
<Text>suffix</Text>
|
|
49
|
+
</Box>
|
|
50
|
+
}
|
|
51
|
+
/>
|
|
52
|
+
</Card>
|
|
53
|
+
<Card padding={3} tone="positive">
|
|
54
|
+
<TextInput
|
|
55
|
+
placeholder="positive"
|
|
56
|
+
prefix={
|
|
57
|
+
<Box padding={3}>
|
|
58
|
+
<Text>prefix</Text>
|
|
59
|
+
</Box>
|
|
60
|
+
}
|
|
61
|
+
suffix={
|
|
62
|
+
<Box padding={3}>
|
|
63
|
+
<Text>suffix</Text>
|
|
64
|
+
</Box>
|
|
65
|
+
}
|
|
66
|
+
/>
|
|
67
|
+
</Card>
|
|
68
|
+
<Card padding={3} tone="caution">
|
|
69
|
+
<TextInput
|
|
70
|
+
placeholder="caution"
|
|
71
|
+
prefix={
|
|
72
|
+
<Box padding={3}>
|
|
73
|
+
<Text>prefix</Text>
|
|
74
|
+
</Box>
|
|
75
|
+
}
|
|
76
|
+
suffix={
|
|
77
|
+
<Box padding={3}>
|
|
78
|
+
<Text>suffix</Text>
|
|
79
|
+
</Box>
|
|
80
|
+
}
|
|
81
|
+
/>
|
|
82
|
+
</Card>
|
|
83
|
+
<Card padding={3} tone="critical">
|
|
84
|
+
<TextInput
|
|
85
|
+
placeholder="critical"
|
|
86
|
+
prefix={
|
|
87
|
+
<Box padding={3}>
|
|
88
|
+
<Text>prefix</Text>
|
|
89
|
+
</Box>
|
|
90
|
+
}
|
|
91
|
+
suffix={
|
|
92
|
+
<Box padding={3}>
|
|
93
|
+
<Text>suffix</Text>
|
|
94
|
+
</Box>
|
|
95
|
+
}
|
|
96
|
+
/>
|
|
97
|
+
</Card>
|
|
98
|
+
</Stack>
|
|
99
|
+
</Container>
|
|
239
100
|
)
|
|
240
101
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {TextInput} from '@sanity/ui'
|
|
2
2
|
import {useSelect} from '@sanity/ui-workshop'
|
|
3
3
|
import React, {useCallback, useState} from 'react'
|
|
4
4
|
import {WORKSHOP_TEXT_INPUT_TYPE_OPTIONS} from '../../../__workshop__/constants'
|
|
@@ -12,11 +12,5 @@ export default function TypedStory() {
|
|
|
12
12
|
setValue(event.currentTarget.value)
|
|
13
13
|
}, [])
|
|
14
14
|
|
|
15
|
-
return
|
|
16
|
-
<Box padding={4}>
|
|
17
|
-
<Container width={1}>
|
|
18
|
-
<TextInput onChange={handleChange} type={type} value={value} />
|
|
19
|
-
</Container>
|
|
20
|
-
</Box>
|
|
21
|
-
)
|
|
15
|
+
return <TextInput onChange={handleChange} type={type} value={value} />
|
|
22
16
|
}
|