@sanity/ui 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.mjs +0 -2
- package/dist/index.d.ts +19 -34
- package/dist/index.esm.js +213 -189
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +211 -189
- package/dist/index.js.map +1 -1
- package/package.json +39 -39
- package/src/components/menu/__workshop__/menuButton.tsx +2 -0
- package/src/components/menu/menuButton.tsx +10 -0
- package/src/primitives/popover/__workshop__/AlignedStory.tsx +1 -0
- package/src/primitives/popover/__workshop__/SidePanelStory.tsx +86 -0
- package/src/primitives/popover/__workshop__/TestStory.tsx +30 -18
- package/src/primitives/popover/__workshop__/index.ts +3 -3
- package/src/primitives/popover/helpers.ts +32 -0
- package/src/primitives/popover/index.ts +0 -2
- package/src/primitives/popover/popover.tsx +124 -58
- package/src/primitives/popover/popoverCard.tsx +21 -50
- package/src/primitives/popover/types.ts +6 -8
- package/src/primitives/tooltip/tooltip.tsx +4 -4
- package/src/primitives/popover/__workshop__/PositionStory.tsx +0 -103
- package/src/primitives/popover/popover.test.tsx +0 -164
- package/src/primitives/popover/popoverContext.tsx +0 -9
- package/src/primitives/popover/popoverProvider.tsx +0 -29
- package/src/primitives/popover/useOnForcedUpdate.ts +0 -15
- package/src/primitives/popover/usePopover.ts +0 -24
package/dist/index.cjs.mjs
CHANGED
|
@@ -36,7 +36,6 @@ export const MenuDivider = cjs.MenuDivider;
|
|
|
36
36
|
export const MenuGroup = cjs.MenuGroup;
|
|
37
37
|
export const MenuItem = cjs.MenuItem;
|
|
38
38
|
export const Popover = cjs.Popover;
|
|
39
|
-
export const PopoverProvider = cjs.PopoverProvider;
|
|
40
39
|
export const Portal = cjs.Portal;
|
|
41
40
|
export const PortalProvider = cjs.PortalProvider;
|
|
42
41
|
export const Radio = cjs.Radio;
|
|
@@ -110,7 +109,6 @@ export const useForwardedRef = cjs.useForwardedRef;
|
|
|
110
109
|
export const useGlobalKeyDown = cjs.useGlobalKeyDown;
|
|
111
110
|
export const useLayer = cjs.useLayer;
|
|
112
111
|
export const useMediaIndex = cjs.useMediaIndex;
|
|
113
|
-
export const usePopover = cjs.usePopover;
|
|
114
112
|
export const usePortal = cjs.usePortal;
|
|
115
113
|
export const usePrefersDark = cjs.usePrefersDark;
|
|
116
114
|
export const usePrefersReducedMotion = cjs.usePrefersReducedMotion;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,13 +6,14 @@ import {ElementType} from 'react'
|
|
|
6
6
|
import {ForwardRefExoticComponent} from 'react'
|
|
7
7
|
import {HTMLProps} from 'react'
|
|
8
8
|
import {MemoExoticComponent} from 'react'
|
|
9
|
+
import {MutableRefObject} from 'react'
|
|
9
10
|
import {NamedExoticComponent} from 'react'
|
|
10
11
|
import {PropsWithChildren} from 'react'
|
|
11
|
-
import {default as React_2} from 'react'
|
|
12
12
|
import {ReactElement} from 'react'
|
|
13
13
|
import {ReactNode} from 'react'
|
|
14
14
|
import {Ref} from 'react'
|
|
15
15
|
import {RefAttributes} from 'react'
|
|
16
|
+
import {RefCallback} from 'react'
|
|
16
17
|
import {StyledComponent} from 'styled-components'
|
|
17
18
|
|
|
18
19
|
/** @beta */
|
|
@@ -1198,6 +1199,7 @@ export declare interface MenuButtonProps {
|
|
|
1198
1199
|
id: string
|
|
1199
1200
|
menu?: React.ReactElement
|
|
1200
1201
|
onClose?: () => void
|
|
1202
|
+
onOpen?: () => void
|
|
1201
1203
|
/**
|
|
1202
1204
|
* @deprecated Use `popover={{placement: 'top'}}` instead.
|
|
1203
1205
|
*/
|
|
@@ -1344,62 +1346,50 @@ export declare const Popover: MemoExoticComponent<
|
|
|
1344
1346
|
>
|
|
1345
1347
|
>
|
|
1346
1348
|
|
|
1347
|
-
/**
|
|
1348
|
-
* @public
|
|
1349
|
-
*/
|
|
1350
|
-
export declare interface PopoverContextValue {
|
|
1351
|
-
version: number
|
|
1352
|
-
forceUpdate: () => void
|
|
1353
|
-
lastUpdateId: string | null
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
1349
|
/**
|
|
1357
1350
|
* @beta
|
|
1358
1351
|
*/
|
|
1359
1352
|
export declare type PopoverMargins = [number, number, number, number]
|
|
1360
1353
|
|
|
1361
|
-
/**
|
|
1362
|
-
* @public
|
|
1363
|
-
*/
|
|
1354
|
+
/** @public */
|
|
1364
1355
|
export declare interface PopoverProps
|
|
1365
1356
|
extends Omit<LayerProps, 'as'>,
|
|
1366
1357
|
ResponsiveRadiusProps,
|
|
1367
|
-
ResponsiveShadowProps
|
|
1368
|
-
|
|
1369
|
-
/**
|
|
1370
|
-
* @beta
|
|
1371
|
-
*/
|
|
1358
|
+
ResponsiveShadowProps {
|
|
1359
|
+
/** @beta */
|
|
1372
1360
|
__unstable_margins?: PopoverMargins
|
|
1373
1361
|
arrow?: boolean
|
|
1362
|
+
/** @deprecated Use `floatingBoundary` and/or `referenceBoundary` instead */
|
|
1374
1363
|
boundaryElement?: HTMLElement | null
|
|
1375
1364
|
children?: React.ReactElement
|
|
1376
1365
|
constrainSize?: boolean
|
|
1377
1366
|
content?: React.ReactNode
|
|
1378
1367
|
disabled?: boolean
|
|
1379
1368
|
fallbackPlacements?: Placement[]
|
|
1369
|
+
floatingBoundary?: HTMLElement | null
|
|
1370
|
+
matchReferenceWidth?: boolean
|
|
1380
1371
|
open?: boolean
|
|
1381
1372
|
overflow?: BoxOverflow
|
|
1382
1373
|
padding?: number | number[]
|
|
1383
1374
|
placement?: Placement
|
|
1384
1375
|
portal?: boolean | string
|
|
1385
1376
|
preventOverflow?: boolean
|
|
1377
|
+
referenceBoundary?: HTMLElement | null
|
|
1386
1378
|
referenceElement?: HTMLElement | null
|
|
1387
|
-
matchReferenceWidth?: boolean
|
|
1388
1379
|
scheme?: ThemeColorSchemeKey
|
|
1389
1380
|
tone?: CardTone
|
|
1381
|
+
/** @beta */
|
|
1382
|
+
updateRef?:
|
|
1383
|
+
| MutableRefObject<PopoverUpdateCallback | undefined>
|
|
1384
|
+
| RefCallback<PopoverUpdateCallback | undefined>
|
|
1385
|
+
width?: PopoverWidth | PopoverWidth[]
|
|
1390
1386
|
}
|
|
1391
1387
|
|
|
1392
|
-
/**
|
|
1393
|
-
|
|
1394
|
-
*/
|
|
1395
|
-
export declare const PopoverProvider: ({children}: PopoverProviderProps) => React_2.ReactElement
|
|
1388
|
+
/** @beta */
|
|
1389
|
+
export declare type PopoverUpdateCallback = () => void
|
|
1396
1390
|
|
|
1397
|
-
/**
|
|
1398
|
-
|
|
1399
|
-
*/
|
|
1400
|
-
export declare interface PopoverProviderProps {
|
|
1401
|
-
children?: React_2.ReactNode
|
|
1402
|
-
}
|
|
1391
|
+
/** @public */
|
|
1392
|
+
export declare type PopoverWidth = number | 'auto'
|
|
1403
1393
|
|
|
1404
1394
|
/**
|
|
1405
1395
|
* @public
|
|
@@ -2828,11 +2818,6 @@ export declare function useLayer(): LayerContextValue
|
|
|
2828
2818
|
*/
|
|
2829
2819
|
export declare function useMediaIndex(): number
|
|
2830
2820
|
|
|
2831
|
-
/**
|
|
2832
|
-
* @public
|
|
2833
|
-
*/
|
|
2834
|
-
export declare function usePopover(): PopoverContextValue
|
|
2835
|
-
|
|
2836
2821
|
/**
|
|
2837
2822
|
* @public
|
|
2838
2823
|
*/
|