@sanity/ui 2.6.7-canary.0 → 2.6.7
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.mts +15 -51
- package/dist/index.d.ts +15 -51
- package/dist/index.esm.js +186 -120
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +186 -119
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +186 -120
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +14 -14
- package/dist/theme.d.ts +14 -14
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs.map +1 -1
- package/package.json +53 -46
- package/src/core/__workshop__/constants.ts +36 -36
- package/src/core/components/autocomplete/autocomplete.tsx +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +6 -15
- package/src/core/components/dialog/dialog.tsx +21 -12
- package/src/core/components/dialog/styles.ts +8 -8
- package/src/core/components/menu/menu.tsx +18 -11
- package/src/core/components/menu/menuButton.tsx +11 -11
- package/src/core/components/menu/menuContext.ts +1 -1
- package/src/core/components/menu/useMenuController.ts +17 -11
- package/src/core/components/tab/tab.tsx +8 -8
- package/src/core/components/tab/tabPanel.tsx +1 -1
- package/src/core/components/toast/styles.ts +1 -2
- package/src/core/components/toast/useToast.ts +0 -1
- package/src/core/components/tree/tree.tsx +0 -1
- package/src/core/components/tree/treeItem.tsx +0 -1
- package/src/core/helpers/focus.ts +0 -1
- package/src/core/helpers/scroll.ts +0 -1
- package/src/core/hooks/_internal/index.ts +1 -0
- package/src/core/hooks/_internal/useUnique.ts +34 -0
- package/src/core/hooks/index.ts +2 -3
- package/src/core/hooks/useClickOutside.ts +72 -38
- package/src/core/hooks/useElementSize.ts +0 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +10 -2
- package/src/core/hooks/usePrefersDark.ts +55 -10
- package/src/core/hooks/usePrefersReducedMotion.ts +56 -10
- package/src/core/primitives/avatar/styles.ts +42 -42
- package/src/core/primitives/badge/styles.ts +2 -2
- package/src/core/primitives/button/styles.ts +4 -4
- package/src/core/primitives/inline/styles.ts +2 -2
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +7 -9
- package/src/core/primitives/popover/constants.ts +4 -4
- package/src/core/primitives/stack/styles.ts +2 -2
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +7 -9
- package/src/core/primitives/tooltip/constants.ts +4 -4
- package/src/core/primitives/tooltip/tooltip.tsx +49 -68
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -1
- package/src/core/styles/font/responsiveFont.ts +8 -8
- package/src/core/theme/__workshop__/debug/story.tsx +11 -11
- package/src/core/utils/layer/layerProvider.tsx +0 -1
- package/src/core/utils/portal/__workshop__/named.tsx +8 -10
- package/src/core/utils/portal/portalProvider.tsx +13 -7
- package/src/theme/build/buildColorTheme.test.ts +13 -13
- package/src/theme/config/tokens/color/types.ts +14 -14
- package/src/theme/defaults/colorTokens.ts +36 -36
- package/src/core/hooks/useMatchMedia.ts +0 -46
package/dist/index.d.mts
CHANGED
|
@@ -628,7 +628,7 @@ export declare interface CheckboxProps {
|
|
|
628
628
|
/**
|
|
629
629
|
* @public
|
|
630
630
|
*/
|
|
631
|
-
export declare type ClickOutsideListener = (event: MouseEvent
|
|
631
|
+
export declare type ClickOutsideListener = (event: MouseEvent) => void
|
|
632
632
|
|
|
633
633
|
/**
|
|
634
634
|
* @public
|
|
@@ -1432,7 +1432,7 @@ export declare interface MenuProps extends ResponsivePaddingProps {
|
|
|
1432
1432
|
* @deprecated Use `shouldFocus="last"` instead.
|
|
1433
1433
|
*/
|
|
1434
1434
|
focusLast?: boolean
|
|
1435
|
-
onClickOutside?: (event: MouseEvent
|
|
1435
|
+
onClickOutside?: (event: MouseEvent) => void
|
|
1436
1436
|
onEscape?: () => void
|
|
1437
1437
|
onItemClick?: () => void
|
|
1438
1438
|
onItemSelect?: (index: number) => void
|
|
@@ -2069,7 +2069,7 @@ export declare interface TabPanelProps extends BoxProps {
|
|
|
2069
2069
|
* The `id` of the correlating `Tab` component.
|
|
2070
2070
|
*/
|
|
2071
2071
|
'aria-labelledby': string
|
|
2072
|
-
|
|
2072
|
+
id: string
|
|
2073
2073
|
}
|
|
2074
2074
|
|
|
2075
2075
|
/**
|
|
@@ -2080,14 +2080,14 @@ export declare interface TabProps {
|
|
|
2080
2080
|
* The `id` of the correlating `TabPanel` component.
|
|
2081
2081
|
*/
|
|
2082
2082
|
'aria-controls': string
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2083
|
+
id: string
|
|
2084
|
+
icon?: React.ElementType | React.ReactNode
|
|
2085
|
+
focused?: boolean
|
|
2086
|
+
fontSize?: number | number[]
|
|
2087
|
+
label?: React.ReactNode
|
|
2088
|
+
padding?: number | number[]
|
|
2089
|
+
selected?: boolean
|
|
2090
|
+
tone?: ButtonTone
|
|
2091
2091
|
}
|
|
2092
2092
|
|
|
2093
2093
|
/**
|
|
@@ -2649,22 +2649,13 @@ export declare function useArrayProp<T extends ArrayPropPrimitive = ArrayPropPri
|
|
|
2649
2649
|
export declare function useBoundaryElement(): BoundaryElementContextValue
|
|
2650
2650
|
|
|
2651
2651
|
/**
|
|
2652
|
-
* Use the callback version of `elementsArg` if you're using `useRef` to handle elements:
|
|
2653
|
-
* ```tsx
|
|
2654
|
-
* useClickOutside(
|
|
2655
|
-
* () => {},
|
|
2656
|
-
* () => [ref.current],
|
|
2657
|
-
* )
|
|
2658
|
-
*
|
|
2659
2652
|
* @public
|
|
2660
2653
|
*/
|
|
2661
2654
|
export declare function useClickOutside(
|
|
2662
2655
|
listener: ClickOutsideListener,
|
|
2663
|
-
elementsArg?:
|
|
2664
|
-
| Array<HTMLElement | HTMLElement[] | null>
|
|
2665
|
-
| (() => Array<HTMLElement | HTMLElement[] | null>),
|
|
2656
|
+
elementsArg?: Array<HTMLElement | HTMLElement[] | null>,
|
|
2666
2657
|
boundaryElement?: HTMLElement | null,
|
|
2667
|
-
): void
|
|
2658
|
+
): (el: HTMLElement | null) => void
|
|
2668
2659
|
|
|
2669
2660
|
/**
|
|
2670
2661
|
* @beta
|
|
@@ -2722,18 +2713,6 @@ export declare function useGlobalKeyDown(onKeyDown: (event: KeyboardEvent) => vo
|
|
|
2722
2713
|
*/
|
|
2723
2714
|
export declare function useLayer(): LayerContextValue
|
|
2724
2715
|
|
|
2725
|
-
/**
|
|
2726
|
-
* Efficiently subscribes to `window.matchMedia` queries
|
|
2727
|
-
*
|
|
2728
|
-
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Required if the hook is called during SSR (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
2729
|
-
*
|
|
2730
|
-
* @public
|
|
2731
|
-
*/
|
|
2732
|
-
export declare function useMatchMedia(
|
|
2733
|
-
mediaQueryString: `(${string})`,
|
|
2734
|
-
getServerSnapshot?: () => boolean,
|
|
2735
|
-
): boolean
|
|
2736
|
-
|
|
2737
2716
|
/**
|
|
2738
2717
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
2739
2718
|
* @beta
|
|
@@ -2746,30 +2725,15 @@ export declare function useMediaIndex(): number
|
|
|
2746
2725
|
export declare function usePortal(): PortalContextValue
|
|
2747
2726
|
|
|
2748
2727
|
/**
|
|
2749
|
-
* Returns true if a dark color scheme is preferred, false if a light color scheme is preferred or the preference is not known.
|
|
2750
|
-
*
|
|
2751
|
-
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-color-scheme: light)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
2752
|
-
*
|
|
2753
|
-
* If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
|
|
2754
|
-
* Chrome supports reading the `prefers-color-scheme` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Color-Scheme
|
|
2755
|
-
* @example https://gist.github.com/stipsan/13c0cccf8dfc34f4b44bb1b984baf7df
|
|
2756
|
-
*
|
|
2757
2728
|
* @public
|
|
2758
2729
|
*/
|
|
2759
|
-
export declare function usePrefersDark(
|
|
2730
|
+
export declare function usePrefersDark(): boolean
|
|
2760
2731
|
|
|
2761
2732
|
/**
|
|
2762
2733
|
* Returns true if motion should be reduced
|
|
2763
|
-
*
|
|
2764
|
-
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-reduced-motion: no-preference)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
2765
|
-
*
|
|
2766
|
-
* If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
|
|
2767
|
-
* Chrome supports reading the `prefers-reduced-motion` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Reduced-Motion
|
|
2768
|
-
* @example https://gist.github.com/stipsan/0c0f839a27842249cada893e9fb7767b
|
|
2769
|
-
*
|
|
2770
2734
|
* @public
|
|
2771
2735
|
*/
|
|
2772
|
-
export declare function usePrefersReducedMotion(
|
|
2736
|
+
export declare function usePrefersReducedMotion(): boolean
|
|
2773
2737
|
|
|
2774
2738
|
/**
|
|
2775
2739
|
* @public
|
package/dist/index.d.ts
CHANGED
|
@@ -628,7 +628,7 @@ export declare interface CheckboxProps {
|
|
|
628
628
|
/**
|
|
629
629
|
* @public
|
|
630
630
|
*/
|
|
631
|
-
export declare type ClickOutsideListener = (event: MouseEvent
|
|
631
|
+
export declare type ClickOutsideListener = (event: MouseEvent) => void
|
|
632
632
|
|
|
633
633
|
/**
|
|
634
634
|
* @public
|
|
@@ -1432,7 +1432,7 @@ export declare interface MenuProps extends ResponsivePaddingProps {
|
|
|
1432
1432
|
* @deprecated Use `shouldFocus="last"` instead.
|
|
1433
1433
|
*/
|
|
1434
1434
|
focusLast?: boolean
|
|
1435
|
-
onClickOutside?: (event: MouseEvent
|
|
1435
|
+
onClickOutside?: (event: MouseEvent) => void
|
|
1436
1436
|
onEscape?: () => void
|
|
1437
1437
|
onItemClick?: () => void
|
|
1438
1438
|
onItemSelect?: (index: number) => void
|
|
@@ -2069,7 +2069,7 @@ export declare interface TabPanelProps extends BoxProps {
|
|
|
2069
2069
|
* The `id` of the correlating `Tab` component.
|
|
2070
2070
|
*/
|
|
2071
2071
|
'aria-labelledby': string
|
|
2072
|
-
|
|
2072
|
+
id: string
|
|
2073
2073
|
}
|
|
2074
2074
|
|
|
2075
2075
|
/**
|
|
@@ -2080,14 +2080,14 @@ export declare interface TabProps {
|
|
|
2080
2080
|
* The `id` of the correlating `TabPanel` component.
|
|
2081
2081
|
*/
|
|
2082
2082
|
'aria-controls': string
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2083
|
+
id: string
|
|
2084
|
+
icon?: React.ElementType | React.ReactNode
|
|
2085
|
+
focused?: boolean
|
|
2086
|
+
fontSize?: number | number[]
|
|
2087
|
+
label?: React.ReactNode
|
|
2088
|
+
padding?: number | number[]
|
|
2089
|
+
selected?: boolean
|
|
2090
|
+
tone?: ButtonTone
|
|
2091
2091
|
}
|
|
2092
2092
|
|
|
2093
2093
|
/**
|
|
@@ -2649,22 +2649,13 @@ export declare function useArrayProp<T extends ArrayPropPrimitive = ArrayPropPri
|
|
|
2649
2649
|
export declare function useBoundaryElement(): BoundaryElementContextValue
|
|
2650
2650
|
|
|
2651
2651
|
/**
|
|
2652
|
-
* Use the callback version of `elementsArg` if you're using `useRef` to handle elements:
|
|
2653
|
-
* ```tsx
|
|
2654
|
-
* useClickOutside(
|
|
2655
|
-
* () => {},
|
|
2656
|
-
* () => [ref.current],
|
|
2657
|
-
* )
|
|
2658
|
-
*
|
|
2659
2652
|
* @public
|
|
2660
2653
|
*/
|
|
2661
2654
|
export declare function useClickOutside(
|
|
2662
2655
|
listener: ClickOutsideListener,
|
|
2663
|
-
elementsArg?:
|
|
2664
|
-
| Array<HTMLElement | HTMLElement[] | null>
|
|
2665
|
-
| (() => Array<HTMLElement | HTMLElement[] | null>),
|
|
2656
|
+
elementsArg?: Array<HTMLElement | HTMLElement[] | null>,
|
|
2666
2657
|
boundaryElement?: HTMLElement | null,
|
|
2667
|
-
): void
|
|
2658
|
+
): (el: HTMLElement | null) => void
|
|
2668
2659
|
|
|
2669
2660
|
/**
|
|
2670
2661
|
* @beta
|
|
@@ -2722,18 +2713,6 @@ export declare function useGlobalKeyDown(onKeyDown: (event: KeyboardEvent) => vo
|
|
|
2722
2713
|
*/
|
|
2723
2714
|
export declare function useLayer(): LayerContextValue
|
|
2724
2715
|
|
|
2725
|
-
/**
|
|
2726
|
-
* Efficiently subscribes to `window.matchMedia` queries
|
|
2727
|
-
*
|
|
2728
|
-
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Required if the hook is called during SSR (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
2729
|
-
*
|
|
2730
|
-
* @public
|
|
2731
|
-
*/
|
|
2732
|
-
export declare function useMatchMedia(
|
|
2733
|
-
mediaQueryString: `(${string})`,
|
|
2734
|
-
getServerSnapshot?: () => boolean,
|
|
2735
|
-
): boolean
|
|
2736
|
-
|
|
2737
2716
|
/**
|
|
2738
2717
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
2739
2718
|
* @beta
|
|
@@ -2746,30 +2725,15 @@ export declare function useMediaIndex(): number
|
|
|
2746
2725
|
export declare function usePortal(): PortalContextValue
|
|
2747
2726
|
|
|
2748
2727
|
/**
|
|
2749
|
-
* Returns true if a dark color scheme is preferred, false if a light color scheme is preferred or the preference is not known.
|
|
2750
|
-
*
|
|
2751
|
-
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-color-scheme: light)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
2752
|
-
*
|
|
2753
|
-
* If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
|
|
2754
|
-
* Chrome supports reading the `prefers-color-scheme` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Color-Scheme
|
|
2755
|
-
* @example https://gist.github.com/stipsan/13c0cccf8dfc34f4b44bb1b984baf7df
|
|
2756
|
-
*
|
|
2757
2728
|
* @public
|
|
2758
2729
|
*/
|
|
2759
|
-
export declare function usePrefersDark(
|
|
2730
|
+
export declare function usePrefersDark(): boolean
|
|
2760
2731
|
|
|
2761
2732
|
/**
|
|
2762
2733
|
* Returns true if motion should be reduced
|
|
2763
|
-
*
|
|
2764
|
-
* @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-reduced-motion: no-preference)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
|
|
2765
|
-
*
|
|
2766
|
-
* If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
|
|
2767
|
-
* Chrome supports reading the `prefers-reduced-motion` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Reduced-Motion
|
|
2768
|
-
* @example https://gist.github.com/stipsan/0c0f839a27842249cada893e9fb7767b
|
|
2769
|
-
*
|
|
2770
2734
|
* @public
|
|
2771
2735
|
*/
|
|
2772
|
-
export declare function usePrefersReducedMotion(
|
|
2736
|
+
export declare function usePrefersReducedMotion(): boolean
|
|
2773
2737
|
|
|
2774
2738
|
/**
|
|
2775
2739
|
* @public
|