@sanity-labs/ui-poc 0.0.1-alpha.13 → 0.0.1-alpha.15
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/README.md +151 -0
- package/dist/index.d.ts +220 -14
- package/dist/index.js +594 -136
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/button/Button.tsx +62 -0
- package/src/components/button/button.css +81 -0
- package/src/components/button/button.props.ts +104 -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.tsx +3 -2
- package/src/components/icon/icon.css +4 -4
- package/src/components/icon/icon.props.ts +5 -3
- package/src/components/icon-button/IconButton.tsx +27 -0
- package/src/components/icon-button/iconButton.props.ts +26 -0
- package/src/components/index.css +6 -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-stack/IndicatorStack.tsx +26 -0
- package/src/components/indicator-stack/indicator-stack.css +7 -0
- package/src/components/indicator-stack/indicatorStack.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/components/tooltip/Tooltip.tsx +83 -0
- package/src/components/tooltip/tooltip.css +48 -0
- package/src/components/tooltip/tooltip.props.ts +20 -0
- package/src/components/tooltip-group/TooltipGroup.tsx +62 -0
- package/src/components/tooltip-group/tooltipGroup.props.ts +13 -0
- package/src/css/classes/dynamic/width.css +2 -0
- package/src/css/classes/generic/index.css +1 -0
- package/src/css/classes/generic/placement.css +171 -0
- package/src/css/classes/local/tone.css +1 -9
- package/src/css/classes/system/margin.css +40 -40
- 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 +8 -0
- package/src/props/placement.ts +15 -0
- package/src/props/shadow.ts +2 -2
- package/src/types/Button.ts +8 -0
- package/src/types/Interactive.ts +8 -0
- package/src/types/List.ts +2 -0
- package/src/types/Placement.ts +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Sanity UI 4
|
|
2
|
+
|
|
3
|
+
The next version of Sanity's component library. Faster, simpler, and built on CSS instead of styled-components.
|
|
4
|
+
|
|
5
|
+
## What's different from v3
|
|
6
|
+
|
|
7
|
+
- **CSS classes instead of styled-components.** No runtime style generation. Smaller bundles, faster renders.
|
|
8
|
+
- **Direct props for layout.** Width, height, position, border, and overflow are first-class props — no more `style={{ ... }}` escape hatches.
|
|
9
|
+
- **Works alongside v3.** Install both packages in the same app. No forced migration.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm add @sanity-labs/ui-poc
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires React 19.2+ and Node >=20.19 <22 || >=22.12.
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
Import the stylesheet at your app entry point. Without it, components render as unstyled HTML with no error.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import '@sanity-labs/ui-poc/styles.css'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If your app uses Sanity UI v3, keep the existing `ThemeProvider` setup.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import {ThemeProvider, studioTheme, ToastProvider} from '@sanity/ui'
|
|
31
|
+
import '@sanity-labs/ui-poc/styles.css'
|
|
32
|
+
import App from './App'
|
|
33
|
+
|
|
34
|
+
createRoot(document.getElementById('root')!).render(
|
|
35
|
+
<ThemeProvider theme={studioTheme}>
|
|
36
|
+
<ToastProvider>
|
|
37
|
+
<App />
|
|
38
|
+
</ToastProvider>
|
|
39
|
+
</ThemeProvider>,
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
Import from `@sanity-labs/ui-poc`. Components not yet in v4 — Menu, Dialog, TextInput, Badge — remain in `@sanity/ui`.
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import {Box, Flex, Card, Heading, Text, Button} from '@sanity-labs/ui-poc'
|
|
49
|
+
import {AddIcon} from '@sanity/icons'
|
|
50
|
+
|
|
51
|
+
export default function App() {
|
|
52
|
+
return (
|
|
53
|
+
<Flex minHeight="100vh">
|
|
54
|
+
<Box as="nav" aria-label="Main" padding={3} borderRight width="240px">
|
|
55
|
+
<Heading as="h2" size={1}>
|
|
56
|
+
My App
|
|
57
|
+
</Heading>
|
|
58
|
+
</Box>
|
|
59
|
+
<Box as="main" padding={4} flexGrow={1}>
|
|
60
|
+
<Flex alignItems="center" justifyContent="space-between" flexWrap="wrap" gap={2}>
|
|
61
|
+
<Heading as="h1" size={2}>
|
|
62
|
+
Documents
|
|
63
|
+
</Heading>
|
|
64
|
+
<Button iconStart={AddIcon} text="New" />
|
|
65
|
+
</Flex>
|
|
66
|
+
<Box marginTop={3}>
|
|
67
|
+
<Card density="loose">
|
|
68
|
+
<Text size={1}>First document</Text>
|
|
69
|
+
<Text size={1} muted>
|
|
70
|
+
Edited 2 hours ago
|
|
71
|
+
</Text>
|
|
72
|
+
</Card>
|
|
73
|
+
</Box>
|
|
74
|
+
</Box>
|
|
75
|
+
</Flex>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Components
|
|
81
|
+
|
|
82
|
+
All components below are from `@sanity-labs/ui-poc`.
|
|
83
|
+
|
|
84
|
+
### Layout
|
|
85
|
+
|
|
86
|
+
| Component | What it does |
|
|
87
|
+
| ----------- | ----------------------------------------------------------------------------------- |
|
|
88
|
+
| `Box` | General container. Padding, margin, border, overflow, and position as direct props. |
|
|
89
|
+
| `Flex` | Flexbox layout. `alignItems`, `justifyContent`, `flexDirection`, `gap`. |
|
|
90
|
+
| `Grid` | CSS grid. Use `gridTemplateColumns` with a CSS string (e.g. `"repeat(3, 1fr)"`). |
|
|
91
|
+
| `Container` | Max-width content wrapper. |
|
|
92
|
+
| `HStack` | Horizontal stack. Accepts `gap` and `as` only — use `Flex` for alignment control. |
|
|
93
|
+
| `VStack` | Vertical stack. Accepts `gap` and `as` only — use `Flex` for alignment control. |
|
|
94
|
+
| `Inline` | Inline flow layout with wrapping and gap. |
|
|
95
|
+
|
|
96
|
+
### Typography
|
|
97
|
+
|
|
98
|
+
| Component | What it does |
|
|
99
|
+
| --------- | ----------------------------------------------------------------------- |
|
|
100
|
+
| `Heading` | Semantic headings (`h1`–`h6`). Always set `as` to match the level. |
|
|
101
|
+
| `Text` | Body copy, captions, labels. Props: `size`, `weight`, `muted`, `align`. |
|
|
102
|
+
| `Label` | Form input label. Use only with form elements. |
|
|
103
|
+
| `Code` | Inline or block code. Uses the system monospace font. |
|
|
104
|
+
|
|
105
|
+
### Interactive
|
|
106
|
+
|
|
107
|
+
| Component | What it does |
|
|
108
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
109
|
+
| `Button` | `level` (primary/secondary/tertiary), `tone` (neutral/critical), `iconStart`, `iconEnd`, `text`, `fullWidth`, `loading`. |
|
|
110
|
+
| `Checkbox` | Controlled checkbox. Requires `label` (string). |
|
|
111
|
+
| `Radio` | Controlled radio button. |
|
|
112
|
+
| `Switch` | Toggle control. Requires `label` (string). |
|
|
113
|
+
| `Link` | Anchor element styled as a link. |
|
|
114
|
+
|
|
115
|
+
### Display
|
|
116
|
+
|
|
117
|
+
| Component | What it does |
|
|
118
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
119
|
+
| `Card` | Raised surface with background and `tone`. Does not accept padding, margin, or layout props — wrap content in `Box`. |
|
|
120
|
+
| `Divider` | Horizontal rule between content sections. |
|
|
121
|
+
| `Icon` | Renders a `@sanity/icons` icon component. Always set `aria-label` or `aria-hidden`. |
|
|
122
|
+
| `Indicator` | Status dot with `tone`. |
|
|
123
|
+
| `IndicatorGroup` | Grouped `Indicator` elements. |
|
|
124
|
+
| `Spinner` | Loading indicator. |
|
|
125
|
+
|
|
126
|
+
### Lists
|
|
127
|
+
|
|
128
|
+
| Component | What it does |
|
|
129
|
+
| --------- | --------------------------------------------------- |
|
|
130
|
+
| `List` | Semantic list. Use `List.Item` and `List.ItemText`. |
|
|
131
|
+
|
|
132
|
+
### Accessibility
|
|
133
|
+
|
|
134
|
+
| Component | What it does |
|
|
135
|
+
| ---------------- | ------------------------------------------------------------------------------------------------ |
|
|
136
|
+
| `SkipToContent` | Visually hidden skip-nav link. Must be the first focusable element. Requires `hash` and `label`. |
|
|
137
|
+
| `VisuallyHidden` | Hides content visually while keeping it in the accessibility tree. |
|
|
138
|
+
|
|
139
|
+
### Still from `@sanity/ui`
|
|
140
|
+
|
|
141
|
+
Menu, Dialog, TextInput, Select, Stack, Badge, ThemeProvider, ToastProvider, and other components not yet migrated to v4.
|
|
142
|
+
|
|
143
|
+
## Contributing
|
|
144
|
+
|
|
145
|
+
We welcome feedback and contributions. Start here:
|
|
146
|
+
|
|
147
|
+
1. **Try the components** and report what breaks, what confuses, or what's missing.
|
|
148
|
+
2. **Read the contribution model** — build a recipe with existing building block components, then propose graduating it.
|
|
149
|
+
3. **Open a PR** following the branch naming and checklist in the developer contribution docs.
|
|
150
|
+
|
|
151
|
+
During preview, the most useful contribution is using the components and telling us what happens.
|
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 */
|
|
@@ -275,22 +322,62 @@ declare interface HStackProps<T extends React.ElementType> extends Pick<GapProps
|
|
|
275
322
|
}
|
|
276
323
|
|
|
277
324
|
/** @public */
|
|
278
|
-
export declare function Icon({
|
|
325
|
+
export declare function Icon({size, ...props}: IconProps): JSX.Element
|
|
279
326
|
|
|
280
327
|
declare const ICON_SIZE: readonly [0, 1, 2, 3, 4]
|
|
281
328
|
|
|
282
329
|
/** @public */
|
|
283
|
-
declare
|
|
330
|
+
export declare function IconButton<T extends ElementType = 'button'>(
|
|
331
|
+
props: IconButtonProps<T> & Omit<ComponentPropsWithRef<T>, keyof IconButtonProps<T>>,
|
|
332
|
+
): JSX.Element
|
|
333
|
+
|
|
334
|
+
/** @public */
|
|
335
|
+
declare interface IconButtonProps<T extends React_2.ElementType> extends Pick<
|
|
336
|
+
ButtonProps<T>,
|
|
337
|
+
'as' | 'density' | 'level' | 'loading' | 'tone'
|
|
338
|
+
> {
|
|
339
|
+
/** Button label */
|
|
340
|
+
'aria-label': string
|
|
341
|
+
/** Icon */
|
|
342
|
+
'icon': React_2.ComponentType<SVGProps<SVGSVGElement>>
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** @public */
|
|
346
|
+
declare interface IconProps
|
|
347
|
+
extends ComponentProps<'svg'>, Pick<TypographyProps, 'muted'>, MarginProps, ToneProps {
|
|
284
348
|
/** Icon to render */
|
|
285
349
|
icon: React.ComponentType<SVGProps<SVGSVGElement>>
|
|
286
350
|
/** CSS **font-size** property */
|
|
287
351
|
size?: Responsive<IconSize>
|
|
288
|
-
/** CSS **color** property */
|
|
289
|
-
muted?: TypographyProps['muted']
|
|
290
352
|
}
|
|
291
353
|
|
|
292
354
|
declare type IconSize = (typeof ICON_SIZE)[number]
|
|
293
355
|
|
|
356
|
+
/** @beta */
|
|
357
|
+
export declare function Indicator<T extends ElementType = 'span'>({
|
|
358
|
+
tone,
|
|
359
|
+
...props
|
|
360
|
+
}: IndicatorProps<T> & Omit<ComponentPropsWithRef<T>, keyof IndicatorProps<T>>): JSX.Element
|
|
361
|
+
|
|
362
|
+
/** @beta */
|
|
363
|
+
declare interface IndicatorProps<T extends React.ElementType> extends ToneProps {
|
|
364
|
+
/** Element to render */
|
|
365
|
+
as?: T
|
|
366
|
+
/** Label for aria-label attribute */
|
|
367
|
+
label?: string
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** @public */
|
|
371
|
+
export declare function IndicatorStack<T extends ElementType = 'div'>(
|
|
372
|
+
props: IndicatorStackProps<T> & Omit<ComponentPropsWithRef<T>, keyof IndicatorStackProps<T>>,
|
|
373
|
+
): JSX.Element
|
|
374
|
+
|
|
375
|
+
/** @public */
|
|
376
|
+
declare interface IndicatorStackProps<T extends React.ElementType> {
|
|
377
|
+
/** Element to render */
|
|
378
|
+
as?: T
|
|
379
|
+
}
|
|
380
|
+
|
|
294
381
|
/** @deprecated Use HStack component instead */
|
|
295
382
|
/** @public */
|
|
296
383
|
export declare function Inline<T extends ElementType = 'div'>(
|
|
@@ -306,6 +393,16 @@ declare interface InlineProps<T extends React.ElementType> extends PaddingProps
|
|
|
306
393
|
gap?: Responsive<SpaceInherit>
|
|
307
394
|
}
|
|
308
395
|
|
|
396
|
+
declare const INTERACTIVE_TAG: readonly ['button', 'a']
|
|
397
|
+
|
|
398
|
+
declare type InteractiveAs<T extends React.ElementType> = T extends InteractiveTag
|
|
399
|
+
? T
|
|
400
|
+
: T extends string
|
|
401
|
+
? never
|
|
402
|
+
: T
|
|
403
|
+
|
|
404
|
+
declare type InteractiveTag = (typeof INTERACTIVE_TAG)[number]
|
|
405
|
+
|
|
309
406
|
declare const JUSTIFY_CONTENT: readonly [
|
|
310
407
|
'flex-start',
|
|
311
408
|
'flex-end',
|
|
@@ -324,6 +421,7 @@ export declare function Label(props: LabelProps): JSX.Element
|
|
|
324
421
|
declare interface LabelProps extends React.ComponentProps<'label'>, MarginProps {
|
|
325
422
|
/** Element to render */
|
|
326
423
|
disabled?: boolean
|
|
424
|
+
error?: boolean
|
|
327
425
|
}
|
|
328
426
|
|
|
329
427
|
declare interface LayoutProps
|
|
@@ -356,6 +454,56 @@ declare interface LinkProps extends React.ComponentProps<'a'> {
|
|
|
356
454
|
underlined?: boolean
|
|
357
455
|
}
|
|
358
456
|
|
|
457
|
+
/** @beta */
|
|
458
|
+
export declare const List: typeof ListRoot
|
|
459
|
+
|
|
460
|
+
declare const LIST_TAG: readonly ['ol', 'ul']
|
|
461
|
+
|
|
462
|
+
declare function ListItem({density, ...props}: ListItemProps): JSX.Element
|
|
463
|
+
|
|
464
|
+
declare function ListItemImage(props: ComponentProps<'img'>): JSX.Element
|
|
465
|
+
|
|
466
|
+
/** @beta */
|
|
467
|
+
declare interface ListItemProps extends React_2.ComponentProps<'li'> {
|
|
468
|
+
/** Composite prop for setting padding and gap */
|
|
469
|
+
density?: Responsive<Density>
|
|
470
|
+
/** Trailing slot */
|
|
471
|
+
trailing?: React_2.ReactNode
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
declare function ListItemText<T extends ElementType = 'div'>(
|
|
475
|
+
props: ListItemTextProps<T> & Omit<ComponentPropsWithRef<T>, keyof ListItemTextProps<T>>,
|
|
476
|
+
): JSX.Element
|
|
477
|
+
|
|
478
|
+
/** @beta */
|
|
479
|
+
declare interface ListItemTextProps<T extends React_2.ElementType> {
|
|
480
|
+
/** Element to render */
|
|
481
|
+
as?: T
|
|
482
|
+
/** Title text */
|
|
483
|
+
title?: React_2.ReactNode
|
|
484
|
+
/** Subtitle text */
|
|
485
|
+
subtitle?: React_2.ReactNode
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/** @beta */
|
|
489
|
+
declare interface ListProps<T extends ListTag> {
|
|
490
|
+
/** Element to render */
|
|
491
|
+
as?: T
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
declare function ListRoot<T extends ListTag = 'ul'>(
|
|
495
|
+
props: ListProps<T> & Omit<ComponentPropsWithRef<T>, keyof ListProps<T>>,
|
|
496
|
+
): JSX.Element
|
|
497
|
+
|
|
498
|
+
declare namespace ListRoot {
|
|
499
|
+
var displayName: string
|
|
500
|
+
var Item: typeof ListItem
|
|
501
|
+
var ItemText: typeof ListItemText
|
|
502
|
+
var ItemImage: typeof ListItemImage
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
declare type ListTag = (typeof LIST_TAG)[number]
|
|
506
|
+
|
|
359
507
|
declare type MarginProps = {
|
|
360
508
|
/** CSS **margin** property */
|
|
361
509
|
margin?: Responsive<SpaceAutoNegative>
|
|
@@ -403,6 +551,28 @@ declare interface PaddingProps {
|
|
|
403
551
|
paddingLeft?: Responsive<Space>
|
|
404
552
|
}
|
|
405
553
|
|
|
554
|
+
declare const PLACEMENT: readonly [
|
|
555
|
+
'top',
|
|
556
|
+
'top-start',
|
|
557
|
+
'top-end',
|
|
558
|
+
'right',
|
|
559
|
+
'right-start',
|
|
560
|
+
'right-end',
|
|
561
|
+
'bottom',
|
|
562
|
+
'bottom-start',
|
|
563
|
+
'bottom-end',
|
|
564
|
+
'left',
|
|
565
|
+
'left-start',
|
|
566
|
+
'left-end',
|
|
567
|
+
]
|
|
568
|
+
|
|
569
|
+
declare type Placement = (typeof PLACEMENT)[number]
|
|
570
|
+
|
|
571
|
+
declare type PlacementProps = {
|
|
572
|
+
/** Placement relative to anchor */
|
|
573
|
+
placement?: Placement
|
|
574
|
+
}
|
|
575
|
+
|
|
406
576
|
declare const POSITION: readonly ['absolute', 'fixed', 'relative', 'static', 'sticky']
|
|
407
577
|
|
|
408
578
|
declare type Position = (typeof POSITION)[number]
|
|
@@ -427,6 +597,8 @@ export declare function Radio(props: RadioProps): JSX.Element
|
|
|
427
597
|
|
|
428
598
|
/** @beta */
|
|
429
599
|
declare interface RadioProps extends React.ComponentProps<'input'>, MarginProps {
|
|
600
|
+
/** Error state */
|
|
601
|
+
error?: boolean
|
|
430
602
|
/** Input label */
|
|
431
603
|
label: React.ReactNode
|
|
432
604
|
}
|
|
@@ -457,9 +629,13 @@ declare type Responsive<T> =
|
|
|
457
629
|
length: 6
|
|
458
630
|
})
|
|
459
631
|
|
|
632
|
+
declare const SHADOW: readonly [0, 1, 2, 3, 4, 5]
|
|
633
|
+
|
|
634
|
+
declare type Shadow = (typeof SHADOW)[number]
|
|
635
|
+
|
|
460
636
|
declare type ShadowProps = {
|
|
461
637
|
/** CSS **box-shadow** property */
|
|
462
|
-
shadow?:
|
|
638
|
+
shadow?: Shadow
|
|
463
639
|
}
|
|
464
640
|
|
|
465
641
|
/** @beta */
|
|
@@ -516,15 +692,23 @@ declare type SpaceAutoNegative = (typeof SPACE_AUTO_NEGATIVE)[number]
|
|
|
516
692
|
|
|
517
693
|
declare type SpaceInherit = (typeof SPACE_INHERIT)[number]
|
|
518
694
|
|
|
695
|
+
/** @public */
|
|
696
|
+
export declare function Spinner({size, ...props}: SpinnerProps): JSX.Element
|
|
697
|
+
|
|
698
|
+
/** @public */
|
|
699
|
+
declare interface SpinnerProps extends React.ComponentProps<'svg'> {
|
|
700
|
+
size?: Responsive<IconSize>
|
|
701
|
+
}
|
|
702
|
+
|
|
519
703
|
/** @beta */
|
|
520
704
|
export declare function Switch(props: SwitchProps): JSX.Element
|
|
521
705
|
|
|
522
706
|
/** @beta */
|
|
523
707
|
declare interface SwitchProps extends React.ComponentProps<'input'>, MarginProps {
|
|
708
|
+
/** Error state */
|
|
709
|
+
error?: boolean
|
|
524
710
|
/** Input label */
|
|
525
711
|
label: React.ReactNode
|
|
526
|
-
/** Indeterminate state */
|
|
527
|
-
indeterminate?: boolean
|
|
528
712
|
}
|
|
529
713
|
|
|
530
714
|
/** @public */
|
|
@@ -559,6 +743,28 @@ declare type ToneProps = {
|
|
|
559
743
|
tone?: Tone
|
|
560
744
|
}
|
|
561
745
|
|
|
746
|
+
/** @public */
|
|
747
|
+
export declare function Tooltip({placement, ...props}: TooltipProps): any
|
|
748
|
+
|
|
749
|
+
/** @public */
|
|
750
|
+
export declare function TooltipGroup<T extends ElementType = 'div'>(
|
|
751
|
+
props: TooltipGroupProps<T> & Omit<ComponentPropsWithRef<T>, keyof TooltipGroupProps<T>>,
|
|
752
|
+
): JSX.Element
|
|
753
|
+
|
|
754
|
+
/** @public */
|
|
755
|
+
declare interface TooltipGroupProps<T extends React.ElementType> {
|
|
756
|
+
/** Element to render */
|
|
757
|
+
as?: T
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/** @public */
|
|
761
|
+
declare interface TooltipProps extends React.ComponentProps<'div'>, PlacementProps {
|
|
762
|
+
/** Tooltip text */
|
|
763
|
+
text?: React.ReactNode
|
|
764
|
+
/** Disabled state */
|
|
765
|
+
disabled?: boolean
|
|
766
|
+
}
|
|
767
|
+
|
|
562
768
|
declare interface TypographyProps extends MarginProps, ToneProps {
|
|
563
769
|
/** CSS **text-align** property */
|
|
564
770
|
align?: TextAlign
|