@sanity/ui 2.0.12 → 2.0.13-alpha.2

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 (115) hide show
  1. package/dist/_chunks-cjs/getScopedTheme.js +547 -0
  2. package/dist/_chunks-cjs/getScopedTheme.js.map +1 -0
  3. package/dist/_chunks-es/getScopedTheme.mjs +548 -0
  4. package/dist/_chunks-es/getScopedTheme.mjs.map +1 -0
  5. package/dist/_legacy/getScopedTheme.esm.js +548 -0
  6. package/dist/_legacy/getScopedTheme.esm.js.map +1 -0
  7. package/dist/index.d.mts +2 -2
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.esm.js +74 -74
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.js +202 -202
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +74 -74
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/theme.d.mts +1 -1
  16. package/dist/theme.d.ts +1 -1
  17. package/dist/theme.esm.js +51 -587
  18. package/dist/theme.esm.js.map +1 -1
  19. package/dist/theme.js +22 -560
  20. package/dist/theme.js.map +1 -1
  21. package/dist/theme.mjs +51 -587
  22. package/dist/theme.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/src/core/components/autocomplete/autocomplete.styles.tsx +1 -1
  25. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +1 -1
  26. package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
  27. package/src/core/components/dialog/dialog.tsx +1 -1
  28. package/src/core/components/dialog/styles.ts +3 -3
  29. package/src/core/components/hotkeys/hotkeys.tsx +1 -1
  30. package/src/core/components/menu/menu.tsx +1 -1
  31. package/src/core/components/menu/menuDivider.ts +1 -1
  32. package/src/core/components/skeleton/skeleton.tsx +1 -1
  33. package/src/core/components/skeleton/textSkeleton.tsx +3 -3
  34. package/src/core/components/tab/tab.tsx +1 -1
  35. package/src/core/components/tab/tabList.tsx +1 -1
  36. package/src/core/components/toast/toast.tsx +1 -1
  37. package/src/core/components/toast/toastProvider.tsx +1 -1
  38. package/src/core/components/tree/style.ts +2 -3
  39. package/src/core/components/tree/treeItem.tsx +1 -1
  40. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +1 -1
  41. package/src/core/primitives/_selectable/selectable.tsx +1 -1
  42. package/src/core/primitives/_selectable/style.ts +1 -2
  43. package/src/core/primitives/avatar/avatar.tsx +1 -1
  44. package/src/core/primitives/avatar/avatarCounter.tsx +3 -4
  45. package/src/core/primitives/avatar/avatarStack.tsx +2 -3
  46. package/src/core/primitives/avatar/styles.ts +3 -3
  47. package/src/core/primitives/badge/badge.tsx +1 -1
  48. package/src/core/primitives/box/box.tsx +1 -1
  49. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
  50. package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
  51. package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
  52. package/src/core/primitives/button/button.tsx +1 -1
  53. package/src/core/primitives/button/styles.ts +3 -3
  54. package/src/core/primitives/card/__workshop__/selected.tsx +3 -3
  55. package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
  56. package/src/core/primitives/card/card.tsx +1 -1
  57. package/src/core/primitives/card/styles.ts +2 -3
  58. package/src/core/primitives/checkbox/checkbox.tsx +1 -1
  59. package/src/core/primitives/checkbox/styles.ts +1 -2
  60. package/src/core/primitives/code/code.tsx +1 -1
  61. package/src/core/primitives/code/styles.ts +1 -4
  62. package/src/core/primitives/container/container.tsx +1 -1
  63. package/src/core/primitives/container/styles.ts +2 -2
  64. package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
  65. package/src/core/primitives/flex/flex.tsx +1 -1
  66. package/src/core/primitives/grid/grid.tsx +1 -1
  67. package/src/core/primitives/heading/heading.tsx +1 -1
  68. package/src/core/primitives/heading/styles.ts +1 -2
  69. package/src/core/primitives/inline/inline.tsx +1 -1
  70. package/src/core/primitives/inline/styles.ts +2 -2
  71. package/src/core/primitives/kbd/kbd.tsx +1 -1
  72. package/src/core/primitives/label/label.tsx +1 -1
  73. package/src/core/primitives/label/styles.ts +1 -2
  74. package/src/core/primitives/popover/popoverCard.tsx +1 -1
  75. package/src/core/primitives/radio/radio.tsx +1 -1
  76. package/src/core/primitives/radio/styles.ts +1 -2
  77. package/src/core/primitives/select/select.tsx +1 -1
  78. package/src/core/primitives/select/styles.ts +5 -5
  79. package/src/core/primitives/spinner/spinner.tsx +1 -1
  80. package/src/core/primitives/stack/stack.tsx +1 -1
  81. package/src/core/primitives/stack/styles.ts +2 -2
  82. package/src/core/primitives/switch/styles.ts +3 -4
  83. package/src/core/primitives/switch/switch.tsx +1 -1
  84. package/src/core/primitives/text/__workshop__/colored.tsx +3 -3
  85. package/src/core/primitives/text/styles.ts +1 -2
  86. package/src/core/primitives/text/text.tsx +1 -1
  87. package/src/core/primitives/textArea/textArea.tsx +1 -1
  88. package/src/core/primitives/textInput/textInput.tsx +1 -1
  89. package/src/core/primitives/tooltip/tooltip.tsx +1 -1
  90. package/src/core/primitives/tooltip/tooltipCard.tsx +1 -1
  91. package/src/core/styles/border/borderStyle.ts +6 -6
  92. package/src/core/styles/box/boxStyle.ts +5 -5
  93. package/src/core/styles/flex/flexItemStyle.ts +2 -2
  94. package/src/core/styles/flex/flexStyle.ts +6 -6
  95. package/src/core/styles/font/responsiveFont.ts +2 -2
  96. package/src/core/styles/font/textAlignStyle.ts +2 -2
  97. package/src/core/styles/grid/gridItemStyle.ts +7 -7
  98. package/src/core/styles/grid/gridStyle.ts +9 -9
  99. package/src/core/styles/helpers.ts +2 -2
  100. package/src/core/styles/input/responsiveInputPaddingStyle.ts +2 -2
  101. package/src/core/styles/input/textInputStyle.ts +4 -4
  102. package/src/core/styles/margin/marginsStyle.test.ts +1 -1
  103. package/src/core/styles/padding/paddingStyle.test.ts +1 -1
  104. package/src/core/styles/radius/radiusStyle.ts +2 -2
  105. package/src/core/styles/shadow/shadowStyle.ts +2 -2
  106. package/src/core/theme/__workshop__/build/Root.tsx +1 -2
  107. package/src/core/theme/theme.test.tsx +1 -1
  108. package/src/core/theme/themeProvider.tsx +6 -7
  109. package/src/core/theme/useTheme.ts +2 -1
  110. package/src/core/utils/arrow/arrow.tsx +1 -1
  111. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
  112. package/src/core/utils/layer/layer.tsx +1 -1
  113. package/src/core/utils/srOnly/srOnly.tsx +1 -1
  114. package/src/core/utils/virtualList/virtualList.tsx +1 -1
  115. package/src/theme/system/theme.ts +1 -1
@@ -1,4 +1,4 @@
1
- import {ThemeBoxShadow, ThemeShadow, getTheme_v2} from '@sanity/ui/theme'
1
+ import {ThemeBoxShadow, ThemeShadow} from '@sanity/ui/theme'
2
2
  import {CSSObject} from '@sanity/ui/theme'
3
3
  import {EMPTY_RECORD} from '../../constants'
4
4
  import {rem, _responsive} from '../helpers'
@@ -21,7 +21,7 @@ function shadowStyle(shadow: ThemeShadow | null, outlineWidth: number = 1): CSSO
21
21
  }
22
22
 
23
23
  export function responsiveShadowStyle(props: ResponsiveShadowStyleProps & ThemeProps): CSSObject[] {
24
- const {card, media, shadow} = getTheme_v2(props.theme)
24
+ const {card, media, shadow} = props.theme.sanity.v2
25
25
 
26
26
  return _responsive(media, props.$shadow, (index) =>
27
27
  shadowStyle(shadow[index], card.shadow.outline),
@@ -1,8 +1,7 @@
1
1
  import {css, styled} from 'styled-components'
2
- import {getTheme_v2} from '../../../../theme'
3
2
 
4
3
  export const Root = styled.div((props) => {
5
- const {button, card, input} = getTheme_v2(props.theme)
4
+ const {button, card, input} = props.theme.sanity.v2
6
5
 
7
6
  return css`
8
7
  background: #000;
@@ -1,8 +1,8 @@
1
1
  /** @jest-environment jsdom */
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
3
 
4
- import {buildTheme} from '@sanity/ui/theme'
5
4
  import {render} from '../../../test'
5
+ import {buildTheme} from '../../theme'
6
6
  import {ThemeContext} from './themeContext'
7
7
  import {ThemeContextValue} from './types'
8
8
  import {useRootTheme} from './useRootTheme'
@@ -1,12 +1,7 @@
1
- import {
2
- RootTheme,
3
- ThemeColorCardToneKey,
4
- ThemeColorSchemeKey,
5
- Theme,
6
- getScopedTheme,
7
- } from '@sanity/ui/theme'
1
+ import {RootTheme, ThemeColorCardToneKey, ThemeColorSchemeKey, Theme} from '@sanity/ui/theme'
8
2
  import {useContext, useMemo} from 'react'
9
3
  import {ThemeProvider as StyledThemeProvider} from 'styled-components'
4
+ import {getScopedTheme} from '../../theme'
10
5
  import {ThemeContext} from './themeContext'
11
6
  import {ThemeContextValue} from './types'
12
7
 
@@ -53,6 +48,10 @@ export function ThemeProvider(props: ThemeProviderProps): React.ReactElement {
53
48
  return <pre>ThemeProvider: no "theme" property provided</pre>
54
49
  }
55
50
 
51
+ if (!theme.sanity.v2) {
52
+ return <pre>ThemeProvider: no "theme.sanity.v2" property in theme</pre>
53
+ }
54
+
56
55
  return (
57
56
  <ThemeContext.Provider value={themeContext}>
58
57
  <StyledThemeProvider theme={theme}>{children}</StyledThemeProvider>
@@ -1,5 +1,6 @@
1
- import {Theme, Theme_v2, getTheme_v2} from '@sanity/ui/theme'
1
+ import type {Theme, Theme_v2} from '@sanity/ui/theme'
2
2
  import {useTheme as useStyledTheme} from 'styled-components'
3
+ import {getTheme_v2} from '../../theme'
3
4
 
4
5
  /**
5
6
  * @public
@@ -1,5 +1,5 @@
1
1
  import {ForwardedRef, HTMLProps, ReactElement, forwardRef} from 'react'
2
- import {styled, css} from 'styled-components'
2
+ import styled, {css} from 'styled-components'
3
3
  import {useTheme_v2} from '../../theme'
4
4
  import {Point, compileCommands, getRoundedCommands} from './cmds'
5
5
 
@@ -1,5 +1,5 @@
1
1
  import {Box, Card, ElementQuery, Text} from '@sanity/ui'
2
- import {styled} from 'styled-components'
2
+ import styled from 'styled-components'
3
3
 
4
4
  const TestCard = styled(Card)`
5
5
  --card-fg-color: orange;
@@ -1,5 +1,5 @@
1
1
  import {FocusEvent, forwardRef, useCallback, useEffect, useRef} from 'react'
2
- import {styled} from 'styled-components'
2
+ import styled from 'styled-components'
3
3
  import {EMPTY_RECORD} from '../../constants'
4
4
  import {containsOrEqualsElement, isHTMLElement} from '../../helpers'
5
5
  import {useForwardedRef} from '../../hooks'
@@ -1,5 +1,5 @@
1
1
  import {forwardRef} from 'react'
2
- import {styled} from 'styled-components'
2
+ import styled from 'styled-components'
3
3
 
4
4
  /**
5
5
  * @public
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import {forwardRef, useEffect, useMemo, useRef, useState} from 'react'
3
- import {styled} from 'styled-components'
3
+ import styled from 'styled-components'
4
4
  import {_isScrollable} from '../../helpers'
5
5
  import {useForwardedRef} from '../../hooks'
6
6
  import {_ResizeObserver} from '../../observers'
@@ -133,6 +133,6 @@ export interface Theme {
133
133
  * @deprecated Use `v2.color` instead
134
134
  */
135
135
  color: ThemeColor
136
- v2?: Theme_v2
136
+ v2: Theme_v2
137
137
  }
138
138
  }