@sanity/ui 3.0.0-static.0 → 3.0.0-static.1

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.
Files changed (216) hide show
  1. package/dist/_chunks-cjs/buildCommand.js +1387 -681
  2. package/dist/_chunks-cjs/buildCommand.js.map +1 -1
  3. package/dist/cli.js +4 -2
  4. package/dist/cli.js.map +1 -1
  5. package/dist/css.d.mts +131 -12
  6. package/dist/css.d.ts +131 -12
  7. package/dist/css.esm.js +1450 -791
  8. package/dist/css.esm.js.map +1 -1
  9. package/dist/css.js +1449 -790
  10. package/dist/css.js.map +1 -1
  11. package/dist/css.mjs +1450 -791
  12. package/dist/css.mjs.map +1 -1
  13. package/dist/index.d.mts +84 -76
  14. package/dist/index.d.ts +84 -76
  15. package/dist/index.esm.js +2734 -3146
  16. package/dist/index.esm.js.map +1 -1
  17. package/dist/index.js +2733 -3145
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +2734 -3146
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/sanity-theme.css +1 -1
  22. package/dist/system.css +1590 -1158
  23. package/dist/theme.esm.js +1565 -452
  24. package/dist/theme.esm.js.map +1 -1
  25. package/dist/theme.js +1599 -484
  26. package/dist/theme.js.map +1 -1
  27. package/dist/theme.mjs +1565 -452
  28. package/dist/theme.mjs.map +1 -1
  29. package/package.json +22 -22
  30. package/src/core/__workshop__/constants.ts +14 -5
  31. package/src/core/__workshop__/fontsPlugin.tsx +1 -1
  32. package/src/core/_compat/index.ts +2 -0
  33. package/src/core/{styles → _compat/styles}/box/boxStyle.ts +1 -1
  34. package/src/core/{styles → _compat/styles}/box/types.ts +1 -1
  35. package/src/core/{styles → _compat/styles}/card/_cardColorStyle.ts +2 -2
  36. package/src/core/{styles → _compat/styles}/flex/flexItemStyle.ts +1 -1
  37. package/src/core/{styles → _compat/styles}/font/types.ts +1 -1
  38. package/src/core/{styles → _compat/styles}/grid/types.ts +1 -1
  39. package/src/core/{styles → _compat/styles}/helpers.ts +1 -1
  40. package/src/core/{styles → _compat/styles}/input/textInputStyle.ts +2 -2
  41. package/src/core/{styles → _compat/styles}/radius/types.ts +1 -1
  42. package/src/core/{styles → _compat/styles}/shadow/shadowStyle.ts +1 -1
  43. package/src/core/components/autocomplete/__workshop__/custom.tsx +5 -4
  44. package/src/core/components/autocomplete/__workshop__/example.tsx +3 -2
  45. package/src/core/components/autocomplete/autocomplete.tsx +5 -5
  46. package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
  47. package/src/core/components/dialog/__workshop__/props.tsx +2 -0
  48. package/src/core/components/dialog/dialog.tsx +1 -5
  49. package/src/core/components/hotkeys/hotkeys.tsx +1 -1
  50. package/src/core/components/menu/menu.tsx +8 -10
  51. package/src/core/components/menu/menuDivider.tsx +16 -0
  52. package/src/core/components/menu/menuGroup.tsx +2 -8
  53. package/src/core/components/menu/menuItem.tsx +1 -1
  54. package/src/core/components/skeleton/skeleton.tsx +14 -20
  55. package/src/core/components/skeleton/textSkeleton.tsx +72 -48
  56. package/src/core/components/tab/tab.tsx +0 -1
  57. package/src/core/components/tab/tabList.tsx +4 -21
  58. package/src/core/components/tab/tabPanel.tsx +1 -0
  59. package/src/core/components/toast/toast.tsx +27 -14
  60. package/src/core/components/toast/toastProvider.tsx +4 -13
  61. package/src/core/components/tree/tree.tsx +1 -2
  62. package/src/core/components/tree/treeGroup.tsx +4 -1
  63. package/src/core/components/tree/treeItem.tsx +11 -15
  64. package/src/core/hooks/useArrayProp.ts +1 -1
  65. package/src/core/index.ts +0 -1
  66. package/src/core/lib/styled/members.ts +2 -2
  67. package/src/core/primitives/avatar/avatar.tsx +0 -21
  68. package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
  69. package/src/core/primitives/avatar/avatarStack.tsx +1 -1
  70. package/src/core/primitives/avatar/styles.ts +2 -2
  71. package/src/core/primitives/box/box.tsx +4 -1
  72. package/src/core/primitives/button/__workshop__/props.tsx +2 -1
  73. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
  74. package/src/core/primitives/button/__workshop__/stacked.tsx +2 -1
  75. package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
  76. package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
  77. package/src/core/primitives/button/styles.ts +3 -3
  78. package/src/core/primitives/card/__workshop__/props.tsx +2 -2
  79. package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
  80. package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
  81. package/src/core/primitives/card/card.tsx +7 -10
  82. package/src/core/primitives/code/code.tsx +2 -4
  83. package/src/core/primitives/container/styles.ts +1 -1
  84. package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
  85. package/src/core/primitives/flex/flex.tsx +1 -13
  86. package/src/core/primitives/grid/grid.tsx +5 -19
  87. package/src/core/primitives/heading/heading.tsx +8 -25
  88. package/src/core/primitives/heading/styles.ts +1 -1
  89. package/src/core/primitives/inline/inline.tsx +3 -12
  90. package/src/core/primitives/inline/styles.ts +1 -1
  91. package/src/core/primitives/label/label.tsx +4 -9
  92. package/src/core/primitives/label/styles.ts +1 -1
  93. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
  94. package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -1
  95. package/src/core/primitives/popover/popover.tsx +1 -1
  96. package/src/core/primitives/popover/popoverCard.tsx +1 -1
  97. package/src/core/primitives/radio/radio.tsx +1 -1
  98. package/src/core/primitives/radio/styles.ts +2 -2
  99. package/src/core/primitives/select/select.tsx +1 -1
  100. package/src/core/primitives/select/styles.ts +3 -3
  101. package/src/core/primitives/spinner/__workshop__/Props.tsx +2 -1
  102. package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +16 -0
  103. package/src/core/primitives/spinner/spinner.tsx +2 -2
  104. package/src/core/primitives/stack/styles.ts +1 -1
  105. package/src/core/primitives/switch/styles.ts +2 -2
  106. package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
  107. package/src/core/primitives/text/styles.ts +1 -1
  108. package/src/core/primitives/text/text.tsx +1 -4
  109. package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
  110. package/src/core/primitives/textArea/textArea.tsx +3 -3
  111. package/src/core/primitives/textInput/__workshop__/plain.tsx +3 -2
  112. package/src/core/primitives/textInput/textInput.tsx +16 -83
  113. package/src/core/primitives/tooltip/tooltipCard.tsx +5 -5
  114. package/src/core/primitives/types.ts +1 -0
  115. package/src/core/theme/__workshop__/build/Root.tsx +1 -1
  116. package/src/core/theme/__workshop__/build/story.tsx +2 -4
  117. package/src/core/theme/themeProvider.tsx +1 -1
  118. package/src/core/types/box.ts +22 -16
  119. package/src/core/types/grid.ts +17 -12
  120. package/src/core/types/text.ts +7 -4
  121. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
  122. package/src/core/utils/layer/layer.tsx +2 -2
  123. package/src/core/utils/virtualList/virtualList.tsx +1 -1
  124. package/src/css/compile/{comileRules.ts → compileRules.ts} +2 -5
  125. package/src/css/compile/compileSystem.ts +1 -1
  126. package/src/css/compile/compileTheme.ts +4 -1
  127. package/src/css/components/breadcrumbs/rules.ts +18 -0
  128. package/src/css/components/menu/index.ts +1 -0
  129. package/src/css/components/menu/menu.ts +5 -0
  130. package/src/css/components/menu/rules.ts +10 -0
  131. package/src/css/components/skeleton/index.ts +2 -0
  132. package/src/css/components/skeleton/rules.ts +106 -0
  133. package/src/css/components/skeleton/skeleton.ts +31 -0
  134. package/src/css/components/skeleton/types.ts +24 -0
  135. package/src/css/components/toast/rules.ts +68 -0
  136. package/src/css/components/tree/rules.ts +115 -0
  137. package/src/css/index.ts +4 -0
  138. package/src/css/primitives/box/box.ts +5 -1
  139. package/src/css/primitives/box/types.ts +7 -8
  140. package/src/css/primitives/card/rules.ts +161 -13
  141. package/src/css/primitives/checkbox/__styles.ts +115 -113
  142. package/src/css/primitives/selectable/__style.ts +117 -115
  143. package/src/css/primitives/spinner/rules.ts +5 -7
  144. package/src/css/primitives/spinner/spinner.ts +4 -0
  145. package/src/css/primitives/textInput/index.ts +1 -0
  146. package/src/css/primitives/textInput/rules.ts +159 -64
  147. package/src/css/primitives/textInput/textInput.ts +11 -3
  148. package/src/css/primitives/textInput/types.ts +8 -0
  149. package/src/css/rules.ts +16 -38
  150. package/src/css/styles/font/font.ts +7 -2
  151. package/src/css/styles/font/rules.ts +23 -0
  152. package/src/css/styles/font/types.ts +6 -0
  153. package/src/css/styles/gap/rules.ts +6 -6
  154. package/src/css/styles/grid/grid.ts +13 -0
  155. package/src/css/styles/grid/index.ts +2 -0
  156. package/src/css/styles/grid/rules.ts +112 -1
  157. package/src/css/styles/grid/types.ts +29 -0
  158. package/src/css/styles/margin/rules.ts +58 -54
  159. package/src/css/styles/outline/rules.ts +7 -0
  160. package/src/css/styles/overflow/index.ts +2 -0
  161. package/src/css/styles/overflow/overflow.ts +11 -0
  162. package/src/css/styles/overflow/types.ts +11 -0
  163. package/src/css/styles/padding/rules.ts +50 -48
  164. package/src/css/types.ts +36 -1
  165. package/src/css/varNames.ts +1 -1
  166. package/src/css/vars.ts +86 -0
  167. package/dist/_chunks-cjs/getTheme_v2.js +0 -316
  168. package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
  169. package/dist/_chunks-es/getTheme_v2.mjs +0 -317
  170. package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
  171. package/dist/_legacy/getTheme_v2.esm.js +0 -317
  172. package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
  173. package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -38
  174. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -17
  175. package/src/core/components/menu/menuDivider.ts +0 -13
  176. package/src/core/components/skeleton/styles.ts +0 -50
  177. package/src/core/components/toast/styles.ts +0 -61
  178. package/src/core/components/tree/style.ts +0 -104
  179. package/src/core/primitives/card/styles.ts +0 -146
  180. /package/src/core/{styles → _compat/styles}/border/borderStyle.ts +0 -0
  181. /package/src/core/{styles → _compat/styles}/border/index.ts +0 -0
  182. /package/src/core/{styles → _compat/styles}/border/types.ts +0 -0
  183. /package/src/core/{styles → _compat/styles}/box/index.ts +0 -0
  184. /package/src/core/{styles → _compat/styles}/card/index.ts +0 -0
  185. /package/src/core/{styles → _compat/styles}/flex/flexStyle.ts +0 -0
  186. /package/src/core/{styles → _compat/styles}/flex/index.ts +0 -0
  187. /package/src/core/{styles → _compat/styles}/flex/types.ts +0 -0
  188. /package/src/core/{styles → _compat/styles}/focusRing/index.ts +0 -0
  189. /package/src/core/{styles → _compat/styles}/font/codeFontStyle.ts +0 -0
  190. /package/src/core/{styles → _compat/styles}/font/headingFontStyle.ts +0 -0
  191. /package/src/core/{styles → _compat/styles}/font/index.ts +0 -0
  192. /package/src/core/{styles → _compat/styles}/font/labelFontStyle.ts +0 -0
  193. /package/src/core/{styles → _compat/styles}/font/responsiveFont.ts +0 -0
  194. /package/src/core/{styles → _compat/styles}/font/textAlignStyle.ts +0 -0
  195. /package/src/core/{styles → _compat/styles}/font/textFontStyle.ts +0 -0
  196. /package/src/core/{styles → _compat/styles}/grid/gridItemStyle.ts +0 -0
  197. /package/src/core/{styles → _compat/styles}/grid/gridStyle.ts +0 -0
  198. /package/src/core/{styles → _compat/styles}/grid/index.ts +0 -0
  199. /package/src/core/{styles → _compat/styles}/index.ts +0 -0
  200. /package/src/core/{styles → _compat/styles}/input/index.ts +0 -0
  201. /package/src/core/{styles → _compat/styles}/input/responsiveInputPaddingStyle.ts +0 -0
  202. /package/src/core/{styles → _compat/styles}/internal.ts +0 -0
  203. /package/src/core/{styles → _compat/styles}/margin/index.ts +0 -0
  204. /package/src/core/{styles → _compat/styles}/margin/marginStyle.ts +0 -0
  205. /package/src/core/{styles → _compat/styles}/margin/marginsStyle.test.ts +0 -0
  206. /package/src/core/{styles → _compat/styles}/margin/types.ts +0 -0
  207. /package/src/core/{styles → _compat/styles}/padding/index.ts +0 -0
  208. /package/src/core/{styles → _compat/styles}/padding/paddingStyle.test.ts +0 -0
  209. /package/src/core/{styles → _compat/styles}/padding/paddingStyle.ts +0 -0
  210. /package/src/core/{styles → _compat/styles}/padding/types.ts +0 -0
  211. /package/src/core/{styles → _compat/styles}/radius/index.ts +0 -0
  212. /package/src/core/{styles → _compat/styles}/radius/radiusStyle.ts +0 -0
  213. /package/src/core/{styles → _compat/styles}/shadow/index.ts +0 -0
  214. /package/src/core/{styles → _compat/styles}/shadow/types.ts +0 -0
  215. /package/src/core/{styles → _compat/styles}/types.ts +0 -0
  216. /package/src/core/{_compat.ts → _compat/types.ts} +0 -0
@@ -1,5 +1,6 @@
1
1
  import {icons, IconSymbol} from '@sanity/icons'
2
2
  import {Container, Flex, Stack, Text, TextInput} from '@sanity/ui'
3
+ import {FontTextSize, Radius} from '@sanity/ui/theme'
3
4
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
4
5
  import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop/plugin-perf'
5
6
  import {fireEvent} from '@testing-library/dom'
@@ -79,7 +80,7 @@ function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
79
80
  border={border}
80
81
  customValidity={customValidity}
81
82
  disabled={disabled}
82
- fontSize={fontSize}
83
+ fontSize={fontSize as FontTextSize}
83
84
  icon={icon && icons[icon]}
84
85
  iconRight={iconRight && icons[iconRight]}
85
86
  id="text-input-example"
@@ -87,7 +88,7 @@ function TextInputTest(props: {inputRef: React.Ref<HTMLInputElement>}) {
87
88
  onChange={handleChange}
88
89
  padding={padding}
89
90
  placeholder={placeholder}
90
- radius={radius}
91
+ radius={radius as Radius}
91
92
  readOnly={readOnly}
92
93
  ref={ref}
93
94
  space={space}
@@ -1,23 +1,17 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
- import {composeClassNames, RadiusStyleProps, ResponsiveProp, textInput} from '@sanity/ui/css'
2
+ import {
3
+ composeClassNames,
4
+ RadiusStyleProps,
5
+ ResponsiveProp,
6
+ textInput,
7
+ textInputElement,
8
+ } from '@sanity/ui/css'
3
9
  import {FontTextSize, Space, ThemeFontWeightKey} from '@sanity/ui/theme'
4
10
  import {forwardRef, isValidElement, useCallback, useImperativeHandle, useMemo, useRef} from 'react'
5
11
  import {isValidElementType} from 'react-is'
6
12
  import {EMPTY_RECORD} from '../../constants'
7
13
  import {useArrayProp, useCustomValidity} from '../../hooks'
8
14
  import {styled} from '../../lib/styled'
9
- // import {
10
- // // responsiveRadiusStyle,
11
- // // ResponsiveRadiusStyleProps,
12
- // responsiveInputPaddingStyle,
13
- // TextInputInputStyleProps,
14
- // // TextInputRepresentationStyleProps,
15
- // TextInputResponsivePaddingStyleProps,
16
- // textInputBaseStyle,
17
- // textInputFontSizeStyle,
18
- // // textInputRepresentationStyle,
19
- // // textInputRootStyle,
20
- // } from '../../styles/internal'
21
15
  import {useRootTheme} from '../../theme'
22
16
  import {Box} from '../box'
23
17
  import {Button, ButtonProps} from '../button'
@@ -68,11 +62,8 @@ export interface TextInputProps extends RadiusStyleProps {
68
62
  * @beta
69
63
  */
70
64
  onClear?: () => void
71
- padding: ResponsiveProp<Space>
72
- // padding?: number | number[]
65
+ padding?: ResponsiveProp<Space>
73
66
  prefix?: React.ReactNode
74
- // radius?: Radius | Radius[]
75
- // space?: number | number[]
76
67
  space?: ResponsiveProp<Space>
77
68
  suffix?: React.ReactNode
78
69
  type?: TextInputType
@@ -86,65 +77,6 @@ const CLEAR_BUTTON_BOX_STYLE: React.CSSProperties = {
86
77
  zIndex: 2,
87
78
  }
88
79
 
89
- // const Root = styled(Card).attrs({forwardedAs: 'span'})(textInputRootStyle)
90
-
91
- // const InputRoot = styled.span`
92
- // flex: 1;
93
- // min-width: 0;
94
- // display: block;
95
- // position: relative;
96
- // `
97
-
98
- // const Prefix = styled(Card).attrs({forwardedAs: 'span'})`
99
- // border-top-right-radius: 0;
100
- // border-bottom-right-radius: 0;
101
-
102
- // & > span {
103
- // display: block;
104
- // margin: -1px;
105
- // }
106
- // `
107
-
108
- // const Suffix = styled(Card).attrs({forwardedAs: 'span'})`
109
- // border-top-left-radius: 0;
110
- // border-bottom-left-radius: 0;
111
-
112
- // & > span {
113
- // display: block;
114
- // margin: -1px;
115
- // }
116
- // `
117
-
118
- // const Input = styled.input<TextInputResponsivePaddingStyleProps & TextInputInputStyleProps>(
119
- // responsiveInputPaddingStyle,
120
- // textInputBaseStyle,
121
- // textInputFontSizeStyle,
122
- // )
123
-
124
- // const Presentation = styled.span<ResponsiveRadiusStyleProps & TextInputRepresentationStyleProps>(
125
- // responsiveRadiusStyle,
126
- // textInputRepresentationStyle,
127
- // )
128
-
129
- // const LeftBox = styled(Box)`
130
- // position: absolute;
131
- // top: 0;
132
- // left: 0;
133
- // `
134
-
135
- // const RightBox = styled(Box)`
136
- // position: absolute;
137
- // top: 0;
138
- // right: 0;
139
- // `
140
-
141
- // const RightCard = styled(Card)`
142
- // background-color: transparent;
143
- // position: absolute;
144
- // top: 0;
145
- // right: 0;
146
- // `
147
-
148
80
  const TextInputClearButton = styled(Button)({
149
81
  '&:not([hidden])': {
150
82
  display: 'block',
@@ -174,11 +106,11 @@ export const TextInput = forwardRef(function TextInput(
174
106
  prefix,
175
107
  radius: radiusProp = 2,
176
108
  readOnly,
177
- space: _space = 3,
109
+ space: _space = 3, // eslint-disable-line @typescript-eslint/no-unused-vars
178
110
  suffix,
179
111
  customValidity,
180
112
  type = 'text',
181
- weight: _width,
113
+ weight: _width, // eslint-disable-line @typescript-eslint/no-unused-vars
182
114
  ...restProps
183
115
  } = props
184
116
  const ref = useRef<HTMLInputElement | null>(null)
@@ -254,7 +186,7 @@ export const TextInput = forwardRef(function TextInput(
254
186
  // $radius={radius}
255
187
  // $scheme={rootTheme.scheme}
256
188
  // $tone={rootTheme.tone}
257
- border={border}
189
+ // border={border}
258
190
  className="text-input-presentation"
259
191
  data-border={border ? '' : undefined}
260
192
  data-disable-focus-ring={__unstable_disableFocusRing ? '' : undefined}
@@ -394,7 +326,7 @@ export const TextInput = forwardRef(function TextInput(
394
326
  <Card
395
327
  align="center"
396
328
  as="span"
397
- className={composeClassNames(className, textInput({size: fontSizeProp}))}
329
+ className={composeClassNames(className, textInput({padding, size: fontSizeProp}))}
398
330
  data-ui="TextInput"
399
331
  display="flex"
400
332
  tone={rootTheme.tone}
@@ -403,7 +335,7 @@ export const TextInput = forwardRef(function TextInput(
403
335
 
404
336
  <Box
405
337
  as="span"
406
- className="text-input-wrapper"
338
+ // className="text-input-wrapper"
407
339
  flex={1}
408
340
  // todo
409
341
  // minWidth={0}
@@ -411,9 +343,10 @@ export const TextInput = forwardRef(function TextInput(
411
343
  >
412
344
  <input
413
345
  data-as="input"
414
- data-scheme={rootTheme.scheme}
415
- data-tone={rootTheme.tone}
346
+ // data-scheme={rootTheme.scheme}
347
+ // data-tone={rootTheme.tone}
416
348
  {...restProps}
349
+ className={textInputElement()}
417
350
  // $fontSize={fontSize}
418
351
  // $iconLeft={$hasIcon}
419
352
  // $iconRight={$hasIconRight || $hasClearButton}
@@ -8,14 +8,14 @@ import {
8
8
  } from '../../constants'
9
9
  import {Placement} from '../../types'
10
10
  import {Arrow} from '../../utils'
11
- import {Card, CardProps} from '../card'
11
+ import {Card} from '../card'
12
12
  import {
13
13
  DEFAULT_TOOLTIP_ARROW_HEIGHT,
14
14
  DEFAULT_TOOLTIP_ARROW_RADIUS,
15
15
  DEFAULT_TOOLTIP_ARROW_WIDTH,
16
16
  } from './constants'
17
17
 
18
- const MotionCard = motion(Card)
18
+ const MotionCard = motion(Card) as typeof Card
19
19
 
20
20
  /**
21
21
  * @internal
@@ -35,7 +35,7 @@ export const TooltipCard = memo(
35
35
  scheme?: ThemeColorSchemeKey
36
36
  shadow?: number | number[]
37
37
  } & RadiusStyleProps &
38
- Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width' | 'wrap'>,
38
+ Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'rows' | 'width' | 'wrap'>,
39
39
  ref: React.ForwardedRef<HTMLDivElement>,
40
40
  ) {
41
41
  const {
@@ -79,7 +79,7 @@ export const TooltipCard = memo(
79
79
  return (
80
80
  <MotionCard
81
81
  data-ui="Tooltip__card"
82
- {...(restProps as CardProps)}
82
+ {...restProps}
83
83
  data-animate={animate ? '' : undefined}
84
84
  className={tooltipCard()}
85
85
  data-placement={placement}
@@ -89,7 +89,7 @@ export const TooltipCard = memo(
89
89
  scheme={scheme}
90
90
  shadow={shadow}
91
91
  style={rootStyle}
92
- {...((animate ? POPOVER_MOTION_PROPS : {}) as CardProps)}
92
+ {...(animate ? POPOVER_MOTION_PROPS : {})}
93
93
  >
94
94
  {children}
95
95
 
@@ -74,6 +74,7 @@ export interface ResponsiveFlexItemProps {
74
74
 
75
75
  /**
76
76
  * @public
77
+ * @deprecated
77
78
  */
78
79
  export interface ResponsiveGridProps {
79
80
  autoRows?: GridAutoRows | GridAutoRows[]
@@ -1,4 +1,4 @@
1
- import {css, styled} from '../../../lib/styled'
1
+ import {css, styled} from 'styled-components'
2
2
  import {getTheme_v2} from '../../../../theme'
3
3
 
4
4
  export const Root = styled.div((props) => {
@@ -5,18 +5,16 @@ import {
5
5
  ThemeColorCard_v2,
6
6
  ThemeColorInputMode_v2,
7
7
  ThemeColorState_v2,
8
- } from '@sanity/ui/theme'
9
- import {
10
8
  THEME_COLOR_BUTTON_MODES,
11
9
  THEME_COLOR_CARD_TONES,
12
10
  THEME_COLOR_INPUT_MODES,
13
11
  THEME_COLOR_STATE_TONES,
14
12
  ThemeColorCardToneKey,
15
13
  ThemeColorInputModeKey,
14
+ buildTheme,
16
15
  } from '@sanity/ui/theme'
17
- import {buildTheme} from '@sanity/ui/theme'
18
16
  import {ReactElement} from 'react'
19
- import {rem} from '../../../styles'
17
+ import {rem} from '../../../_compat'
20
18
  import {useTheme_v2} from '../../useTheme'
21
19
  import {getCSSProps} from './helpers'
22
20
  import {Root} from './Root'
@@ -6,7 +6,7 @@ import {
6
6
  getScopedTheme,
7
7
  } from '@sanity/ui/theme'
8
8
  import {useContext, useMemo} from 'react'
9
- import {ThemeProvider as StyledThemeProvider} from '../lib/styled'
9
+ import {ThemeProvider as StyledThemeProvider} from 'styled-components'
10
10
  import {ThemeContext} from './themeContext'
11
11
  import {ThemeContextValue} from './types'
12
12
 
@@ -1,19 +1,25 @@
1
- /**
2
- * @public
3
- */
4
- export type BoxSizing = 'content' | 'border'
1
+ export {
2
+ /**
3
+ * @public
4
+ * @deprecated use `Display` from `@sanity/ui/css` instead.
5
+ */
6
+ type Display as BoxDisplay,
5
7
 
6
- /**
7
- * @public
8
- */
9
- export type BoxDisplay = 'none' | 'block' | 'grid' | 'flex' | 'inline-block'
8
+ /**
9
+ * @public
10
+ * @deprecated use `BoxHeight` from `@sanity/ui/css` instead.
11
+ */
12
+ type BoxHeight,
10
13
 
11
- /**
12
- * @public
13
- */
14
- export type BoxHeight = 'stretch' | 'fill'
14
+ /**
15
+ * @public
16
+ * @deprecated use `Overflow` from `@sanity/ui/css` instead.
17
+ */
18
+ type BoxOverflow,
15
19
 
16
- /**
17
- * @public
18
- */
19
- export type BoxOverflow = 'visible' | 'hidden' | 'auto'
20
+ /**
21
+ * @public
22
+ * @deprecated use `BoxSizing` from `@sanity/ui/css` instead.
23
+ */
24
+ type BoxSizing,
25
+ } from '@sanity/ui/css'
@@ -1,14 +1,19 @@
1
- /**
2
- * @public
3
- */
4
- export type GridAutoRows = 'auto' | 'min' | 'max' | 'fr'
1
+ export {
2
+ /**
3
+ * @public
4
+ * @deprecated Use `GridAutoRows` from `@sanity/ui/css` instead.
5
+ */
6
+ type GridAutoRows,
5
7
 
6
- /**
7
- * @public
8
- */
9
- export type GridAutoCols = 'auto' | 'min' | 'max' | 'fr'
8
+ /**
9
+ * @public
10
+ * @deprecated Use `GridAutoCols` from `@sanity/ui/css` instead.
11
+ */
12
+ type GridAutoCols,
10
13
 
11
- /**
12
- * @public
13
- */
14
- export type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense'
14
+ /**
15
+ * @public
16
+ * @deprecated Use `GridAutoFlow` from `@sanity/ui/css` instead.
17
+ */
18
+ type GridAutoFlow,
19
+ } from '@sanity/ui/css'
@@ -1,4 +1,7 @@
1
- /**
2
- * @public
3
- */
4
- export type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'initial'
1
+ export {
2
+ /**
3
+ * @public
4
+ * @deprecated Use `TextAlign` from `@sanity/ui/css` instead
5
+ */
6
+ type TextAlign,
7
+ } from '@sanity/ui/css'
@@ -1,5 +1,5 @@
1
1
  import {Box, Card, ElementQuery, Text} from '@sanity/ui'
2
- import {styled} from '../../../lib/styled'
2
+ import {styled} from 'styled-components'
3
3
 
4
4
  const TestCard = styled(Card)`
5
5
  --card-fg-color: orange;
@@ -25,7 +25,7 @@ interface LayerChildrenProps extends BoxProps {
25
25
 
26
26
  const LayerChildren = forwardRef(function LayerChildren(
27
27
  props: LayerChildrenProps &
28
- Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width' | 'wrap'>,
28
+ Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'rows' | 'width' | 'wrap'>,
29
29
  forwardedRef: React.Ref<HTMLDivElement>,
30
30
  ) {
31
31
  const {
@@ -91,7 +91,7 @@ const LayerChildren = forwardRef(function LayerChildren(
91
91
  * @public
92
92
  */
93
93
  export const Layer = forwardRef(function Layer(
94
- props: LayerProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'width' | 'wrap'>,
94
+ props: LayerProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'rows' | 'width' | 'wrap'>,
95
95
  ref: React.Ref<HTMLDivElement>,
96
96
  ) {
97
97
  const {children, zOffset = 1, ...restProps} = props
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import {forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'
3
- import {styled} from '../../lib/styled'
4
3
  import {_isScrollable} from '../../helpers'
4
+ import {styled} from '../../lib/styled'
5
5
  import {_ResizeObserver} from '../../observers'
6
6
  import {StackProps} from '../../primitives'
7
7
  import {useTheme_v2} from '../../theme'
@@ -39,18 +39,15 @@ export function compileRules(rules: Rules): string {
39
39
  let keyframesCss = `@keyframes ${name} {\n`
40
40
 
41
41
  for (const [key, props] of Object.entries(value)) {
42
- keyframesCss += ` ${key} {\n`
42
+ keyframesCss += ` ${key}`
43
43
  keyframesCss += compileRule('', props).replace(/\n/g, '\n ') + '\n'
44
- keyframesCss += ` }\n`
45
44
  }
46
45
 
47
- keyframesCss += `}\n`
46
+ keyframesCss += `\n}\n`
48
47
 
49
48
  css += keyframesCss
50
49
  }
51
50
 
52
- // console.log('keyframes', keyframes)
53
-
54
51
  for (const [query, queryRules] of Object.entries(mediaQueries)) {
55
52
  css += compileMediaQueryRule(query, queryRules) + '\n'
56
53
  }
@@ -1,5 +1,5 @@
1
1
  import {rules} from '../rules'
2
- import {compileRules} from './comileRules'
2
+ import {compileRules} from './compileRules'
3
3
 
4
4
  /** @public */
5
5
  export function compileSystem(): string {
@@ -70,7 +70,7 @@ export function compileTheme(theme: RootTheme_v2): string {
70
70
  }
71
71
 
72
72
  return [
73
- compileRule(`.root`, {
73
+ compileRule(`:root`, {
74
74
  [varNames.avatar.focusRing.offset]: px(theme.avatar.focusRing.offset),
75
75
  [varNames.avatar.focusRing.width]: px(theme.avatar.focusRing.width),
76
76
  // [varNames.avatar.size[0].distance]: px(theme.avatar.size[0].distance),
@@ -282,7 +282,9 @@ export function compileTheme(theme: RootTheme_v2): string {
282
282
  '--radius-4': px(theme.radius[4]),
283
283
  '--radius-5': px(theme.radius[5]),
284
284
  '--radius-6': px(theme.radius[6]),
285
+
285
286
  [varNames.space[0]]: rem(theme.space[0]),
287
+ [varNames.space[0.5]]: `calc(${rem(theme.space[1])} / 2)`,
286
288
  [varNames.space[1]]: rem(theme.space[1]),
287
289
  [varNames.space[2]]: rem(theme.space[2]),
288
290
  [varNames.space[3]]: rem(theme.space[3]),
@@ -292,6 +294,7 @@ export function compileTheme(theme: RootTheme_v2): string {
292
294
  [varNames.space[7]]: rem(theme.space[7]),
293
295
  [varNames.space[8]]: rem(theme.space[8]),
294
296
  [varNames.space[9]]: rem(theme.space[9]),
297
+
295
298
  '--shadow-0-umbra': toBoxShadow(theme.shadow[0]?.umbra), //`${theme.shadow[0]?.umbra || 'none'}`,
296
299
  '--shadow-0-penumbra': toBoxShadow(theme.shadow[0]?.penumbra),
297
300
  '--shadow-0-ambient': toBoxShadow(theme.shadow[0]?.ambient),
@@ -5,3 +5,21 @@ export const breadcrumbsRules: Rules = {
5
5
  lineHeight: 0,
6
6
  },
7
7
  }
8
+
9
+ // import {styled} from '../../lib/styled'
10
+ // import {Button} from '../../primitives'
11
+
12
+ // export const Root = styled.ol`
13
+ // margin: 0;
14
+ // padding: 0;
15
+ // display: flex;
16
+ // list-style: none;
17
+ // align-items: center;
18
+ // white-space: nowrap;
19
+ // line-height: 0;
20
+ // `
21
+
22
+ // export const ExpandButton = styled(Button)`
23
+ // appearance: none;
24
+ // margin: -4px;
25
+ // `
@@ -0,0 +1 @@
1
+ export * from './menu'
@@ -0,0 +1,5 @@
1
+ import {composeClassNames} from '../../composeClassNames'
2
+
3
+ export function menuDivider(): string {
4
+ return composeClassNames('menu-divider')
5
+ }
@@ -0,0 +1,10 @@
1
+ import {Rules} from '../../types'
2
+
3
+ export const menuRules: Rules = {
4
+ 'menu-divider': {
5
+ height: `1px`,
6
+ border: 0,
7
+ backgroundColor: 'var(--card-border-color)',
8
+ margin: 0,
9
+ },
10
+ }
@@ -0,0 +1,2 @@
1
+ export * from './skeleton'
2
+ export * from './types'
@@ -0,0 +1,106 @@
1
+ import {FONT_CODE_SIZE, FONT_HEADING_SIZE, FONT_LABEL_SIZE, FONT_TEXT_SIZE} from '@sanity/ui/theme'
2
+ import {responsiveRules} from '../../responsiveRules'
3
+ import {Rules} from '../../types'
4
+
5
+ export const skeletonRules: Rules = {
6
+ 'skeleton': {
7
+ 'backgroundColor': 'var(--card-skeleton-from-color)',
8
+ 'backgroundPosition': '100%',
9
+ 'backgroundSize': '200% 100%',
10
+ 'backgroundAttachment': 'fixed',
11
+ 'opacity': 0,
12
+ 'transition': 'opacity 200ms ease-in',
13
+
14
+ '@keyframes': {
15
+ 'skeleton-pulse': {
16
+ '0%': {
17
+ backgroundPosition: '100%',
18
+ },
19
+ '100%': {
20
+ backgroundPosition: '-100%',
21
+ },
22
+ },
23
+ },
24
+
25
+ '@nest': {
26
+ '&[data-animated]': {
27
+ backgroundImage: `linear-gradient(
28
+ to right,
29
+ var(--card-skeleton-from-color),
30
+ var(--card-skeleton-to-color),
31
+ var(--card-skeleton-from-color),
32
+ var(--card-skeleton-from-color),
33
+ var(--card-skeleton-from-color)
34
+ )`,
35
+ animationName: 'skeleton-pulse',
36
+ animationTimingFunction: 'ease-in-out',
37
+ animationIterationCount: 'infinite',
38
+ animationDuration: '2000ms',
39
+ },
40
+
41
+ '&[data-visible]': {
42
+ opacity: 1,
43
+ },
44
+ },
45
+
46
+ '@media': {
47
+ 'screen and (prefers-reduced-motion: no-preference)': {
48
+ backgroundColor: 'var(--card-skeleton-from-color)',
49
+ },
50
+ },
51
+ },
52
+
53
+ 'font-skeleton': {
54
+ height: `calc(var(--font-skeleton-line-height) - var(--font-skeleton-ascender-height) - var(--font-skeleton-descender-height))`,
55
+ },
56
+
57
+ // ...responsiveRules('text-skeleton-0', {
58
+ // '--font-skeleton-line-height': 'var(--font-text-0-line-height)',
59
+ // '--font-skeleton-ascender-height': 'var(--font-text-0-ascender-height)',
60
+ // '--font-skeleton-descender-height': 'var(--font-text-0-descender-height)',
61
+ // }),
62
+
63
+ ...FONT_CODE_SIZE.reduce((acc, size) => {
64
+ return {
65
+ ...acc,
66
+ ...responsiveRules(`code-skeleton-${size}`, {
67
+ '--font-skeleton-line-height': `var(--font-code-${size}-line-height)`,
68
+ '--font-skeleton-ascender-height': `var(--font-code-${size}-ascender-height)`,
69
+ '--font-skeleton-descender-height': `var(--font-code-${size}-descender-height)`,
70
+ }),
71
+ }
72
+ }, {}),
73
+
74
+ ...FONT_HEADING_SIZE.reduce((acc, size) => {
75
+ return {
76
+ ...acc,
77
+ ...responsiveRules(`heading-skeleton-${size}`, {
78
+ '--font-skeleton-line-height': `var(--font-heading-${size}-line-height)`,
79
+ '--font-skeleton-ascender-height': `var(--font-heading-${size}-ascender-height)`,
80
+ '--font-skeleton-descender-height': `var(--font-heading-${size}-descender-height)`,
81
+ }),
82
+ }
83
+ }, {}),
84
+
85
+ ...FONT_LABEL_SIZE.reduce((acc, size) => {
86
+ return {
87
+ ...acc,
88
+ ...responsiveRules(`label-skeleton-${size}`, {
89
+ '--font-skeleton-line-height': `var(--font-label-${size}-line-height)`,
90
+ '--font-skeleton-ascender-height': `var(--font-label-${size}-ascender-height)`,
91
+ '--font-skeleton-descender-height': `var(--font-label-${size}-descender-height)`,
92
+ }),
93
+ }
94
+ }, {}),
95
+
96
+ ...FONT_TEXT_SIZE.reduce((acc, size) => {
97
+ return {
98
+ ...acc,
99
+ ...responsiveRules(`text-skeleton-${size}`, {
100
+ '--font-skeleton-line-height': `var(--font-text-${size}-line-height)`,
101
+ '--font-skeleton-ascender-height': `var(--font-text-${size}-ascender-height)`,
102
+ '--font-skeleton-descender-height': `var(--font-text-${size}-descender-height)`,
103
+ }),
104
+ }
105
+ }, {}),
106
+ }
@@ -0,0 +1,31 @@
1
+ import {_resp} from '../../_resp'
2
+ import {composeClassNames} from '../../composeClassNames'
3
+ import {radius} from '../../styles/radius'
4
+ import {
5
+ CodeSkeletonStyleProps,
6
+ HeadingSkeletonStyleProps,
7
+ LabelSkeletonStyleProps,
8
+ SkeletonStyleProps,
9
+ TextSkeletonStyleProps,
10
+ } from './types'
11
+
12
+ /** @beta */
13
+ export function skeleton(props: SkeletonStyleProps): string {
14
+ return composeClassNames('skeleton', radius(props))
15
+ }
16
+
17
+ export function codeSkeleton(props: CodeSkeletonStyleProps): string {
18
+ return composeClassNames('font-skeleton', _resp('code-skeleton', props.size))
19
+ }
20
+
21
+ export function headingSkeleton(props: HeadingSkeletonStyleProps): string {
22
+ return composeClassNames('font-skeleton', _resp('heading-skeleton', props.size))
23
+ }
24
+
25
+ export function labelSkeleton(props: LabelSkeletonStyleProps): string {
26
+ return composeClassNames('font-skeleton', _resp('label-skeleton', props.size))
27
+ }
28
+
29
+ export function textSkeleton(props: TextSkeletonStyleProps): string {
30
+ return composeClassNames('font-skeleton', _resp('text-skeleton', props.size))
31
+ }