@sanity/ui 5.0.0-alpha.15 → 5.0.0-alpha.16
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 +96 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +340 -83
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/avatar/Avatar.tsx +50 -0
- package/src/components/avatar/avatar.css +51 -0
- package/src/components/avatar/avatar.props.ts +57 -0
- package/src/components/avatar-counter/AvatarCounter.tsx +38 -0
- package/src/components/avatar-counter/avatar-counter.css +8 -0
- package/src/components/avatar-counter/avatarCounter.props.ts +44 -0
- package/src/components/avatar-stack/AvatarStack.tsx +60 -0
- package/src/components/avatar-stack/avatar-stack.css +16 -0
- package/src/components/avatar-stack/avatarStack.props.ts +20 -0
- package/src/components/button/button.css +2 -2
- package/src/components/checkbox/Checkbox.tsx +3 -3
- package/src/components/checkbox/checkbox.props.ts +2 -2
- package/src/components/hotkeys/Hotkeys.tsx +29 -0
- package/src/components/hotkeys/hotkeys.css +3 -0
- package/src/components/hotkeys/hotkeys.props.ts +15 -0
- package/src/components/index.css +6 -0
- package/src/components/kbd/KBD.tsx +33 -0
- package/src/components/kbd/kbd.css +6 -0
- package/src/components/kbd/kbd.props.ts +20 -0
- package/src/components/radio/Radio.tsx +3 -3
- package/src/components/radio/radio.props.ts +2 -2
- package/src/components/select/select.props.ts +1 -0
- package/src/components/switch/Switch.tsx +3 -3
- package/src/components/switch/switch.props.ts +2 -2
- package/src/components/text-area/TextArea.tsx +32 -0
- package/src/components/text-area/text-area.css +56 -0
- package/src/components/text-area/textArea.props.ts +35 -0
- package/src/components/text-input/TextInput.tsx +1 -1
- package/src/components/text-input/text-input.css +9 -3
- package/src/components/text-input/textInput.props.ts +1 -0
- package/src/css/classes/dynamic/height.css +2 -0
- package/src/css/classes/local/field-sizing.css +3 -0
- package/src/css/classes/local/index.css +1 -0
- package/src/index.ts +7 -1
- package/src/types/Avatar.ts +14 -0
- package/src/types/Eyebrow.ts +1 -1
- package/src/version.ts +2 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import clsx from 'clsx'
|
|
2
|
+
|
|
3
|
+
import {getProps} from '../../utils/getProps'
|
|
4
|
+
import {suffixClassName} from '../../utils/suffixClassName'
|
|
5
|
+
import {type TextAreaProps, textAreaProps} from './textArea.props'
|
|
6
|
+
|
|
7
|
+
const textAreaClassName = suffixClassName('sui-TextArea')
|
|
8
|
+
|
|
9
|
+
/** @public */
|
|
10
|
+
export function TextArea({
|
|
11
|
+
autoResize,
|
|
12
|
+
density = 'regular',
|
|
13
|
+
hasError,
|
|
14
|
+
rows = 5,
|
|
15
|
+
...props
|
|
16
|
+
}: TextAreaProps) {
|
|
17
|
+
const {className, style, ...rest} = getProps({autoResize, density, rows, ...props}, textAreaProps)
|
|
18
|
+
|
|
19
|
+
const textAreaClasses = clsx(textAreaClassName, 'sui-radius2', 'sui-width-full', className)
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<textarea
|
|
23
|
+
className={textAreaClasses}
|
|
24
|
+
style={style}
|
|
25
|
+
data-ui="TextArea"
|
|
26
|
+
{...rest}
|
|
27
|
+
aria-invalid={hasError || undefined}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type {TextAreaProps}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.sui-TextArea {
|
|
2
|
+
--background-color: var(--backdrop);
|
|
3
|
+
--border-color: var(--separator-high);
|
|
4
|
+
--color: var(--foreground-high);
|
|
5
|
+
background-color: var(--background-color);
|
|
6
|
+
border: 1px solid var(--border-color);
|
|
7
|
+
font: var(--form-element-text);
|
|
8
|
+
color: var(--color);
|
|
9
|
+
resize: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.sui-TextArea::placeholder {
|
|
13
|
+
color: oklch(from var(--color) l c h / var(--placeholder-opacity));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Error
|
|
18
|
+
*/
|
|
19
|
+
.sui-TextArea[aria-invalid="true"] {
|
|
20
|
+
--border-color: var(--error-separator);
|
|
21
|
+
--color: var(--error-foreground);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Hover - uses relative border/background colours to darken/lighten in both normal & error state
|
|
26
|
+
*/
|
|
27
|
+
.sui-TextArea:hover {
|
|
28
|
+
border-color: light-dark(
|
|
29
|
+
oklch(from var(--border-color) calc(l - var(--hover-lightness-delta)) c h),
|
|
30
|
+
oklch(from var(--border-color) calc(l + var(--hover-lightness-delta)) c h)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Disabled, read-only
|
|
36
|
+
*/
|
|
37
|
+
.sui-TextArea:is(:disabled, :read-only) {
|
|
38
|
+
--background-color: var(--inert-background);
|
|
39
|
+
--border-color: var(--separator-low);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Disabled
|
|
44
|
+
*/
|
|
45
|
+
.sui-TextArea:disabled {
|
|
46
|
+
--color: var(--inert-foreground);
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Focus
|
|
52
|
+
*/
|
|
53
|
+
.sui-TextArea:focus-visible {
|
|
54
|
+
outline: var(--focus-outline);
|
|
55
|
+
outline-offset: var(--focus-offset);
|
|
56
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {formElementDensityProps, type FormElementDensityProps} from '../../props/formElement'
|
|
2
|
+
import {type HeightProps, heightProps} from '../../props/height'
|
|
3
|
+
import {type PropDef} from '../../types/PropDef'
|
|
4
|
+
|
|
5
|
+
/** @public */
|
|
6
|
+
export interface TextAreaProps
|
|
7
|
+
extends
|
|
8
|
+
React.ComponentProps<'textarea'>,
|
|
9
|
+
FormElementDensityProps,
|
|
10
|
+
Pick<HeightProps, 'maxHeight'> {
|
|
11
|
+
/**
|
|
12
|
+
* Sizes the textarea to its content via the CSS `field-sizing` property.
|
|
13
|
+
*/
|
|
14
|
+
autoResize?: boolean
|
|
15
|
+
/**
|
|
16
|
+
* Used to trigger styling for invalid states.
|
|
17
|
+
*/
|
|
18
|
+
hasError?: boolean
|
|
19
|
+
/**
|
|
20
|
+
* The html `rows` attribute. Defaults to 5.
|
|
21
|
+
*/
|
|
22
|
+
rows?: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const textAreaProps: Record<string, PropDef> = {
|
|
26
|
+
autoResize: {
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
className: 'field-sizing-content',
|
|
29
|
+
},
|
|
30
|
+
hasError: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
},
|
|
33
|
+
maxHeight: heightProps['maxHeight'] as PropDef,
|
|
34
|
+
...formElementDensityProps,
|
|
35
|
+
}
|
|
@@ -31,15 +31,21 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Disabled
|
|
34
|
+
* Disabled, read-only
|
|
35
35
|
*/
|
|
36
|
-
.sui-TextInput:disabled {
|
|
36
|
+
.sui-TextInput:is(:disabled, :read-only) {
|
|
37
37
|
--background-color: var(--inert-background);
|
|
38
38
|
--border-color: var(--separator-low);
|
|
39
|
-
--color: var(--inert-foreground);
|
|
40
39
|
pointer-events: none;
|
|
41
40
|
}
|
|
42
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Disabled
|
|
44
|
+
*/
|
|
45
|
+
.sui-TextInput:disabled {
|
|
46
|
+
--color: var(--inert-foreground);
|
|
47
|
+
}
|
|
48
|
+
|
|
43
49
|
/**
|
|
44
50
|
* Focus
|
|
45
51
|
*/
|
|
@@ -25,6 +25,7 @@ export interface TextInputProps
|
|
|
25
25
|
extends Omit<React.ComponentProps<'input'>, 'type'>, FormElementDensityProps {
|
|
26
26
|
/**
|
|
27
27
|
* Used to trigger styling for invalid states.
|
|
28
|
+
* @remarks Use when form validation fails. Pair with a visible error message.
|
|
28
29
|
*/
|
|
29
30
|
hasError?: boolean
|
|
30
31
|
/**
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
export * from './components/avatar/Avatar'
|
|
4
|
+
export * from './components/avatar-counter/AvatarCounter'
|
|
5
|
+
export * from './components/avatar-stack/AvatarStack'
|
|
3
6
|
export * from './components/badge/Badge'
|
|
4
7
|
export * from './components/box/Box'
|
|
5
8
|
export * from './components/button/Button'
|
|
@@ -14,11 +17,13 @@ export * from './components/flex/Flex'
|
|
|
14
17
|
export * from './components/grid/Grid'
|
|
15
18
|
export * from './components/h-stack/HStack'
|
|
16
19
|
export * from './components/heading/Heading'
|
|
20
|
+
export * from './components/hotkeys/Hotkeys'
|
|
17
21
|
export * from './components/icon/Icon'
|
|
18
22
|
export * from './components/icon-button/IconButton'
|
|
19
23
|
export * from './components/indicator/Indicator'
|
|
20
24
|
export * from './components/indicator-stack/IndicatorStack'
|
|
21
25
|
export * from './components/inline/Inline'
|
|
26
|
+
export * from './components/kbd/KBD'
|
|
22
27
|
export * from './components/label/Label'
|
|
23
28
|
export * from './components/link/Link'
|
|
24
29
|
export * from './components/list/List'
|
|
@@ -30,6 +35,7 @@ export * from './components/skip-to-content/SkipToContent'
|
|
|
30
35
|
export * from './components/spinner/Spinner'
|
|
31
36
|
export * from './components/switch/Switch'
|
|
32
37
|
export * from './components/text/Text'
|
|
38
|
+
export * from './components/text-area/TextArea'
|
|
33
39
|
export * from './components/text-input/TextInput'
|
|
34
40
|
export * from './components/tooltip/Tooltip'
|
|
35
41
|
export * from './components/tooltip-group/TooltipGroup'
|
|
@@ -53,6 +59,7 @@ export type {Density} from './types/Density'
|
|
|
53
59
|
export type {DisplayBlock, DisplayFlex, DisplayGrid} from './types/Display'
|
|
54
60
|
export type {EyebrowSize} from './types/Eyebrow'
|
|
55
61
|
export type {AlignItems, FlexDirection, FlexWrap, JustifyContent} from './types/Flex'
|
|
62
|
+
export type {FontWeight} from './types/FontWeight'
|
|
56
63
|
export type {GridAutoFlow} from './types/Grid'
|
|
57
64
|
export type {HeadingSize} from './types/Heading'
|
|
58
65
|
export type {IconSize} from './types/Icon'
|
|
@@ -65,5 +72,4 @@ export type {Shadow} from './types/Shadow'
|
|
|
65
72
|
export type {Space, SpaceAuto, SpaceAutoNegative, SpaceInherit} from './types/Space'
|
|
66
73
|
export type {TextSize} from './types/Text'
|
|
67
74
|
export type {TextAlign} from './types/TextAlign'
|
|
68
|
-
export type {FontWeight} from './types/FontWeight'
|
|
69
75
|
export type {Tone} from './types/Tone'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const AVATAR_SIZE = [0, 1, 2] as const
|
|
2
|
+
export type AvatarSize = (typeof AVATAR_SIZE)[number]
|
|
3
|
+
|
|
4
|
+
export const AVATAR_COLOR = [
|
|
5
|
+
'gray',
|
|
6
|
+
'purple',
|
|
7
|
+
'magenta',
|
|
8
|
+
'red',
|
|
9
|
+
'orange',
|
|
10
|
+
'yellow',
|
|
11
|
+
'green',
|
|
12
|
+
'cyan',
|
|
13
|
+
] as const
|
|
14
|
+
export type AvatarColor = (typeof AVATAR_COLOR)[number]
|
package/src/types/Eyebrow.ts
CHANGED
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 = '500alpha16'
|
|
3
|
+
export const HASH = 'd73bbc'
|