@sanity/ui 3.0.0-static.19 → 3.0.0-static.20
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/_visual-editing.cjs +109 -112
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/buildCommand.cjs +30 -24
- package/dist/_chunks-cjs/buildCommand.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +110 -113
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/css.cjs +379 -358
- package/dist/css.cjs.map +1 -1
- package/dist/css.d.cts +45 -10
- package/dist/css.d.ts +45 -10
- package/dist/css.js +379 -358
- package/dist/css.js.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/theme.cjs +89 -64
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +28 -2
- package/dist/theme.d.ts +28 -2
- package/dist/theme.js +89 -64
- package/dist/theme.js.map +1 -1
- package/dist/ui-system.css +1236 -801
- package/dist/ui-system.min.css +1 -1
- package/dist/ui-theme.css +413 -82
- package/dist/ui-theme.min.css +1 -1
- package/dist/ui.css +1649 -883
- package/dist/ui.min.css +1 -1
- package/exports/_visual-editing.ts +0 -1
- package/package.json +6 -6
- package/src/cli/buildCommand.ts +48 -41
- package/src/core/components/autocomplete/__workshop__/async.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/custom.tsx +12 -11
- package/src/core/components/autocomplete/__workshop__/example.tsx +13 -12
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +53 -54
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -2
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +2 -2
- package/src/core/components/dialog/__workshop__/onScroll.tsx +16 -4
- package/src/core/components/dialog/__workshop__/position.tsx +3 -3
- package/src/core/components/dialog/__workshop__/props.tsx +6 -6
- package/src/core/components/menu/__workshop__/menuButton.tsx +3 -3
- package/src/core/components/menu/__workshop__/tones.tsx +3 -3
- package/src/core/components/skeleton/__workshop__/delay.tsx +2 -2
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +2 -2
- package/src/core/components/tab/__workshop__/example.tsx +1 -1
- package/src/core/components/toast/__workshop__/toast.tsx +5 -5
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +2 -2
- package/src/core/primitives/avatar/__workshop__/stack.tsx +2 -2
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +1 -1
- package/src/core/primitives/badge/__workshop__/props.tsx +5 -8
- package/src/core/primitives/box/__workshop__/props.tsx +2 -2
- package/src/core/primitives/box/box.tsx +2 -0
- package/src/core/primitives/button/__workshop__/props.tsx +17 -19
- package/src/core/primitives/button/__workshop__/stacked.tsx +12 -12
- package/src/core/primitives/card/__workshop__/asButton.tsx +1 -1
- package/src/core/primitives/card/__workshop__/interactive.tsx +2 -2
- package/src/core/primitives/card/__workshop__/props.tsx +11 -11
- package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
- package/src/core/primitives/checkbox/__workshop__/props.tsx +5 -5
- package/src/core/primitives/code/__workshop__/props.tsx +4 -7
- package/src/core/primitives/code/code.tsx +1 -1
- package/src/core/primitives/container/__workshop__/example.tsx +2 -2
- package/src/core/primitives/flex/__workshop__/example.tsx +2 -2
- package/src/core/primitives/heading/__workshop__/plain.tsx +11 -7
- package/src/core/primitives/heading/heading.tsx +1 -1
- package/src/core/primitives/inline/__workshop__/plain.tsx +2 -5
- package/src/core/primitives/label/__workshop__/plain.tsx +7 -8
- package/src/core/primitives/label/label.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +6 -6
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +3 -3
- 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 +3 -1
- package/src/core/primitives/radio/__workshop__/example.tsx +2 -2
- package/src/core/primitives/radio/__workshop__/plain.tsx +3 -3
- package/src/core/primitives/select/__workshop__/plain.tsx +5 -8
- package/src/core/primitives/spinner/__workshop__/Props.tsx +3 -3
- package/src/core/primitives/stack/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
- package/src/core/primitives/text/__workshop__/example.tsx +8 -11
- package/src/core/primitives/textArea/__workshop__/plain.tsx +11 -12
- package/src/core/primitives/textArea/textArea.tsx +10 -7
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/plain.tsx +30 -18
- package/src/core/primitives/textInput/__workshop__/states.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/typed.tsx +2 -2
- package/src/core/primitives/textInput/textInput.tsx +11 -20
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +3 -3
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/props.tsx +4 -4
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/tooltipLayer.tsx +1 -3
- package/src/css/_system.style.ts +2 -0
- package/src/css/aspects/font/font.style.ts +9 -8
- package/src/css/aspects/index.ts +1 -0
- package/src/css/aspects/margin/margin.style.ts +13 -0
- package/src/css/aspects/margin/types.ts +12 -7
- package/src/css/aspects/minHeight/index.ts +2 -0
- package/src/css/aspects/minHeight/minHeight.style.ts +9 -0
- package/src/css/aspects/minHeight/minHeight.ts +8 -0
- package/src/css/aspects/minHeight/types.ts +9 -0
- package/src/css/components/skeleton/skeleton.style.ts +7 -10
- package/src/css/primitives/_input/_input.style.ts +30 -51
- package/src/css/primitives/_selectable/_selectable.style.ts +2 -3
- package/src/css/primitives/box/box.style.ts +0 -3
- package/src/css/primitives/box/box.ts +2 -0
- package/src/css/primitives/box/types.ts +2 -0
- package/src/css/primitives/card/card.style.ts +3 -0
- package/src/css/primitives/code/code.style.ts +1 -0
- package/src/css/primitives/heading/heading.style.ts +1 -0
- package/src/css/primitives/label/label.style.ts +1 -0
- package/src/css/primitives/text/text.style.ts +1 -0
- package/src/css/primitives/textArea/textArea.style.ts +1 -3
- package/src/css/primitives/textInput/textInput.style.ts +10 -18
- package/src/css/primitives/textInput/textInput.ts +15 -0
- package/src/css/primitives/tooltip/tooltip.style.ts +0 -13
- package/src/css/primitives/tooltip/tooltip.ts +0 -5
- package/src/css/theme/resolveTheme.ts +29 -18
- package/src/theme/v0/font.ts +0 -1
- package/src/theme/v2/defaults/fonts.ts +0 -1
- package/src/theme/v3/_parseColorToken.ts +0 -5
- package/src/theme/v3/buildTheme_v3.ts +2 -2
- package/src/theme/v3/defaultFonts.ts +250 -0
- package/src/theme/v3/defaultTokens.ts +39 -35
- package/src/theme/v3/types.ts +35 -2
- package/src/theme/versioning/v3_v2.ts +1 -0
- package/src/css/primitives/_input/__workshop__/customInput.tsx +0 -16
- package/src/css/primitives/_input/__workshop__/index.ts +0 -14
- /package/src/core/components/autocomplete/{__mocks__ → __workshop__/mock}/apiStore.ts +0 -0
- /package/src/core/components/autocomplete/{__mocks__ → __workshop__/mock}/countries.ts +0 -0
|
@@ -4,24 +4,23 @@ import {useState} from 'react'
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
WORKSHOP_CARD_TONE_OPTIONS,
|
|
7
|
-
WORKSHOP_FONT_WEIGHT_OPTIONS,
|
|
8
7
|
WORKSHOP_RADIUS_OPTIONS,
|
|
9
8
|
WORKSHOP_SPACE_OPTIONS,
|
|
10
9
|
WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
|
|
11
|
-
} from '
|
|
10
|
+
} from '$workshop'
|
|
12
11
|
|
|
13
12
|
export default function PlainStory() {
|
|
14
13
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS)
|
|
15
14
|
|
|
16
|
-
const border = useBoolean('Border', true
|
|
17
|
-
const customValidity = useText('Custom validity'
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
15
|
+
const border = useBoolean('Border', true)
|
|
16
|
+
const customValidity = useText('Custom validity')
|
|
17
|
+
const disableFocusRing = useBoolean('Disable focus ring (unstable)', false)
|
|
18
|
+
const disabled = useBoolean('Disabled', false)
|
|
19
|
+
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
|
|
20
|
+
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
|
|
21
|
+
const placeholder = useText('Placeholder', 'Placeholder')
|
|
22
|
+
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2)
|
|
23
|
+
const readOnly = useBoolean('Read only', false)
|
|
25
24
|
|
|
26
25
|
const [value, setValue] = useState('')
|
|
27
26
|
|
|
@@ -41,6 +40,7 @@ export default function PlainStory() {
|
|
|
41
40
|
TextArea
|
|
42
41
|
</Text>
|
|
43
42
|
<TextArea
|
|
43
|
+
__unstable_disableFocusRing={disableFocusRing}
|
|
44
44
|
border={border}
|
|
45
45
|
customValidity={customValidity}
|
|
46
46
|
disabled={disabled}
|
|
@@ -53,7 +53,6 @@ export default function PlainStory() {
|
|
|
53
53
|
readOnly={readOnly}
|
|
54
54
|
rows={10}
|
|
55
55
|
value={value}
|
|
56
|
-
weight={weight}
|
|
57
56
|
/>
|
|
58
57
|
</Stack>
|
|
59
58
|
</Container>
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
textArea,
|
|
6
6
|
type TextAreaStyleProps,
|
|
7
7
|
} from '@sanity/ui/css'
|
|
8
|
-
import type {Space
|
|
8
|
+
import type {Space} from '@sanity/ui/theme'
|
|
9
9
|
import {useImperativeHandle, useRef} from 'react'
|
|
10
10
|
|
|
11
11
|
import {useCustomValidity} from '../../hooks'
|
|
@@ -23,7 +23,6 @@ export type TextAreaOwnProps = TextAreaStyleProps & {
|
|
|
23
23
|
customValidity?: string
|
|
24
24
|
/** @deprecated Use `gap` instead. */
|
|
25
25
|
space?: ResponsiveProp<Space>
|
|
26
|
-
weight?: ThemeFontWeightKey
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
/** @public */
|
|
@@ -45,7 +44,7 @@ export function TextArea<E extends TextAreaElementType = typeof DEFAULT_TEXT_ARE
|
|
|
45
44
|
) {
|
|
46
45
|
const {
|
|
47
46
|
// TODO: fix this
|
|
48
|
-
|
|
47
|
+
|
|
49
48
|
__unstable_disableFocusRing,
|
|
50
49
|
as: Element = DEFAULT_TEXT_AREA_ELEMENT,
|
|
51
50
|
border = true,
|
|
@@ -58,9 +57,6 @@ export function TextArea<E extends TextAreaElementType = typeof DEFAULT_TEXT_ARE
|
|
|
58
57
|
readOnly,
|
|
59
58
|
ref: forwardedRef,
|
|
60
59
|
space = 3,
|
|
61
|
-
// TODO: fix this
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
63
|
-
weight,
|
|
64
60
|
...rest
|
|
65
61
|
} = props as TextAreaProps<typeof DEFAULT_TEXT_AREA_ELEMENT>
|
|
66
62
|
|
|
@@ -75,7 +71,13 @@ export function TextArea<E extends TextAreaElementType = typeof DEFAULT_TEXT_ARE
|
|
|
75
71
|
|
|
76
72
|
return (
|
|
77
73
|
<span
|
|
78
|
-
className={textArea({
|
|
74
|
+
className={textArea({
|
|
75
|
+
border,
|
|
76
|
+
fontSize,
|
|
77
|
+
padding,
|
|
78
|
+
radius,
|
|
79
|
+
gap: gap ?? space,
|
|
80
|
+
})}
|
|
79
81
|
data-invalid={customValidity ? '' : undefined}
|
|
80
82
|
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
81
83
|
data-ui="TextArea"
|
|
@@ -83,6 +85,7 @@ export function TextArea<E extends TextAreaElementType = typeof DEFAULT_TEXT_ARE
|
|
|
83
85
|
<Element
|
|
84
86
|
{...rest}
|
|
85
87
|
className={_inputElement()}
|
|
88
|
+
data-no-focus-ring={__unstable_disableFocusRing ? '' : undefined}
|
|
86
89
|
disabled={disabled}
|
|
87
90
|
readOnly={readOnly}
|
|
88
91
|
ref={ref}
|
|
@@ -2,7 +2,7 @@ import {Button, Card, Container, Stack, TextInput} from '@sanity/ui'
|
|
|
2
2
|
import {useText} from '@sanity/ui-workshop'
|
|
3
3
|
|
|
4
4
|
export default function CustomValidityStory() {
|
|
5
|
-
const customValidity = useText('Custom validity', 'Invalid value'
|
|
5
|
+
const customValidity = useText('Custom validity', 'Invalid value') || undefined
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
8
|
<Container as="form" onSubmit={(event) => event.preventDefault()} width={0}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {icons} from '@sanity/icons'
|
|
2
|
-
import {Container, Flex, Stack, Text, TextInput} from '@sanity/ui'
|
|
2
|
+
import {Box, Container, Flex, Stack, Text, TextInput} from '@sanity/ui'
|
|
3
3
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
4
4
|
import {type PerfTestProps, usePerfTest} from '@sanity/ui-workshop/plugin-perf'
|
|
5
5
|
import {fireEvent} from '@testing-library/dom'
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
WORKSHOP_RADIUS_OPTIONS,
|
|
12
12
|
WORKSHOP_SPACE_OPTIONS,
|
|
13
13
|
WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
|
|
14
|
-
} from '
|
|
14
|
+
} from '$workshop'
|
|
15
15
|
|
|
16
16
|
const typingPerfTest: PerfTestProps<HTMLInputElement> = {
|
|
17
17
|
name: 'typing',
|
|
@@ -50,20 +50,20 @@ export default function PlainStory() {
|
|
|
50
50
|
|
|
51
51
|
function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
|
|
52
52
|
const {inputRef: ref} = props
|
|
53
|
-
const border = useBoolean('Border', true
|
|
54
|
-
const customValidity = useText('Custom validity'
|
|
55
|
-
const disabled = useBoolean('Disabled', false
|
|
56
|
-
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2
|
|
57
|
-
const gap = useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 3
|
|
58
|
-
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'search'
|
|
59
|
-
const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS, 'cube'
|
|
60
|
-
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3
|
|
61
|
-
const placeholder = useText('Placeholder'
|
|
62
|
-
const prefix = useBoolean('Prefix', false
|
|
63
|
-
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2
|
|
64
|
-
const readOnly = useBoolean('Read only', false
|
|
65
|
-
const suffix = useBoolean('Suffix', false
|
|
66
|
-
const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS
|
|
53
|
+
const border = useBoolean('Border', true)
|
|
54
|
+
const customValidity = useText('Custom validity')
|
|
55
|
+
const disabled = useBoolean('Disabled', false)
|
|
56
|
+
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
|
|
57
|
+
const gap = useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 3)
|
|
58
|
+
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'search')
|
|
59
|
+
const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS, 'cube')
|
|
60
|
+
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
|
|
61
|
+
const placeholder = useText('Placeholder')
|
|
62
|
+
const prefix = useBoolean('Prefix', false)
|
|
63
|
+
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2)
|
|
64
|
+
const readOnly = useBoolean('Read only', false)
|
|
65
|
+
const suffix = useBoolean('Suffix', false)
|
|
66
|
+
const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS)
|
|
67
67
|
|
|
68
68
|
const [value, setValue] = useState('')
|
|
69
69
|
|
|
@@ -86,11 +86,23 @@ function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
|
|
|
86
86
|
onChange={handleChange}
|
|
87
87
|
padding={padding}
|
|
88
88
|
placeholder={placeholder}
|
|
89
|
-
prefix={
|
|
89
|
+
prefix={
|
|
90
|
+
prefix && (
|
|
91
|
+
<Box padding={padding}>
|
|
92
|
+
<Text size={fontSize}>Prefix</Text>
|
|
93
|
+
</Box>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
90
96
|
radius={radius}
|
|
91
97
|
readOnly={readOnly}
|
|
92
98
|
ref={ref}
|
|
93
|
-
suffix={
|
|
99
|
+
suffix={
|
|
100
|
+
suffix && (
|
|
101
|
+
<Box padding={padding}>
|
|
102
|
+
<Text size={fontSize}>Suffix</Text>
|
|
103
|
+
</Box>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
94
106
|
value={value}
|
|
95
107
|
weight={weight}
|
|
96
108
|
/>
|
|
@@ -2,7 +2,7 @@ import {Container, Flex, Stack, Text, TextInput} from '@sanity/ui'
|
|
|
2
2
|
import {useAction, useBoolean} from '@sanity/ui-workshop'
|
|
3
3
|
|
|
4
4
|
export default function StatesStory() {
|
|
5
|
-
const invalid = useBoolean('Invalid', false
|
|
5
|
+
const invalid = useBoolean('Invalid', false)
|
|
6
6
|
const onChange = useAction('onChange')
|
|
7
7
|
|
|
8
8
|
return (
|
|
@@ -2,10 +2,10 @@ import {Box, Container, TextInput} from '@sanity/ui'
|
|
|
2
2
|
import {useSelect} from '@sanity/ui-workshop'
|
|
3
3
|
import {useCallback, useState} from 'react'
|
|
4
4
|
|
|
5
|
-
import {WORKSHOP_TEXT_INPUT_TYPE_OPTIONS} from '
|
|
5
|
+
import {WORKSHOP_TEXT_INPUT_TYPE_OPTIONS} from '$workshop'
|
|
6
6
|
|
|
7
7
|
export default function TypedStory() {
|
|
8
|
-
const type = useSelect('Type', WORKSHOP_TEXT_INPUT_TYPE_OPTIONS, 'text'
|
|
8
|
+
const type = useSelect('Type', WORKSHOP_TEXT_INPUT_TYPE_OPTIONS, 'text')
|
|
9
9
|
|
|
10
10
|
const [value, setValue] = useState('')
|
|
11
11
|
|
|
@@ -6,6 +6,9 @@ import {
|
|
|
6
6
|
type InputStyleProps,
|
|
7
7
|
type ResponsiveProp,
|
|
8
8
|
textInput,
|
|
9
|
+
textInputElement,
|
|
10
|
+
textInputPrefix,
|
|
11
|
+
textInputSuffix,
|
|
9
12
|
} from '@sanity/ui/css'
|
|
10
13
|
import type {Space, ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
11
14
|
import {
|
|
@@ -176,7 +179,6 @@ export function TextInput<E extends TextInputElementType = typeof DEFAULT_TEXT_I
|
|
|
176
179
|
return (
|
|
177
180
|
<Box
|
|
178
181
|
align="center"
|
|
179
|
-
as="span"
|
|
180
182
|
className={_composeClassNames(
|
|
181
183
|
className,
|
|
182
184
|
textInput({
|
|
@@ -198,30 +200,25 @@ export function TextInput<E extends TextInputElementType = typeof DEFAULT_TEXT_I
|
|
|
198
200
|
display="flex"
|
|
199
201
|
>
|
|
200
202
|
{prefix && (
|
|
201
|
-
<Box
|
|
203
|
+
<Box className={textInputPrefix()} sizing="border">
|
|
202
204
|
<span>{prefix}</span>
|
|
203
205
|
</Box>
|
|
204
206
|
)}
|
|
205
207
|
|
|
206
|
-
<Box
|
|
208
|
+
<Box className={textInputElement()} flex={1} position="relative">
|
|
207
209
|
<Element
|
|
208
210
|
{...rest}
|
|
209
211
|
className={_inputElement()}
|
|
212
|
+
data-no-focus-ring={__unstable_disableFocusRing ? '' : undefined}
|
|
210
213
|
disabled={disabled}
|
|
211
214
|
readOnly={readOnly}
|
|
212
215
|
ref={ref}
|
|
213
216
|
type={type}
|
|
214
217
|
/>
|
|
215
218
|
|
|
216
|
-
<Box
|
|
217
|
-
as="span"
|
|
218
|
-
// $unstableDisableFocusRing={__unstable_disableFocusRing}
|
|
219
|
-
className={_inputPresentation()}
|
|
220
|
-
data-disable-focus-ring={__unstable_disableFocusRing ? '' : undefined}
|
|
221
|
-
position="absolute"
|
|
222
|
-
>
|
|
219
|
+
<Box className={_inputPresentation()} position="absolute">
|
|
223
220
|
{IconComponent && (
|
|
224
|
-
<Box
|
|
221
|
+
<Box padding={padding} position="absolute" style={{top: 0, left: 0}}>
|
|
225
222
|
<Text size={fontSize}>
|
|
226
223
|
{isValidElement(IconComponent) && IconComponent}
|
|
227
224
|
{isValidElementType(IconComponent) && <IconComponent />}
|
|
@@ -230,7 +227,7 @@ export function TextInput<E extends TextInputElementType = typeof DEFAULT_TEXT_I
|
|
|
230
227
|
)}
|
|
231
228
|
|
|
232
229
|
{!withClearButton && IconRightComponent && (
|
|
233
|
-
<Box
|
|
230
|
+
<Box padding={padding} position="absolute" style={{top: 0, right: 0}}>
|
|
234
231
|
<Text size={fontSize}>
|
|
235
232
|
{isValidElement(IconRightComponent) && IconRightComponent}
|
|
236
233
|
{isValidElementType(IconRightComponent) && <IconRightComponent />}
|
|
@@ -240,13 +237,7 @@ export function TextInput<E extends TextInputElementType = typeof DEFAULT_TEXT_I
|
|
|
240
237
|
</Box>
|
|
241
238
|
|
|
242
239
|
{!disabled && !readOnly && clearButton && (
|
|
243
|
-
<Box
|
|
244
|
-
as="span"
|
|
245
|
-
padding={clearButtonBoxPadding}
|
|
246
|
-
position="absolute"
|
|
247
|
-
style={CLEAR_BUTTON_BOX_STYLE}
|
|
248
|
-
// tone={customValidity ? 'critical' : 'inherit'}
|
|
249
|
-
>
|
|
240
|
+
<Box padding={clearButtonBoxPadding} position="absolute" style={CLEAR_BUTTON_BOX_STYLE}>
|
|
250
241
|
<Button
|
|
251
242
|
aria-label="Clear"
|
|
252
243
|
data-qa="clear-button"
|
|
@@ -265,7 +256,7 @@ export function TextInput<E extends TextInputElementType = typeof DEFAULT_TEXT_I
|
|
|
265
256
|
</Box>
|
|
266
257
|
|
|
267
258
|
{suffix && (
|
|
268
|
-
<Box
|
|
259
|
+
<Box className={textInputSuffix()} sizing="border">
|
|
269
260
|
<span>{suffix}</span>
|
|
270
261
|
</Box>
|
|
271
262
|
)}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
13
13
|
import {useMemo, useState} from 'react'
|
|
14
14
|
|
|
15
|
-
import {WORKSHOP_PLACEMENT_OPTIONS} from '
|
|
15
|
+
import {WORKSHOP_PLACEMENT_OPTIONS} from '$workshop'
|
|
16
16
|
|
|
17
17
|
const PORTAL_OPTIONS = {
|
|
18
18
|
'(true)': true,
|
|
@@ -26,7 +26,7 @@ export default function CustomPortalStory() {
|
|
|
26
26
|
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mollis consectetur malesuada. Sed lobortis est dolor, eget imperdiet velit placerat et. Aenean posuere mi non aliquet iaculis. Donec fermentum pulvinar purus at sagittis. Ut tincidunt massa odio, sed finibus justo ullamcorper id. Nam venenatis justo non ligula elementum cursus. Pellentesque laoreet justo in mollis sagittis. In lacinia ornare ultrices. Suspendisse potenti.',
|
|
27
27
|
)
|
|
28
28
|
const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS, 'top')
|
|
29
|
-
const portal = useSelect('Portal', PORTAL_OPTIONS
|
|
29
|
+
const portal = useSelect('Portal', PORTAL_OPTIONS)
|
|
30
30
|
const useBoundaryElement = useBoolean('Use boundary element', true)
|
|
31
31
|
|
|
32
32
|
const [portal1Element, setPortal1Element] = useState<HTMLDivElement | null>(null)
|
|
@@ -58,7 +58,7 @@ export default function CustomPortalStory() {
|
|
|
58
58
|
<Stack gap={2}>
|
|
59
59
|
<Tooltip
|
|
60
60
|
boundaryElement={useBoundaryElement ? boundaryElement : null}
|
|
61
|
-
content={<Text size={1}>{content}</Text>}
|
|
61
|
+
content={content ? <Text size={1}>{content}</Text> : undefined}
|
|
62
62
|
padding={2}
|
|
63
63
|
placement={placement}
|
|
64
64
|
portal={portal}
|
|
@@ -2,7 +2,7 @@ import {BoundaryElementProvider, Button, Card, Code, Flex, Stack, Text, Tooltip}
|
|
|
2
2
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
3
3
|
import {useCallback, useState} from 'react'
|
|
4
4
|
|
|
5
|
-
import {WORKSHOP_PLACEMENT_OPTIONS} from '
|
|
5
|
+
import {WORKSHOP_PLACEMENT_OPTIONS} from '$workshop'
|
|
6
6
|
|
|
7
7
|
export default function OverflowingBoundaryStory() {
|
|
8
8
|
const content = useText(
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
WORKSHOP_PLACEMENT_OPTIONS,
|
|
7
7
|
WORKSHOP_SHADOW_OPTIONS,
|
|
8
8
|
WORKSHOP_SPACE_OPTIONS,
|
|
9
|
-
} from '
|
|
9
|
+
} from '$workshop'
|
|
10
10
|
|
|
11
11
|
export default function PropsStory() {
|
|
12
12
|
const arrow = useBoolean('Arrow', false)
|
|
13
13
|
const content = useText('Content', 'Tooltip content')
|
|
14
|
-
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 2
|
|
14
|
+
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 2)
|
|
15
15
|
const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS, 'top')
|
|
16
16
|
const portal = useBoolean('Portal', true)
|
|
17
|
-
const openDelay = useNumber('Open Delay', 200)
|
|
18
|
-
const closeDelay = useNumber('Close Delay', 200)
|
|
17
|
+
const openDelay = useNumber('Open Delay', 200)
|
|
18
|
+
const closeDelay = useNumber('Close Delay', 200)
|
|
19
19
|
const shadow = useSelect('Shadow', WORKSHOP_SHADOW_OPTIONS, 2)
|
|
20
20
|
|
|
21
21
|
return (
|
|
@@ -2,7 +2,7 @@ import {BoundaryElementProvider, Button, Card, Code, Flex, Text, Tooltip} from '
|
|
|
2
2
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
3
3
|
import {useState} from 'react'
|
|
4
4
|
|
|
5
|
-
import {WORKSHOP_PLACEMENT_OPTIONS} from '
|
|
5
|
+
import {WORKSHOP_PLACEMENT_OPTIONS} from '$workshop'
|
|
6
6
|
|
|
7
7
|
export default function ResizableBoundaryStory() {
|
|
8
8
|
const content = useText(
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {tooltipCard} from '@sanity/ui/css'
|
|
2
1
|
import {motion, type MotionStyle} from 'framer-motion'
|
|
3
2
|
import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
|
|
4
3
|
|
|
@@ -73,10 +72,9 @@ export function TooltipLayer(props: TooltipLayerProps) {
|
|
|
73
72
|
return (
|
|
74
73
|
// @ts-expect-error - TODO: fix this
|
|
75
74
|
<Layer
|
|
76
|
-
data-ui="
|
|
75
|
+
data-ui="Tooltip__layer"
|
|
77
76
|
{...rest}
|
|
78
77
|
as={motion.div}
|
|
79
|
-
className={tooltipCard()}
|
|
80
78
|
data-animate={animate ? '' : undefined}
|
|
81
79
|
data-placement={placement}
|
|
82
80
|
padding={padding}
|
package/src/css/_system.style.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {heightStyle} from './aspects/height/height.style'
|
|
|
24
24
|
import {insetStyle} from './aspects/inset/inset.style'
|
|
25
25
|
import {marginStyle} from './aspects/margin/margin.style'
|
|
26
26
|
import {maxWidthStyle} from './aspects/maxWidth/maxWidth.style'
|
|
27
|
+
import {minHeightStyle} from './aspects/minHeight/minHeight.style'
|
|
27
28
|
import {minWidthStyle} from './aspects/minWidth/minWidth.style'
|
|
28
29
|
import {outlineStyle} from './aspects/outline/outline.style'
|
|
29
30
|
import {overflowStyle} from './aspects/overflow/overflow.style'
|
|
@@ -110,6 +111,7 @@ export const _systemStyle: Style = _mergeStyles([
|
|
|
110
111
|
insetStyle,
|
|
111
112
|
marginStyle,
|
|
112
113
|
maxWidthStyle,
|
|
114
|
+
minHeightStyle,
|
|
113
115
|
minWidthStyle,
|
|
114
116
|
outlineStyle,
|
|
115
117
|
overflowStyle,
|
|
@@ -14,9 +14,11 @@ export const primitive: StyleRules = {
|
|
|
14
14
|
margin: '0',
|
|
15
15
|
|
|
16
16
|
vars: {
|
|
17
|
-
[varNames.font.
|
|
18
|
-
`calc(
|
|
19
|
-
[varNames.font.
|
|
17
|
+
[varNames.font.capHeight]:
|
|
18
|
+
`calc(${vars.font.lineHeight} - ${vars.font.ascenderHeight} - ${vars.font.descenderHeight})`,
|
|
19
|
+
[varNames.font.iconOffset]: `calc((${vars.font.capHeight} - ${vars.font.iconSize}) / 2)`,
|
|
20
|
+
[varNames.font.customIconOffset]:
|
|
21
|
+
`calc((${vars.font.capHeight} - ${vars.font.customIconSize}) / 2)`,
|
|
20
22
|
},
|
|
21
23
|
|
|
22
24
|
nest: {
|
|
@@ -40,11 +42,10 @@ export const primitive: StyleRules = {
|
|
|
40
42
|
display: 'inline',
|
|
41
43
|
},
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// },
|
|
45
|
+
'& svg:not([data-sanity-icon])': {
|
|
46
|
+
fontSize: vars.font.customIconSize,
|
|
47
|
+
margin: vars.font.customIconOffset,
|
|
48
|
+
},
|
|
48
49
|
|
|
49
50
|
'& [data-sanity-icon]': {
|
|
50
51
|
fontSize: vars.font.iconSize,
|
package/src/css/aspects/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ const util: StyleRules = {}
|
|
|
9
9
|
for (const space of SPACE) {
|
|
10
10
|
_responsiveRule(util, `m-${space}`, {margin: vars.space[space]})
|
|
11
11
|
}
|
|
12
|
+
_responsiveRule(util, `m-auto`, {margin: 'auto'})
|
|
12
13
|
|
|
13
14
|
for (const space of SPACE) {
|
|
14
15
|
_responsiveRule(util, `mx-${space}`, {
|
|
@@ -16,6 +17,10 @@ for (const space of SPACE) {
|
|
|
16
17
|
marginRight: vars.space[space],
|
|
17
18
|
})
|
|
18
19
|
}
|
|
20
|
+
_responsiveRule(util, `mx-auto`, {
|
|
21
|
+
marginLeft: 'auto',
|
|
22
|
+
marginRight: 'auto',
|
|
23
|
+
})
|
|
19
24
|
|
|
20
25
|
for (const space of SPACE) {
|
|
21
26
|
_responsiveRule(util, `my-${space}`, {
|
|
@@ -23,21 +28,29 @@ for (const space of SPACE) {
|
|
|
23
28
|
marginBottom: vars.space[space],
|
|
24
29
|
})
|
|
25
30
|
}
|
|
31
|
+
_responsiveRule(util, `my-auto`, {
|
|
32
|
+
marginTop: 'auto',
|
|
33
|
+
marginBottom: 'auto',
|
|
34
|
+
})
|
|
26
35
|
|
|
27
36
|
for (const i of SPACE) {
|
|
28
37
|
_responsiveRule(util, `mt-${i}`, {marginTop: vars.space[i]})
|
|
29
38
|
}
|
|
39
|
+
_responsiveRule(util, `mt-auto`, {marginTop: 'auto'})
|
|
30
40
|
|
|
31
41
|
for (const i of SPACE) {
|
|
32
42
|
_responsiveRule(util, `mr-${i}`, {marginRight: vars.space[i]})
|
|
33
43
|
}
|
|
44
|
+
_responsiveRule(util, `mr-auto`, {marginRight: 'auto'})
|
|
34
45
|
|
|
35
46
|
for (const i of SPACE) {
|
|
36
47
|
_responsiveRule(util, `mb-${i}`, {marginBottom: vars.space[i]})
|
|
37
48
|
}
|
|
49
|
+
_responsiveRule(util, `mb-auto`, {marginBottom: 'auto'})
|
|
38
50
|
|
|
39
51
|
for (const i of SPACE) {
|
|
40
52
|
_responsiveRule(util, `ml-${i}`, {marginLeft: vars.space[i]})
|
|
41
53
|
}
|
|
54
|
+
_responsiveRule(util, `ml-auto`, {marginLeft: 'auto'})
|
|
42
55
|
|
|
43
56
|
export const marginStyle: Style = {layers: {util}}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import type {Space} from '@sanity/ui/theme'
|
|
2
|
+
|
|
1
3
|
import type {ResponsiveProp} from '../../types'
|
|
2
4
|
|
|
5
|
+
/** @public */
|
|
6
|
+
export type Margin = Space | 'auto'
|
|
7
|
+
|
|
3
8
|
/** @public */
|
|
4
9
|
export interface MarginStyleProps {
|
|
5
|
-
margin?: ResponsiveProp<
|
|
6
|
-
marginTop?: ResponsiveProp<
|
|
7
|
-
marginRight?: ResponsiveProp<
|
|
8
|
-
marginBottom?: ResponsiveProp<
|
|
9
|
-
marginLeft?: ResponsiveProp<
|
|
10
|
-
marginX?: ResponsiveProp<
|
|
11
|
-
marginY?: ResponsiveProp<
|
|
10
|
+
margin?: ResponsiveProp<Margin>
|
|
11
|
+
marginTop?: ResponsiveProp<Margin>
|
|
12
|
+
marginRight?: ResponsiveProp<Margin>
|
|
13
|
+
marginBottom?: ResponsiveProp<Margin>
|
|
14
|
+
marginLeft?: ResponsiveProp<Margin>
|
|
15
|
+
marginX?: ResponsiveProp<Margin>
|
|
16
|
+
marginY?: ResponsiveProp<Margin>
|
|
12
17
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {_responsiveRule} from '../../_responsiveRule'
|
|
2
|
+
import type {Style, StyleRules} from '../../types'
|
|
3
|
+
|
|
4
|
+
const util: StyleRules = {}
|
|
5
|
+
|
|
6
|
+
_responsiveRule(util, 'min-h-0', {minHeight: '0'})
|
|
7
|
+
_responsiveRule(util, 'min-h-full', {minHeight: '100%'})
|
|
8
|
+
|
|
9
|
+
export const minHeightStyle: Style = {layers: {util}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {_resp} from '../../_resp'
|
|
2
|
+
import {_scopeClassNames} from '../../_scopeClassNames'
|
|
3
|
+
import type {MinHeightStyleProps} from './types'
|
|
4
|
+
|
|
5
|
+
/** @internal */
|
|
6
|
+
export function minHeight(props: MinHeightStyleProps): string | undefined {
|
|
7
|
+
return _scopeClassNames(_resp('min-h', props.minHeight) ?? '')
|
|
8
|
+
}
|
|
@@ -20,9 +20,6 @@ const keyframes: StyleKeyframes = {
|
|
|
20
20
|
|
|
21
21
|
const component: StyleRules = {
|
|
22
22
|
'.skeleton': {
|
|
23
|
-
[varNames.color.skeleton.from]: `color-mix(in srgb, transparent, ${vars.color.muted.fg} 5%)`,
|
|
24
|
-
[varNames.color.skeleton.to]: `color-mix(in srgb, transparent, ${vars.color.muted.fg} 10%)`,
|
|
25
|
-
|
|
26
23
|
'backgroundColor': vars.color.skeleton.from,
|
|
27
24
|
'backgroundPosition': '100%',
|
|
28
25
|
'backgroundSize': '200% 100%',
|
|
@@ -33,14 +30,14 @@ const component: StyleRules = {
|
|
|
33
30
|
'nest': {
|
|
34
31
|
'&[data-animated]': {
|
|
35
32
|
backgroundImage: [
|
|
36
|
-
`linear-gradient(to right
|
|
37
|
-
vars.color.skeleton.from
|
|
38
|
-
vars.color.skeleton.to
|
|
39
|
-
vars.color.skeleton.from
|
|
40
|
-
vars.color.skeleton.from
|
|
41
|
-
vars.color.skeleton.from
|
|
33
|
+
`linear-gradient(to right,`,
|
|
34
|
+
`${vars.color.skeleton.from},`,
|
|
35
|
+
`${vars.color.skeleton.to},`,
|
|
36
|
+
`${vars.color.skeleton.from},`,
|
|
37
|
+
`${vars.color.skeleton.from},`,
|
|
38
|
+
`${vars.color.skeleton.from}`,
|
|
42
39
|
`)`,
|
|
43
|
-
].join('
|
|
40
|
+
].join(''),
|
|
44
41
|
animationName: KEYFRAMES_PULSE,
|
|
45
42
|
animationTimingFunction: 'ease-in-out',
|
|
46
43
|
animationIterationCount: 'infinite',
|