@sanity/ui 1.0.0-beta.32 → 1.0.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/{types/src/index.d.ts → index.d.ts} +136 -68
- package/dist/{sanity-ui.esm.js → index.esm.js} +698 -1525
- package/dist/index.esm.js.map +1 -0
- package/dist/{sanity-ui.js → index.js} +697 -1539
- package/dist/index.js.map +1 -0
- package/package.json +113 -23
- package/src/components/autocomplete/__workshop__/example.tsx +1 -1
- package/src/components/autocomplete/__workshop__/index.ts +36 -32
- package/src/components/autocomplete/autocomplete.tsx +1 -2
- package/src/components/autocomplete/constants.ts +3 -8
- package/src/components/breadcrumbs/__workshop__/index.ts +11 -7
- package/src/components/dialog/__workshop__/index.ts +13 -9
- package/src/components/hotkeys/__workshop__/index.ts +11 -3
- package/src/components/menu/__workshop__/index.ts +71 -67
- package/src/components/menu/menuButton.tsx +16 -14
- package/src/components/skeleton/__workshop__/index.ts +8 -4
- package/src/components/tab/__workshop__/index.ts +11 -3
- package/src/components/toast/__workshop__/index.ts +16 -4
- package/src/components/tree/__workshop__/basic.perf.ts +1 -14
- package/src/components/tree/__workshop__/basic.tsx +1 -1
- package/src/components/tree/__workshop__/index.ts +12 -8
- package/src/hooks/useElementRect/__workshop__/index.ts +11 -3
- package/src/hooks/useMediaIndex/__workshop__/index.ts +11 -3
- package/src/primitives/avatar/__workshop__/index.ts +16 -12
- package/src/primitives/badge/__workshop__/index.ts +16 -12
- package/src/primitives/badge/__workshop__/tones.tsx +1 -1
- package/src/primitives/box/__workshop__/index.ts +16 -4
- package/src/primitives/button/__workshop__/index.ts +51 -47
- package/src/primitives/card/__workshop__/index.ts +15 -11
- package/src/primitives/checkbox/__workshop__/index.ts +10 -6
- package/src/primitives/code/__workshop__/index.ts +16 -12
- package/src/primitives/container/__workshop__/index.ts +5 -3
- package/src/primitives/flex/__workshop__/index.ts +8 -4
- package/src/primitives/grid/__workshop__/index.ts +7 -3
- package/src/primitives/heading/__workshop__/index.ts +16 -12
- package/src/primitives/inline/__workshop__/index.ts +5 -3
- package/src/primitives/kbd/__workshop__/index.ts +5 -3
- package/src/primitives/label/__workshop__/index.ts +16 -12
- package/src/primitives/popover/__workshop__/PlainStory.tsx +0 -1
- package/src/primitives/popover/__workshop__/TestStory.tsx +0 -1
- package/src/primitives/popover/__workshop__/index.ts +36 -32
- package/src/primitives/popover/constants.ts +0 -3
- package/src/primitives/popover/floating-ui/size.ts +40 -25
- package/src/primitives/popover/popover.tsx +54 -41
- package/src/primitives/popover/popoverCard.tsx +9 -16
- package/src/primitives/radio/__workshop__/index.ts +8 -4
- package/src/primitives/select/__workshop__/index.ts +8 -4
- package/src/primitives/spinner/__workshop__/index.ts +11 -7
- package/src/primitives/stack/__workshop__/index.ts +11 -7
- package/src/primitives/switch/__workshop__/index.ts +8 -4
- package/src/primitives/text/__workshop__/index.ts +21 -17
- package/src/primitives/textArea/__workshop__/index.ts +11 -7
- package/src/primitives/textInput/__workshop__/index.ts +46 -42
- package/src/primitives/textInput/__workshop__/plain.tsx +2 -1
- package/src/primitives/tooltip/__workshop__/index.ts +11 -7
- package/src/theme/__workshop__/index.ts +26 -22
- package/src/theme/{ThemeContext.ts → themeContext.ts} +0 -0
- package/src/utils/boundaryElement/__workshop__/index.ts +11 -7
- package/src/utils/elementQuery/__workshop__/index.ts +11 -7
- package/src/utils/layer/__workshop__/index.ts +21 -17
- package/src/utils/portal/__workshop__/index.ts +11 -7
- package/src/utils/virtualList/__workshop__/index.ts +26 -22
- package/dist/sanity-ui.esm.js.map +0 -1
- package/dist/sanity-ui.js.map +0 -1
- package/src/__workshop__/color/overview.tsx +0 -101
- package/src/__workshop__/index.ts +0 -10
- package/src/icons/__workshop__/.eslintrc +0 -5
- package/src/icons/__workshop__/index.tsx +0 -6
- package/src/icons/__workshop__/overview.tsx +0 -76
- package/src/utils/srOnly/__workshop__/.eslintrc +0 -5
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
import {Middleware, detectOverflow} from '@floating-ui/react-dom'
|
|
1
|
+
import {Elements, Middleware, detectOverflow} from '@floating-ui/react-dom'
|
|
2
|
+
import {PopoverMargins} from '../../../types'
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
|
|
4
|
+
export interface SizeMiddlewareApplyOptions {
|
|
5
|
+
availableWidth: number
|
|
6
|
+
availableHeight: number
|
|
7
|
+
elements: Elements
|
|
8
|
+
referenceWidth: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function size(options: {
|
|
12
|
+
apply: (args: SizeMiddlewareApplyOptions) => void
|
|
13
|
+
boundaryElement?: HTMLElement | null
|
|
5
14
|
constrainSize: boolean
|
|
15
|
+
margins: PopoverMargins
|
|
6
16
|
matchReferenceWidth?: boolean
|
|
7
17
|
padding?: number
|
|
8
|
-
setAvailableWidth: (v: number) => void
|
|
9
|
-
setAvailableHeight: (v: number) => void
|
|
10
|
-
setReferenceWidth: (v: number) => void
|
|
11
18
|
}): Middleware {
|
|
12
|
-
const {padding = 0} =
|
|
19
|
+
const {apply, margins, padding = 0} = options
|
|
13
20
|
|
|
14
21
|
return {
|
|
15
22
|
name: '@sanity/ui/size',
|
|
16
23
|
async fn(args) {
|
|
17
|
-
const {placement, rects} = args
|
|
24
|
+
const {elements, placement, platform, rects} = args
|
|
18
25
|
const {floating, reference} = rects
|
|
19
26
|
|
|
20
27
|
const overflow = await detectOverflow(args, {
|
|
21
28
|
altBoundary: true,
|
|
22
|
-
boundary:
|
|
29
|
+
boundary: options.boundaryElement || undefined,
|
|
23
30
|
elementContext: 'floating',
|
|
24
31
|
padding,
|
|
25
32
|
rootBoundary: 'viewport',
|
|
@@ -28,36 +35,44 @@ export function size(scope: {
|
|
|
28
35
|
let maxWidth = Infinity
|
|
29
36
|
let maxHeight = Infinity
|
|
30
37
|
|
|
38
|
+
const floatingW = floating.width
|
|
39
|
+
const floatingH = floating.height
|
|
40
|
+
|
|
31
41
|
if (placement.includes('top')) {
|
|
32
|
-
maxWidth =
|
|
33
|
-
maxHeight =
|
|
42
|
+
maxWidth = floatingW - (overflow.left + overflow.right)
|
|
43
|
+
maxHeight = floatingH - overflow.top
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
if (placement.includes('right')) {
|
|
37
|
-
maxWidth =
|
|
38
|
-
maxHeight =
|
|
47
|
+
maxWidth = floatingW - overflow.right
|
|
48
|
+
maxHeight = floatingH - (overflow.top + overflow.bottom)
|
|
39
49
|
}
|
|
40
50
|
|
|
41
51
|
if (placement.includes('bottom')) {
|
|
42
|
-
maxWidth =
|
|
43
|
-
maxHeight =
|
|
52
|
+
maxWidth = floatingW - (overflow.left + overflow.right)
|
|
53
|
+
maxHeight = floatingH - overflow.bottom
|
|
44
54
|
}
|
|
45
55
|
|
|
46
56
|
if (placement.includes('left')) {
|
|
47
|
-
maxWidth =
|
|
48
|
-
maxHeight =
|
|
57
|
+
maxWidth = floatingW - overflow.left
|
|
58
|
+
maxHeight = floatingH - (overflow.top + overflow.bottom)
|
|
49
59
|
}
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
// IMPORTANT – APPLY ELEMENT STYLES HERE
|
|
62
|
+
// Elements need to be resized BEFORE the `platform.getDimensions` call below
|
|
63
|
+
apply({
|
|
64
|
+
availableWidth: maxWidth - margins[1] - margins[3],
|
|
65
|
+
availableHeight: maxHeight - margins[0] - margins[2],
|
|
66
|
+
elements,
|
|
67
|
+
referenceWidth: reference.width - margins[1] - margins[3],
|
|
68
|
+
})
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
const nextDimensions = await platform.getDimensions(elements.floating)
|
|
71
|
+
|
|
72
|
+
const targetH = nextDimensions.height
|
|
73
|
+
const targetW = nextDimensions.width
|
|
59
74
|
|
|
60
|
-
if (
|
|
75
|
+
if (floatingW !== targetW || floatingH !== targetH) {
|
|
61
76
|
return {reset: {rects: true}}
|
|
62
77
|
}
|
|
63
78
|
|
|
@@ -8,23 +8,19 @@ import {
|
|
|
8
8
|
offset,
|
|
9
9
|
shift,
|
|
10
10
|
useFloating,
|
|
11
|
+
UseFloatingProps,
|
|
11
12
|
} from '@floating-ui/react-dom'
|
|
12
|
-
import {
|
|
13
|
-
cloneElement,
|
|
14
|
-
forwardRef,
|
|
15
|
-
memo,
|
|
16
|
-
useCallback,
|
|
17
|
-
useEffect,
|
|
18
|
-
useMemo,
|
|
19
|
-
useRef,
|
|
20
|
-
useState,
|
|
21
|
-
} from 'react'
|
|
13
|
+
import {cloneElement, forwardRef, memo, useCallback, useEffect, useMemo, useRef} from 'react'
|
|
22
14
|
import {useForwardedRef, useArrayProp, useElementSize} from '../../hooks'
|
|
23
15
|
import {ThemeColorSchemeKey, useTheme} from '../../theme'
|
|
24
16
|
import {BoxOverflow, CardTone, Placement, PopoverMargins} from '../../types'
|
|
25
17
|
import {LayerProps, LayerProvider, Portal, useBoundaryElement} from '../../utils'
|
|
26
18
|
import {ResponsiveRadiusProps, ResponsiveShadowProps, ResponsiveWidthProps} from '../types'
|
|
27
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
DEFAULT_POPOVER_DISTANCE,
|
|
21
|
+
DEFAULT_POPOVER_MARGINS,
|
|
22
|
+
DEFAULT_POPOVER_PADDING,
|
|
23
|
+
} from './constants'
|
|
28
24
|
import {size} from './floating-ui/size'
|
|
29
25
|
import {PopoverCard} from './popoverCard'
|
|
30
26
|
|
|
@@ -70,7 +66,7 @@ export const Popover = memo(
|
|
|
70
66
|
const boundaryElementContext = useBoundaryElement()
|
|
71
67
|
|
|
72
68
|
const {
|
|
73
|
-
__unstable_margins: margins,
|
|
69
|
+
__unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
|
|
74
70
|
arrow: arrowProp = true,
|
|
75
71
|
boundaryElement = boundaryElementContext.element,
|
|
76
72
|
children: childProp,
|
|
@@ -80,7 +76,7 @@ export const Popover = memo(
|
|
|
80
76
|
fallbackPlacements,
|
|
81
77
|
matchReferenceWidth: matchReferenceWidthProp,
|
|
82
78
|
open,
|
|
83
|
-
overflow =
|
|
79
|
+
overflow = 'hidden',
|
|
84
80
|
padding: paddingProp,
|
|
85
81
|
placement: placementProp = 'bottom',
|
|
86
82
|
portal,
|
|
@@ -100,9 +96,6 @@ export const Popover = memo(
|
|
|
100
96
|
const shadow = useArrayProp(shadowProp)
|
|
101
97
|
const width = useArrayProp(widthProp)
|
|
102
98
|
const zOffset = useArrayProp(zOffsetProp)
|
|
103
|
-
const [availableWidth, setAvailableWidth] = useState<number | undefined>(undefined)
|
|
104
|
-
const [availableHeight, setAvailableHeight] = useState<number | undefined>(undefined)
|
|
105
|
-
const [referenceWidth, setReferenceWidth] = useState<number | undefined>(undefined)
|
|
106
99
|
const forwardedRef = useForwardedRef(ref)
|
|
107
100
|
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
108
101
|
const rootBoundary: RootBoundary = 'viewport'
|
|
@@ -122,29 +115,37 @@ export const Popover = memo(
|
|
|
122
115
|
)
|
|
123
116
|
}
|
|
124
117
|
|
|
118
|
+
// Define distance between reference and floating element
|
|
119
|
+
ret.push(
|
|
120
|
+
offset({
|
|
121
|
+
mainAxis: arrowProp ? DEFAULT_POPOVER_DISTANCE : 0,
|
|
122
|
+
})
|
|
123
|
+
)
|
|
124
|
+
|
|
125
125
|
// Track sizes
|
|
126
126
|
if (constrainSize || matchReferenceWidthProp) {
|
|
127
127
|
ret.push(
|
|
128
128
|
size({
|
|
129
|
+
apply({availableWidth, availableHeight, elements, referenceWidth}) {
|
|
130
|
+
if (matchReferenceWidthProp) {
|
|
131
|
+
elements.floating.style.width = `${referenceWidth}px`
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (constrainSize) {
|
|
135
|
+
elements.floating.style.maxWidth = `${availableWidth}px`
|
|
136
|
+
elements.floating.style.maxHeight = `${availableHeight}px`
|
|
137
|
+
}
|
|
138
|
+
},
|
|
129
139
|
boundaryElement,
|
|
130
140
|
constrainSize,
|
|
141
|
+
margins,
|
|
131
142
|
matchReferenceWidth: matchReferenceWidthProp,
|
|
132
143
|
padding: DEFAULT_POPOVER_PADDING,
|
|
133
|
-
setAvailableHeight,
|
|
134
|
-
setAvailableWidth,
|
|
135
|
-
setReferenceWidth,
|
|
136
144
|
})
|
|
137
145
|
)
|
|
138
146
|
}
|
|
139
147
|
|
|
140
|
-
//
|
|
141
|
-
ret.push(
|
|
142
|
-
offset({
|
|
143
|
-
mainAxis: arrowProp ? DEFAULT_POPOVER_DISTANCE : 0,
|
|
144
|
-
})
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
// Shift the popover so its sits with the boundary eleement
|
|
148
|
+
// Shift the popover so its sits within the boundary eleement
|
|
148
149
|
if (preventOverflow) {
|
|
149
150
|
ret.push(
|
|
150
151
|
shift({
|
|
@@ -179,15 +180,29 @@ export const Popover = memo(
|
|
|
179
180
|
boundaryElement,
|
|
180
181
|
constrainSize,
|
|
181
182
|
fallbackPlacements,
|
|
183
|
+
margins,
|
|
182
184
|
matchReferenceWidthProp,
|
|
183
185
|
preventOverflow,
|
|
184
186
|
])
|
|
185
187
|
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
const floatingProps: UseFloatingProps = useMemo(
|
|
189
|
+
() => ({
|
|
190
|
+
middleware,
|
|
191
|
+
placement: placementProp,
|
|
192
|
+
whileElementsMounted: autoUpdate,
|
|
193
|
+
}),
|
|
194
|
+
[middleware, placementProp]
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
const {
|
|
198
|
+
x,
|
|
199
|
+
y,
|
|
200
|
+
placement,
|
|
201
|
+
reference: referenceRef,
|
|
202
|
+
floating: floatingRef,
|
|
203
|
+
middlewareData,
|
|
204
|
+
strategy,
|
|
205
|
+
} = useFloating(floatingProps)
|
|
191
206
|
|
|
192
207
|
const referenceHidden = middlewareData.hide?.referenceHidden
|
|
193
208
|
|
|
@@ -201,15 +216,16 @@ export const Popover = memo(
|
|
|
201
216
|
const setFloating = useCallback(
|
|
202
217
|
(node: HTMLDivElement | null) => {
|
|
203
218
|
forwardedRef.current = node
|
|
204
|
-
|
|
219
|
+
floatingRef(node)
|
|
205
220
|
},
|
|
206
|
-
[
|
|
221
|
+
[floatingRef, forwardedRef]
|
|
207
222
|
)
|
|
208
223
|
|
|
209
224
|
const setReference = useCallback(
|
|
210
225
|
(node: HTMLElement | null) => {
|
|
211
|
-
|
|
226
|
+
referenceRef(node)
|
|
212
227
|
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
213
229
|
const childRef = (childProp as any)?.ref
|
|
214
230
|
|
|
215
231
|
if (typeof childRef === 'function') {
|
|
@@ -218,7 +234,7 @@ export const Popover = memo(
|
|
|
218
234
|
childRef.current = node
|
|
219
235
|
}
|
|
220
236
|
},
|
|
221
|
-
[childProp,
|
|
237
|
+
[childProp, referenceRef]
|
|
222
238
|
)
|
|
223
239
|
|
|
224
240
|
const child = useMemo(() => {
|
|
@@ -228,8 +244,8 @@ export const Popover = memo(
|
|
|
228
244
|
}, [childProp, referenceElement, setReference])
|
|
229
245
|
|
|
230
246
|
useEffect(() => {
|
|
231
|
-
|
|
232
|
-
}, [
|
|
247
|
+
referenceRef(referenceElement || null)
|
|
248
|
+
}, [referenceRef, referenceElement])
|
|
233
249
|
|
|
234
250
|
if (disabled) {
|
|
235
251
|
return childProp || <></>
|
|
@@ -244,8 +260,6 @@ export const Popover = memo(
|
|
|
244
260
|
arrowRef={setArrow}
|
|
245
261
|
arrowX={arrowX}
|
|
246
262
|
arrowY={arrowY}
|
|
247
|
-
availableWidth={constrainSize ? availableWidth : undefined}
|
|
248
|
-
availableHeight={constrainSize ? availableHeight : undefined}
|
|
249
263
|
boundaryWidth={preventOverflow ? boundarySize?.width : undefined}
|
|
250
264
|
hidden={referenceHidden}
|
|
251
265
|
overflow={overflow}
|
|
@@ -253,7 +267,6 @@ export const Popover = memo(
|
|
|
253
267
|
placement={placement}
|
|
254
268
|
radius={radius}
|
|
255
269
|
ref={setFloating}
|
|
256
|
-
referenceWidth={matchReferenceWidthProp ? referenceWidth : undefined}
|
|
257
270
|
scheme={scheme}
|
|
258
271
|
shadow={shadow}
|
|
259
272
|
strategy={strategy}
|
|
@@ -36,6 +36,11 @@ function popoverCardStyle(props: {$boundaryWidth?: number} & ThemeProps): CSSObj
|
|
|
36
36
|
|
|
37
37
|
const Root = memo(styled(Card)(popoverCardStyle))
|
|
38
38
|
|
|
39
|
+
const PopoverContainer = memo(styled(Container)`
|
|
40
|
+
max-height: inherit;
|
|
41
|
+
max-width: inherit;
|
|
42
|
+
`)
|
|
43
|
+
|
|
39
44
|
/**
|
|
40
45
|
* @internal
|
|
41
46
|
*/
|
|
@@ -48,14 +53,11 @@ export const PopoverCard = memo(
|
|
|
48
53
|
arrowRef: React.Ref<HTMLDivElement>
|
|
49
54
|
arrowX?: number
|
|
50
55
|
arrowY?: number
|
|
51
|
-
availableHeight?: number
|
|
52
|
-
availableWidth?: number
|
|
53
56
|
boundaryWidth?: number
|
|
54
57
|
overflow?: BoxOverflow
|
|
55
58
|
padding?: number | number[]
|
|
56
59
|
placement?: Placement
|
|
57
60
|
radius?: number | number[]
|
|
58
|
-
referenceWidth?: number
|
|
59
61
|
scheme?: ThemeColorSchemeKey
|
|
60
62
|
shadow?: number | number[]
|
|
61
63
|
strategy: Strategy
|
|
@@ -72,15 +74,12 @@ export const PopoverCard = memo(
|
|
|
72
74
|
arrowRef,
|
|
73
75
|
arrowX,
|
|
74
76
|
arrowY,
|
|
75
|
-
availableHeight,
|
|
76
|
-
availableWidth,
|
|
77
77
|
boundaryWidth,
|
|
78
78
|
children,
|
|
79
79
|
padding,
|
|
80
80
|
placement,
|
|
81
81
|
overflow,
|
|
82
82
|
radius,
|
|
83
|
-
referenceWidth: referenceWidthProp,
|
|
84
83
|
scheme,
|
|
85
84
|
shadow,
|
|
86
85
|
strategy,
|
|
@@ -101,10 +100,6 @@ export const PopoverCard = memo(
|
|
|
101
100
|
)
|
|
102
101
|
|
|
103
102
|
// Translate according to margins
|
|
104
|
-
const referenceWidth = referenceWidthProp
|
|
105
|
-
? referenceWidthProp - margins[1] - margins[3]
|
|
106
|
-
: undefined
|
|
107
|
-
|
|
108
103
|
const x = (xProp ?? 0) + margins[3]
|
|
109
104
|
const y = (yProp ?? 0) + margins[0]
|
|
110
105
|
|
|
@@ -114,12 +109,9 @@ export const PopoverCard = memo(
|
|
|
114
109
|
top: y,
|
|
115
110
|
left: x,
|
|
116
111
|
zIndex,
|
|
117
|
-
width: referenceWidth,
|
|
118
|
-
maxWidth: availableWidth,
|
|
119
|
-
maxHeight: availableHeight,
|
|
120
112
|
...style,
|
|
121
113
|
}),
|
|
122
|
-
[
|
|
114
|
+
[strategy, style, x, y, zIndex]
|
|
123
115
|
)
|
|
124
116
|
|
|
125
117
|
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split('-')[0]]
|
|
@@ -147,10 +139,11 @@ export const PopoverCard = memo(
|
|
|
147
139
|
ref={ref}
|
|
148
140
|
scheme={scheme}
|
|
149
141
|
shadow={shadow}
|
|
142
|
+
sizing="border"
|
|
150
143
|
style={rootStyle}
|
|
151
144
|
tone={tone}
|
|
152
145
|
>
|
|
153
|
-
<
|
|
146
|
+
<PopoverContainer
|
|
154
147
|
data-ui="Popover__wrapper"
|
|
155
148
|
flex={1}
|
|
156
149
|
overflow={overflow}
|
|
@@ -159,7 +152,7 @@ export const PopoverCard = memo(
|
|
|
159
152
|
width={width}
|
|
160
153
|
>
|
|
161
154
|
{children}
|
|
162
|
-
</
|
|
155
|
+
</PopoverContainer>
|
|
163
156
|
|
|
164
157
|
{arrow && <PopoverArrow ref={arrowRef} style={arrowStyle} />}
|
|
165
158
|
</Root>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/radio',
|
|
6
|
+
title: 'Radio',
|
|
7
|
+
stories: [
|
|
8
|
+
{name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
|
|
9
|
+
{name: 'example', title: 'Example', component: lazy(() => import('./example'))},
|
|
10
|
+
],
|
|
11
|
+
})
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/select',
|
|
6
|
+
title: 'Select',
|
|
7
|
+
stories: [
|
|
8
|
+
{name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
|
|
9
|
+
{name: 'read-only', title: 'Read-only', component: lazy(() => import('./readOnly'))},
|
|
10
|
+
],
|
|
11
|
+
})
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/spinner',
|
|
6
|
+
title: 'Spinner',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'props',
|
|
10
|
+
title: 'Props',
|
|
11
|
+
component: lazy(() => import('./Props')),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
})
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/stack',
|
|
6
|
+
title: 'Stack',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'plain',
|
|
10
|
+
title: 'Plain',
|
|
11
|
+
component: lazy(() => import('./plain')),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
})
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/switch',
|
|
6
|
+
title: 'Switch',
|
|
7
|
+
stories: [
|
|
8
|
+
{name: 'props', title: 'Props', component: lazy(() => import('./props'))},
|
|
9
|
+
{name: 'example', title: 'Example', component: lazy(() => import('./example'))},
|
|
10
|
+
],
|
|
11
|
+
})
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/text',
|
|
6
|
+
title: 'Text',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'default',
|
|
10
|
+
title: 'Text',
|
|
11
|
+
component: lazy(() => import('./example')),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'colored',
|
|
15
|
+
title: 'Colored text',
|
|
16
|
+
component: lazy(() => import('./colored')),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'optical-alignment',
|
|
20
|
+
title: 'Optical alignment',
|
|
21
|
+
component: lazy(() => import('./opticalAlignment')),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
})
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/text-area',
|
|
6
|
+
title: 'TextArea',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'plain',
|
|
10
|
+
title: 'Plain',
|
|
11
|
+
component: lazy(() => import('./plain')),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
})
|
|
@@ -1,45 +1,49 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/text-input',
|
|
6
|
+
title: 'TextInput',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'plain',
|
|
10
|
+
title: 'Plain',
|
|
11
|
+
component: lazy(() => import('./plain')),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'custom-validity',
|
|
15
|
+
title: 'Custom validity',
|
|
16
|
+
component: lazy(() => import('./customValidity')),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'typed',
|
|
20
|
+
title: 'Typed',
|
|
21
|
+
component: lazy(() => import('./typed')),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'tones',
|
|
25
|
+
title: 'Tones',
|
|
26
|
+
component: lazy(() => import('./tones')),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'clear-button',
|
|
30
|
+
title: 'Clear button',
|
|
31
|
+
component: lazy(() => import('./clearButton')),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'read-only',
|
|
35
|
+
title: 'Read only',
|
|
36
|
+
component: lazy(() => import('./readOnly')),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'multiple-tones',
|
|
40
|
+
title: 'Multiple tones',
|
|
41
|
+
component: lazy(() => import('./multipleTones')),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'states',
|
|
45
|
+
title: 'States',
|
|
46
|
+
component: lazy(() => import('./states')),
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {icons, IconSymbol} from '@sanity/icons'
|
|
2
2
|
import {Container, Flex, Stack, Text, TextInput} from '@sanity/ui'
|
|
3
|
-
import {
|
|
3
|
+
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
4
|
+
import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop/plugin-perf'
|
|
4
5
|
import {fireEvent} from '@testing-library/dom'
|
|
5
6
|
import {useCallback, useState} from 'react'
|
|
6
7
|
import {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {defineScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
export default defineScope(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export default defineScope({
|
|
5
|
+
name: 'primitives/tooltip',
|
|
6
|
+
title: 'Tooltip',
|
|
7
|
+
stories: [
|
|
8
|
+
{
|
|
9
|
+
name: 'props',
|
|
10
|
+
title: 'Props',
|
|
11
|
+
component: lazy(() => import('./props')),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
})
|