@sanity/ui 1.7.8 → 1.7.10
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.d.ts +346 -10
- package/dist/index.esm.js +20 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -13
- package/dist/index.js.map +1 -1
- package/package.json +22 -22
- package/src/components/dialog/styles.ts +1 -1
- package/src/components/menu/__workshop__/shouldFocus.tsx +1 -1
- package/src/components/menu/menuDivider.ts +2 -3
- package/src/components/menu/menuGroup.tsx +1 -1
- package/src/components/tree/style.ts +4 -4
- package/src/primitives/_selectable/style.ts +3 -3
- package/src/primitives/avatar/styles.ts +6 -3
- package/src/primitives/badge/styles.ts +1 -1
- package/src/primitives/box/box.tsx +1 -0
- package/src/primitives/button/styles.ts +3 -2
- package/src/primitives/card/styles.ts +4 -4
- package/src/primitives/checkbox/styles.ts +3 -3
- package/src/primitives/code/styles.ts +3 -5
- package/src/primitives/container/styles.ts +1 -1
- package/src/primitives/flex/flex.tsx +1 -0
- package/src/primitives/heading/styles.ts +2 -4
- package/src/primitives/inline/inline.tsx +8 -1
- package/src/primitives/inline/styles.ts +1 -1
- package/src/primitives/label/styles.ts +2 -2
- package/src/primitives/popover/popover.tsx +2 -0
- package/src/primitives/radio/styles.ts +3 -3
- package/src/primitives/select/styles.ts +6 -5
- package/src/primitives/stack/styles.ts +1 -1
- package/src/primitives/switch/styles.ts +6 -6
- package/src/primitives/text/styles.ts +2 -2
- package/src/styles/border/borderStyle.ts +1 -1
- package/src/styles/box/boxStyle.ts +1 -1
- package/src/styles/colorVars/colorVarsStyle.ts +1 -1
- package/src/styles/flex/flexItemStyle.ts +1 -1
- package/src/styles/flex/flexStyle.ts +1 -1
- package/src/styles/font/codeFontStyle.ts +1 -1
- package/src/styles/font/headingFontStyle.ts +1 -1
- package/src/styles/font/labelFontStyle.ts +1 -1
- package/src/styles/font/responsiveFont.ts +1 -1
- package/src/styles/font/textAlignStyle.ts +1 -1
- package/src/styles/font/textFontStyle.ts +1 -1
- package/src/styles/grid/gridItemStyle.ts +1 -1
- package/src/styles/grid/gridStyle.ts +1 -1
- package/src/styles/helpers.ts +1 -1
- package/src/styles/input/responsiveInputPaddingStyle.ts +1 -1
- package/src/styles/input/textInputStyle.ts +5 -4
- package/src/styles/margin/marginStyle.ts +1 -1
- package/src/styles/padding/paddingStyle.ts +1 -1
- package/src/styles/radius/radiusStyle.ts +1 -1
- package/src/styles/shadow/shadowStyle.ts +1 -1
- package/src/theme/types.ts +1 -1
- package/src/types/index.ts +1 -0
- package/src/types/styled.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.10",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"source": "./src/index.ts",
|
|
13
13
|
"require": "./dist/index.js",
|
|
14
14
|
"node": {
|
|
15
|
+
"module": "./dist/index.esm.js",
|
|
15
16
|
"import": "./dist/index.cjs.mjs"
|
|
16
17
|
},
|
|
17
18
|
"import": "./dist/index.esm.js",
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
"@sanity/color": "^2.2.5",
|
|
53
54
|
"@sanity/icons": "^2.4.1",
|
|
54
55
|
"csstype": "^3.1.2",
|
|
55
|
-
"framer-motion": "^10.
|
|
56
|
+
"framer-motion": "^10.16.1",
|
|
56
57
|
"react-refractor": "^2.1.7"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
@@ -63,52 +64,51 @@
|
|
|
63
64
|
"@commitlint/cli": "^17.7.1",
|
|
64
65
|
"@commitlint/config-conventional": "^17.7.0",
|
|
65
66
|
"@juggle/resize-observer": "^3.4.0",
|
|
66
|
-
"@sanity/pkg-utils": "^2.4.
|
|
67
|
+
"@sanity/pkg-utils": "^2.4.8",
|
|
67
68
|
"@sanity/semantic-release-preset": "^4.1.3",
|
|
68
|
-
"@sanity/ui-workshop": "^1.2.
|
|
69
|
+
"@sanity/ui-workshop": "^1.2.10",
|
|
69
70
|
"@testing-library/dom": "^9.3.1",
|
|
70
71
|
"@testing-library/jest-dom": "^5.17.0",
|
|
71
72
|
"@testing-library/react": "^14.0.0",
|
|
72
|
-
"@types/jest": "^29.5.
|
|
73
|
+
"@types/jest": "^29.5.4",
|
|
73
74
|
"@types/jest-axe": "^3.5.5",
|
|
74
|
-
"@types/node": "^20.5.
|
|
75
|
-
"@types/react": "^18.2.
|
|
75
|
+
"@types/node": "^20.5.3",
|
|
76
|
+
"@types/react": "^18.2.21",
|
|
76
77
|
"@types/react-dom": "^18.2.7",
|
|
77
78
|
"@types/react-is": "^18.2.1",
|
|
78
79
|
"@types/refractor": "^3.0.2",
|
|
79
|
-
"@types/styled-components": "^5.1.26",
|
|
80
80
|
"@types/testing-library__jest-dom": "^5.14.9",
|
|
81
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
82
|
-
"@typescript-eslint/parser": "^6.
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
82
|
+
"@typescript-eslint/parser": "^6.4.1",
|
|
83
83
|
"commitizen": "^4.3.0",
|
|
84
|
-
"cypress": "^12.17.
|
|
84
|
+
"cypress": "^12.17.4",
|
|
85
85
|
"cypress-real-events": "^1.10.0",
|
|
86
86
|
"cz-conventional-changelog": "^3.3.0",
|
|
87
87
|
"esbuild": "^0.19.2",
|
|
88
88
|
"esbuild-register": "^3.4.2",
|
|
89
89
|
"eslint": "^8.47.0",
|
|
90
|
-
"eslint-config-prettier": "^
|
|
91
|
-
"eslint-plugin-import": "^2.28.
|
|
90
|
+
"eslint-config-prettier": "^9.0.0",
|
|
91
|
+
"eslint-plugin-import": "^2.28.1",
|
|
92
92
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
93
93
|
"eslint-plugin-prettier": "^5.0.0",
|
|
94
|
-
"eslint-plugin-react": "^7.33.
|
|
94
|
+
"eslint-plugin-react": "^7.33.2",
|
|
95
95
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
96
96
|
"http-server": "^14.1.1",
|
|
97
97
|
"husky": "^8.0.3",
|
|
98
|
-
"jest": "^29.6.
|
|
98
|
+
"jest": "^29.6.3",
|
|
99
99
|
"jest-axe": "^8.0.0",
|
|
100
|
-
"jest-environment-jsdom": "^29.6.
|
|
101
|
-
"lint-staged": "^
|
|
100
|
+
"jest-environment-jsdom": "^29.6.3",
|
|
101
|
+
"lint-staged": "^14.0.1",
|
|
102
102
|
"module-alias": "^2.2.3",
|
|
103
103
|
"npm-run-all": "^4.1.5",
|
|
104
|
-
"prettier": "^3.0.
|
|
104
|
+
"prettier": "^3.0.2",
|
|
105
105
|
"react": "^18.2.0",
|
|
106
106
|
"react-dom": "^18.2.0",
|
|
107
107
|
"react-is": "^18.2.0",
|
|
108
108
|
"rimraf": "^5.0.1",
|
|
109
|
-
"semantic-release": "^21.0.
|
|
109
|
+
"semantic-release": "^21.0.9",
|
|
110
110
|
"start-server-and-test": "^2.0.0",
|
|
111
|
-
"styled-components": "^
|
|
111
|
+
"styled-components": "^6.0.7",
|
|
112
112
|
"tsconfig-paths": "^4.2.0",
|
|
113
113
|
"typescript": "^5.1.6"
|
|
114
114
|
},
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"react": "^18",
|
|
117
117
|
"react-dom": "^18",
|
|
118
118
|
"react-is": "^18",
|
|
119
|
-
"styled-components": "^5.2"
|
|
119
|
+
"styled-components": "^5.2 || ^6"
|
|
120
120
|
},
|
|
121
121
|
"engines": {
|
|
122
122
|
"node": ">=14.0.0"
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"prettier --write --cache --ignore-unknown"
|
|
146
146
|
]
|
|
147
147
|
},
|
|
148
|
-
"packageManager": "pnpm@8.6.
|
|
148
|
+
"packageManager": "pnpm@8.6.12",
|
|
149
149
|
"publishConfig": {
|
|
150
150
|
"access": "public",
|
|
151
151
|
"provenance": true
|
|
@@ -14,7 +14,7 @@ const ITEMS = [...Array(8).keys()].map((num) => ({
|
|
|
14
14
|
const OPTIONS = {first: 'first', last: 'last'}
|
|
15
15
|
|
|
16
16
|
export default function ShouldFocusStory() {
|
|
17
|
-
const shouldFocus = useSelect('Should focus', OPTIONS, 'first')
|
|
17
|
+
const shouldFocus = useSelect<keyof typeof OPTIONS>('Should focus', OPTIONS, 'first')
|
|
18
18
|
|
|
19
19
|
const [popoverOpen, setPopoverOpen] = useState<boolean>(false)
|
|
20
20
|
const handleToggleOpen = useCallback(() => setPopoverOpen((v) => !v), [])
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import styled
|
|
2
|
-
import {Theme} from '../../theme'
|
|
1
|
+
import styled from 'styled-components'
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* @public
|
|
6
5
|
*/
|
|
7
|
-
export const MenuDivider
|
|
6
|
+
export const MenuDivider = styled.hr`
|
|
8
7
|
height: 1px;
|
|
9
8
|
border: 0;
|
|
10
9
|
background: var(--card-hairline-soft-color);
|
|
@@ -54,7 +54,7 @@ export function MenuGroup(
|
|
|
54
54
|
onItemMouseEnter = menu.onMouseEnter,
|
|
55
55
|
registerElement,
|
|
56
56
|
} = menu
|
|
57
|
-
const [rootElement, setRootElement] = useState<HTMLButtonElement | null>(null)
|
|
57
|
+
const [rootElement, setRootElement] = useState<HTMLButtonElement | HTMLDivElement | null>(null)
|
|
58
58
|
const [open, setOpen] = useState(false)
|
|
59
59
|
const shouldFocusRef = useRef<'first' | 'last' | null>(null)
|
|
60
60
|
const active = Boolean(activeElement) && activeElement === rootElement
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {rem, ThemeProps} from '../../styles'
|
|
3
3
|
import {_colorVarsStyle} from '../../styles/colorVars'
|
|
4
4
|
|
|
5
|
-
export function treeItemRootStyle():
|
|
5
|
+
export function treeItemRootStyle(): ReturnType<typeof css> {
|
|
6
6
|
return css`
|
|
7
7
|
&[role='none'] > [role='treeitem'] {
|
|
8
8
|
outline: none;
|
|
@@ -29,7 +29,7 @@ export function treeItemRootStyle(): FlattenSimpleInterpolation {
|
|
|
29
29
|
`
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function treeItemRootColorStyle(props: ThemeProps):
|
|
32
|
+
export function treeItemRootColorStyle(props: ThemeProps): ReturnType<typeof css> {
|
|
33
33
|
const {theme} = props
|
|
34
34
|
const $tone = 'default'
|
|
35
35
|
const {base, muted, selectable} = theme.sanity.color
|
|
@@ -93,7 +93,7 @@ export interface TreeItemBoxStyleProps {
|
|
|
93
93
|
|
|
94
94
|
export function treeItemBoxStyle(
|
|
95
95
|
props: TreeItemBoxStyleProps & ThemeProps,
|
|
96
|
-
):
|
|
96
|
+
): ReturnType<typeof css> {
|
|
97
97
|
const {$level, theme} = props
|
|
98
98
|
const {space} = theme.sanity
|
|
99
99
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {ThemeProps} from '../../styles'
|
|
3
3
|
import {_colorVarsStyle} from '../../styles/colorVars'
|
|
4
4
|
import {SelectableTone} from '../../types/selectable'
|
|
@@ -10,7 +10,7 @@ export interface SelectableStyleProps {
|
|
|
10
10
|
$tone: SelectableTone
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function selectableBaseStyle():
|
|
13
|
+
export function selectableBaseStyle(): ReturnType<typeof css> {
|
|
14
14
|
return css`
|
|
15
15
|
background-color: inherit;
|
|
16
16
|
color: inherit;
|
|
@@ -34,7 +34,7 @@ export function selectableBaseStyle(): FlattenSimpleInterpolation {
|
|
|
34
34
|
|
|
35
35
|
export function selectableColorStyle(
|
|
36
36
|
props: SelectableStyleProps & ThemeProps,
|
|
37
|
-
):
|
|
37
|
+
): ReturnType<typeof css> {
|
|
38
38
|
const {$tone, theme} = props
|
|
39
39
|
const {base, muted, selectable} = theme.sanity.color
|
|
40
40
|
// @todo: remove use of `muted` here
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {CSSObject} from 'styled-components'
|
|
2
1
|
import {rem, _responsive, ThemeProps} from '../../styles'
|
|
3
2
|
import {focusRingStyle} from '../../styles/internal'
|
|
3
|
+
import {CSSObject} from '../../types/styled'
|
|
4
4
|
import {AvatarRootStyleProps, ResponsiveAvatarSizeStyleProps} from './types'
|
|
5
5
|
|
|
6
6
|
export const avatarStyle = {
|
|
@@ -32,6 +32,7 @@ function avatarArrowStyle(): CSSObject {
|
|
|
32
32
|
left: '50%',
|
|
33
33
|
transform: 'translateX(-6px)',
|
|
34
34
|
|
|
35
|
+
// @ts-expect-error -- TODO wait for CSSObject types to be fixed in `styled-components` itself
|
|
35
36
|
'&:not([hidden])': {
|
|
36
37
|
display: 'block',
|
|
37
38
|
},
|
|
@@ -70,6 +71,7 @@ export function avatarRootStyle(props: AvatarRootStyleProps & ThemeProps): CSSOb
|
|
|
70
71
|
},
|
|
71
72
|
|
|
72
73
|
'&>svg': {
|
|
74
|
+
// @ts-expect-error -- TODO wait for CSSObject types to be fixed in `styled-components` itself
|
|
73
75
|
'&:not([hidden])': {
|
|
74
76
|
display: 'block',
|
|
75
77
|
},
|
|
@@ -77,7 +79,7 @@ export function avatarRootStyle(props: AvatarRootStyleProps & ThemeProps): CSSOb
|
|
|
77
79
|
|
|
78
80
|
/* &:is(button) */
|
|
79
81
|
'&[data-as="button"]': {
|
|
80
|
-
|
|
82
|
+
WebkitFontSmoothing: 'inherit',
|
|
81
83
|
appearance: 'none',
|
|
82
84
|
margin: 0,
|
|
83
85
|
padding: 0,
|
|
@@ -86,6 +88,7 @@ export function avatarRootStyle(props: AvatarRootStyleProps & ThemeProps): CSSOb
|
|
|
86
88
|
color: 'inherit',
|
|
87
89
|
outline: 'none',
|
|
88
90
|
|
|
91
|
+
// @ts-expect-error -- TODO wait for CSSObject types to be fixed in `styled-components` itself
|
|
89
92
|
'&:focus': {
|
|
90
93
|
boxShadow: focusRingStyle({focusRing}),
|
|
91
94
|
},
|
|
@@ -152,7 +155,7 @@ function avatarStrokeStyle(): CSSObject {
|
|
|
152
155
|
strokeWidth: '3px',
|
|
153
156
|
|
|
154
157
|
'[data-status="editing"] &': {
|
|
155
|
-
|
|
158
|
+
strokeDasharray: '2 4',
|
|
156
159
|
strokeLinecap: 'round',
|
|
157
160
|
},
|
|
158
161
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {ThemeProps} from '../../styles'
|
|
3
3
|
import {_colorVarsStyle} from '../../styles/colorVars'
|
|
4
4
|
import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
|
|
5
5
|
import {ButtonMode, ButtonTone} from '../../types'
|
|
6
|
+
import {CSSObject} from '../../types/styled'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @internal
|
|
9
10
|
*/
|
|
10
|
-
export function buttonBaseStyles():
|
|
11
|
+
export function buttonBaseStyles(): ReturnType<typeof css> {
|
|
11
12
|
return css`
|
|
12
13
|
-webkit-font-smoothing: inherit;
|
|
13
14
|
appearance: none;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {ThemeProps} from '../../styles'
|
|
3
3
|
import {_colorVarsStyle} from '../../styles/colorVars'
|
|
4
4
|
import {focusRingBorderStyle, focusRingStyle} from '../../styles/focusRing'
|
|
@@ -6,11 +6,11 @@ import {CardStyleProps} from './types'
|
|
|
6
6
|
|
|
7
7
|
export function cardStyle(
|
|
8
8
|
props: CardStyleProps & ThemeProps,
|
|
9
|
-
): Array<
|
|
9
|
+
): Array<ReturnType<typeof css> | (() => ReturnType<typeof css>)> {
|
|
10
10
|
return [cardBaseStyle(props), cardColorStyle(props)]
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function cardBaseStyle(props: CardStyleProps & ThemeProps):
|
|
13
|
+
export function cardBaseStyle(props: CardStyleProps & ThemeProps): ReturnType<typeof css> {
|
|
14
14
|
const {$checkered, theme} = props
|
|
15
15
|
const space = theme.sanity.space
|
|
16
16
|
|
|
@@ -45,7 +45,7 @@ export function cardBaseStyle(props: CardStyleProps & ThemeProps): FlattenSimple
|
|
|
45
45
|
`
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export function cardColorStyle(props: CardStyleProps & ThemeProps):
|
|
48
|
+
export function cardColorStyle(props: CardStyleProps & ThemeProps): ReturnType<typeof css> {
|
|
49
49
|
const {$checkered, $focusRing, theme} = props
|
|
50
50
|
const {focusRing} = theme.sanity
|
|
51
51
|
const {base, card, dark} = theme.sanity.color
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {rem, ThemeProps} from '../../styles'
|
|
3
3
|
import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
|
|
4
4
|
|
|
5
|
-
export function checkboxBaseStyles():
|
|
5
|
+
export function checkboxBaseStyles(): ReturnType<typeof css> {
|
|
6
6
|
return css`
|
|
7
7
|
position: relative;
|
|
8
8
|
display: inline-block;
|
|
9
9
|
`
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function inputElementStyles(props: ThemeProps):
|
|
12
|
+
export function inputElementStyles(props: ThemeProps): ReturnType<typeof css> {
|
|
13
13
|
const {theme} = props
|
|
14
14
|
const color = theme.sanity.color.input
|
|
15
15
|
const {focusRing, input, radius} = theme.sanity
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {css,
|
|
2
|
-
import {ThemeProps} from '../../styles'
|
|
3
|
-
import {Theme} from '../../theme'
|
|
1
|
+
import {css, ExecutionContext} from 'styled-components'
|
|
4
2
|
|
|
5
|
-
function codeSyntaxHighlightingStyle({theme}:
|
|
3
|
+
function codeSyntaxHighlightingStyle({theme}: ExecutionContext) {
|
|
6
4
|
const color = theme.sanity.color.syntax
|
|
7
5
|
|
|
8
6
|
return {
|
|
@@ -45,7 +43,7 @@ function codeSyntaxHighlightingStyle({theme}: ThemeProps) {
|
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
export function codeBaseStyle():
|
|
46
|
+
export function codeBaseStyle(): ReturnType<typeof css> {
|
|
49
47
|
return css`
|
|
50
48
|
color: var(--card-code-fg-color);
|
|
51
49
|
|
|
@@ -35,6 +35,7 @@ export const Flex = forwardRef(function Flex(
|
|
|
35
35
|
const {align, as, direction = 'row', gap, justify, wrap, ...restProps} = props
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
+
// @ts-expect-error -- some dollar prefixed typings aren't inferred correctly https://github.com/styled-components/styled-components/issues/4062
|
|
38
39
|
<Root
|
|
39
40
|
data-ui="Flex"
|
|
40
41
|
{...restProps}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {ThemeProps} from '../../styles'
|
|
3
3
|
import {HeadingStyleProps} from './types'
|
|
4
4
|
|
|
5
|
-
export function headingBaseStyle(
|
|
6
|
-
props: HeadingStyleProps & ThemeProps,
|
|
7
|
-
): FlattenSimpleInterpolation {
|
|
5
|
+
export function headingBaseStyle(props: HeadingStyleProps & ThemeProps): ReturnType<typeof css> {
|
|
8
6
|
const {$accent, $muted, theme} = props
|
|
9
7
|
|
|
10
8
|
return css`
|
|
@@ -33,7 +33,14 @@ export const Inline = forwardRef(function Inline(
|
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<Root
|
|
36
|
+
<Root
|
|
37
|
+
data-ui="Inline"
|
|
38
|
+
{...restProps}
|
|
39
|
+
$space={useArrayProp(space)}
|
|
40
|
+
forwardedAs={as}
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
ref={ref as any}
|
|
43
|
+
>
|
|
37
44
|
{children}
|
|
38
45
|
</Root>
|
|
39
46
|
)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {ThemeProps} from '../../styles'
|
|
3
3
|
|
|
4
4
|
export function labelBaseStyle(
|
|
5
5
|
props: {$accent?: boolean; $muted: boolean} & ThemeProps,
|
|
6
|
-
):
|
|
6
|
+
): ReturnType<typeof css> {
|
|
7
7
|
const {$accent, $muted, theme} = props
|
|
8
8
|
const {fonts} = theme.sanity
|
|
9
9
|
|
|
@@ -35,6 +35,8 @@ import {calcCurrentWidth, calcMaxWidth} from './helpers'
|
|
|
35
35
|
import {PopoverCard} from './popoverCard'
|
|
36
36
|
import {PopoverUpdateCallback, PopoverWidth} from './types'
|
|
37
37
|
|
|
38
|
+
export type {PopoverUpdateCallback}
|
|
39
|
+
|
|
38
40
|
/** @public */
|
|
39
41
|
export interface PopoverProps
|
|
40
42
|
extends Omit<LayerProps, 'as'>,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {rem, ThemeProps} from '../../styles'
|
|
3
3
|
import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
|
|
4
4
|
|
|
5
|
-
export function radioBaseStyle():
|
|
5
|
+
export function radioBaseStyle(): ReturnType<typeof css> {
|
|
6
6
|
return css`
|
|
7
7
|
position: relative;
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ export function radioBaseStyle(): FlattenSimpleInterpolation {
|
|
|
16
16
|
`
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function inputElementStyle(props: ThemeProps):
|
|
19
|
+
export function inputElementStyle(props: ThemeProps): ReturnType<typeof css> {
|
|
20
20
|
const {theme} = props
|
|
21
21
|
const {focusRing, input} = theme.sanity
|
|
22
22
|
const color = theme.sanity.color.input
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {rem, _responsive, ThemeProps} from '../../styles'
|
|
3
3
|
import {
|
|
4
4
|
focusRingBorderStyle,
|
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
ResponsiveRadiusStyleProps,
|
|
9
9
|
} from '../../styles/internal'
|
|
10
10
|
import {ThemeFontSize} from '../../theme'
|
|
11
|
+
import {CSSObject} from '../../types/styled'
|
|
11
12
|
|
|
12
|
-
function rootStyle():
|
|
13
|
+
function rootStyle(): ReturnType<typeof css> {
|
|
13
14
|
return css`
|
|
14
15
|
position: relative;
|
|
15
16
|
width: stretch;
|
|
@@ -20,7 +21,7 @@ function rootStyle(): FlattenSimpleInterpolation {
|
|
|
20
21
|
`
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
function inputBaseStyle(props: ThemeProps):
|
|
24
|
+
function inputBaseStyle(props: ThemeProps): ReturnType<typeof css> {
|
|
24
25
|
const {theme} = props
|
|
25
26
|
const font = theme.sanity.fonts.text
|
|
26
27
|
|
|
@@ -117,7 +118,7 @@ function inputStyle(): Array<
|
|
|
117
118
|
$space: number[]
|
|
118
119
|
} & ThemeProps,
|
|
119
120
|
) => CSSObject[])
|
|
120
|
-
| ((props: ThemeProps) =>
|
|
121
|
+
| ((props: ThemeProps) => ReturnType<typeof css>)
|
|
121
122
|
> {
|
|
122
123
|
return [
|
|
123
124
|
responsiveRadiusStyle,
|
|
@@ -128,7 +129,7 @@ function inputStyle(): Array<
|
|
|
128
129
|
]
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
function iconBoxStyle(props: ThemeProps):
|
|
132
|
+
function iconBoxStyle(props: ThemeProps): ReturnType<typeof css> {
|
|
132
133
|
const {theme} = props
|
|
133
134
|
const color = theme.sanity.color.input
|
|
134
135
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {rem, ThemeProps} from '../../styles'
|
|
3
3
|
import {focusRingStyle} from '../../styles/internal'
|
|
4
4
|
|
|
5
5
|
/* Root */
|
|
6
|
-
export function switchBaseStyles():
|
|
6
|
+
export function switchBaseStyles(): ReturnType<typeof css> {
|
|
7
7
|
return css`
|
|
8
8
|
position: relative;
|
|
9
9
|
&:not([hidden]) {
|
|
@@ -13,7 +13,7 @@ export function switchBaseStyles(): FlattenSimpleInterpolation {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/* Input */
|
|
16
|
-
export function switchInputStyles():
|
|
16
|
+
export function switchInputStyles(): ReturnType<typeof css> {
|
|
17
17
|
// Visually hide the input element while keeping it interactive
|
|
18
18
|
return css`
|
|
19
19
|
position: absolute;
|
|
@@ -34,7 +34,7 @@ export function switchInputStyles(): FlattenSimpleInterpolation {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/* Representation */
|
|
37
|
-
export function switchRepresentationStyles(props: ThemeProps):
|
|
37
|
+
export function switchRepresentationStyles(props: ThemeProps): ReturnType<typeof css> {
|
|
38
38
|
const {theme} = props
|
|
39
39
|
const {focusRing, input} = theme.sanity
|
|
40
40
|
const color = theme.sanity.color.button.default
|
|
@@ -102,7 +102,7 @@ export function switchRepresentationStyles(props: ThemeProps): FlattenSimpleInte
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/* Track */
|
|
105
|
-
export function switchTrackStyles(props: ThemeProps):
|
|
105
|
+
export function switchTrackStyles(props: ThemeProps): ReturnType<typeof css> {
|
|
106
106
|
const {theme} = props
|
|
107
107
|
const {input} = theme.sanity
|
|
108
108
|
|
|
@@ -123,7 +123,7 @@ export function switchTrackStyles(props: ThemeProps): FlattenSimpleInterpolation
|
|
|
123
123
|
/* Thumb */
|
|
124
124
|
export function switchThumbStyles(
|
|
125
125
|
props: {$checked?: boolean; $indeterminate?: boolean} & ThemeProps,
|
|
126
|
-
):
|
|
126
|
+
): ReturnType<typeof css> {
|
|
127
127
|
const {$indeterminate, theme} = props
|
|
128
128
|
const {input} = theme.sanity
|
|
129
129
|
const trackWidth = input.switch.width
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from 'styled-components'
|
|
2
2
|
import {ThemeProps} from '../../styles'
|
|
3
3
|
|
|
4
4
|
export function textBaseStyle(
|
|
5
5
|
props: {$accent?: boolean; $muted?: boolean} & ThemeProps,
|
|
6
|
-
):
|
|
6
|
+
): ReturnType<typeof css> {
|
|
7
7
|
const {$accent, $muted, theme} = props
|
|
8
8
|
const {weights} = theme.sanity.fonts.text
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {CSSObject} from 'styled-components'
|
|
2
1
|
import {EMPTY_ARRAY} from '../../constants'
|
|
2
|
+
import {CSSObject} from '../../types/styled'
|
|
3
3
|
import {_responsive} from '../helpers'
|
|
4
4
|
import {ThemeProps} from '../types'
|
|
5
5
|
import {ResponsiveFlexItemStyleProps} from './types'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {CSSObject} from 'styled-components'
|
|
2
1
|
import {ThemeFontSize, ThemeFontKey} from '../../theme'
|
|
2
|
+
import {CSSObject} from '../../types/styled'
|
|
3
3
|
import {rem, _responsive} from '../helpers'
|
|
4
4
|
import {ThemeProps} from '../types'
|
|
5
5
|
import {ResponsiveFontStyleProps} from './types'
|