@sanity/ui 5.0.0-alpha.7 → 5.0.0-alpha.9
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 +1 -1
- package/dist/cli/install.js +2 -1
- package/dist/index.d.ts +273 -79
- package/dist/index.js +51 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/cli/install.ts +2 -1
- package/src/components/badge/Badge.tsx +53 -0
- package/src/components/badge/badge.css +6 -0
- package/src/components/badge/badge.props.ts +31 -0
- package/src/components/box/box.props.ts +7 -2
- package/src/components/button/button.props.ts +27 -9
- package/src/components/card/card.props.ts +6 -2
- package/src/components/checkbox/Checkbox.tsx +2 -1
- package/src/components/checkbox/checkbox.props.ts +11 -3
- package/src/components/code/code.props.ts +10 -3
- package/src/components/container/container.props.ts +6 -2
- package/src/components/dialog/Dialog.tsx +1 -1
- package/src/components/dialog/dialog.props.ts +13 -4
- package/src/components/eyebrow/eyebrow.props.ts +6 -2
- package/src/components/flex/flex.props.ts +6 -2
- package/src/components/grid/grid.props.ts +6 -2
- package/src/components/h-stack/hStack.props.ts +3 -1
- package/src/components/heading/heading.props.ts +8 -2
- package/src/components/icon/icon.props.ts +6 -2
- package/src/components/icon-button/iconButton.props.ts +7 -2
- package/src/components/index.css +1 -0
- package/src/components/indicator/indicator.props.ts +6 -2
- package/src/components/indicator-stack/indicatorStack.props.ts +3 -1
- package/src/components/inline/inline.props.ts +6 -2
- package/src/components/label/label.props.ts +7 -1
- package/src/components/link/link.props.ts +4 -4
- package/src/components/list/list.props.ts +27 -9
- package/src/components/popover/popover.props.ts +14 -4
- package/src/components/press-area/pressArea.props.ts +3 -1
- package/src/components/radio/radio.props.ts +7 -2
- package/src/components/skip-to-content/skipToContent.props.ts +9 -3
- package/src/components/spinner/Spinner.tsx +1 -1
- package/src/components/spinner/spinner.props.ts +3 -0
- package/src/components/switch/switch.props.ts +7 -2
- package/src/components/text/text.props.ts +6 -2
- package/src/components/tooltip/tooltip.props.ts +12 -4
- package/src/components/tooltip-group/tooltipGroup.props.ts +3 -1
- package/src/components/v-stack/vStack.props.ts +3 -1
- package/src/components/visually-hidden/visuallyHidden.props.ts +6 -2
- package/src/index.ts +1 -0
- package/src/version.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.9",
|
|
4
4
|
"description": "Sanity UI Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@sanity-labs/design-tokens": "0.0.2-alpha.4",
|
|
52
|
-
"@sanity/icons": "^
|
|
52
|
+
"@sanity/icons": "^5.2.1",
|
|
53
53
|
"clsx": "^2.1.1",
|
|
54
54
|
"comment-json": "^5.0.0",
|
|
55
55
|
"dialog-closedby-polyfill": "^1.3.0",
|
package/src/cli/install.ts
CHANGED
|
@@ -36,7 +36,8 @@ function exactFromRange(range: string | undefined): string | null {
|
|
|
36
36
|
*
|
|
37
37
|
* Icons is already a dependency, so the package manager installs it either way.
|
|
38
38
|
* It is listed explicitly because apps import icons directly to pass to
|
|
39
|
-
* components (
|
|
39
|
+
* components (`import {AddIcon} from '@sanity/icons/Add'`, then
|
|
40
|
+
* `<Button iconStart={AddIcon} />`), and under pnpm an import that
|
|
40
41
|
* isn't in the app's own package.json doesn't resolve. Dependencies the app
|
|
41
42
|
* never imports itself (react-refractor, clsx) are left to the package manager.
|
|
42
43
|
* React/react-dom are peers that belong to the host app, so they are left out
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import clsx from 'clsx'
|
|
2
|
+
import {isValidElement, type ComponentPropsWithRef, type ElementType} from 'react'
|
|
3
|
+
|
|
4
|
+
import {getProps} from '../../utils/getProps'
|
|
5
|
+
import {suffixClassName} from '../../utils/suffixClassName'
|
|
6
|
+
import {Icon} from '../icon/Icon'
|
|
7
|
+
import {Text} from '../text/Text'
|
|
8
|
+
import {type BadgeProps, badgeProps} from './badge.props'
|
|
9
|
+
|
|
10
|
+
const badgeClassName = suffixClassName('sui-Badge')
|
|
11
|
+
|
|
12
|
+
/** @public */
|
|
13
|
+
export function Badge<T extends ElementType = 'span'>({
|
|
14
|
+
tone = 'neutral',
|
|
15
|
+
...props
|
|
16
|
+
}: BadgeProps<T> & Omit<ComponentPropsWithRef<T>, keyof BadgeProps<T>>) {
|
|
17
|
+
const {
|
|
18
|
+
as,
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
style,
|
|
22
|
+
iconStart: IconStart,
|
|
23
|
+
text,
|
|
24
|
+
...rest
|
|
25
|
+
} = getProps({tone, ...props}, badgeProps)
|
|
26
|
+
const Component = as || 'span'
|
|
27
|
+
|
|
28
|
+
const paddingClasses = IconStart ? 'sui-p1' : 'sui-px2 sui-py1'
|
|
29
|
+
|
|
30
|
+
const badgeClasses = clsx(
|
|
31
|
+
badgeClassName,
|
|
32
|
+
`${paddingClasses} sui-radius-full sui-display-inline-flex sui-align-items-center sui-gap1`,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Component className={clsx(badgeClasses, className)} style={style} data-ui="Badge" {...rest}>
|
|
37
|
+
{IconStart &&
|
|
38
|
+
(isValidElement(IconStart) ? (
|
|
39
|
+
IconStart
|
|
40
|
+
) : (
|
|
41
|
+
<Icon icon={IconStart} marginX={-1} marginY={-2} size={0} />
|
|
42
|
+
))}
|
|
43
|
+
{text && (
|
|
44
|
+
<Text size={1} trim>
|
|
45
|
+
{text}
|
|
46
|
+
</Text>
|
|
47
|
+
)}
|
|
48
|
+
{children}
|
|
49
|
+
</Component>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type {BadgeProps}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {type ToneProps, toneProps} from '../../props/tone'
|
|
2
|
+
import {type PropDef} from '../../types/PropDef'
|
|
3
|
+
|
|
4
|
+
/** @public */
|
|
5
|
+
export interface BadgeProps<T extends React.ElementType = 'span'> extends ToneProps {
|
|
6
|
+
/**
|
|
7
|
+
* HTML element to render.
|
|
8
|
+
*/
|
|
9
|
+
as?: T
|
|
10
|
+
/**
|
|
11
|
+
* Shows an icon in the start position (left side in left-to-right languages).
|
|
12
|
+
*/
|
|
13
|
+
iconStart?: React.ElementType | React.ReactNode
|
|
14
|
+
/**
|
|
15
|
+
* Sets Badge's text label. Use instead of children unless you have a special use case.
|
|
16
|
+
*/
|
|
17
|
+
text?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const badgeProps: Record<string, PropDef> = {
|
|
21
|
+
as: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
},
|
|
24
|
+
iconStart: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
},
|
|
27
|
+
text: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
},
|
|
30
|
+
...toneProps,
|
|
31
|
+
}
|
|
@@ -5,9 +5,14 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
5
5
|
|
|
6
6
|
/** @public */
|
|
7
7
|
export interface BoxProps<T extends React.ElementType = 'div'> extends LayoutProps {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* HTML element or component to render.
|
|
10
|
+
*/
|
|
9
11
|
as?: T
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* CSS `display` property.
|
|
14
|
+
* @remarks Does not include `'flex'` or `'grid'`. Use the Flex or Grid components for those.
|
|
15
|
+
*/
|
|
11
16
|
display?: Responsive<DisplayBlock>
|
|
12
17
|
}
|
|
13
18
|
|
|
@@ -16,23 +16,41 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
16
16
|
|
|
17
17
|
/** @public */
|
|
18
18
|
export interface ButtonProps<T extends React.ElementType = 'button'> {
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* HTML element to render.
|
|
21
|
+
*/
|
|
20
22
|
as?: InteractiveAs<T>
|
|
21
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Sets padding and gap together to specify size.
|
|
25
|
+
*/
|
|
22
26
|
density?: ButtonDensity
|
|
23
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Sets Button to fill the width of its container.
|
|
29
|
+
*/
|
|
24
30
|
fullWidth?: Responsive<boolean>
|
|
25
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Shows an icon in the start position (left side in left-to-right languages).
|
|
33
|
+
*/
|
|
26
34
|
iconStart?: React.ElementType | React.ReactNode
|
|
27
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Shows an icon in the end position (right side in left-to-right languages).
|
|
37
|
+
*/
|
|
28
38
|
iconEnd?: React.ElementType | React.ReactNode
|
|
29
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Sets the importance of Button's action.
|
|
41
|
+
*/
|
|
30
42
|
level?: ButtonLevel
|
|
31
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Places Button into a loading state.
|
|
45
|
+
*/
|
|
32
46
|
loading?: boolean
|
|
33
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Sets Button's text label.
|
|
49
|
+
*/
|
|
34
50
|
text?: string
|
|
35
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Sets Button's semantic meaning and related color.
|
|
53
|
+
*/
|
|
36
54
|
tone?: ButtonTone
|
|
37
55
|
}
|
|
38
56
|
|
|
@@ -9,9 +9,13 @@ import {type Responsive} from '../../types/Responsive'
|
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
11
11
|
export interface CardProps<T extends React.ElementType = 'div'> extends MarginProps, ToneProps {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* HTML element or component to render.
|
|
14
|
+
*/
|
|
13
15
|
as?: T
|
|
14
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Sets padding, gap, and border-radius together to specify size. This prop is used in place of separate `padding`, `gap`, and `border-radius` props.
|
|
18
|
+
*/
|
|
15
19
|
density?: Responsive<Density>
|
|
16
20
|
}
|
|
17
21
|
|
|
@@ -3,11 +3,19 @@ import {type PropDef} from '../../types/PropDef'
|
|
|
3
3
|
|
|
4
4
|
/** @beta */
|
|
5
5
|
export interface CheckboxProps extends React.ComponentProps<'input'>, MarginProps {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Applies error styling to the checkbox mark.
|
|
8
|
+
* @remarks Use when form validation fails. Pair with a visible error message. The prop is visual only.
|
|
9
|
+
*/
|
|
7
10
|
error?: boolean
|
|
8
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Renders the "mixed state" mark (a horizontal line).
|
|
13
|
+
* @remarks Use when the checkbox controls a group with some-but-not-all children checked.
|
|
14
|
+
*/
|
|
9
15
|
indeterminate?: boolean
|
|
10
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Visible label next to the checkbox.
|
|
18
|
+
*/
|
|
11
19
|
label: React.ReactNode
|
|
12
20
|
}
|
|
13
21
|
|
|
@@ -9,11 +9,18 @@ export interface CodeProps<T extends CodeTag = 'pre'> extends Omit<
|
|
|
9
9
|
TypographyProps,
|
|
10
10
|
'align' | 'truncate' | 'tone'
|
|
11
11
|
> {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* HTML element or component to render.
|
|
14
|
+
* @remarks The defined element wraps an inner `<code>` tag.
|
|
15
|
+
*/
|
|
13
16
|
as?: T
|
|
14
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Refractor language for syntax highlighting.
|
|
19
|
+
*/
|
|
15
20
|
language?: string
|
|
16
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Sets font size.
|
|
23
|
+
*/
|
|
17
24
|
size?: Responsive<CodeSize>
|
|
18
25
|
}
|
|
19
26
|
|
|
@@ -5,9 +5,13 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
5
5
|
|
|
6
6
|
/** @public */
|
|
7
7
|
export interface ContainerProps<T extends React.ElementType = 'div'> extends LayoutProps {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* HTML element or component to render.
|
|
10
|
+
*/
|
|
9
11
|
as?: T
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Maximum width of the container.
|
|
14
|
+
*/
|
|
11
15
|
size?: Responsive<ContainerSize>
|
|
12
16
|
}
|
|
13
17
|
|
|
@@ -4,13 +4,22 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
4
4
|
|
|
5
5
|
/** @beta */
|
|
6
6
|
export interface DialogProps extends Omit<React.ComponentProps<'dialog'>, 'open'> {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Text for the dialog heading.
|
|
9
|
+
* @remarks Recommended for accessibility. The component sets `aria-labelledby` to the heading when you give this prop.
|
|
10
|
+
*/
|
|
8
11
|
header?: string
|
|
9
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* A function to call alongside the native `close` event.
|
|
14
|
+
* @remarks Use it to set `open` back to `false`. It runs for every close cause: the Escape key, a backdrop click, the close button, or a programmatic close.
|
|
15
|
+
*/
|
|
10
16
|
onClose: React.ReactEventHandler<HTMLDialogElement>
|
|
11
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Toggles the dialog's open state.
|
|
19
|
+
* @remarks `true` calls `showModal()` on the element. `false` calls `close()`.
|
|
20
|
+
*/
|
|
12
21
|
open?: boolean
|
|
13
|
-
/**
|
|
22
|
+
/** Sets the max width of the dialog */
|
|
14
23
|
size?: Responsive<ContainerSize>
|
|
15
24
|
}
|
|
16
25
|
|
|
@@ -5,9 +5,13 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
5
5
|
|
|
6
6
|
/** @public */
|
|
7
7
|
export interface EyebrowProps<T extends React.ElementType = 'span'> extends TypographyProps {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* HTML element to render.
|
|
10
|
+
*/
|
|
9
11
|
as?: T
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Sets font size. Uses the same scale as Label.
|
|
14
|
+
*/
|
|
11
15
|
size?: Responsive<EyebrowSize>
|
|
12
16
|
}
|
|
13
17
|
|
|
@@ -8,9 +8,13 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export interface FlexProps<T extends React.ElementType = 'div'>
|
|
10
10
|
extends FlexParentProps, GapProps, LayoutProps {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* HTML element or component to render.
|
|
13
|
+
*/
|
|
12
14
|
as?: T
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* CSS `display` property.
|
|
17
|
+
*/
|
|
14
18
|
display?: Responsive<DisplayFlex>
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -8,9 +8,13 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export interface GridProps<T extends React.ElementType = 'div'>
|
|
10
10
|
extends GridParentProps, GapProps, LayoutProps {
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* HTML element or component to render.
|
|
13
|
+
*/
|
|
12
14
|
as?: T
|
|
13
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* CSS `display` property.
|
|
17
|
+
*/
|
|
14
18
|
display?: Responsive<DisplayGrid>
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -5,9 +5,15 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
5
5
|
|
|
6
6
|
/** @public */
|
|
7
7
|
export interface HeadingProps extends TypographyProps {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Semantic heading element to render.
|
|
10
|
+
* @remarks Always set this explicitly.
|
|
11
|
+
*/
|
|
9
12
|
as?: HeadingTag
|
|
10
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Sets font size.
|
|
15
|
+
* @remarks Independent of `as`.
|
|
16
|
+
*/
|
|
11
17
|
size?: Responsive<HeadingSize>
|
|
12
18
|
}
|
|
13
19
|
|
|
@@ -10,9 +10,13 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
10
10
|
/** @public */
|
|
11
11
|
export interface IconProps
|
|
12
12
|
extends ComponentProps<'svg'>, Pick<TypographyProps, 'muted'>, MarginProps, ToneProps {
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The icon component to render.
|
|
15
|
+
*/
|
|
14
16
|
icon: React.ComponentType<SVGProps<SVGSVGElement>>
|
|
15
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Sets icon size.
|
|
19
|
+
*/
|
|
16
20
|
size?: Responsive<IconSize>
|
|
17
21
|
}
|
|
18
22
|
|
|
@@ -9,9 +9,14 @@ export interface IconButtonProps<T extends React.ElementType = 'button'> extends
|
|
|
9
9
|
ButtonProps<T>,
|
|
10
10
|
'as' | 'density' | 'level' | 'loading' | 'tone'
|
|
11
11
|
> {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Accessible name for the button.
|
|
14
|
+
* @remarks Because IconButtons have no visible text, this is required.
|
|
15
|
+
*/
|
|
13
16
|
'aria-label': string
|
|
14
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Icon to render.
|
|
19
|
+
*/
|
|
15
20
|
'icon': React.ComponentType<SVGProps<SVGSVGElement>>
|
|
16
21
|
}
|
|
17
22
|
|
package/src/components/index.css
CHANGED
|
@@ -3,9 +3,13 @@ import {type PropDef} from '../../types/PropDef'
|
|
|
3
3
|
|
|
4
4
|
/** @beta */
|
|
5
5
|
export interface IndicatorProps<T extends React.ElementType = 'span'> extends ToneProps {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* HTML element to render.
|
|
8
|
+
*/
|
|
7
9
|
as?: T
|
|
8
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Accessible label.
|
|
12
|
+
*/
|
|
9
13
|
label?: string
|
|
10
14
|
}
|
|
11
15
|
|
|
@@ -7,9 +7,13 @@ import {SPACE, type SpaceInherit} from '../../types/Space'
|
|
|
7
7
|
/** @deprecated Use HStack component instead */
|
|
8
8
|
/** @public */
|
|
9
9
|
export interface InlineProps<T extends React.ElementType = 'div'> extends PaddingProps {
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* HTML element or component to render.
|
|
12
|
+
*/
|
|
11
13
|
as?: T
|
|
12
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Space between children.
|
|
16
|
+
*/
|
|
13
17
|
gap?: Responsive<SpaceInherit>
|
|
14
18
|
}
|
|
15
19
|
|
|
@@ -3,8 +3,14 @@ import {type PropDef} from '../../types/PropDef'
|
|
|
3
3
|
|
|
4
4
|
/** @beta */
|
|
5
5
|
export interface LabelProps extends React.ComponentProps<'label'>, MarginProps {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Renders the label in a muted color.
|
|
8
|
+
*/
|
|
7
9
|
disabled?: boolean
|
|
10
|
+
/**
|
|
11
|
+
* Renders the label in the error color.
|
|
12
|
+
* @remarks Use when the linked input has a validation error.
|
|
13
|
+
*/
|
|
8
14
|
error?: boolean
|
|
9
15
|
}
|
|
10
16
|
|
|
@@ -2,12 +2,12 @@ import {type PropDef} from '../../types/PropDef'
|
|
|
2
2
|
|
|
3
3
|
/** @beta */
|
|
4
4
|
export interface LinkProps extends React.ComponentProps<'a'> {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Sets the link to `target="_blank"` and `rel="noopener noreferrer"`.
|
|
7
|
+
*/
|
|
6
8
|
openInNewTab?: boolean
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @defaultValue true
|
|
10
|
+
* Underlines the link.
|
|
11
11
|
*/
|
|
12
12
|
underlined?: boolean
|
|
13
13
|
}
|
|
@@ -11,7 +11,9 @@ import type {Responsive} from '../../types/Responsive'
|
|
|
11
11
|
|
|
12
12
|
/** @beta */
|
|
13
13
|
export interface ListProps<T extends ListTag = 'ul'> extends Pick<GapProps, 'gap'> {
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* HTML element to render.
|
|
16
|
+
*/
|
|
15
17
|
as?: T
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -24,11 +26,17 @@ export const listProps: Record<string, PropDef> = {
|
|
|
24
26
|
|
|
25
27
|
/** @beta */
|
|
26
28
|
export interface ListItemProps extends React.ComponentProps<'li'> {
|
|
27
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Sets horizontal padding, gap, and minimum row height together.
|
|
31
|
+
*/
|
|
28
32
|
density?: Responsive<Density>
|
|
29
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Slot at the left edge of the row.
|
|
35
|
+
*/
|
|
30
36
|
start?: React.ReactNode
|
|
31
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Slot at the right edge of the row.
|
|
39
|
+
*/
|
|
32
40
|
end?: React.ReactNode
|
|
33
41
|
}
|
|
34
42
|
|
|
@@ -73,9 +81,13 @@ export const listItemProps: Record<string, PropDef> = {
|
|
|
73
81
|
|
|
74
82
|
/** @beta */
|
|
75
83
|
export interface ListButtonItemProps<T extends React.ElementType = 'button'> extends ListItemProps {
|
|
76
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Element or component to render for the press target.
|
|
86
|
+
*/
|
|
77
87
|
as?: InteractiveAs<T>
|
|
78
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Marks the row as the current selection.
|
|
90
|
+
*/
|
|
79
91
|
selected?: boolean
|
|
80
92
|
}
|
|
81
93
|
|
|
@@ -91,11 +103,17 @@ export const listButtonItemProps: Record<string, PropDef> = {
|
|
|
91
103
|
|
|
92
104
|
/** @beta */
|
|
93
105
|
export interface ListItemTextProps<T extends React.ElementType = 'div'> {
|
|
94
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* HTML element to render.
|
|
108
|
+
*/
|
|
95
109
|
as?: T
|
|
96
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* Main label.
|
|
112
|
+
*/
|
|
97
113
|
title?: React.ReactNode
|
|
98
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Text below the title.
|
|
116
|
+
*/
|
|
99
117
|
subtitle?: React.ReactNode
|
|
100
118
|
}
|
|
101
119
|
|
|
@@ -4,13 +4,23 @@ import {type PropDef} from '../../types/PropDef'
|
|
|
4
4
|
/** @beta */
|
|
5
5
|
export interface PopoverProps
|
|
6
6
|
extends Omit<React.ComponentProps<'div'>, 'children' | 'content'>, PlacementProps {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Shared anchor identifier.
|
|
9
|
+
* @remarks Set the same value on a Tooltip and a Popover to point both at one trigger.
|
|
10
|
+
*/
|
|
8
11
|
anchorName?: React.ReactNode
|
|
9
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The trigger element.
|
|
14
|
+
* @remarks Popover clones it and attaches the `popovertarget` attribute that opens the floating layer.
|
|
15
|
+
*/
|
|
10
16
|
children: React.ReactElement<Record<string, unknown>>
|
|
11
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The floating content.
|
|
19
|
+
*/
|
|
12
20
|
content?: React.ReactNode
|
|
13
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Renders the content into `document.body` through a React portal instead of inline.
|
|
23
|
+
*/
|
|
14
24
|
portal?: boolean
|
|
15
25
|
}
|
|
16
26
|
|
|
@@ -3,9 +3,14 @@ import {type PropDef} from '../../types/PropDef'
|
|
|
3
3
|
|
|
4
4
|
/** @beta */
|
|
5
5
|
export interface RadioProps extends React.ComponentProps<'input'>, MarginProps {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Applies error styling to the radio mark.
|
|
8
|
+
* @remarks Use when form validation fails. Pair with a visible error message. The prop is visual only.
|
|
9
|
+
*/
|
|
7
10
|
error?: boolean
|
|
8
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Visible label next to the radio.
|
|
13
|
+
*/
|
|
9
14
|
label: React.ReactNode
|
|
10
15
|
}
|
|
11
16
|
|