@sanity/ui 2.3.2 → 2.3.4-canary.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.3.2",
3
+ "version": "2.3.4-canary.0",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -51,32 +51,6 @@
51
51
  "src",
52
52
  "theme.js"
53
53
  ],
54
- "scripts": {
55
- "build": "run-s clean pkg:build pkg:check figma:pkg:build",
56
- "clean": "rimraf .workshop dist",
57
- "commit": "cz",
58
- "cypress:dev": "run-p dev cypress:open",
59
- "cypress:open": "cypress open",
60
- "cypress:run": "cypress run",
61
- "dev": "run-p storybook:dev workshop:dev",
62
- "figma:pkg:build": "cd figma && pnpm build",
63
- "format": "prettier --write --cache --ignore-unknown .",
64
- "lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
65
- "pkg:build": "pkg build --strict",
66
- "pkg:check": "pkg --strict",
67
- "prepare": "husky install",
68
- "prepublishOnly": "pnpm build",
69
- "release": "semantic-release",
70
- "storybook:build": "storybook build",
71
- "storybook:dev": "storybook dev -p 6006",
72
- "test": "jest",
73
- "test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
74
- "ts:check": "tsc",
75
- "watch": "pkg watch --strict",
76
- "workshop:build": "workshop build",
77
- "workshop:dev": "workshop dev",
78
- "workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
79
- },
80
54
  "commitlint": {
81
55
  "extends": [
82
56
  "@commitlint/config-conventional"
@@ -119,7 +93,7 @@
119
93
  "@commitlint/cli": "^19.3.0",
120
94
  "@commitlint/config-conventional": "^19.2.2",
121
95
  "@juggle/resize-observer": "^3.4.0",
122
- "@sanity/pkg-utils": "^6.9.1",
96
+ "@sanity/pkg-utils": "^6.9.3",
123
97
  "@sanity/semantic-release-preset": "^4.1.8",
124
98
  "@sanity/ui-workshop": "^2.0.15",
125
99
  "@storybook/addon-a11y": "^8.0.8",
@@ -184,7 +158,7 @@
184
158
  "styled-components": "^6.1.11",
185
159
  "tsconfig-paths": "^4.2.0",
186
160
  "typescript": "5.4.5",
187
- "vite": "^5.2.12",
161
+ "vite": "^5.2.13",
188
162
  "vite-tsconfig-paths": "^4.3.2"
189
163
  },
190
164
  "peerDependencies": {
@@ -193,7 +167,6 @@
193
167
  "react-is": "^18",
194
168
  "styled-components": "^5.2 || ^6"
195
169
  },
196
- "packageManager": "pnpm@9.2.0",
197
170
  "engines": {
198
171
  "node": ">=14.0.0"
199
172
  },
@@ -203,9 +176,28 @@
203
176
  "esm.sh": {
204
177
  "bundle": false
205
178
  },
206
- "pnpm": {
207
- "overrides": {
208
- "conventional-changelog-conventionalcommits": ">= 8.0.0"
209
- }
179
+ "scripts": {
180
+ "build": "run-s clean pkg:build pkg:check figma:pkg:build",
181
+ "clean": "rimraf .workshop dist",
182
+ "commit": "cz",
183
+ "cypress:dev": "run-p dev cypress:open",
184
+ "cypress:open": "cypress open",
185
+ "cypress:run": "cypress run",
186
+ "dev": "run-p storybook:dev workshop:dev",
187
+ "figma:pkg:build": "cd figma && pnpm build",
188
+ "format": "prettier --write --cache --ignore-unknown .",
189
+ "lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
190
+ "pkg:build": "pkg build --strict",
191
+ "pkg:check": "pkg --strict",
192
+ "release": "semantic-release",
193
+ "storybook:build": "storybook build",
194
+ "storybook:dev": "storybook dev -p 6006",
195
+ "test": "jest",
196
+ "test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
197
+ "ts:check": "tsc",
198
+ "watch": "pkg watch --strict",
199
+ "workshop:build": "workshop build",
200
+ "workshop:dev": "workshop dev",
201
+ "workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
210
202
  }
211
- }
203
+ }
@@ -1,11 +1,10 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
- import {cloneElement, forwardRef} from 'react'
2
+ import {Children, cloneElement, forwardRef} from 'react'
3
3
  import {styled, css} from 'styled-components'
4
4
  import {EMPTY_RECORD} from '../../constants'
5
5
  import {useArrayProp} from '../../hooks'
6
6
  import {rem, _responsive, ThemeProps} from '../../styles'
7
7
  import {AvatarSize} from '../../types'
8
- import {childrenToElementArray} from '../helpers'
9
8
  import {AvatarCounter} from './avatarCounter'
10
9
 
11
10
  const BASE_STYLES = css`
@@ -66,7 +65,7 @@ export const AvatarStack = forwardRef(function AvatarStack(
66
65
  size: sizeProp = 1,
67
66
  ...restProps
68
67
  } = props
69
- const children = childrenToElementArray(childrenProp).filter(
68
+ const children = Children.toArray(childrenProp).filter(
70
69
  (child) => typeof child !== 'string',
71
70
  ) as React.ReactElement[]
72
71
  const maxLength = Math.max(maxLengthProp, 0)
@@ -1,8 +1,7 @@
1
- import {forwardRef, useMemo} from 'react'
1
+ import {forwardRef, useMemo, Children} from 'react'
2
2
  import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {Box, BoxProps} from '../box'
5
- import {childrenToElementArray} from '../helpers'
6
5
  import {inlineBaseStyle, inlineSpaceStyle} from './styles'
7
6
  import {ResponsiveInlineSpaceStyleProps} from './types'
8
7
 
@@ -28,10 +27,7 @@ export const Inline = forwardRef(function Inline(
28
27
  const {as, children: childrenProp, space, ...restProps} = props
29
28
 
30
29
  const children = useMemo(
31
- () =>
32
- childrenToElementArray(childrenProp)
33
- .filter(Boolean)
34
- .map((child, idx) => <div key={idx}>{child}</div>),
30
+ () => Children.map(childrenProp, (child) => <div>{child}</div>),
35
31
  [childrenProp],
36
32
  )
37
33
 
@@ -432,7 +432,7 @@ export const defaultColorTokens: ThemeColorTokens = {
432
432
  muted: {
433
433
  bg: ['50', '950'],
434
434
  },
435
- placeholder: ['400', '600 50%'],
435
+ placeholder: ['400', '600'],
436
436
  },
437
437
  hovered: {
438
438
  border: ['300', '700'],
@@ -1,11 +0,0 @@
1
- import {isElement, isFragment} from 'react-is'
2
-
3
- export function childrenToElementArray(
4
- children: React.ReactNode,
5
- ): Array<React.ReactElement | string> {
6
- const childrenArray = Array.isArray(children) ? children : [children]
7
-
8
- return childrenArray.filter(
9
- (node) => isElement(node) || isFragment(node) || typeof node === 'string',
10
- ) as Array<React.ReactElement | string>
11
- }