@sanity/ui 5.0.0-alpha.24 → 5.0.0-alpha.25
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 +136 -144
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -99
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/avatar/avatar.props.ts +4 -2
- package/src/components/avatar-counter/avatarCounter.props.ts +4 -2
- package/src/components/avatar-stack/avatarStack.props.ts +4 -2
- package/src/components/badge/Badge.tsx +2 -5
- package/src/components/badge/badge.props.ts +15 -15
- package/src/components/box/Box.tsx +2 -5
- package/src/components/box/box.props.ts +18 -12
- package/src/components/button/Button.tsx +2 -2
- package/src/components/button/button.props.ts +49 -43
- package/src/components/card/Card.tsx +2 -2
- package/src/components/card/card.props.ts +19 -13
- package/src/components/checkbox/checkbox.props.ts +4 -2
- package/src/components/code/code.props.ts +5 -3
- package/src/components/container/Container.tsx +2 -2
- package/src/components/container/container.props.ts +17 -11
- package/src/components/dialog/Dialog.tsx +10 -5
- package/src/components/dialog/dialog.props.ts +11 -3
- package/src/components/divider/divider.props.ts +4 -2
- package/src/components/eyebrow/Eyebrow.tsx +2 -5
- package/src/components/eyebrow/eyebrow.props.ts +19 -12
- package/src/components/flex/Flex.tsx +2 -5
- package/src/components/flex/flex.props.ts +19 -12
- package/src/components/grid/Grid.tsx +2 -5
- package/src/components/grid/grid.props.ts +20 -16
- package/src/components/h-stack/HStack.tsx +2 -5
- package/src/components/h-stack/hStack.props.ts +7 -4
- package/src/components/heading/Heading.tsx +2 -5
- package/src/components/heading/heading.props.ts +18 -13
- package/src/components/hotkeys/hotkeys.props.ts +4 -2
- package/src/components/icon/icon.props.ts +3 -3
- package/src/components/icon-button/IconButton.tsx +2 -4
- package/src/components/icon-button/iconButton.props.ts +17 -17
- package/src/components/indicator/Indicator.tsx +2 -2
- package/src/components/indicator/indicator.props.ts +17 -11
- package/src/components/indicator-stack/IndicatorStack.tsx +2 -4
- package/src/components/indicator-stack/indicatorStack.props.ts +13 -7
- package/src/components/inline/Inline.tsx +2 -2
- package/src/components/inline/inline.props.ts +17 -11
- package/src/components/kbd/kbd.props.ts +4 -2
- package/src/components/link/link.props.ts +4 -2
- package/src/components/list/List.tsx +47 -97
- package/src/components/list/list.css +28 -9
- package/src/components/list/list.props.ts +59 -68
- package/src/components/popover/popover.props.ts +7 -5
- package/src/components/press-area/PressArea.tsx +2 -4
- package/src/components/press-area/press-area.css +9 -3
- package/src/components/press-area/pressArea.props.ts +13 -7
- package/src/components/radio/radio.props.ts +2 -1
- package/src/components/select/select.props.ts +4 -2
- package/src/components/skip-to-content/skipToContent.props.ts +4 -2
- package/src/components/spinner/spinner.props.ts +4 -2
- package/src/components/switch/switch.props.ts +4 -2
- package/src/components/tabs/tabs.props.ts +8 -9
- package/src/components/text/Text.tsx +2 -5
- package/src/components/text/text.props.ts +19 -12
- package/src/components/text-area/textArea.props.ts +4 -5
- package/src/components/text-input/textInput.props.ts +5 -3
- package/src/components/tooltip/tooltip.props.ts +7 -5
- package/src/components/tooltip-group/TooltipGroup.tsx +2 -4
- package/src/components/tooltip-group/tooltipGroup.props.ts +13 -7
- package/src/components/v-stack/VStack.tsx +2 -5
- package/src/components/v-stack/vStack.props.ts +7 -4
- package/src/components/visually-hidden/VisuallyHidden.tsx +2 -4
- package/src/components/visually-hidden/visuallyHidden.props.ts +17 -11
- package/src/types/Interactive.ts +3 -1
- package/src/types/Polymorphic.ts +9 -0
- package/src/version.ts +2 -2
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import type {ComponentProps} from 'react'
|
|
2
|
+
|
|
1
3
|
import {formElementDensityProps, type FormElementDensityProps} from '../../props/formElement'
|
|
2
4
|
import {type HeightProps, heightProps} from '../../props/height'
|
|
3
|
-
import
|
|
5
|
+
import type {PropDef} from '../../types/PropDef'
|
|
4
6
|
|
|
5
7
|
/** @public */
|
|
6
8
|
export interface TextAreaProps
|
|
7
|
-
extends
|
|
8
|
-
React.ComponentProps<'textarea'>,
|
|
9
|
-
FormElementDensityProps,
|
|
10
|
-
Pick<HeightProps, 'maxHeight'> {
|
|
9
|
+
extends ComponentProps<'textarea'>, FormElementDensityProps, Pick<HeightProps, 'maxHeight'> {
|
|
11
10
|
/**
|
|
12
11
|
* Sizes the textarea to its content via the CSS `field-sizing` property.
|
|
13
12
|
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type {ComponentProps, HTMLInputTypeAttribute} from 'react'
|
|
2
|
+
|
|
1
3
|
import {formElementDensityProps, type FormElementDensityProps} from '../../props/formElement'
|
|
2
|
-
import
|
|
4
|
+
import type {PropDef} from '../../types/PropDef'
|
|
3
5
|
|
|
4
6
|
export const TEXT_INPUT_EXCLUDED_TYPES = [
|
|
5
7
|
'button',
|
|
@@ -18,11 +20,11 @@ export const TEXT_INPUT_EXCLUDED_TYPES = [
|
|
|
18
20
|
export type TextInputExcludedTypes = (typeof TEXT_INPUT_EXCLUDED_TYPES)[number]
|
|
19
21
|
|
|
20
22
|
/** @public */
|
|
21
|
-
export type TextInputType = Exclude<
|
|
23
|
+
export type TextInputType = Exclude<HTMLInputTypeAttribute, TextInputExcludedTypes>
|
|
22
24
|
|
|
23
25
|
/** @public */
|
|
24
26
|
export interface TextInputProps
|
|
25
|
-
extends Omit<
|
|
27
|
+
extends Omit<ComponentProps<'input'>, 'type'>, FormElementDensityProps {
|
|
26
28
|
/**
|
|
27
29
|
* Used to trigger styling for invalid states.
|
|
28
30
|
* @remarks Use when form validation fails. Pair with a visible error message.
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
import type {ComponentProps, ReactElement, ReactNode} from 'react'
|
|
2
|
+
|
|
1
3
|
import {type PlacementProps, placementProps} from '../../props/placement'
|
|
2
|
-
import
|
|
4
|
+
import type {PropDef} from '../../types/PropDef'
|
|
3
5
|
|
|
4
6
|
/** @beta */
|
|
5
7
|
export interface TooltipProps
|
|
6
|
-
extends Omit<
|
|
8
|
+
extends Omit<ComponentProps<'div'>, 'children' | 'content'>, PlacementProps {
|
|
7
9
|
/**
|
|
8
10
|
* Shared anchor identifier.
|
|
9
11
|
*/
|
|
10
|
-
anchorName?:
|
|
12
|
+
anchorName?: ReactNode
|
|
11
13
|
/**
|
|
12
14
|
* The trigger element.
|
|
13
15
|
*/
|
|
14
|
-
children:
|
|
16
|
+
children: ReactElement<Record<string, unknown>>
|
|
15
17
|
/**
|
|
16
18
|
* The tooltip label.
|
|
17
19
|
*/
|
|
18
|
-
content?:
|
|
20
|
+
content?: ReactNode
|
|
19
21
|
/**
|
|
20
22
|
* Renders the label into `document.body` through a React portal instead of inline.
|
|
21
23
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from 'clsx'
|
|
2
|
-
import {type
|
|
2
|
+
import {type ElementType, useRef, useState} from 'react'
|
|
3
3
|
|
|
4
4
|
import {getProps} from '../../utils/getProps'
|
|
5
5
|
import {suffixClassName} from '../../utils/suffixClassName'
|
|
@@ -8,9 +8,7 @@ import {type TooltipGroupProps, tooltipGroupProps} from './tooltipGroup.props'
|
|
|
8
8
|
const tooltipGroupClassName = suffixClassName('sui-TooltipGroup')
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
11
|
-
export function TooltipGroup<T extends ElementType = 'div'>(
|
|
12
|
-
props: TooltipGroupProps<T> & Omit<ComponentPropsWithRef<T>, keyof TooltipGroupProps<T>>,
|
|
13
|
-
) {
|
|
11
|
+
export function TooltipGroup<T extends ElementType = 'div'>(props: TooltipGroupProps<T>) {
|
|
14
12
|
const {as, children, className, style, ...rest} = getProps(props, tooltipGroupProps)
|
|
15
13
|
const Component = as || 'div'
|
|
16
14
|
const ref = useRef<HTMLElement>(null)
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type {ElementType} from 'react'
|
|
2
|
+
|
|
3
|
+
import type {Polymorphic} from '../../types/Polymorphic'
|
|
4
|
+
import type {PropDef} from '../../types/PropDef'
|
|
2
5
|
|
|
3
6
|
/** @public */
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export type TooltipGroupProps<T extends ElementType = 'div'> = Polymorphic<
|
|
8
|
+
T,
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* HTML element to render.
|
|
12
|
+
*/
|
|
13
|
+
as?: T
|
|
14
|
+
}
|
|
15
|
+
>
|
|
10
16
|
|
|
11
17
|
export const tooltipGroupProps: Record<string, PropDef> = {
|
|
12
18
|
as: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from 'clsx'
|
|
2
|
-
import type {
|
|
2
|
+
import type {ElementType} from 'react'
|
|
3
3
|
|
|
4
4
|
import type {ComponentProps} from '../../utils/getProps'
|
|
5
5
|
import {suffixClassName} from '../../utils/suffixClassName'
|
|
@@ -9,10 +9,7 @@ import {type VStackProps} from './vStack.props'
|
|
|
9
9
|
const vStackClassName = suffixClassName('sui-VStack')
|
|
10
10
|
|
|
11
11
|
/** @public */
|
|
12
|
-
export function VStack<T extends ElementType = 'div'>({
|
|
13
|
-
className,
|
|
14
|
-
...props
|
|
15
|
-
}: VStackProps<T> & Omit<ComponentPropsWithRef<T>, keyof VStackProps<T>>) {
|
|
12
|
+
export function VStack<T extends ElementType = 'div'>({className, ...props}: VStackProps<T>) {
|
|
16
13
|
return (
|
|
17
14
|
<Flex
|
|
18
15
|
className={clsx(vStackClassName, className)}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type {ElementType} from 'react'
|
|
2
|
+
|
|
3
|
+
import type {Polymorphic} from '../../types/Polymorphic'
|
|
1
4
|
import type {FlexProps} from '../flex/flex.props'
|
|
2
5
|
|
|
3
6
|
/** @public */
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
'as' | 'gap'
|
|
7
|
-
>
|
|
7
|
+
export type VStackProps<T extends ElementType = 'div'> = Polymorphic<
|
|
8
|
+
T,
|
|
9
|
+
Pick<FlexProps<T>, 'as' | 'gap'>
|
|
10
|
+
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from 'clsx'
|
|
2
|
-
import type {
|
|
2
|
+
import type {ElementType} from 'react'
|
|
3
3
|
|
|
4
4
|
import {getProps} from '../../utils/getProps'
|
|
5
5
|
import {suffixClassName} from '../../utils/suffixClassName'
|
|
@@ -8,9 +8,7 @@ import {type VisuallyHiddenProps, visuallyHiddenProps} from './visuallyHidden.pr
|
|
|
8
8
|
const visuallyHiddenClassName = suffixClassName('sui-VisuallyHidden')
|
|
9
9
|
|
|
10
10
|
/** @public */
|
|
11
|
-
export function VisuallyHidden<T extends ElementType = 'span'>(
|
|
12
|
-
props: VisuallyHiddenProps<T> & Omit<ComponentPropsWithRef<T>, keyof VisuallyHiddenProps<T>>,
|
|
13
|
-
) {
|
|
11
|
+
export function VisuallyHidden<T extends ElementType = 'span'>(props: VisuallyHiddenProps<T>) {
|
|
14
12
|
const {as, children, className, style, ...rest} = getProps(props, visuallyHiddenProps)
|
|
15
13
|
const Component = as || 'span'
|
|
16
14
|
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type {ElementType} from 'react'
|
|
2
|
+
|
|
3
|
+
import type {Polymorphic} from '../../types/Polymorphic'
|
|
4
|
+
import type {PropDef} from '../../types/PropDef'
|
|
2
5
|
|
|
3
6
|
/** @public */
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
export type VisuallyHiddenProps<T extends ElementType = 'span'> = Polymorphic<
|
|
8
|
+
T,
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* HTML element to render.
|
|
12
|
+
*/
|
|
13
|
+
as?: T
|
|
14
|
+
/**
|
|
15
|
+
* If true, the element becomes visible on `:focus-visible`.
|
|
16
|
+
*/
|
|
17
|
+
visibleOnFocus?: boolean
|
|
18
|
+
}
|
|
19
|
+
>
|
|
14
20
|
|
|
15
21
|
export const visuallyHiddenProps: Record<string, PropDef> = {
|
|
16
22
|
as: {
|
package/src/types/Interactive.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type {ElementType} from 'react'
|
|
2
|
+
|
|
1
3
|
export const INTERACTIVE_TAG = ['button', 'a'] as const
|
|
2
4
|
export type InteractiveTag = (typeof INTERACTIVE_TAG)[number]
|
|
3
5
|
|
|
4
|
-
export type InteractiveAs<T extends
|
|
6
|
+
export type InteractiveAs<T extends ElementType> = T extends InteractiveTag
|
|
5
7
|
? T
|
|
6
8
|
: T extends string
|
|
7
9
|
? never
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type {ComponentPropsWithRef, ElementType} from 'react'
|
|
2
|
+
|
|
3
|
+
export type Polymorphic<T extends ElementType, Props extends object> = Props &
|
|
4
|
+
Omit<
|
|
5
|
+
T extends (props: infer AsProps, ...args: never) => unknown
|
|
6
|
+
? AsProps
|
|
7
|
+
: ComponentPropsWithRef<T>,
|
|
8
|
+
keyof Props
|
|
9
|
+
>
|
package/src/version.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// This file is generated by scripts/write-version.js. Do not edit.
|
|
2
|
-
export const VERSION = '
|
|
3
|
-
export const HASH = '
|
|
2
|
+
export const VERSION = '500alpha25'
|
|
3
|
+
export const HASH = '13d200'
|