@sanity/ui 5.0.0-alpha.22 → 5.0.0-alpha.24
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 +10 -0
- package/dist/index.d.ts +15 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +76 -59
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/docs/components/avatar-counter.dsds.yaml +78 -0
- package/docs/components/avatar-stack.dsds.yaml +96 -0
- package/docs/components/avatar.dsds.yaml +115 -0
- package/docs/components/badge.dsds.yaml +126 -0
- package/docs/components/box.dsds.yaml +223 -0
- package/docs/components/button.dsds.yaml +296 -0
- package/docs/components/card.dsds.yaml +317 -0
- package/docs/components/checkbox.dsds.yaml +204 -0
- package/docs/components/code.dsds.yaml +169 -0
- package/docs/components/container.dsds.yaml +189 -0
- package/docs/components/dialog.dsds.yaml +343 -0
- package/docs/components/divider.dsds.yaml +93 -0
- package/docs/components/eyebrow.dsds.yaml +198 -0
- package/docs/components/flex.dsds.yaml +237 -0
- package/docs/components/grid.dsds.yaml +217 -0
- package/docs/components/h-stack.dsds.yaml +127 -0
- package/docs/components/heading.dsds.yaml +233 -0
- package/docs/components/hotkeys.dsds.yaml +60 -0
- package/docs/components/icon-button.dsds.yaml +227 -0
- package/docs/components/icon.dsds.yaml +275 -0
- package/docs/components/indicator-stack.dsds.yaml +98 -0
- package/docs/components/indicator.dsds.yaml +108 -0
- package/docs/components/inline.dsds.yaml +127 -0
- package/docs/components/kbd.dsds.yaml +59 -0
- package/docs/components/link.dsds.yaml +108 -0
- package/docs/components/list-button-item.dsds.yaml +103 -0
- package/docs/components/list-item-image.dsds.yaml +82 -0
- package/docs/components/list-item-text.dsds.yaml +80 -0
- package/docs/components/list-item.dsds.yaml +148 -0
- package/docs/components/list.dsds.yaml +162 -0
- package/docs/components/popover.dsds.yaml +214 -0
- package/docs/components/press-area.dsds.yaml +279 -0
- package/docs/components/radio.dsds.yaml +198 -0
- package/docs/components/select.dsds.yaml +214 -0
- package/docs/components/skip-to-content.dsds.yaml +110 -0
- package/docs/components/spinner.dsds.yaml +119 -0
- package/docs/components/switch.dsds.yaml +202 -0
- package/docs/components/tab.dsds.yaml +54 -0
- package/docs/components/tabs-list.dsds.yaml +56 -0
- package/docs/components/tabs-panel.dsds.yaml +54 -0
- package/docs/components/tabs.dsds.yaml +104 -0
- package/docs/components/text-area.dsds.yaml +170 -0
- package/docs/components/text-input.dsds.yaml +189 -0
- package/docs/components/text.dsds.yaml +268 -0
- package/docs/components/tooltip-group.dsds.yaml +90 -0
- package/docs/components/tooltip.dsds.yaml +216 -0
- package/docs/components/v-stack.dsds.yaml +155 -0
- package/docs/components/visually-hidden.dsds.yaml +112 -0
- package/docs/evals/cases.yaml +1319 -0
- package/docs/examples/checkbox-2.tsx +57 -0
- package/docs/examples/confirmation-dialogs-1.tsx +27 -0
- package/docs/examples/confirmation-dialogs-2.tsx +55 -0
- package/docs/examples/confirmation-dialogs-3.tsx +28 -0
- package/docs/examples/confirmation-dialogs-4.tsx +38 -0
- package/docs/examples/popover-1.tsx +48 -0
- package/docs/examples/popover-2.tsx +53 -0
- package/docs/foundations/accessibility-guidelines.dsds.yaml +301 -0
- package/docs/foundations/color-guidelines.dsds.yaml +308 -0
- package/docs/foundations/content-guidelines.dsds.yaml +285 -0
- package/docs/foundations/semantics.dsds.yaml +125 -0
- package/docs/foundations/spacing-guidelines.dsds.yaml +226 -0
- package/docs/foundations/typography-guidelines.dsds.yaml +322 -0
- 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 +768 -0
- package/docs/index.dsds.yaml +506 -0
- package/docs/overview/api-essentials.dsds.yaml +221 -0
- package/docs/overview/component-reference.dsds.yaml +213 -0
- package/docs/overview/installation.dsds.yaml +254 -0
- package/docs/overview/quick-start.dsds.yaml +317 -0
- package/docs/patterns/confirmation-dialogs.dsds.yaml +140 -0
- package/docs/patterns/error-messaging.dsds.yaml +58 -0
- package/docs/patterns/forms.dsds.yaml +362 -0
- package/docs/patterns/layouts.dsds.yaml +403 -0
- package/docs/patterns/loading-states.dsds.yaml +41 -0
- package/docs/patterns/messaging.dsds.yaml +72 -0
- package/docs/patterns/navigation.dsds.yaml +153 -0
- package/docs/patterns/responsive.dsds.yaml +590 -0
- package/docs/tokens/color.dsds.yaml +1158 -0
- package/docs/tokens/container-widths.dsds.yaml +131 -0
- package/docs/tokens/content.dsds.yaml +258 -0
- package/docs/tokens/content.tokens.json +180 -0
- package/docs/tokens/dtcg/README.md +41 -0
- package/docs/tokens/dtcg/css/color.css +107 -0
- package/docs/tokens/dtcg/css/container.css +12 -0
- package/docs/tokens/dtcg/css/fontFamily.css +10 -0
- package/docs/tokens/dtcg/css/fontWeight.css +10 -0
- package/docs/tokens/dtcg/css/index.css +12 -0
- package/docs/tokens/dtcg/css/radius.css +14 -0
- package/docs/tokens/dtcg/css/semantic.css +42 -0
- package/docs/tokens/dtcg/css/shadow.css +22 -0
- package/docs/tokens/dtcg/css/space.css +16 -0
- package/docs/tokens/dtcg/css/typography.css +67 -0
- package/docs/tokens/dtcg/json/color.tokens.json +911 -0
- package/docs/tokens/dtcg/json/container.tokens.json +44 -0
- package/docs/tokens/dtcg/json/fontFamily.tokens.json +10 -0
- package/docs/tokens/dtcg/json/fontWeight.tokens.json +18 -0
- package/docs/tokens/dtcg/json/radius.tokens.json +58 -0
- package/docs/tokens/dtcg/json/semantic.tokens.json +372 -0
- package/docs/tokens/dtcg/json/shadow.tokens.json +599 -0
- package/docs/tokens/dtcg/json/space.tokens.json +72 -0
- package/docs/tokens/dtcg/json/typography.tokens.json +354 -0
- package/docs/tokens/font-family.dsds.yaml +79 -0
- package/docs/tokens/font-weight.dsds.yaml +103 -0
- package/docs/tokens/radius.dsds.yaml +153 -0
- package/docs/tokens/semantic.dsds.yaml +397 -0
- package/docs/tokens/shadow.dsds.yaml +125 -0
- package/docs/tokens/space.dsds.yaml +185 -0
- package/docs/tokens/typography.dsds.yaml +316 -0
- package/llms.txt +108 -0
- package/package.json +6 -3
- package/skills/sanity-ui-5/SKILL.md +158 -0
- package/skills/sanity-ui-5/references/component-choice.md +37 -0
- package/skills/sanity-ui-5/references/components.md +145 -0
- package/skills/sanity-ui-5/references/forms-and-accessibility.md +189 -0
- package/skills/sanity-ui-5/references/migrating-from-v3.md +250 -0
- package/skills/sanity-ui-5/references/props-and-imports.md +169 -0
- package/skills/sanity-ui-5/references/setup.md +177 -0
- package/skills/sanity-ui-5/references/silent-failures.md +33 -0
- package/skills/sanity-ui-5/references/taste.md +53 -0
- package/skills/sanity-ui-5/references/tone-and-color.md +55 -0
- package/src/components/button/Button.tsx +14 -3
- package/src/components/button/button.css +23 -25
- package/src/components/button/button.props.ts +4 -0
- package/src/components/code/code.props.ts +3 -2
- package/src/components/eyebrow/Eyebrow.tsx +8 -3
- package/src/components/eyebrow/eyebrow.props.ts +10 -2
- package/src/components/heading/Heading.tsx +1 -1
- package/src/components/heading/heading.props.ts +4 -3
- package/src/components/popover/Popover.tsx +4 -3
- package/src/components/popover/popover.css +5 -3
- package/src/components/popover/popover.props.ts +9 -0
- package/src/components/text/text.props.ts +6 -1
- 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/version.ts +2 -2
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: radio
|
|
3
|
+
name: Radio
|
|
4
|
+
description: Enables the selection from a small set of options (2–4).
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [radio, form, input, single-select, choice, option, group]
|
|
7
|
+
status:
|
|
8
|
+
status: beta
|
|
9
|
+
sections:
|
|
10
|
+
- kind: guidelines
|
|
11
|
+
for: all
|
|
12
|
+
framing: when-to-use
|
|
13
|
+
title: When to use
|
|
14
|
+
items:
|
|
15
|
+
- level: should
|
|
16
|
+
statement: To select from a small set of options (2–4).
|
|
17
|
+
refines:
|
|
18
|
+
- to: forms#choose-control-by-option-count
|
|
19
|
+
- refs:
|
|
20
|
+
- to: forms#choose-control-by-option-count
|
|
21
|
+
rel: same-as
|
|
22
|
+
- level: should-not
|
|
23
|
+
statement: For binary on/off toggles that trigger immediate feedback. Use Switch instead.
|
|
24
|
+
alternatives:
|
|
25
|
+
- to: switch
|
|
26
|
+
- level: should-not
|
|
27
|
+
statement: When more than one option can be selected. Use Checkbox instead.
|
|
28
|
+
alternatives:
|
|
29
|
+
- to: checkbox
|
|
30
|
+
- kind: guidelines
|
|
31
|
+
for: all
|
|
32
|
+
framing: how-to-use
|
|
33
|
+
items:
|
|
34
|
+
- level: must
|
|
35
|
+
statement: Give every Radio an accessible name. Link a visible label element to it with id and htmlFor, or use aria-label or aria-labelledby when there is no visible text to link.
|
|
36
|
+
refines:
|
|
37
|
+
- to: forms#pair-with-visible-label
|
|
38
|
+
- level: must-not
|
|
39
|
+
statement: Use Radio without an accessible name. A nameless radio is announced as an unlabeled radio button.
|
|
40
|
+
- level: must
|
|
41
|
+
statement: Always group radios with a shared name prop for mutual exclusivity.
|
|
42
|
+
- refs:
|
|
43
|
+
- to: forms#pair-checked-with-onchange
|
|
44
|
+
rel: same-as
|
|
45
|
+
- level: should
|
|
46
|
+
statement: Wrap groups in a fieldset with a legend to provide group-level labeling.
|
|
47
|
+
- refs:
|
|
48
|
+
- to: forms#stack-options-vertically
|
|
49
|
+
rel: same-as
|
|
50
|
+
- refs:
|
|
51
|
+
- to: forms#stack-fields-vertically
|
|
52
|
+
rel: same-as
|
|
53
|
+
- refs:
|
|
54
|
+
- to: shared-foundations#error-state-never-disabled
|
|
55
|
+
rel: same-as
|
|
56
|
+
- level: must-not
|
|
57
|
+
statement: Don't horizontally arrange more than 2 radio options.
|
|
58
|
+
- refs:
|
|
59
|
+
- to: forms#no-mixed-controlled-uncontrolled
|
|
60
|
+
rel: same-as
|
|
61
|
+
- kind: guidelines
|
|
62
|
+
for: agent
|
|
63
|
+
framing: how-to-use
|
|
64
|
+
items:
|
|
65
|
+
- id: radio-has-accessible-name
|
|
66
|
+
level: must
|
|
67
|
+
statement: Every Radio has an accessible name from a linked label element, aria-label or aria-labelledby. Radio has no label prop.
|
|
68
|
+
checkedBy: manual
|
|
69
|
+
- level: must-not
|
|
70
|
+
statement: 'Passing hasError to Radio. Radio has no error state. Instead: Show a visible message near the group and link each Radio to it with aria-describedby.'
|
|
71
|
+
- refs:
|
|
72
|
+
- to: forms#error-prop-needs-visible-message
|
|
73
|
+
rel: same-as
|
|
74
|
+
- kind: guidelines
|
|
75
|
+
for: all
|
|
76
|
+
title: Content
|
|
77
|
+
tags: [content]
|
|
78
|
+
items:
|
|
79
|
+
- refs:
|
|
80
|
+
- to: content-guidelines#sentence-case-all-system-set
|
|
81
|
+
rel: same-as
|
|
82
|
+
- refs:
|
|
83
|
+
- to: forms#label-short
|
|
84
|
+
rel: same-as
|
|
85
|
+
- level: should
|
|
86
|
+
statement: All labels in a group should follow the same grammatical pattern ("Send weekly", "Send daily", "Send hourly" — not "Send weekly", "Daily digest", "Send hourly notifications").
|
|
87
|
+
- refs:
|
|
88
|
+
- to: forms#label-no-trailing-period
|
|
89
|
+
rel: same-as
|
|
90
|
+
- refs:
|
|
91
|
+
- to: forms#label-no-trailing-colon
|
|
92
|
+
rel: same-as
|
|
93
|
+
- kind: guidelines
|
|
94
|
+
for: all
|
|
95
|
+
title: Accessibility
|
|
96
|
+
description: 'Target conformance: WCAG Level AA.'
|
|
97
|
+
tags: [accessibility]
|
|
98
|
+
items:
|
|
99
|
+
- level: must
|
|
100
|
+
statement: The Radio has no name of its own (WCAG 4.1.2). Name it through a linked label element, aria-label or aria-labelledby.
|
|
101
|
+
- refs:
|
|
102
|
+
- to: forms#aria-label-overrides-name
|
|
103
|
+
rel: same-as
|
|
104
|
+
- refs:
|
|
105
|
+
- to: forms#aria-labelledby-references-name
|
|
106
|
+
rel: same-as
|
|
107
|
+
- refs:
|
|
108
|
+
- to: forms#label-available-to-screen-readers
|
|
109
|
+
rel: same-as
|
|
110
|
+
- refs:
|
|
111
|
+
- to: forms#error-described-in-text
|
|
112
|
+
rel: same-as
|
|
113
|
+
- refs:
|
|
114
|
+
- to: forms#border-contrast
|
|
115
|
+
rel: same-as
|
|
116
|
+
- kind: section
|
|
117
|
+
for: all
|
|
118
|
+
freeform:
|
|
119
|
+
- title: Example — single handler for a Radio group
|
|
120
|
+
body: |-
|
|
121
|
+
```
|
|
122
|
+
import { Flex, Radio, Text, VStack } from '@sanity/ui'
|
|
123
|
+
|
|
124
|
+
<VStack gap={2}>
|
|
125
|
+
{plans.map((plan) => (
|
|
126
|
+
<Flex key={plan.id} alignItems="center" gap={2}>
|
|
127
|
+
<Radio
|
|
128
|
+
id={`plan-${plan.id}`}
|
|
129
|
+
name="plan"
|
|
130
|
+
value={plan.id}
|
|
131
|
+
checked={selectedPlan === plan.id}
|
|
132
|
+
onChange={(e) => setSelectedPlan(e.currentTarget.value)}
|
|
133
|
+
/>
|
|
134
|
+
<Text as="label" htmlFor={`plan-${plan.id}`}>{plan.label}</Text>
|
|
135
|
+
</Flex>
|
|
136
|
+
))}
|
|
137
|
+
</VStack>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Use `checked` and `onChange` to control each radio from React state. Only the newly-selected Radio fires `onChange`. The previously-checked Radio does not fire a "deselect" event, so derive deselection from the next selection in state. Each `id` and `htmlFor` pair gives its option its name.
|
|
141
|
+
alternatives:
|
|
142
|
+
- to: checkbox
|
|
143
|
+
note: multi-select or boolean toggle
|
|
144
|
+
- to: switch
|
|
145
|
+
note: boolean toggle that takes effect immediately
|
|
146
|
+
- to: select
|
|
147
|
+
note: single-select dropdown for 5–20 options
|
|
148
|
+
refs:
|
|
149
|
+
- href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=31902-99
|
|
150
|
+
rel: design
|
|
151
|
+
role: Figma component (v5)
|
|
152
|
+
sourceFiles:
|
|
153
|
+
- platform: react
|
|
154
|
+
file: packages/ui/src/components/radio/Radio.tsx
|
|
155
|
+
imports:
|
|
156
|
+
- platform: react
|
|
157
|
+
code: import { Radio } from '@sanity/ui'
|
|
158
|
+
package: '@sanity/ui'
|
|
159
|
+
traits:
|
|
160
|
+
- traitType: state
|
|
161
|
+
kind: boolean
|
|
162
|
+
id: enabled
|
|
163
|
+
description: Standard unselected state.
|
|
164
|
+
- traitType: state
|
|
165
|
+
kind: boolean
|
|
166
|
+
id: focused
|
|
167
|
+
description: Focus ring on :focus-visible.
|
|
168
|
+
- traitType: state
|
|
169
|
+
kind: boolean
|
|
170
|
+
id: checked
|
|
171
|
+
description: Filled inner dot showing the selected option.
|
|
172
|
+
- traitType: state
|
|
173
|
+
kind: boolean
|
|
174
|
+
id: disabled
|
|
175
|
+
description: Muted appearance, removed from tab order.
|
|
176
|
+
$extensions:
|
|
177
|
+
com.sanity.ui:
|
|
178
|
+
implementationStatus:
|
|
179
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
180
|
+
implemented: true
|
|
181
|
+
migrationGuide:
|
|
182
|
+
context: 'Migration guide for this component, covering the codemod and the changes it cannot make. Held as an extension because it is temporary: migration tooling and porting agents read it, and it should be dropped when Sanity UI 3 support ends.'
|
|
183
|
+
guidance: |-
|
|
184
|
+
The v5 Radio is the input itself, with no label wrapper. It has no visible text and no name of its own. In v3, a separate `<label htmlFor>` named the Radio. In v5, link a label element with `id` and `htmlFor`, or use `aria-label` or `aria-labelledby`.
|
|
185
|
+
|
|
186
|
+
| v3 pattern | v5 pattern | Notes |
|
|
187
|
+
| :---- | :---- | :---- |
|
|
188
|
+
| `<label htmlFor="x">Label</label><Radio id="x" name="g" />` | `<Radio id="x" name="g" /><label htmlFor="x">Label</label>` | Same association. Use `Text as="label"` if you need the Sanity UI text styles |
|
|
189
|
+
| `<Radio checked />` | `<Radio checked />` | Same `checked`/`onChange` API |
|
|
190
|
+
| All native `<input>` attributes (`name`, `value`, `required`, `aria-*`) | Forwarded unchanged | Pass them as before |
|
|
191
|
+
|
|
192
|
+
### Breaking changes
|
|
193
|
+
|
|
194
|
+
- **`customValidity` removed.** Handle validation outside the component. Show a visible message near the group and link it with `aria-describedby`.
|
|
195
|
+
|
|
196
|
+
### Codemod
|
|
197
|
+
|
|
198
|
+
Run `pnpx @sanity/ui-codemod latest:radio --paths <paths> --toPackage @sanity/ui`. It updates the import and warns about `customValidity`. It does not rewrite `label` props or wrapping label elements. Fix those by hand.
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: select
|
|
3
|
+
name: Select
|
|
4
|
+
description: Allows the user to choose one option from medium-size set (5-20) within a dropdown list.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [select, dropdown, form, input, single-select, option, picker, optgroup]
|
|
7
|
+
status:
|
|
8
|
+
status: beta
|
|
9
|
+
sections:
|
|
10
|
+
- kind: guidelines
|
|
11
|
+
for: all
|
|
12
|
+
framing: when-to-use
|
|
13
|
+
title: When to use
|
|
14
|
+
items:
|
|
15
|
+
- level: should
|
|
16
|
+
statement: To select from a medium set of options (5–20).
|
|
17
|
+
refines:
|
|
18
|
+
- to: forms#choose-control-by-option-count
|
|
19
|
+
- level: should
|
|
20
|
+
statement: To group related options under headings. Select renders native `optgroup` labels.
|
|
21
|
+
- refs:
|
|
22
|
+
- to: forms#choose-control-by-option-count
|
|
23
|
+
rel: same-as
|
|
24
|
+
- level: should-not
|
|
25
|
+
statement: When there are more than 20 options to choose from, or when the options are asynchronously loaded. Use a TextInput with a filtered list instead.
|
|
26
|
+
alternatives:
|
|
27
|
+
- to: text-input
|
|
28
|
+
- level: should-not
|
|
29
|
+
statement: When there are 4 or fewer options inside a form context. Use Radio instead.
|
|
30
|
+
alternatives:
|
|
31
|
+
- to: radio
|
|
32
|
+
- level: should-not
|
|
33
|
+
statement: To allow freeform text input. Use TextInput.
|
|
34
|
+
alternatives:
|
|
35
|
+
- to: text-input
|
|
36
|
+
- level: should-not
|
|
37
|
+
statement: When an option needs an icon, a description, or any markup beyond text. Options are native `option` elements and hold text only. Use a Popover with Buttons instead.
|
|
38
|
+
alternatives:
|
|
39
|
+
- to: popover
|
|
40
|
+
- level: should-not
|
|
41
|
+
statement: When selecting an option navigates to another location. Use Link instead.
|
|
42
|
+
alternatives:
|
|
43
|
+
- to: link
|
|
44
|
+
- kind: guidelines
|
|
45
|
+
for: all
|
|
46
|
+
framing: how-to-use
|
|
47
|
+
items:
|
|
48
|
+
- id: pass-options-children-select-renders
|
|
49
|
+
level: must
|
|
50
|
+
statement: Pass the options as children. Select renders a native `select`. Each option is an `option` element, and `optgroup` groups them.
|
|
51
|
+
checkedBy: manual
|
|
52
|
+
- refs:
|
|
53
|
+
- to: forms#pair-with-visible-label
|
|
54
|
+
rel: same-as
|
|
55
|
+
- refs:
|
|
56
|
+
- to: content-guidelines#sentence-case-all-system-set
|
|
57
|
+
rel: same-as
|
|
58
|
+
tags: [content]
|
|
59
|
+
- level: should
|
|
60
|
+
statement: Constrain the width from the parent. Select fills its container. Wrap it in a Box or a grid cell to size it.
|
|
61
|
+
- level: should
|
|
62
|
+
statement: Keep select option labels concise and lead with the word that distinguishes the option. Labels are scanned, not read, and a label longer than the field runs under the picker icon.
|
|
63
|
+
tags: [content]
|
|
64
|
+
- level: should
|
|
65
|
+
statement: Label an `optgroup` with the trait its options share, not with a verb.
|
|
66
|
+
tags: [content]
|
|
67
|
+
- level: should
|
|
68
|
+
statement: Pre-select a default option when a clear default exists.
|
|
69
|
+
- level: should
|
|
70
|
+
statement: Order select options logically. When in doubt, order alphabetically or numerically.
|
|
71
|
+
- level: should
|
|
72
|
+
statement: Use `density="loose"` in forms with wide spacing. `regular` is the default and sets padding to space 1; `loose` sets it to space 2.
|
|
73
|
+
- refs:
|
|
74
|
+
- to: forms#stack-fields-vertically
|
|
75
|
+
rel: same-as
|
|
76
|
+
- checkedBy: manual
|
|
77
|
+
refs:
|
|
78
|
+
- to: shared-foundations#error-state-never-disabled
|
|
79
|
+
rel: same-as
|
|
80
|
+
- level: must-not
|
|
81
|
+
statement: Don't add your own dropdown arrow. Select draws the picker icon itself, and the icon ignores pointer events.
|
|
82
|
+
checkedBy: manual
|
|
83
|
+
- level: must-not
|
|
84
|
+
statement: Don't mix Select and a Popover option list in a related group of filter UI — the group should exclusively use one pattern.
|
|
85
|
+
checkedBy: manual
|
|
86
|
+
- kind: guidelines
|
|
87
|
+
for: agent
|
|
88
|
+
framing: how-to-use
|
|
89
|
+
items:
|
|
90
|
+
- level: should
|
|
91
|
+
statement: Use a visible label in form contexts.
|
|
92
|
+
- level: must-not
|
|
93
|
+
statement: 'Do not pass `fontSize`, `padding`, `radius` or `space`. Select does not accept them. Instead: use `density` for padding; the type size and the radius are fixed.'
|
|
94
|
+
checkedBy: manual
|
|
95
|
+
|
|
96
|
+
- kind: guidelines
|
|
97
|
+
for: all
|
|
98
|
+
title: Accessibility
|
|
99
|
+
tags: [accessibility]
|
|
100
|
+
items:
|
|
101
|
+
- refs:
|
|
102
|
+
- to: forms#label-available-to-screen-readers
|
|
103
|
+
rel: same-as
|
|
104
|
+
- refs:
|
|
105
|
+
- to: forms#programmatic-name-required
|
|
106
|
+
rel: same-as
|
|
107
|
+
- level: should
|
|
108
|
+
statement: '**Border contrast.** The default border must reach 3:1 against the field background (WCAG 1.4.11) — check this in both light and dark themes.'
|
|
109
|
+
- level: should
|
|
110
|
+
statement: '**Error text, not error color alone.** `hasError` sets `aria-invalid="true"` and recolors the border and the text. None of that says what is wrong. Describe the problem in text and link it with `aria-describedby` (WCAG 3.3.1).'
|
|
111
|
+
- level: should
|
|
112
|
+
statement: '**A disabled Select cannot be focused or clicked.** It leaves the tab order and sets `pointer-events: none`, so no hover or click reaches it and it is hidden from screen readers. Never rely on a disabled field to explain why it is unavailable.'
|
|
113
|
+
- refs:
|
|
114
|
+
- to: forms#error-described-in-text
|
|
115
|
+
rel: same-as
|
|
116
|
+
- refs:
|
|
117
|
+
- to: forms#error-prop-needs-visible-message
|
|
118
|
+
rel: same-as
|
|
119
|
+
- refs:
|
|
120
|
+
- to: forms#border-contrast
|
|
121
|
+
rel: same-as
|
|
122
|
+
- kind: section
|
|
123
|
+
for: all
|
|
124
|
+
freeform:
|
|
125
|
+
- title: Example - Controlled value
|
|
126
|
+
body: |-
|
|
127
|
+
```
|
|
128
|
+
import { Select } from '@sanity/ui'
|
|
129
|
+
|
|
130
|
+
<Select
|
|
131
|
+
aria-label="Choose a region"
|
|
132
|
+
value={region}
|
|
133
|
+
onChange={(e) => setRegion(e.currentTarget.value)}
|
|
134
|
+
>
|
|
135
|
+
<optgroup label="Europe">
|
|
136
|
+
<option value="eu-west">Ireland</option>
|
|
137
|
+
<option value="eu-central">Frankfurt</option>
|
|
138
|
+
</optgroup>
|
|
139
|
+
<option value="us-east">Virginia</option>
|
|
140
|
+
</Select>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Select forwards the native `select` events. Use `value` and
|
|
144
|
+
`onChange` to drive the field from React state. Read the new
|
|
145
|
+
value from `event.currentTarget.value`. Use `defaultValue` to pre-select
|
|
146
|
+
an option and leave the field uncontrolled.
|
|
147
|
+
|
|
148
|
+
alternatives:
|
|
149
|
+
- to: radio
|
|
150
|
+
note: Single-select from 2–4 options, all visible at once
|
|
151
|
+
- to: text-input
|
|
152
|
+
note: Single-select from a large or async option set, with filtering
|
|
153
|
+
- to: checkbox
|
|
154
|
+
note: Multi-select from a small option set
|
|
155
|
+
- to: popover
|
|
156
|
+
note: A list whose items need icons, descriptions, or navigation
|
|
157
|
+
refs:
|
|
158
|
+
- href: https://www.figma.com/design/NWmchNlsNdG66VBaCsTdSL/pjo-ui4-component-buildout?node-id=29-1944
|
|
159
|
+
rel: design
|
|
160
|
+
role: Figma component
|
|
161
|
+
sourceFiles:
|
|
162
|
+
- platform: react
|
|
163
|
+
file: packages/ui/src/components/select/Select.tsx
|
|
164
|
+
imports:
|
|
165
|
+
- platform: react
|
|
166
|
+
code: import { Select } from '@sanity/ui'
|
|
167
|
+
package: '@sanity/ui'
|
|
168
|
+
traits:
|
|
169
|
+
- traitType: state
|
|
170
|
+
kind: boolean
|
|
171
|
+
id: enabled
|
|
172
|
+
description: Resting state. Backdrop background with a high separator border. The border carries the states below; the background only moves for `disabled`.
|
|
173
|
+
- traitType: state
|
|
174
|
+
kind: boolean
|
|
175
|
+
id: hovered
|
|
176
|
+
description: The border shifts one lightness step — darker in light mode, lighter in dark mode. In the error state it shifts from the error border.
|
|
177
|
+
- traitType: state
|
|
178
|
+
kind: boolean
|
|
179
|
+
id: focused
|
|
180
|
+
description: Focus outline on `:focus-visible`, offset from the border.
|
|
181
|
+
- traitType: state
|
|
182
|
+
kind: boolean
|
|
183
|
+
id: disabled
|
|
184
|
+
description: 'Inert background and a low separator border, with the text in the inert foreground color and the picker icon greyed to match. `pointer-events: none`, so the field is not focusable, not clickable, and leaves the tab order.'
|
|
185
|
+
- traitType: state
|
|
186
|
+
kind: boolean
|
|
187
|
+
id: error
|
|
188
|
+
description: Set with the `hasError` prop. The border turns the error separator color, the text turns the error foreground color, and the select gains `aria-invalid="true"`. It carries no message — supply that yourself.
|
|
189
|
+
$extensions:
|
|
190
|
+
com.sanity.ui:
|
|
191
|
+
implementationStatus:
|
|
192
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
193
|
+
implemented: true
|
|
194
|
+
migrationGuide:
|
|
195
|
+
context: 'Migration guide for this component, covering the codemod and the changes it cannot make. Held as an extension because it is temporary: migration tooling and porting agents read it, and it should be dropped when Sanity UI 3 support ends.'
|
|
196
|
+
guidance: |-
|
|
197
|
+
The sizing props are gone. One `density` prop replaces them, and validation is now a boolean named `hasError`.
|
|
198
|
+
|
|
199
|
+
### Detailed list of differences
|
|
200
|
+
|
|
201
|
+
| v3 pattern | v5 pattern | Notes |
|
|
202
|
+
| :---- | :---- | :---- |
|
|
203
|
+
| `<Select fontSize={2} />` | `<Select />` | The type size is fixed by the component at body size 1 |
|
|
204
|
+
| `<Select padding={3} space={3} />` | `<Select density="loose" />` | `density` is `regular` or `loose`. It sets padding to space 1 or space 2, so neither value reproduces a v3 `padding={3}` exactly |
|
|
205
|
+
| `<Select radius={2} />` | `<Select />` | The radius is fixed at step 2, {radius-2} |
|
|
206
|
+
| `<Select customValidity="Pick one" />` | `<Select hasError />` plus your own message | `hasError` sets `aria-invalid` and recolors the border and text. It renders no text |
|
|
207
|
+
| `<Select icon={ChevronDownIcon} />` | `<Select />` | The picker icon is drawn by the component |
|
|
208
|
+
| All native `<select>` attributes | Forwarded unchanged | Pass them as before |
|
|
209
|
+
|
|
210
|
+
### Breaking changes
|
|
211
|
+
|
|
212
|
+
- **No `fontSize`, `padding`, `radius` or `space`.** Passing them has no effect. Use `density` for padding.
|
|
213
|
+
- **`customValidity` is replaced by `hasError`.** The old prop set the native validation message. The new one is styling plus `aria-invalid`. You own the message and where it appears. The `has` prefix marks it as a validation boolean.
|
|
214
|
+
- **The width is no longer yours to set on the component.** Select fills its container. Size it from the parent.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: skip-to-content
|
|
3
|
+
name: SkipToContent
|
|
4
|
+
description: An accessibility helper that lets keyboard and screen-reader users skip past navigation to the main content.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [accessibility, skip-link, keyboard, navigation, WCAG, skip-to-content, bypass]
|
|
7
|
+
status:
|
|
8
|
+
status: beta
|
|
9
|
+
sections:
|
|
10
|
+
- kind: guidelines
|
|
11
|
+
for: all
|
|
12
|
+
framing: when-to-use
|
|
13
|
+
title: When to use
|
|
14
|
+
items:
|
|
15
|
+
- level: should
|
|
16
|
+
statement: On every page that contains repeated navigation (header, sidebar) before the main content. WCAG 2.4.1 (A) requires a way to bypass blocks of content.
|
|
17
|
+
- level: should
|
|
18
|
+
statement: As the first focusable element in the document so the first Tab press lands on it.
|
|
19
|
+
- level: should-not
|
|
20
|
+
statement: On single-page apps with no repeated navigation block — the skip link adds noise without value.
|
|
21
|
+
- level: should-not
|
|
22
|
+
statement: "For non-main destinations (for example, 'Skip to footer'). Use a regular Link for other jump targets."
|
|
23
|
+
alternatives:
|
|
24
|
+
- to: link
|
|
25
|
+
- kind: guidelines
|
|
26
|
+
for: agent
|
|
27
|
+
framing: when-to-use
|
|
28
|
+
title: When to use
|
|
29
|
+
items:
|
|
30
|
+
- level: should-not
|
|
31
|
+
statement: Don't use SkipToContent for visible navigation links. Use Link instead — SkipToContent is a specialized hidden skip-link that uses Link internally.
|
|
32
|
+
alternatives:
|
|
33
|
+
- to: link
|
|
34
|
+
- level: should-not
|
|
35
|
+
statement: Don't use SkipToContent for custom skip-link patterns. Use VisuallyHidden with `visibleOnFocus` instead.
|
|
36
|
+
alternatives:
|
|
37
|
+
- to: visually-hidden
|
|
38
|
+
- kind: guidelines
|
|
39
|
+
for: all
|
|
40
|
+
framing: how-to-use
|
|
41
|
+
items:
|
|
42
|
+
- level: must
|
|
43
|
+
statement: Place SkipToContent as the first child of body so it's the first thing Tab reaches.
|
|
44
|
+
- level: must
|
|
45
|
+
statement: Point href at a focusable element. The target (typically main) should have tabIndex={-1}.
|
|
46
|
+
- level: must-not
|
|
47
|
+
statement: "Don't hide SkipToContent with display: none or aria-hidden — the clip-rect technique keeps it focusable."
|
|
48
|
+
- level: must-not
|
|
49
|
+
statement: Don't link to a non-focusable element — focus stays at the top and the skip link fails its purpose.
|
|
50
|
+
- kind: guidelines
|
|
51
|
+
for: agent
|
|
52
|
+
framing: how-to-use
|
|
53
|
+
items:
|
|
54
|
+
- level: must
|
|
55
|
+
statement: The target element must have tabIndex={-1} for focus to move correctly on activation.
|
|
56
|
+
- level: must-not
|
|
57
|
+
statement: 'Do not hide with display: none — this breaks keyboard accessibility.'
|
|
58
|
+
- level: must-not
|
|
59
|
+
statement: 'Linking to a non-focusable element as the href target. Instead: Add tabIndex={-1} to the target element (for example, the main element) so focus moves correctly.'
|
|
60
|
+
- level: must-not
|
|
61
|
+
statement: 'Using `hash` instead of `href` on SkipToContent (for example, `<SkipToContent hash="#main" />`). `hash` is not a prop, so passing it is a TypeScript error. Use `<SkipToContent href="#main" label="Skip to content" />`. The `sanity-ui/no-skip-to-content-hash` ESLint rule autofixes `hash` to `href`.'
|
|
62
|
+
- level: must-not
|
|
63
|
+
statement: 'Omitting the leading ''#'' from href (for example, `href="main"` instead of `href="#main"`). `href` is passed straight through to the underlying anchor — without the ''#'' it compiles fine but links to a relative URL instead of jumping to the same-page fragment. This produces no build error, so it must be checked explicitly.'
|
|
64
|
+
- kind: guidelines
|
|
65
|
+
for: all
|
|
66
|
+
title: Content
|
|
67
|
+
tags: [content]
|
|
68
|
+
items:
|
|
69
|
+
- refs:
|
|
70
|
+
- to: content-guidelines#sentence-case-all-system-set
|
|
71
|
+
rel: same-as
|
|
72
|
+
- level: should
|
|
73
|
+
statement: '**"Skip to content"** or **"Skip to main content"** is the convention.'
|
|
74
|
+
- level: should
|
|
75
|
+
statement: '**No trailing period.**'
|
|
76
|
+
|
|
77
|
+
alternatives:
|
|
78
|
+
- to: link
|
|
79
|
+
note: The anchor primitive rendered inside SkipToContent
|
|
80
|
+
- to: visually-hidden
|
|
81
|
+
note: The hiding primitive SkipToContent composes; use `<VisuallyHidden visibleOnFocus>` directly for other skip-link patterns
|
|
82
|
+
sourceFiles:
|
|
83
|
+
- platform: react
|
|
84
|
+
file: packages/ui/src/components/skip-to-content/SkipToContent.tsx
|
|
85
|
+
imports:
|
|
86
|
+
- platform: react
|
|
87
|
+
code: import { SkipToContent } from '@sanity/ui'
|
|
88
|
+
package: '@sanity/ui'
|
|
89
|
+
traits:
|
|
90
|
+
- traitType: state
|
|
91
|
+
kind: boolean
|
|
92
|
+
id: hidden
|
|
93
|
+
description: Clipped to 1×1 pixel, removed from layout. Default state, invisible to sighted users.
|
|
94
|
+
- traitType: state
|
|
95
|
+
kind: boolean
|
|
96
|
+
id: revealed
|
|
97
|
+
description: Unclipped, positioned at top-left with high z-index. Shown when the link receives :focus-visible.
|
|
98
|
+
$extensions:
|
|
99
|
+
com.sanity.ui:
|
|
100
|
+
implementationStatus:
|
|
101
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
102
|
+
implemented: true
|
|
103
|
+
migrationGuide:
|
|
104
|
+
context: 'Migration guide for this component, covering the codemod and the changes it cannot make. Held as an extension because it is temporary: migration tooling and porting agents read it, and it should be dropped when Sanity UI 3 support ends.'
|
|
105
|
+
guidance: |-
|
|
106
|
+
There was no SkipToContent in v3 — teams hand-rolled the pattern with a `<Box>` and a `position: absolute` reveal trick. The new component bundles VisuallyHidden + Link with the right focus behavior.
|
|
107
|
+
|
|
108
|
+
| v3 pattern | New prop | Notes |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `<Box className="skip-link">...</Box>` (custom) | `<SkipToContent href="#main" label="Skip to content" />` | Drop in as the first body child |
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: spinner
|
|
3
|
+
name: Spinner
|
|
4
|
+
description: Displays a loading/processing indicator.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [spinner, loading, progress, async, indicator, busy, fetch]
|
|
7
|
+
status:
|
|
8
|
+
status: beta
|
|
9
|
+
sections:
|
|
10
|
+
- kind: guidelines
|
|
11
|
+
for: all
|
|
12
|
+
framing: when-to-use
|
|
13
|
+
title: When to use
|
|
14
|
+
items:
|
|
15
|
+
- level: should
|
|
16
|
+
statement: Content loading into a region of the page.
|
|
17
|
+
- level: should
|
|
18
|
+
statement: Async operations in progress (fetching data, uploading files).
|
|
19
|
+
- level: should
|
|
20
|
+
statement: Form submissions or other actions that take a long time.
|
|
21
|
+
- level: should-not
|
|
22
|
+
statement: To fill in placeholder content prior to loading. Use a skeleton placeholder instead.
|
|
23
|
+
alternatives:
|
|
24
|
+
- to: loading-states
|
|
25
|
+
- level: should-not
|
|
26
|
+
statement: When progress is known. Use a progress bar pattern instead.
|
|
27
|
+
- kind: guidelines
|
|
28
|
+
for: agent
|
|
29
|
+
framing: when-to-use
|
|
30
|
+
title: When to use
|
|
31
|
+
items:
|
|
32
|
+
- level: should-not
|
|
33
|
+
statement: Button has a built-in loading prop; use that for button-level loading states instead of composing a Spinner inside a Button.
|
|
34
|
+
alternatives:
|
|
35
|
+
- to: button
|
|
36
|
+
- kind: guidelines
|
|
37
|
+
for: all
|
|
38
|
+
framing: how-to-use
|
|
39
|
+
items:
|
|
40
|
+
- level: must
|
|
41
|
+
statement: Pair with a visible text label explaining what's loading. A spinner alone does not tell the user what is happening.
|
|
42
|
+
- level: must
|
|
43
|
+
statement: >-
|
|
44
|
+
Carry the loading state in text, not in the rotation. Under reduced motion, v5's global reset stops Spinner's animation after one short iteration, so the spinner renders still. The paired text label, or an `aria-live` announcement, is what tells the user that work is in progress.
|
|
45
|
+
- level: should
|
|
46
|
+
statement: Show the spinner only after a short delay (~200ms) to avoid a flash for operations that complete quickly. If the operation finishes before the delay, skip the spinner.
|
|
47
|
+
- level: should
|
|
48
|
+
statement: Place the spinner near the content region it relates to.
|
|
49
|
+
- level: must-not
|
|
50
|
+
statement: Don't show spinners for tasks that finish in under 200ms.
|
|
51
|
+
- level: must-not
|
|
52
|
+
statement: Don't use multiple spinners on the same screen — use a single spinner at a higher level or skeleton placeholders per region.
|
|
53
|
+
- kind: guidelines
|
|
54
|
+
for: agent
|
|
55
|
+
framing: how-to-use
|
|
56
|
+
items:
|
|
57
|
+
- level: must
|
|
58
|
+
statement: Spinner renders `role="status"` and `aria-label="Loading..."` by default. Don't wrap it in another status region. Pass your own `aria-label` to name the operation.
|
|
59
|
+
- level: must-not
|
|
60
|
+
statement: 'Showing a spinner without any text label. Instead: Always pair Spinner with a visible text label or aria-label describing the operation.'
|
|
61
|
+
- level: must-not
|
|
62
|
+
statement: 'Using a tone or muted prop on Spinner. Instead: Both props were removed in v5. Spinner color is CSS-driven via --foreground-high and --foreground-low. Set tone on the parent container to control color intensity.'
|
|
63
|
+
- kind: guidelines
|
|
64
|
+
for: all
|
|
65
|
+
title: Accessibility
|
|
66
|
+
description: 'Target conformance: WCAG Level AA.'
|
|
67
|
+
tags: [accessibility]
|
|
68
|
+
items:
|
|
69
|
+
- id: aria-busy
|
|
70
|
+
level: must
|
|
71
|
+
statement: Set aria-busy='true' on the container that is loading. Remove it when loading completes.
|
|
72
|
+
- id: role
|
|
73
|
+
level: must
|
|
74
|
+
statement: Wrap the Spinner and its label in a container with role='status'. Screen readers announce the loading message when it appears. The role implies aria-live='polite' so the announcement does not cut off the user.
|
|
75
|
+
- id: aria-label
|
|
76
|
+
level: must
|
|
77
|
+
statement: "Spinner ships with a built-in role='status' and aria-label='Loading...', so a bare <Spinner /> is announced by screen readers as 'Loading...' — it is not hidden from assistive technology. Pass your own aria-label to announce a more specific state (for example, 'Loading documents'); it overrides the default."
|
|
78
|
+
|
|
79
|
+
alternatives:
|
|
80
|
+
- to: button
|
|
81
|
+
refs:
|
|
82
|
+
- href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=32600-2650
|
|
83
|
+
rel: design
|
|
84
|
+
role: Figma component (v5)
|
|
85
|
+
sourceFiles:
|
|
86
|
+
- platform: react
|
|
87
|
+
file: packages/ui/src/components/spinner/Spinner.tsx
|
|
88
|
+
imports:
|
|
89
|
+
- platform: react
|
|
90
|
+
code: import { Spinner } from '@sanity/ui'
|
|
91
|
+
package: '@sanity/ui'
|
|
92
|
+
$extensions:
|
|
93
|
+
com.sanity.ui:
|
|
94
|
+
implementationStatus:
|
|
95
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
96
|
+
implemented: true
|
|
97
|
+
migrationGuide:
|
|
98
|
+
context: 'Migration guide for this component, covering the codemod and the changes it cannot make. Held as an extension because it is temporary: migration tooling and porting agents read it, and it should be dropped when Sanity UI 3 support ends.'
|
|
99
|
+
guidance: |-
|
|
100
|
+
Spinner has two API changes in v5\. v5 drops `tone` and adds `size`.
|
|
101
|
+
|
|
102
|
+
### **Key differences**
|
|
103
|
+
|
|
104
|
+
- v5 drops the `tone` and `muted` props.
|
|
105
|
+
- v5 adds a `size` prop. It controls the icon size on a scale of 0–4. Defaults to `2`.
|
|
106
|
+
- v5 drops `styled-components`. Custom extensions like `styled(Spinner)` will not work.
|
|
107
|
+
|
|
108
|
+
### **Detailed list of differences**
|
|
109
|
+
|
|
110
|
+
| v3 prop | v5 prop | Notes |
|
|
111
|
+
| :---- | :---- | :---- |
|
|
112
|
+
| `tone` | — | Removed. |
|
|
113
|
+
| `muted` | — | Removed. |
|
|
114
|
+
| — | `size` | New. Controls the icon size (0–4, default `2`) |
|
|
115
|
+
|
|
116
|
+
### **Breaking changes**
|
|
117
|
+
|
|
118
|
+
- v5 drops `tone` and `muted`. `<Spinner tone="critical" muted>` does nothing.
|
|
119
|
+
- v5 drops `styled-components`. `styled(Spinner)` will not work.
|