@sanity/ui 5.0.0-alpha.26 → 5.0.0-alpha.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/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/components/tabs/tabs.css +1 -1
- package/src/utils/getProps.test.ts +22 -0
- package/src/utils/getProps.ts +5 -1
- package/src/version.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.27",
|
|
4
4
|
"description": "Sanity UI Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@sanity-labs/design-tokens": "0.0.2-alpha.
|
|
54
|
+
"@sanity-labs/design-tokens": "0.0.2-alpha.12",
|
|
55
55
|
"@sanity/icons": "^5.2.1",
|
|
56
56
|
"clsx": "^2.1.1",
|
|
57
57
|
"comment-json": "^5.0.0",
|
|
@@ -118,6 +118,28 @@ describe('getProps', () => {
|
|
|
118
118
|
expect(result.style).toEqual({})
|
|
119
119
|
})
|
|
120
120
|
|
|
121
|
+
it('does not forward undefined known layout props', () => {
|
|
122
|
+
const result = getProps({width: undefined}, layoutProps)
|
|
123
|
+
expect(result).not.toHaveProperty('width')
|
|
124
|
+
expect(result.className).toBe('')
|
|
125
|
+
expect(result.style).toEqual({})
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('does not forward null known layout props', () => {
|
|
129
|
+
const result = getProps({width: null}, layoutProps)
|
|
130
|
+
expect(result).not.toHaveProperty('width')
|
|
131
|
+
expect(result.className).toBe('')
|
|
132
|
+
expect(result.style).toEqual({})
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
it('forwards keys without a prop def', () => {
|
|
136
|
+
const result = getProps({'id': 'test', 'data-testid': 'grid'}, layoutProps)
|
|
137
|
+
expect(result['id']).toEqual('test')
|
|
138
|
+
expect(result['data-testid']).toEqual('grid')
|
|
139
|
+
expect(result.className).toBe('')
|
|
140
|
+
expect(result.style).toEqual({})
|
|
141
|
+
})
|
|
142
|
+
|
|
121
143
|
it('generates responsive className with undefined values', () => {
|
|
122
144
|
const result = getProps({padding: [1, 2, undefined, 3]}, layoutProps)
|
|
123
145
|
expect(result.className).toBe('sui-p1 sui-p2-bp-1 sui-p3-bp-3')
|
package/src/utils/getProps.ts
CHANGED
|
@@ -51,9 +51,13 @@ export function getProps(
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
} else {
|
|
54
|
+
if (propValue === null || propValue === undefined) {
|
|
55
|
+
continue
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
const resolvedPropDef = getResolvedPropDef(propValue, propDef)
|
|
55
59
|
|
|
56
|
-
if (!resolvedPropDef
|
|
60
|
+
if (!resolvedPropDef) {
|
|
57
61
|
restProps[key] = propValue
|
|
58
62
|
continue
|
|
59
63
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// This file is generated by scripts/write-version.js. Do not edit.
|
|
2
|
-
export const VERSION = '
|
|
3
|
-
export const HASH = '
|
|
2
|
+
export const VERSION = '500alpha27'
|
|
3
|
+
export const HASH = '711625'
|