@sanity-labs/ui-poc 0.0.1-alpha.10 → 0.0.1-alpha.12
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/_chunks-es/LazyRefractor.js +9 -0
- package/dist/_chunks-es/LazyRefractor.js.map +1 -0
- package/dist/index.d.ts +129 -18
- package/dist/index.js +322 -56
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -8931
- package/package.json +27 -21
- package/src/components/box/Box.tsx +3 -3
- package/src/components/card/Card.tsx +3 -3
- package/src/components/checkbox/Checkbox.tsx +51 -0
- package/src/components/checkbox/checkbox.css +36 -0
- package/src/components/checkbox/checkbox.props.ts +20 -0
- package/src/components/code/Code.tsx +37 -0
- package/src/components/code/LazyRefractor.tsx +9 -0
- package/src/components/code/code.css +36 -0
- package/src/components/code/code.props.ts +35 -0
- package/src/components/container/Container.tsx +25 -0
- package/src/components/container/container.css +4 -0
- package/src/components/container/container.props.ts +24 -0
- package/src/components/flex/Flex.tsx +3 -3
- package/src/components/grid/Grid.tsx +3 -3
- package/src/components/heading/Heading.tsx +3 -3
- package/src/components/heading/heading.props.ts +2 -1
- package/src/components/icon/Icon.tsx +18 -0
- package/src/components/icon/icon.css +17 -0
- package/src/components/icon/icon.props.ts +29 -0
- package/src/components/index.css +8 -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/radio/Radio.tsx +34 -0
- package/src/components/radio/radio.css +26 -0
- package/src/components/radio/radio.props.ts +15 -0
- package/src/components/switch/Switch.tsx +50 -0
- package/src/components/switch/switch.css +40 -0
- package/src/components/switch/switch.props.ts +20 -0
- package/src/components/text/Text.tsx +3 -3
- package/src/components/text/text.props.ts +3 -4
- 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 +13 -0
- package/src/css/classes/local/text-trim.css +6 -0
- package/src/css/classes/system/container.css +6 -6
- package/src/css/classes/system/margin.css +0 -7
- package/src/css/classes/system/padding.css +0 -7
- package/src/css/classes/system/radius.css +1 -1
- package/src/css/global/reset.css +5 -2
- package/src/css/tokens/border.css +1 -1
- package/src/index.css +10 -2
- package/src/index.ts +8 -0
- package/src/props/border.ts +5 -5
- package/src/props/typography.ts +2 -2
- package/src/types/Code.ts +5 -0
- package/src/types/Container.ts +2 -0
- package/src/types/Icon.ts +2 -0
- package/src/types/PropDef.ts +22 -5
- package/src/types/Responsive.ts +0 -1
- package/src/utils/getProps.test.ts +1 -1
- package/src/utils/getProps.ts +2 -2
- package/dist/components.css +0 -38
- package/dist/utilities.css +0 -9659
|
@@ -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,5 +1,8 @@
|
|
|
1
|
+
import type {ComponentProps} from 'react'
|
|
2
|
+
import type {ComponentPropsWithRef} from 'react'
|
|
3
|
+
import type {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,60 @@ 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
|
+
|
|
66
|
+
/** @public */
|
|
67
|
+
export declare function Code<T extends React.ElementType = 'pre'>({
|
|
68
|
+
size,
|
|
69
|
+
...props
|
|
70
|
+
}: CodeProps & Omit<React.ComponentPropsWithRef<T>, keyof CodeProps>): JSX.Element
|
|
71
|
+
|
|
72
|
+
declare const CODE_SIZE: readonly [0, 1, 2, 3, 4]
|
|
73
|
+
|
|
74
|
+
declare const CODE_TAG: readonly ['pre', 'span']
|
|
75
|
+
|
|
76
|
+
/** @public */
|
|
77
|
+
declare interface CodeProps
|
|
78
|
+
extends React.ComponentProps<'pre'>, Omit<TypographyProps, 'align' | 'lineClamp' | 'tone'> {
|
|
79
|
+
/** Element to render */
|
|
80
|
+
as?: CodeTag
|
|
81
|
+
/** Refractor language for syntax highlighting */
|
|
82
|
+
language?: string
|
|
83
|
+
/** CSS **font-size** property */
|
|
84
|
+
size?: Responsive<CodeSize>
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare type CodeSize = (typeof CODE_SIZE)[number]
|
|
88
|
+
|
|
89
|
+
declare type CodeTag = (typeof CODE_TAG)[number]
|
|
90
|
+
|
|
91
|
+
/** @public */
|
|
92
|
+
export declare function Container<T extends ElementType = 'div'>({
|
|
93
|
+
marginX,
|
|
94
|
+
...props
|
|
95
|
+
}: ContainerProps<T> & Omit<ComponentPropsWithRef<T>, keyof ContainerProps<T>>): JSX.Element
|
|
96
|
+
|
|
97
|
+
declare const CONTAINER_SIZE: readonly [0, 1, 2, 3, 4, 5]
|
|
98
|
+
|
|
99
|
+
/** @public */
|
|
100
|
+
declare interface ContainerProps<T extends React.ElementType> extends LayoutProps {
|
|
101
|
+
/** Element to render */
|
|
102
|
+
as?: T
|
|
103
|
+
/** CSS **max-width** property */
|
|
104
|
+
contentSize?: Responsive<ContainerSize>
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare type ContainerSize = (typeof CONTAINER_SIZE)[number]
|
|
108
|
+
|
|
52
109
|
declare const DENSITY: readonly ['compact', 'regular', 'loose']
|
|
53
110
|
|
|
54
111
|
declare type Density = (typeof DENSITY)[number]
|
|
@@ -72,10 +129,10 @@ export declare function Divider(props: DividerProps): JSX.Element
|
|
|
72
129
|
declare interface DividerProps extends React.ComponentProps<'hr'>, MarginProps {}
|
|
73
130
|
|
|
74
131
|
/** @public */
|
|
75
|
-
export declare function Flex<T extends
|
|
132
|
+
export declare function Flex<T extends ElementType = 'div'>({
|
|
76
133
|
display,
|
|
77
134
|
...props
|
|
78
|
-
}: FlexProps<T> & Omit<
|
|
135
|
+
}: FlexProps<T> & Omit<ComponentPropsWithRef<T>, keyof FlexProps<T>>): JSX.Element
|
|
79
136
|
|
|
80
137
|
declare const FLEX_DIRECTION: readonly ['row', 'row-reverse', 'column', 'column-reverse']
|
|
81
138
|
|
|
@@ -128,10 +185,10 @@ declare type GapProps = {
|
|
|
128
185
|
}
|
|
129
186
|
|
|
130
187
|
/** @public */
|
|
131
|
-
export declare function Grid<T extends
|
|
188
|
+
export declare function Grid<T extends ElementType = 'div'>({
|
|
132
189
|
display,
|
|
133
190
|
...props
|
|
134
|
-
}: GridProps<T> & Omit<
|
|
191
|
+
}: GridProps<T> & Omit<ComponentPropsWithRef<T>, keyof GridProps<T>>): JSX.Element
|
|
135
192
|
|
|
136
193
|
declare const GRID_AUTO_FLOW: readonly ['row', 'column', 'row dense', 'column dense', 'dense']
|
|
137
194
|
|
|
@@ -175,11 +232,11 @@ declare interface GridProps<T extends React.ElementType>
|
|
|
175
232
|
}
|
|
176
233
|
|
|
177
234
|
/** @public */
|
|
178
|
-
export declare function Heading<T extends
|
|
235
|
+
export declare function Heading<T extends ElementType = 'h2'>({
|
|
179
236
|
size,
|
|
180
237
|
weight,
|
|
181
238
|
...props
|
|
182
|
-
}: HeadingProps & Omit<
|
|
239
|
+
}: HeadingProps & Omit<ComponentPropsWithRef<T>, keyof HeadingProps>): JSX.Element
|
|
183
240
|
|
|
184
241
|
declare const HEADING_SIZE: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
185
242
|
|
|
@@ -190,7 +247,7 @@ declare interface HeadingProps extends TypographyProps {
|
|
|
190
247
|
/** Element to render */
|
|
191
248
|
as?: HeadingTag
|
|
192
249
|
/** CSS **font-size** property */
|
|
193
|
-
size?: HeadingSize
|
|
250
|
+
size?: Responsive<HeadingSize>
|
|
194
251
|
}
|
|
195
252
|
|
|
196
253
|
declare type HeadingSize = (typeof HEADING_SIZE)[number]
|
|
@@ -206,6 +263,23 @@ declare type HeightProps = {
|
|
|
206
263
|
maxHeight?: Responsive<string>
|
|
207
264
|
}
|
|
208
265
|
|
|
266
|
+
/** @public */
|
|
267
|
+
export declare function Icon({icon: Component, size, ...props}: IconProps): JSX.Element
|
|
268
|
+
|
|
269
|
+
declare const ICON_SIZE: readonly [0, 1, 2, 3, 4]
|
|
270
|
+
|
|
271
|
+
/** @public */
|
|
272
|
+
declare interface IconProps extends ComponentProps<'svg'>, MarginProps, ToneProps {
|
|
273
|
+
/** Icon to render */
|
|
274
|
+
icon: React.ComponentType<SVGProps<SVGSVGElement>>
|
|
275
|
+
/** CSS **font-size** property */
|
|
276
|
+
size?: Responsive<IconSize>
|
|
277
|
+
/** CSS **color** property */
|
|
278
|
+
muted?: TypographyProps['muted']
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
declare type IconSize = (typeof ICON_SIZE)[number]
|
|
282
|
+
|
|
209
283
|
declare const JUSTIFY_CONTENT: readonly [
|
|
210
284
|
'flex-start',
|
|
211
285
|
'flex-end',
|
|
@@ -217,6 +291,15 @@ declare const JUSTIFY_CONTENT: readonly [
|
|
|
217
291
|
|
|
218
292
|
declare type JustifyContent = (typeof JUSTIFY_CONTENT)[number]
|
|
219
293
|
|
|
294
|
+
/** @beta */
|
|
295
|
+
export declare function Label(props: LabelProps): JSX.Element
|
|
296
|
+
|
|
297
|
+
/** @beta */
|
|
298
|
+
declare interface LabelProps extends React.ComponentProps<'label'>, MarginProps {
|
|
299
|
+
/** Element to render */
|
|
300
|
+
disabled?: boolean
|
|
301
|
+
}
|
|
302
|
+
|
|
220
303
|
declare interface LayoutProps
|
|
221
304
|
extends
|
|
222
305
|
ToneProps,
|
|
@@ -298,6 +381,15 @@ declare type PositionProps = {
|
|
|
298
381
|
left?: Responsive<SpaceAuto>
|
|
299
382
|
}
|
|
300
383
|
|
|
384
|
+
/** @beta */
|
|
385
|
+
export declare function Radio(props: RadioProps): JSX.Element
|
|
386
|
+
|
|
387
|
+
/** @beta */
|
|
388
|
+
declare interface RadioProps extends React.ComponentProps<'input'>, MarginProps {
|
|
389
|
+
/** Input label */
|
|
390
|
+
label: React.ReactNode
|
|
391
|
+
}
|
|
392
|
+
|
|
301
393
|
declare const RADIUS: readonly [0, 1, 2, 3, 4, 5, 6, 'full']
|
|
302
394
|
|
|
303
395
|
declare type Radius = (typeof RADIUS)[number]
|
|
@@ -323,9 +415,6 @@ declare type Responsive<T> =
|
|
|
323
415
|
| ([T | undefined, ...(T | undefined)[]] & {
|
|
324
416
|
length: 6
|
|
325
417
|
})
|
|
326
|
-
| ([T | undefined, ...(T | undefined)[]] & {
|
|
327
|
-
length: 7
|
|
328
|
-
})
|
|
329
418
|
|
|
330
419
|
declare type ShadowProps = {
|
|
331
420
|
/** CSS **box-shadow** property */
|
|
@@ -340,11 +429,22 @@ declare const SPACE_AUTO: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'auto']
|
|
|
340
429
|
|
|
341
430
|
declare type SpaceAuto = (typeof SPACE_AUTO)[number]
|
|
342
431
|
|
|
432
|
+
/** @beta */
|
|
433
|
+
export declare function Switch(props: SwitchProps): JSX.Element
|
|
434
|
+
|
|
435
|
+
/** @beta */
|
|
436
|
+
declare interface SwitchProps extends React.ComponentProps<'input'>, MarginProps {
|
|
437
|
+
/** Input label */
|
|
438
|
+
label: React.ReactNode
|
|
439
|
+
/** Indeterminate state */
|
|
440
|
+
indeterminate?: boolean
|
|
441
|
+
}
|
|
442
|
+
|
|
343
443
|
/** @public */
|
|
344
|
-
declare function Text_2<T extends
|
|
444
|
+
declare function Text_2<T extends ElementType = 'span'>({
|
|
345
445
|
size,
|
|
346
446
|
...props
|
|
347
|
-
}: TextProps<T> & Omit<
|
|
447
|
+
}: TextProps<T> & Omit<ComponentPropsWithRef<T>, keyof TextProps<T>>): JSX.Element
|
|
348
448
|
export {Text_2 as Text}
|
|
349
449
|
|
|
350
450
|
declare const TEXT_ALIGN: readonly ['left', 'center', 'right', 'justify']
|
|
@@ -358,7 +458,7 @@ declare interface TextProps<T extends React.ElementType> extends TypographyProps
|
|
|
358
458
|
/** Element to render */
|
|
359
459
|
as?: T
|
|
360
460
|
/** CSS **font-size** property */
|
|
361
|
-
size?: TextSize
|
|
461
|
+
size?: Responsive<TextSize>
|
|
362
462
|
}
|
|
363
463
|
|
|
364
464
|
declare type TextSize = (typeof TEXT_SIZE)[number]
|
|
@@ -393,6 +493,17 @@ declare interface TypographyProps extends MarginProps, ToneProps {
|
|
|
393
493
|
weight?: FontWeight
|
|
394
494
|
}
|
|
395
495
|
|
|
496
|
+
/** @public */
|
|
497
|
+
export declare function VisuallyHidden<T extends ElementType = 'span'>(
|
|
498
|
+
props: VisuallyHiddenProps<T> & Omit<ComponentPropsWithRef<T>, keyof VisuallyHiddenProps<T>>,
|
|
499
|
+
): JSX.Element
|
|
500
|
+
|
|
501
|
+
/** @public */
|
|
502
|
+
declare interface VisuallyHiddenProps<T extends React.ElementType> {
|
|
503
|
+
/** Element to render */
|
|
504
|
+
as?: T
|
|
505
|
+
}
|
|
506
|
+
|
|
396
507
|
declare type WidthProps = {
|
|
397
508
|
/** CSS **width** property */
|
|
398
509
|
width?: Responsive<string>
|