@sanity-labs/ui-poc 0.0.1-alpha.13 → 0.0.1-alpha.14
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 +154 -12
- package/dist/index.js +430 -135
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/button/Button.tsx +61 -0
- package/src/components/button/button.css +80 -0
- package/src/components/button/button.props.ts +88 -0
- package/src/components/checkbox/Checkbox.tsx +8 -3
- package/src/components/checkbox/checkbox.css +74 -14
- package/src/components/checkbox/checkbox.props.ts +9 -4
- package/src/components/code/Code.tsx +4 -3
- package/src/components/code/code.props.ts +5 -3
- package/src/components/heading/heading.css +4 -4
- package/src/components/icon/icon.css +4 -4
- package/src/components/icon/icon.props.ts +2 -3
- package/src/components/index.css +5 -0
- package/src/components/indicator/Indicator.tsx +37 -0
- package/src/components/indicator/indicator.css +4 -0
- package/src/components/indicator/indicator.props.ts +20 -0
- package/src/components/indicator-group/IndicatorGroup.tsx +26 -0
- package/src/components/indicator-group/indicator-group.css +7 -0
- package/src/components/indicator-group/indicatorGroup.props.ts +13 -0
- package/src/components/label/Label.tsx +2 -1
- package/src/components/label/label.css +2 -2
- package/src/components/label/label.props.ts +4 -0
- package/src/components/list/List.tsx +106 -0
- package/src/components/list/list.css +10 -0
- package/src/components/list/list.props.ts +78 -0
- package/src/components/radio/Radio.tsx +11 -4
- package/src/components/radio/radio.css +82 -12
- package/src/components/radio/radio.props.ts +5 -0
- package/src/components/spinner/Spinner.tsx +23 -0
- package/src/components/spinner/spinner.css +10 -0
- package/src/components/spinner/spinner.props.ts +16 -0
- package/src/components/switch/Switch.tsx +7 -16
- package/src/components/switch/switch.css +96 -24
- package/src/components/switch/switch.props.ts +5 -5
- package/src/components/text/text.css +4 -4
- package/src/css/classes/dynamic/width.css +2 -0
- package/src/css/classes/local/tone.css +1 -9
- package/src/css/global/reset.css +1 -0
- package/src/css/tokens/index.css +2 -0
- package/src/css/tokens/semantic.css +21 -0
- package/src/css/tokens/surface.css +27 -0
- package/src/index.ts +5 -0
- package/src/types/Button.ts +8 -0
- package/src/types/Interactive.ts +8 -0
- package/src/types/List.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type {ComponentProps} from 'react'
|
|
|
2
2
|
import {ComponentPropsWithRef} from 'react'
|
|
3
3
|
import {ElementType} from 'react'
|
|
4
4
|
import {JSX} from 'react/jsx-runtime'
|
|
5
|
+
import type {default as React_2} from 'react'
|
|
5
6
|
import type {SVGProps} from 'react'
|
|
6
7
|
|
|
7
8
|
declare const ALIGN_ITEMS: readonly ['baseline', 'center', 'flex-end', 'flex-start', 'stretch']
|
|
@@ -37,6 +38,48 @@ declare interface BoxProps<T extends React.ElementType> extends LayoutProps {
|
|
|
37
38
|
display?: Responsive<DisplayBlock>
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
/** @public */
|
|
42
|
+
export declare function Button<T extends ElementType = 'button'>({
|
|
43
|
+
density,
|
|
44
|
+
level,
|
|
45
|
+
tone,
|
|
46
|
+
...props
|
|
47
|
+
}: ButtonProps<T> & Omit<ComponentPropsWithRef<T>, keyof ButtonProps<T>>): JSX.Element
|
|
48
|
+
|
|
49
|
+
declare const BUTTON_DENSITY: readonly ['regular', 'loose']
|
|
50
|
+
|
|
51
|
+
declare const BUTTON_LEVEL: readonly ['primary', 'secondary', 'tertiary']
|
|
52
|
+
|
|
53
|
+
declare const BUTTON_TONE: readonly ['neutral', 'critical']
|
|
54
|
+
|
|
55
|
+
declare type ButtonDensity = (typeof BUTTON_DENSITY)[number]
|
|
56
|
+
|
|
57
|
+
declare type ButtonLevel = (typeof BUTTON_LEVEL)[number]
|
|
58
|
+
|
|
59
|
+
/** @public */
|
|
60
|
+
declare interface ButtonProps<T extends React.ElementType> {
|
|
61
|
+
/** Element to render */
|
|
62
|
+
as?: InteractiveAs<T>
|
|
63
|
+
/** Composite prop for setting padding and gap */
|
|
64
|
+
density?: ButtonDensity
|
|
65
|
+
/** Set CSS **width** property to 100% */
|
|
66
|
+
fullWidth?: Responsive<boolean>
|
|
67
|
+
/** Starting icon */
|
|
68
|
+
iconStart?: React.ElementType | React.ReactNode
|
|
69
|
+
/** Ending icon */
|
|
70
|
+
iconEnd?: React.ElementType | React.ReactNode
|
|
71
|
+
/** Button level */
|
|
72
|
+
level?: ButtonLevel
|
|
73
|
+
/** Loading state */
|
|
74
|
+
loading?: boolean
|
|
75
|
+
/** Button text */
|
|
76
|
+
text?: string
|
|
77
|
+
/** Button tone */
|
|
78
|
+
tone?: ButtonTone
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare type ButtonTone = (typeof BUTTON_TONE)[number]
|
|
82
|
+
|
|
40
83
|
/** @public */
|
|
41
84
|
export declare function Card<T extends ElementType = 'div'>({
|
|
42
85
|
density,
|
|
@@ -57,27 +100,31 @@ export declare function Checkbox(props: CheckboxProps): JSX.Element
|
|
|
57
100
|
|
|
58
101
|
/** @beta */
|
|
59
102
|
declare interface CheckboxProps extends React.ComponentProps<'input'>, MarginProps {
|
|
60
|
-
/**
|
|
61
|
-
|
|
103
|
+
/** Error state */
|
|
104
|
+
error?: boolean
|
|
62
105
|
/** Indeterminate state */
|
|
63
106
|
indeterminate?: boolean
|
|
107
|
+
/** Input label */
|
|
108
|
+
label: React.ReactNode
|
|
64
109
|
}
|
|
65
110
|
|
|
66
111
|
/** @public */
|
|
67
|
-
export declare function Code<T extends
|
|
112
|
+
export declare function Code<T extends CodeTag = 'pre'>({
|
|
68
113
|
size,
|
|
69
114
|
...props
|
|
70
|
-
}: CodeProps & Omit<
|
|
115
|
+
}: CodeProps<T> & Omit<ComponentPropsWithRef<T>, keyof CodeProps<T>>): JSX.Element
|
|
71
116
|
|
|
72
117
|
declare const CODE_SIZE: readonly [0, 1, 2, 3, 4]
|
|
73
118
|
|
|
74
119
|
declare const CODE_TAG: readonly ['pre', 'span']
|
|
75
120
|
|
|
76
121
|
/** @public */
|
|
77
|
-
declare interface CodeProps
|
|
78
|
-
|
|
122
|
+
declare interface CodeProps<T extends CodeTag> extends Omit<
|
|
123
|
+
TypographyProps,
|
|
124
|
+
'align' | 'lineClamp' | 'tone'
|
|
125
|
+
> {
|
|
79
126
|
/** Element to render */
|
|
80
|
-
as?:
|
|
127
|
+
as?: T
|
|
81
128
|
/** Refractor language for syntax highlighting */
|
|
82
129
|
language?: string
|
|
83
130
|
/** CSS **font-size** property */
|
|
@@ -280,17 +327,41 @@ export declare function Icon({icon: Component, size, ...props}: IconProps): JSX.
|
|
|
280
327
|
declare const ICON_SIZE: readonly [0, 1, 2, 3, 4]
|
|
281
328
|
|
|
282
329
|
/** @public */
|
|
283
|
-
declare interface IconProps
|
|
330
|
+
declare interface IconProps
|
|
331
|
+
extends ComponentProps<'svg'>, Pick<TypographyProps, 'muted'>, MarginProps, ToneProps {
|
|
284
332
|
/** Icon to render */
|
|
285
333
|
icon: React.ComponentType<SVGProps<SVGSVGElement>>
|
|
286
334
|
/** CSS **font-size** property */
|
|
287
335
|
size?: Responsive<IconSize>
|
|
288
|
-
/** CSS **color** property */
|
|
289
|
-
muted?: TypographyProps['muted']
|
|
290
336
|
}
|
|
291
337
|
|
|
292
338
|
declare type IconSize = (typeof ICON_SIZE)[number]
|
|
293
339
|
|
|
340
|
+
/** @beta */
|
|
341
|
+
export declare function Indicator<T extends ElementType = 'span'>({
|
|
342
|
+
tone,
|
|
343
|
+
...props
|
|
344
|
+
}: IndicatorProps<T> & Omit<ComponentPropsWithRef<T>, keyof IndicatorProps<T>>): JSX.Element
|
|
345
|
+
|
|
346
|
+
/** @public */
|
|
347
|
+
export declare function IndicatorGroup<T extends ElementType = 'div'>(
|
|
348
|
+
props: IndicatorGroupProps<T> & Omit<ComponentPropsWithRef<T>, keyof IndicatorGroupProps<T>>,
|
|
349
|
+
): JSX.Element
|
|
350
|
+
|
|
351
|
+
/** @public */
|
|
352
|
+
declare interface IndicatorGroupProps<T extends React.ElementType> {
|
|
353
|
+
/** Element to render */
|
|
354
|
+
as?: T
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** @beta */
|
|
358
|
+
declare interface IndicatorProps<T extends React.ElementType> extends ToneProps {
|
|
359
|
+
/** Element to render */
|
|
360
|
+
as?: T
|
|
361
|
+
/** Label for aria-label attribute */
|
|
362
|
+
label?: string
|
|
363
|
+
}
|
|
364
|
+
|
|
294
365
|
/** @deprecated Use HStack component instead */
|
|
295
366
|
/** @public */
|
|
296
367
|
export declare function Inline<T extends ElementType = 'div'>(
|
|
@@ -306,6 +377,16 @@ declare interface InlineProps<T extends React.ElementType> extends PaddingProps
|
|
|
306
377
|
gap?: Responsive<SpaceInherit>
|
|
307
378
|
}
|
|
308
379
|
|
|
380
|
+
declare const INTERACTIVE_TAG: readonly ['button', 'a']
|
|
381
|
+
|
|
382
|
+
declare type InteractiveAs<T extends React.ElementType> = T extends InteractiveTag
|
|
383
|
+
? T
|
|
384
|
+
: T extends string
|
|
385
|
+
? never
|
|
386
|
+
: T
|
|
387
|
+
|
|
388
|
+
declare type InteractiveTag = (typeof INTERACTIVE_TAG)[number]
|
|
389
|
+
|
|
309
390
|
declare const JUSTIFY_CONTENT: readonly [
|
|
310
391
|
'flex-start',
|
|
311
392
|
'flex-end',
|
|
@@ -324,6 +405,7 @@ export declare function Label(props: LabelProps): JSX.Element
|
|
|
324
405
|
declare interface LabelProps extends React.ComponentProps<'label'>, MarginProps {
|
|
325
406
|
/** Element to render */
|
|
326
407
|
disabled?: boolean
|
|
408
|
+
error?: boolean
|
|
327
409
|
}
|
|
328
410
|
|
|
329
411
|
declare interface LayoutProps
|
|
@@ -356,6 +438,56 @@ declare interface LinkProps extends React.ComponentProps<'a'> {
|
|
|
356
438
|
underlined?: boolean
|
|
357
439
|
}
|
|
358
440
|
|
|
441
|
+
/** @beta */
|
|
442
|
+
export declare const List: typeof ListRoot
|
|
443
|
+
|
|
444
|
+
declare const LIST_TAG: readonly ['ol', 'ul']
|
|
445
|
+
|
|
446
|
+
declare function ListItem({density, ...props}: ListItemProps): JSX.Element
|
|
447
|
+
|
|
448
|
+
declare function ListItemImage(props: ComponentProps<'img'>): JSX.Element
|
|
449
|
+
|
|
450
|
+
/** @beta */
|
|
451
|
+
declare interface ListItemProps extends React_2.ComponentProps<'li'> {
|
|
452
|
+
/** Composite prop for setting padding and gap */
|
|
453
|
+
density?: Responsive<Density>
|
|
454
|
+
/** Trailing slot */
|
|
455
|
+
trailing?: React_2.ReactNode
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
declare function ListItemText<T extends ElementType = 'div'>(
|
|
459
|
+
props: ListItemTextProps<T> & Omit<ComponentPropsWithRef<T>, keyof ListItemTextProps<T>>,
|
|
460
|
+
): JSX.Element
|
|
461
|
+
|
|
462
|
+
/** @beta */
|
|
463
|
+
declare interface ListItemTextProps<T extends React_2.ElementType> {
|
|
464
|
+
/** Element to render */
|
|
465
|
+
as?: T
|
|
466
|
+
/** Title text */
|
|
467
|
+
title?: React_2.ReactNode
|
|
468
|
+
/** Subtitle text */
|
|
469
|
+
subtitle?: React_2.ReactNode
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/** @beta */
|
|
473
|
+
declare interface ListProps<T extends ListTag> {
|
|
474
|
+
/** Element to render */
|
|
475
|
+
as?: T
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
declare function ListRoot<T extends ListTag = 'ul'>(
|
|
479
|
+
props: ListProps<T> & Omit<ComponentPropsWithRef<T>, keyof ListProps<T>>,
|
|
480
|
+
): JSX.Element
|
|
481
|
+
|
|
482
|
+
declare namespace ListRoot {
|
|
483
|
+
var displayName: string
|
|
484
|
+
var Item: typeof ListItem
|
|
485
|
+
var ItemText: typeof ListItemText
|
|
486
|
+
var ItemImage: typeof ListItemImage
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
declare type ListTag = (typeof LIST_TAG)[number]
|
|
490
|
+
|
|
359
491
|
declare type MarginProps = {
|
|
360
492
|
/** CSS **margin** property */
|
|
361
493
|
margin?: Responsive<SpaceAutoNegative>
|
|
@@ -427,6 +559,8 @@ export declare function Radio(props: RadioProps): JSX.Element
|
|
|
427
559
|
|
|
428
560
|
/** @beta */
|
|
429
561
|
declare interface RadioProps extends React.ComponentProps<'input'>, MarginProps {
|
|
562
|
+
/** Error state */
|
|
563
|
+
error?: boolean
|
|
430
564
|
/** Input label */
|
|
431
565
|
label: React.ReactNode
|
|
432
566
|
}
|
|
@@ -516,15 +650,23 @@ declare type SpaceAutoNegative = (typeof SPACE_AUTO_NEGATIVE)[number]
|
|
|
516
650
|
|
|
517
651
|
declare type SpaceInherit = (typeof SPACE_INHERIT)[number]
|
|
518
652
|
|
|
653
|
+
/** @public */
|
|
654
|
+
export declare function Spinner({size, ...props}: SpinnerProps): JSX.Element
|
|
655
|
+
|
|
656
|
+
/** @public */
|
|
657
|
+
declare interface SpinnerProps extends React.ComponentProps<'svg'> {
|
|
658
|
+
size?: Responsive<IconSize>
|
|
659
|
+
}
|
|
660
|
+
|
|
519
661
|
/** @beta */
|
|
520
662
|
export declare function Switch(props: SwitchProps): JSX.Element
|
|
521
663
|
|
|
522
664
|
/** @beta */
|
|
523
665
|
declare interface SwitchProps extends React.ComponentProps<'input'>, MarginProps {
|
|
666
|
+
/** Error state */
|
|
667
|
+
error?: boolean
|
|
524
668
|
/** Input label */
|
|
525
669
|
label: React.ReactNode
|
|
526
|
-
/** Indeterminate state */
|
|
527
|
-
indeterminate?: boolean
|
|
528
670
|
}
|
|
529
671
|
|
|
530
672
|
/** @public */
|