@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,65 +1,59 @@
1
- import {forwardRef, memo} from 'react'
1
+ import {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
3
  import {DEFAULT_POPOVER_ARROW_HEIGHT, DEFAULT_POPOVER_ARROW_WIDTH} from './constants'
4
4
 
5
- const Root = memo(
6
- styled.div({
7
- position: 'absolute',
8
- pointerEvents: 'none',
9
- width: `${DEFAULT_POPOVER_ARROW_WIDTH}px`,
10
- height: `${DEFAULT_POPOVER_ARROW_WIDTH}px`,
11
- fill: 'none',
5
+ const Root = styled.div`
6
+ position: absolute;
7
+ pointer-events: none;
8
+ width: ${DEFAULT_POPOVER_ARROW_WIDTH}px;
9
+ height: ${DEFAULT_POPOVER_ARROW_WIDTH}px;
10
+ fill: none;
12
11
 
13
- ':empty + &': {
14
- display: 'none',
15
- },
12
+ :empty + & {
13
+ display: none;
14
+ }
16
15
 
17
- '& > svg': {
18
- display: 'block',
19
- transformOrigin: `${DEFAULT_POPOVER_ARROW_WIDTH / 2}px ${DEFAULT_POPOVER_ARROW_WIDTH / 2}px`,
20
- },
16
+ & > svg {
17
+ display: block;
18
+ transform-origin: ${DEFAULT_POPOVER_ARROW_WIDTH / 2}px ${DEFAULT_POPOVER_ARROW_WIDTH / 2}px;
19
+ }
21
20
 
22
- '[data-placement^="top"] > &': {
23
- bottom: `-${DEFAULT_POPOVER_ARROW_WIDTH}px`,
24
- },
21
+ [data-placement^='top'] > & {
22
+ bottom: -${DEFAULT_POPOVER_ARROW_WIDTH}px;
23
+ }
25
24
 
26
- '[data-placement^="right"] > &': {
27
- left: `-${DEFAULT_POPOVER_ARROW_WIDTH}px`,
25
+ [data-placement^='right'] > & {
26
+ left: -${DEFAULT_POPOVER_ARROW_WIDTH}px;
28
27
 
29
- '& > svg': {
30
- transform: 'rotate(90deg)',
31
- },
32
- },
28
+ & > svg {
29
+ transform: rotate(90deg);
30
+ }
31
+ }
33
32
 
34
- '[data-placement^="left"] > &': {
35
- right: `-${DEFAULT_POPOVER_ARROW_WIDTH}px`,
33
+ [data-placement^='left'] > & {
34
+ right: -${DEFAULT_POPOVER_ARROW_WIDTH}px;
36
35
 
37
- '& > svg': {
38
- transform: 'rotate(-90deg)',
39
- },
40
- },
36
+ & > svg {
37
+ transform: rotate(-90deg);
38
+ }
39
+ }
41
40
 
42
- '[data-placement^="bottom"] > &': {
43
- top: `-${DEFAULT_POPOVER_ARROW_WIDTH}px`,
41
+ [data-placement^='bottom'] > & {
42
+ top: -${DEFAULT_POPOVER_ARROW_WIDTH}px;
44
43
 
45
- '& > svg': {
46
- transform: 'rotate(180deg)',
47
- },
48
- },
49
- })
50
- )
44
+ & > svg {
45
+ transform: rotate(180deg);
46
+ }
47
+ }
48
+ `
51
49
 
52
- const BorderPath = memo(
53
- styled.path({
54
- fill: 'var(--card-shadow-outline-color)',
55
- })
56
- )
50
+ const BorderPath = styled.path`
51
+ fill: var(--card-shadow-outline-color);
52
+ `
57
53
 
58
- const ShapePath = memo(
59
- styled.path({
60
- fill: 'var(--card-bg-color)',
61
- })
62
- )
54
+ const ShapePath = styled.path`
55
+ fill: var(--card-bg-color);
56
+ `
63
57
 
64
58
  export const PopoverArrow = forwardRef(function PopoverArrow(
65
59
  props: Omit<React.HTMLProps<HTMLDivElement>, 'as'>,
@@ -1,8 +1,8 @@
1
1
  import {Strategy} from '@floating-ui/react-dom'
2
2
  import React, {CSSProperties, forwardRef, memo, useMemo} from 'react'
3
- import {CSSObject} from 'styled-components'
3
+ import styled, {CSSObject} from 'styled-components'
4
4
  import {FLOATING_STATIC_SIDES} from '../../constants'
5
- import {compose, ThemeProps} from '../../styles'
5
+ import {ThemeProps} from '../../styles'
6
6
  import {ThemeColorSchemeKey} from '../../theme'
7
7
  import {BoxOverflow, CardTone, Placement, PopoverMargins} from '../../types'
8
8
  import {useLayer} from '../../utils'
@@ -31,13 +31,15 @@ function popoverCardStyle(props: {$boundaryWidth?: number} & ThemeProps): CSSObj
31
31
  typeof $boundaryWidth === 'number'
32
32
  ? `${$boundaryWidth - DEFAULT_POPOVER_PADDING * 2}px`
33
33
  : undefined,
34
-
35
- height: 'max-content',
36
- minHeight: 'min-content',
37
34
  }
38
35
  }
39
36
 
40
- const Root = memo(compose<{$boundaryWidth?: number}>(Card, [popoverCardStyle]))
37
+ const Root = memo(styled(Card)(popoverCardStyle))
38
+
39
+ const PopoverContainer = memo(styled(Container)`
40
+ max-height: inherit;
41
+ max-width: inherit;
42
+ `)
41
43
 
42
44
  /**
43
45
  * @internal
@@ -51,14 +53,11 @@ export const PopoverCard = memo(
51
53
  arrowRef: React.Ref<HTMLDivElement>
52
54
  arrowX?: number
53
55
  arrowY?: number
54
- availableHeight?: number
55
- availableWidth?: number
56
56
  boundaryWidth?: number
57
57
  overflow?: BoxOverflow
58
58
  padding?: number | number[]
59
59
  placement?: Placement
60
60
  radius?: number | number[]
61
- referenceWidth?: number
62
61
  scheme?: ThemeColorSchemeKey
63
62
  shadow?: number | number[]
64
63
  strategy: Strategy
@@ -75,15 +74,12 @@ export const PopoverCard = memo(
75
74
  arrowRef,
76
75
  arrowX,
77
76
  arrowY,
78
- availableHeight,
79
- availableWidth,
80
77
  boundaryWidth,
81
78
  children,
82
79
  padding,
83
80
  placement,
84
81
  overflow,
85
82
  radius,
86
- referenceWidth: referenceWidthProp,
87
83
  scheme,
88
84
  shadow,
89
85
  strategy,
@@ -104,10 +100,6 @@ export const PopoverCard = memo(
104
100
  )
105
101
 
106
102
  // Translate according to margins
107
- const referenceWidth = referenceWidthProp
108
- ? referenceWidthProp - margins[1] - margins[3]
109
- : undefined
110
-
111
103
  const x = (xProp ?? 0) + margins[3]
112
104
  const y = (yProp ?? 0) + margins[0]
113
105
 
@@ -117,12 +109,9 @@ export const PopoverCard = memo(
117
109
  top: y,
118
110
  left: x,
119
111
  zIndex,
120
- width: referenceWidth,
121
- maxWidth: availableWidth,
122
- maxHeight: availableHeight,
123
112
  ...style,
124
113
  }),
125
- [availableHeight, availableWidth, referenceWidth, strategy, style, x, y, zIndex]
114
+ [strategy, style, x, y, zIndex]
126
115
  )
127
116
 
128
117
  const staticSide = placement && FLOATING_STATIC_SIDES[placement.split('-')[0]]
@@ -150,10 +139,11 @@ export const PopoverCard = memo(
150
139
  ref={ref}
151
140
  scheme={scheme}
152
141
  shadow={shadow}
142
+ sizing="border"
153
143
  style={rootStyle}
154
144
  tone={tone}
155
145
  >
156
- <Container
146
+ <PopoverContainer
157
147
  data-ui="Popover__wrapper"
158
148
  flex={1}
159
149
  overflow={overflow}
@@ -162,7 +152,7 @@ export const PopoverCard = memo(
162
152
  width={width}
163
153
  >
164
154
  {children}
165
- </Container>
155
+ </PopoverContainer>
166
156
 
167
157
  {arrow && <PopoverArrow ref={arrowRef} style={arrowStyle} />}
168
158
  </Root>
@@ -1,7 +1,11 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('primitives/radio', 'Radio', [
5
- {name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
6
- {name: 'example', title: 'Example', component: lazy(() => import('./example'))},
7
- ])
4
+ export default defineScope({
5
+ name: 'primitives/radio',
6
+ title: 'Radio',
7
+ stories: [
8
+ {name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
9
+ {name: 'example', title: 'Example', component: lazy(() => import('./example'))},
10
+ ],
11
+ })
@@ -1,4 +1,4 @@
1
- import {forwardRef, memo} from 'react'
1
+ import {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
3
  import {useForwardedRef, useCustomValidity} from '../../hooks'
4
4
  import {radioBaseStyle, inputElementStyle} from './styles'
@@ -10,8 +10,8 @@ export interface RadioProps {
10
10
  customValidity?: string
11
11
  }
12
12
 
13
- const Root = memo(styled.div(radioBaseStyle))
14
- const Input = memo(styled.input(inputElementStyle))
13
+ const Root = styled.div(radioBaseStyle)
14
+ const Input = styled.input(inputElementStyle)
15
15
 
16
16
  /**
17
17
  * @public
@@ -1,105 +1,105 @@
1
- import {CSSObject} from 'styled-components'
1
+ import {css, FlattenSimpleInterpolation} from 'styled-components'
2
2
  import {rem, ThemeProps} from '../../styles'
3
3
  import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
4
4
 
5
- export function radioBaseStyle(): CSSObject {
6
- return {
7
- position: 'relative',
5
+ export function radioBaseStyle(): FlattenSimpleInterpolation {
6
+ return css`
7
+ position: relative;
8
8
 
9
- '&:not([hidden])': {
10
- display: 'inline-block',
11
- },
9
+ &:not([hidden]) {
10
+ display: inline-block;
11
+ }
12
12
 
13
- '&[data-read-only]': {
14
- outline: '1px solid red',
15
- },
16
- }
13
+ &[data-read-only] {
14
+ outline: 1px solid red;
15
+ }
16
+ `
17
17
  }
18
18
 
19
- export function inputElementStyle(props: ThemeProps): CSSObject {
19
+ export function inputElementStyle(props: ThemeProps): FlattenSimpleInterpolation {
20
20
  const {theme} = props
21
21
  const {focusRing, input} = theme.sanity
22
22
  const color = theme.sanity.color.input
23
23
  const dist = (input.radio.size - input.radio.markSize) / 2
24
24
 
25
- return {
26
- appearance: 'none',
27
- position: 'absolute',
28
- top: 0,
29
- left: 0,
30
- opacity: 0,
31
- height: '100%',
32
- width: '100%',
33
- outline: 'none',
34
- zIndex: 1,
35
- padding: 0,
36
- margin: 0,
37
- borderRadius: rem(input.radio.size / 2),
38
- border: 'none',
25
+ return css`
26
+ appearance: none;
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ opacity: 0;
31
+ height: 100%;
32
+ width: 100%;
33
+ outline: none;
34
+ z-index: 1;
35
+ padding: 0;
36
+ margin: 0;
37
+ border-radius: ${rem(input.radio.size / 2)};
38
+ border: none;
39
39
 
40
40
  /* enabled */
41
- '& + span': {
42
- display: 'block',
43
- position: 'relative',
44
- height: rem(input.radio.size),
45
- width: rem(input.radio.size),
46
- borderRadius: rem(input.radio.size / 2),
47
- background: color.default.enabled.bg,
48
- boxShadow: focusRingBorderStyle({
41
+ & + span {
42
+ display: block;
43
+ position: relative;
44
+ height: ${rem(input.radio.size)};
45
+ width: ${rem(input.radio.size)};
46
+ border-radius: ${rem(input.radio.size / 2)};
47
+ background: ${color.default.enabled.bg};
48
+ box-shadow: ${focusRingBorderStyle({
49
49
  color: color.default.enabled.border,
50
50
  width: input.border.width,
51
- }),
51
+ })};
52
52
 
53
- '&::after': {
54
- content: '""',
55
- position: 'absolute',
56
- top: rem(dist),
57
- left: rem(dist),
58
- height: rem(input.radio.markSize),
59
- width: rem(input.radio.markSize),
60
- borderRadius: rem(input.radio.markSize / 2),
61
- background: color.default.enabled.fg,
62
- opacity: 0,
63
- },
64
- },
53
+ &::after {
54
+ content: '';
55
+ position: absolute;
56
+ top: ${rem(dist)};
57
+ left: ${rem(dist)};
58
+ height: ${rem(input.radio.markSize)};
59
+ width: ${rem(input.radio.markSize)};
60
+ border-radius: ${rem(input.radio.markSize / 2)};
61
+ background: ${color.default.enabled.fg};
62
+ opacity: 0;
63
+ }
64
+ }
65
65
 
66
66
  /* focused */
67
- '&:not(:disabled):focus + span': {
68
- boxShadow: focusRingStyle({
67
+ &:not(:disabled):focus + span {
68
+ box-shadow: ${focusRingStyle({
69
69
  border: {width: input.border.width, color: color.default.enabled.border},
70
70
  focusRing,
71
- }),
72
- },
71
+ })};
72
+ }
73
73
 
74
- '&:not(:disabled):focus:not(:focus-visible) + span': {
75
- boxShadow: focusRingBorderStyle({
74
+ &:not(:disabled):focus:not(:focus-visible) + span {
75
+ box-shadow: ${focusRingBorderStyle({
76
76
  color: color.default.enabled.border,
77
77
  width: input.border.width,
78
- }),
79
- },
78
+ })};
79
+ }
80
80
 
81
- '&:checked + span::after': {
82
- opacity: 1,
83
- },
81
+ &:checked + span::after {
82
+ opacity: 1;
83
+ }
84
84
 
85
85
  /* read only */
86
- '&[data-read-only] + span': {
87
- boxShadow: `0 0 0 1px ${color.default.readOnly.border}`,
88
- background: color.default.readOnly.bg,
86
+ &[data-read-only] + span {
87
+ box-shadow: 0 0 0 1px ${color.default.readOnly.border};
88
+ background: ${color.default.readOnly.bg};
89
89
 
90
- '&::after': {
91
- background: color.default.readOnly.fg,
92
- },
93
- },
90
+ &::after {
91
+ background: ${color.default.readOnly.fg};
92
+ }
93
+ }
94
94
 
95
95
  /* disabled */
96
- '&:not([data-read-only]):disabled + span': {
97
- boxShadow: `0 0 0 1px ${color.default.disabled.border}`,
98
- background: color.default.disabled.bg,
96
+ &:not([data-read-only]):disabled + span {
97
+ box-shadow: 0 0 0 1px ${color.default.disabled.border};
98
+ background: ${color.default.disabled.bg};
99
99
 
100
- '&::after': {
101
- background: color.default.disabled.fg,
102
- },
103
- },
104
- }
100
+ &::after {
101
+ background: ${color.default.disabled.fg};
102
+ }
103
+ }
104
+ `
105
105
  }
@@ -1,7 +1,11 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('primitives/select', 'Select', [
5
- {name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
6
- {name: 'read-only', title: 'Read-only', component: lazy(() => import('./readOnly'))},
7
- ])
4
+ export default defineScope({
5
+ name: 'primitives/select',
6
+ title: 'Select',
7
+ stories: [
8
+ {name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
9
+ {name: 'read-only', title: 'Read-only', component: lazy(() => import('./readOnly'))},
10
+ ],
11
+ })
@@ -1,5 +1,5 @@
1
1
  import {SelectIcon} from '@sanity/icons'
2
- import {forwardRef, memo} from 'react'
2
+ import {forwardRef} from 'react'
3
3
  import styled from 'styled-components'
4
4
  import {useForwardedRef, useCustomValidity, useArrayProp} from '../../hooks'
5
5
  import {Box} from '../box'
@@ -17,18 +17,16 @@ export interface SelectProps {
17
17
  customValidity?: string
18
18
  }
19
19
 
20
- const Root = memo(styled.div(selectStyle.root))
20
+ const Root = styled.div(selectStyle.root)
21
21
 
22
- const Input = memo(
23
- styled.select<{
24
- $fontSize: number[]
25
- $padding: number[]
26
- $radius: number[]
27
- $space: number[]
28
- }>(selectStyle.input)
29
- )
22
+ const Input = styled.select<{
23
+ $fontSize: number[]
24
+ $padding: number[]
25
+ $radius: number[]
26
+ $space: number[]
27
+ }>(selectStyle.input)
30
28
 
31
- const IconBox = memo(styled(Box)(selectStyle.iconBox))
29
+ const IconBox = styled(Box)(selectStyle.iconBox)
32
30
 
33
31
  /**
34
32
  * @public