@sanity/ui 4.0.0-static.2 → 4.0.0-static.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/dist/css/index.css +2 -1
- package/dist/css/index.css.map +1 -0
- package/dist/css/index.d.ts +29 -1
- package/dist/css/index.js +17965 -50
- package/dist/css/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -16
- package/dist/index.js.map +1 -1
- package/package.json +38 -48
- package/src/core/components/autocomplete/__workshop__/custom.tsx +14 -1
- package/src/core/components/autocomplete/__workshop__/example.tsx +12 -1
- package/src/core/components/dialog/__workshop__/position.tsx +9 -1
- package/src/core/components/dialog/__workshop__/props.tsx +2 -0
- package/src/core/components/menu/__workshop__/menuButton.tsx +6 -1
- package/src/core/components/menu/__workshop__/tones.tsx +7 -1
- package/src/core/components/menu/menu.tsx +1 -1
- package/src/core/components/menu/menuButton.tsx +10 -5
- package/src/core/components/menu/menuContext.ts +1 -1
- package/src/core/components/menu/menuGroup.tsx +7 -4
- package/src/core/components/menu/menuItem.tsx +1 -1
- package/src/core/components/toast/__workshop__/toast.tsx +2 -0
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +8 -1
- package/src/core/primitives/avatar/__workshop__/stack.tsx +5 -1
- package/src/core/primitives/badge/__workshop__/props.tsx +12 -1
- package/src/core/primitives/box/__workshop__/props.tsx +6 -1
- package/src/core/primitives/button/__workshop__/props.tsx +22 -0
- package/src/core/primitives/button/__workshop__/stacked.tsx +16 -0
- package/src/core/primitives/card/__workshop__/props.tsx +10 -0
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/card.tsx +2 -2
- package/src/core/primitives/code/__workshop__/props.tsx +6 -1
- package/src/core/primitives/container/__workshop__/example.tsx +6 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +7 -1
- package/src/core/primitives/heading/__workshop__/plain.tsx +12 -1
- package/src/core/primitives/inline/__workshop__/plain.tsx +5 -1
- package/src/core/primitives/label/__workshop__/plain.tsx +15 -1
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +13 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +2 -0
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +8 -0
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +7 -1
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +6 -0
- package/src/core/primitives/popover/popover.tsx +0 -1
- package/src/core/primitives/select/__workshop__/plain.tsx +4 -0
- package/src/core/primitives/skeleton/__workshop__/delay.tsx +9 -1
- package/src/core/primitives/skeleton/__workshop__/skeleton.tsx +9 -1
- package/src/core/primitives/spinner/__workshop__/Props.tsx +6 -1
- package/src/core/primitives/stack/__workshop__/plain.tsx +4 -1
- package/src/core/primitives/text/__workshop__/colored.tsx +8 -1
- package/src/core/primitives/text/__workshop__/example.tsx +15 -1
- package/src/core/primitives/textArea/__workshop__/plain.tsx +8 -0
- package/src/core/primitives/textInput/__workshop__/plain.tsx +34 -4
- package/src/core/primitives/textInput/__workshop__/typed.tsx +7 -1
- package/src/core/primitives/textInput/textInput.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +2 -0
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +2 -0
- package/src/core/primitives/tooltip/__workshop__/props.tsx +12 -0
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +5 -0
- package/src/css/primitives/avatar/avatar.css.ts +9 -5
- package/src/css/primitives/card/__workshop__/color.tsx +9 -1
- package/src/css/primitives/card/card.css.ts +10 -0
- package/src/css/theme/buildCSSTheme.ts +4 -0
- package/src/css/types.ts +4 -0
- package/src/css/vars.css.ts +4 -0
- package/dist/_chunks-cjs/refractor.cjs +0 -22
- package/dist/_chunks-cjs/refractor.cjs.map +0 -1
- package/dist/css/index.cjs +0 -966
- package/dist/css/index.cjs.map +0 -1
- package/dist/css/index.d.cts +0 -1370
- package/dist/index.cjs +0 -4515
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -2521
- package/dist/theme.cjs +0 -870
- package/dist/theme.cjs.map +0 -1
- package/dist/theme.d.cts +0 -499
|
@@ -10,30 +10,40 @@ import {
|
|
|
10
10
|
} from '$workshop'
|
|
11
11
|
|
|
12
12
|
export default function PropsStory(): React.JSX.Element {
|
|
13
|
+
// @ts-expect-error - TODO: fix this
|
|
13
14
|
const as = useSelect('As', WORKSHOP_CARD_AS_OPTIONS, 'div')
|
|
14
15
|
const border = useBoolean('Border', false)
|
|
15
16
|
const checkered = useBoolean('Checkered', false)
|
|
16
17
|
const muted = useBoolean('Muted', false)
|
|
18
|
+
// @ts-expect-error - TODO: fix this
|
|
17
19
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
|
|
18
20
|
const pressed = useBoolean('Pressed', false)
|
|
21
|
+
// @ts-expect-error - TODO: fix this
|
|
19
22
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 0)
|
|
20
23
|
const selected = useBoolean('Selected', false)
|
|
24
|
+
// @ts-expect-error - TODO: fix this
|
|
21
25
|
const shadow = useSelect('Shadow', WORKSHOP_SHADOW_OPTIONS, 0)
|
|
26
|
+
// @ts-expect-error - TODO: fix this
|
|
22
27
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS, 'default')
|
|
23
28
|
|
|
24
29
|
return (
|
|
25
30
|
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
26
31
|
<Card
|
|
27
32
|
__unstable_checkered={checkered}
|
|
33
|
+
// @ts-expect-error - TODO: fix this
|
|
28
34
|
as={as}
|
|
29
35
|
border={border}
|
|
30
36
|
muted={muted}
|
|
31
37
|
onClick={useAction('onClick')}
|
|
38
|
+
// @ts-expect-error - TODO: fix this
|
|
32
39
|
padding={padding}
|
|
33
40
|
pressed={pressed}
|
|
41
|
+
// @ts-expect-error - TODO: fix this
|
|
34
42
|
radius={radius}
|
|
35
43
|
selected={selected}
|
|
44
|
+
// @ts-expect-error - TODO: fix this
|
|
36
45
|
shadow={shadow}
|
|
46
|
+
// @ts-expect-error - TODO: fix this
|
|
37
47
|
tone={tone}
|
|
38
48
|
>
|
|
39
49
|
<Stack gap={3}>
|
|
@@ -47,7 +47,6 @@ export function Card<E extends CardElementType = typeof DEFAULT_CARD_ELEMENT>(
|
|
|
47
47
|
__unstable_focusRing: focusRing = false,
|
|
48
48
|
as = DEFAULT_CARD_ELEMENT,
|
|
49
49
|
className,
|
|
50
|
-
disabled,
|
|
51
50
|
pressed,
|
|
52
51
|
radius = 0,
|
|
53
52
|
scheme: schemeProp,
|
|
@@ -72,7 +71,8 @@ export function Card<E extends CardElementType = typeof DEFAULT_CARD_ELEMENT>(
|
|
|
72
71
|
tone,
|
|
73
72
|
})}
|
|
74
73
|
data-checkered={checkered ? '' : undefined}
|
|
75
|
-
|
|
74
|
+
// Extract the disabled prop without removing it from `...rest` so that the underlying <button> or <a> has `[disabled]` when needed
|
|
75
|
+
data-disabled={props.disabled ? '' : undefined}
|
|
76
76
|
data-focus-ring={focusRing ? '' : undefined}
|
|
77
77
|
data-pressed={pressed ? '' : undefined}
|
|
78
78
|
data-selected={selected ? '' : undefined}
|
|
@@ -6,11 +6,16 @@ import {WORKSHOP_CODE_LANGUAGE_OPTIONS, WORKSHOP_TEXT_FONT_SIZE_OPTIONS} from '$
|
|
|
6
6
|
export default function PropsStory(): React.JSX.Element {
|
|
7
7
|
const code = useText('Code', `console.log('Hello, world')`)
|
|
8
8
|
const language = useSelect('Language', WORKSHOP_CODE_LANGUAGE_OPTIONS, 'typescript')
|
|
9
|
+
// @ts-expect-error - TODO: fix this
|
|
9
10
|
const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 1)
|
|
10
11
|
|
|
11
12
|
return (
|
|
12
13
|
<Box padding={[4, 5, 6]}>
|
|
13
|
-
<Code
|
|
14
|
+
<Code
|
|
15
|
+
language={language}
|
|
16
|
+
// @ts-expect-error - TODO: fix this
|
|
17
|
+
size={size}
|
|
18
|
+
>
|
|
14
19
|
{code}
|
|
15
20
|
</Code>
|
|
16
21
|
</Box>
|
|
@@ -4,11 +4,16 @@ import {useAction, useSelect} from '@sanity/ui-workshop'
|
|
|
4
4
|
import {WORKSHOP_CONTAINER_WIDTH_OPTIONS} from '$workshop'
|
|
5
5
|
|
|
6
6
|
export default function PlainStory(): React.JSX.Element {
|
|
7
|
+
// @ts-expect-error - TODO: fix this
|
|
7
8
|
const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS, 0)
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
11
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
11
|
-
<Container
|
|
12
|
+
<Container
|
|
13
|
+
onClick={useAction('onClick')}
|
|
14
|
+
// @ts-expect-error - TODO: fix this
|
|
15
|
+
width={width}
|
|
16
|
+
>
|
|
12
17
|
<Card padding={4} shadow={1}>
|
|
13
18
|
<Text size={1}>
|
|
14
19
|
Container with <code>max-width={width}</code>
|
|
@@ -14,10 +14,16 @@ const DebugCard = styled(Card)`
|
|
|
14
14
|
`
|
|
15
15
|
|
|
16
16
|
export default function ExampleStory(): React.JSX.Element {
|
|
17
|
+
// @ts-expect-error - TODO: fix this
|
|
17
18
|
const direction = useSelect('Direction', WORKSHOP_FLEX_DIRECTION_OPTIONS, 'row')
|
|
18
19
|
|
|
19
20
|
return (
|
|
20
|
-
<Flex
|
|
21
|
+
<Flex
|
|
22
|
+
// @ts-expect-error - TODO: fix this
|
|
23
|
+
direction={direction}
|
|
24
|
+
height="fill"
|
|
25
|
+
style={{width: '100%'}}
|
|
26
|
+
>
|
|
21
27
|
<DebugCard flex={1}>
|
|
22
28
|
<Code size={1}>1</Code>
|
|
23
29
|
</DebugCard>
|
|
@@ -9,19 +9,30 @@ import {
|
|
|
9
9
|
|
|
10
10
|
export default function PlainStory(): React.JSX.Element {
|
|
11
11
|
const muted = useBoolean('Muted', false)
|
|
12
|
+
// @ts-expect-error - TODO: fix this
|
|
12
13
|
const size = useSelect('Size', WORKSHOP_HEADING_FONT_SIZE_OPTIONS, 2)
|
|
13
14
|
const textChild = useText('Text', 'Hello, world')
|
|
14
15
|
const textOverflow = useSelect(
|
|
15
16
|
'Text overflow',
|
|
17
|
+
// @ts-expect-error - TODO: fix this
|
|
16
18
|
WORKSHOP_TEXT_OVERFLOW_OPTIONS,
|
|
17
19
|
undefined,
|
|
18
20
|
'Props',
|
|
19
21
|
)
|
|
22
|
+
// @ts-expect-error - TODO: fix this
|
|
20
23
|
const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS)
|
|
21
24
|
|
|
22
25
|
return (
|
|
23
26
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
24
|
-
<Heading
|
|
27
|
+
<Heading
|
|
28
|
+
muted={muted}
|
|
29
|
+
// @ts-expect-error - TODO: fix this
|
|
30
|
+
size={size}
|
|
31
|
+
// @ts-expect-error - TODO: fix this
|
|
32
|
+
textOverflow={textOverflow}
|
|
33
|
+
// @ts-expect-error - TODO: fix this
|
|
34
|
+
weight={weight}
|
|
35
|
+
>
|
|
25
36
|
{textChild}
|
|
26
37
|
</Heading>
|
|
27
38
|
</Flex>
|
|
@@ -6,7 +6,11 @@ import {WORKSHOP_SPACE_OPTIONS} from '$workshop'
|
|
|
6
6
|
export default function PlainStory(): React.JSX.Element {
|
|
7
7
|
return (
|
|
8
8
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
9
|
-
<Inline
|
|
9
|
+
<Inline
|
|
10
|
+
// @ts-expect-error - TODO: fix this
|
|
11
|
+
gap={useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 0)}
|
|
12
|
+
onClick={useAction('onClick')}
|
|
13
|
+
>
|
|
10
14
|
<Card padding={1} shadow={1}>
|
|
11
15
|
<Text size={1}>Inline item</Text>
|
|
12
16
|
</Card>
|
|
@@ -9,17 +9,31 @@ import {
|
|
|
9
9
|
} from '$workshop'
|
|
10
10
|
|
|
11
11
|
export default function PlainStory(): React.JSX.Element {
|
|
12
|
+
// @ts-expect-error - TODO: fix this
|
|
12
13
|
const align = useSelect('Align', WORKSHOP_TEXT_ALIGN_OPTIONS)
|
|
13
14
|
const muted = useBoolean('Muted', false)
|
|
15
|
+
// @ts-expect-error - TODO: fix this
|
|
14
16
|
const size = useSelect('Size', WORKSHOP_LABEL_FONT_SIZE_OPTIONS)
|
|
15
17
|
const textChild = useText('Text', 'Label text')
|
|
18
|
+
// @ts-expect-error - TODO: fix this
|
|
16
19
|
const textOverflow = useSelect('Text overflow', WORKSHOP_TEXT_OVERFLOW_OPTIONS)
|
|
20
|
+
// @ts-expect-error - TODO: fix this
|
|
17
21
|
const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS)
|
|
18
22
|
|
|
19
23
|
return (
|
|
20
24
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
21
25
|
<Container width={0}>
|
|
22
|
-
<Label
|
|
26
|
+
<Label
|
|
27
|
+
// @ts-expect-error - TODO: fix this
|
|
28
|
+
align={align}
|
|
29
|
+
muted={muted}
|
|
30
|
+
// @ts-expect-error - TODO: fix this
|
|
31
|
+
size={size}
|
|
32
|
+
// @ts-expect-error - TODO: fix this
|
|
33
|
+
textOverflow={textOverflow}
|
|
34
|
+
// @ts-expect-error - TODO: fix this
|
|
35
|
+
weight={weight}
|
|
36
|
+
>
|
|
23
37
|
{textChild}
|
|
24
38
|
</Label>
|
|
25
39
|
</Container>
|
|
@@ -12,11 +12,15 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export default function AlignedStory(): React.JSX.Element {
|
|
14
14
|
const constrainSize = useBoolean('Constrain size', false)
|
|
15
|
+
// @ts-expect-error - TODO: fix this
|
|
15
16
|
const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS)
|
|
16
17
|
const portal = useBoolean('Portal', true)
|
|
18
|
+
// @ts-expect-error - TODO: fix this
|
|
17
19
|
const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS, 'auto')
|
|
18
20
|
|
|
21
|
+
// @ts-expect-error - TODO: fix this
|
|
19
22
|
const flexAlign = useSelect('Align', WORKSHOP_FLEX_ALIGN_OPTIONS)
|
|
23
|
+
// @ts-expect-error - TODO: fix this
|
|
20
24
|
const flexJustify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS)
|
|
21
25
|
|
|
22
26
|
const [open, setOpen] = useState(false)
|
|
@@ -49,7 +53,13 @@ export default function AlignedStory(): React.JSX.Element {
|
|
|
49
53
|
return (
|
|
50
54
|
<Card height="fill" padding={[4, 5, 6]} sizing="border" tone="transparent">
|
|
51
55
|
<Card height="fill" padding={2} ref={setBoundaryElement} shadow={1} sizing="border">
|
|
52
|
-
<Flex
|
|
56
|
+
<Flex
|
|
57
|
+
// @ts-expect-error - TODO: fix this
|
|
58
|
+
align={flexAlign}
|
|
59
|
+
height="fill"
|
|
60
|
+
// @ts-expect-error - TODO: fix this
|
|
61
|
+
justify={flexJustify}
|
|
62
|
+
>
|
|
53
63
|
<Popover
|
|
54
64
|
constrainSize={constrainSize}
|
|
55
65
|
content={content}
|
|
@@ -58,8 +68,10 @@ export default function AlignedStory(): React.JSX.Element {
|
|
|
58
68
|
overflow="auto"
|
|
59
69
|
padding={3}
|
|
60
70
|
portal={portal}
|
|
71
|
+
// @ts-expect-error - TODO: fix this
|
|
61
72
|
placement={placement}
|
|
62
73
|
ref={popoverElementRef}
|
|
74
|
+
// @ts-expect-error - TODO: fix this
|
|
63
75
|
width={width}
|
|
64
76
|
>
|
|
65
77
|
<Button
|
|
@@ -5,6 +5,7 @@ import {WORKSHOP_PLACEMENT_OPTIONS} from '$workshop'
|
|
|
5
5
|
|
|
6
6
|
export default function MatchReferenceWidthStory(): React.JSX.Element {
|
|
7
7
|
const arrow = useBoolean('Arrow', true)
|
|
8
|
+
// @ts-expect-error - TODO: fix this
|
|
8
9
|
const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS, 'bottom')
|
|
9
10
|
|
|
10
11
|
return (
|
|
@@ -18,6 +19,7 @@ export default function MatchReferenceWidthStory(): React.JSX.Element {
|
|
|
18
19
|
}
|
|
19
20
|
matchReferenceWidth
|
|
20
21
|
open
|
|
22
|
+
// @ts-expect-error - TODO: fix this
|
|
21
23
|
placement={placement}
|
|
22
24
|
radius={2}
|
|
23
25
|
>
|
|
@@ -15,11 +15,15 @@ export default function PlainStory(): React.JSX.Element {
|
|
|
15
15
|
const constrainSize = useBoolean('Constrain size', true)
|
|
16
16
|
const matchReferenceWidth = useBoolean('Match reference width', false)
|
|
17
17
|
const open = useBoolean('Open', true)
|
|
18
|
+
// @ts-expect-error - TODO: fix this
|
|
18
19
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
|
|
20
|
+
// @ts-expect-error - TODO: fix this
|
|
19
21
|
const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS, 'bottom')
|
|
20
22
|
const portal = useBoolean('Portal', true)
|
|
21
23
|
const preventOverflow = useBoolean('Prevent overflow', true)
|
|
24
|
+
// @ts-expect-error - TODO: fix this
|
|
22
25
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2)
|
|
26
|
+
// @ts-expect-error - TODO: fix this
|
|
23
27
|
const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS, 'auto')
|
|
24
28
|
const [portalElement, setPortalElement] = useState<HTMLDivElement | null>(null)
|
|
25
29
|
const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
|
|
@@ -53,11 +57,15 @@ export default function PlainStory(): React.JSX.Element {
|
|
|
53
57
|
floatingBoundary={boundaryElementFlag ? boundaryElement : undefined}
|
|
54
58
|
matchReferenceWidth={matchReferenceWidth}
|
|
55
59
|
open={open}
|
|
60
|
+
// @ts-expect-error - TODO: fix this
|
|
56
61
|
padding={padding}
|
|
62
|
+
// @ts-expect-error - TODO: fix this
|
|
57
63
|
placement={placement}
|
|
58
64
|
portal={portal}
|
|
59
65
|
preventOverflow={preventOverflow}
|
|
66
|
+
// @ts-expect-error - TODO: fix this
|
|
60
67
|
radius={radius}
|
|
68
|
+
// @ts-expect-error - TODO: fix this
|
|
61
69
|
width={width}
|
|
62
70
|
>
|
|
63
71
|
<Button text="This button is the popover reference" />
|
|
@@ -26,6 +26,7 @@ export default function SidePanelStory(): React.JSX.Element {
|
|
|
26
26
|
const sidePanelWidth = useSelect('Side panel width', SIDE_PANEL_WIDTH, SIDE_PANEL_WIDTH.md)
|
|
27
27
|
const [sidePanel, setSidePanel] = useState<HTMLDivElement | null>(null)
|
|
28
28
|
const updateRef = useRef<PopoverUpdateCallback>(undefined)
|
|
29
|
+
// @ts-expect-error - TODO: fix this
|
|
29
30
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS) ?? 'inherit'
|
|
30
31
|
|
|
31
32
|
useEffect(() => updateRef.current?.(), [sidePanelWidth])
|
|
@@ -48,7 +49,12 @@ export default function SidePanelStory(): React.JSX.Element {
|
|
|
48
49
|
|
|
49
50
|
<Card border padding={3}>
|
|
50
51
|
<Text size={1}>
|
|
51
|
-
Some editor
|
|
52
|
+
Some editor{' '}
|
|
53
|
+
<InlineObject
|
|
54
|
+
// @ts-expect-error - TODO: fix this
|
|
55
|
+
tone={tone}
|
|
56
|
+
updateRef={updateRef}
|
|
57
|
+
/>
|
|
52
58
|
</Text>
|
|
53
59
|
</Card>
|
|
54
60
|
</Stack>
|
|
@@ -25,11 +25,14 @@ export default function TestStory(): React.JSX.Element {
|
|
|
25
25
|
const constrainSize = useBoolean('Constrain size', true)
|
|
26
26
|
const matchReferenceWidth = useBoolean('Match reference width', false)
|
|
27
27
|
const open = useBoolean('Open', true)
|
|
28
|
+
// @ts-expect-error - TODO: fix this
|
|
28
29
|
const placement = useSelect('Placement', WORKSHOP_PLACEMENT_OPTIONS, 'bottom')
|
|
29
30
|
const portal = useBoolean('Render in portal', true)
|
|
30
31
|
const preventOverflow = useBoolean('Prevent overflow', true)
|
|
32
|
+
// @ts-expect-error - TODO: fix this
|
|
31
33
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2)
|
|
32
34
|
const referenceWide = useBoolean('Reference wide?', false)
|
|
35
|
+
// @ts-expect-error - TODO: fix this
|
|
33
36
|
const width = useSelect('Width', WORKSHOP_CONTAINER_WIDTH_OPTIONS, 'auto')
|
|
34
37
|
|
|
35
38
|
const text = useText('Text', 'Test')
|
|
@@ -81,11 +84,14 @@ export default function TestStory(): React.JSX.Element {
|
|
|
81
84
|
open={open}
|
|
82
85
|
overflow="hidden"
|
|
83
86
|
padding={3}
|
|
87
|
+
// @ts-expect-error - TODO: fix this
|
|
84
88
|
placement={placement}
|
|
85
89
|
portal={portal}
|
|
86
90
|
preventOverflow={preventOverflow}
|
|
91
|
+
// @ts-expect-error - TODO: fix this
|
|
87
92
|
radius={radius}
|
|
88
93
|
updateRef={updateRef}
|
|
94
|
+
// @ts-expect-error - TODO: fix this
|
|
89
95
|
width={width}
|
|
90
96
|
>
|
|
91
97
|
{button}
|
|
@@ -171,7 +171,6 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
171
171
|
matchReferenceWidth,
|
|
172
172
|
floatingBoundary = boundaryElementContext.element,
|
|
173
173
|
modal,
|
|
174
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
175
174
|
onActivate,
|
|
176
175
|
open,
|
|
177
176
|
overflow = 'hidden',
|
|
@@ -6,7 +6,9 @@ import {WORKSHOP_RADIUS_OPTIONS, WORKSHOP_TEXT_FONT_SIZE_OPTIONS} from '$worksho
|
|
|
6
6
|
export default function PlainStory(): React.JSX.Element {
|
|
7
7
|
const border = useBoolean('Border', true)
|
|
8
8
|
const disabled = useBoolean('Disabled', false)
|
|
9
|
+
// @ts-expect-error - TODO: fix this
|
|
9
10
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS)
|
|
11
|
+
// @ts-expect-error - TODO: fix this
|
|
10
12
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS)
|
|
11
13
|
const readOnly = useBoolean('Read only', false)
|
|
12
14
|
|
|
@@ -21,8 +23,10 @@ export default function PlainStory(): React.JSX.Element {
|
|
|
21
23
|
<Select
|
|
22
24
|
border={border}
|
|
23
25
|
disabled={disabled}
|
|
26
|
+
// @ts-expect-error - TODO: fix this
|
|
24
27
|
fontSize={fontSize}
|
|
25
28
|
id="select-example"
|
|
29
|
+
// @ts-expect-error - TODO: fix this
|
|
26
30
|
radius={radius}
|
|
27
31
|
readOnly={readOnly}
|
|
28
32
|
>
|
|
@@ -16,6 +16,7 @@ import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
|
16
16
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '$workshop'
|
|
17
17
|
|
|
18
18
|
export default function SkeletonDelayStory(): React.JSX.Element {
|
|
19
|
+
// @ts-expect-error - TODO: fix this
|
|
19
20
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS)
|
|
20
21
|
const animated = useBoolean('Animated', true)
|
|
21
22
|
|
|
@@ -23,7 +24,14 @@ export default function SkeletonDelayStory(): React.JSX.Element {
|
|
|
23
24
|
<Box padding={[4, 5, 6]}>
|
|
24
25
|
<Container width={1}>
|
|
25
26
|
<Text muted>Delayed by 2000ms</Text>
|
|
26
|
-
<Card
|
|
27
|
+
<Card
|
|
28
|
+
// @ts-expect-error - TODO: fix this
|
|
29
|
+
tone={tone}
|
|
30
|
+
marginTop={4}
|
|
31
|
+
padding={2}
|
|
32
|
+
radius={2}
|
|
33
|
+
border
|
|
34
|
+
>
|
|
27
35
|
<Flex align="center">
|
|
28
36
|
<Skeleton
|
|
29
37
|
style={{width: 90, height: 90}}
|
|
@@ -16,6 +16,7 @@ import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
|
16
16
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '$workshop'
|
|
17
17
|
|
|
18
18
|
export default function SkeletonStory(): React.JSX.Element {
|
|
19
|
+
// @ts-expect-error - TODO: fix this
|
|
19
20
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS)
|
|
20
21
|
const animated = useBoolean('Animated', true)
|
|
21
22
|
|
|
@@ -24,7 +25,14 @@ export default function SkeletonStory(): React.JSX.Element {
|
|
|
24
25
|
<Container width={1}>
|
|
25
26
|
<Stack gap={4}>
|
|
26
27
|
{[1, 2, 3].map((item) => (
|
|
27
|
-
<Card
|
|
28
|
+
<Card
|
|
29
|
+
key={item}
|
|
30
|
+
// @ts-expect-error - TODO: fix this
|
|
31
|
+
tone={tone}
|
|
32
|
+
padding={2}
|
|
33
|
+
radius={2}
|
|
34
|
+
border
|
|
35
|
+
>
|
|
28
36
|
<Flex align="center">
|
|
29
37
|
<Grid gap={2} gridTemplateColumns={2} marginRight={3}>
|
|
30
38
|
<Skeleton style={{width: 40, height: 40}} radius={2} animated={animated} />
|
|
@@ -5,11 +5,16 @@ import {WORKSHOP_TEXT_FONT_SIZE_OPTIONS} from '$workshop'
|
|
|
5
5
|
|
|
6
6
|
export default function Props(): React.JSX.Element {
|
|
7
7
|
const muted = useBoolean('Muted', false)
|
|
8
|
+
// @ts-expect-error - TODO: fix this
|
|
8
9
|
const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
|
|
9
10
|
|
|
10
11
|
return (
|
|
11
12
|
<Flex align="center" height="fill" justify="center">
|
|
12
|
-
<Spinner
|
|
13
|
+
<Spinner
|
|
14
|
+
muted={muted}
|
|
15
|
+
// @ts-expect-error - TODO: fix this
|
|
16
|
+
size={size}
|
|
17
|
+
/>
|
|
13
18
|
</Flex>
|
|
14
19
|
)
|
|
15
20
|
}
|
|
@@ -7,7 +7,10 @@ export default function PlainStory(): React.JSX.Element {
|
|
|
7
7
|
return (
|
|
8
8
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
9
9
|
<Container width={0}>
|
|
10
|
-
<Stack
|
|
10
|
+
<Stack
|
|
11
|
+
// @ts-expect-error - TODO: fix this
|
|
12
|
+
gap={useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 0)}
|
|
13
|
+
>
|
|
11
14
|
<Card padding={[2, 3, 4]} shadow={1}>
|
|
12
15
|
<Text align="center" muted>
|
|
13
16
|
Stack item
|
|
@@ -11,11 +11,18 @@ const ColoredText = styled(Text)<{$color: AvatarColor}>`
|
|
|
11
11
|
`
|
|
12
12
|
|
|
13
13
|
export default function ColoredTextStory(): React.JSX.Element {
|
|
14
|
+
// @ts-expect-error - TODO: fix this
|
|
14
15
|
const color = useSelect('Color', WORKSHOP_AVATAR_COLOR_OPTIONS, 'gray') ?? 'gray'
|
|
15
16
|
|
|
16
17
|
return (
|
|
17
18
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
18
|
-
<ColoredText
|
|
19
|
+
<ColoredText
|
|
20
|
+
align="center"
|
|
21
|
+
// @ts-expect-error - TODO: fix this
|
|
22
|
+
$color={color}
|
|
23
|
+
size={4}
|
|
24
|
+
weight="bold"
|
|
25
|
+
>
|
|
19
26
|
{color}
|
|
20
27
|
</ColoredText>
|
|
21
28
|
</Flex>
|
|
@@ -9,17 +9,31 @@ import {
|
|
|
9
9
|
} from '$workshop'
|
|
10
10
|
|
|
11
11
|
export default function TextStory(): React.JSX.Element {
|
|
12
|
+
// @ts-expect-error - TODO: fix this
|
|
12
13
|
const align = useSelect('Align', WORKSHOP_TEXT_ALIGN_OPTIONS)
|
|
13
14
|
const muted = useBoolean('Muted', false)
|
|
15
|
+
// @ts-expect-error - TODO: fix this
|
|
14
16
|
const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 1)
|
|
15
17
|
const text = useText('Text', 'Hello, world')
|
|
18
|
+
// @ts-expect-error - TODO: fix this
|
|
16
19
|
const textOverflow = useSelect('Text overflow', WORKSHOP_TEXT_OVERFLOW_OPTIONS)
|
|
20
|
+
// @ts-expect-error - TODO: fix this
|
|
17
21
|
const weight = useSelect('Weight', WORKSHOP_TEXT_WEIGHT_OPTIONS)
|
|
18
22
|
|
|
19
23
|
return (
|
|
20
24
|
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
21
25
|
<Container width={0}>
|
|
22
|
-
<Text
|
|
26
|
+
<Text
|
|
27
|
+
// @ts-expect-error - TODO: fix this
|
|
28
|
+
align={align}
|
|
29
|
+
muted={muted}
|
|
30
|
+
// @ts-expect-error - TODO: fix this
|
|
31
|
+
size={size}
|
|
32
|
+
// @ts-expect-error - TODO: fix this
|
|
33
|
+
textOverflow={textOverflow}
|
|
34
|
+
// @ts-expect-error - TODO: fix this
|
|
35
|
+
weight={weight}
|
|
36
|
+
>
|
|
23
37
|
{text}
|
|
24
38
|
</Text>
|
|
25
39
|
</Container>
|
|
@@ -10,15 +10,19 @@ import {
|
|
|
10
10
|
} from '$workshop'
|
|
11
11
|
|
|
12
12
|
export default function PlainStory(): React.JSX.Element {
|
|
13
|
+
// @ts-expect-error - TODO: fix this
|
|
13
14
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS)
|
|
14
15
|
|
|
15
16
|
const border = useBoolean('Border', true)
|
|
16
17
|
const customValidity = useText('Custom validity')
|
|
17
18
|
const disableFocusRing = useBoolean('Disable focus ring (unstable)', false)
|
|
18
19
|
const disabled = useBoolean('Disabled', false)
|
|
20
|
+
// @ts-expect-error - TODO: fix this
|
|
19
21
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
|
|
22
|
+
// @ts-expect-error - TODO: fix this
|
|
20
23
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
|
|
21
24
|
const placeholder = useText('Placeholder', 'Placeholder')
|
|
25
|
+
// @ts-expect-error - TODO: fix this
|
|
22
26
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2)
|
|
23
27
|
const readOnly = useBoolean('Read only', false)
|
|
24
28
|
|
|
@@ -32,6 +36,7 @@ export default function PlainStory(): React.JSX.Element {
|
|
|
32
36
|
justifyContent="center"
|
|
33
37
|
padding={[4, 5, 6]}
|
|
34
38
|
sizing="border"
|
|
39
|
+
// @ts-expect-error - TODO: fix this
|
|
35
40
|
tone={tone}
|
|
36
41
|
>
|
|
37
42
|
<Container width={0}>
|
|
@@ -44,11 +49,14 @@ export default function PlainStory(): React.JSX.Element {
|
|
|
44
49
|
border={border}
|
|
45
50
|
customValidity={customValidity}
|
|
46
51
|
disabled={disabled}
|
|
52
|
+
// @ts-expect-error - TODO: fix this
|
|
47
53
|
fontSize={fontSize}
|
|
48
54
|
id="text-area-example"
|
|
49
55
|
onChange={(e) => setValue(e.target.value)}
|
|
56
|
+
// @ts-expect-error - TODO: fix this
|
|
50
57
|
padding={padding}
|
|
51
58
|
placeholder={placeholder}
|
|
59
|
+
// @ts-expect-error - TODO: fix this
|
|
52
60
|
radius={radius}
|
|
53
61
|
readOnly={readOnly}
|
|
54
62
|
rows={10}
|
|
@@ -53,16 +53,23 @@ function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
|
|
|
53
53
|
const border = useBoolean('Border', true)
|
|
54
54
|
const customValidity = useText('Custom validity')
|
|
55
55
|
const disabled = useBoolean('Disabled', false)
|
|
56
|
+
// @ts-expect-error - TODO: fix this
|
|
56
57
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
|
|
58
|
+
// @ts-expect-error - TODO: fix this
|
|
57
59
|
const gap = useSelect('Gap', WORKSHOP_SPACE_OPTIONS, 3)
|
|
60
|
+
// @ts-expect-error - TODO: fix this
|
|
58
61
|
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'search')
|
|
62
|
+
// @ts-expect-error - TODO: fix this
|
|
59
63
|
const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS, 'cube')
|
|
64
|
+
// @ts-expect-error - TODO: fix this
|
|
60
65
|
const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3)
|
|
61
66
|
const placeholder = useText('Placeholder')
|
|
62
67
|
const prefix = useBoolean('Prefix', false)
|
|
68
|
+
// @ts-expect-error - TODO: fix this
|
|
63
69
|
const radius = useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2)
|
|
64
70
|
const readOnly = useBoolean('Read only', false)
|
|
65
71
|
const suffix = useBoolean('Suffix', false)
|
|
72
|
+
// @ts-expect-error - TODO: fix this
|
|
66
73
|
const weight = useSelect('Weight', WORKSHOP_FONT_WEIGHT_OPTIONS)
|
|
67
74
|
|
|
68
75
|
const [value, setValue] = useState('')
|
|
@@ -77,33 +84,56 @@ function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
|
|
|
77
84
|
border={border}
|
|
78
85
|
customValidity={customValidity}
|
|
79
86
|
disabled={disabled}
|
|
87
|
+
// @ts-expect-error - TODO: fix this
|
|
80
88
|
fontSize={fontSize}
|
|
89
|
+
// @ts-expect-error - TODO: fix this
|
|
81
90
|
gap={gap}
|
|
91
|
+
// @ts-expect-error - TODO: fix this
|
|
82
92
|
icon={icon && icons[icon]}
|
|
93
|
+
// @ts-expect-error - TODO: fix this
|
|
83
94
|
iconRight={iconRight && icons[iconRight]}
|
|
84
95
|
id="text-input-example"
|
|
85
96
|
name="test"
|
|
86
97
|
onChange={handleChange}
|
|
98
|
+
// @ts-expect-error - TODO: fix this
|
|
87
99
|
padding={padding}
|
|
88
100
|
placeholder={placeholder}
|
|
89
101
|
prefix={
|
|
90
102
|
prefix && (
|
|
91
|
-
<Box
|
|
92
|
-
|
|
103
|
+
<Box
|
|
104
|
+
// @ts-expect-error - TODO: fix this
|
|
105
|
+
padding={padding}
|
|
106
|
+
>
|
|
107
|
+
<Text
|
|
108
|
+
// @ts-expect-error - TODO: fix this
|
|
109
|
+
size={fontSize}
|
|
110
|
+
>
|
|
111
|
+
Prefix
|
|
112
|
+
</Text>
|
|
93
113
|
</Box>
|
|
94
114
|
)
|
|
95
115
|
}
|
|
116
|
+
// @ts-expect-error - TODO: fix this
|
|
96
117
|
radius={radius}
|
|
97
118
|
readOnly={readOnly}
|
|
98
119
|
ref={ref}
|
|
99
120
|
suffix={
|
|
100
121
|
suffix && (
|
|
101
|
-
<Box
|
|
102
|
-
|
|
122
|
+
<Box
|
|
123
|
+
// @ts-expect-error - TODO: fix this
|
|
124
|
+
padding={padding}
|
|
125
|
+
>
|
|
126
|
+
<Text
|
|
127
|
+
// @ts-expect-error - TODO: fix this
|
|
128
|
+
size={fontSize}
|
|
129
|
+
>
|
|
130
|
+
Suffix
|
|
131
|
+
</Text>
|
|
103
132
|
</Box>
|
|
104
133
|
)
|
|
105
134
|
}
|
|
106
135
|
value={value}
|
|
136
|
+
// @ts-expect-error - TODO: fix this
|
|
107
137
|
weight={weight}
|
|
108
138
|
/>
|
|
109
139
|
)
|