@sanity/ui 1.0.0-next.3 → 1.0.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 (146) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/dist/{types/src/index.d.ts → index.d.ts} +4450 -4398
  4. package/dist/{sanity-ui.esm.js → index.esm.js} +889 -2678
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/{sanity-ui.js → index.js} +883 -2688
  7. package/dist/index.js.map +1 -0
  8. package/package.json +114 -23
  9. package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  10. package/src/components/autocomplete/__workshop__/example.tsx +1 -1
  11. package/src/components/autocomplete/__workshop__/index.ts +36 -32
  12. package/src/components/autocomplete/autocomplete.styles.tsx +22 -28
  13. package/src/components/autocomplete/autocomplete.tsx +1 -2
  14. package/src/components/autocomplete/constants.ts +3 -8
  15. package/src/components/breadcrumbs/__workshop__/index.ts +11 -7
  16. package/src/components/breadcrumbs/breadcrumbs.styles.ts +13 -18
  17. package/src/components/dialog/__workshop__/index.ts +13 -9
  18. package/src/components/dialog/dialog.tsx +53 -67
  19. package/src/components/hotkeys/__workshop__/index.ts +11 -3
  20. package/src/components/hotkeys/hotkeys.tsx +12 -16
  21. package/src/components/menu/__workshop__/index.ts +71 -67
  22. package/src/components/menu/menu.tsx +5 -7
  23. package/src/components/menu/menuButton.tsx +16 -14
  24. package/src/components/menu/menuDivider.ts +8 -10
  25. package/src/components/skeleton/__workshop__/index.ts +8 -4
  26. package/src/components/skeleton/skeleton.tsx +4 -6
  27. package/src/components/skeleton/styles.ts +13 -9
  28. package/src/components/skeleton/textSkeleton.tsx +12 -14
  29. package/src/components/tab/__workshop__/index.ts +11 -3
  30. package/src/components/toast/__workshop__/index.ts +16 -4
  31. package/src/components/toast/toast.tsx +6 -11
  32. package/src/components/toast/toastProvider.tsx +18 -22
  33. package/src/components/tree/__workshop__/basic.perf.ts +1 -14
  34. package/src/components/tree/__workshop__/basic.tsx +1 -1
  35. package/src/components/tree/__workshop__/index.ts +12 -8
  36. package/src/components/tree/style.ts +78 -76
  37. package/src/components/tree/treeItem.tsx +7 -12
  38. package/src/global.ts +6 -0
  39. package/src/hooks/useElementRect/__workshop__/index.ts +11 -3
  40. package/src/hooks/useMediaIndex/__workshop__/index.ts +11 -3
  41. package/src/primitives/_selectable/selectable.tsx +4 -7
  42. package/src/primitives/_selectable/style.ts +85 -82
  43. package/src/primitives/avatar/__workshop__/index.ts +16 -12
  44. package/src/primitives/avatar/avatar.tsx +9 -12
  45. package/src/primitives/avatar/avatarCounter.tsx +22 -24
  46. package/src/primitives/avatar/avatarStack.tsx +16 -14
  47. package/src/primitives/avatar/styles.ts +1 -1
  48. package/src/primitives/badge/__workshop__/index.ts +16 -12
  49. package/src/primitives/badge/__workshop__/tones.tsx +1 -1
  50. package/src/primitives/badge/badge.tsx +6 -5
  51. package/src/primitives/box/__workshop__/index.ts +16 -4
  52. package/src/primitives/box/box.tsx +21 -49
  53. package/src/primitives/button/__workshop__/index.ts +51 -47
  54. package/src/primitives/button/__workshop__/sanityUploadButton.tsx +19 -20
  55. package/src/primitives/button/__workshop__/styled1.tsx +6 -6
  56. package/src/primitives/button/button.tsx +20 -26
  57. package/src/primitives/button/styles.ts +30 -29
  58. package/src/primitives/card/__workshop__/index.ts +15 -11
  59. package/src/primitives/card/card.tsx +9 -25
  60. package/src/primitives/card/styles.ts +119 -114
  61. package/src/primitives/checkbox/__workshop__/index.ts +10 -6
  62. package/src/primitives/checkbox/checkbox.tsx +4 -4
  63. package/src/primitives/checkbox/styles.ts +71 -69
  64. package/src/primitives/code/__workshop__/index.ts +16 -12
  65. package/src/primitives/code/code.tsx +3 -5
  66. package/src/primitives/code/styles.ts +20 -18
  67. package/src/primitives/container/__workshop__/index.ts +5 -3
  68. package/src/primitives/container/container.tsx +5 -4
  69. package/src/primitives/flex/__workshop__/index.ts +8 -4
  70. package/src/primitives/flex/flex.tsx +7 -23
  71. package/src/primitives/grid/__workshop__/index.ts +7 -3
  72. package/src/primitives/grid/grid.tsx +4 -27
  73. package/src/primitives/heading/__workshop__/index.ts +16 -12
  74. package/src/primitives/heading/heading.tsx +10 -17
  75. package/src/primitives/heading/styles.ts +45 -36
  76. package/src/primitives/inline/__workshop__/index.ts +5 -3
  77. package/src/primitives/inline/inline.tsx +3 -5
  78. package/src/primitives/kbd/__workshop__/index.ts +5 -3
  79. package/src/primitives/kbd/kbd.tsx +12 -13
  80. package/src/primitives/label/__workshop__/index.ts +16 -12
  81. package/src/primitives/label/label.tsx +13 -18
  82. package/src/primitives/label/styles.ts +24 -18
  83. package/src/primitives/popover/__workshop__/PlainStory.tsx +0 -1
  84. package/src/primitives/popover/__workshop__/TestStory.tsx +0 -1
  85. package/src/primitives/popover/__workshop__/index.ts +36 -32
  86. package/src/primitives/popover/constants.ts +0 -3
  87. package/src/primitives/popover/floating-ui/size.ts +40 -25
  88. package/src/primitives/popover/popover.tsx +220 -196
  89. package/src/primitives/popover/popoverArrow.tsx +42 -48
  90. package/src/primitives/popover/popoverCard.tsx +12 -22
  91. package/src/primitives/radio/__workshop__/index.ts +8 -4
  92. package/src/primitives/radio/radio.tsx +3 -3
  93. package/src/primitives/radio/styles.ts +73 -73
  94. package/src/primitives/select/__workshop__/index.ts +8 -4
  95. package/src/primitives/select/select.tsx +9 -11
  96. package/src/primitives/select/styles.ts +77 -77
  97. package/src/primitives/spinner/__workshop__/index.ts +11 -7
  98. package/src/primitives/spinner/spinner.tsx +2 -5
  99. package/src/primitives/stack/__workshop__/index.ts +11 -7
  100. package/src/primitives/stack/stack.tsx +3 -5
  101. package/src/primitives/switch/__workshop__/index.ts +8 -4
  102. package/src/primitives/switch/styles.ts +119 -112
  103. package/src/primitives/switch/switch.tsx +6 -6
  104. package/src/primitives/text/__workshop__/index.ts +21 -17
  105. package/src/primitives/text/styles.ts +51 -45
  106. package/src/primitives/text/text.tsx +11 -16
  107. package/src/primitives/textArea/__workshop__/index.ts +11 -7
  108. package/src/primitives/textArea/textArea.tsx +15 -22
  109. package/src/primitives/textInput/__workshop__/index.ts +46 -42
  110. package/src/primitives/textInput/__workshop__/plain.tsx +2 -1
  111. package/src/primitives/textInput/textInput.tsx +50 -69
  112. package/src/primitives/tooltip/__workshop__/index.ts +11 -7
  113. package/src/primitives/tooltip/tooltip.tsx +3 -6
  114. package/src/primitives/tooltip/tooltipArrow.tsx +69 -59
  115. package/src/styles/border/borderStyle.ts +10 -18
  116. package/src/styles/box/boxStyle.ts +14 -18
  117. package/src/styles/flex/flexItemStyle.ts +7 -1
  118. package/src/styles/flex/flexStyle.ts +14 -9
  119. package/src/styles/grid/gridItemStyle.ts +18 -30
  120. package/src/styles/grid/gridStyle.ts +25 -33
  121. package/src/styles/helpers.ts +2 -2
  122. package/src/styles/index.ts +0 -1
  123. package/src/styles/input/textInputStyle.ts +127 -123
  124. package/src/styles/margin/marginStyle.ts +11 -10
  125. package/src/styles/margin/marginsStyle.test.ts +12 -10
  126. package/src/styles/padding/paddingStyle.test.ts +12 -10
  127. package/src/styles/padding/paddingStyle.ts +9 -10
  128. package/src/theme/__workshop__/index.ts +26 -22
  129. package/src/theme/{ThemeContext.ts → themeContext.ts} +0 -0
  130. package/src/utils/boundaryElement/__workshop__/index.ts +11 -7
  131. package/src/utils/elementQuery/__workshop__/index.ts +11 -7
  132. package/src/utils/layer/__workshop__/index.ts +21 -17
  133. package/src/utils/layer/layer.tsx +4 -6
  134. package/src/utils/portal/__workshop__/index.ts +11 -7
  135. package/src/utils/srOnly/srOnly.tsx +8 -10
  136. package/src/utils/virtualList/__workshop__/index.ts +26 -22
  137. package/src/utils/virtualList/virtualList.tsx +10 -14
  138. package/dist/sanity-ui.esm.js.map +0 -1
  139. package/dist/sanity-ui.js.map +0 -1
  140. package/src/__workshop__/color/overview.tsx +0 -101
  141. package/src/__workshop__/index.ts +0 -10
  142. package/src/icons/__workshop__/.eslintrc +0 -5
  143. package/src/icons/__workshop__/index.tsx +0 -6
  144. package/src/icons/__workshop__/overview.tsx +0 -76
  145. package/src/styles/compose.ts +0 -35
  146. package/src/utils/srOnly/__workshop__/.eslintrc +0 -5
@@ -1,64 +1,74 @@
1
- import {forwardRef, memo} from 'react'
1
+ import {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
3
 
4
- const Root = memo(
5
- styled.div({
6
- position: 'absolute',
7
- pointerEvents: 'none',
8
- width: '15px',
9
- height: '15px',
10
- fill: 'none',
11
-
12
- ':empty + &': {
13
- display: 'none',
14
- },
15
-
16
- '& > svg': {
17
- display: 'block',
18
- transformOrigin: '7.5px 7.5px',
19
- },
20
-
21
- '[data-placement^="top"] > &': {
22
- bottom: '-27px',
23
- },
24
-
25
- '[data-placement^="right"] > &': {
26
- left: '-27px',
27
-
28
- '& > svg': {
29
- transform: 'rotate(90deg)',
30
- },
31
- },
32
-
33
- '[data-placement^="left"] > &': {
34
- right: '-27px',
35
-
36
- '& > svg': {
37
- transform: 'rotate(-90deg)',
38
- },
39
- },
40
-
41
- '[data-placement^="bottom"] > &': {
42
- top: '-27px',
43
-
44
- '& > svg': {
45
- transform: 'rotate(180deg)',
46
- },
47
- },
48
- })
49
- )
50
-
51
- const Border = memo(
52
- styled.path({
53
- fill: 'var(--card-shadow-outline-color)',
54
- })
55
- )
56
-
57
- const Shape = memo(
58
- styled.path({
59
- fill: 'var(--card-bg-color)',
60
- })
61
- )
4
+ const Root = styled.div`
5
+ position: absolute;
6
+ pointer-events: none;
7
+ width: 15px;
8
+ height: 15px;
9
+ fill: none;
10
+
11
+ :empty + & {
12
+ display: none;
13
+ }
14
+
15
+ & > svg {
16
+ display: block;
17
+ transform-origin: 7.5px 7.5px;
18
+ }
19
+
20
+ /* position: absolute;
21
+ width: 15px;
22
+ height: 15px;
23
+ fill: none;
24
+
25
+ :empty + & {
26
+ display: none;
27
+ }
28
+
29
+ & > svg {
30
+ &:not([hidden]) {
31
+ display: block;
32
+ }
33
+ transform-origin: 7.5px 7.5px;
34
+ } */
35
+
36
+ [data-placement^='top'] > & {
37
+ bottom: -27px;
38
+ }
39
+
40
+ [data-placement^='right'] > & {
41
+ left: -27px;
42
+
43
+ & > svg {
44
+ transform: rotate(90deg);
45
+ }
46
+ }
47
+
48
+ [data-placement^='left'] > & {
49
+ right: -27px;
50
+
51
+ & > svg {
52
+ transform: rotate(-90deg);
53
+ }
54
+ }
55
+
56
+ [data-placement^='bottom'] > & {
57
+ top: -27px;
58
+
59
+ & > svg {
60
+ transform: rotate(180deg);
61
+ }
62
+ }
63
+ `
64
+
65
+ const Border = styled.path`
66
+ fill: var(--card-shadow-outline-color);
67
+ `
68
+
69
+ const Shape = styled.path`
70
+ fill: var(--card-bg-color);
71
+ `
62
72
 
63
73
  interface TooltipArrowProps {}
64
74
 
@@ -5,13 +5,13 @@ import {ResponsiveBorderStyleProps} from './types'
5
5
 
6
6
  const BORDER_VALUE = '1px solid var(--card-border-color)'
7
7
 
8
- // export function responsiveBorderStyle(): Array<
9
- // (props: ResponsiveBorderStyleProps & ThemeProps) => CSSObject[]
10
- // > {
11
- // return [responsiveBorderStyle, borderTop, borderRight, borderBottom, borderLeft]
12
- // }
8
+ export function responsiveBorderStyle(): Array<
9
+ (props: ResponsiveBorderStyleProps & ThemeProps) => CSSObject[]
10
+ > {
11
+ return [border, borderTop, borderRight, borderBottom, borderLeft]
12
+ }
13
13
 
14
- export function responsiveBorderStyle(props: ResponsiveBorderStyleProps & ThemeProps): CSSObject[] {
14
+ function border(props: ResponsiveBorderStyleProps & ThemeProps) {
15
15
  const {theme} = props
16
16
  const {media} = theme.sanity
17
17
 
@@ -20,9 +20,7 @@ export function responsiveBorderStyle(props: ResponsiveBorderStyleProps & ThemeP
20
20
  )
21
21
  }
22
22
 
23
- export function responsiveBorderTopStyle(
24
- props: ResponsiveBorderStyleProps & ThemeProps
25
- ): CSSObject[] {
23
+ function borderTop(props: ResponsiveBorderStyleProps & ThemeProps) {
26
24
  const {theme} = props
27
25
  const {media} = theme.sanity
28
26
 
@@ -31,9 +29,7 @@ export function responsiveBorderTopStyle(
31
29
  )
32
30
  }
33
31
 
34
- export function responsiveBorderRightStyle(
35
- props: ResponsiveBorderStyleProps & ThemeProps
36
- ): CSSObject[] {
32
+ function borderRight(props: ResponsiveBorderStyleProps & ThemeProps) {
37
33
  const {theme} = props
38
34
  const {media} = theme.sanity
39
35
 
@@ -42,9 +38,7 @@ export function responsiveBorderRightStyle(
42
38
  )
43
39
  }
44
40
 
45
- export function responsiveBorderBottomStyle(
46
- props: ResponsiveBorderStyleProps & ThemeProps
47
- ): CSSObject[] {
41
+ function borderBottom(props: ResponsiveBorderStyleProps & ThemeProps) {
48
42
  const {theme} = props
49
43
  const {media} = theme.sanity
50
44
 
@@ -53,9 +47,7 @@ export function responsiveBorderBottomStyle(
53
47
  )
54
48
  }
55
49
 
56
- export function responsiveBorderLeftStyle(
57
- props: ResponsiveBorderStyleProps & ThemeProps
58
- ): CSSObject[] {
50
+ function borderLeft(props: ResponsiveBorderStyleProps & ThemeProps) {
59
51
  const {theme} = props
60
52
  const {media} = theme.sanity
61
53
 
@@ -24,20 +24,18 @@ export function boxStyle(): CSSObject {
24
24
  return BASE_STYLE
25
25
  }
26
26
 
27
- // export function responsiveBoxStyle(): Array<
28
- // (props: ResponsiveBoxStyleProps & ThemeProps) => CSSObject[]
29
- // > {
30
- // return [
31
- // responsiveBoxSizingStyle,
32
- // responsiveBoxHeightStyle,
33
- // responsiveBoxOverflowStyle,
34
- // responsiveBoxDisplayStyle,
35
- // ]
36
- // }
27
+ export function responsiveBoxStyle(): Array<
28
+ (props: ResponsiveBoxStyleProps & ThemeProps) => CSSObject[]
29
+ > {
30
+ return [
31
+ responsiveBoxSizingStyle,
32
+ responsiveBoxHeightStyle,
33
+ responsiveBoxOverflowStyle,
34
+ responsiveBoxDisplayStyle,
35
+ ]
36
+ }
37
37
 
38
- export function responsiveBoxDisplayStyle(
39
- props: ResponsiveBoxStyleProps & ThemeProps
40
- ): CSSObject[] {
38
+ function responsiveBoxDisplayStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
41
39
  const {theme} = props
42
40
  const {media} = theme.sanity
43
41
 
@@ -46,7 +44,7 @@ export function responsiveBoxDisplayStyle(
46
44
  }))
47
45
  }
48
46
 
49
- export function responsiveBoxSizingStyle(props: ResponsiveBoxStyleProps & ThemeProps): CSSObject[] {
47
+ function responsiveBoxSizingStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
50
48
  const {theme} = props
51
49
  const {media} = theme.sanity
52
50
 
@@ -55,7 +53,7 @@ export function responsiveBoxSizingStyle(props: ResponsiveBoxStyleProps & ThemeP
55
53
  }))
56
54
  }
57
55
 
58
- export function responsiveBoxHeightStyle(props: ResponsiveBoxStyleProps & ThemeProps): CSSObject[] {
56
+ function responsiveBoxHeightStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
59
57
  const {theme} = props
60
58
  const {media} = theme.sanity
61
59
 
@@ -64,9 +62,7 @@ export function responsiveBoxHeightStyle(props: ResponsiveBoxStyleProps & ThemeP
64
62
  }))
65
63
  }
66
64
 
67
- export function responsiveBoxOverflowStyle(
68
- props: ResponsiveBoxStyleProps & ThemeProps
69
- ): CSSObject[] {
65
+ function responsiveBoxOverflowStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
70
66
  const {theme} = props
71
67
  const {media} = theme.sanity
72
68
 
@@ -4,11 +4,17 @@ import {_responsive} from '../helpers'
4
4
  import {ThemeProps} from '../types'
5
5
  import {ResponsiveFlexItemStyleProps} from './types'
6
6
 
7
- export const __tmp_flexItemStyle: CSSObject = {
7
+ const BASE_STYLE: CSSObject = {
8
8
  minWidth: 0,
9
9
  minHeight: 0,
10
10
  }
11
11
 
12
+ export function flexItemStyle(): Array<
13
+ CSSObject | ((props: ResponsiveFlexItemStyleProps & ThemeProps) => CSSObject[])
14
+ > {
15
+ return [BASE_STYLE, responsiveFlexItemStyle]
16
+ }
17
+
12
18
  export function responsiveFlexItemStyle(
13
19
  props: ResponsiveFlexItemStyleProps & ThemeProps
14
20
  ): CSSObject[] {
@@ -3,19 +3,24 @@ import {rem, _responsive} from '../helpers'
3
3
  import {ThemeProps} from '../types'
4
4
  import {ResponsiveFlexStyleProps} from './types'
5
5
 
6
- export const __tmp_flexStyle: CSSObject = {
6
+ const BASE_STYLE: CSSObject = {
7
7
  '&&:not([hidden])': {
8
8
  display: 'flex',
9
9
  },
10
10
  }
11
11
 
12
- // export function responsiveFlexStyle(): Array<
13
- // CSSObject | ((props: ResponsiveFlexStyleProps & ThemeProps) => CSSObject[])
14
- // > {
15
- // return [
16
-
17
- // ]
18
- // }
12
+ export function responsiveFlexStyle(): Array<
13
+ CSSObject | ((props: ResponsiveFlexStyleProps & ThemeProps) => CSSObject[])
14
+ > {
15
+ return [
16
+ BASE_STYLE,
17
+ responsiveFlexAlignStyle,
18
+ responsiveFlexGapStyle,
19
+ responsiveFlexWrapStyle,
20
+ responsiveFlexJustifyStyle,
21
+ responsiveFlexDirectionStyle,
22
+ ]
23
+ }
19
24
 
20
25
  export function responsiveFlexAlignStyle(
21
26
  props: ResponsiveFlexStyleProps & ThemeProps
@@ -28,7 +33,7 @@ export function responsiveFlexAlignStyle(
28
33
  })
29
34
  }
30
35
 
31
- export function responsiveFlexGapStyle(props: ResponsiveFlexStyleProps & ThemeProps): CSSObject[] {
36
+ function responsiveFlexGapStyle(props: ResponsiveFlexStyleProps & ThemeProps) {
32
37
  const {theme} = props
33
38
  const {media, space} = theme.sanity
34
39
 
@@ -3,18 +3,18 @@ import {_responsive} from '../helpers'
3
3
  import {ThemeProps} from '../types'
4
4
  import {ResponsiveGridItemStyleProps} from './types'
5
5
 
6
- // export function responsiveGridItemStyle(): Array<
7
- // (props: ResponsiveGridItemStyleProps & ThemeProps) => CSSObject[]
8
- // > {
9
- // return [
10
- // responsiveGridItemRowStyle,
11
- // responsiveGridItemRowStartStyle,
12
- // responsiveGridItemRowEndStyle,
13
- // responsiveGridItemColumnStyle,
14
- // responsiveGridItemColumnStartStyle,
15
- // responsiveGridItemColumnEndStyle,
16
- // ]
17
- // }
6
+ export function responsiveGridItemStyle(): Array<
7
+ (props: ResponsiveGridItemStyleProps & ThemeProps) => CSSObject[]
8
+ > {
9
+ return [
10
+ responsiveGridItemRowStyle,
11
+ responsiveGridItemRowStartStyle,
12
+ responsiveGridItemRowEndStyle,
13
+ responsiveGridItemColumnStyle,
14
+ responsiveGridItemColumnStartStyle,
15
+ responsiveGridItemColumnEndStyle,
16
+ ]
17
+ }
18
18
 
19
19
  const GRID_ITEM_ROW = {
20
20
  auto: 'auto',
@@ -26,9 +26,7 @@ const GRID_ITEM_COLUMN = {
26
26
  full: '1 / -1',
27
27
  }
28
28
 
29
- export function responsiveGridItemRowStyle(
30
- props: ResponsiveGridItemStyleProps & ThemeProps
31
- ): CSSObject[] {
29
+ function responsiveGridItemRowStyle(props: ResponsiveGridItemStyleProps & ThemeProps) {
32
30
  const {theme} = props
33
31
  const {media} = theme.sanity
34
32
 
@@ -41,9 +39,7 @@ export function responsiveGridItemRowStyle(
41
39
  })
42
40
  }
43
41
 
44
- export function responsiveGridItemRowStartStyle(
45
- props: ResponsiveGridItemStyleProps & ThemeProps
46
- ): CSSObject[] {
42
+ function responsiveGridItemRowStartStyle(props: ResponsiveGridItemStyleProps & ThemeProps) {
47
43
  const {theme} = props
48
44
  const {media} = theme.sanity
49
45
 
@@ -52,18 +48,14 @@ export function responsiveGridItemRowStartStyle(
52
48
  }))
53
49
  }
54
50
 
55
- export function responsiveGridItemRowEndStyle(
56
- props: ResponsiveGridItemStyleProps & ThemeProps
57
- ): CSSObject[] {
51
+ function responsiveGridItemRowEndStyle(props: ResponsiveGridItemStyleProps & ThemeProps) {
58
52
  const {theme} = props
59
53
  const {media} = theme.sanity
60
54
 
61
55
  return _responsive(media, props.$rowEnd, (rowEnd) => ({gridRowEnd: rowEnd}))
62
56
  }
63
57
 
64
- export function responsiveGridItemColumnStyle(
65
- props: ResponsiveGridItemStyleProps & ThemeProps
66
- ): CSSObject[] {
58
+ function responsiveGridItemColumnStyle(props: ResponsiveGridItemStyleProps & ThemeProps) {
67
59
  const {theme} = props
68
60
  const {media} = theme.sanity
69
61
 
@@ -76,9 +68,7 @@ export function responsiveGridItemColumnStyle(
76
68
  })
77
69
  }
78
70
 
79
- export function responsiveGridItemColumnStartStyle(
80
- props: ResponsiveGridItemStyleProps & ThemeProps
81
- ): CSSObject[] {
71
+ function responsiveGridItemColumnStartStyle(props: ResponsiveGridItemStyleProps & ThemeProps) {
82
72
  const {theme} = props
83
73
  const {media} = theme.sanity
84
74
 
@@ -87,9 +77,7 @@ export function responsiveGridItemColumnStartStyle(
87
77
  }))
88
78
  }
89
79
 
90
- export function responsiveGridItemColumnEndStyle(
91
- props: ResponsiveGridItemStyleProps & ThemeProps
92
- ): CSSObject[] {
80
+ function responsiveGridItemColumnEndStyle(props: ResponsiveGridItemStyleProps & ThemeProps) {
93
81
  const {theme} = props
94
82
  const {media} = theme.sanity
95
83
 
@@ -3,7 +3,7 @@ import {rem, _responsive} from '../helpers'
3
3
  import {ThemeProps} from '../types'
4
4
  import {ResponsiveGridStyleProps} from './types'
5
5
 
6
- export const __tmp_gridStyle: CSSObject = {
6
+ const GRID_CSS = {
7
7
  '&&:not([hidden])': {
8
8
  display: 'grid',
9
9
  },
@@ -26,25 +26,23 @@ const GRID_AUTO_ROWS = {
26
26
  fr: 'minmax(0, 1fr)',
27
27
  }
28
28
 
29
- // export function responsiveGridStyle(): Array<
30
- // CSSObject | ((props: ResponsiveGridStyleProps & ThemeProps) => CSSObject[])
31
- // > {
32
- // return [
33
- // __tmp_gridStyle,
34
- // responsiveGridAutoFlowStyle,
35
- // responsiveGridAutoRowsStyle,
36
- // responsiveGridAutoColsStyle,
37
- // responsiveGridColumnsStyle,
38
- // responsiveGridRowsStyle,
39
- // responsiveGridGapStyle,
40
- // responsiveGridGapXStyle,
41
- // responsiveGridGapYStyle,
42
- // ]
43
- // }
44
-
45
- export function responsiveGridAutoFlowStyle(
46
- props: ResponsiveGridStyleProps & ThemeProps
47
- ): CSSObject[] {
29
+ export function responsiveGridStyle(): Array<
30
+ CSSObject | ((props: ResponsiveGridStyleProps & ThemeProps) => CSSObject[])
31
+ > {
32
+ return [
33
+ GRID_CSS,
34
+ responsiveGridAutoFlowStyle,
35
+ responsiveGridAutoRowsStyle,
36
+ responsiveGridAutoColsStyle,
37
+ responsiveGridColumnsStyle,
38
+ responsiveGridRowsStyle,
39
+ responsiveGridGapStyle,
40
+ responsiveGridGapXStyle,
41
+ responsiveGridGapYStyle,
42
+ ]
43
+ }
44
+
45
+ function responsiveGridAutoFlowStyle(props: ResponsiveGridStyleProps & ThemeProps) {
48
46
  const {theme} = props
49
47
  const {media} = theme.sanity
50
48
 
@@ -53,9 +51,7 @@ export function responsiveGridAutoFlowStyle(
53
51
  }))
54
52
  }
55
53
 
56
- export function responsiveGridAutoRowsStyle(
57
- props: ResponsiveGridStyleProps & ThemeProps
58
- ): CSSObject[] {
54
+ function responsiveGridAutoRowsStyle(props: ResponsiveGridStyleProps & ThemeProps) {
59
55
  const {theme} = props
60
56
  const {media} = theme.sanity
61
57
 
@@ -64,9 +60,7 @@ export function responsiveGridAutoRowsStyle(
64
60
  }))
65
61
  }
66
62
 
67
- export function responsiveGridAutoColsStyle(
68
- props: ResponsiveGridStyleProps & ThemeProps
69
- ): CSSObject[] {
63
+ function responsiveGridAutoColsStyle(props: ResponsiveGridStyleProps & ThemeProps) {
70
64
  const {theme} = props
71
65
  const {media} = theme.sanity
72
66
 
@@ -75,9 +69,7 @@ export function responsiveGridAutoColsStyle(
75
69
  }))
76
70
  }
77
71
 
78
- export function responsiveGridColumnsStyle(
79
- props: ResponsiveGridStyleProps & ThemeProps
80
- ): CSSObject[] {
72
+ function responsiveGridColumnsStyle(props: ResponsiveGridStyleProps & ThemeProps) {
81
73
  const {theme} = props
82
74
  const {media} = theme.sanity
83
75
 
@@ -86,7 +78,7 @@ export function responsiveGridColumnsStyle(
86
78
  }))
87
79
  }
88
80
 
89
- export function responsiveGridRowsStyle(props: ResponsiveGridStyleProps & ThemeProps): CSSObject[] {
81
+ function responsiveGridRowsStyle(props: ResponsiveGridStyleProps & ThemeProps) {
90
82
  const {theme} = props
91
83
  const {media} = theme.sanity
92
84
 
@@ -95,7 +87,7 @@ export function responsiveGridRowsStyle(props: ResponsiveGridStyleProps & ThemeP
95
87
  }))
96
88
  }
97
89
 
98
- export function responsiveGridGapStyle(props: ResponsiveGridStyleProps & ThemeProps): CSSObject[] {
90
+ function responsiveGridGapStyle(props: ResponsiveGridStyleProps & ThemeProps) {
99
91
  const {theme} = props
100
92
  const {media, space} = theme.sanity
101
93
 
@@ -104,7 +96,7 @@ export function responsiveGridGapStyle(props: ResponsiveGridStyleProps & ThemePr
104
96
  }))
105
97
  }
106
98
 
107
- export function responsiveGridGapXStyle(props: ResponsiveGridStyleProps & ThemeProps): CSSObject[] {
99
+ function responsiveGridGapXStyle(props: ResponsiveGridStyleProps & ThemeProps) {
108
100
  const {theme} = props
109
101
  const {media, space} = theme.sanity
110
102
 
@@ -113,7 +105,7 @@ export function responsiveGridGapXStyle(props: ResponsiveGridStyleProps & ThemeP
113
105
  }))
114
106
  }
115
107
 
116
- export function responsiveGridGapYStyle(props: ResponsiveGridStyleProps & ThemeProps): CSSObject[] {
108
+ function responsiveGridGapYStyle(props: ResponsiveGridStyleProps & ThemeProps) {
117
109
  const {theme} = props
118
110
  const {media, space} = theme.sanity
119
111
 
@@ -55,13 +55,13 @@ export function _getResponsiveSpace(
55
55
  theme: Theme,
56
56
  props: string[],
57
57
  spaceIndexes: number[] = EMPTY_ARRAY
58
- ): CSSObject[] {
58
+ ): CSSObject[] | null {
59
59
  if (!Array.isArray(spaceIndexes)) {
60
60
  throw new Error('the property must be array of numbers')
61
61
  }
62
62
 
63
63
  if (spaceIndexes.length === 0) {
64
- return []
64
+ return null
65
65
  }
66
66
 
67
67
  return _responsive(theme.sanity.media, spaceIndexes, (spaceIndex) =>
@@ -1,4 +1,3 @@
1
- export * from './compose'
2
1
  export * from './helpers'
3
2
  export * from './types'
4
3