@sanity/ui 3.0.0-static.25 → 3.0.0-static.27
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/_chunks-cjs/_visual-editing.cjs +197 -197
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +199 -199
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_visual-editing.d.cts +1 -0
- package/dist/_visual-editing.d.ts +1 -0
- package/dist/css.cjs +1 -1
- package/dist/css.d.cts +1 -1
- package/dist/css.d.ts +1 -1
- package/dist/css.js +1 -1
- package/dist/index.cjs +141 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +143 -143
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +2605 -1075
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +2689 -1159
- package/dist/theme.js.map +1 -1
- package/dist/ui.css +1 -1
- package/exports/_visual-editing.ts +1 -1
- package/package.json +13 -26
- package/src/core/components/dialog/dialog.tsx +2 -9
- package/src/core/components/dialog/dialogCard.tsx +2 -1
- package/src/core/components/index.ts +1 -0
- package/src/core/components/menu/menu.tsx +1 -2
- package/src/core/components/toast/toastLayer.tsx +1 -2
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/{utils → components}/virtualList/__workshop__/index.ts +1 -1
- package/src/core/primitives/badge/badge.tsx +2 -1
- package/src/core/primitives/index.ts +3 -0
- package/src/core/{utils → primitives}/layer/__workshop__/index.ts +1 -1
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +1 -0
- package/src/core/primitives/popover/popover.tsx +2 -1
- package/src/core/primitives/popover/popoverLayer.tsx +2 -1
- package/src/core/primitives/stack/stack.tsx +1 -0
- package/src/core/primitives/switch/switch.tsx +1 -1
- package/src/core/primitives/tooltip/tooltip.tsx +2 -1
- package/src/core/primitives/tooltip/tooltipLayer.tsx +2 -1
- package/src/core/utils/getElementRef.ts +1 -0
- package/src/core/utils/index.ts +0 -4
- package/src/css/primitives/avatar/avatar.css.ts +21 -4
- package/src/css/primitives/badge/badge.css.ts +2 -1
- package/src/css/primitives/label/label.css.ts +1 -0
- package/src/css/props/textOverflow/textOverflow.css.ts +2 -0
- package/src/css/props/width/types.ts +1 -1
- package/src/css/props/width/width.css.ts +3 -0
- package/src/theme/v2/build/buildTheme.test.ts +8 -8
- package/src/theme/v2/build/buildTheme.ts +32 -7
- /package/src/core/{utils → components}/virtualList/__workshop__/changingProps.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/elementScroll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/infiniteList.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/windowScrolll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/index.ts +0 -0
- /package/src/core/{utils → components}/virtualList/virtualList.tsx +0 -0
- /package/src/core/{utils → primitives}/arrow/arrow.tsx +0 -0
- /package/src/core/{utils → primitives}/arrow/cmds.ts +0 -0
- /package/src/core/{utils → primitives}/arrow/index.ts +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/_debug.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/multipleRoots.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/nested.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/responsiveZOffset.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.test.ts +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/index.ts +0 -0
- /package/src/core/{utils → primitives}/layer/layer.test.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/layer.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/layerCard.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/layerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/layerProvider.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/types.ts +0 -0
- /package/src/core/{utils → primitives}/layer/useLayer.ts +0 -0
- /package/src/core/{utils → primitives}/srOnly/index.ts +0 -0
- /package/src/core/{utils → primitives}/srOnly/srOnly.tsx +0 -0
|
@@ -18,6 +18,7 @@ export {Button, type ButtonProps} from '../src/core/primitives/button/button'
|
|
|
18
18
|
export {Card, type CardProps} from '../src/core/primitives/card/card'
|
|
19
19
|
export {Flex, type FlexProps} from '../src/core/primitives/flex/flex'
|
|
20
20
|
export {Grid, type GridProps} from '../src/core/primitives/grid/grid'
|
|
21
|
+
export {LayerProvider} from '../src/core/primitives/layer/layerProvider'
|
|
21
22
|
export {Popover, type PopoverProps} from '../src/core/primitives/popover/popover'
|
|
22
23
|
export {Spinner, type SpinnerProps} from '../src/core/primitives/spinner/spinner'
|
|
23
24
|
export {Stack, type StackProps} from '../src/core/primitives/stack/stack'
|
|
@@ -25,6 +26,5 @@ export {Text, type TextProps} from '../src/core/primitives/text/text'
|
|
|
25
26
|
export {TextInput, type TextInputProps} from '../src/core/primitives/textInput/textInput'
|
|
26
27
|
export {Tooltip, type TooltipProps} from '../src/core/primitives/tooltip/tooltip'
|
|
27
28
|
export type {PopoverMargins} from '../src/core/types/popover'
|
|
28
|
-
export {LayerProvider} from '../src/core/utils/layer/layerProvider'
|
|
29
29
|
export {Portal, type PortalProps} from '../src/core/utils/portal/portal'
|
|
30
30
|
export {PortalProvider, type PortalProviderProps} from '../src/core/utils/portal/portalProvider'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "3.0.0-static.
|
|
3
|
+
"version": "3.0.0-static.27",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react",
|
|
6
6
|
"ui",
|
|
@@ -120,28 +120,14 @@
|
|
|
120
120
|
"@babel/preset-env": "^7.27.1",
|
|
121
121
|
"@babel/preset-react": "^7.27.1",
|
|
122
122
|
"@babel/preset-typescript": "^7.27.1",
|
|
123
|
-
"@commitlint/cli": "
|
|
124
|
-
"@commitlint/config-conventional": "
|
|
123
|
+
"@commitlint/cli": "19.5.0",
|
|
124
|
+
"@commitlint/config-conventional": "19.5.0",
|
|
125
125
|
"@eslint/js": "^9.26.0",
|
|
126
126
|
"@sanity/browserslist-config": "^1.0.5",
|
|
127
127
|
"@sanity/pkg-utils": "^7.2.2",
|
|
128
128
|
"@sanity/prettier-config": "^1.0.3",
|
|
129
129
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
130
|
-
"@sanity/ui-workshop": "^2.1.
|
|
131
|
-
"@storybook/addon-a11y": "^8.6.14",
|
|
132
|
-
"@storybook/addon-docs": "^8.6.14",
|
|
133
|
-
"@storybook/addon-essentials": "^8.6.12",
|
|
134
|
-
"@storybook/addon-interactions": "^8.6.12",
|
|
135
|
-
"@storybook/addon-links": "^8.6.14",
|
|
136
|
-
"@storybook/addon-mdx-gfm": "^8.6.12",
|
|
137
|
-
"@storybook/addon-storysource": "^8.6.12",
|
|
138
|
-
"@storybook/addon-themes": "^8.6.14",
|
|
139
|
-
"@storybook/blocks": "^8.6.12",
|
|
140
|
-
"@storybook/manager-api": "^8.6.12",
|
|
141
|
-
"@storybook/react": "^8.6.14",
|
|
142
|
-
"@storybook/react-vite": "^8.6.14",
|
|
143
|
-
"@storybook/test": "^8.6.12",
|
|
144
|
-
"@storybook/theming": "^8.6.12",
|
|
130
|
+
"@sanity/ui-workshop": "^2.1.3",
|
|
145
131
|
"@testing-library/dom": "^10.4.0",
|
|
146
132
|
"@testing-library/jest-dom": "^6.6.3",
|
|
147
133
|
"@testing-library/react": "^16.3.0",
|
|
@@ -152,6 +138,7 @@
|
|
|
152
138
|
"@types/react-is": "^19.0.0",
|
|
153
139
|
"@types/refractor": "^3.4.1",
|
|
154
140
|
"@vanilla-extract/rollup-plugin": "^1.3.15",
|
|
141
|
+
"@vanilla-extract/vite-plugin": "^5.0.3",
|
|
155
142
|
"@vitejs/plugin-react": "^4.4.1",
|
|
156
143
|
"@vitest/browser": "^3.1.4",
|
|
157
144
|
"autoprefixer": "^10.4.21",
|
|
@@ -174,7 +161,7 @@
|
|
|
174
161
|
"eslint-plugin-react-hooks": "0.0.0-experimental-4448b187-20250515",
|
|
175
162
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
176
163
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
177
|
-
"eslint-plugin-storybook": "^0.
|
|
164
|
+
"eslint-plugin-storybook": "^9.0.5",
|
|
178
165
|
"globals": "^16.0.0",
|
|
179
166
|
"http-server": "^14.1.1",
|
|
180
167
|
"husky": "^8.0.3",
|
|
@@ -190,16 +177,15 @@
|
|
|
190
177
|
"react-is": "^19.1.0",
|
|
191
178
|
"refractor": "^4.9.0",
|
|
192
179
|
"rimraf": "^5.0.10",
|
|
193
|
-
"semantic-release": "
|
|
180
|
+
"semantic-release": "23.1.1",
|
|
194
181
|
"start-server-and-test": "^2.0.11",
|
|
195
|
-
"storybook": "^8.6.14",
|
|
196
182
|
"styled-components": "^6.1.17",
|
|
197
183
|
"tsconfig-paths": "^4.2.0",
|
|
198
184
|
"typescript": "5.8.3",
|
|
199
185
|
"typescript-eslint": "^8.32.0",
|
|
200
|
-
"vite": "^
|
|
186
|
+
"vite": "^6.3.5",
|
|
201
187
|
"vite-tsconfig-paths": "^5.1.4",
|
|
202
|
-
"vitest": "^3.
|
|
188
|
+
"vitest": "^3.2.2",
|
|
203
189
|
"vitest-axe": "1.0.0-pre.5"
|
|
204
190
|
},
|
|
205
191
|
"peerDependencies": {
|
|
@@ -226,14 +212,15 @@
|
|
|
226
212
|
"cypress:open": "cypress open",
|
|
227
213
|
"cypress:run": "cypress run",
|
|
228
214
|
"dev": "run-p workshop:clean workshop:dev",
|
|
229
|
-
"figma:
|
|
215
|
+
"figma:build": "pnpm run --filter 'figma-plugin-sanity-ui' build",
|
|
230
216
|
"format": "prettier --write --cache --ignore-unknown .",
|
|
231
217
|
"lint": "eslint .",
|
|
232
218
|
"pkg:build": "mkdirp dist && touch dist/ui.css && pkg build --strict",
|
|
233
219
|
"pkg:check": "pkg --strict",
|
|
220
|
+
"pkg:watch": "mkdirp dist && touch dist/ui.css && pkg watch --strict",
|
|
234
221
|
"release": "semantic-release",
|
|
235
|
-
"storybook:build": "storybook build",
|
|
236
|
-
"storybook:dev": "
|
|
222
|
+
"storybook:build": "pnpm run --filter 'sanity-ui-storybook' build",
|
|
223
|
+
"storybook:dev": "pnpm run --filter 'sanity-ui-storybook' dev",
|
|
237
224
|
"test": "vitest run",
|
|
238
225
|
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
239
226
|
"typecheck": "tsc",
|
|
@@ -10,16 +10,9 @@ import {type FocusEvent, type ForwardedRef, type ReactNode, useCallback, useRef}
|
|
|
10
10
|
import {Z_OFFSETS} from '../../constants'
|
|
11
11
|
import {focusFirstDescendant, focusLastDescendant, isHTMLElement} from '../../helpers'
|
|
12
12
|
import {usePrefersReducedMotion, useResponsiveProp} from '../../hooks'
|
|
13
|
-
import {Container} from '../../primitives'
|
|
13
|
+
import {Container, Layer, type LayerOwnProps, type LayerProps} from '../../primitives'
|
|
14
14
|
import type {CardTone, ComponentType, DialogPosition, Props, Radius} from '../../types'
|
|
15
|
-
import {
|
|
16
|
-
Layer,
|
|
17
|
-
type LayerOwnProps,
|
|
18
|
-
type LayerProps,
|
|
19
|
-
Portal,
|
|
20
|
-
useBoundaryElement,
|
|
21
|
-
usePortal,
|
|
22
|
-
} from '../../utils'
|
|
15
|
+
import {Portal, useBoundaryElement, usePortal} from '../../utils'
|
|
23
16
|
import {DialogCard} from './dialogCard'
|
|
24
17
|
import {isTargetWithinScope} from './isTargetWithinScope'
|
|
25
18
|
import {useDialog} from './useDialog'
|
|
@@ -19,9 +19,10 @@ import {
|
|
|
19
19
|
type CardOwnProps,
|
|
20
20
|
Flex,
|
|
21
21
|
Text,
|
|
22
|
+
useLayer,
|
|
22
23
|
} from '../../primitives'
|
|
23
24
|
import type {Props} from '../../types'
|
|
24
|
-
import {useBoundaryElement,
|
|
25
|
+
import {useBoundaryElement, usePortal} from '../../utils'
|
|
25
26
|
import {isTargetWithinScope} from './isTargetWithinScope'
|
|
26
27
|
|
|
27
28
|
/** @internal */
|
|
@@ -3,9 +3,8 @@ import type {Space} from '@sanity/ui/theme'
|
|
|
3
3
|
import {useCallback, useEffect, useImperativeHandle, useMemo, useRef} from 'react'
|
|
4
4
|
|
|
5
5
|
import {useClickOutsideEvent, useGlobalKeyDown} from '../../hooks'
|
|
6
|
-
import {Box, Stack} from '../../primitives'
|
|
6
|
+
import {Box, Stack, useLayer} from '../../primitives'
|
|
7
7
|
import type {ComponentType, Props} from '../../types'
|
|
8
|
-
import {useLayer} from '../../utils'
|
|
9
8
|
import {MenuContext, type MenuContextValue} from './menuContext'
|
|
10
9
|
import {useMenuController} from './useMenuController'
|
|
11
10
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {type GapStyleProps, type PaddingStyleProps, toastLayer} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
|
-
import {Grid} from '../../primitives
|
|
3
|
+
import {Grid, useLayer} from '../../primitives'
|
|
4
4
|
import type {ComponentType, Props} from '../../types'
|
|
5
|
-
import {useLayer} from '../../utils'
|
|
6
5
|
|
|
7
6
|
/** @internal */
|
|
8
7
|
export const DEFAULT_TOAST_LAYER_ELEMENT = 'ul'
|
|
@@ -3,7 +3,7 @@ import {AnimatePresence} from 'framer-motion'
|
|
|
3
3
|
import {startTransition, useMemo, useState} from 'react'
|
|
4
4
|
|
|
5
5
|
import {useMounted} from '../../hooks/useMounted'
|
|
6
|
-
import {LayerProvider} from '../../
|
|
6
|
+
import {LayerProvider} from '../../primitives'
|
|
7
7
|
import {Toast} from './toast'
|
|
8
8
|
import {ToastContext} from './toastContext'
|
|
9
9
|
import {ToastLayer, type ToastLayerProps} from './toastLayer'
|
|
@@ -47,10 +47,11 @@ export function Badge<E extends BadgeElementType = typeof DEFAULT_BADGE_ELEMENT>
|
|
|
47
47
|
{...rest}
|
|
48
48
|
as={as}
|
|
49
49
|
className={badge({className, tone})}
|
|
50
|
-
display="
|
|
50
|
+
display="flex"
|
|
51
51
|
maxWidth="fill"
|
|
52
52
|
padding={padding}
|
|
53
53
|
radius={radius}
|
|
54
|
+
width="min"
|
|
54
55
|
>
|
|
55
56
|
<Text size={fontSize}>{children}</Text>
|
|
56
57
|
</Box>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './arrow'
|
|
1
2
|
export * from './avatar'
|
|
2
3
|
export * from './badge'
|
|
3
4
|
export * from './box'
|
|
@@ -12,10 +13,12 @@ export * from './heading'
|
|
|
12
13
|
export * from './inline'
|
|
13
14
|
export * from './kbd'
|
|
14
15
|
export * from './label'
|
|
16
|
+
export * from './layer'
|
|
15
17
|
export * from './popover'
|
|
16
18
|
export * from './radio'
|
|
17
19
|
export * from './select'
|
|
18
20
|
export * from './spinner'
|
|
21
|
+
export * from './srOnly'
|
|
19
22
|
export * from './stack'
|
|
20
23
|
export * from './switch'
|
|
21
24
|
export * from './text'
|
|
@@ -2,6 +2,7 @@ import {useSelect} from '@sanity/ui-workshop'
|
|
|
2
2
|
import {useCallback, useEffect, useRef, useState} from 'react'
|
|
3
3
|
|
|
4
4
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '$workshop'
|
|
5
|
+
|
|
5
6
|
import type {CardTone} from '../../../types'
|
|
6
7
|
import {BoundaryElementProvider} from '../../../utils'
|
|
7
8
|
import {Box} from '../../box'
|
|
@@ -28,8 +28,9 @@ import {Z_OFFSETS} from '../../constants'
|
|
|
28
28
|
import {usePrefersReducedMotion, useResponsiveProp} from '../../hooks'
|
|
29
29
|
import {origin} from '../../middleware/origin'
|
|
30
30
|
import type {ComponentType, Placement, PopoverMargins, Props} from '../../types'
|
|
31
|
-
import {
|
|
31
|
+
import {Portal, useBoundaryElement} from '../../utils'
|
|
32
32
|
import {CardProvider, useCard} from '../card'
|
|
33
|
+
import {type LayerOwnProps, useLayer} from '../layer'
|
|
33
34
|
import {
|
|
34
35
|
DEFAULT_FALLBACK_PLACEMENTS,
|
|
35
36
|
DEFAULT_POPOVER_DISTANCE,
|
|
@@ -5,8 +5,9 @@ import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
|
|
|
5
5
|
|
|
6
6
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
7
7
|
import type {Placement, PopoverMargins} from '../../types'
|
|
8
|
-
import {Arrow
|
|
8
|
+
import {Arrow} from '../arrow'
|
|
9
9
|
import {Flex} from '../flex'
|
|
10
|
+
import {Layer, type LayerOwnProps, type LayerProps} from '../layer'
|
|
10
11
|
import {
|
|
11
12
|
DEFAULT_POPOVER_ARROW_HEIGHT,
|
|
12
13
|
DEFAULT_POPOVER_ARROW_RADIUS,
|
|
@@ -66,7 +66,7 @@ export function Switch<E extends SwitchElementType = typeof DEFAULT_SWITCH_ELEME
|
|
|
66
66
|
data-checked={checked ? '' : undefined}
|
|
67
67
|
data-indeterminate={indeterminate ? '' : undefined}
|
|
68
68
|
data-ui="Switch"
|
|
69
|
-
display="
|
|
69
|
+
display="block"
|
|
70
70
|
position="relative"
|
|
71
71
|
style={style}
|
|
72
72
|
>
|
|
@@ -35,9 +35,10 @@ import {usePrefersReducedMotion} from '../../hooks'
|
|
|
35
35
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
36
36
|
import {origin} from '../../middleware/origin'
|
|
37
37
|
import type {ComponentType, Placement, Props} from '../../types'
|
|
38
|
-
import {
|
|
38
|
+
import {Portal, useBoundaryElement, usePortal} from '../../utils'
|
|
39
39
|
import {getElementRef} from '../../utils/getElementRef'
|
|
40
40
|
import {CardProvider, useCard} from '../card'
|
|
41
|
+
import type {LayerOwnProps} from '../layer'
|
|
41
42
|
import type {Delay} from '../types'
|
|
42
43
|
import {
|
|
43
44
|
DEFAULT_FALLBACK_PLACEMENTS,
|
|
@@ -3,7 +3,8 @@ import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
|
|
|
3
3
|
|
|
4
4
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
5
5
|
import type {Placement} from '../../types'
|
|
6
|
-
import {Arrow
|
|
6
|
+
import {Arrow} from '../arrow'
|
|
7
|
+
import {Layer, type LayerOwnProps, type LayerProps} from '../layer'
|
|
7
8
|
import {
|
|
8
9
|
DEFAULT_TOOLTIP_ARROW_HEIGHT,
|
|
9
10
|
DEFAULT_TOOLTIP_ARROW_RADIUS,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @internal */
|
|
1
2
|
// Based on https://github.com/radix-ui/primitives/blob/0bade6a704e5821b90a6da0f3d8cfa8a7711127d/packages/react/slot/src/Slot.tsx#L128-L150
|
|
2
3
|
// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`
|
|
3
4
|
// After React 19 accessing `element.ref` does the opposite.
|
package/src/core/utils/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {AVATAR_COLORS, AVATAR_SIZE, type AvatarSize} from '@sanity/ui/theme'
|
|
2
|
+
import {globalStyle} from '@vanilla-extract/css'
|
|
2
3
|
|
|
3
4
|
import {_fromEntries} from '../../_fromEntries'
|
|
4
5
|
import {_responsiveStyle} from '../../_responsiveStyle.css'
|
|
@@ -10,6 +11,7 @@ import {vars} from '../../vars.css'
|
|
|
10
11
|
export const stack = _style(layers.primitives, {})
|
|
11
12
|
|
|
12
13
|
export const root = _style(layers.primitives, {
|
|
14
|
+
// display: 'block',
|
|
13
15
|
backgroundColor: vars.color.avatar.bg,
|
|
14
16
|
position: 'relative',
|
|
15
17
|
boxSizing: 'border-box',
|
|
@@ -25,6 +27,10 @@ export const root = _style(layers.primitives, {
|
|
|
25
27
|
},
|
|
26
28
|
|
|
27
29
|
selectors: {
|
|
30
|
+
'&:not([hidden])': {
|
|
31
|
+
display: 'block',
|
|
32
|
+
},
|
|
33
|
+
|
|
28
34
|
[`${stack} > & + &`]: {
|
|
29
35
|
marginLeft: vars.avatar.distance,
|
|
30
36
|
},
|
|
@@ -113,11 +119,12 @@ export const arrowSvg = _style(layers.primitives, {
|
|
|
113
119
|
})
|
|
114
120
|
|
|
115
121
|
export const image = _style(layers.primitives, {
|
|
116
|
-
display: 'block',
|
|
117
122
|
position: 'absolute',
|
|
123
|
+
top: 0,
|
|
124
|
+
left: 0,
|
|
118
125
|
width: vars.avatar.size,
|
|
119
126
|
height: vars.avatar.size,
|
|
120
|
-
borderRadius:
|
|
127
|
+
borderRadius: 'inherit',
|
|
121
128
|
|
|
122
129
|
selectors: {
|
|
123
130
|
'[data-image-error] &': {
|
|
@@ -126,12 +133,22 @@ export const image = _style(layers.primitives, {
|
|
|
126
133
|
},
|
|
127
134
|
})
|
|
128
135
|
|
|
136
|
+
globalStyle(`${image} img`, {
|
|
137
|
+
display: 'block',
|
|
138
|
+
width: '100%',
|
|
139
|
+
height: '100%',
|
|
140
|
+
objectFit: 'cover',
|
|
141
|
+
borderRadius: 'inherit',
|
|
142
|
+
})
|
|
143
|
+
|
|
129
144
|
export const imageOutline = _style(layers.primitives, {
|
|
130
145
|
display: 'block',
|
|
131
146
|
position: 'absolute',
|
|
147
|
+
top: 0,
|
|
148
|
+
left: 0,
|
|
132
149
|
width: vars.avatar.size,
|
|
133
150
|
height: vars.avatar.size,
|
|
134
|
-
borderRadius:
|
|
151
|
+
borderRadius: 'inherit',
|
|
135
152
|
boxShadow: [
|
|
136
153
|
`inset 0 0 0 1px ${vars.color.avatar.bg}`,
|
|
137
154
|
`inset 0 0 0 1.75px ${vars.color.bg}`,
|
|
@@ -140,7 +157,7 @@ export const imageOutline = _style(layers.primitives, {
|
|
|
140
157
|
|
|
141
158
|
export const initials = _style(layers.primitives, {
|
|
142
159
|
color: vars.color.avatar.fg,
|
|
143
|
-
borderRadius:
|
|
160
|
+
borderRadius: 'inherit',
|
|
144
161
|
})
|
|
145
162
|
|
|
146
163
|
export const counter = _style(layers.primitives, {
|
|
@@ -8,7 +8,7 @@ import {vars} from '../../vars.css'
|
|
|
8
8
|
export const root = _style(layers.primitives, {
|
|
9
9
|
backgroundColor: vars.color.bg,
|
|
10
10
|
color: vars.color.fg,
|
|
11
|
-
|
|
11
|
+
whiteSpace: 'nowrap',
|
|
12
12
|
})
|
|
13
13
|
|
|
14
14
|
export const tones = {
|
|
@@ -18,6 +18,7 @@ export const tones = {
|
|
|
18
18
|
_style(layers.primitives, {
|
|
19
19
|
vars: {
|
|
20
20
|
[vars.color.bg]: vars.color.tinted[t].bg[2],
|
|
21
|
+
[vars.color.border]: vars.color.tinted[t].border[2],
|
|
21
22
|
[vars.color.fg]: vars.color.tinted[t].fg[3],
|
|
22
23
|
},
|
|
23
24
|
}),
|
|
@@ -5,11 +5,13 @@ import type {TextOverflow} from './types'
|
|
|
5
5
|
|
|
6
6
|
export const options: ResponsiveRuleOptions<TextOverflow> = {
|
|
7
7
|
clip: _responsiveStyle(layers.props, {
|
|
8
|
+
display: 'block',
|
|
8
9
|
overflow: 'clip',
|
|
9
10
|
textOverflow: 'clip',
|
|
10
11
|
whiteSpace: 'nowrap',
|
|
11
12
|
}),
|
|
12
13
|
ellipsis: _responsiveStyle(layers.props, {
|
|
14
|
+
display: 'block',
|
|
13
15
|
overflow: 'clip',
|
|
14
16
|
textOverflow: 'ellipsis',
|
|
15
17
|
whiteSpace: 'nowrap',
|
|
@@ -3,7 +3,7 @@ import type {ContainerWidth} from '@sanity/ui/theme'
|
|
|
3
3
|
import type {ResponsiveProp} from '../../types'
|
|
4
4
|
|
|
5
5
|
/** @public */
|
|
6
|
-
export type Width = ContainerWidth | 'auto' | 'fill' | 'stretch'
|
|
6
|
+
export type Width = ContainerWidth | 'auto' | 'fill' | 'stretch' | 'min'
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export interface WidthStyleProps {
|
|
@@ -14,6 +14,9 @@ export const options: ResponsiveRuleOptions<Width> = {
|
|
|
14
14
|
fill: _responsiveStyle(layers.props, {
|
|
15
15
|
width: '100%',
|
|
16
16
|
}),
|
|
17
|
+
min: _responsiveStyle(layers.props, {
|
|
18
|
+
width: 'min-content',
|
|
19
|
+
}),
|
|
17
20
|
stretch: _responsiveStyle(layers.props, {
|
|
18
21
|
width: 'stretch',
|
|
19
22
|
}),
|
|
@@ -59,31 +59,31 @@ test('build theme', () => {
|
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
}).toEqual({
|
|
62
|
-
|
|
63
|
-
bg: '
|
|
62
|
+
light: {
|
|
63
|
+
bg: 'rgba(255,255,255,0)',
|
|
64
|
+
fg: '#000000',
|
|
64
65
|
default: {
|
|
65
66
|
button: {
|
|
66
67
|
ghost: {
|
|
67
68
|
enabled: {
|
|
68
|
-
border: '
|
|
69
|
+
border: 'rgba(246,246,248,0)',
|
|
69
70
|
},
|
|
70
71
|
},
|
|
71
72
|
},
|
|
72
73
|
},
|
|
73
|
-
fg: '#ffffff',
|
|
74
74
|
},
|
|
75
|
-
|
|
76
|
-
bg: '
|
|
75
|
+
dark: {
|
|
76
|
+
bg: 'rgba(0,0,0,0)',
|
|
77
|
+
fg: '#ffffff',
|
|
77
78
|
default: {
|
|
78
79
|
button: {
|
|
79
80
|
ghost: {
|
|
80
81
|
enabled: {
|
|
81
|
-
border: '
|
|
82
|
+
border: 'rgba(19,20,27,0)',
|
|
82
83
|
},
|
|
83
84
|
},
|
|
84
85
|
},
|
|
85
86
|
},
|
|
86
|
-
fg: '#000000',
|
|
87
87
|
},
|
|
88
88
|
})
|
|
89
89
|
})
|
|
@@ -1,12 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {buildTheme_v3} from '../../v3'
|
|
1
|
+
import type {RootTheme} from '../../types'
|
|
3
2
|
import {v2_v0} from '../../versioning/v2_v0'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import type {ThemeConfig} from '../config'
|
|
4
|
+
import {defaultThemeConfig} from '../defaults/config'
|
|
5
|
+
import {defaultThemeFonts} from '../defaults/fonts'
|
|
6
|
+
import type {RootTheme_v2} from '../theme'
|
|
7
|
+
import {buildColorTheme} from './buildColorTheme'
|
|
8
|
+
import {renderThemeColorSchemes} from './renderColorTheme'
|
|
6
9
|
|
|
7
10
|
/** @internal */
|
|
8
|
-
export function buildTheme(
|
|
9
|
-
const
|
|
11
|
+
export function buildTheme(config?: ThemeConfig): RootTheme {
|
|
12
|
+
const colorTheme = buildColorTheme(config)
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
const v2: RootTheme_v2 = {
|
|
15
|
+
_version: 2,
|
|
16
|
+
avatar: config?.avatar ?? defaultThemeConfig.avatar,
|
|
17
|
+
button: config?.button ?? defaultThemeConfig.button,
|
|
18
|
+
card: config?.card ?? defaultThemeConfig.card,
|
|
19
|
+
// How colors are generated:
|
|
20
|
+
// 1. Merge custom tokens with default tokens
|
|
21
|
+
// 2. Generate tree of color keys (gray/500, black, white, etc.)
|
|
22
|
+
// 3. Apply mixing and render to hex values
|
|
23
|
+
// render(build(mergeWithDefaults()))
|
|
24
|
+
color: renderThemeColorSchemes(colorTheme, config),
|
|
25
|
+
container: config?.container ?? defaultThemeConfig.container,
|
|
26
|
+
font: config?.font ?? defaultThemeFonts,
|
|
27
|
+
input: config?.input ?? defaultThemeConfig.input,
|
|
28
|
+
layer: config?.layer ?? defaultThemeConfig.layer,
|
|
29
|
+
media: config?.media ?? defaultThemeConfig.media,
|
|
30
|
+
radius: config?.radius ?? defaultThemeConfig.radius,
|
|
31
|
+
shadow: config?.shadow ?? defaultThemeConfig.shadow,
|
|
32
|
+
space: config?.space ?? defaultThemeConfig.space,
|
|
33
|
+
style: config?.style ?? defaultThemeConfig.style,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return v2_v0(v2)
|
|
12
37
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|