@sanity/ui 2.0.0-beta.4 → 2.0.0-beta.5

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.
@@ -14,6 +14,7 @@ export const Card = cjs.Card;
14
14
  export const Checkbox = cjs.Checkbox;
15
15
  export const Code = cjs.Code;
16
16
  export const CodeSkeleton = cjs.CodeSkeleton;
17
+ export const ConditionalWrapper = cjs.ConditionalWrapper;
17
18
  export const Container = cjs.Container;
18
19
  export const Dialog = cjs.Dialog;
19
20
  export const DialogContext = cjs.DialogContext;
package/dist/index.d.ts CHANGED
@@ -116,24 +116,24 @@ export declare const Autocomplete: <Option extends BaseAutocompleteOption>(
116
116
  props: AutocompleteProps<Option> &
117
117
  Omit<
118
118
  HTMLProps<HTMLInputElement>,
119
- | 'value'
120
- | 'ref'
121
119
  | 'id'
122
- | 'spellCheck'
120
+ | 'type'
123
121
  | 'role'
124
- | 'prefix'
125
- | 'autoCapitalize'
126
- | 'autoCorrect'
127
- | 'inputMode'
128
122
  | 'aria-activedescendant'
129
123
  | 'aria-autocomplete'
130
124
  | 'aria-expanded'
131
125
  | 'aria-owns'
132
126
  | 'onChange'
133
127
  | 'onSelect'
128
+ | 'value'
129
+ | 'ref'
130
+ | 'spellCheck'
131
+ | 'prefix'
132
+ | 'autoCapitalize'
133
+ | 'autoCorrect'
134
+ | 'inputMode'
134
135
  | 'as'
135
136
  | 'autoComplete'
136
- | 'type'
137
137
  > & {
138
138
  ref?: Ref<HTMLInputElement> | undefined
139
139
  },
@@ -497,7 +497,7 @@ export declare type BoxSizing = 'content' | 'border'
497
497
  */
498
498
  export declare const Breadcrumbs: ForwardRefExoticComponent<
499
499
  BreadcrumbsProps &
500
- Omit<HTMLProps<HTMLOListElement>, 'ref' | 'as' | 'type'> &
500
+ Omit<HTMLProps<HTMLOListElement>, 'type' | 'ref' | 'as'> &
501
501
  RefAttributes<HTMLOListElement>
502
502
  >
503
503
 
@@ -616,7 +616,7 @@ export declare type CardTone = ThemeColorCardToneKey | 'inherit'
616
616
  * @public
617
617
  */
618
618
  export declare const Checkbox: ForwardRefExoticComponent<
619
- Omit<Omit<HTMLProps<HTMLInputElement>, 'as' | 'type'> & CheckboxProps, 'ref'> &
619
+ Omit<Omit<HTMLProps<HTMLInputElement>, 'type' | 'as'> & CheckboxProps, 'ref'> &
620
620
  RefAttributes<HTMLInputElement>
621
621
  >
622
622
 
@@ -657,7 +657,7 @@ export declare interface CodeProps {
657
657
  */
658
658
  export declare const CodeSkeleton: ForwardRefExoticComponent<
659
659
  Omit<
660
- CodeSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'size' | 'children' | 'height' | 'as'>,
660
+ CodeSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'children' | 'size' | 'as'>,
661
661
  'ref'
662
662
  > &
663
663
  RefAttributes<HTMLDivElement>
@@ -671,6 +671,19 @@ export declare interface CodeSkeletonProps extends SkeletonProps {
671
671
  size?: number | number[]
672
672
  }
673
673
 
674
+ /**
675
+ * @internal
676
+ */
677
+ export declare function ConditionalWrapper({
678
+ children,
679
+ condition,
680
+ wrapper,
681
+ }: {
682
+ children: React.ReactNode
683
+ condition: boolean
684
+ wrapper: (children: React.ReactNode) => React.ReactNode
685
+ }): React.ReactNode
686
+
674
687
  /**
675
688
  * The `Container` component wraps content layout in a defined set of widths.
676
689
  *
@@ -1055,7 +1068,7 @@ export declare interface HeadingProps {
1055
1068
  */
1056
1069
  export declare const HeadingSkeleton: ForwardRefExoticComponent<
1057
1070
  Omit<
1058
- HeadingSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'size' | 'children' | 'height' | 'as'>,
1071
+ HeadingSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'children' | 'size' | 'as'>,
1059
1072
  'ref'
1060
1073
  > &
1061
1074
  RefAttributes<HTMLDivElement>
@@ -1222,7 +1235,7 @@ export declare interface LabelProps {
1222
1235
  */
1223
1236
  export declare const LabelSkeleton: ForwardRefExoticComponent<
1224
1237
  Omit<
1225
- LabelSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'size' | 'children' | 'height' | 'as'>,
1238
+ LabelSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'children' | 'size' | 'as'>,
1226
1239
  'ref'
1227
1240
  > &
1228
1241
  RefAttributes<HTMLDivElement>
@@ -1299,7 +1312,7 @@ export declare interface _MediaStore {
1299
1312
  * @public
1300
1313
  */
1301
1314
  export declare const Menu: ForwardRefExoticComponent<
1302
- Omit<MenuProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'tabIndex' | 'role' | 'as'>, 'ref'> &
1315
+ Omit<MenuProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'role' | 'tabIndex' | 'as'>, 'ref'> &
1303
1316
  RefAttributes<HTMLDivElement>
1304
1317
  >
1305
1318
 
@@ -1382,7 +1395,7 @@ export declare const MenuDivider: IStyledComponent<
1382
1395
  style?: CSSProperties | undefined
1383
1396
  tabIndex?: number | undefined
1384
1397
  title?: string | undefined
1385
- translate?: 'yes' | 'no' | undefined
1398
+ translate?: 'no' | 'yes' | undefined
1386
1399
  radioGroup?: string | undefined
1387
1400
  role?: AriaRole | undefined
1388
1401
  about?: string | undefined
@@ -1407,7 +1420,7 @@ export declare const MenuDivider: IStyledComponent<
1407
1420
  itemRef?: string | undefined
1408
1421
  results?: number | undefined
1409
1422
  security?: string | undefined
1410
- unselectable?: 'on' | 'off' | undefined
1423
+ unselectable?: 'off' | 'on' | undefined
1411
1424
  inputMode?:
1412
1425
  | 'none'
1413
1426
  | 'text'
@@ -1421,7 +1434,7 @@ export declare const MenuDivider: IStyledComponent<
1421
1434
  is?: string | undefined
1422
1435
  'aria-activedescendant'?: string | undefined
1423
1436
  'aria-atomic'?: (boolean | 'false' | 'true') | undefined
1424
- 'aria-autocomplete'?: 'none' | 'both' | 'inline' | 'list' | undefined
1437
+ 'aria-autocomplete'?: 'none' | 'inline' | 'both' | 'list' | undefined
1425
1438
  'aria-braillelabel'?: string | undefined
1426
1439
  'aria-brailleroledescription'?: string | undefined
1427
1440
  'aria-busy'?: (boolean | 'false' | 'true') | undefined
@@ -1436,16 +1449,16 @@ export declare const MenuDivider: IStyledComponent<
1436
1449
  | 'page'
1437
1450
  | 'false'
1438
1451
  | 'true'
1439
- | 'time'
1440
1452
  | 'step'
1441
1453
  | 'location'
1442
1454
  | 'date'
1455
+ | 'time'
1443
1456
  | undefined
1444
1457
  'aria-describedby'?: string | undefined
1445
1458
  'aria-description'?: string | undefined
1446
1459
  'aria-details'?: string | undefined
1447
1460
  'aria-disabled'?: (boolean | 'false' | 'true') | undefined
1448
- 'aria-dropeffect'?: 'none' | 'link' | 'copy' | 'move' | 'execute' | 'popup' | undefined
1461
+ 'aria-dropeffect'?: 'none' | 'copy' | 'move' | 'link' | 'execute' | 'popup' | undefined
1449
1462
  'aria-errormessage'?: string | undefined
1450
1463
  'aria-expanded'?: (boolean | 'false' | 'true') | undefined
1451
1464
  'aria-flowto'?: string | undefined
@@ -1477,8 +1490,8 @@ export declare const MenuDivider: IStyledComponent<
1477
1490
  'aria-pressed'?: boolean | 'mixed' | 'false' | 'true' | undefined
1478
1491
  'aria-readonly'?: (boolean | 'false' | 'true') | undefined
1479
1492
  'aria-relevant'?:
1480
- | 'text'
1481
1493
  | 'all'
1494
+ | 'text'
1482
1495
  | 'additions'
1483
1496
  | 'additions removals'
1484
1497
  | 'additions text'
@@ -1700,7 +1713,7 @@ export declare interface MenuGroupProps {
1700
1713
  */
1701
1714
  export declare const MenuItem: ForwardRefExoticComponent<
1702
1715
  MenuItemProps &
1703
- Omit<HTMLProps<HTMLDivElement>, 'ref' | 'height' | 'tabIndex' | 'as' | 'selected'> &
1716
+ Omit<HTMLProps<HTMLDivElement>, 'height' | 'tabIndex' | 'ref' | 'as' | 'selected'> &
1704
1717
  RefAttributes<HTMLDivElement>
1705
1718
  >
1706
1719
 
@@ -1783,7 +1796,7 @@ export declare type Placement =
1783
1796
  export declare const Popover: MemoExoticComponent<
1784
1797
  ForwardRefExoticComponent<
1785
1798
  Omit<
1786
- PopoverProps & Omit<HTMLProps<HTMLDivElement>, 'content' | 'children' | 'width' | 'as'>,
1799
+ PopoverProps & Omit<HTMLProps<HTMLDivElement>, 'content' | 'width' | 'children' | 'as'>,
1787
1800
  'ref'
1788
1801
  > &
1789
1802
  RefAttributes<HTMLDivElement>
@@ -1802,15 +1815,41 @@ export declare interface PopoverProps
1802
1815
  ResponsiveShadowProps {
1803
1816
  /** @beta */
1804
1817
  __unstable_margins?: PopoverMargins
1818
+ /**
1819
+ * Whether the popover should animate in and out.
1820
+ *
1821
+ * @beta
1822
+ * @defaultValue false
1823
+ */
1824
+ animate?: boolean
1805
1825
  arrow?: boolean
1806
1826
  /** @deprecated Use `floatingBoundary` and/or `referenceBoundary` instead */
1807
1827
  boundaryElement?: HTMLElement | null
1808
1828
  children?: React.ReactElement
1829
+ /**
1830
+ * When `true`, prevent overflow within the current boundary:
1831
+ * - by flipping on its side axis
1832
+ * - by resizing
1833
+ /*
1834
+ * Note that:
1835
+ * - setting `preventOverflow` to `true` also prevents overflow on its side axis
1836
+ * - setting `matchReferenceWidth` to `true` also causes the popover to resize
1837
+ *
1838
+ * @defaultValue false
1839
+ */
1809
1840
  constrainSize?: boolean
1810
1841
  content?: React.ReactNode
1811
1842
  disabled?: boolean
1812
1843
  fallbackPlacements?: Placement[]
1813
1844
  floatingBoundary?: HTMLElement | null
1845
+ /**
1846
+ * When `true`, set the maximum width to match the reference element, and also prevent overflow within
1847
+ * the current boundary by resizing.
1848
+ *
1849
+ * Note that setting `constrainSize` to `true` also causes the popover to resize
1850
+ *
1851
+ * @defaultValue false
1852
+ */
1814
1853
  matchReferenceWidth?: boolean
1815
1854
  open?: boolean
1816
1855
  overflow?: BoxOverflow
@@ -1889,7 +1928,7 @@ export declare interface PortalProviderProps {
1889
1928
  * @public
1890
1929
  */
1891
1930
  export declare const Radio: ForwardRefExoticComponent<
1892
- Omit<Omit<HTMLProps<HTMLInputElement>, 'as' | 'type'> & RadioProps, 'ref'> &
1931
+ Omit<Omit<HTMLProps<HTMLInputElement>, 'type' | 'as'> & RadioProps, 'ref'> &
1893
1932
  RefAttributes<HTMLInputElement>
1894
1933
  >
1895
1934
 
@@ -2279,7 +2318,7 @@ export declare type Styles = ThemeStyles
2279
2318
  * @public
2280
2319
  */
2281
2320
  export declare const Switch: ForwardRefExoticComponent<
2282
- Omit<Omit<HTMLProps<HTMLInputElement>, 'as' | 'type'> & SwitchProps, 'ref'> &
2321
+ Omit<Omit<HTMLProps<HTMLInputElement>, 'type' | 'as'> & SwitchProps, 'ref'> &
2283
2322
  RefAttributes<HTMLInputElement>
2284
2323
  >
2285
2324
 
@@ -2298,7 +2337,7 @@ export declare const Tab: ForwardRefExoticComponent<
2298
2337
  TabProps &
2299
2338
  Omit<
2300
2339
  HTMLProps<HTMLButtonElement>,
2301
- 'label' | 'width' | 'id' | 'aria-controls' | 'as' | 'type'
2340
+ 'width' | 'id' | 'type' | 'aria-controls' | 'label' | 'as'
2302
2341
  >,
2303
2342
  'ref'
2304
2343
  > &
@@ -2404,7 +2443,7 @@ export declare interface TextAreaProps extends ResponsiveRadiusProps {
2404
2443
  * @public
2405
2444
  */
2406
2445
  export declare const TextInput: ForwardRefExoticComponent<
2407
- Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'prefix' | 'as' | 'type'>, 'ref'> &
2446
+ Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | 'prefix' | 'as'>, 'ref'> &
2408
2447
  RefAttributes<HTMLInputElement>
2409
2448
  >
2410
2449
 
@@ -2486,7 +2525,7 @@ export declare interface TextProps {
2486
2525
  */
2487
2526
  export declare const TextSkeleton: ForwardRefExoticComponent<
2488
2527
  Omit<
2489
- TextSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'size' | 'children' | 'height' | 'as'>,
2528
+ TextSkeletonProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'children' | 'size' | 'as'>,
2490
2529
  'ref'
2491
2530
  > &
2492
2531
  RefAttributes<HTMLDivElement>
@@ -2834,7 +2873,7 @@ export declare interface TooltipProps extends Omit<LayerProps, 'as'> {
2834
2873
  export declare const Tree: MemoExoticComponent<
2835
2874
  ForwardRefExoticComponent<
2836
2875
  TreeProps &
2837
- Omit<HTMLProps<HTMLDivElement>, 'wrap' | 'ref' | 'height' | 'role' | 'as' | 'align'> &
2876
+ Omit<HTMLProps<HTMLDivElement>, 'height' | 'role' | 'wrap' | 'ref' | 'as' | 'align'> &
2838
2877
  RefAttributes<HTMLDivElement>
2839
2878
  >
2840
2879
  >
@@ -2859,7 +2898,7 @@ export declare interface TreeContextValue {
2859
2898
  * @beta
2860
2899
  */
2861
2900
  export declare const TreeItem: NamedExoticComponent<
2862
- TreeItemProps & Omit<HTMLProps<HTMLLIElement>, 'ref' | 'role' | 'as'>
2901
+ TreeItemProps & Omit<HTMLProps<HTMLLIElement>, 'role' | 'ref' | 'as'>
2863
2902
  >
2864
2903
 
2865
2904
  /**
@@ -3029,7 +3068,7 @@ export declare function useTree(): TreeContextValue
3029
3068
  export declare const VirtualList: ForwardRefExoticComponent<
3030
3069
  VirtualListProps<any> &
3031
3070
  StackProps &
3032
- Omit<HTMLProps<HTMLDivElement>, 'children' | 'ref' | 'onChange' | 'as'> &
3071
+ Omit<HTMLProps<HTMLDivElement>, 'children' | 'onChange' | 'ref' | 'as'> &
3033
3072
  RefAttributes<HTMLDivElement>
3034
3073
  >
3035
3074