@sanity/ui 2.0.0-alpha.16 → 2.0.0-alpha.17
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 +79 -1
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/autocomplete/autocomplete.tsx +6 -0
- package/src/components/dialog/dialog.tsx +2 -0
- package/src/components/hotkeys/hotkeys.tsx +2 -0
- package/src/components/menu/menu.tsx +2 -0
- package/src/components/menu/menuButton.tsx +2 -0
- package/src/components/toast/toast.tsx +4 -0
- package/src/primitives/_selectable/style.ts +2 -0
- package/src/primitives/avatar/avatar.tsx +2 -0
- package/src/primitives/badge/badge.tsx +2 -0
- package/src/primitives/box/box.tsx +3 -0
- package/src/primitives/button/styles.ts +1 -0
- package/src/primitives/card/card.tsx +3 -0
- package/src/primitives/card/styles.ts +2 -0
- package/src/primitives/checkbox/checkbox.tsx +2 -0
- package/src/primitives/code/code.tsx +1 -0
- package/src/primitives/container/container.tsx +2 -0
- package/src/primitives/flex/flex.tsx +2 -0
- package/src/primitives/grid/grid.tsx +2 -0
- package/src/primitives/heading/heading.tsx +2 -0
- package/src/primitives/inline/inline.tsx +3 -0
- package/src/primitives/kbd/kbd.tsx +2 -0
- package/src/primitives/label/label.tsx +2 -0
- package/src/primitives/popover/popover.tsx +6 -1
- package/src/primitives/radio/radio.tsx +2 -0
- package/src/primitives/select/select.tsx +2 -0
- package/src/primitives/select/styles.ts +2 -0
- package/src/primitives/spinner/spinner.tsx +2 -0
- package/src/primitives/stack/stack.tsx +2 -0
- package/src/primitives/switch/switch.tsx +4 -0
- package/src/primitives/text/text.tsx +3 -0
- package/src/primitives/textArea/textArea.tsx +3 -0
- package/src/primitives/textInput/textInput.tsx +2 -0
- package/src/primitives/tooltip/tooltip.tsx +3 -0
- package/src/primitives/types.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.17",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"rimraf": "^5.0.1",
|
|
127
127
|
"semantic-release": "^21.1.1",
|
|
128
128
|
"start-server-and-test": "^2.0.0",
|
|
129
|
-
"storybook": "^7.
|
|
129
|
+
"storybook": "^7.5.2",
|
|
130
130
|
"styled-components": "^6.0.7",
|
|
131
131
|
"tsconfig-paths": "^4.2.0",
|
|
132
132
|
"typescript": "^5.2.2"
|
|
@@ -60,6 +60,7 @@ export interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseA
|
|
|
60
60
|
onSelect?: (value: string) => void
|
|
61
61
|
/** @beta */
|
|
62
62
|
openButton?: boolean | AutocompleteOpenButtonProps
|
|
63
|
+
/** The options to render. */
|
|
63
64
|
options?: Option[]
|
|
64
65
|
padding?: number | number[]
|
|
65
66
|
popover?: Omit<PopoverProps, 'content' | 'onMouseEnter' | 'onMouseLeave' | 'open'> &
|
|
@@ -68,6 +69,7 @@ export interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseA
|
|
|
68
69
|
radius?: Radius | Radius[]
|
|
69
70
|
/** @beta */
|
|
70
71
|
relatedElements?: HTMLElement[]
|
|
72
|
+
/** The callback function for rendering each option. */
|
|
71
73
|
renderOption?: (option: Option) => ReactElement
|
|
72
74
|
/** @beta */
|
|
73
75
|
renderPopover?: (
|
|
@@ -82,6 +84,7 @@ export interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseA
|
|
|
82
84
|
) => ReactNode
|
|
83
85
|
renderValue?: (value: string, option?: Option) => string
|
|
84
86
|
suffix?: ReactNode
|
|
87
|
+
/** The current value. */
|
|
85
88
|
value?: string
|
|
86
89
|
}
|
|
87
90
|
|
|
@@ -684,6 +687,9 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
684
687
|
})
|
|
685
688
|
|
|
686
689
|
/**
|
|
690
|
+
* The Autocomplete component is typically used for search components.
|
|
691
|
+
* It consists of a text input for writing a query, and properties for rendering suggestions.
|
|
692
|
+
*
|
|
687
693
|
* @public
|
|
688
694
|
*/
|
|
689
695
|
export const Autocomplete = InnerAutocomplete as <Option extends BaseAutocompleteOption>(
|
|
@@ -37,6 +37,10 @@ const TextBox = styled(Flex)`
|
|
|
37
37
|
`
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
+
* The `Toast` component gives feedback to users when an action has taken place.
|
|
41
|
+
*
|
|
42
|
+
* Toasts can be closed with a close button, or auto-dismiss after a certain timeout.
|
|
43
|
+
*
|
|
40
44
|
* @public
|
|
41
45
|
*/
|
|
42
46
|
export function Toast(
|
|
@@ -41,6 +41,8 @@ const Stroke = styled.ellipse(avatarStyle.stroke)
|
|
|
41
41
|
const Initials = styled.div(avatarStyle.initials)
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
+
* Avatars are used to represent people and other agents (e.g. bots).
|
|
45
|
+
*
|
|
44
46
|
* @public
|
|
45
47
|
*/
|
|
46
48
|
export const Avatar = forwardRef(function Avatar(
|
|
@@ -48,6 +48,9 @@ const Root = styled(Box)<
|
|
|
48
48
|
>(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle)
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
+
* The `Card` component acts much like a `Box`, but with a background and foreground color.
|
|
52
|
+
* Components within a `Card` inherit its colors.
|
|
53
|
+
*
|
|
51
54
|
* @public
|
|
52
55
|
*/
|
|
53
56
|
export const Card = forwardRef(function Card(
|
|
@@ -11,6 +11,7 @@ import {codeBaseStyle} from './styles'
|
|
|
11
11
|
*/
|
|
12
12
|
export interface CodeProps {
|
|
13
13
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
14
|
+
/** Define the language to use for syntax highlighting. */
|
|
14
15
|
language?: string
|
|
15
16
|
size?: number | number[]
|
|
16
17
|
weight?: string
|
|
@@ -13,6 +13,8 @@ export interface GridProps extends Omit<BoxProps, 'display'>, ResponsiveGridProp
|
|
|
13
13
|
const Root = styled(Box)<ResponsiveGridStyleProps>(responsiveGridStyle)
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
+
* The `Grid` component is for building 2-dimensional layers (based on CSS grid).
|
|
17
|
+
*
|
|
16
18
|
* @public
|
|
17
19
|
*/
|
|
18
20
|
export const Grid = forwardRef(function Grid(
|
|
@@ -10,12 +10,15 @@ import {ResponsiveInlineSpaceStyleProps} from './types'
|
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export interface InlineProps extends Omit<BoxProps, 'display'> {
|
|
13
|
+
/** The spacing between children. */
|
|
13
14
|
space?: number | number[]
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const Root = styled(Box)<ResponsiveInlineSpaceStyleProps>(inlineBaseStyle, inlineSpaceStyle)
|
|
17
18
|
|
|
18
19
|
/**
|
|
20
|
+
* The `Inline` component is a layout utility for aligning and spacing items horizontally.
|
|
21
|
+
*
|
|
19
22
|
* @public
|
|
20
23
|
*/
|
|
21
24
|
export const Inline = forwardRef(function Inline(
|
|
@@ -59,6 +59,7 @@ export interface PopoverProps
|
|
|
59
59
|
overflow?: BoxOverflow
|
|
60
60
|
padding?: number | number[]
|
|
61
61
|
placement?: Placement
|
|
62
|
+
/** Whether or not to render the popover in a portal element. */
|
|
62
63
|
portal?: boolean | string
|
|
63
64
|
preventOverflow?: boolean
|
|
64
65
|
referenceBoundary?: HTMLElement | null
|
|
@@ -72,7 +73,11 @@ export interface PopoverProps
|
|
|
72
73
|
width?: PopoverWidth | PopoverWidth[]
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* The `Popover` component is used to display some content on top of another.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
76
81
|
export const Popover = memo(
|
|
77
82
|
forwardRef(function Popover(
|
|
78
83
|
props: PopoverProps &
|
|
@@ -15,6 +15,8 @@ export interface StackProps extends BoxProps {
|
|
|
15
15
|
const Root = styled(Box)<ResponsiveStackSpaceStyleProps>(stackBaseStyle, responsiveStackSpaceStyle)
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
+
* The `Stack` component is used to place elements on top of each other.
|
|
19
|
+
*
|
|
18
20
|
* @public
|
|
19
21
|
*/
|
|
20
22
|
export const Stack = forwardRef(function Stack(
|
|
@@ -23,6 +23,10 @@ const Track = styled.span(switchTrackStyles)
|
|
|
23
23
|
const Thumb = styled.span<{$checked?: boolean; $indeterminate?: boolean}>(switchThumbStyles)
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
+
* The `Switch` component allows the user to toggle a setting on and off.
|
|
27
|
+
*
|
|
28
|
+
* Extends all properties of an `<input type="checkbox" />` element, except type.
|
|
29
|
+
*
|
|
26
30
|
* @public
|
|
27
31
|
*/
|
|
28
32
|
export const Switch = forwardRef(function Switch(
|
|
@@ -17,6 +17,7 @@ export interface TextProps {
|
|
|
17
17
|
accent?: boolean
|
|
18
18
|
align?: TextAlign | TextAlign[]
|
|
19
19
|
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
20
|
+
/** When `true` the text color will be muted. */
|
|
20
21
|
muted?: boolean
|
|
21
22
|
size?: number | number[]
|
|
22
23
|
/**
|
|
@@ -43,6 +44,8 @@ const SpanWithTextOverflow = styled.span`
|
|
|
43
44
|
`
|
|
44
45
|
|
|
45
46
|
/**
|
|
47
|
+
* The `Text` component is an agile, themed typographic element.
|
|
48
|
+
*
|
|
46
49
|
* @public
|
|
47
50
|
*/
|
|
48
51
|
export const Text = forwardRef(function Text(
|
|
@@ -48,6 +48,7 @@ export interface TooltipProps extends Omit<LayerProps, 'as'> {
|
|
|
48
48
|
fallbackPlacements?: Placement[]
|
|
49
49
|
padding?: number | number[]
|
|
50
50
|
placement?: Placement
|
|
51
|
+
/** Whether or not to render the tooltip in a portal element. */
|
|
51
52
|
portal?: boolean | string
|
|
52
53
|
scheme?: ThemeColorSchemeKey
|
|
53
54
|
shadow?: number | number[]
|
|
@@ -66,6 +67,8 @@ const Root = styled(Layer)`
|
|
|
66
67
|
`
|
|
67
68
|
|
|
68
69
|
/**
|
|
70
|
+
* Tooltips display information when hovering, focusing or tapping.
|
|
71
|
+
*
|
|
69
72
|
* @public
|
|
70
73
|
*/
|
|
71
74
|
export const Tooltip = forwardRef(function Tooltip(
|
package/src/primitives/types.ts
CHANGED
|
@@ -55,6 +55,7 @@ export interface ResponsiveFlexProps {
|
|
|
55
55
|
* @public
|
|
56
56
|
*/
|
|
57
57
|
export interface ResponsiveFlexItemProps {
|
|
58
|
+
/** Sets the flex CSS attribute. The property is responsive. */
|
|
58
59
|
flex?: FlexValue | FlexValue[]
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -88,8 +89,11 @@ export interface ResponsiveGridItemProps {
|
|
|
88
89
|
* @public
|
|
89
90
|
*/
|
|
90
91
|
export interface ResponsiveMarginProps {
|
|
92
|
+
/** Applies margins to all sides. The property is responsive. */
|
|
91
93
|
margin?: number | number[]
|
|
94
|
+
/** Applies margins to the left and right sides. The property is responsive. */
|
|
92
95
|
marginX?: number | number[]
|
|
96
|
+
/** Applies margins to the top and bottom sides. The property is responsive. */
|
|
93
97
|
marginY?: number | number[]
|
|
94
98
|
marginTop?: number | number[]
|
|
95
99
|
marginRight?: number | number[]
|