@sanity/ui 3.0.0-static.0 → 3.0.0-static.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 (216) hide show
  1. package/dist/_chunks-cjs/buildCommand.js +1387 -681
  2. package/dist/_chunks-cjs/buildCommand.js.map +1 -1
  3. package/dist/cli.js +4 -2
  4. package/dist/cli.js.map +1 -1
  5. package/dist/css.d.mts +131 -12
  6. package/dist/css.d.ts +131 -12
  7. package/dist/css.esm.js +1450 -791
  8. package/dist/css.esm.js.map +1 -1
  9. package/dist/css.js +1449 -790
  10. package/dist/css.js.map +1 -1
  11. package/dist/css.mjs +1450 -791
  12. package/dist/css.mjs.map +1 -1
  13. package/dist/index.d.mts +84 -76
  14. package/dist/index.d.ts +84 -76
  15. package/dist/index.esm.js +2734 -3146
  16. package/dist/index.esm.js.map +1 -1
  17. package/dist/index.js +2733 -3145
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +2734 -3146
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/sanity-theme.css +1 -1
  22. package/dist/system.css +1590 -1158
  23. package/dist/theme.esm.js +1565 -452
  24. package/dist/theme.esm.js.map +1 -1
  25. package/dist/theme.js +1599 -484
  26. package/dist/theme.js.map +1 -1
  27. package/dist/theme.mjs +1565 -452
  28. package/dist/theme.mjs.map +1 -1
  29. package/package.json +22 -22
  30. package/src/core/__workshop__/constants.ts +14 -5
  31. package/src/core/__workshop__/fontsPlugin.tsx +1 -1
  32. package/src/core/_compat/index.ts +2 -0
  33. package/src/core/{styles → _compat/styles}/box/boxStyle.ts +1 -1
  34. package/src/core/{styles → _compat/styles}/box/types.ts +1 -1
  35. package/src/core/{styles → _compat/styles}/card/_cardColorStyle.ts +2 -2
  36. package/src/core/{styles → _compat/styles}/flex/flexItemStyle.ts +1 -1
  37. package/src/core/{styles → _compat/styles}/font/types.ts +1 -1
  38. package/src/core/{styles → _compat/styles}/grid/types.ts +1 -1
  39. package/src/core/{styles → _compat/styles}/helpers.ts +1 -1
  40. package/src/core/{styles → _compat/styles}/input/textInputStyle.ts +2 -2
  41. package/src/core/{styles → _compat/styles}/radius/types.ts +1 -1
  42. package/src/core/{styles → _compat/styles}/shadow/shadowStyle.ts +1 -1
  43. package/src/core/components/autocomplete/__workshop__/custom.tsx +5 -4
  44. package/src/core/components/autocomplete/__workshop__/example.tsx +3 -2
  45. package/src/core/components/autocomplete/autocomplete.tsx +5 -5
  46. package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
  47. package/src/core/components/dialog/__workshop__/props.tsx +2 -0
  48. package/src/core/components/dialog/dialog.tsx +1 -5
  49. package/src/core/components/hotkeys/hotkeys.tsx +1 -1
  50. package/src/core/components/menu/menu.tsx +8 -10
  51. package/src/core/components/menu/menuDivider.tsx +16 -0
  52. package/src/core/components/menu/menuGroup.tsx +2 -8
  53. package/src/core/components/menu/menuItem.tsx +1 -1
  54. package/src/core/components/skeleton/skeleton.tsx +14 -20
  55. package/src/core/components/skeleton/textSkeleton.tsx +72 -48
  56. package/src/core/components/tab/tab.tsx +0 -1
  57. package/src/core/components/tab/tabList.tsx +4 -21
  58. package/src/core/components/tab/tabPanel.tsx +1 -0
  59. package/src/core/components/toast/toast.tsx +27 -14
  60. package/src/core/components/toast/toastProvider.tsx +4 -13
  61. package/src/core/components/tree/tree.tsx +1 -2
  62. package/src/core/components/tree/treeGroup.tsx +4 -1
  63. package/src/core/components/tree/treeItem.tsx +11 -15
  64. package/src/core/hooks/useArrayProp.ts +1 -1
  65. package/src/core/index.ts +0 -1
  66. package/src/core/lib/styled/members.ts +2 -2
  67. package/src/core/primitives/avatar/avatar.tsx +0 -21
  68. package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
  69. package/src/core/primitives/avatar/avatarStack.tsx +1 -1
  70. package/src/core/primitives/avatar/styles.ts +2 -2
  71. package/src/core/primitives/box/box.tsx +4 -1
  72. package/src/core/primitives/button/__workshop__/props.tsx +2 -1
  73. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
  74. package/src/core/primitives/button/__workshop__/stacked.tsx +2 -1
  75. package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
  76. package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
  77. package/src/core/primitives/button/styles.ts +3 -3
  78. package/src/core/primitives/card/__workshop__/props.tsx +2 -2
  79. package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
  80. package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
  81. package/src/core/primitives/card/card.tsx +7 -10
  82. package/src/core/primitives/code/code.tsx +2 -4
  83. package/src/core/primitives/container/styles.ts +1 -1
  84. package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
  85. package/src/core/primitives/flex/flex.tsx +1 -13
  86. package/src/core/primitives/grid/grid.tsx +5 -19
  87. package/src/core/primitives/heading/heading.tsx +8 -25
  88. package/src/core/primitives/heading/styles.ts +1 -1
  89. package/src/core/primitives/inline/inline.tsx +3 -12
  90. package/src/core/primitives/inline/styles.ts +1 -1
  91. package/src/core/primitives/label/label.tsx +4 -9
  92. package/src/core/primitives/label/styles.ts +1 -1
  93. package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
  94. package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -1
  95. package/src/core/primitives/popover/popover.tsx +1 -1
  96. package/src/core/primitives/popover/popoverCard.tsx +1 -1
  97. package/src/core/primitives/radio/radio.tsx +1 -1
  98. package/src/core/primitives/radio/styles.ts +2 -2
  99. package/src/core/primitives/select/select.tsx +1 -1
  100. package/src/core/primitives/select/styles.ts +3 -3
  101. package/src/core/primitives/spinner/__workshop__/Props.tsx +2 -1
  102. package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +16 -0
  103. package/src/core/primitives/spinner/spinner.tsx +2 -2
  104. package/src/core/primitives/stack/styles.ts +1 -1
  105. package/src/core/primitives/switch/styles.ts +2 -2
  106. package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
  107. package/src/core/primitives/text/styles.ts +1 -1
  108. package/src/core/primitives/text/text.tsx +1 -4
  109. package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
  110. package/src/core/primitives/textArea/textArea.tsx +3 -3
  111. package/src/core/primitives/textInput/__workshop__/plain.tsx +3 -2
  112. package/src/core/primitives/textInput/textInput.tsx +16 -83
  113. package/src/core/primitives/tooltip/tooltipCard.tsx +5 -5
  114. package/src/core/primitives/types.ts +1 -0
  115. package/src/core/theme/__workshop__/build/Root.tsx +1 -1
  116. package/src/core/theme/__workshop__/build/story.tsx +2 -4
  117. package/src/core/theme/themeProvider.tsx +1 -1
  118. package/src/core/types/box.ts +22 -16
  119. package/src/core/types/grid.ts +17 -12
  120. package/src/core/types/text.ts +7 -4
  121. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
  122. package/src/core/utils/layer/layer.tsx +2 -2
  123. package/src/core/utils/virtualList/virtualList.tsx +1 -1
  124. package/src/css/compile/{comileRules.ts → compileRules.ts} +2 -5
  125. package/src/css/compile/compileSystem.ts +1 -1
  126. package/src/css/compile/compileTheme.ts +4 -1
  127. package/src/css/components/breadcrumbs/rules.ts +18 -0
  128. package/src/css/components/menu/index.ts +1 -0
  129. package/src/css/components/menu/menu.ts +5 -0
  130. package/src/css/components/menu/rules.ts +10 -0
  131. package/src/css/components/skeleton/index.ts +2 -0
  132. package/src/css/components/skeleton/rules.ts +106 -0
  133. package/src/css/components/skeleton/skeleton.ts +31 -0
  134. package/src/css/components/skeleton/types.ts +24 -0
  135. package/src/css/components/toast/rules.ts +68 -0
  136. package/src/css/components/tree/rules.ts +115 -0
  137. package/src/css/index.ts +4 -0
  138. package/src/css/primitives/box/box.ts +5 -1
  139. package/src/css/primitives/box/types.ts +7 -8
  140. package/src/css/primitives/card/rules.ts +161 -13
  141. package/src/css/primitives/checkbox/__styles.ts +115 -113
  142. package/src/css/primitives/selectable/__style.ts +117 -115
  143. package/src/css/primitives/spinner/rules.ts +5 -7
  144. package/src/css/primitives/spinner/spinner.ts +4 -0
  145. package/src/css/primitives/textInput/index.ts +1 -0
  146. package/src/css/primitives/textInput/rules.ts +159 -64
  147. package/src/css/primitives/textInput/textInput.ts +11 -3
  148. package/src/css/primitives/textInput/types.ts +8 -0
  149. package/src/css/rules.ts +16 -38
  150. package/src/css/styles/font/font.ts +7 -2
  151. package/src/css/styles/font/rules.ts +23 -0
  152. package/src/css/styles/font/types.ts +6 -0
  153. package/src/css/styles/gap/rules.ts +6 -6
  154. package/src/css/styles/grid/grid.ts +13 -0
  155. package/src/css/styles/grid/index.ts +2 -0
  156. package/src/css/styles/grid/rules.ts +112 -1
  157. package/src/css/styles/grid/types.ts +29 -0
  158. package/src/css/styles/margin/rules.ts +58 -54
  159. package/src/css/styles/outline/rules.ts +7 -0
  160. package/src/css/styles/overflow/index.ts +2 -0
  161. package/src/css/styles/overflow/overflow.ts +11 -0
  162. package/src/css/styles/overflow/types.ts +11 -0
  163. package/src/css/styles/padding/rules.ts +50 -48
  164. package/src/css/types.ts +36 -1
  165. package/src/css/varNames.ts +1 -1
  166. package/src/css/vars.ts +86 -0
  167. package/dist/_chunks-cjs/getTheme_v2.js +0 -316
  168. package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
  169. package/dist/_chunks-es/getTheme_v2.mjs +0 -317
  170. package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
  171. package/dist/_legacy/getTheme_v2.esm.js +0 -317
  172. package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
  173. package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -38
  174. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -17
  175. package/src/core/components/menu/menuDivider.ts +0 -13
  176. package/src/core/components/skeleton/styles.ts +0 -50
  177. package/src/core/components/toast/styles.ts +0 -61
  178. package/src/core/components/tree/style.ts +0 -104
  179. package/src/core/primitives/card/styles.ts +0 -146
  180. /package/src/core/{styles → _compat/styles}/border/borderStyle.ts +0 -0
  181. /package/src/core/{styles → _compat/styles}/border/index.ts +0 -0
  182. /package/src/core/{styles → _compat/styles}/border/types.ts +0 -0
  183. /package/src/core/{styles → _compat/styles}/box/index.ts +0 -0
  184. /package/src/core/{styles → _compat/styles}/card/index.ts +0 -0
  185. /package/src/core/{styles → _compat/styles}/flex/flexStyle.ts +0 -0
  186. /package/src/core/{styles → _compat/styles}/flex/index.ts +0 -0
  187. /package/src/core/{styles → _compat/styles}/flex/types.ts +0 -0
  188. /package/src/core/{styles → _compat/styles}/focusRing/index.ts +0 -0
  189. /package/src/core/{styles → _compat/styles}/font/codeFontStyle.ts +0 -0
  190. /package/src/core/{styles → _compat/styles}/font/headingFontStyle.ts +0 -0
  191. /package/src/core/{styles → _compat/styles}/font/index.ts +0 -0
  192. /package/src/core/{styles → _compat/styles}/font/labelFontStyle.ts +0 -0
  193. /package/src/core/{styles → _compat/styles}/font/responsiveFont.ts +0 -0
  194. /package/src/core/{styles → _compat/styles}/font/textAlignStyle.ts +0 -0
  195. /package/src/core/{styles → _compat/styles}/font/textFontStyle.ts +0 -0
  196. /package/src/core/{styles → _compat/styles}/grid/gridItemStyle.ts +0 -0
  197. /package/src/core/{styles → _compat/styles}/grid/gridStyle.ts +0 -0
  198. /package/src/core/{styles → _compat/styles}/grid/index.ts +0 -0
  199. /package/src/core/{styles → _compat/styles}/index.ts +0 -0
  200. /package/src/core/{styles → _compat/styles}/input/index.ts +0 -0
  201. /package/src/core/{styles → _compat/styles}/input/responsiveInputPaddingStyle.ts +0 -0
  202. /package/src/core/{styles → _compat/styles}/internal.ts +0 -0
  203. /package/src/core/{styles → _compat/styles}/margin/index.ts +0 -0
  204. /package/src/core/{styles → _compat/styles}/margin/marginStyle.ts +0 -0
  205. /package/src/core/{styles → _compat/styles}/margin/marginsStyle.test.ts +0 -0
  206. /package/src/core/{styles → _compat/styles}/margin/types.ts +0 -0
  207. /package/src/core/{styles → _compat/styles}/padding/index.ts +0 -0
  208. /package/src/core/{styles → _compat/styles}/padding/paddingStyle.test.ts +0 -0
  209. /package/src/core/{styles → _compat/styles}/padding/paddingStyle.ts +0 -0
  210. /package/src/core/{styles → _compat/styles}/padding/types.ts +0 -0
  211. /package/src/core/{styles → _compat/styles}/radius/index.ts +0 -0
  212. /package/src/core/{styles → _compat/styles}/radius/radiusStyle.ts +0 -0
  213. /package/src/core/{styles → _compat/styles}/shadow/index.ts +0 -0
  214. /package/src/core/{styles → _compat/styles}/shadow/types.ts +0 -0
  215. /package/src/core/{styles → _compat/styles}/types.ts +0 -0
  216. /package/src/core/{_compat.ts → _compat/types.ts} +0 -0
@@ -1,72 +1,106 @@
1
+ import {FONT_TEXT_SIZE, SPACE} from '@sanity/ui/theme'
2
+ // import {_resp} from '../../_resp'
3
+ import {responsiveRules} from '../../responsiveRules'
1
4
  import {Rules} from '../../types'
5
+ import {vars} from '../../vars'
2
6
 
3
7
  export const textInputRules: Rules = {
4
8
  'text-input': {
5
- //
9
+ '--font-family': vars.font.text.family,
6
10
  },
7
11
 
8
- 'text-input-wrapper': {
12
+ ...SPACE.reduce<Rules>((acc, space) => {
13
+ return {
14
+ ...acc,
15
+ ...responsiveRules(`text-input-p-${space}`.replace('.', '_'), {
16
+ '--padding-top': `calc(${vars.space[space]} - var(--font-ascender-height))`,
17
+ '--padding-right': vars.space[space],
18
+ '--padding-bottom': `calc(${vars.space[space]} - var(--font-descender-height))`,
19
+ '--padding-left': vars.space[space],
20
+ }),
21
+ }
22
+ }, {}),
23
+
24
+ ...FONT_TEXT_SIZE.reduce<Rules>((acc, size) => {
25
+ return {
26
+ ...acc,
27
+ ...responsiveRules(`text-input-${size}`, {
28
+ '--font-size': vars.font.text.sizes[size].fontSize,
29
+ '--font-line-height': vars.font.text.sizes[size].lineHeight,
30
+ '--font-letter-spacing': vars.font.text.sizes[size].letterSpacing,
31
+ '--font-ascender-height': vars.font.text.sizes[size].ascenderHeight,
32
+ '--font-descender-height': vars.font.text.sizes[size].descenderHeight,
33
+ }),
34
+ }
35
+ }, {}),
36
+
37
+ 'text-input-element': {
38
+ 'appearance': 'none',
39
+ 'background': 'none',
40
+ 'border': 0,
41
+ 'borderRadius': 0,
42
+ 'outline': 'none',
43
+ 'width': '100%',
44
+ 'boxSizing': 'border-box',
45
+ 'fontFamily': 'var(--font-family)',
46
+ 'fontSize': 'var(--font-size)',
47
+ 'fontWeight': 'var(--font-weight)',
48
+ 'lineHeight': 'var(--font-line-height)',
49
+ 'letterSpacing': 'var(--font-letter-spacing)',
50
+ 'margin': 0,
51
+ 'position': 'relative',
52
+ 'zIndex': 1,
53
+ 'display': 'block',
54
+ 'color': 'var(--input-fg-color)',
55
+ 'paddingTop': 'var(--padding-top)',
56
+ 'paddingRight': 'var(--padding-right)',
57
+ 'paddingBottom': 'var(--padding-bottom)',
58
+ 'paddingLeft': 'var(--padding-left)',
59
+
60
+ '--input-fg-color': 'var(--color-input-default-enabled-fg)',
61
+
9
62
  '@nest': {
10
- '& > input': {
11
- 'appearance': 'none',
12
- 'background': 'none',
13
- 'border': 0,
14
- 'borderRadius': 0,
15
- 'outline': 'none',
16
- 'width': '100%',
17
- 'boxSizing': 'border-box',
18
- 'fontFamily': 'var(--font-family)',
19
- 'fontSize': 'var(--font-size)',
20
- /* font-family: ${font.text.family}, */
21
- /* font-weight: ${($weight && font.text.weights[$weight]) || font.text.weights.regular}, */
22
- 'margin': 0,
23
- 'position': 'relative',
24
- 'zIndex': 1,
25
- 'display': 'block',
26
- 'color': 'var(--input-fg-color)',
27
-
28
- '@nest': {
29
- // NOTE: This is a hack to disable Chrome’s autofill styles
30
- '&:-webkit-autofill, &:-webkit-autofill:hover, &:-webkit-autofill:focus, &:-webkit-autofill:active':
31
- {
32
- WebkitTextFillColor: 'var(--input-fg-color) !important',
33
- transition: 'background-color 5000s',
34
- transitionDelay: '86400s', // 24h
35
- },
36
-
37
- // /* &:is(textarea) */
38
- // &[data-as='textarea'] {
39
- // resize: none;
40
- // }
41
- // &::placeholder {
42
- // color: var(--input-placeholder-color);
43
- // }
44
- // &[data-scheme='${$scheme}'][data-tone='${$tone}'] {
45
- // /* --input-fg-color: ${color.input.default.enabled.fg}; */
46
- // /* --input-placeholder-color: ${color.input.default.enabled.placeholder}; */
47
- // /* enabled */
48
- // &:not(:invalid):not(:disabled):not(:read-only) {
49
- // /* --input-fg-color: ${color.input.default.enabled.fg}; */
50
- // /* --input-placeholder-color: ${color.input.default.enabled.placeholder}; */
51
- // }
52
- // /* disabled */
53
- // &:not(:invalid):disabled {
54
- // /* --input-fg-color: ${color.input.default.disabled.fg}; */
55
- // /* --input-placeholder-color: ${color.input.default.disabled.placeholder}; */
56
- // }
57
- // /* invalid */
58
- // &:invalid {
59
- // /* --input-fg-color: ${color.input.invalid.enabled.fg}; */
60
- // /* --input-placeholder-color: ${color.input.invalid.enabled.placeholder}; */
61
- // }
62
- // /* readOnly */
63
- // &:read-only {
64
- // /* --input-fg-color: ${color.input.default.readOnly.fg}; */
65
- // /* --input-placeholder-color: ${color.input.default.readOnly.placeholder}; */
66
- // }
67
- // }
63
+ // NOTE: This is a hack to disable Chrome’s autofill styles
64
+ '&:-webkit-autofill, &:-webkit-autofill:hover, &:-webkit-autofill:focus, &:-webkit-autofill:active':
65
+ {
66
+ WebkitTextFillColor: 'var(--input-fg-color) !important',
67
+ transition: 'background-color 5000s',
68
+ transitionDelay: '86400s', // 24h
68
69
  },
70
+
71
+ /* &:is(textarea) */
72
+ // '&[data-as="textarea"]': {
73
+ // resize: 'none',
74
+ // },
75
+
76
+ '&::placeholder': {
77
+ color: 'var(--input-placeholder-color)',
69
78
  },
79
+
80
+ // &[data-scheme='${$scheme}'][data-tone='${$tone}'] {
81
+ // /* --input-fg-color: ${color.input.default.enabled.fg}; */
82
+ // /* --input-placeholder-color: ${color.input.default.enabled.placeholder}; */
83
+ // /* enabled */
84
+ // &:not(:invalid):not(:disabled):not(:read-only) {
85
+ // /* --input-fg-color: ${color.input.default.enabled.fg}; */
86
+ // /* --input-placeholder-color: ${color.input.default.enabled.placeholder}; */
87
+ // }
88
+ // /* disabled */
89
+ // &:not(:invalid):disabled {
90
+ // /* --input-fg-color: ${color.input.default.disabled.fg}; */
91
+ // /* --input-placeholder-color: ${color.input.default.disabled.placeholder}; */
92
+ // }
93
+ // /* invalid */
94
+ // &:invalid {
95
+ // /* --input-fg-color: ${color.input.invalid.enabled.fg}; */
96
+ // /* --input-placeholder-color: ${color.input.invalid.enabled.placeholder}; */
97
+ // }
98
+ // /* readOnly */
99
+ // &:read-only {
100
+ // /* --input-fg-color: ${color.input.default.readOnly.fg}; */
101
+ // /* --input-placeholder-color: ${color.input.default.readOnly.placeholder}; */
102
+ // }
103
+ // }
70
104
  },
71
105
  },
72
106
 
@@ -83,8 +117,8 @@ export const textInputRules: Rules = {
83
117
  },
84
118
 
85
119
  'text-input-suffix': {
86
- 'borderTopRightRadius': 0,
87
- 'borderBottomRightRadius': 0,
120
+ 'borderTopLeftRadius': 0,
121
+ 'borderBottomLeftRadius': 0,
88
122
 
89
123
  '@nest': {
90
124
  '& > span': {
@@ -95,7 +129,7 @@ export const textInputRules: Rules = {
95
129
  },
96
130
 
97
131
  'text-input-presentation': {
98
- '--input-box-shadow': 'none',
132
+ '--input-box-shadow': 'inset 0 0 0 1px var(--input-border-color)',
99
133
 
100
134
  'position': 'absolute',
101
135
  'top': 0,
@@ -106,9 +140,11 @@ export const textInputRules: Rules = {
106
140
  'pointerEvents': 'none',
107
141
  'zIndex': 0,
108
142
 
109
- 'backgroundColor': 'var(--card-bg-color)',
143
+ 'backgroundColor': 'var(--input-bg-color)',
110
144
  'boxShadow': 'var(--input-box-shadow)',
111
145
 
146
+ '--input-border-color': 'var(--color-input-default-enabled-border)',
147
+
112
148
  // border-top-left-radius: ${$hasPrefix ? 0 : undefined};
113
149
  // border-bottom-left-radius: ${$hasPrefix ? 0 : undefined};
114
150
  // border-top-right-radius: ${$hasSuffix ? 0 : undefined};
@@ -224,3 +260,62 @@ export const textInputRules: Rules = {
224
260
  // }
225
261
  },
226
262
  }
263
+
264
+ // const Root = styled(Card).attrs({forwardedAs: 'span'})(textInputRootStyle)
265
+
266
+ // const InputRoot = styled.span`
267
+ // flex: 1;
268
+ // min-width: 0;
269
+ // display: block;
270
+ // position: relative;
271
+ // `
272
+
273
+ // const Prefix = styled(Card).attrs({forwardedAs: 'span'})`
274
+ // border-top-right-radius: 0;
275
+ // border-bottom-right-radius: 0;
276
+
277
+ // & > span {
278
+ // display: block;
279
+ // margin: -1px;
280
+ // }
281
+ // `
282
+
283
+ // const Suffix = styled(Card).attrs({forwardedAs: 'span'})`
284
+ // border-top-left-radius: 0;
285
+ // border-bottom-left-radius: 0;
286
+
287
+ // & > span {
288
+ // display: block;
289
+ // margin: -1px;
290
+ // }
291
+ // `
292
+
293
+ // const Input = styled.input<TextInputResponsivePaddingStyleProps & TextInputInputStyleProps>(
294
+ // responsiveInputPaddingStyle,
295
+ // textInputBaseStyle,
296
+ // textInputFontSizeStyle,
297
+ // )
298
+
299
+ // const Presentation = styled.span<ResponsiveRadiusStyleProps & TextInputRepresentationStyleProps>(
300
+ // responsiveRadiusStyle,
301
+ // textInputRepresentationStyle,
302
+ // )
303
+
304
+ // const LeftBox = styled(Box)`
305
+ // position: absolute;
306
+ // top: 0;
307
+ // left: 0;
308
+ // `
309
+
310
+ // const RightBox = styled(Box)`
311
+ // position: absolute;
312
+ // top: 0;
313
+ // right: 0;
314
+ // `
315
+
316
+ // const RightCard = styled(Card)`
317
+ // background-color: transparent;
318
+ // position: absolute;
319
+ // top: 0;
320
+ // right: 0;
321
+ // `
@@ -1,7 +1,15 @@
1
1
  import {_resp} from '../../_resp'
2
2
  import {composeClassNames} from '../../composeClassNames'
3
- import {ResponsiveProp} from '../../types'
3
+ import {TextInputStyleProps} from './types'
4
4
 
5
- export function textInput(props: {size: ResponsiveProp<number>}): string {
6
- return composeClassNames('text-input', _resp('text-input', props.size))
5
+ export function textInput(props: TextInputStyleProps): string {
6
+ return composeClassNames(
7
+ 'text-input',
8
+ _resp('text-input', props.size),
9
+ _resp('text-input-p', props.padding),
10
+ )
11
+ }
12
+
13
+ export function textInputElement(): string {
14
+ return composeClassNames('text-input-element')
7
15
  }
@@ -0,0 +1,8 @@
1
+ import {FontTextSize, Space} from '@sanity/ui/theme'
2
+ import {ResponsiveProp} from '../../types'
3
+
4
+ /** @public */
5
+ export interface TextInputStyleProps {
6
+ padding: ResponsiveProp<Space>
7
+ size: ResponsiveProp<FontTextSize>
8
+ }
package/src/css/rules.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import {breadcrumbsRules} from './components/breadcrumbs/rules'
2
2
  import {dialogRules} from './components/dialog/rules'
3
+ import {menuRules} from './components/menu/rules'
4
+ import {skeletonRules} from './components/skeleton/rules'
3
5
  import {avatarRules} from './primitives/avatar/rules'
4
6
  import {badgeRules} from './primitives/badge/rules'
5
7
  import {boxRules} from './primitives/box/rules'
@@ -31,26 +33,11 @@ import {gapRules} from './styles/gap/rules'
31
33
  import {gridRules} from './styles/grid/rules'
32
34
  import {gridItemRules} from './styles/gridItem/rules'
33
35
  import {heightRules} from './styles/height/rules'
34
- import {
35
- marginBottomRules,
36
- marginLeftRules,
37
- marginRightRules,
38
- marginRules,
39
- marginTopRules,
40
- marginXRules,
41
- marginYRules,
42
- } from './styles/margin/rules'
36
+ import {marginRules} from './styles/margin/rules'
43
37
  import {maxWidthRules} from './styles/maxWidth/rules'
38
+ import {outlineRules} from './styles/outline/rules'
44
39
  import {overflowRules} from './styles/overflow/rules'
45
- import {
46
- paddingBottomRules,
47
- paddingLeftRules,
48
- paddingRightRules,
49
- paddingRules,
50
- paddingTopRules,
51
- paddingXRules,
52
- paddingYRules,
53
- } from './styles/padding/rules'
40
+ import {paddingRules} from './styles/padding/rules'
54
41
  import {pointerEventsRules} from './styles/pointerEvents/rules'
55
42
  import {positionRules} from './styles/position/rules'
56
43
  import {radiusRules} from './styles/radius/rules'
@@ -59,32 +46,21 @@ import {widthRules} from './styles/width/rules'
59
46
  import {type Rules} from './types'
60
47
 
61
48
  export const rules: Rules = {
62
- // styless
49
+ // styles
50
+ ...borderRules,
63
51
  ...displayRules,
64
- ...flexRules,
65
52
  ...flexItemRules,
66
- ...gridItemRules,
67
- ...borderRules,
68
- ...paddingRules,
69
- ...paddingXRules,
70
- ...paddingYRules,
71
- ...paddingTopRules,
72
- ...paddingRightRules,
73
- ...paddingBottomRules,
74
- ...paddingLeftRules,
75
- ...pointerEventsRules,
76
- ...marginRules,
77
- ...marginXRules,
78
- ...marginYRules,
79
- ...marginTopRules,
80
- ...marginRightRules,
81
- ...marginBottomRules,
82
- ...marginLeftRules,
53
+ ...flexRules,
83
54
  ...fontRules,
84
55
  ...gapRules,
56
+ ...gridItemRules,
85
57
  ...gridRules,
86
58
  ...heightRules,
59
+ ...marginRules,
60
+ ...outlineRules,
87
61
  ...overflowRules,
62
+ ...paddingRules,
63
+ ...pointerEventsRules,
88
64
  ...positionRules,
89
65
  ...radiusRules,
90
66
  ...shadowRules,
@@ -109,13 +85,15 @@ export const rules: Rules = {
109
85
  ...selectableRules,
110
86
  ...spinnerRules,
111
87
  ...switchRules,
112
- ...textRules,
113
88
  ...textAreaRules,
114
89
  ...textInputRules,
90
+ ...textRules,
115
91
  ...tokenRules,
116
92
  ...tooltipRules,
117
93
 
118
94
  // components
119
95
  ...breadcrumbsRules,
120
96
  ...dialogRules,
97
+ ...menuRules,
98
+ ...skeletonRules,
121
99
  }
@@ -3,10 +3,15 @@ import {composeClassNames} from '../../composeClassNames'
3
3
  import {FontStyleProps} from './types'
4
4
 
5
5
  const prefixes = {
6
+ align: 'text-align',
6
7
  weight: 'font',
7
- }
8
+ } as const
8
9
 
9
10
  /** @public */
10
11
  export function font(props: FontStyleProps): string {
11
- return composeClassNames('font', _resp(prefixes.weight, props.weight))
12
+ return composeClassNames(
13
+ 'font',
14
+ props.weight && `${prefixes.weight}-${props.weight}`,
15
+ _resp(prefixes.align, props.align),
16
+ )
12
17
  }
@@ -1,3 +1,4 @@
1
+ import {responsiveRules} from '../../responsiveRules'
1
2
  import {type Rules} from '../../types'
2
3
 
3
4
  export const fontRules: Rules = {
@@ -67,6 +68,28 @@ export const fontRules: Rules = {
67
68
  'font-bold': {
68
69
  '--font-weight': 'var(--font-weight-bold)',
69
70
  },
71
+
72
+ // align
73
+
74
+ ...responsiveRules('text-align-initial', {
75
+ textAlign: 'initial',
76
+ }),
77
+
78
+ ...responsiveRules('text-align-left', {
79
+ textAlign: 'left',
80
+ }),
81
+
82
+ ...responsiveRules('text-align-center', {
83
+ textAlign: 'center',
84
+ }),
85
+
86
+ ...responsiveRules('text-align-right', {
87
+ textAlign: 'right',
88
+ }),
89
+
90
+ ...responsiveRules('text-align-justify', {
91
+ textAlign: 'justify',
92
+ }),
70
93
  }
71
94
 
72
95
  // .font {
@@ -1,6 +1,12 @@
1
1
  import {FontWeight} from '@sanity/ui/theme'
2
2
 
3
+ /**
4
+ * @public
5
+ */
6
+ export type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'initial'
7
+
3
8
  /** @public */
4
9
  export interface FontStyleProps {
10
+ align?: TextAlign
5
11
  weight?: FontWeight
6
12
  }
@@ -7,8 +7,8 @@ export const gapRules: Rules = {
7
7
  ...SPACE.reduce<Rules>((acc, space) => {
8
8
  return {
9
9
  ...acc,
10
- ...responsiveRules(`g-${space}`, {
11
- gap: space === 0.5 ? 'calc(var(--space-1) / 2)' : vars.space[space],
10
+ ...responsiveRules(`g-${space}`.replace('.', '_'), {
11
+ gap: vars.space[space],
12
12
  }),
13
13
  }
14
14
  }, {}),
@@ -16,8 +16,8 @@ export const gapRules: Rules = {
16
16
  ...SPACE.reduce<Rules>((acc, space) => {
17
17
  return {
18
18
  ...acc,
19
- ...responsiveRules(`gx-${space}`, {
20
- columnGap: space === 0.5 ? 'calc(var(--space-1) / 2)' : vars.space[space],
19
+ ...responsiveRules(`gx-${space}`.replace('.', '_'), {
20
+ columnGap: vars.space[space],
21
21
  }),
22
22
  }
23
23
  }, {}),
@@ -25,8 +25,8 @@ export const gapRules: Rules = {
25
25
  ...SPACE.reduce<Rules>((acc, space) => {
26
26
  return {
27
27
  ...acc,
28
- ...responsiveRules(`gy-${space}`, {
29
- rowGap: space === 0.5 ? 'calc(var(--space-1) / 2)' : vars.space[space],
28
+ ...responsiveRules(`gy-${space}`.replace('.', '_'), {
29
+ rowGap: vars.space[space],
30
30
  }),
31
31
  }
32
32
  }, {}),
@@ -0,0 +1,13 @@
1
+ import {_resp} from '../../_resp'
2
+ import {composeClassNames} from '../../composeClassNames'
3
+ import {GridStyleProps} from './types'
4
+
5
+ export function grid(props: GridStyleProps): string {
6
+ return composeClassNames(
7
+ _resp('auto-cols', props.autoCols),
8
+ _resp('auto-rows', props.autoRows),
9
+ _resp('auto-flow', props.autoFlow),
10
+ _resp('columns', props.columns),
11
+ _resp('rows', props.rows),
12
+ )
13
+ }
@@ -0,0 +1,2 @@
1
+ export * from './grid'
2
+ export * from './types'
@@ -18,7 +18,7 @@ export const gridRules: Rules = {
18
18
  ...responsiveRules('auto-rows-auto', {gridAutoRows: 'auto'}),
19
19
  ...responsiveRules('auto-rows-min', {gridAutoRows: 'min-content'}),
20
20
  ...responsiveRules('auto-rows-max', {gridAutoRows: 'max-content'}),
21
- // ...responsiveRules('auto-rows-fr', {gridAutoRows: 'fr'}),
21
+ ...responsiveRules('auto-rows-fr', {gridAutoRows: 'minmax(0, 1fr)'}),
22
22
 
23
23
  // columns
24
24
  ...responsiveRules('columns-1', {gridTemplateColumns: 'repeat(1, 1fr)'}),
@@ -32,4 +32,115 @@ export const gridRules: Rules = {
32
32
  ...responsiveRules('columns-9', {gridTemplateColumns: 'repeat(9, 1fr)'}),
33
33
  ...responsiveRules('columns-10', {gridTemplateColumns: 'repeat(10, 1fr)'}),
34
34
  ...responsiveRules('columns-12', {gridTemplateColumns: 'repeat(12, 1fr)'}),
35
+
36
+ // rows
37
+ ...responsiveRules('rows-1', {gridTemplateRows: 'repeat(1, 1fr)'}),
38
+ ...responsiveRules('rows-2', {gridTemplateRows: 'repeat(2, 1fr)'}),
39
+ ...responsiveRules('rows-3', {gridTemplateRows: 'repeat(3, 1fr)'}),
40
+ ...responsiveRules('rows-4', {gridTemplateRows: 'repeat(4, 1fr)'}),
41
+ ...responsiveRules('rows-5', {gridTemplateRows: 'repeat(5, 1fr)'}),
42
+ ...responsiveRules('rows-6', {gridTemplateRows: 'repeat(6, 1fr)'}),
43
+ ...responsiveRules('rows-7', {gridTemplateRows: 'repeat(7, 1fr)'}),
44
+ ...responsiveRules('rows-8', {gridTemplateRows: 'repeat(8, 1fr)'}),
45
+ ...responsiveRules('rows-9', {gridTemplateRows: 'repeat(9, 1fr)'}),
46
+ ...responsiveRules('rows-10', {gridTemplateRows: 'repeat(10, 1fr)'}),
47
+ ...responsiveRules('rows-12', {gridTemplateRows: 'repeat(12, 1fr)'}),
35
48
  }
49
+
50
+ // import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
51
+ // import {rem, _responsive} from '../helpers'
52
+ // import {ThemeProps} from '../types'
53
+ // import {ResponsiveGridStyleProps} from './types'
54
+
55
+ // const GRID_AUTO_COLUMS = {
56
+ // auto: 'auto',
57
+ // min: 'min-content',
58
+ // max: 'max-content',
59
+ // fr: 'minmax(0, 1fr)',
60
+ // }
61
+
62
+ // const GRID_AUTO_ROWS = {
63
+ // auto: 'auto',
64
+ // min: 'min-content',
65
+ // max: 'max-content',
66
+ // fr: 'minmax(0, 1fr)',
67
+ // }
68
+
69
+ // export function responsiveGridStyle(): Array<
70
+ // CSSObject | ((props: ResponsiveGridStyleProps & ThemeProps) => CSSObject[])
71
+ // > {
72
+ // return [
73
+ // responsiveGridAutoFlowStyle,
74
+ // responsiveGridAutoRowsStyle,
75
+ // responsiveGridAutoColsStyle,
76
+ // responsiveGridColumnsStyle,
77
+ // responsiveGridRowsStyle,
78
+ // responsiveGridGapStyle,
79
+ // responsiveGridGapXStyle,
80
+ // responsiveGridGapYStyle,
81
+ // ]
82
+ // }
83
+
84
+ // function responsiveGridAutoFlowStyle(props: ResponsiveGridStyleProps & ThemeProps) {
85
+ // const {media} = getTheme_v2(props.theme)
86
+
87
+ // return _responsive(media, props.$autoFlow, (autoFlow) => ({
88
+ // gridAutoFlow: autoFlow,
89
+ // }))
90
+ // }
91
+
92
+ // function responsiveGridAutoRowsStyle(props: ResponsiveGridStyleProps & ThemeProps) {
93
+ // const {media} = getTheme_v2(props.theme)
94
+
95
+ // return _responsive(media, props.$autoRows, (autoRows) => ({
96
+ // gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows],
97
+ // }))
98
+ // }
99
+
100
+ // function responsiveGridAutoColsStyle(props: ResponsiveGridStyleProps & ThemeProps) {
101
+ // const {media} = getTheme_v2(props.theme)
102
+
103
+ // return _responsive(media, props.$autoCols, (autoCols) => ({
104
+ // gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols],
105
+ // }))
106
+ // }
107
+
108
+ // function responsiveGridColumnsStyle(props: ResponsiveGridStyleProps & ThemeProps) {
109
+ // const {media} = getTheme_v2(props.theme)
110
+
111
+ // return _responsive(media, props.$columns, (columns) => ({
112
+ // gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));`,
113
+ // }))
114
+ // }
115
+
116
+ // function responsiveGridRowsStyle(props: ResponsiveGridStyleProps & ThemeProps) {
117
+ // const {media} = getTheme_v2(props.theme)
118
+
119
+ // return _responsive(media, props.$rows, (rows) => ({
120
+ // gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));`,
121
+ // }))
122
+ // }
123
+
124
+ // function responsiveGridGapStyle(props: ResponsiveGridStyleProps & ThemeProps) {
125
+ // const {media, space} = getTheme_v2(props.theme)
126
+
127
+ // return _responsive(media, props.$gap, (gap) => ({
128
+ // gridGap: gap ? rem(space[gap]) : undefined,
129
+ // }))
130
+ // }
131
+
132
+ // function responsiveGridGapXStyle(props: ResponsiveGridStyleProps & ThemeProps) {
133
+ // const {media, space} = getTheme_v2(props.theme)
134
+
135
+ // return _responsive(media, props.$gapX, (gapX) => ({
136
+ // columnGap: gapX ? rem(space[gapX]) : undefined,
137
+ // }))
138
+ // }
139
+
140
+ // function responsiveGridGapYStyle(props: ResponsiveGridStyleProps & ThemeProps) {
141
+ // const {media, space} = getTheme_v2(props.theme)
142
+
143
+ // return _responsive(media, props.$gapY, (gapY) => ({
144
+ // rowGap: gapY ? rem(space[gapY]) : undefined,
145
+ // }))
146
+ // }
@@ -0,0 +1,29 @@
1
+ import {ResponsiveProp} from '../../types'
2
+
3
+ /**
4
+ * @public
5
+ */
6
+ export type GridAutoRows = 'auto' | 'min' | 'max' | 'fr'
7
+
8
+ /**
9
+ * @public
10
+ */
11
+ export type GridAutoCols = 'auto' | 'min' | 'max' | 'fr'
12
+
13
+ /**
14
+ * @public
15
+ */
16
+ export type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense'
17
+
18
+ export type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12
19
+
20
+ export type Rows = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12
21
+
22
+ /** @public */
23
+ export interface GridStyleProps {
24
+ autoRows?: ResponsiveProp<GridAutoRows>
25
+ autoCols?: ResponsiveProp<GridAutoCols>
26
+ autoFlow?: ResponsiveProp<GridAutoFlow>
27
+ columns?: ResponsiveProp<Columns>
28
+ rows?: ResponsiveProp<Rows>
29
+ }