@sanity-labs/ui-poc 0.0.1-alpha.1 → 0.0.1-alpha.11

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 (117) hide show
  1. package/dist/_chunks-es/LazyRefractor.js +9 -0
  2. package/dist/_chunks-es/LazyRefractor.js.map +1 -0
  3. package/dist/index.d.ts +277 -13
  4. package/dist/index.js +446 -33
  5. package/dist/index.js.map +1 -1
  6. package/dist/styles.css +1 -8044
  7. package/package.json +28 -33
  8. package/src/components/box/Box.tsx +1 -12
  9. package/src/components/box/box.css +5 -0
  10. package/src/components/box/box.props.ts +11 -2
  11. package/src/components/card/Card.tsx +26 -0
  12. package/src/components/card/card.css +7 -0
  13. package/src/components/card/card.props.ts +34 -10
  14. package/src/components/code/Code.tsx +37 -0
  15. package/src/components/code/LazyRefractor.tsx +9 -0
  16. package/src/components/code/code.css +36 -0
  17. package/src/components/code/code.props.ts +35 -0
  18. package/src/components/container/Container.tsx +25 -0
  19. package/src/components/container/container.css +4 -0
  20. package/src/components/container/container.props.ts +24 -0
  21. package/src/components/divider/Divider.tsx +10 -3
  22. package/src/components/divider/divider.props.tsx +9 -0
  23. package/src/components/flex/Flex.tsx +1 -15
  24. package/src/components/flex/flex.css +5 -0
  25. package/src/components/flex/flex.props.ts +14 -4
  26. package/src/components/grid/Grid.tsx +1 -15
  27. package/src/components/grid/grid.css +5 -0
  28. package/src/components/grid/grid.props.ts +14 -4
  29. package/src/components/heading/Heading.tsx +39 -0
  30. package/src/components/heading/heading.css +9 -0
  31. package/src/components/heading/heading.props.ts +25 -0
  32. package/src/components/icon/Icon.tsx +18 -0
  33. package/src/components/icon/icon.css +17 -0
  34. package/src/components/icon/icon.props.ts +29 -0
  35. package/src/components/index.css +9 -0
  36. package/src/components/text/Text.tsx +3 -13
  37. package/src/components/text/text.css +9 -0
  38. package/src/components/text/text.props.ts +11 -2
  39. package/src/css/classes/dynamic/readme.md +3 -0
  40. package/src/css/{utilities → classes}/generic/display.css +0 -3
  41. package/src/css/{utilities → classes}/generic/flex.css +7 -7
  42. package/src/css/classes/generic/grid.css +7 -0
  43. package/src/css/{utilities → classes}/generic/index.css +0 -4
  44. package/src/css/classes/generic/readme.md +3 -0
  45. package/src/css/classes/index.css +4 -0
  46. package/src/css/classes/local/border.css +16 -0
  47. package/src/css/classes/local/index.css +3 -0
  48. package/src/css/classes/local/readme.md +3 -0
  49. package/src/css/classes/local/text-trim.css +45 -0
  50. package/src/css/classes/local/tone.css +48 -0
  51. package/src/css/classes/system/container.css +8 -0
  52. package/src/css/{utilities/tokenized → classes/system}/index.css +1 -0
  53. package/src/css/{utilities/tokenized → classes/system}/margin.css +0 -7
  54. package/src/css/{utilities/tokenized → classes/system}/padding.css +0 -7
  55. package/src/css/classes/system/radius.css +10 -0
  56. package/src/css/classes/system/readme.md +3 -0
  57. package/src/css/global/font-face.css +20 -0
  58. package/src/css/global/index.css +2 -0
  59. package/src/css/global/reset.css +74 -0
  60. package/src/css/index.css +3 -4
  61. package/src/css/tokens/border.css +3 -0
  62. package/src/css/tokens/index.css +2 -0
  63. package/src/css/tokens/tone.css +30 -0
  64. package/src/index.css +10 -2
  65. package/src/index.ts +5 -0
  66. package/src/props/border.ts +5 -5
  67. package/src/props/layout.ts +7 -1
  68. package/src/props/position.ts +0 -7
  69. package/src/props/shadow.ts +15 -0
  70. package/src/props/tone.ts +1 -2
  71. package/src/props/typography.ts +5 -3
  72. package/src/props/zIndex.ts +15 -0
  73. package/src/types/Code.ts +5 -0
  74. package/src/types/Container.ts +2 -0
  75. package/src/types/Density.ts +1 -1
  76. package/src/types/FontWeight.ts +1 -1
  77. package/src/types/Heading.ts +5 -0
  78. package/src/types/Icon.ts +2 -0
  79. package/src/types/Overflow.ts +1 -1
  80. package/src/types/Position.ts +1 -1
  81. package/src/types/PropDef.ts +44 -6
  82. package/src/types/Radius.ts +1 -1
  83. package/src/types/Responsive.ts +0 -1
  84. package/src/types/Shadow.ts +2 -0
  85. package/src/types/Text.ts +1 -1
  86. package/src/types/TextAlign.ts +1 -1
  87. package/src/types/Tone.ts +9 -1
  88. package/src/utils/getProps.test.ts +22 -9
  89. package/src/utils/getProps.ts +75 -26
  90. package/dist/components.css +0 -9
  91. package/dist/utilities.css +0 -8032
  92. package/src/css/global.css +0 -103
  93. package/src/css/utilities/generic/border.css +0 -11
  94. package/src/css/utilities/generic/grid.css +0 -7
  95. package/src/css/utilities/generic/text-muted.css +0 -2
  96. package/src/css/utilities/generic/text-trim.css +0 -38
  97. package/src/css/utilities/generic/tone.css +0 -34
  98. package/src/css/utilities/tokenized/container.css +0 -8
  99. package/src/css/utilities/tokenized/radius.css +0 -8
  100. /package/src/css/{utilities → classes}/dynamic/flex-child.css +0 -0
  101. /package/src/css/{utilities → classes}/dynamic/grid-child.css +0 -0
  102. /package/src/css/{utilities → classes}/dynamic/grid-parent.css +0 -0
  103. /package/src/css/{utilities → classes}/dynamic/height.css +0 -0
  104. /package/src/css/{utilities → classes}/dynamic/index.css +0 -0
  105. /package/src/css/{utilities → classes}/dynamic/line-clamp.css +0 -0
  106. /package/src/css/{utilities → classes}/dynamic/width.css +0 -0
  107. /package/src/css/{utilities → classes}/dynamic/z-index.css +0 -0
  108. /package/src/css/{utilities → classes}/generic/overflow.css +0 -0
  109. /package/src/css/{utilities → classes}/generic/position.css +0 -0
  110. /package/src/css/{utilities → classes}/generic/text-align.css +0 -0
  111. /package/src/css/{utilities/tokenized → classes/system}/color.css +0 -0
  112. /package/src/css/{utilities/tokenized → classes/system}/fontFamily.css +0 -0
  113. /package/src/css/{utilities/tokenized → classes/system}/fontWeight.css +0 -0
  114. /package/src/css/{utilities/tokenized → classes/system}/gap.css +0 -0
  115. /package/src/css/{utilities/tokenized → classes/system}/inset.css +0 -0
  116. /package/src/css/{utilities/tokenized → classes/system}/shadow.css +0 -0
  117. /package/src/css/{utilities/tokenized → classes/system}/typography.css +0 -0
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { hasLanguage, Refractor } from "react-refractor";
3
+ function LazyRefractor({ language, value }) {
4
+ return hasLanguage(language) ? /* @__PURE__ */ jsx(Refractor, { inline: !0, language, value }) : /* @__PURE__ */ jsx("code", { children: value });
5
+ }
6
+ export {
7
+ LazyRefractor as default
8
+ };
9
+ //# sourceMappingURL=LazyRefractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LazyRefractor.js","sources":["../../src/components/code/LazyRefractor.tsx"],"sourcesContent":["import {hasLanguage, Refractor, type RefractorProps} from 'react-refractor'\n\nexport default function LazyRefractor({language, value}: RefractorProps) {\n if (!hasLanguage(language)) {\n return <code>{value}</code>\n }\n\n return <Refractor inline language={language} value={value} />\n}\n"],"names":[],"mappings":";;AAEA,SAAwB,cAAc,EAAC,UAAU,SAAwB;AACvE,SAAK,YAAY,QAAQ,IAIlB,oBAAC,WAAA,EAAU,QAAM,IAAC,UAAoB,MAAA,CAAc,IAHlD,oBAAC,QAAA,EAAM,UAAA,OAAM;AAIxB;"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import {JSX} from 'react/jsx-runtime'
2
2
  import {default as React_2} from 'react'
3
3
 
4
+ declare const ALIGN_ITEMS: readonly ['baseline', 'center', 'flex-end', 'flex-start', 'stretch']
5
+
6
+ declare type AlignItems = (typeof ALIGN_ITEMS)[number]
7
+
4
8
  declare type BorderProps = {
5
9
  /** CSS **border** property */
6
10
  border?: Responsive<boolean>
@@ -17,22 +21,109 @@ declare type BorderProps = {
17
21
  }
18
22
 
19
23
  /** @public */
20
- export declare function Box<T extends React_2.ElementType = 'div'>(
21
- props: BoxProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof BoxProps<T>>,
22
- ): JSX.Element
24
+ export declare function Box<T extends React_2.ElementType = 'div'>({
25
+ display,
26
+ ...props
27
+ }: BoxProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof BoxProps<T>>): JSX.Element
23
28
 
24
29
  /** @public */
25
- export declare interface BoxProps<T extends React_2.ElementType> extends LayoutProps {
30
+ declare interface BoxProps<T extends React.ElementType> extends LayoutProps {
26
31
  /** Element to render */
27
32
  as?: T
28
33
  /** CSS **display** property */
29
34
  display?: Responsive<DisplayBlock>
30
35
  }
31
36
 
37
+ /** @public */
38
+ export declare function Card<T extends React_2.ElementType = 'div'>({
39
+ density,
40
+ tone,
41
+ ...props
42
+ }: CardProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof CardProps<T>>): JSX.Element
43
+
44
+ /** @public */
45
+ declare interface CardProps<T extends React.ElementType> extends MarginProps, ToneProps {
46
+ /** Element to render */
47
+ as?: T
48
+ /** Composite prop for setting padding and border radius */
49
+ density?: Responsive<Density>
50
+ }
51
+
52
+ /** @public */
53
+ export declare function Code<T extends React.ElementType = 'pre'>({
54
+ size,
55
+ ...props
56
+ }: CodeProps & Omit<React.ComponentPropsWithRef<T>, keyof CodeProps>): JSX.Element
57
+
58
+ declare const CODE_SIZE: readonly [0, 1, 2, 3, 4]
59
+
60
+ declare const CODE_TAG: readonly ['pre', 'span']
61
+
62
+ /** @public */
63
+ declare interface CodeProps
64
+ extends React.ComponentProps<'pre'>, Omit<TypographyProps, 'align' | 'lineClamp' | 'tone'> {
65
+ /** Element to render */
66
+ as?: CodeTag
67
+ /** Refractor language for syntax highlighting */
68
+ language?: string
69
+ /** CSS **font-size** property */
70
+ size?: Responsive<CodeSize>
71
+ }
72
+
73
+ declare type CodeSize = (typeof CODE_SIZE)[number]
74
+
75
+ declare type CodeTag = (typeof CODE_TAG)[number]
76
+
77
+ /** @public */
78
+ export declare function Container<T extends React_2.ElementType = 'div'>({
79
+ marginX,
80
+ ...props
81
+ }: ContainerProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof ContainerProps<T>>): JSX.Element
82
+
83
+ declare const CONTAINER_SIZE: readonly [0, 1, 2, 3, 4, 5]
84
+
85
+ /** @public */
86
+ declare interface ContainerProps<T extends React.ElementType> extends LayoutProps {
87
+ /** Element to render */
88
+ as?: T
89
+ /** CSS **max-width** property */
90
+ contentSize?: Responsive<ContainerSize>
91
+ }
92
+
93
+ declare type ContainerSize = (typeof CONTAINER_SIZE)[number]
94
+
95
+ declare const DENSITY: readonly ['compact', 'regular', 'loose']
96
+
97
+ declare type Density = (typeof DENSITY)[number]
98
+
32
99
  declare const DISPLAY_BLOCK: readonly ['block', 'inline-block', 'none']
33
100
 
101
+ declare const DISPLAY_FLEX: readonly ['flex', 'inline-flex', 'none']
102
+
103
+ declare const DISPLAY_GRID: readonly ['grid', 'inline-grid', 'none']
104
+
34
105
  declare type DisplayBlock = (typeof DISPLAY_BLOCK)[number]
35
106
 
107
+ declare type DisplayFlex = (typeof DISPLAY_FLEX)[number]
108
+
109
+ declare type DisplayGrid = (typeof DISPLAY_GRID)[number]
110
+
111
+ /** @public */
112
+ export declare function Divider(props: DividerProps): JSX.Element
113
+
114
+ /** @public */
115
+ declare interface DividerProps extends React.ComponentProps<'hr'>, MarginProps {}
116
+
117
+ /** @public */
118
+ export declare function Flex<T extends React_2.ElementType = 'div'>({
119
+ display,
120
+ ...props
121
+ }: FlexProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof FlexProps<T>>): JSX.Element
122
+
123
+ declare const FLEX_DIRECTION: readonly ['row', 'row-reverse', 'column', 'column-reverse']
124
+
125
+ declare const FLEX_WRAP: readonly ['wrap', 'wrap-reverse', 'nowrap']
126
+
36
127
  declare type FlexChildProps = {
37
128
  /** CSS **flex-basis** property */
38
129
  flexBasis?: Responsive<string>
@@ -42,6 +133,53 @@ declare type FlexChildProps = {
42
133
  flexShrink?: Responsive<number>
43
134
  }
44
135
 
136
+ declare type FlexDirection = (typeof FLEX_DIRECTION)[number]
137
+
138
+ declare type FlexParentProps = {
139
+ /** CSS **align-items** property */
140
+ alignItems?: Responsive<AlignItems>
141
+ /** CSS **justify-content** property */
142
+ justifyContent?: Responsive<JustifyContent>
143
+ /** CSS **flex-direction** property */
144
+ flexDirection?: Responsive<FlexDirection>
145
+ /** CSS **flex-wrap** property */
146
+ flexWrap?: Responsive<FlexWrap>
147
+ }
148
+
149
+ /** @public */
150
+ declare interface FlexProps<T extends React.ElementType>
151
+ extends FlexParentProps, GapProps, LayoutProps {
152
+ /** Element to render */
153
+ as?: T
154
+ /** CSS **display** property */
155
+ display?: Responsive<DisplayFlex>
156
+ }
157
+
158
+ declare type FlexWrap = (typeof FLEX_WRAP)[number]
159
+
160
+ declare const FONT_WEIGHT: readonly ['regular', 'medium', 'semibold', 'bold']
161
+
162
+ declare type FontWeight = (typeof FONT_WEIGHT)[number]
163
+
164
+ declare type GapProps = {
165
+ /** CSS **gap** property */
166
+ gap?: Responsive<Space>
167
+ /** CSS **row-gap** property */
168
+ rowGap?: Responsive<Space>
169
+ /** CSS **column-gap** property */
170
+ columnGap?: Responsive<Space>
171
+ }
172
+
173
+ /** @public */
174
+ export declare function Grid<T extends React_2.ElementType = 'div'>({
175
+ display,
176
+ ...props
177
+ }: GridProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof GridProps<T>>): JSX.Element
178
+
179
+ declare const GRID_AUTO_FLOW: readonly ['row', 'column', 'row dense', 'column dense', 'dense']
180
+
181
+ declare type GridAutoFlow = (typeof GRID_AUTO_FLOW)[number]
182
+
45
183
  declare type GridChildProps = {
46
184
  /** CSS **grid-column** property */
47
185
  gridColumn?: Responsive<string>
@@ -57,6 +195,51 @@ declare type GridChildProps = {
57
195
  gridRowEnd?: Responsive<string>
58
196
  }
59
197
 
198
+ declare type GridParentProps = {
199
+ /** CSS **grid-auto-flow** property */
200
+ gridAutoFlow?: Responsive<GridAutoFlow>
201
+ /** CSS **grid-auto-columns** property */
202
+ gridAutoColumns?: Responsive<string>
203
+ /** CSS **grid-auto-row** property */
204
+ gridAutoRows?: Responsive<string>
205
+ /** CSS **grid-template-columns** property */
206
+ gridTemplateColumns?: Responsive<string>
207
+ /** CSS **grid-template-rows** property */
208
+ gridTemplateRows?: Responsive<string>
209
+ }
210
+
211
+ /** @public */
212
+ declare interface GridProps<T extends React.ElementType>
213
+ extends GridParentProps, GapProps, LayoutProps {
214
+ /** Element to render */
215
+ as?: T
216
+ /** CSS **display** property */
217
+ display?: Responsive<DisplayGrid>
218
+ }
219
+
220
+ /** @public */
221
+ export declare function Heading<T extends React_2.ElementType = 'h2'>({
222
+ size,
223
+ weight,
224
+ ...props
225
+ }: HeadingProps & Omit<React_2.ComponentPropsWithRef<T>, keyof HeadingProps>): JSX.Element
226
+
227
+ declare const HEADING_SIZE: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
228
+
229
+ declare const HEADING_TAG: readonly ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
230
+
231
+ /** @public */
232
+ declare interface HeadingProps extends TypographyProps {
233
+ /** Element to render */
234
+ as?: HeadingTag
235
+ /** CSS **font-size** property */
236
+ size?: Responsive<HeadingSize>
237
+ }
238
+
239
+ declare type HeadingSize = (typeof HEADING_SIZE)[number]
240
+
241
+ declare type HeadingTag = (typeof HEADING_TAG)[number]
242
+
60
243
  declare type HeightProps = {
61
244
  /** CSS **height** property */
62
245
  height?: Responsive<string>
@@ -66,6 +249,34 @@ declare type HeightProps = {
66
249
  maxHeight?: Responsive<string>
67
250
  }
68
251
 
252
+ /** @public */
253
+ export declare function Icon({icon: Component, size, ...props}: IconProps): JSX.Element
254
+
255
+ declare const ICON_SIZE: readonly [0, 1, 2, 3, 4]
256
+
257
+ /** @public */
258
+ declare interface IconProps extends React_2.ComponentProps<'svg'>, MarginProps, ToneProps {
259
+ /** Icon to render */
260
+ icon: React_2.ComponentType<React_2.SVGProps<SVGSVGElement>>
261
+ /** CSS **font-size** property */
262
+ size?: Responsive<IconSize>
263
+ /** CSS **color** property */
264
+ muted?: TypographyProps['muted']
265
+ }
266
+
267
+ declare type IconSize = (typeof ICON_SIZE)[number]
268
+
269
+ declare const JUSTIFY_CONTENT: readonly [
270
+ 'flex-start',
271
+ 'flex-end',
272
+ 'center',
273
+ 'space-between',
274
+ 'space-around',
275
+ 'space-evenly',
276
+ ]
277
+
278
+ declare type JustifyContent = (typeof JUSTIFY_CONTENT)[number]
279
+
69
280
  declare interface LayoutProps
70
281
  extends
71
282
  ToneProps,
@@ -77,7 +288,9 @@ declare interface LayoutProps
77
288
  PositionProps,
78
289
  OverflowProps,
79
290
  FlexChildProps,
80
- GridChildProps {}
291
+ GridChildProps,
292
+ ZIndexProps,
293
+ ShadowProps {}
81
294
 
82
295
  declare type MarginProps = {
83
296
  /** CSS **margin** property */
@@ -96,7 +309,7 @@ declare type MarginProps = {
96
309
  marginLeft?: Responsive<SpaceAuto>
97
310
  }
98
311
 
99
- declare const OVERFLOW: string[]
312
+ declare const OVERFLOW: readonly ['visible', 'hidden', 'auto', 'scroll', 'clip']
100
313
 
101
314
  declare type Overflow = (typeof OVERFLOW)[number]
102
315
 
@@ -126,7 +339,7 @@ declare interface PaddingProps {
126
339
  paddingLeft?: Responsive<Space>
127
340
  }
128
341
 
129
- declare const POSITION: string[]
342
+ declare const POSITION: readonly ['absolute', 'fixed', 'relative', 'static', 'sticky']
130
343
 
131
344
  declare type Position = (typeof POSITION)[number]
132
345
 
@@ -145,7 +358,7 @@ declare type PositionProps = {
145
358
  left?: Responsive<SpaceAuto>
146
359
  }
147
360
 
148
- declare const RADIUS: (string | number)[]
361
+ declare const RADIUS: readonly [0, 1, 2, 3, 4, 5, 6, 'full']
149
362
 
150
363
  declare type Radius = (typeof RADIUS)[number]
151
364
 
@@ -170,9 +383,11 @@ declare type Responsive<T> =
170
383
  | ([T | undefined, ...(T | undefined)[]] & {
171
384
  length: 6
172
385
  })
173
- | ([T | undefined, ...(T | undefined)[]] & {
174
- length: 7
175
- })
386
+
387
+ declare type ShadowProps = {
388
+ /** CSS **box-shadow** property */
389
+ shadow?: string
390
+ }
176
391
 
177
392
  declare const SPACE: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
178
393
 
@@ -182,13 +397,57 @@ declare const SPACE_AUTO: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'auto']
182
397
 
183
398
  declare type SpaceAuto = (typeof SPACE_AUTO)[number]
184
399
 
185
- declare const TONE: string[]
400
+ /** @public */
401
+ declare function Text_2<T extends React_2.ElementType = 'span'>({
402
+ size,
403
+ ...props
404
+ }: TextProps<T> & Omit<React_2.ComponentPropsWithRef<T>, keyof TextProps<T>>): JSX.Element
405
+ export {Text_2 as Text}
406
+
407
+ declare const TEXT_ALIGN: readonly ['left', 'center', 'right', 'justify']
408
+
409
+ declare const TEXT_SIZE: readonly [0, 1, 2, 3, 4]
410
+
411
+ declare type TextAlign = (typeof TEXT_ALIGN)[number]
412
+
413
+ /** @public */
414
+ declare interface TextProps<T extends React.ElementType> extends TypographyProps {
415
+ /** Element to render */
416
+ as?: T
417
+ /** CSS **font-size** property */
418
+ size?: Responsive<TextSize>
419
+ }
420
+
421
+ declare type TextSize = (typeof TEXT_SIZE)[number]
422
+
423
+ declare const TONE: readonly [
424
+ 'none',
425
+ 'neutral',
426
+ 'primary',
427
+ 'positive',
428
+ 'suggest',
429
+ 'caution',
430
+ 'critical',
431
+ ]
186
432
 
187
433
  declare type Tone = (typeof TONE)[number]
188
434
 
189
435
  declare type ToneProps = {
190
436
  /** CSS **background-color** property */
191
- tone?: Responsive<Tone>
437
+ tone?: Tone
438
+ }
439
+
440
+ declare interface TypographyProps extends MarginProps, ToneProps {
441
+ /** CSS **text-align** property */
442
+ align?: TextAlign
443
+ /** CSS **-webkit-line-clamp** property */
444
+ lineClamp?: number
445
+ /** CSS **color** property */
446
+ muted?: boolean
447
+ /** CSS **text-box-trim** property */
448
+ trim?: boolean
449
+ /** CSS **font-weight** property */
450
+ weight?: FontWeight
192
451
  }
193
452
 
194
453
  declare type WidthProps = {
@@ -200,4 +459,9 @@ declare type WidthProps = {
200
459
  maxWidth?: Responsive<string>
201
460
  }
202
461
 
462
+ declare type ZIndexProps = {
463
+ /** CSS z-index property */
464
+ zIndex?: Responsive<number>
465
+ }
466
+
203
467
  export {}