@sanity/ui 5.0.0-alpha.23 → 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 +147 -147
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +139 -157
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/docs/components/button.dsds.yaml +24 -12
- package/docs/components/code.dsds.yaml +2 -0
- package/docs/components/eyebrow.dsds.yaml +3 -22
- package/docs/components/icon-button.dsds.yaml +9 -2
- package/docs/components/popover.dsds.yaml +8 -2
- package/docs/foundations/typography-guidelines.dsds.yaml +4 -4
- package/docs/icons/icon-access-denied.dsds.yaml +40 -0
- package/docs/icons/icon-activity.dsds.yaml +40 -0
- package/docs/icons/icon-add-circle.dsds.yaml +14 -0
- package/docs/icons/icon-add-comment.dsds.yaml +34 -0
- package/docs/icons/icon-add-document.dsds.yaml +34 -0
- package/docs/icons/icon-add-user.dsds.yaml +30 -0
- package/docs/icons/icon-add.dsds.yaml +57 -0
- package/docs/icons/icon-api.dsds.yaml +17 -0
- package/docs/icons/icon-archive.dsds.yaml +44 -0
- package/docs/icons/icon-arrow-down.dsds.yaml +38 -0
- package/docs/icons/icon-arrow-left.dsds.yaml +32 -0
- package/docs/icons/icon-arrow-right.dsds.yaml +32 -0
- package/docs/icons/icon-arrow-top-right.dsds.yaml +32 -0
- package/docs/icons/icon-arrow-up.dsds.yaml +44 -0
- package/docs/icons/icon-asterisk.dsds.yaml +18 -0
- package/docs/icons/icon-bar-chart.dsds.yaml +40 -0
- package/docs/icons/icon-basket.dsds.yaml +14 -0
- package/docs/icons/icon-bell.dsds.yaml +30 -0
- package/docs/icons/icon-bill.dsds.yaml +40 -0
- package/docs/icons/icon-binary-document.dsds.yaml +30 -0
- package/docs/icons/icon-block-content.dsds.yaml +30 -0
- package/docs/icons/icon-block-element.dsds.yaml +32 -0
- package/docs/icons/icon-blockquote.dsds.yaml +32 -0
- package/docs/icons/icon-bold.dsds.yaml +28 -0
- package/docs/icons/icon-bolt.dsds.yaml +18 -0
- package/docs/icons/icon-book.dsds.yaml +34 -0
- package/docs/icons/icon-bookmark-filled.dsds.yaml +14 -0
- package/docs/icons/icon-bookmark.dsds.yaml +14 -0
- package/docs/icons/icon-bottle.dsds.yaml +18 -0
- package/docs/icons/icon-bug.dsds.yaml +28 -0
- package/docs/icons/icon-bulb-filled.dsds.yaml +14 -0
- package/docs/icons/icon-bulb-outline.dsds.yaml +30 -0
- package/docs/icons/icon-calendar.dsds.yaml +36 -0
- package/docs/icons/icon-case.dsds.yaml +18 -0
- package/docs/icons/icon-chart-upward.dsds.yaml +40 -0
- package/docs/icons/icon-checkmark-circle.dsds.yaml +40 -0
- package/docs/icons/icon-checkmark.dsds.yaml +36 -0
- package/docs/icons/icon-chevron-down.dsds.yaml +46 -0
- package/docs/icons/icon-chevron-left.dsds.yaml +42 -0
- package/docs/icons/icon-chevron-right.dsds.yaml +42 -0
- package/docs/icons/icon-chevron-up.dsds.yaml +44 -0
- package/docs/icons/icon-circle.dsds.yaml +28 -0
- package/docs/icons/icon-clipboard-image.dsds.yaml +30 -0
- package/docs/icons/icon-clipboard.dsds.yaml +34 -0
- package/docs/icons/icon-clock.dsds.yaml +39 -0
- package/docs/icons/icon-close-circle.dsds.yaml +18 -0
- package/docs/icons/icon-close.dsds.yaml +51 -0
- package/docs/icons/icon-code-block.dsds.yaml +38 -0
- package/docs/icons/icon-code.dsds.yaml +40 -0
- package/docs/icons/icon-cog.dsds.yaml +38 -0
- package/docs/icons/icon-collapse.dsds.yaml +40 -0
- package/docs/icons/icon-color-wheel.dsds.yaml +30 -0
- package/docs/icons/icon-comment.dsds.yaml +38 -0
- package/docs/icons/icon-component.dsds.yaml +18 -0
- package/docs/icons/icon-compose-sparkles.dsds.yaml +36 -0
- package/docs/icons/icon-compose.dsds.yaml +38 -0
- package/docs/icons/icon-confetti.dsds.yaml +18 -0
- package/docs/icons/icon-controls.dsds.yaml +36 -0
- package/docs/icons/icon-copy.dsds.yaml +31 -0
- package/docs/icons/icon-credit-card.dsds.yaml +18 -0
- package/docs/icons/icon-crop.dsds.yaml +32 -0
- package/docs/icons/icon-cube.dsds.yaml +36 -0
- package/docs/icons/icon-dashboard.dsds.yaml +34 -0
- package/docs/icons/icon-database.dsds.yaml +40 -0
- package/docs/icons/icon-desktop.dsds.yaml +31 -0
- package/docs/icons/icon-diamond.dsds.yaml +18 -0
- package/docs/icons/icon-document-pdf.dsds.yaml +34 -0
- package/docs/icons/icon-document-remove.dsds.yaml +30 -0
- package/docs/icons/icon-document-sheet.dsds.yaml +34 -0
- package/docs/icons/icon-document-text.dsds.yaml +30 -0
- package/docs/icons/icon-document-video.dsds.yaml +30 -0
- package/docs/icons/icon-document-word.dsds.yaml +34 -0
- package/docs/icons/icon-document-zip.dsds.yaml +30 -0
- package/docs/icons/icon-document.dsds.yaml +52 -0
- package/docs/icons/icon-documents.dsds.yaml +30 -0
- package/docs/icons/icon-dot.dsds.yaml +32 -0
- package/docs/icons/icon-double-chevron-down.dsds.yaml +38 -0
- package/docs/icons/icon-double-chevron-left.dsds.yaml +34 -0
- package/docs/icons/icon-double-chevron-right.dsds.yaml +34 -0
- package/docs/icons/icon-double-chevron-up.dsds.yaml +36 -0
- package/docs/icons/icon-double-quote.dsds.yaml +14 -0
- package/docs/icons/icon-download.dsds.yaml +40 -0
- package/docs/icons/icon-drag-handle.dsds.yaml +28 -0
- package/docs/icons/icon-drop.dsds.yaml +30 -0
- package/docs/icons/icon-earth-americas.dsds.yaml +34 -0
- package/docs/icons/icon-earth-globe.dsds.yaml +34 -0
- package/docs/icons/icon-edit.dsds.yaml +34 -0
- package/docs/icons/icon-ellipsis-horizontal.dsds.yaml +32 -0
- package/docs/icons/icon-ellipsis-vertical.dsds.yaml +14 -0
- package/docs/icons/icon-empty.dsds.yaml +28 -0
- package/docs/icons/icon-enter-right.dsds.yaml +18 -0
- package/docs/icons/icon-enter.dsds.yaml +18 -0
- package/docs/icons/icon-envelope.dsds.yaml +34 -0
- package/docs/icons/icon-equal.dsds.yaml +14 -0
- package/docs/icons/icon-error-filled.dsds.yaml +14 -0
- package/docs/icons/icon-error-outline.dsds.yaml +38 -0
- package/docs/icons/icon-error-screen.dsds.yaml +14 -0
- package/docs/icons/icon-expand.dsds.yaml +36 -0
- package/docs/icons/icon-eye-closed.dsds.yaml +38 -0
- package/docs/icons/icon-eye-open.dsds.yaml +38 -0
- package/docs/icons/icon-face-happy.dsds.yaml +14 -0
- package/docs/icons/icon-face-indifferent.dsds.yaml +14 -0
- package/docs/icons/icon-face-sad.dsds.yaml +14 -0
- package/docs/icons/icon-feedback.dsds.yaml +30 -0
- package/docs/icons/icon-filter.dsds.yaml +38 -0
- package/docs/icons/icon-folder.dsds.yaml +36 -0
- package/docs/icons/icon-generate.dsds.yaml +18 -0
- package/docs/icons/icon-github.dsds.yaml +14 -0
- package/docs/icons/icon-groq.dsds.yaml +31 -0
- package/docs/icons/icon-hash.dsds.yaml +18 -0
- package/docs/icons/icon-heart-filled.dsds.yaml +18 -0
- package/docs/icons/icon-heart.dsds.yaml +18 -0
- package/docs/icons/icon-help-circle.dsds.yaml +38 -0
- package/docs/icons/icon-highlight.dsds.yaml +18 -0
- package/docs/icons/icon-home.dsds.yaml +28 -0
- package/docs/icons/icon-ice-cream.dsds.yaml +18 -0
- package/docs/icons/icon-image-remove.dsds.yaml +32 -0
- package/docs/icons/icon-image.dsds.yaml +36 -0
- package/docs/icons/icon-images.dsds.yaml +34 -0
- package/docs/icons/icon-inbox.dsds.yaml +14 -0
- package/docs/icons/icon-info-filled.dsds.yaml +14 -0
- package/docs/icons/icon-info-outline.dsds.yaml +38 -0
- package/docs/icons/icon-inline-element.dsds.yaml +32 -0
- package/docs/icons/icon-inline.dsds.yaml +18 -0
- package/docs/icons/icon-insert-above.dsds.yaml +32 -0
- package/docs/icons/icon-insert-below.dsds.yaml +32 -0
- package/docs/icons/icon-italic.dsds.yaml +28 -0
- package/docs/icons/icon-joystick.dsds.yaml +18 -0
- package/docs/icons/icon-json.dsds.yaml +36 -0
- package/docs/icons/icon-launch.dsds.yaml +34 -0
- package/docs/icons/icon-leave.dsds.yaml +35 -0
- package/docs/icons/icon-lemon.dsds.yaml +18 -0
- package/docs/icons/icon-link-removed.dsds.yaml +30 -0
- package/docs/icons/icon-link.dsds.yaml +36 -0
- package/docs/icons/icon-linkedin.dsds.yaml +14 -0
- package/docs/icons/icon-list.dsds.yaml +14 -0
- package/docs/icons/icon-lock.dsds.yaml +39 -0
- package/docs/icons/icon-logo-js.dsds.yaml +18 -0
- package/docs/icons/icon-logo-ts.dsds.yaml +18 -0
- package/docs/icons/icon-marker-removed.dsds.yaml +14 -0
- package/docs/icons/icon-marker.dsds.yaml +14 -0
- package/docs/icons/icon-master-detail.dsds.yaml +28 -0
- package/docs/icons/icon-menu.dsds.yaml +40 -0
- package/docs/icons/icon-microphone-slash.dsds.yaml +14 -0
- package/docs/icons/icon-microphone.dsds.yaml +14 -0
- package/docs/icons/icon-mobile-device.dsds.yaml +32 -0
- package/docs/icons/icon-moon.dsds.yaml +30 -0
- package/docs/icons/icon-number.dsds.yaml +30 -0
- package/docs/icons/icon-ok-hand.dsds.yaml +18 -0
- package/docs/icons/icon-olist.dsds.yaml +36 -0
- package/docs/icons/icon-overage.dsds.yaml +42 -0
- package/docs/icons/icon-package.dsds.yaml +34 -0
- package/docs/icons/icon-panel-left.dsds.yaml +38 -0
- package/docs/icons/icon-panel-right.dsds.yaml +40 -0
- package/docs/icons/icon-pause.dsds.yaml +32 -0
- package/docs/icons/icon-pin-filled.dsds.yaml +28 -0
- package/docs/icons/icon-pin-removed.dsds.yaml +14 -0
- package/docs/icons/icon-pin.dsds.yaml +32 -0
- package/docs/icons/icon-play.dsds.yaml +32 -0
- package/docs/icons/icon-plug.dsds.yaml +35 -0
- package/docs/icons/icon-presentation.dsds.yaml +18 -0
- package/docs/icons/icon-progress50.dsds.yaml +14 -0
- package/docs/icons/icon-progress75.dsds.yaml +14 -0
- package/docs/icons/icon-projects.dsds.yaml +14 -0
- package/docs/icons/icon-publish.dsds.yaml +38 -0
- package/docs/icons/icon-read-only.dsds.yaml +36 -0
- package/docs/icons/icon-redo.dsds.yaml +38 -0
- package/docs/icons/icon-refresh.dsds.yaml +38 -0
- package/docs/icons/icon-remove-circle.dsds.yaml +14 -0
- package/docs/icons/icon-remove.dsds.yaml +30 -0
- package/docs/icons/icon-reset.dsds.yaml +40 -0
- package/docs/icons/icon-restore.dsds.yaml +45 -0
- package/docs/icons/icon-retrieve.dsds.yaml +14 -0
- package/docs/icons/icon-retry.dsds.yaml +14 -0
- package/docs/icons/icon-revert.dsds.yaml +14 -0
- package/docs/icons/icon-robot.dsds.yaml +17 -0
- package/docs/icons/icon-rocket.dsds.yaml +34 -0
- package/docs/icons/icon-schema.dsds.yaml +36 -0
- package/docs/icons/icon-search.dsds.yaml +34 -0
- package/docs/icons/icon-select.dsds.yaml +38 -0
- package/docs/icons/icon-share.dsds.yaml +36 -0
- package/docs/icons/icon-sort.dsds.yaml +40 -0
- package/docs/icons/icon-sparkle.dsds.yaml +26 -0
- package/docs/icons/icon-sparkles.dsds.yaml +34 -0
- package/docs/icons/icon-spinner.dsds.yaml +38 -0
- package/docs/icons/icon-split-horizontal.dsds.yaml +32 -0
- package/docs/icons/icon-split-vertical.dsds.yaml +30 -0
- package/docs/icons/icon-square.dsds.yaml +18 -0
- package/docs/icons/icon-stack-compact.dsds.yaml +30 -0
- package/docs/icons/icon-stack.dsds.yaml +44 -0
- package/docs/icons/icon-star-filled.dsds.yaml +48 -0
- package/docs/icons/icon-star.dsds.yaml +51 -0
- package/docs/icons/icon-stop.dsds.yaml +32 -0
- package/docs/icons/icon-strikethrough.dsds.yaml +28 -0
- package/docs/icons/icon-string.dsds.yaml +38 -0
- package/docs/icons/icon-sun.dsds.yaml +30 -0
- package/docs/icons/icon-sync.dsds.yaml +36 -0
- package/docs/icons/icon-tablet-device.dsds.yaml +30 -0
- package/docs/icons/icon-tag.dsds.yaml +32 -0
- package/docs/icons/icon-tags.dsds.yaml +36 -0
- package/docs/icons/icon-target.dsds.yaml +14 -0
- package/docs/icons/icon-task.dsds.yaml +30 -0
- package/docs/icons/icon-terminal.dsds.yaml +30 -0
- package/docs/icons/icon-text.dsds.yaml +32 -0
- package/docs/icons/icon-th-large.dsds.yaml +34 -0
- package/docs/icons/icon-th-list.dsds.yaml +30 -0
- package/docs/icons/icon-thumbs-down.dsds.yaml +27 -0
- package/docs/icons/icon-thumbs-up.dsds.yaml +30 -0
- package/docs/icons/icon-tiers.dsds.yaml +18 -0
- package/docs/icons/icon-timeline.dsds.yaml +32 -0
- package/docs/icons/icon-toggle-arrow-right.dsds.yaml +39 -0
- package/docs/icons/icon-token.dsds.yaml +30 -0
- package/docs/icons/icon-transfer.dsds.yaml +32 -0
- package/docs/icons/icon-translate.dsds.yaml +32 -0
- package/docs/icons/icon-trash.dsds.yaml +34 -0
- package/docs/icons/icon-trend-upward.dsds.yaml +42 -0
- package/docs/icons/icon-triangle-outline.dsds.yaml +18 -0
- package/docs/icons/icon-trolley.dsds.yaml +18 -0
- package/docs/icons/icon-truncate.dsds.yaml +18 -0
- package/docs/icons/icon-twitter.dsds.yaml +18 -0
- package/docs/icons/icon-ulist.dsds.yaml +36 -0
- package/docs/icons/icon-unarchive.dsds.yaml +32 -0
- package/docs/icons/icon-underline.dsds.yaml +28 -0
- package/docs/icons/icon-undo.dsds.yaml +34 -0
- package/docs/icons/icon-unknown.dsds.yaml +36 -0
- package/docs/icons/icon-unlink.dsds.yaml +32 -0
- package/docs/icons/icon-unlock.dsds.yaml +41 -0
- package/docs/icons/icon-unpublish.dsds.yaml +38 -0
- package/docs/icons/icon-upload.dsds.yaml +40 -0
- package/docs/icons/icon-user.dsds.yaml +34 -0
- package/docs/icons/icon-users.dsds.yaml +34 -0
- package/docs/icons/icon-versions.dsds.yaml +14 -0
- package/docs/icons/icon-video.dsds.yaml +32 -0
- package/docs/icons/icon-warning-filled.dsds.yaml +14 -0
- package/docs/icons/icon-warning-outline.dsds.yaml +38 -0
- package/docs/icons/icon-wrench.dsds.yaml +18 -0
- package/docs/icons.dsds.yaml +767 -2512
- package/docs/index.dsds.yaml +76 -85
- package/docs/overview/component-reference.dsds.yaml +0 -2
- package/docs/overview/installation.dsds.yaml +20 -4
- package/docs/patterns/forms.dsds.yaml +6 -0
- package/docs/patterns/layouts.dsds.yaml +1 -1
- package/docs/patterns/loading-states.dsds.yaml +1 -1
- package/docs/tokens/dtcg/README.md +5 -3
- package/docs/tokens/dtcg/css/color.css +1 -1
- package/docs/tokens/dtcg/css/index.css +0 -1
- package/docs/tokens/dtcg/css/typography.css +23 -25
- package/docs/tokens/dtcg/json/color.tokens.json +2 -2
- package/docs/tokens/dtcg/json/typography.tokens.json +45 -45
- package/docs/tokens/typography.dsds.yaml +25 -25
- package/package.json +2 -2
- 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 +16 -5
- package/src/components/button/button.css +23 -25
- package/src/components/button/button.props.ts +49 -39
- 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 +8 -5
- 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 +10 -8
- package/src/components/eyebrow/eyebrow.props.ts +27 -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 +3 -6
- package/src/components/heading/heading.props.ts +20 -14
- 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.tsx +4 -3
- package/src/components/popover/popover.css +5 -3
- package/src/components/popover/popover.props.ts +16 -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 +23 -11
- 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/css/classes/system/typography.css +6 -6
- package/src/css/tokens/semantic.css +7 -7
- package/src/props/typography.ts +1 -5
- package/src/types/Interactive.ts +3 -1
- package/src/types/Polymorphic.ts +9 -0
- package/src/version.ts +2 -2
- package/docs/overview/designer-contribution-model.dsds.yaml +0 -77
- package/docs/overview/developer-contribution-model.dsds.yaml +0 -362
- package/docs/overview/resources.dsds.yaml +0 -34
|
@@ -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: {
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
.sui-text-heading4 { font: var(--heading-4); }
|
|
19
19
|
.sui-text-heading5 { font: var(--heading-5); }
|
|
20
20
|
|
|
21
|
-
.sui-text-eyebrow0 { font: var(--
|
|
22
|
-
.sui-text-eyebrow1 { font: var(--
|
|
23
|
-
.sui-text-eyebrow2 { font: var(--
|
|
24
|
-
.sui-text-eyebrow3 { font: var(--
|
|
25
|
-
.sui-text-eyebrow4 { font: var(--
|
|
26
|
-
.sui-text-eyebrow5 { font: var(--
|
|
21
|
+
.sui-text-eyebrow0 { font: var(--eyebrow-0); }
|
|
22
|
+
.sui-text-eyebrow1 { font: var(--eyebrow-1); }
|
|
23
|
+
.sui-text-eyebrow2 { font: var(--eyebrow-2); }
|
|
24
|
+
.sui-text-eyebrow3 { font: var(--eyebrow-3); }
|
|
25
|
+
.sui-text-eyebrow4 { font: var(--eyebrow-4); }
|
|
26
|
+
.sui-text-eyebrow5 { font: var(--eyebrow-5); }
|
|
27
27
|
}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
--placeholder-opacity: 0.64;
|
|
3
3
|
--overlay-opacity: var(--opacity-mid);
|
|
4
4
|
/* State */
|
|
5
|
-
--active-background-normal: light-dark(var(--
|
|
6
|
-
--active-foreground-normal: light-dark(var(--
|
|
7
|
-
--active-background-emphasized: light-dark(var(--
|
|
8
|
-
--active-foreground-emphasized: light-dark(var(--white), var(--
|
|
5
|
+
--active-background-normal: light-dark(var(--gray-100), var(--gray-900));
|
|
6
|
+
--active-foreground-normal: light-dark(var(--gray-800), var(--gray-200));
|
|
7
|
+
--active-background-emphasized: light-dark(var(--gray-800), var(--gray-200));
|
|
8
|
+
--active-foreground-emphasized: light-dark(var(--white), var(--gray-950));
|
|
9
9
|
--error-background-emphasized: light-dark(var(--red-600), var(--red-400));
|
|
10
10
|
--error-foreground: light-dark(var(--red-800), var(--red-200));
|
|
11
11
|
--error-separator: light-dark(var(--red-600), var(--red-400));
|
|
12
|
-
--focus-outline: 2px solid var(--blue-
|
|
12
|
+
--focus-outline: 2px solid light-dark(var(--blue-600), var(--blue-400));
|
|
13
13
|
--focus-offset: 2px;
|
|
14
14
|
--hover-lightness-delta: 0.125;
|
|
15
15
|
--hover-transition: border-color 100ms linear, background-color 100ms linear, transform 100ms linear;
|
|
16
|
-
--inert-background:
|
|
17
|
-
--inert-foreground: light-dark(var(--gray-400), var(--gray-
|
|
16
|
+
--inert-background: hsl(from var(--gray-500) h s l / 0.125);
|
|
17
|
+
--inert-foreground: light-dark(var(--gray-400), var(--gray-500));
|
|
18
18
|
--fade-in-transition:
|
|
19
19
|
opacity 200ms cubic-bezier(0.34, 1.2, 0.64, 1),
|
|
20
20
|
scale 200ms cubic-bezier(0.34, 1.2, 0.64, 1), visibility 0s linear,
|
package/src/props/typography.ts
CHANGED
|
@@ -2,11 +2,9 @@ import {FONT_WEIGHT, type FontWeight} from '../types/FontWeight'
|
|
|
2
2
|
import {type PropDef} from '../types/PropDef'
|
|
3
3
|
import type {Responsive} from '../types/Responsive'
|
|
4
4
|
import {TEXT_ALIGN, type TextAlign} from '../types/TextAlign'
|
|
5
|
-
import {type MarginProps, marginProps} from './margin'
|
|
6
|
-
import {type ToneProps, toneProps} from './tone'
|
|
7
5
|
|
|
8
6
|
/** @public */
|
|
9
|
-
export interface TypographyProps
|
|
7
|
+
export interface TypographyProps {
|
|
10
8
|
/** CSS **text-align** property */
|
|
11
9
|
align?: Responsive<TextAlign>
|
|
12
10
|
/** CSS **color** property */
|
|
@@ -57,6 +55,4 @@ export const typographyProps: Record<string, PropDef> = {
|
|
|
57
55
|
className: 'weight',
|
|
58
56
|
values: FONT_WEIGHT,
|
|
59
57
|
},
|
|
60
|
-
...marginProps,
|
|
61
|
-
...toneProps,
|
|
62
58
|
}
|
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'
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
kind: sanity.guide
|
|
2
|
-
id: designer-contribution-model
|
|
3
|
-
name: Sanity Design System's design contribution model
|
|
4
|
-
description: How designers propose and graduate a recipe into the core Sanity Design System through a three-step, low-process contribution model.
|
|
5
|
-
metadata:
|
|
6
|
-
tags:
|
|
7
|
-
- contribution
|
|
8
|
-
- designer
|
|
9
|
-
- recipe
|
|
10
|
-
- triage
|
|
11
|
-
- graduation
|
|
12
|
-
- process
|
|
13
|
-
- design system
|
|
14
|
-
- governance
|
|
15
|
-
status:
|
|
16
|
-
status: stable
|
|
17
|
-
sections:
|
|
18
|
-
- kind: guidelines
|
|
19
|
-
for: agent
|
|
20
|
-
framing: how-to-use
|
|
21
|
-
items:
|
|
22
|
-
- level: should
|
|
23
|
-
statement: Build recipes out of existing Sanity Design System components and tokens where possible — doing so carries baseline accessibility and consistency requirements forward automatically.
|
|
24
|
-
- level: should
|
|
25
|
-
statement: Propose graduating a recipe (Step 2) only when the creator believes it would be valuable beyond their own feature — bring it to a triage sync with the design system team and, ideally, a developer to confirm technical soundness.
|
|
26
|
-
- level: should
|
|
27
|
-
statement: 'When a recipe graduates (Step 3), assign explicit owners for four separate workstreams: changes to the initial recipe, spec definition, documentation, and component development.'
|
|
28
|
-
- level: must-not
|
|
29
|
-
statement: Do not treat stopping at Step 1 (a recipe that never graduates) as a failure — it is an explicitly supported, penalty-free outcome, and the feature team retains ownership and maintenance of it.
|
|
30
|
-
- kind: steps
|
|
31
|
-
for: all
|
|
32
|
-
ordered: true
|
|
33
|
-
title: The three-step contribution model
|
|
34
|
-
items:
|
|
35
|
-
- title: 'Step 1: Make a recipe'
|
|
36
|
-
description: |-
|
|
37
|
-
A recipe is a distinct composition of existing design system components or design tokens (for example, an onboarding stepper pattern built out of standard buttons, text, and containers). Recipes aren't required to use Sanity UI, but it dramatically simplifies the following steps of the process.
|
|
38
|
-
|
|
39
|
-
The designer creates the recipe to solve their immediate feature need and adds it to a shared recipe library.
|
|
40
|
-
|
|
41
|
-
The more the recipe uses existing design system building blocks, the more baseline requirements like accessibility are automatically sorted out.
|
|
42
|
-
|
|
43
|
-
People can stop at Step 1. Stopping at Step 1 carries no penalty. Teams remain unblocked and the feature team owns future maintenance.
|
|
44
|
-
- title: 'Step 2: Propose a contribution'
|
|
45
|
-
description: |-
|
|
46
|
-
The recipe creator can propose graduating it into the core system. They do this if they believe it would be valuable to the rest of the company.
|
|
47
|
-
|
|
48
|
-
Bring the recipe to a "triage" sync. This could be as short as 15 minutes, depending on the size/complexity of the recipe.
|
|
49
|
-
|
|
50
|
-
The design system team and the feature designer review the work together. They can review the idea quickly with a developer to confirm it's technically sound.
|
|
51
|
-
|
|
52
|
-
The team decides if the recipe should graduate to a core system pattern. If it doesn't, the creator still has a perfectly usable recipe for their feature.
|
|
53
|
-
- title: 'Step 3: Contribute'
|
|
54
|
-
description: |-
|
|
55
|
-
The graduation process begins if everyone agrees that the recipe should be absorbed into the central design system. The contributing team and the design system team collaborate to:
|
|
56
|
-
|
|
57
|
-
- Agree on what needs to change from the initial recipe to make it universally applicable.
|
|
58
|
-
- Define a spec for engineering development.
|
|
59
|
-
- Write usage documentation. The person best equipped to write the first draft is usually the person who made it.
|
|
60
|
-
|
|
61
|
-
**Assign owners to take on:**
|
|
62
|
-
- Changes of the initial recipe
|
|
63
|
-
- Spec definition
|
|
64
|
-
- Documentation
|
|
65
|
-
- Component development
|
|
66
|
-
|
|
67
|
-
And that's it.
|
|
68
|
-
- kind: section
|
|
69
|
-
for: all
|
|
70
|
-
freeform:
|
|
71
|
-
- title: Overview
|
|
72
|
-
body: No approval step is required to ship a recipe. Designers and developers make recipes for whatever they need, without waiting for sign-off or policing. Even if a recipe never officially graduates to the core design system, the contributing designer still gets something usable out of the process.
|
|
73
|
-
- kind: section
|
|
74
|
-
for: agent
|
|
75
|
-
freeform:
|
|
76
|
-
- title: Intent
|
|
77
|
-
body: Use this guide to understand how a designer moves a recipe (a composition of existing components/tokens) toward becoming a core design system pattern, and to know that stopping at any step is a valid, penalty-free outcome.
|
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
kind: sanity.guide
|
|
2
|
-
id: developer-contribution-model
|
|
3
|
-
name: Developer contribution model
|
|
4
|
-
description: 'How a developer moves a working recipe into a pull request against @sanity/ui, and what that PR must include: branch naming, PR description, code formatting, Storybook stories, prop documentation, tests, and docs.'
|
|
5
|
-
metadata:
|
|
6
|
-
tags:
|
|
7
|
-
- contribution
|
|
8
|
-
- developer
|
|
9
|
-
- pull request
|
|
10
|
-
- recipe
|
|
11
|
-
- triage
|
|
12
|
-
- branch naming
|
|
13
|
-
- storybook
|
|
14
|
-
- typedocs
|
|
15
|
-
- testing
|
|
16
|
-
- documentation
|
|
17
|
-
- checklist
|
|
18
|
-
- '@sanity/ui'
|
|
19
|
-
status:
|
|
20
|
-
status: stable
|
|
21
|
-
sections:
|
|
22
|
-
- kind: guidelines
|
|
23
|
-
for: agent
|
|
24
|
-
framing: how-to-use
|
|
25
|
-
items:
|
|
26
|
-
- level: must
|
|
27
|
-
statement: Name branches `<type>/<short-description>` using type feat, fix, docs, or refactor, 3-5 words, lowercase, hyphen-separated, with no ticket numbers.
|
|
28
|
-
- level: must
|
|
29
|
-
statement: Include What, Why, and How to review sections in every PR description. New components additionally need an API surface table and an Open questions section.
|
|
30
|
-
- level: must
|
|
31
|
-
statement: Write components as .tsx with explicit prop types exported alongside the component, one component per file, a named Props type (not inline types), React.forwardRef for anything rendering a DOM element, and named exports only — never a default export.
|
|
32
|
-
- level: must
|
|
33
|
-
statement: Include a Storybook story for every new component and every major change to an existing one, covering all tone/mode/state variants, both light and dark scheme, a composition example, and edge cases (long text, empty state, max children, disabled).
|
|
34
|
-
- level: must
|
|
35
|
-
statement: Give every public prop a TSDoc comment describing behavior, not accepted values. Do not enumerate inherited props, use @type, quote simple prop names, use @optional, or note defaults in description text — use @defaultValue only when the default is not undefined.
|
|
36
|
-
- level: must
|
|
37
|
-
statement: Cover a PR with tests across five categories before requesting review — accessibility, performance, visual regression, functional unit tests, and AI fluency — or explicitly mark a category N/A with a reason.
|
|
38
|
-
- level: must
|
|
39
|
-
statement: For new components, create a doc file with a complete props table and at least one working code example; usage guidelines, best practices, accessibility, and content sections are encouraged but not required.
|
|
40
|
-
- level: must-not
|
|
41
|
-
statement: Do not hardcode colors, spacing, font sizes, shadows, or border radii. Use design tokens through component props (padding, tone, radius, gap) or CSS custom properties.
|
|
42
|
-
- kind: steps
|
|
43
|
-
for: all
|
|
44
|
-
ordered: true
|
|
45
|
-
title: The three-step contribution model
|
|
46
|
-
items:
|
|
47
|
-
- title: 'Step 1: Build a recipe'
|
|
48
|
-
description: |-
|
|
49
|
-
A recipe is a working composition of existing Sanity UI components. It solves a real feature need. It lives in your project — not in `@sanity/ui` itself.
|
|
50
|
-
|
|
51
|
-
Build the recipe with existing primitives (Card, VStack, Flex, Button, etc.). The more you use what the system already provides, the more accessibility, theming, and dark mode support come for free.
|
|
52
|
-
|
|
53
|
-
You can stop here. The recipe works in your project. No PR needed. No review needed. You ship your feature and move on.
|
|
54
|
-
- title: 'Step 2: Propose a contribution'
|
|
55
|
-
description: |-
|
|
56
|
-
If the recipe solves a problem other teams would face, propose graduating it into `@sanity/ui`. Ideally, three or more existing use cases would benefit from this recipe.
|
|
57
|
-
|
|
58
|
-
Bring it to a triage sync. Share what kind of contribution this is (new component, changing an existing component, bug fix, etc.). Show the working code. Walk through the API — what props does it accept, what does it render, how does it compose with other primitives.
|
|
59
|
-
|
|
60
|
-
The design system team and the contributor decide together whether it belongs in the core library. If it doesn't graduate, you still have a working recipe.
|
|
61
|
-
- title: 'Step 3: Open a pull request'
|
|
62
|
-
description: |-
|
|
63
|
-
If the team agrees the recipe should become a core component, the contributor opens a PR against the `@sanity/ui` repo. The design system team collaborates on the PR — this is a partnership, not a gate.
|
|
64
|
-
|
|
65
|
-
The rest of this guide describes how to format that PR.
|
|
66
|
-
- kind: steps
|
|
67
|
-
for: all
|
|
68
|
-
ordered: false
|
|
69
|
-
title: PR checklist
|
|
70
|
-
items:
|
|
71
|
-
- title: Branch follows `<type>/<description>` naming
|
|
72
|
-
- title: PR description has What / Why / How to review sections
|
|
73
|
-
- title: TypeScript types are exported for all public props
|
|
74
|
-
- title: Component forwards refs
|
|
75
|
-
- title: Named exports only (no default export)
|
|
76
|
-
- title: No hardcoded colors, spacing, font sizes, or shadows — uses design tokens only
|
|
77
|
-
- title: Story file created or updated (`ComponentName.stories.tsx`)
|
|
78
|
-
- title: Stories cover all visual variants (tones, modes, states)
|
|
79
|
-
- title: Light and dark scheme shown
|
|
80
|
-
- title: Interactive controls wired to props
|
|
81
|
-
- title: Story linked in PR description under "How to review"
|
|
82
|
-
- title: Every public prop has a TSDoc comment
|
|
83
|
-
- title: Docstrings describe behavior, not accepted values (types handle that)
|
|
84
|
-
- title: No @type, @optional, or quoted simple prop names
|
|
85
|
-
- title: '@defaultValue used only when default is not undefined'
|
|
86
|
-
- title: Defaults are not noted in description text
|
|
87
|
-
- title: Inherited props are not re-documented
|
|
88
|
-
- title: 'Accessibility: axe-core scan passes, keyboard works, screen reader names correct'
|
|
89
|
-
- title: 'Performance: renders within benchmark threshold (or N/A)'
|
|
90
|
-
- title: 'Visual regression: snapshots captured for all states/schemes (or N/A)'
|
|
91
|
-
- title: 'Functional: unit tests cover props, interactions, and edge cases'
|
|
92
|
-
- title: 'AI fluency: LLM can build a working example from the docs (or N/A)'
|
|
93
|
-
- title: Component doc file created or updated
|
|
94
|
-
- title: Props table is complete
|
|
95
|
-
- title: At least one code example included
|
|
96
|
-
- kind: section
|
|
97
|
-
for: all
|
|
98
|
-
freeform:
|
|
99
|
-
- title: Overview
|
|
100
|
-
body: 'This model mirrors the designer contribution model. Same philosophy: low-process, high-trust, always walk away with something usable. The difference is that the workflow goes through code — branches, pull requests, and tests.'
|
|
101
|
-
- kind: section
|
|
102
|
-
for: all
|
|
103
|
-
freeform:
|
|
104
|
-
- title: Branch naming
|
|
105
|
-
body: |-
|
|
106
|
-
Use the format:
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
<type>/<short-description>
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
| Type | When to use | Example |
|
|
113
|
-
| --- | --- | --- |
|
|
114
|
-
| `feat` | New component or new prop on an existing component | `feat/combobox` |
|
|
115
|
-
| `fix` | Bug fix | `fix/button-focus-ring-dark-mode` |
|
|
116
|
-
| `docs` | Documentation only | `docs/card-selected-pattern` |
|
|
117
|
-
| `refactor` | Internal change with no API impact | `refactor/flex-css-modules` |
|
|
118
|
-
|
|
119
|
-
Keep the branch name to 3–5 words, lowercase, hyphen-separated. No ticket numbers in branch names — put those in the PR description.
|
|
120
|
-
- title: PR description
|
|
121
|
-
body: |-
|
|
122
|
-
Every PR needs three sections. Copy this template:
|
|
123
|
-
|
|
124
|
-
```markdown
|
|
125
|
-
## What
|
|
126
|
-
|
|
127
|
-
One or two sentences describing what the PR adds or changes. Name the component
|
|
128
|
-
and the user-facing behavior.
|
|
129
|
-
|
|
130
|
-
## Why
|
|
131
|
-
|
|
132
|
-
Link to the triage decision, the issue, or the feedback that motivated this
|
|
133
|
-
change. If this graduated from a recipe, link to the original component or pattern.
|
|
134
|
-
|
|
135
|
-
## How to review
|
|
136
|
-
|
|
137
|
-
Steps to see the change in action. Could be:
|
|
138
|
-
- A Storybook story to open
|
|
139
|
-
- A test command to run
|
|
140
|
-
- A before/after screenshot
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
For new components, also add:
|
|
144
|
-
|
|
145
|
-
```markdown
|
|
146
|
-
## API surface
|
|
147
|
-
|
|
148
|
-
| Prop | Type | Default | Description |
|
|
149
|
-
| --- | --- | --- | --- |
|
|
150
|
-
| (list every public prop) | | | |
|
|
151
|
-
|
|
152
|
-
## Open questions
|
|
153
|
-
|
|
154
|
-
- (anything the contributor is unsure about and wants feedback on)
|
|
155
|
-
```
|
|
156
|
-
- title: Code formatting
|
|
157
|
-
body: |-
|
|
158
|
-
Follow the conventions already in `@sanity/ui`. The short version:
|
|
159
|
-
|
|
160
|
-
- **TypeScript.** All components are `.tsx`. All props have explicit types. Export the props type alongside the component (`export type ComboboxProps = { ... }`).
|
|
161
|
-
- **One component per file.** The file name matches the component name: `Combobox.tsx` exports `Combobox`.
|
|
162
|
-
- **Props interface, not inline types.** Define a named `Props` or `ComponentNameProps` type. Do not inline complex types in the function signature.
|
|
163
|
-
- **Forward refs.** Every component that renders a DOM element must use `React.forwardRef`. Tooltip, Popover, and other overlay components depend on this.
|
|
164
|
-
- **No default exports.** Use named exports only.
|
|
165
|
-
- **CSS.** Follow the existing styling approach in the repo (CSS modules or styled-components — match what's in place, do not introduce a new approach).
|
|
166
|
-
- **Design tokens, not hardcoded values.** Do not hardcode colors, spacing, font sizes, shadows, or border radii. Use the theme's design tokens through component props (`padding`, `tone`, `radius`, `gap`). Hardcoded values break dark mode, ignore tone contexts, and diverge from the spacing scale.
|
|
167
|
-
- title: Storybook story
|
|
168
|
-
body: |-
|
|
169
|
-
Each new component and each major change to an existing component must include a Storybook story. The story is the review artifact — designers and developers on the design system team use it to evaluate the component before approving the PR.
|
|
170
|
-
|
|
171
|
-
**What to include**
|
|
172
|
-
|
|
173
|
-
- **One story per visual variant.** Show each combination of `tone`, `mode`, and `state` the component supports.
|
|
174
|
-
- **Interactive controls.** Use Storybook args/controls to let reviewers toggle props without editing code.
|
|
175
|
-
- **Light and dark scheme.** Include at least one story that renders the component in both `scheme="light"` and `scheme="dark"`.
|
|
176
|
-
- **Composition example.** Show the component used in context — inside a Card, alongside other primitives, in a realistic layout.
|
|
177
|
-
- **Edge cases.** Long text, empty state, maximum children, disabled state.
|
|
178
|
-
|
|
179
|
-
**File location**
|
|
180
|
-
|
|
181
|
-
Place the story file next to the component:
|
|
182
|
-
|
|
183
|
-
```
|
|
184
|
-
src/
|
|
185
|
-
components/
|
|
186
|
-
Combobox/
|
|
187
|
-
Combobox.tsx
|
|
188
|
-
Combobox.test.tsx
|
|
189
|
-
Combobox.stories.tsx ← story file
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
The story is the primary artifact for design review. Link to it in the PR description under "How to review."
|
|
193
|
-
- title: Prop documentation (TypeDocs)
|
|
194
|
-
body: |-
|
|
195
|
-
Every public prop must have a TSDoc comment in the props type definition. These comments power IDE tooltips, generated API docs, and AI context.
|
|
196
|
-
|
|
197
|
-
**Rules**
|
|
198
|
-
|
|
199
|
-
- **Describe what the prop does, not what values it accepts.** The TypeScript type already declares the accepted values. Do not repeat them in the docstring.
|
|
200
|
-
- **Do not enumerate inherited props.** If the component extends `BoxProps` or `HTMLAttributes`, the inherited props are visible through the type. Only document props that the component adds or overrides.
|
|
201
|
-
- **Do not use `@type`.** TypeScript declares the type. The tag is redundant.
|
|
202
|
-
- **Do not quote simple prop names.** Props like `padding`, `tone`, and `selected` do not need quotes. Only quote names that contain special characters (for example, `aria-label`).
|
|
203
|
-
- **Do not use `@optional`.** The `?` in the type definition marks a prop as optional. The tag adds no information.
|
|
204
|
-
- **Use `@defaultValue` only when the default is not `undefined`.** If a prop defaults to `undefined` (the most common case), omit the tag. If the component applies a specific default (for example, `"div"`, `3`, `true`), document it with `@defaultValue`.
|
|
205
|
-
- **Do not note defaults in any other way.** Do not write "Defaults to X" in the description text. Use `@defaultValue` or nothing.
|
|
206
|
-
|
|
207
|
-
**Example — correct**
|
|
208
|
-
|
|
209
|
-
```tsx
|
|
210
|
-
export interface ComboboxProps {
|
|
211
|
-
/**
|
|
212
|
-
* Text shown when no option is selected.
|
|
213
|
-
*/
|
|
214
|
-
placeholder?: string
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Disables the input and removes it from the tab order.
|
|
218
|
-
* @defaultValue false
|
|
219
|
-
*/
|
|
220
|
-
disabled?: boolean
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* HTML element to render.
|
|
224
|
-
* @defaultValue "div"
|
|
225
|
-
*/
|
|
226
|
-
as?: React.ElementType
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Called when the selected value changes.
|
|
230
|
-
*/
|
|
231
|
-
onChange?: (value: string) => void
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Semantic background color.
|
|
235
|
-
*/
|
|
236
|
-
tone?: 'default' | 'positive' | 'caution' | 'critical'
|
|
237
|
-
}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
**Example — incorrect**
|
|
241
|
-
|
|
242
|
-
```tsx
|
|
243
|
-
// ✗ Enumerates values in the docstring
|
|
244
|
-
/**
|
|
245
|
-
* Semantic background color.
|
|
246
|
-
* Accepted values: "default", "positive", "caution", "critical".
|
|
247
|
-
*/
|
|
248
|
-
tone?: 'default' | 'positive' | 'caution' | 'critical'
|
|
249
|
-
|
|
250
|
-
// ✗ Uses @type (redundant with TypeScript)
|
|
251
|
-
/**
|
|
252
|
-
* @type {string}
|
|
253
|
-
*/
|
|
254
|
-
placeholder?: string
|
|
255
|
-
|
|
256
|
-
// ✗ Uses @optional (redundant with ?)
|
|
257
|
-
/**
|
|
258
|
-
* @optional
|
|
259
|
-
*/
|
|
260
|
-
disabled?: boolean
|
|
261
|
-
|
|
262
|
-
// ✗ Quotes a simple prop name
|
|
263
|
-
/**
|
|
264
|
-
* The "tone" prop sets the color.
|
|
265
|
-
*/
|
|
266
|
-
tone?: Tone
|
|
267
|
-
|
|
268
|
-
// ✗ Uses @defaultValue for undefined
|
|
269
|
-
/**
|
|
270
|
-
* @defaultValue undefined
|
|
271
|
-
*/
|
|
272
|
-
onChange?: (value: string) => void
|
|
273
|
-
|
|
274
|
-
// ✗ Notes default in description text instead of @defaultValue
|
|
275
|
-
/**
|
|
276
|
-
* HTML element to render. Defaults to "div".
|
|
277
|
-
*/
|
|
278
|
-
as?: React.ElementType
|
|
279
|
-
```
|
|
280
|
-
- title: Testing
|
|
281
|
-
body: |-
|
|
282
|
-
A PR is not ready for review until it has test coverage across five categories. Not all categories apply to every PR — but the contributor must confirm which apply and mark the rest as N/A.
|
|
283
|
-
|
|
284
|
-
**Accessibility tests**
|
|
285
|
-
|
|
286
|
-
Sanity UI components must meet WCAG 2.2 AA criteria at minimum. Sanity UI has built-in accessibility testing that acts as a baseline for accessibility compliance. A contributed component must pass all tests before it's officially submitted.
|
|
287
|
-
|
|
288
|
-
Refer to "Component authoring accessibility standards" for specific information related to shipping accessible Sanity UI components.
|
|
289
|
-
|
|
290
|
-
**Performance tests**
|
|
291
|
-
|
|
292
|
-
Measure rendering cost for components that appear in lists or render many children.
|
|
293
|
-
|
|
294
|
-
- Render time for a list of 100 instances should stay under the existing benchmark threshold.
|
|
295
|
-
- No layout thrashing (forced reflows) during mount or state changes.
|
|
296
|
-
|
|
297
|
-
**Visual regression tests**
|
|
298
|
-
|
|
299
|
-
Sanity UI has built-in tests for visual regressing. A contribution cannot cause any visual regressions with existing components.
|
|
300
|
-
|
|
301
|
-
**Functional unit tests**
|
|
302
|
-
|
|
303
|
-
Cover the component's behavior with unit tests.
|
|
304
|
-
|
|
305
|
-
- Every prop that changes rendered output has at least one test.
|
|
306
|
-
- Every user interaction (click, keypress, focus) has a test.
|
|
307
|
-
- Edge cases: empty state, overflow content, maximum prop values.
|
|
308
|
-
|
|
309
|
-
Use the test framework already in the repo. Match the patterns in existing test files.
|
|
310
|
-
|
|
311
|
-
**AI fluency tests**
|
|
312
|
-
|
|
313
|
-
Verify that an LLM can use the component from its documentation alone.
|
|
314
|
-
|
|
315
|
-
- Provide the component's doc page (props table, usage guidelines, examples) as context to an LLM.
|
|
316
|
-
- Ask it to build a working example using the component.
|
|
317
|
-
- The generated code must render without errors and pass the accessibility test suite.
|
|
318
|
-
|
|
319
|
-
This measures whether the documentation and API are clear enough for both humans and AI agents to use correctly.
|
|
320
|
-
- title: Documentation required
|
|
321
|
-
body: |-
|
|
322
|
-
Every PR that adds or changes a public API must include documentation updates. Don't merge without them.
|
|
323
|
-
|
|
324
|
-
**For new components**
|
|
325
|
-
|
|
326
|
-
Create a new `.md` file in the component documentation directory. It must include:
|
|
327
|
-
|
|
328
|
-
| Section | What to write | Required |
|
|
329
|
-
| --- | --- | --- |
|
|
330
|
-
| **Props table** | Every public prop with type, accepted values, default, and description | Yes |
|
|
331
|
-
| **Code examples** | At least one working example showing the primary use case | Yes |
|
|
332
|
-
| **Usage guidelines** | When to use, when not to use, which component to use instead | No |
|
|
333
|
-
| **Best practices** | Do / Don't list with rationale | No |
|
|
334
|
-
| **Accessibility** | Keyboard interaction, ARIA attributes, accessible name source, contrast notes | No |
|
|
335
|
-
| **Content** | Casing, label length, tone pairing, translation considerations | No |
|
|
336
|
-
|
|
337
|
-
Use `button.md`, `card.md`, or `dialog.md` as a reference for the expected structure and depth.
|
|
338
|
-
|
|
339
|
-
**For changes to existing components**
|
|
340
|
-
|
|
341
|
-
Update the component's doc file to reflect the change. If you add a new prop, add it to the props table and write a usage example. If you change behavior, update the affected sections.
|
|
342
|
-
|
|
343
|
-
**Writing standards**
|
|
344
|
-
|
|
345
|
-
- Follow the casing rule in Content guidelines (`content-guidelines#sentence-case-all-system-set`).
|
|
346
|
-
- Do not simplify technical terms (WCAG, aria-label, screen readers, etc.).
|
|
347
|
-
- title: What happens after the PR is merged
|
|
348
|
-
body: |-
|
|
349
|
-
The design system team handles:
|
|
350
|
-
|
|
351
|
-
- Publishing the next release of `@sanity/ui`.
|
|
352
|
-
- Updating the public documentation site.
|
|
353
|
-
- Announcing the new component or change to consuming teams.
|
|
354
|
-
|
|
355
|
-
The design system team credits the contributor in the changelog.
|
|
356
|
-
- title: Keep it simple
|
|
357
|
-
body: This model works because the team is small enough that everyone knows each other. If a step feels unclear, ask in the triage sync. If a test category doesn't apply, mark it N/A and explain why. The goal is to ship good components — not to fill out forms.
|
|
358
|
-
- kind: section
|
|
359
|
-
for: agent
|
|
360
|
-
freeform:
|
|
361
|
-
- title: Intent
|
|
362
|
-
body: 'Use this guide when opening a pull request against @sanity/ui: it defines branch naming, the PR description template, code and TSDoc conventions, Storybook requirements, the five test categories, and the documentation that must ship with the PR.'
|