@sanity/ui 5.0.0-alpha.7 → 5.0.0-alpha.9

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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/install.js +2 -1
  3. package/dist/index.d.ts +273 -79
  4. package/dist/index.js +51 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/styles.css +1 -1
  7. package/package.json +2 -2
  8. package/src/cli/install.ts +2 -1
  9. package/src/components/badge/Badge.tsx +53 -0
  10. package/src/components/badge/badge.css +6 -0
  11. package/src/components/badge/badge.props.ts +31 -0
  12. package/src/components/box/box.props.ts +7 -2
  13. package/src/components/button/button.props.ts +27 -9
  14. package/src/components/card/card.props.ts +6 -2
  15. package/src/components/checkbox/Checkbox.tsx +2 -1
  16. package/src/components/checkbox/checkbox.props.ts +11 -3
  17. package/src/components/code/code.props.ts +10 -3
  18. package/src/components/container/container.props.ts +6 -2
  19. package/src/components/dialog/Dialog.tsx +1 -1
  20. package/src/components/dialog/dialog.props.ts +13 -4
  21. package/src/components/eyebrow/eyebrow.props.ts +6 -2
  22. package/src/components/flex/flex.props.ts +6 -2
  23. package/src/components/grid/grid.props.ts +6 -2
  24. package/src/components/h-stack/hStack.props.ts +3 -1
  25. package/src/components/heading/heading.props.ts +8 -2
  26. package/src/components/icon/icon.props.ts +6 -2
  27. package/src/components/icon-button/iconButton.props.ts +7 -2
  28. package/src/components/index.css +1 -0
  29. package/src/components/indicator/indicator.props.ts +6 -2
  30. package/src/components/indicator-stack/indicatorStack.props.ts +3 -1
  31. package/src/components/inline/inline.props.ts +6 -2
  32. package/src/components/label/label.props.ts +7 -1
  33. package/src/components/link/link.props.ts +4 -4
  34. package/src/components/list/list.props.ts +27 -9
  35. package/src/components/popover/popover.props.ts +14 -4
  36. package/src/components/press-area/pressArea.props.ts +3 -1
  37. package/src/components/radio/radio.props.ts +7 -2
  38. package/src/components/skip-to-content/skipToContent.props.ts +9 -3
  39. package/src/components/spinner/Spinner.tsx +1 -1
  40. package/src/components/spinner/spinner.props.ts +3 -0
  41. package/src/components/switch/switch.props.ts +7 -2
  42. package/src/components/text/text.props.ts +6 -2
  43. package/src/components/tooltip/tooltip.props.ts +12 -4
  44. package/src/components/tooltip-group/tooltipGroup.props.ts +3 -1
  45. package/src/components/v-stack/vStack.props.ts +3 -1
  46. package/src/components/visually-hidden/visuallyHidden.props.ts +6 -2
  47. package/src/index.ts +1 -0
  48. package/src/version.ts +2 -2
@@ -3,12 +3,18 @@ import {type PropDef} from '../../types/PropDef'
3
3
  /** @beta */
4
4
  export interface SkipToContentProps extends React.ComponentProps<'a'> {
5
5
  /**
6
- * Anchor href. The target element should be focusable or have `tabindex="-1"`.
6
+ * Same-page fragment to jump to.
7
+ * @remarks Note: The hash character # is required for proper linking.
7
8
  */
8
9
  href: string
9
- /** Visible/announced label */
10
+ /**
11
+ * Visible and announced text.
12
+ */
10
13
  label: string
11
- /** Use label instead */
14
+ /**
15
+ * Not accepted.
16
+ * @remarks Pass text via `label`.
17
+ */
12
18
  children?: never
13
19
  }
14
20
 
@@ -1,4 +1,4 @@
1
- import {SpinnerIcon} from '@sanity/icons'
1
+ import {SpinnerIcon} from '@sanity/icons/Spinner'
2
2
  import clsx from 'clsx'
3
3
 
4
4
  import {getProps} from '../../utils/getProps'
@@ -4,6 +4,9 @@ import type {Responsive} from '../../types/Responsive'
4
4
 
5
5
  /** @public */
6
6
  export interface SpinnerProps extends React.ComponentProps<'svg'> {
7
+ /**
8
+ * Size of the spinner icon.
9
+ */
7
10
  size?: Responsive<IconSize>
8
11
  }
9
12
 
@@ -3,9 +3,14 @@ import {type PropDef} from '../../types/PropDef'
3
3
 
4
4
  /** @beta */
5
5
  export interface SwitchProps extends React.ComponentProps<'input'>, MarginProps {
6
- /** Error state */
6
+ /**
7
+ * Applies error styling to the switch track.
8
+ * @remarks Use when form validation fails. Pair with a visible error message. The prop is visual only.
9
+ */
7
10
  error?: boolean
8
- /** Input label */
11
+ /**
12
+ * Visible label next to the switch.
13
+ */
9
14
  label: React.ReactNode
10
15
  }
11
16
 
@@ -5,9 +5,13 @@ import {TEXT_SIZE, type TextSize} from '../../types/Text'
5
5
 
6
6
  /** @public */
7
7
  export interface TextProps<T extends React.ElementType = 'span'> extends TypographyProps {
8
- /** Element to render */
8
+ /**
9
+ * HTML element to render.
10
+ */
9
11
  as?: T
10
- /** CSS **font-size** property */
12
+ /**
13
+ * Sets font size.
14
+ */
11
15
  size?: Responsive<TextSize>
12
16
  }
13
17
 
@@ -4,13 +4,21 @@ import {type PropDef} from '../../types/PropDef'
4
4
  /** @beta */
5
5
  export interface TooltipProps
6
6
  extends Omit<React.ComponentProps<'div'>, 'children' | 'content'>, PlacementProps {
7
- /** Anchor name for positioning */
7
+ /**
8
+ * Shared anchor identifier.
9
+ */
8
10
  anchorName?: React.ReactNode
9
- /** Focusable trigger element */
11
+ /**
12
+ * The trigger element.
13
+ */
10
14
  children: React.ReactElement<Record<string, unknown>>
11
- /** Tooltip content */
15
+ /**
16
+ * The tooltip label.
17
+ */
12
18
  content?: React.ReactNode
13
- /** Render tooltip in portal */
19
+ /**
20
+ * Renders the label into `document.body` through a React portal instead of inline.
21
+ */
14
22
  portal?: boolean
15
23
  }
16
24
 
@@ -2,7 +2,9 @@ import {type PropDef} from '../../types/PropDef'
2
2
 
3
3
  /** @public */
4
4
  export interface TooltipGroupProps<T extends React.ElementType = 'div'> {
5
- /** Element to render */
5
+ /**
6
+ * HTML element to render.
7
+ */
6
8
  as?: T
7
9
  }
8
10
 
@@ -3,7 +3,9 @@ import {type PropDef} from '../../types/PropDef'
3
3
 
4
4
  /** @public */
5
5
  export interface VStackProps<T extends React.ElementType = 'div'> extends Pick<GapProps, 'gap'> {
6
- /** Element to render */
6
+ /**
7
+ * HTML element or component to render.
8
+ */
7
9
  as?: T
8
10
  }
9
11
 
@@ -2,9 +2,13 @@ import {type PropDef} from '../../types/PropDef'
2
2
 
3
3
  /** @public */
4
4
  export interface VisuallyHiddenProps<T extends React.ElementType = 'span'> {
5
- /** Element to render */
5
+ /**
6
+ * HTML element to render.
7
+ */
6
8
  as?: T
7
- /** If true, element is visible on :focus-visible */
9
+ /**
10
+ * If true, the element becomes visible on `:focus-visible`.
11
+ */
8
12
  visibleOnFocus?: boolean
9
13
  }
10
14
 
package/src/index.ts CHANGED
@@ -62,3 +62,4 @@ export type {TextSize} from './types/Text'
62
62
  export type {TextAlign} from './types/TextAlign'
63
63
  export type {FontWeight} from './types/FontWeight'
64
64
  export type {Tone} from './types/Tone'
65
+ export * from './components/badge/Badge'
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 = '500alpha7'
3
- export const HASH = '47d232'
2
+ export const VERSION = '500alpha9'
3
+ export const HASH = 'fd663f'