@sanity/ui 3.0.11 → 3.0.12-canary.1

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 (53) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +1124 -628
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +1127 -631
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/_visual-editing.d.mts +3 -7
  6. package/dist/_visual-editing.d.ts +3 -7
  7. package/dist/index.d.mts +11 -12
  8. package/dist/index.d.ts +11 -12
  9. package/dist/index.js +252 -295
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +254 -297
  12. package/dist/index.mjs.map +1 -1
  13. package/package.json +26 -40
  14. package/src/core/components/autocomplete/autocomplete.tsx +2 -2
  15. package/src/core/components/breadcrumbs/breadcrumbs.tsx +70 -40
  16. package/src/core/components/dialog/dialog.tsx +10 -14
  17. package/src/core/components/hotkeys/hotkeys.tsx +2 -2
  18. package/src/core/components/menu/menuGroup.tsx +2 -2
  19. package/src/core/components/menu/menuItem.tsx +4 -4
  20. package/src/core/components/skeleton/skeleton.tsx +2 -2
  21. package/src/core/components/skeleton/textSkeleton.tsx +5 -5
  22. package/src/core/components/tree/tree.tsx +176 -182
  23. package/src/core/components/tree/treeGroup.tsx +2 -4
  24. package/src/core/components/tree/treeItem.tsx +5 -5
  25. package/src/core/hooks/index.ts +1 -1
  26. package/src/core/hooks/useArrayProp.ts +5 -17
  27. package/src/core/primitives/avatar/avatar.tsx +14 -16
  28. package/src/core/primitives/avatar/avatarCounter.tsx +14 -16
  29. package/src/core/primitives/avatar/avatarStack.tsx +2 -2
  30. package/src/core/primitives/badge/badge.tsx +3 -3
  31. package/src/core/primitives/box/box.tsx +26 -26
  32. package/src/core/primitives/button/button.tsx +11 -11
  33. package/src/core/primitives/card/card.tsx +8 -8
  34. package/src/core/primitives/code/code.tsx +2 -2
  35. package/src/core/primitives/container/container.tsx +2 -2
  36. package/src/core/primitives/flex/flex.tsx +6 -6
  37. package/src/core/primitives/grid/grid.tsx +9 -9
  38. package/src/core/primitives/heading/heading.tsx +3 -3
  39. package/src/core/primitives/inline/inline.tsx +2 -2
  40. package/src/core/primitives/kbd/kbd.tsx +2 -2
  41. package/src/core/primitives/label/label.tsx +3 -3
  42. package/src/core/primitives/popover/floating-ui/size.ts +32 -16
  43. package/src/core/primitives/popover/popover.tsx +355 -328
  44. package/src/core/primitives/popover/popoverCard.tsx +123 -125
  45. package/src/core/primitives/select/select.tsx +6 -5
  46. package/src/core/primitives/stack/stack.tsx +2 -2
  47. package/src/core/primitives/text/text.tsx +3 -3
  48. package/src/core/primitives/textArea/textArea.tsx +6 -5
  49. package/src/core/primitives/textInput/textInput.tsx +6 -5
  50. package/src/core/primitives/tooltip/tooltip.tsx +73 -44
  51. package/src/core/primitives/tooltip/tooltipCard.tsx +83 -85
  52. package/src/core/utils/layer/layerProvider.tsx +3 -2
  53. package/src/core/utils/virtualList/virtualList.tsx +48 -23
@@ -5,10 +5,8 @@ import {ForwardRefExoticComponent} from 'react'
5
5
  import {HTMLAttributes} from 'react'
6
6
  import {HTMLProps} from 'react'
7
7
  import {IStyledComponentBase} from 'styled-components/dist/types'
8
- import {MutableRefObject} from 'react'
9
- import {NamedExoticComponent} from 'react'
8
+ import {Ref} from 'react'
10
9
  import {RefAttributes} from 'react'
11
- import {RefCallback} from 'react'
12
10
  import {RootTheme} from '@sanity/ui/theme'
13
11
  import {Theme_v2} from '@sanity/ui/theme'
14
12
  import {ThemeColorButtonModeKey} from '@sanity/ui/theme'
@@ -470,7 +468,7 @@ declare type Placement =
470
468
  *
471
469
  * @public
472
470
  */
473
- export declare const Popover: NamedExoticComponent<
471
+ export declare const Popover: ForwardRefExoticComponent<
474
472
  Omit<
475
473
  PopoverProps & Omit<HTMLProps<HTMLDivElement>, 'content' | 'width' | 'children' | 'as'>,
476
474
  'ref'
@@ -559,9 +557,7 @@ declare interface PopoverProps
559
557
  scheme?: ThemeColorSchemeKey
560
558
  tone?: CardTone
561
559
  /** @beta */
562
- updateRef?:
563
- | MutableRefObject<PopoverUpdateCallback | undefined>
564
- | RefCallback<PopoverUpdateCallback | undefined>
560
+ updateRef?: Ref<PopoverUpdateCallback | undefined>
565
561
  width?: PopoverWidth | PopoverWidth[]
566
562
  }
567
563
 
@@ -5,10 +5,8 @@ import {ForwardRefExoticComponent} from 'react'
5
5
  import {HTMLAttributes} from 'react'
6
6
  import {HTMLProps} from 'react'
7
7
  import {IStyledComponentBase} from 'styled-components/dist/types'
8
- import {MutableRefObject} from 'react'
9
- import {NamedExoticComponent} from 'react'
8
+ import {Ref} from 'react'
10
9
  import {RefAttributes} from 'react'
11
- import {RefCallback} from 'react'
12
10
  import {RootTheme} from '@sanity/ui/theme'
13
11
  import {Theme_v2} from '@sanity/ui/theme'
14
12
  import {ThemeColorButtonModeKey} from '@sanity/ui/theme'
@@ -470,7 +468,7 @@ declare type Placement =
470
468
  *
471
469
  * @public
472
470
  */
473
- export declare const Popover: NamedExoticComponent<
471
+ export declare const Popover: ForwardRefExoticComponent<
474
472
  Omit<
475
473
  PopoverProps & Omit<HTMLProps<HTMLDivElement>, 'content' | 'width' | 'children' | 'as'>,
476
474
  'ref'
@@ -559,9 +557,7 @@ declare interface PopoverProps
559
557
  scheme?: ThemeColorSchemeKey
560
558
  tone?: CardTone
561
559
  /** @beta */
562
- updateRef?:
563
- | MutableRefObject<PopoverUpdateCallback | undefined>
564
- | RefCallback<PopoverUpdateCallback | undefined>
560
+ updateRef?: Ref<PopoverUpdateCallback | undefined>
565
561
  width?: PopoverWidth | PopoverWidth[]
566
562
  }
567
563
 
package/dist/index.d.mts CHANGED
@@ -14,15 +14,12 @@ import {HTMLAttributes} from 'react'
14
14
  import {HTMLProps} from 'react'
15
15
  import {IStyledComponentBase} from 'styled-components/dist/types'
16
16
  import {multiply as multiply_2} from '@sanity/ui/theme'
17
- import {MutableRefObject} from 'react'
18
- import {NamedExoticComponent} from 'react'
19
17
  import {parseColor as parseColor_2} from '@sanity/ui/theme'
20
18
  import {PartialThemeColorBuilderOpts} from '@sanity/ui/theme'
21
19
  import {PropsWithChildren} from 'react'
22
20
  import {ReactNode} from 'react'
23
21
  import {Ref} from 'react'
24
22
  import {RefAttributes} from 'react'
25
- import {RefCallback} from 'react'
26
23
  import {RGB as RGB_2} from '@sanity/ui/theme'
27
24
  import {rgba as rgba_2} from '@sanity/ui/theme'
28
25
  import {rgbToHex as rgbToHex_2} from '@sanity/ui/theme'
@@ -1529,7 +1526,7 @@ export declare type Placement =
1529
1526
  *
1530
1527
  * @public
1531
1528
  */
1532
- export declare const Popover: NamedExoticComponent<
1529
+ export declare const Popover: ForwardRefExoticComponent<
1533
1530
  Omit<
1534
1531
  PopoverProps & Omit<HTMLProps<HTMLDivElement>, 'content' | 'width' | 'children' | 'as'>,
1535
1532
  'ref'
@@ -1618,9 +1615,7 @@ export declare interface PopoverProps
1618
1615
  scheme?: ThemeColorSchemeKey_2
1619
1616
  tone?: CardTone
1620
1617
  /** @beta */
1621
- updateRef?:
1622
- | MutableRefObject<PopoverUpdateCallback | undefined>
1623
- | RefCallback<PopoverUpdateCallback | undefined>
1618
+ updateRef?: Ref<PopoverUpdateCallback | undefined>
1624
1619
  width?: PopoverWidth | PopoverWidth[]
1625
1620
  }
1626
1621
 
@@ -2684,7 +2679,7 @@ export declare interface TooltipProps extends Omit<LayerProps, 'as'> {
2684
2679
  * This API might change. DO NOT USE IN PRODUCTION.
2685
2680
  * @beta
2686
2681
  */
2687
- export declare const Tree: NamedExoticComponent<
2682
+ export declare const Tree: ForwardRefExoticComponent<
2688
2683
  TreeProps &
2689
2684
  Omit<HTMLProps<HTMLDivElement>, 'height' | 'wrap' | 'ref' | 'role' | 'as' | 'align'> &
2690
2685
  RefAttributes<HTMLDivElement>
@@ -2709,9 +2704,13 @@ export declare interface TreeContextValue {
2709
2704
  * This API might change. DO NOT USE IN PRODUCTION.
2710
2705
  * @beta
2711
2706
  */
2712
- export declare const TreeItem: NamedExoticComponent<
2713
- TreeItemProps & Omit<HTMLProps<HTMLLIElement>, 'ref' | 'role' | 'as'>
2714
- >
2707
+ export declare function TreeItem(
2708
+ props: TreeItemProps & Omit<React.HTMLProps<HTMLLIElement>, 'as' | 'ref' | 'role'>,
2709
+ ): React.JSX.Element
2710
+
2711
+ export declare namespace TreeItem {
2712
+ var displayName: string
2713
+ }
2715
2714
 
2716
2715
  /**
2717
2716
  * @beta
@@ -2751,7 +2750,7 @@ export declare interface TreeState {
2751
2750
  }
2752
2751
 
2753
2752
  /**
2754
- * This API might change. DO NOT USE IN PRODUCTION.
2753
+ * @deprecated instead of `useArrayProp(width)` use `Array.isArray(width) ? width : [width]` instead
2755
2754
  * @beta
2756
2755
  */
2757
2756
  export declare function useArrayProp<T extends ArrayPropPrimitive = ArrayPropPrimitive>(
package/dist/index.d.ts CHANGED
@@ -14,15 +14,12 @@ import {HTMLAttributes} from 'react'
14
14
  import {HTMLProps} from 'react'
15
15
  import {IStyledComponentBase} from 'styled-components/dist/types'
16
16
  import {multiply as multiply_2} from '@sanity/ui/theme'
17
- import {MutableRefObject} from 'react'
18
- import {NamedExoticComponent} from 'react'
19
17
  import {parseColor as parseColor_2} from '@sanity/ui/theme'
20
18
  import {PartialThemeColorBuilderOpts} from '@sanity/ui/theme'
21
19
  import {PropsWithChildren} from 'react'
22
20
  import {ReactNode} from 'react'
23
21
  import {Ref} from 'react'
24
22
  import {RefAttributes} from 'react'
25
- import {RefCallback} from 'react'
26
23
  import {RGB as RGB_2} from '@sanity/ui/theme'
27
24
  import {rgba as rgba_2} from '@sanity/ui/theme'
28
25
  import {rgbToHex as rgbToHex_2} from '@sanity/ui/theme'
@@ -1529,7 +1526,7 @@ export declare type Placement =
1529
1526
  *
1530
1527
  * @public
1531
1528
  */
1532
- export declare const Popover: NamedExoticComponent<
1529
+ export declare const Popover: ForwardRefExoticComponent<
1533
1530
  Omit<
1534
1531
  PopoverProps & Omit<HTMLProps<HTMLDivElement>, 'content' | 'width' | 'children' | 'as'>,
1535
1532
  'ref'
@@ -1618,9 +1615,7 @@ export declare interface PopoverProps
1618
1615
  scheme?: ThemeColorSchemeKey_2
1619
1616
  tone?: CardTone
1620
1617
  /** @beta */
1621
- updateRef?:
1622
- | MutableRefObject<PopoverUpdateCallback | undefined>
1623
- | RefCallback<PopoverUpdateCallback | undefined>
1618
+ updateRef?: Ref<PopoverUpdateCallback | undefined>
1624
1619
  width?: PopoverWidth | PopoverWidth[]
1625
1620
  }
1626
1621
 
@@ -2684,7 +2679,7 @@ export declare interface TooltipProps extends Omit<LayerProps, 'as'> {
2684
2679
  * This API might change. DO NOT USE IN PRODUCTION.
2685
2680
  * @beta
2686
2681
  */
2687
- export declare const Tree: NamedExoticComponent<
2682
+ export declare const Tree: ForwardRefExoticComponent<
2688
2683
  TreeProps &
2689
2684
  Omit<HTMLProps<HTMLDivElement>, 'height' | 'wrap' | 'ref' | 'role' | 'as' | 'align'> &
2690
2685
  RefAttributes<HTMLDivElement>
@@ -2709,9 +2704,13 @@ export declare interface TreeContextValue {
2709
2704
  * This API might change. DO NOT USE IN PRODUCTION.
2710
2705
  * @beta
2711
2706
  */
2712
- export declare const TreeItem: NamedExoticComponent<
2713
- TreeItemProps & Omit<HTMLProps<HTMLLIElement>, 'ref' | 'role' | 'as'>
2714
- >
2707
+ export declare function TreeItem(
2708
+ props: TreeItemProps & Omit<React.HTMLProps<HTMLLIElement>, 'as' | 'ref' | 'role'>,
2709
+ ): React.JSX.Element
2710
+
2711
+ export declare namespace TreeItem {
2712
+ var displayName: string
2713
+ }
2715
2714
 
2716
2715
  /**
2717
2716
  * @beta
@@ -2751,7 +2750,7 @@ export declare interface TreeState {
2751
2750
  }
2752
2751
 
2753
2752
  /**
2754
- * This API might change. DO NOT USE IN PRODUCTION.
2753
+ * @deprecated instead of `useArrayProp(width)` use `Array.isArray(width) ? width : [width]` instead
2755
2754
  * @beta
2756
2755
  */
2757
2756
  export declare function useArrayProp<T extends ArrayPropPrimitive = ArrayPropPrimitive>(