@sanity/ui 0.38.2-next.14 → 0.38.2-next.22
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/package.json +10 -10
- package/src/components/menu/menu.test.tsx +4 -3
- package/src/components/toast/toast.test.tsx +4 -3
- package/src/theme/theme.test.tsx +4 -3
- package/src/utils/boundaryElement/boundaryElement.test.tsx +4 -3
- package/src/utils/layer/layer.test.tsx +4 -3
- package/src/utils/portal/portal.test.tsx +4 -3
- 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.22+11066dc1",
|
|
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": [
|
|
@@ -20,19 +21,19 @@
|
|
|
20
21
|
],
|
|
21
22
|
"license": "MIT",
|
|
22
23
|
"scripts": {
|
|
23
|
-
"build": "pkg build --tsconfig tsconfig.dist.json",
|
|
24
|
+
"build": "pkg build --tsconfig tsconfig.dist.json && pkg --strict",
|
|
24
25
|
"clean": "rimraf dist",
|
|
25
26
|
"lint": "eslint . --ext .js,.jsx,.mjs,.ts,.tsx --quiet",
|
|
26
27
|
"prebuild": "yarn clean",
|
|
27
|
-
"test": "
|
|
28
|
+
"test": "vitest run",
|
|
28
29
|
"type-check": "tsc --build",
|
|
29
30
|
"watch": "pkg watch --tsconfig tsconfig.dist.json"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"@juggle/resize-observer": "^3.4.0",
|
|
33
34
|
"@popperjs/core": "^2.11.6",
|
|
34
|
-
"@sanity/color": "2.1.16-next.
|
|
35
|
-
"@sanity/icons": "1.3.6-next.
|
|
35
|
+
"@sanity/color": "2.1.16-next.22+11066dc1",
|
|
36
|
+
"@sanity/icons": "1.3.6-next.22+11066dc1",
|
|
36
37
|
"framer-motion": "^7.3.2",
|
|
37
38
|
"popper-max-size-modifier": "^0.2.0",
|
|
38
39
|
"react-is": "^18.2.0",
|
|
@@ -41,7 +42,6 @@
|
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@testing-library/dom": "^8.17.1",
|
|
44
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
45
45
|
"@testing-library/react": "^13.4.0",
|
|
46
46
|
"@types/refractor": "^3.0.2",
|
|
47
47
|
"react": "^18.2.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "11066dc1633849a19e1aae1a2f64e1d48c8b1e1a"
|
|
74
74
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
3
|
import {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,3 +1,4 @@
|
|
|
1
|
+
import {vi} from 'vitest'
|
|
1
2
|
import {render} from '../../../test'
|
|
2
3
|
import {ToastContext} from './toastContext'
|
|
3
4
|
import {ToastContextValue} from './types'
|
|
@@ -6,7 +7,7 @@ import {useToast} from './useToast'
|
|
|
6
7
|
describe('components/toast', () => {
|
|
7
8
|
describe('useToast', () => {
|
|
8
9
|
it('should get context value', async () => {
|
|
9
|
-
const log =
|
|
10
|
+
const log = vi.fn()
|
|
10
11
|
|
|
11
12
|
function Debug() {
|
|
12
13
|
const rootToast = useToast()
|
|
@@ -36,7 +37,7 @@ describe('components/toast', () => {
|
|
|
36
37
|
})
|
|
37
38
|
|
|
38
39
|
it('should fail when no context value is provided', async () => {
|
|
39
|
-
const log =
|
|
40
|
+
const log = vi.fn()
|
|
40
41
|
|
|
41
42
|
function Debug() {
|
|
42
43
|
try {
|
|
@@ -64,7 +65,7 @@ describe('components/toast', () => {
|
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
it('should fail when context value is not compatible', async () => {
|
|
67
|
-
const log =
|
|
68
|
+
const log = vi.fn()
|
|
68
69
|
|
|
69
70
|
function Debug() {
|
|
70
71
|
try {
|
package/src/theme/theme.test.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {vi} from 'vitest'
|
|
1
2
|
import {render} from '../../test'
|
|
2
3
|
import {studioTheme} from './studioTheme'
|
|
3
4
|
import {ThemeContext} from './themeContext'
|
|
@@ -7,7 +8,7 @@ import {useRootTheme} from './useRootTheme'
|
|
|
7
8
|
describe('theme', () => {
|
|
8
9
|
describe('useRootTheme', () => {
|
|
9
10
|
it('should get context value', async () => {
|
|
10
|
-
const log =
|
|
11
|
+
const log = vi.fn()
|
|
11
12
|
|
|
12
13
|
function Debug() {
|
|
13
14
|
const rootTheme = useRootTheme()
|
|
@@ -40,7 +41,7 @@ describe('theme', () => {
|
|
|
40
41
|
})
|
|
41
42
|
|
|
42
43
|
it('should fail when no context value is provided', async () => {
|
|
43
|
-
const log =
|
|
44
|
+
const log = vi.fn()
|
|
44
45
|
|
|
45
46
|
function Debug() {
|
|
46
47
|
try {
|
|
@@ -68,7 +69,7 @@ describe('theme', () => {
|
|
|
68
69
|
})
|
|
69
70
|
|
|
70
71
|
it('should fail when context value is not compatible', async () => {
|
|
71
|
-
const log =
|
|
72
|
+
const log = vi.fn()
|
|
72
73
|
|
|
73
74
|
function Debug() {
|
|
74
75
|
try {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {vi} from 'vitest'
|
|
1
2
|
import {render} from '../../../test'
|
|
2
3
|
import {BoundaryElementContext} from './boundaryElementContext'
|
|
3
4
|
import {BoundaryElementContextValue} from './types'
|
|
@@ -6,7 +7,7 @@ import {useBoundaryElement} from './useBoundaryElement'
|
|
|
6
7
|
describe('utils/boundaryElement', () => {
|
|
7
8
|
describe('useBoundaryElement', () => {
|
|
8
9
|
it('should get context value', async () => {
|
|
9
|
-
const log =
|
|
10
|
+
const log = vi.fn()
|
|
10
11
|
|
|
11
12
|
function Debug() {
|
|
12
13
|
const rootBoundaryElement = useBoundaryElement()
|
|
@@ -36,7 +37,7 @@ describe('utils/boundaryElement', () => {
|
|
|
36
37
|
})
|
|
37
38
|
|
|
38
39
|
it('should provide default value when no context value is provided', async () => {
|
|
39
|
-
const log =
|
|
40
|
+
const log = vi.fn()
|
|
40
41
|
|
|
41
42
|
function Debug() {
|
|
42
43
|
const rootBoundaryElement = useBoundaryElement()
|
|
@@ -63,7 +64,7 @@ describe('utils/boundaryElement', () => {
|
|
|
63
64
|
})
|
|
64
65
|
|
|
65
66
|
it('should fail when context value is not compatible', async () => {
|
|
66
|
-
const log =
|
|
67
|
+
const log = vi.fn()
|
|
67
68
|
|
|
68
69
|
function Debug() {
|
|
69
70
|
try {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {vi} from 'vitest'
|
|
1
2
|
import {render} from '../../../test'
|
|
2
3
|
import {LayerContext} from './layerContext'
|
|
3
4
|
import {LayerContextValue} from './types'
|
|
@@ -6,7 +7,7 @@ import {useLayer} from './useLayer'
|
|
|
6
7
|
describe('utils/layer', () => {
|
|
7
8
|
describe('useLayer', () => {
|
|
8
9
|
it('should get context value', async () => {
|
|
9
|
-
const log =
|
|
10
|
+
const log = vi.fn()
|
|
10
11
|
|
|
11
12
|
function Debug() {
|
|
12
13
|
const rootLayer = useLayer()
|
|
@@ -42,7 +43,7 @@ describe('utils/layer', () => {
|
|
|
42
43
|
})
|
|
43
44
|
|
|
44
45
|
it('should fail when no context value is provided', async () => {
|
|
45
|
-
const log =
|
|
46
|
+
const log = vi.fn()
|
|
46
47
|
|
|
47
48
|
function Debug() {
|
|
48
49
|
try {
|
|
@@ -70,7 +71,7 @@ describe('utils/layer', () => {
|
|
|
70
71
|
})
|
|
71
72
|
|
|
72
73
|
it('should fail when context value is not compatible', async () => {
|
|
73
|
-
const log =
|
|
74
|
+
const log = vi.fn()
|
|
74
75
|
|
|
75
76
|
function Debug() {
|
|
76
77
|
try {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {vi} from 'vitest'
|
|
1
2
|
import {render} from '../../../test'
|
|
2
3
|
import {PortalContext} from './portalContext'
|
|
3
4
|
import {PortalContextValue} from './types'
|
|
@@ -6,7 +7,7 @@ import {usePortal} from './usePortal'
|
|
|
6
7
|
describe('utils/portal', () => {
|
|
7
8
|
describe('usePortal', () => {
|
|
8
9
|
it('should get context value', async () => {
|
|
9
|
-
const log =
|
|
10
|
+
const log = vi.fn()
|
|
10
11
|
|
|
11
12
|
function Debug() {
|
|
12
13
|
const rootPortal = usePortal()
|
|
@@ -38,7 +39,7 @@ describe('utils/portal', () => {
|
|
|
38
39
|
})
|
|
39
40
|
|
|
40
41
|
it('should fail when no context value is provided', async () => {
|
|
41
|
-
const log =
|
|
42
|
+
const log = vi.fn()
|
|
42
43
|
|
|
43
44
|
function Debug() {
|
|
44
45
|
try {
|
|
@@ -66,7 +67,7 @@ describe('utils/portal', () => {
|
|
|
66
67
|
})
|
|
67
68
|
|
|
68
69
|
it('should fail when context value is not compatible', async () => {
|
|
69
|
-
const log =
|
|
70
|
+
const log = vi.fn()
|
|
70
71
|
|
|
71
72
|
function Debug() {
|
|
72
73
|
try {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {axe} from 'jest-axe'
|
|
2
|
-
import {render} from '../../../test'
|
|
3
|
-
import {Badge} from './badge'
|
|
4
|
-
|
|
5
|
-
describe('atoms/badge', () => {
|
|
6
|
-
it('should have no violations (axe)', async () => {
|
|
7
|
-
const lightResult = render(<Badge tone="positive">Label</Badge>, {scheme: 'light'})
|
|
8
|
-
const darkResult = render(<Badge tone="positive">Label</Badge>, {scheme: 'dark'})
|
|
9
|
-
|
|
10
|
-
expect(await axe(lightResult.container.outerHTML)).toHaveNoViolations()
|
|
11
|
-
expect(await axe(darkResult.container.outerHTML)).toHaveNoViolations()
|
|
12
|
-
})
|
|
13
|
-
})
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {AddIcon} from '@sanity/icons'
|
|
2
|
-
import {screen} from '@testing-library/react'
|
|
3
|
-
import {axe} from 'jest-axe'
|
|
4
|
-
import {render} from '../../../test'
|
|
5
|
-
import {Button, ButtonProps} from './button'
|
|
6
|
-
|
|
7
|
-
describe('atoms/button', () => {
|
|
8
|
-
it('Axe: should have no violations', async () => {
|
|
9
|
-
const lightResult = render(<Button icon={AddIcon} text="Label" tone="positive" />, {
|
|
10
|
-
scheme: 'light',
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
expect(await axe(lightResult.container.outerHTML)).toHaveNoViolations()
|
|
14
|
-
|
|
15
|
-
const darkResult = render(<Button icon={AddIcon} text="Label" tone="positive" />, {
|
|
16
|
-
scheme: 'dark',
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
expect(await axe(darkResult.container.outerHTML)).toHaveNoViolations()
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
it('should render text', () => {
|
|
23
|
-
render(<Button text="Button text" />)
|
|
24
|
-
|
|
25
|
-
expect(screen.getByText('Button text')).toBeInTheDocument()
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
it('should wrap button', () => {
|
|
29
|
-
function WrappedButton({button: buttonProps}: {button: ButtonProps}) {
|
|
30
|
-
return <Button {...buttonProps} />
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const buttonProps: ButtonProps = {
|
|
34
|
-
text: 'Button text',
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
render(<WrappedButton button={buttonProps} />)
|
|
38
|
-
|
|
39
|
-
expect(screen.getByText('Button text')).toBeInTheDocument()
|
|
40
|
-
})
|
|
41
|
-
})
|