@sanity/ui 1.7.4 → 1.7.7
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 -1
- package/dist/index.esm.js +259 -245
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +259 -245
- package/dist/index.js.map +1 -1
- package/package.json +28 -28
- package/src/components/tab/__workshop__/example.tsx +6 -1
- package/src/components/tab/tab.tsx +6 -1
- package/src/components/tab/tabList.tsx +19 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"source": "./src/index.ts",
|
|
13
13
|
"require": "./dist/index.js",
|
|
14
14
|
"node": {
|
|
15
|
-
"import": "./dist/index.cjs.mjs"
|
|
16
|
-
"require": "./dist/index.js"
|
|
15
|
+
"import": "./dist/index.cjs.mjs"
|
|
17
16
|
},
|
|
18
17
|
"import": "./dist/index.esm.js",
|
|
19
18
|
"default": "./dist/index.esm.js"
|
|
@@ -53,56 +52,56 @@
|
|
|
53
52
|
"@sanity/color": "^2.2.5",
|
|
54
53
|
"@sanity/icons": "^2.4.1",
|
|
55
54
|
"csstype": "^3.1.2",
|
|
56
|
-
"framer-motion": "^10.
|
|
55
|
+
"framer-motion": "^10.15.2",
|
|
57
56
|
"react-refractor": "^2.1.7"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
|
-
"@babel/core": "^7.22.
|
|
61
|
-
"@babel/preset-env": "^7.22.
|
|
59
|
+
"@babel/core": "^7.22.10",
|
|
60
|
+
"@babel/preset-env": "^7.22.10",
|
|
62
61
|
"@babel/preset-react": "^7.22.5",
|
|
63
62
|
"@babel/preset-typescript": "^7.22.5",
|
|
64
|
-
"@commitlint/cli": "^17.
|
|
65
|
-
"@commitlint/config-conventional": "^17.
|
|
63
|
+
"@commitlint/cli": "^17.7.1",
|
|
64
|
+
"@commitlint/config-conventional": "^17.7.0",
|
|
66
65
|
"@juggle/resize-observer": "^3.4.0",
|
|
67
|
-
"@sanity/pkg-utils": "^2.
|
|
68
|
-
"@sanity/semantic-release-preset": "^4.1.
|
|
69
|
-
"@sanity/ui-workshop": "^1.2.
|
|
66
|
+
"@sanity/pkg-utils": "^2.4.5",
|
|
67
|
+
"@sanity/semantic-release-preset": "^4.1.3",
|
|
68
|
+
"@sanity/ui-workshop": "^1.2.9",
|
|
70
69
|
"@testing-library/dom": "^9.3.1",
|
|
71
70
|
"@testing-library/jest-dom": "^5.17.0",
|
|
72
71
|
"@testing-library/react": "^14.0.0",
|
|
73
72
|
"@types/jest": "^29.5.3",
|
|
74
73
|
"@types/jest-axe": "^3.5.5",
|
|
75
|
-
"@types/node": "^20.
|
|
76
|
-
"@types/react": "^18.2.
|
|
74
|
+
"@types/node": "^20.5.0",
|
|
75
|
+
"@types/react": "^18.2.20",
|
|
77
76
|
"@types/react-dom": "^18.2.7",
|
|
78
77
|
"@types/react-is": "^18.2.1",
|
|
79
78
|
"@types/refractor": "^3.0.2",
|
|
80
79
|
"@types/styled-components": "^5.1.26",
|
|
81
80
|
"@types/testing-library__jest-dom": "^5.14.9",
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
83
|
-
"@typescript-eslint/parser": "^
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^6.3.0",
|
|
82
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
84
83
|
"commitizen": "^4.3.0",
|
|
85
|
-
"cypress": "^12.17.
|
|
86
|
-
"cypress-real-events": "^1.
|
|
84
|
+
"cypress": "^12.17.3",
|
|
85
|
+
"cypress-real-events": "^1.10.0",
|
|
87
86
|
"cz-conventional-changelog": "^3.3.0",
|
|
88
|
-
"esbuild": "^0.
|
|
87
|
+
"esbuild": "^0.19.2",
|
|
89
88
|
"esbuild-register": "^3.4.2",
|
|
90
|
-
"eslint": "^8.
|
|
91
|
-
"eslint-config-prettier": "^8.
|
|
92
|
-
"eslint-plugin-import": "^2.
|
|
89
|
+
"eslint": "^8.47.0",
|
|
90
|
+
"eslint-config-prettier": "^8.10.0",
|
|
91
|
+
"eslint-plugin-import": "^2.28.0",
|
|
93
92
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
94
93
|
"eslint-plugin-prettier": "^5.0.0",
|
|
95
|
-
"eslint-plugin-react": "^7.33.
|
|
94
|
+
"eslint-plugin-react": "^7.33.1",
|
|
96
95
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
97
96
|
"http-server": "^14.1.1",
|
|
98
97
|
"husky": "^8.0.3",
|
|
99
|
-
"jest": "^29.6.
|
|
100
|
-
"jest-axe": "^
|
|
101
|
-
"jest-environment-jsdom": "^29.6.
|
|
102
|
-
"lint-staged": "^13.
|
|
98
|
+
"jest": "^29.6.2",
|
|
99
|
+
"jest-axe": "^8.0.0",
|
|
100
|
+
"jest-environment-jsdom": "^29.6.2",
|
|
101
|
+
"lint-staged": "^13.3.0",
|
|
103
102
|
"module-alias": "^2.2.3",
|
|
104
103
|
"npm-run-all": "^4.1.5",
|
|
105
|
-
"prettier": "^3.0.
|
|
104
|
+
"prettier": "^3.0.1",
|
|
106
105
|
"react": "^18.2.0",
|
|
107
106
|
"react-dom": "^18.2.0",
|
|
108
107
|
"react-is": "^18.2.0",
|
|
@@ -148,7 +147,8 @@
|
|
|
148
147
|
},
|
|
149
148
|
"packageManager": "pnpm@8.6.10",
|
|
150
149
|
"publishConfig": {
|
|
151
|
-
"access": "public"
|
|
150
|
+
"access": "public",
|
|
151
|
+
"provenance": true
|
|
152
152
|
},
|
|
153
153
|
"release": {
|
|
154
154
|
"extends": "@sanity/semantic-release-preset",
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import {OkHandIcon, RocketIcon, SunIcon} from '@sanity/icons'
|
|
2
2
|
import {Box, Card, Tab, TabList, TabPanel, Text} from '@sanity/ui'
|
|
3
|
+
import {useBoolean} from '@sanity/ui-workshop'
|
|
3
4
|
import {useState} from 'react'
|
|
4
5
|
|
|
5
6
|
export default function ExampleStory() {
|
|
6
7
|
const [tab, setTab] = useState('foo')
|
|
8
|
+
const useLongTitle = useBoolean('Use long title', false, 'Props') || false
|
|
9
|
+
|
|
10
|
+
const longTitle =
|
|
11
|
+
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
|
|
7
12
|
|
|
8
13
|
return (
|
|
9
14
|
<Box padding={[4, 5, 6]}>
|
|
@@ -28,7 +33,7 @@ export default function ExampleStory() {
|
|
|
28
33
|
aria-controls="example-panel-baz"
|
|
29
34
|
icon={OkHandIcon}
|
|
30
35
|
id="example-tab-baz"
|
|
31
|
-
label=
|
|
36
|
+
label={useLongTitle ? longTitle : 'Baz'}
|
|
32
37
|
onClick={() => setTab('baz')}
|
|
33
38
|
selected={tab === 'baz'}
|
|
34
39
|
/>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {forwardRef, useCallback, useEffect, useRef} from 'react'
|
|
2
|
+
import styled from 'styled-components'
|
|
2
3
|
import {useForwardedRef} from '../../hooks'
|
|
3
4
|
import {Button} from '../../primitives'
|
|
4
5
|
import {ButtonTone} from '../../types'
|
|
@@ -21,6 +22,10 @@ export interface TabProps {
|
|
|
21
22
|
tone?: ButtonTone
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
const CustomButton = styled(Button)`
|
|
26
|
+
max-width: 100%;
|
|
27
|
+
`
|
|
28
|
+
|
|
24
29
|
/**
|
|
25
30
|
* @public
|
|
26
31
|
*/
|
|
@@ -71,7 +76,7 @@ export const Tab = forwardRef(function Tab(
|
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
return (
|
|
74
|
-
<
|
|
79
|
+
<CustomButton
|
|
75
80
|
data-ui="Tab"
|
|
76
81
|
{...restProps}
|
|
77
82
|
aria-selected={selected ? 'true' : 'false'}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {cloneElement, forwardRef, useCallback, useMemo, useState} from 'react'
|
|
2
|
+
import styled from 'styled-components'
|
|
2
3
|
import {Inline, InlineProps} from '../../primitives'
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -12,6 +13,16 @@ function _isReactElement(node: unknown): node is React.ReactElement {
|
|
|
12
13
|
return Boolean(node)
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
//Limits the width of tabs in tablist
|
|
17
|
+
const CustomInline = styled(Inline)`
|
|
18
|
+
& > div {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
vertical-align: middle;
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
}
|
|
24
|
+
`
|
|
25
|
+
|
|
15
26
|
/**
|
|
16
27
|
* @public
|
|
17
28
|
*/
|
|
@@ -52,8 +63,14 @@ export const TabList = forwardRef(function TabList(
|
|
|
52
63
|
)
|
|
53
64
|
|
|
54
65
|
return (
|
|
55
|
-
<
|
|
66
|
+
<CustomInline
|
|
67
|
+
data-ui="TabList"
|
|
68
|
+
{...restProps}
|
|
69
|
+
onKeyDown={handleKeyDown}
|
|
70
|
+
ref={ref}
|
|
71
|
+
role="tablist"
|
|
72
|
+
>
|
|
56
73
|
{tabs}
|
|
57
|
-
</
|
|
74
|
+
</CustomInline>
|
|
58
75
|
)
|
|
59
76
|
})
|