@sanity/ui 0.38.2-next.14 → 0.38.2-next.16
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/README.md +5 -4
- package/dist/sanity-ui.cjs +260 -10107
- package/dist/sanity-ui.cjs.map +1 -1
- package/dist/sanity-ui.js +260 -9983
- package/dist/sanity-ui.js.map +1 -1
- package/dist/types/src/index.d.ts +239 -227
- package/package.json +20 -17
- package/src/__workshop__/color/overview.tsx +1 -1
- package/src/components/autocomplete/__workshop__/async.tsx +1 -1
- package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
- package/src/components/autocomplete/__workshop__/custom.tsx +1 -1
- package/src/components/autocomplete/__workshop__/example.tsx +1 -1
- package/src/components/autocomplete/__workshop__/focusAndBlur.tsx +1 -1
- package/src/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/components/autocomplete/autocomplete.tsx +1 -1
- package/src/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/components/breadcrumbs/__workshop__/example.tsx +1 -0
- package/src/components/breadcrumbs/breadcrumbs.tsx +9 -1
- package/src/components/dialog/__workshop__/autoFocus.tsx +1 -0
- package/src/components/dialog/__workshop__/layering.tsx +1 -0
- package/src/components/dialog/__workshop__/nested.tsx +1 -1
- package/src/components/dialog/__workshop__/onScroll.tsx +1 -1
- package/src/components/dialog/__workshop__/position.tsx +1 -0
- package/src/components/dialog/__workshop__/props.tsx +1 -1
- package/src/components/dialog/__workshop__/provider.tsx +1 -0
- package/src/components/dialog/dialog.tsx +1 -1
- package/src/components/dialog/dialogProvider.tsx +1 -1
- package/src/components/hotkeys/__workshop__/plain.tsx +1 -0
- package/src/components/hotkeys/hotkeys.tsx +1 -1
- package/src/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/components/menu/__workshop__/closableMenuButton.tsx +1 -1
- package/src/components/menu/__workshop__/constrainedInBoundary.tsx +1 -1
- package/src/components/menu/__workshop__/customMenuItem.tsx +1 -0
- package/src/components/menu/__workshop__/disableFocusOnClose.tsx +1 -0
- package/src/components/menu/__workshop__/groups.tsx +1 -0
- package/src/components/menu/__workshop__/menuButton.tsx +1 -0
- package/src/components/menu/__workshop__/menuGroupRight.tsx +1 -0
- package/src/components/menu/__workshop__/nestedMenu.tsx +1 -0
- package/src/components/menu/__workshop__/onCloseMenuButton.tsx +1 -1
- package/src/components/menu/__workshop__/selectedItem.tsx +1 -1
- package/src/components/menu/__workshop__/tones.tsx +1 -0
- package/src/components/menu/__workshop__/withoutArrow.tsx +1 -0
- package/src/components/menu/menu.test.tsx +5 -4
- package/src/components/menu/menu.tsx +1 -1
- package/src/components/menu/menuButton.tsx +9 -1
- package/src/components/menu/menuGroup.tsx +1 -1
- package/src/components/menu/menuItem.tsx +1 -1
- package/src/components/menu/useMenuController.ts +1 -1
- package/src/components/skeleton/__workshop__/delay.tsx +1 -0
- package/src/components/skeleton/__workshop__/skeleton.tsx +1 -0
- package/src/components/skeleton/skeleton.tsx +1 -1
- package/src/components/skeleton/textSkeleton.tsx +1 -1
- package/src/components/tab/__workshop__/example.tsx +1 -1
- package/src/components/tab/tab.tsx +1 -1
- package/src/components/tab/tabList.tsx +1 -1
- package/src/components/tab/tabPanel.tsx +1 -1
- package/src/components/toast/__workshop__/hook.tsx +1 -0
- package/src/components/toast/__workshop__/toast.tsx +1 -0
- package/src/components/toast/toast.test.tsx +5 -3
- package/src/components/toast/toast.tsx +1 -0
- package/src/components/toast/toastProvider.tsx +1 -1
- package/src/components/tree/__workshop__/basic.tsx +1 -1
- package/src/components/tree/tree.tsx +1 -1
- package/src/components/tree/treeGroup.tsx +1 -1
- package/src/components/tree/treeItem.tsx +3 -3
- package/src/hooks/useElementRect/__workshop__/example.tsx +1 -0
- package/src/hooks/useForwardedRef.ts +1 -1
- package/src/hooks/useMediaIndex/__workshop__/test.tsx +1 -0
- package/src/icons/__workshop__/overview.tsx +1 -1
- package/src/primitives/avatar/__workshop__/asButton.tsx +1 -0
- package/src/primitives/avatar/__workshop__/stack.tsx +1 -0
- package/src/primitives/avatar/avatar.tsx +3 -2
- package/src/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/primitives/avatar/avatarStack.tsx +1 -1
- package/src/primitives/badge/__workshop__/props.tsx +1 -0
- package/src/primitives/badge/__workshop__/tones.tsx +1 -0
- package/src/primitives/badge/badge.tsx +1 -1
- package/src/primitives/box/__workshop__/props.tsx +1 -0
- package/src/primitives/box/__workshop__/responsive.tsx +1 -0
- package/src/primitives/box/box.tsx +1 -1
- package/src/primitives/button/__workshop__/custom.tsx +1 -0
- package/src/primitives/button/__workshop__/customIcons.tsx +1 -0
- package/src/primitives/button/__workshop__/mixedChildren.tsx +1 -0
- package/src/primitives/button/__workshop__/props.tsx +1 -0
- package/src/primitives/button/__workshop__/sanityUploadButton.tsx +1 -0
- package/src/primitives/button/__workshop__/stacked.tsx +1 -0
- package/src/primitives/button/__workshop__/styled1.tsx +1 -0
- package/src/primitives/button/__workshop__/styled2.tsx +1 -0
- package/src/primitives/button/__workshop__/uploadButton.tsx +1 -1
- package/src/primitives/button/button.tsx +1 -1
- package/src/primitives/card/__workshop__/allTones.tsx +1 -0
- package/src/primitives/card/__workshop__/asButton.tsx +1 -0
- package/src/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/primitives/card/__workshop__/checkered.tsx +1 -0
- package/src/primitives/card/__workshop__/interactive.tsx +1 -0
- package/src/primitives/card/__workshop__/listNavigation.tsx +1 -0
- package/src/primitives/card/__workshop__/props.tsx +1 -0
- package/src/primitives/card/__workshop__/selected.tsx +1 -0
- package/src/primitives/card/__workshop__/styled.tsx +1 -0
- package/src/primitives/card/card.tsx +1 -1
- package/src/primitives/checkbox/__workshop__/example.tsx +1 -1
- package/src/primitives/checkbox/__workshop__/props.tsx +1 -0
- package/src/primitives/checkbox/__workshop__/readOnly.tsx +1 -0
- package/src/primitives/checkbox/__workshop__/tones.tsx +1 -0
- package/src/primitives/checkbox/checkbox.tsx +1 -1
- package/src/primitives/code/__workshop__/opticalAlignment.tsx +1 -0
- package/src/primitives/code/__workshop__/props.tsx +1 -0
- package/src/primitives/code/code.tsx +1 -1
- package/src/primitives/container/__workshop__/example.tsx +1 -0
- package/src/primitives/container/container.tsx +1 -1
- package/src/primitives/flex/__workshop__/example.tsx +1 -0
- package/src/primitives/flex/__workshop__/gap.tsx +1 -0
- package/src/primitives/flex/flex.tsx +1 -1
- package/src/primitives/grid/__workshop__/responsive.tsx +1 -0
- package/src/primitives/grid/grid.tsx +1 -1
- package/src/primitives/heading/__workshop__/opticalAlignment.tsx +1 -0
- package/src/primitives/heading/__workshop__/plain.tsx +1 -0
- package/src/primitives/heading/heading.tsx +1 -1
- package/src/primitives/inline/__workshop__/plain.tsx +1 -0
- package/src/primitives/inline/inline.tsx +1 -1
- package/src/primitives/kbd/__workshop__/plain.tsx +1 -0
- package/src/primitives/kbd/kbd.tsx +1 -1
- package/src/primitives/label/__workshop__/opticalAlignment.tsx +1 -0
- package/src/primitives/label/__workshop__/plain.tsx +1 -0
- package/src/primitives/label/label.tsx +1 -1
- package/src/primitives/popover/__workshop__/MarginsStory.tsx +1 -0
- package/src/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +1 -0
- package/src/primitives/popover/__workshop__/PlainStory.tsx +1 -1
- package/src/primitives/popover/__workshop__/RecursiveStory.tsx +1 -1
- package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +1 -1
- package/src/primitives/popover/__workshop__/TestStory.tsx +1 -1
- package/src/primitives/popover/arrow.tsx +1 -1
- package/src/primitives/popover/popover.tsx +9 -1
- package/src/primitives/radio/__workshop__/example.tsx +1 -1
- package/src/primitives/radio/__workshop__/plain.tsx +1 -0
- package/src/primitives/radio/radio.tsx +1 -1
- package/src/primitives/select/__workshop__/plain.tsx +1 -0
- package/src/primitives/select/__workshop__/readOnly.tsx +1 -0
- package/src/primitives/select/select.tsx +1 -1
- package/src/primitives/spinner/__workshop__/Props.tsx +1 -0
- package/src/primitives/spinner/spinner.tsx +1 -1
- package/src/primitives/stack/__workshop__/plain.tsx +1 -0
- package/src/primitives/stack/stack.tsx +1 -1
- package/src/primitives/switch/__workshop__/example.tsx +1 -1
- package/src/primitives/switch/__workshop__/props.tsx +1 -1
- package/src/primitives/switch/switch.tsx +1 -1
- package/src/primitives/text/__workshop__/colored.tsx +1 -0
- package/src/primitives/text/__workshop__/example.tsx +1 -0
- package/src/primitives/text/__workshop__/opticalAlignment.tsx +1 -0
- package/src/primitives/text/text.tsx +1 -1
- package/src/primitives/textArea/__workshop__/plain.tsx +1 -0
- package/src/primitives/textArea/textArea.tsx +1 -1
- package/src/primitives/textInput/__workshop__/clearButton.tsx +1 -1
- package/src/primitives/textInput/__workshop__/customValidity.tsx +1 -0
- package/src/primitives/textInput/__workshop__/multipleTones.tsx +1 -0
- package/src/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/primitives/textInput/__workshop__/readOnly.tsx +1 -0
- package/src/primitives/textInput/__workshop__/states.tsx +1 -0
- package/src/primitives/textInput/__workshop__/tones.tsx +1 -0
- package/src/primitives/textInput/__workshop__/typed.tsx +1 -1
- package/src/primitives/textInput/textInput.tsx +1 -1
- package/src/primitives/tooltip/__workshop__/props.tsx +1 -0
- package/src/primitives/tooltip/tooltip.tsx +1 -1
- package/src/primitives/tooltip/tooltipArrow.tsx +1 -1
- package/src/styles/font/responsiveFont.ts +0 -13
- package/src/styles/helpers.ts +1 -1
- package/src/theme/__workshop__/canvas.tsx +1 -1
- package/src/theme/__workshop__/color.tsx +1 -0
- package/src/theme/__workshop__/layer.tsx +1 -1
- package/src/theme/__workshop__/nestedProvider.tsx +1 -0
- package/src/theme/theme.test.tsx +5 -3
- package/src/theme/themeColorProvider.tsx +1 -0
- package/src/theme/themeProvider.tsx +1 -1
- package/src/utils/boundaryElement/__workshop__/plain.tsx +1 -1
- package/src/utils/boundaryElement/boundaryElement.test.tsx +5 -3
- package/src/utils/boundaryElement/boundaryElementProvider.tsx +1 -1
- package/src/utils/elementQuery/__workshop__/customMedia.tsx +1 -0
- package/src/utils/elementQuery/elementQuery.tsx +1 -1
- package/src/utils/errorBoundary.tsx +4 -4
- package/src/utils/layer/__workshop__/_debug.tsx +1 -0
- package/src/utils/layer/__workshop__/multipleRoots.tsx +1 -0
- package/src/utils/layer/__workshop__/plain.tsx +1 -1
- package/src/utils/layer/__workshop__/responsiveZOffset.tsx +1 -0
- package/src/utils/layer/layer.test.tsx +5 -3
- package/src/utils/layer/layer.tsx +1 -1
- package/src/utils/layer/layerProvider.tsx +1 -1
- package/src/utils/portal/__workshop__/named.tsx +1 -1
- package/src/utils/portal/portal.test.tsx +5 -3
- package/src/utils/portal/portal.ts +3 -2
- package/src/utils/portal/portalProvider.tsx +1 -1
- package/src/utils/srOnly/srOnly.tsx +1 -1
- package/src/utils/virtualList/__workshop__/changingProps.tsx +1 -1
- package/src/utils/virtualList/__workshop__/elementScroll.tsx +1 -1
- package/src/utils/virtualList/__workshop__/infiniteList.tsx +1 -1
- package/src/utils/virtualList/__workshop__/windowScrolll.tsx +1 -1
- package/src/utils/virtualList/virtualList.tsx +1 -1
- package/src/primitives/badge/badge.test.tsx +0 -13
- package/src/primitives/button/button.test.tsx +0 -41
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "0.38.2-next.
|
|
3
|
+
"version": "0.38.2-next.16+92171d95",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"module": "./dist/sanity-ui.js",
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
"main": "./dist/sanity-ui.cjs",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"source": "./src/index.ts",
|
|
12
|
-
"default": "./dist/sanity-ui.js",
|
|
13
11
|
"types": "./dist/types/src/index.d.ts",
|
|
14
|
-
"
|
|
12
|
+
"source": "./src/index.ts",
|
|
13
|
+
"import": "./dist/sanity-ui.js",
|
|
14
|
+
"require": "./dist/sanity-ui.cjs",
|
|
15
|
+
"default": "./dist/sanity-ui.js"
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
@@ -21,36 +22,38 @@
|
|
|
21
22
|
"license": "MIT",
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "pkg build --tsconfig tsconfig.dist.json",
|
|
25
|
+
"check:package": "pkg --strict --tsconfig tsconfig.dist.json",
|
|
24
26
|
"clean": "rimraf dist",
|
|
25
27
|
"lint": "eslint . --ext .js,.jsx,.mjs,.ts,.tsx --quiet",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
+
"postbuild": "run-s check:package",
|
|
29
|
+
"prebuild": "run-s clean",
|
|
30
|
+
"test": "vitest run",
|
|
28
31
|
"type-check": "tsc --build",
|
|
29
32
|
"watch": "pkg watch --tsconfig tsconfig.dist.json"
|
|
30
33
|
},
|
|
31
34
|
"dependencies": {
|
|
32
35
|
"@juggle/resize-observer": "^3.4.0",
|
|
33
36
|
"@popperjs/core": "^2.11.6",
|
|
34
|
-
"@
|
|
35
|
-
"@sanity/
|
|
36
|
-
"
|
|
37
|
+
"@reach/auto-id": "^0.17.0",
|
|
38
|
+
"@sanity/color": "2.1.16-next.16+92171d95",
|
|
39
|
+
"@sanity/icons": "1.3.6-next.16+92171d95",
|
|
40
|
+
"framer-motion": "6.3.0",
|
|
37
41
|
"popper-max-size-modifier": "^0.2.0",
|
|
38
|
-
"react-is": "^
|
|
42
|
+
"react-is": "^17.0.2",
|
|
39
43
|
"react-popper": "^2.3.0",
|
|
40
44
|
"react-refractor": "^2.1.7"
|
|
41
45
|
},
|
|
42
46
|
"devDependencies": {
|
|
43
47
|
"@testing-library/dom": "^8.17.1",
|
|
44
|
-
"@testing-library/
|
|
45
|
-
"@testing-library/react": "^13.4.0",
|
|
48
|
+
"@testing-library/react": "^12.1.5",
|
|
46
49
|
"@types/refractor": "^3.0.2",
|
|
47
|
-
"react": "^
|
|
48
|
-
"react-dom": "^
|
|
50
|
+
"react": "^17.0.2",
|
|
51
|
+
"react-dom": "^17.0.2",
|
|
49
52
|
"styled-components": "^5.3.5"
|
|
50
53
|
},
|
|
51
54
|
"peerDependencies": {
|
|
52
|
-
"react": "^18",
|
|
53
|
-
"react-dom": "^18",
|
|
55
|
+
"react": "^16.9 || ^17 || ^18",
|
|
56
|
+
"react-dom": "^16.9 || ^17 || ^18",
|
|
54
57
|
"styled-components": "^5.2"
|
|
55
58
|
},
|
|
56
59
|
"repository": {
|
|
@@ -70,5 +73,5 @@
|
|
|
70
73
|
"publishConfig": {
|
|
71
74
|
"access": "public"
|
|
72
75
|
},
|
|
73
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "92171d95fb67bb758aa160067afba1739d344a04"
|
|
74
77
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {black, ColorTints, ColorValue, COLOR_HUES, hues, white} from '@sanity/color'
|
|
2
2
|
import {Box, Card, Code, Flex, Grid, Heading, Stack, useToast} from '@sanity/ui'
|
|
3
|
-
import {useCallback} from 'react'
|
|
3
|
+
import React, {useCallback} from 'react'
|
|
4
4
|
import {hexToRgb, rgbToHsl} from '../../theme'
|
|
5
5
|
|
|
6
6
|
function ucfirst(str: string) {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Stack,
|
|
11
11
|
Text,
|
|
12
12
|
} from '@sanity/ui'
|
|
13
|
-
import {useCallback, useEffect, useRef, useState} from 'react'
|
|
13
|
+
import React, {useCallback, useEffect, useRef, useState} from 'react'
|
|
14
14
|
import {countriesStore} from '../__mocks__/apiStore'
|
|
15
15
|
|
|
16
16
|
export default function AsyncStory() {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Stack,
|
|
8
8
|
Text,
|
|
9
9
|
} from '@sanity/ui'
|
|
10
|
-
import {useCallback, useState} from 'react'
|
|
10
|
+
import React, {useCallback, useState} from 'react'
|
|
11
11
|
import {Popover} from '../../../primitives'
|
|
12
12
|
import countries from '../__fixtures__/countries'
|
|
13
13
|
import {AutocompleteProps} from '../autocomplete'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Autocomplete, Box, Button, Card, Code, Stack, Text} from '@sanity/ui'
|
|
2
2
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
3
|
-
import {useCallback, useState} from 'react'
|
|
3
|
+
import React, {useCallback, useState} from 'react'
|
|
4
4
|
import {
|
|
5
5
|
WORKSHOP_RADIUS_OPTIONS,
|
|
6
6
|
WORKSHOP_SPACE_OPTIONS,
|
|
@@ -2,7 +2,7 @@ import {Autocomplete, Box, Card, Container, Stack, Text} from '@sanity/ui'
|
|
|
2
2
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
3
3
|
import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop'
|
|
4
4
|
import {fireEvent} from '@testing-library/dom'
|
|
5
|
-
import {useCallback, useMemo, useState} from 'react'
|
|
5
|
+
import React, {useCallback, useMemo, useState} from 'react'
|
|
6
6
|
import {
|
|
7
7
|
WORKSHOP_CARD_TONE_OPTIONS,
|
|
8
8
|
WORKSHOP_RADIUS_OPTIONS,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
useToast,
|
|
19
19
|
} from '@sanity/ui'
|
|
20
20
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
21
|
-
import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
21
|
+
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
22
22
|
import {countriesStore} from '../__mocks__/apiStore'
|
|
23
23
|
|
|
24
24
|
export default function Fullscreen() {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, {
|
|
2
|
+
Children,
|
|
3
|
+
forwardRef,
|
|
4
|
+
Fragment,
|
|
5
|
+
isValidElement,
|
|
6
|
+
useCallback,
|
|
7
|
+
useMemo,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react'
|
|
2
10
|
import {useArrayProp, useClickOutside} from '../../hooks'
|
|
3
11
|
import {Box, Popover, Stack, Text} from '../../primitives'
|
|
4
12
|
import {ExpandButton, Root} from './breadcrumbs.styles'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Box, Dialog, LayerProvider, Text} from '@sanity/ui'
|
|
2
2
|
import {useAction} from '@sanity/ui-workshop'
|
|
3
|
-
import {useEffect, useRef} from 'react'
|
|
3
|
+
import React, {useEffect, useRef} from 'react'
|
|
4
4
|
|
|
5
5
|
export default function OnScrollStory() {
|
|
6
6
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {ArrowDownIcon, ArrowUpIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Dialog, LayerProvider, Stack, Text} from '@sanity/ui'
|
|
3
3
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
4
|
+
import React from 'react'
|
|
4
5
|
import {WORKSHOP_DIALOG_POSITION_OPTIONS} from '../../../__workshop__/constants'
|
|
5
6
|
|
|
6
7
|
export default function PositionStory() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Box, Button, Dialog, LayerProvider, Stack, Text} from '@sanity/ui'
|
|
2
2
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
3
|
-
import {useCallback, useRef, useState} from 'react'
|
|
3
|
+
import React, {useCallback, useRef, useState} from 'react'
|
|
4
4
|
import {WORKSHOP_WIDTH_OPTIONS} from '../../../__workshop__/constants'
|
|
5
5
|
|
|
6
6
|
export default function PropsStory() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {CloseIcon} from '@sanity/icons'
|
|
2
|
-
import {forwardRef, useCallback, useEffect, useRef, useState} from 'react'
|
|
2
|
+
import React, {forwardRef, useCallback, useEffect, useRef, useState} from 'react'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
import {focusFirstDescendant, focusLastDescendant} from '../../helpers'
|
|
5
5
|
import {useArrayProp, useClickOutside, useForwardedRef, useGlobalKeyDown} from '../../hooks'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Button, Flex, Menu, MenuButton, MenuItem, Text} from '@sanity/ui'
|
|
2
|
-
import {forwardRef} from 'react'
|
|
2
|
+
import React, {forwardRef} from 'react'
|
|
3
3
|
|
|
4
4
|
const CustomLink = forwardRef(function CustomLink(
|
|
5
5
|
props: {req: string} & Omit<React.HTMLProps<HTMLAnchorElement>, 'as' | 'href'>,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {AddIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Button, Menu, MenuButton, MenuItem, Stack} from '@sanity/ui'
|
|
3
|
-
import {useRef} from 'react'
|
|
3
|
+
import React, {useRef} from 'react'
|
|
4
4
|
|
|
5
5
|
export default function ClosableMenuButtonStory() {
|
|
6
6
|
const ref = useRef<HTMLButtonElement | null>(null)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {SelectIcon} from '@sanity/icons'
|
|
2
2
|
import {Button, Flex, Menu, MenuButton, MenuItem} from '@sanity/ui'
|
|
3
3
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
4
|
+
import React from 'react'
|
|
4
5
|
|
|
5
6
|
export default function DisableFocusOnCloseStory() {
|
|
6
7
|
const disableRestoreFocusOnClose = useBoolean('Disable restore focus on close', false)
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
MenuItem,
|
|
12
12
|
} from '@sanity/ui'
|
|
13
13
|
import {useAction, useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
14
|
+
import React from 'react'
|
|
14
15
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
|
|
15
16
|
|
|
16
17
|
export default function MenuButtonStory() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {CheckmarkIcon, ClockIcon, ExpandIcon, SearchIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Button, Code, Menu, MenuButton, MenuDivider, MenuItem, Stack} from '@sanity/ui'
|
|
3
|
-
import {useState} from 'react'
|
|
3
|
+
import React, {useState} from 'react'
|
|
4
4
|
|
|
5
5
|
export default function SelectedItemStory() {
|
|
6
6
|
const [selectedIndex, setSelectedIndex] = useState(0)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {SearchIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Card, LayerProvider, Menu, MenuItem} from '@sanity/ui'
|
|
3
3
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
4
|
+
import React from 'react'
|
|
4
5
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
|
|
5
6
|
|
|
6
7
|
export default function TonesStory() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
|
-
import {useCallback, useMemo} from 'react'
|
|
3
|
+
import React, {useCallback, useMemo} from 'react'
|
|
4
|
+
import {vi} from 'vitest'
|
|
4
5
|
import {render} from '../../../test'
|
|
5
6
|
import {MenuContext, MenuContextValue} from './menuContext'
|
|
6
7
|
import {useMenu} from './useMenu'
|
|
@@ -8,7 +9,7 @@ import {useMenu} from './useMenu'
|
|
|
8
9
|
describe('components/menu', () => {
|
|
9
10
|
describe('useMenu', () => {
|
|
10
11
|
it('should get context value', async () => {
|
|
11
|
-
const log =
|
|
12
|
+
const log = vi.fn()
|
|
12
13
|
|
|
13
14
|
function Debug() {
|
|
14
15
|
const rootMenu = useMenu()
|
|
@@ -64,7 +65,7 @@ describe('components/menu', () => {
|
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
it('should fail when no context value is provided', async () => {
|
|
67
|
-
const log =
|
|
68
|
+
const log = vi.fn()
|
|
68
69
|
|
|
69
70
|
function Debug() {
|
|
70
71
|
try {
|
|
@@ -93,7 +94,7 @@ describe('components/menu', () => {
|
|
|
93
94
|
})
|
|
94
95
|
|
|
95
96
|
it('should fail when context value is not compatible', async () => {
|
|
96
|
-
const log =
|
|
97
|
+
const log = vi.fn()
|
|
97
98
|
|
|
98
99
|
function Debug() {
|
|
99
100
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {forwardRef, useCallback, useEffect, useMemo} from 'react'
|
|
1
|
+
import React, {forwardRef, useCallback, useEffect, useMemo} from 'react'
|
|
2
2
|
import styled from 'styled-components'
|
|
3
3
|
import {useClickOutside, useForwardedRef, useGlobalKeyDown} from '../../hooks'
|
|
4
4
|
import {Box, Stack} from '../../primitives'
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, {
|
|
2
|
+
cloneElement,
|
|
3
|
+
forwardRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState,
|
|
7
|
+
useEffect,
|
|
8
|
+
useRef,
|
|
9
|
+
} from 'react'
|
|
2
10
|
import {isElement} from 'react-is'
|
|
3
11
|
import {Popover, PopoverProps} from '../../primitives'
|
|
4
12
|
import {ThemeColorSchemeKey} from '../../theme'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ChevronRightIcon} from '@sanity/icons'
|
|
2
|
-
import {createElement, isValidElement, useCallback, useEffect, useRef, useState} from 'react'
|
|
2
|
+
import React, {createElement, isValidElement, useCallback, useEffect, useRef, useState} from 'react'
|
|
3
3
|
import {isValidElementType} from 'react-is'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
5
5
|
import {Box, Flex, Popover, PopoverProps, Text} from '../../primitives'
|
|
@@ -33,7 +33,7 @@ export function useMenuController(props: {
|
|
|
33
33
|
const activeElement = elementsRef.current[activeIndex] || null
|
|
34
34
|
const mounted = Boolean(rootElement)
|
|
35
35
|
|
|
36
|
-
const setActiveIndex = useCallback((nextActiveIndex
|
|
36
|
+
const setActiveIndex = useCallback((nextActiveIndex) => {
|
|
37
37
|
_setActiveIndex(nextActiveIndex)
|
|
38
38
|
activeIndexRef.current = nextActiveIndex
|
|
39
39
|
}, [])
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
TextSkeleton,
|
|
13
13
|
} from '@sanity/ui'
|
|
14
14
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
15
|
+
import React from 'react'
|
|
15
16
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
|
|
16
17
|
|
|
17
18
|
export default function SkeletonDelayStory() {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
TextSkeleton,
|
|
13
13
|
} from '@sanity/ui'
|
|
14
14
|
import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
15
|
+
import React from 'react'
|
|
15
16
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
|
|
16
17
|
|
|
17
18
|
export default function SkeletonStory() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {OkHandIcon, RocketIcon, SunIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Card, Tab, TabList, TabPanel, Text} from '@sanity/ui'
|
|
3
|
-
import {useState} from 'react'
|
|
3
|
+
import React, {useState} from 'react'
|
|
4
4
|
|
|
5
5
|
export default function ExampleStory() {
|
|
6
6
|
const [tab, setTab] = useState('foo')
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {Box, Container, Toast} from '@sanity/ui'
|
|
2
2
|
import {useAction, useBoolean, useSelect, useString, useText} from '@sanity/ui-workshop'
|
|
3
|
+
import React from 'react'
|
|
3
4
|
import {WORKSHOP_TOAST_STATUS_OPTIONS} from '../../../__workshop__/constants'
|
|
4
5
|
|
|
5
6
|
export default function ToastStory() {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {vi} from 'vitest'
|
|
1
3
|
import {render} from '../../../test'
|
|
2
4
|
import {ToastContext} from './toastContext'
|
|
3
5
|
import {ToastContextValue} from './types'
|
|
@@ -6,7 +8,7 @@ import {useToast} from './useToast'
|
|
|
6
8
|
describe('components/toast', () => {
|
|
7
9
|
describe('useToast', () => {
|
|
8
10
|
it('should get context value', async () => {
|
|
9
|
-
const log =
|
|
11
|
+
const log = vi.fn()
|
|
10
12
|
|
|
11
13
|
function Debug() {
|
|
12
14
|
const rootToast = useToast()
|
|
@@ -36,7 +38,7 @@ describe('components/toast', () => {
|
|
|
36
38
|
})
|
|
37
39
|
|
|
38
40
|
it('should fail when no context value is provided', async () => {
|
|
39
|
-
const log =
|
|
41
|
+
const log = vi.fn()
|
|
40
42
|
|
|
41
43
|
function Debug() {
|
|
42
44
|
try {
|
|
@@ -64,7 +66,7 @@ describe('components/toast', () => {
|
|
|
64
66
|
})
|
|
65
67
|
|
|
66
68
|
it('should fail when context value is not compatible', async () => {
|
|
67
|
-
const log =
|
|
69
|
+
const log = vi.fn()
|
|
68
70
|
|
|
69
71
|
function Debug() {
|
|
70
72
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {AnimatePresence, motion} from 'framer-motion'
|
|
2
|
-
import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
2
|
+
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
import {Box} from '../../primitives'
|
|
5
5
|
import {Layer} from '../../utils'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {LinkIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Tree, TreeItem} from '@sanity/ui'
|
|
3
3
|
import {usePerfTest} from '@sanity/ui-workshop'
|
|
4
|
-
import {useCallback, useState} from 'react'
|
|
4
|
+
import React, {useCallback, useState} from 'react'
|
|
5
5
|
import {perfTests} from './basic.perf'
|
|
6
6
|
|
|
7
7
|
export default function BasicStory() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
1
|
+
import React, {forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
2
2
|
import {useForwardedRef} from '../../hooks'
|
|
3
3
|
import {Stack} from '../../primitives'
|
|
4
4
|
import {_findNextItemElement, _findPrevItemElement, _focusItemElement} from './helpers'
|