@sanity-labs/ui-poc 0.0.1-alpha.11 → 0.0.1-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +182 -36
- package/dist/index.js +451 -57
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -2
- package/src/components/box/Box.tsx +3 -3
- package/src/components/box/box.css +3 -4
- package/src/components/card/Card.tsx +4 -4
- package/src/components/card/card.css +2 -5
- package/src/components/card/card.props.ts +9 -0
- package/src/components/checkbox/Checkbox.tsx +51 -0
- package/src/components/checkbox/checkbox.css +40 -0
- package/src/components/checkbox/checkbox.props.ts +20 -0
- package/src/components/code/code.css +5 -1
- package/src/components/container/Container.tsx +3 -3
- package/src/components/container/container.css +3 -3
- package/src/components/flex/Flex.tsx +3 -3
- package/src/components/flex/flex.css +3 -4
- package/src/components/grid/Grid.tsx +3 -3
- package/src/components/grid/grid.css +3 -4
- package/src/components/h-stack/HStack.tsx +29 -0
- package/src/components/h-stack/hStack.props.ts +15 -0
- package/src/components/heading/Heading.tsx +3 -3
- package/src/components/heading/heading.css +4 -4
- package/src/components/icon/icon.css +4 -4
- package/src/components/icon/icon.props.ts +3 -3
- package/src/components/index.css +8 -0
- package/src/components/inline/Inline.tsx +35 -0
- package/src/components/inline/inline.css +4 -0
- package/src/components/inline/inline.props.ts +96 -0
- package/src/components/label/Label.tsx +27 -0
- package/src/components/label/label.css +3 -0
- package/src/components/label/label.props.ts +15 -0
- package/src/components/link/Link.tsx +24 -0
- package/src/components/link/link.css +12 -0
- package/src/components/link/link.props.ts +23 -0
- package/src/components/radio/Radio.tsx +34 -0
- package/src/components/radio/radio.css +27 -0
- package/src/components/radio/radio.props.ts +15 -0
- package/src/components/skip-to-content/SkipToContent.tsx +30 -0
- package/src/components/skip-to-content/skip-to-content.css +9 -0
- package/src/components/skip-to-content/skipToContent.props.ts +24 -0
- package/src/components/switch/Switch.tsx +50 -0
- package/src/components/switch/switch.css +47 -0
- package/src/components/switch/switch.props.ts +20 -0
- package/src/components/text/Text.tsx +3 -3
- package/src/components/text/text.css +4 -4
- package/src/components/v-stack/VStack.tsx +27 -0
- package/src/components/v-stack/vStack.props.ts +15 -0
- package/src/components/visually-hidden/VisuallyHidden.tsx +24 -0
- package/src/components/visually-hidden/visually-hidden.css +9 -0
- package/src/components/visually-hidden/visuallyHidden.props.ts +19 -0
- package/src/css/classes/local/border.css +14 -10
- package/src/css/classes/local/tone.css +68 -33
- package/src/css/classes/system/gap.css +3 -0
- package/src/css/classes/system/margin.css +63 -0
- package/src/css/classes/system/radius.css +1 -1
- package/src/css/global/reset.css +2 -3
- package/src/css/tokens/index.css +1 -2
- package/src/css/tokens/opacity.css +6 -0
- package/src/index.ts +10 -0
- package/src/props/flexParent.ts +1 -1
- package/src/props/gap.ts +7 -7
- package/src/props/margin.ts +15 -15
- package/src/types/Space.ts +6 -0
- package/src/types/Tone.ts +1 -9
- package/src/utils/getProps.test.ts +4 -2
- package/src/utils/getProps.ts +7 -1
- package/src/css/tokens/border.css +0 -3
- package/src/css/tokens/tone.css +0 -30
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type {ComponentProps} from 'react'
|
|
2
|
+
import {ComponentPropsWithRef} from 'react'
|
|
3
|
+
import {ElementType} from 'react'
|
|
1
4
|
import {JSX} from 'react/jsx-runtime'
|
|
2
|
-
import {
|
|
5
|
+
import type {SVGProps} from 'react'
|
|
3
6
|
|
|
4
7
|
declare const ALIGN_ITEMS: readonly ['baseline', 'center', 'flex-end', 'flex-start', 'stretch']
|
|
5
8
|
|
|
@@ -21,10 +24,10 @@ declare type BorderProps = {
|
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
/** @public */
|
|
24
|
-
export declare function Box<T extends
|
|
27
|
+
export declare function Box<T extends ElementType = 'div'>({
|
|
25
28
|
display,
|
|
26
29
|
...props
|
|
27
|
-
}: BoxProps<T> & Omit<
|
|
30
|
+
}: BoxProps<T> & Omit<ComponentPropsWithRef<T>, keyof BoxProps<T>>): JSX.Element
|
|
28
31
|
|
|
29
32
|
/** @public */
|
|
30
33
|
declare interface BoxProps<T extends React.ElementType> extends LayoutProps {
|
|
@@ -35,11 +38,11 @@ declare interface BoxProps<T extends React.ElementType> extends LayoutProps {
|
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
/** @public */
|
|
38
|
-
export declare function Card<T extends
|
|
41
|
+
export declare function Card<T extends ElementType = 'div'>({
|
|
39
42
|
density,
|
|
40
43
|
tone,
|
|
41
44
|
...props
|
|
42
|
-
}: CardProps<T> & Omit<
|
|
45
|
+
}: CardProps<T> & Omit<ComponentPropsWithRef<T>, keyof CardProps<T>>): JSX.Element
|
|
43
46
|
|
|
44
47
|
/** @public */
|
|
45
48
|
declare interface CardProps<T extends React.ElementType> extends MarginProps, ToneProps {
|
|
@@ -49,6 +52,17 @@ declare interface CardProps<T extends React.ElementType> extends MarginProps, To
|
|
|
49
52
|
density?: Responsive<Density>
|
|
50
53
|
}
|
|
51
54
|
|
|
55
|
+
/** @beta */
|
|
56
|
+
export declare function Checkbox(props: CheckboxProps): JSX.Element
|
|
57
|
+
|
|
58
|
+
/** @beta */
|
|
59
|
+
declare interface CheckboxProps extends React.ComponentProps<'input'>, MarginProps {
|
|
60
|
+
/** Input label */
|
|
61
|
+
label: React.ReactNode
|
|
62
|
+
/** Indeterminate state */
|
|
63
|
+
indeterminate?: boolean
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
/** @public */
|
|
53
67
|
export declare function Code<T extends React.ElementType = 'pre'>({
|
|
54
68
|
size,
|
|
@@ -75,10 +89,10 @@ declare type CodeSize = (typeof CODE_SIZE)[number]
|
|
|
75
89
|
declare type CodeTag = (typeof CODE_TAG)[number]
|
|
76
90
|
|
|
77
91
|
/** @public */
|
|
78
|
-
export declare function Container<T extends
|
|
92
|
+
export declare function Container<T extends ElementType = 'div'>({
|
|
79
93
|
marginX,
|
|
80
94
|
...props
|
|
81
|
-
}: ContainerProps<T> & Omit<
|
|
95
|
+
}: ContainerProps<T> & Omit<ComponentPropsWithRef<T>, keyof ContainerProps<T>>): JSX.Element
|
|
82
96
|
|
|
83
97
|
declare const CONTAINER_SIZE: readonly [0, 1, 2, 3, 4, 5]
|
|
84
98
|
|
|
@@ -115,10 +129,10 @@ export declare function Divider(props: DividerProps): JSX.Element
|
|
|
115
129
|
declare interface DividerProps extends React.ComponentProps<'hr'>, MarginProps {}
|
|
116
130
|
|
|
117
131
|
/** @public */
|
|
118
|
-
export declare function Flex<T extends
|
|
132
|
+
export declare function Flex<T extends ElementType = 'div'>({
|
|
119
133
|
display,
|
|
120
134
|
...props
|
|
121
|
-
}: FlexProps<T> & Omit<
|
|
135
|
+
}: FlexProps<T> & Omit<ComponentPropsWithRef<T>, keyof FlexProps<T>>): JSX.Element
|
|
122
136
|
|
|
123
137
|
declare const FLEX_DIRECTION: readonly ['row', 'row-reverse', 'column', 'column-reverse']
|
|
124
138
|
|
|
@@ -163,18 +177,18 @@ declare type FontWeight = (typeof FONT_WEIGHT)[number]
|
|
|
163
177
|
|
|
164
178
|
declare type GapProps = {
|
|
165
179
|
/** CSS **gap** property */
|
|
166
|
-
gap?: Responsive<
|
|
180
|
+
gap?: Responsive<SpaceInherit>
|
|
167
181
|
/** CSS **row-gap** property */
|
|
168
|
-
rowGap?: Responsive<
|
|
182
|
+
rowGap?: Responsive<SpaceInherit>
|
|
169
183
|
/** CSS **column-gap** property */
|
|
170
|
-
columnGap?: Responsive<
|
|
184
|
+
columnGap?: Responsive<SpaceInherit>
|
|
171
185
|
}
|
|
172
186
|
|
|
173
187
|
/** @public */
|
|
174
|
-
export declare function Grid<T extends
|
|
188
|
+
export declare function Grid<T extends ElementType = 'div'>({
|
|
175
189
|
display,
|
|
176
190
|
...props
|
|
177
|
-
}: GridProps<T> & Omit<
|
|
191
|
+
}: GridProps<T> & Omit<ComponentPropsWithRef<T>, keyof GridProps<T>>): JSX.Element
|
|
178
192
|
|
|
179
193
|
declare const GRID_AUTO_FLOW: readonly ['row', 'column', 'row dense', 'column dense', 'dense']
|
|
180
194
|
|
|
@@ -218,11 +232,11 @@ declare interface GridProps<T extends React.ElementType>
|
|
|
218
232
|
}
|
|
219
233
|
|
|
220
234
|
/** @public */
|
|
221
|
-
export declare function Heading<T extends
|
|
235
|
+
export declare function Heading<T extends ElementType = 'h2'>({
|
|
222
236
|
size,
|
|
223
237
|
weight,
|
|
224
238
|
...props
|
|
225
|
-
}: HeadingProps & Omit<
|
|
239
|
+
}: HeadingProps & Omit<ComponentPropsWithRef<T>, keyof HeadingProps>): JSX.Element
|
|
226
240
|
|
|
227
241
|
declare const HEADING_SIZE: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
228
242
|
|
|
@@ -249,15 +263,26 @@ declare type HeightProps = {
|
|
|
249
263
|
maxHeight?: Responsive<string>
|
|
250
264
|
}
|
|
251
265
|
|
|
266
|
+
/** @public */
|
|
267
|
+
export declare function HStack<T extends ElementType = 'div'>(
|
|
268
|
+
props: HStackProps<T> & Omit<ComponentPropsWithRef<T>, keyof HStackProps<T>>,
|
|
269
|
+
): JSX.Element
|
|
270
|
+
|
|
271
|
+
/** @public */
|
|
272
|
+
declare interface HStackProps<T extends React.ElementType> extends Pick<GapProps, 'gap'> {
|
|
273
|
+
/** Element to render */
|
|
274
|
+
as?: T
|
|
275
|
+
}
|
|
276
|
+
|
|
252
277
|
/** @public */
|
|
253
278
|
export declare function Icon({icon: Component, size, ...props}: IconProps): JSX.Element
|
|
254
279
|
|
|
255
280
|
declare const ICON_SIZE: readonly [0, 1, 2, 3, 4]
|
|
256
281
|
|
|
257
282
|
/** @public */
|
|
258
|
-
declare interface IconProps extends
|
|
283
|
+
declare interface IconProps extends ComponentProps<'svg'>, MarginProps, ToneProps {
|
|
259
284
|
/** Icon to render */
|
|
260
|
-
icon:
|
|
285
|
+
icon: React.ComponentType<SVGProps<SVGSVGElement>>
|
|
261
286
|
/** CSS **font-size** property */
|
|
262
287
|
size?: Responsive<IconSize>
|
|
263
288
|
/** CSS **color** property */
|
|
@@ -266,6 +291,21 @@ declare interface IconProps extends React_2.ComponentProps<'svg'>, MarginProps,
|
|
|
266
291
|
|
|
267
292
|
declare type IconSize = (typeof ICON_SIZE)[number]
|
|
268
293
|
|
|
294
|
+
/** @deprecated Use HStack component instead */
|
|
295
|
+
/** @public */
|
|
296
|
+
export declare function Inline<T extends ElementType = 'div'>(
|
|
297
|
+
props: InlineProps<T> & Omit<ComponentPropsWithRef<T>, keyof InlineProps<T>>,
|
|
298
|
+
): JSX.Element
|
|
299
|
+
|
|
300
|
+
/** @deprecated Use HStack component instead */
|
|
301
|
+
/** @public */
|
|
302
|
+
declare interface InlineProps<T extends React.ElementType> extends PaddingProps {
|
|
303
|
+
/** Element to render */
|
|
304
|
+
as?: T
|
|
305
|
+
/** CSS **gap** property */
|
|
306
|
+
gap?: Responsive<SpaceInherit>
|
|
307
|
+
}
|
|
308
|
+
|
|
269
309
|
declare const JUSTIFY_CONTENT: readonly [
|
|
270
310
|
'flex-start',
|
|
271
311
|
'flex-end',
|
|
@@ -277,6 +317,15 @@ declare const JUSTIFY_CONTENT: readonly [
|
|
|
277
317
|
|
|
278
318
|
declare type JustifyContent = (typeof JUSTIFY_CONTENT)[number]
|
|
279
319
|
|
|
320
|
+
/** @beta */
|
|
321
|
+
export declare function Label(props: LabelProps): JSX.Element
|
|
322
|
+
|
|
323
|
+
/** @beta */
|
|
324
|
+
declare interface LabelProps extends React.ComponentProps<'label'>, MarginProps {
|
|
325
|
+
/** Element to render */
|
|
326
|
+
disabled?: boolean
|
|
327
|
+
}
|
|
328
|
+
|
|
280
329
|
declare interface LayoutProps
|
|
281
330
|
extends
|
|
282
331
|
ToneProps,
|
|
@@ -292,21 +341,36 @@ declare interface LayoutProps
|
|
|
292
341
|
ZIndexProps,
|
|
293
342
|
ShadowProps {}
|
|
294
343
|
|
|
344
|
+
/** @beta */
|
|
345
|
+
export declare function Link({underlined, ...props}: LinkProps): JSX.Element
|
|
346
|
+
|
|
347
|
+
/** @beta */
|
|
348
|
+
declare interface LinkProps extends React.ComponentProps<'a'> {
|
|
349
|
+
/** If true, sets `target="_blank"` and `rel="noopener noreferrer"` */
|
|
350
|
+
openInNewTab?: boolean
|
|
351
|
+
/**
|
|
352
|
+
* If true, sets `text-decoration: underline`
|
|
353
|
+
*
|
|
354
|
+
* @defaultValue true
|
|
355
|
+
*/
|
|
356
|
+
underlined?: boolean
|
|
357
|
+
}
|
|
358
|
+
|
|
295
359
|
declare type MarginProps = {
|
|
296
360
|
/** CSS **margin** property */
|
|
297
|
-
margin?: Responsive<
|
|
361
|
+
margin?: Responsive<SpaceAutoNegative>
|
|
298
362
|
/** CSS **margin-left** and **margin-right** properties */
|
|
299
|
-
marginX?: Responsive<
|
|
363
|
+
marginX?: Responsive<SpaceAutoNegative>
|
|
300
364
|
/** CSS **margin-top** and **margin-bottom** properties */
|
|
301
|
-
marginY?: Responsive<
|
|
365
|
+
marginY?: Responsive<SpaceAutoNegative>
|
|
302
366
|
/** CSS **margin-top** property */
|
|
303
|
-
marginTop?: Responsive<
|
|
367
|
+
marginTop?: Responsive<SpaceAutoNegative>
|
|
304
368
|
/** CSS **margin-right** property */
|
|
305
|
-
marginRight?: Responsive<
|
|
369
|
+
marginRight?: Responsive<SpaceAutoNegative>
|
|
306
370
|
/** CSS **margin-bottom** property */
|
|
307
|
-
marginBottom?: Responsive<
|
|
371
|
+
marginBottom?: Responsive<SpaceAutoNegative>
|
|
308
372
|
/** CSS **margin-left** property */
|
|
309
|
-
marginLeft?: Responsive<
|
|
373
|
+
marginLeft?: Responsive<SpaceAutoNegative>
|
|
310
374
|
}
|
|
311
375
|
|
|
312
376
|
declare const OVERFLOW: readonly ['visible', 'hidden', 'auto', 'scroll', 'clip']
|
|
@@ -358,6 +422,15 @@ declare type PositionProps = {
|
|
|
358
422
|
left?: Responsive<SpaceAuto>
|
|
359
423
|
}
|
|
360
424
|
|
|
425
|
+
/** @beta */
|
|
426
|
+
export declare function Radio(props: RadioProps): JSX.Element
|
|
427
|
+
|
|
428
|
+
/** @beta */
|
|
429
|
+
declare interface RadioProps extends React.ComponentProps<'input'>, MarginProps {
|
|
430
|
+
/** Input label */
|
|
431
|
+
label: React.ReactNode
|
|
432
|
+
}
|
|
433
|
+
|
|
361
434
|
declare const RADIUS: readonly [0, 1, 2, 3, 4, 5, 6, 'full']
|
|
362
435
|
|
|
363
436
|
declare type Radius = (typeof RADIUS)[number]
|
|
@@ -389,19 +462,76 @@ declare type ShadowProps = {
|
|
|
389
462
|
shadow?: string
|
|
390
463
|
}
|
|
391
464
|
|
|
465
|
+
/** @beta */
|
|
466
|
+
export declare function SkipToContent(props: SkipToContentProps): JSX.Element
|
|
467
|
+
|
|
468
|
+
/** @beta */
|
|
469
|
+
declare interface SkipToContentProps extends React.ComponentProps<'a'> {
|
|
470
|
+
/**
|
|
471
|
+
* Anchor hash. The target element should be focusable or have `tabindex="-1"` applied.
|
|
472
|
+
*/
|
|
473
|
+
hash: string
|
|
474
|
+
/** Use href instead */
|
|
475
|
+
href?: never
|
|
476
|
+
/** Visible/announced label */
|
|
477
|
+
label: string
|
|
478
|
+
/** Use label instead */
|
|
479
|
+
children?: never
|
|
480
|
+
}
|
|
481
|
+
|
|
392
482
|
declare const SPACE: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
393
483
|
|
|
394
484
|
declare type Space = (typeof SPACE)[number]
|
|
395
485
|
|
|
396
486
|
declare const SPACE_AUTO: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'auto']
|
|
397
487
|
|
|
488
|
+
declare const SPACE_AUTO_NEGATIVE: readonly [
|
|
489
|
+
-9,
|
|
490
|
+
-8,
|
|
491
|
+
-7,
|
|
492
|
+
-6,
|
|
493
|
+
-5,
|
|
494
|
+
-4,
|
|
495
|
+
-3,
|
|
496
|
+
-2,
|
|
497
|
+
-1,
|
|
498
|
+
0,
|
|
499
|
+
1,
|
|
500
|
+
2,
|
|
501
|
+
3,
|
|
502
|
+
4,
|
|
503
|
+
5,
|
|
504
|
+
6,
|
|
505
|
+
7,
|
|
506
|
+
8,
|
|
507
|
+
9,
|
|
508
|
+
'auto',
|
|
509
|
+
]
|
|
510
|
+
|
|
511
|
+
declare const SPACE_INHERIT: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'inherit']
|
|
512
|
+
|
|
398
513
|
declare type SpaceAuto = (typeof SPACE_AUTO)[number]
|
|
399
514
|
|
|
515
|
+
declare type SpaceAutoNegative = (typeof SPACE_AUTO_NEGATIVE)[number]
|
|
516
|
+
|
|
517
|
+
declare type SpaceInherit = (typeof SPACE_INHERIT)[number]
|
|
518
|
+
|
|
519
|
+
/** @beta */
|
|
520
|
+
export declare function Switch(props: SwitchProps): JSX.Element
|
|
521
|
+
|
|
522
|
+
/** @beta */
|
|
523
|
+
declare interface SwitchProps extends React.ComponentProps<'input'>, MarginProps {
|
|
524
|
+
/** Input label */
|
|
525
|
+
label: React.ReactNode
|
|
526
|
+
/** Indeterminate state */
|
|
527
|
+
indeterminate?: boolean
|
|
528
|
+
}
|
|
529
|
+
|
|
400
530
|
/** @public */
|
|
401
|
-
declare function Text_2<T extends
|
|
531
|
+
declare function Text_2<T extends ElementType = 'span'>({
|
|
402
532
|
size,
|
|
403
533
|
...props
|
|
404
|
-
}: TextProps<T> & Omit<
|
|
534
|
+
}: TextProps<T> & Omit<ComponentPropsWithRef<T>, keyof TextProps<T>>): JSX.Element
|
|
405
535
|
export {Text_2 as Text}
|
|
406
536
|
|
|
407
537
|
declare const TEXT_ALIGN: readonly ['left', 'center', 'right', 'justify']
|
|
@@ -420,15 +550,7 @@ declare interface TextProps<T extends React.ElementType> extends TypographyProps
|
|
|
420
550
|
|
|
421
551
|
declare type TextSize = (typeof TEXT_SIZE)[number]
|
|
422
552
|
|
|
423
|
-
declare const TONE: readonly [
|
|
424
|
-
'none',
|
|
425
|
-
'neutral',
|
|
426
|
-
'primary',
|
|
427
|
-
'positive',
|
|
428
|
-
'suggest',
|
|
429
|
-
'caution',
|
|
430
|
-
'critical',
|
|
431
|
-
]
|
|
553
|
+
declare const TONE: readonly ['neutral', 'positive', 'suggest', 'caution', 'critical']
|
|
432
554
|
|
|
433
555
|
declare type Tone = (typeof TONE)[number]
|
|
434
556
|
|
|
@@ -450,6 +572,30 @@ declare interface TypographyProps extends MarginProps, ToneProps {
|
|
|
450
572
|
weight?: FontWeight
|
|
451
573
|
}
|
|
452
574
|
|
|
575
|
+
/** @public */
|
|
576
|
+
export declare function VisuallyHidden<T extends ElementType = 'span'>(
|
|
577
|
+
props: VisuallyHiddenProps<T> & Omit<ComponentPropsWithRef<T>, keyof VisuallyHiddenProps<T>>,
|
|
578
|
+
): JSX.Element
|
|
579
|
+
|
|
580
|
+
/** @public */
|
|
581
|
+
declare interface VisuallyHiddenProps<T extends React.ElementType> {
|
|
582
|
+
/** Element to render */
|
|
583
|
+
as?: T
|
|
584
|
+
/** If true, element is visible on :focus-visible */
|
|
585
|
+
visibleOnFocus?: boolean
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/** @public */
|
|
589
|
+
export declare function VStack<T extends ElementType = 'div'>(
|
|
590
|
+
props: VStackProps<T> & Omit<ComponentPropsWithRef<T>, keyof VStackProps<T>>,
|
|
591
|
+
): JSX.Element
|
|
592
|
+
|
|
593
|
+
/** @public */
|
|
594
|
+
declare interface VStackProps<T extends React.ElementType> extends Pick<GapProps, 'gap'> {
|
|
595
|
+
/** Element to render */
|
|
596
|
+
as?: T
|
|
597
|
+
}
|
|
598
|
+
|
|
453
599
|
declare type WidthProps = {
|
|
454
600
|
/** CSS **width** property */
|
|
455
601
|
width?: Responsive<string>
|