@salt-ds/core 1.8.2 → 1.9.0
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-cjs/accordion/Accordion.js +1 -1
- package/dist-cjs/accordion/AccordionContext.js +1 -1
- package/dist-cjs/accordion/AccordionGroup.js +1 -1
- package/dist-cjs/accordion/AccordionGroup.js.map +1 -1
- package/dist-cjs/accordion/AccordionHeader.js +1 -1
- package/dist-cjs/accordion/AccordionHeader.js.map +1 -1
- package/dist-cjs/accordion/AccordionPanel.js +1 -1
- package/dist-cjs/accordion/AccordionPanel.js.map +1 -1
- package/dist-cjs/aria-announcer/useAriaAnnouncer.js +1 -1
- package/dist-cjs/avatar/Avatar.js +1 -1
- package/dist-cjs/avatar/useAvatarImage.js +1 -1
- package/dist-cjs/banner/Banner.js +1 -1
- package/dist-cjs/banner/BannerActions.js +17 -15
- package/dist-cjs/banner/BannerActions.js.map +1 -1
- package/dist-cjs/banner/BannerContent.js +17 -15
- package/dist-cjs/banner/BannerContent.js.map +1 -1
- package/dist-cjs/border-item/BorderItem.js +1 -1
- package/dist-cjs/border-item/BorderItem.js.map +1 -1
- package/dist-cjs/border-layout/BorderLayout.js +1 -1
- package/dist-cjs/button/Button.css.js +1 -1
- package/dist-cjs/button/Button.js +1 -1
- package/dist-cjs/button/Button.js.map +1 -1
- package/dist-cjs/card/Card.js +1 -1
- package/dist-cjs/card/InteractableCard.js +1 -1
- package/dist-cjs/checkbox/Checkbox.js +1 -1
- package/dist-cjs/checkbox/CheckboxGroup.js +1 -1
- package/dist-cjs/checkbox/CheckboxIcon.js +1 -1
- package/dist-cjs/flex-item/FlexItem.js +1 -1
- package/dist-cjs/flex-item/FlexItem.js.map +1 -1
- package/dist-cjs/flex-layout/FlexLayout.js +1 -1
- package/dist-cjs/flex-layout/FlexLayout.js.map +1 -1
- package/dist-cjs/form-field/FormField.css.js +1 -1
- package/dist-cjs/form-field/FormField.js +1 -1
- package/dist-cjs/form-field/FormFieldHelperText.js +1 -1
- package/dist-cjs/form-field/FormFieldLabel.js +1 -1
- package/dist-cjs/form-field-context/FormFieldContext.js +1 -1
- package/dist-cjs/grid-item/GridItem.js +1 -1
- package/dist-cjs/grid-item/GridItem.js.map +1 -1
- package/dist-cjs/grid-layout/GridLayout.js +1 -1
- package/dist-cjs/index.js +5 -1
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/input/Input.js +1 -1
- package/dist-cjs/link/Link.js +1 -1
- package/dist-cjs/multiline-input/MultilineInput.js +1 -1
- package/dist-cjs/panel/Panel.js +1 -1
- package/dist-cjs/radio-button/RadioButton.js +1 -1
- package/dist-cjs/radio-button/RadioButtonGroup.js +1 -1
- package/dist-cjs/radio-button/RadioButtonIcon.js +1 -1
- package/dist-cjs/radio-button/internal/RadioGroupContext.js +1 -1
- package/dist-cjs/salt-provider/SaltProvider.js +1 -1
- package/dist-cjs/spinner/Spinner.js +1 -1
- package/dist-cjs/spinner/Spinner.js.map +1 -1
- package/dist-cjs/spinner/svgSpinners/SpinnerSVG.js +1 -1
- package/dist-cjs/stack-layout/StackLayout.js +1 -1
- package/dist-cjs/status-adornment/StatusAdornment.js +1 -1
- package/dist-cjs/status-indicator/StatusIndicator.js +1 -1
- package/dist-cjs/status-indicator/ValidationStatus.js.map +1 -1
- package/dist-cjs/text/Display.js +1 -1
- package/dist-cjs/text/Text.js +1 -1
- package/dist-cjs/theme/Density.js.map +1 -1
- package/dist-cjs/theme/Mode.js.map +1 -1
- package/dist-cjs/toast/Toast.js +1 -1
- package/dist-cjs/toast/ToastContent.js +1 -1
- package/dist-cjs/toast/ToastContent.js.map +1 -1
- package/dist-cjs/toggle-button/ToggleButton.js +1 -1
- package/dist-cjs/toggle-button-group/ToggleButtonGroup.js +1 -1
- package/dist-cjs/toggle-button-group/ToggleButtonGroupContext.js +1 -1
- package/dist-cjs/tooltip/Tooltip.js +19 -53
- package/dist-cjs/tooltip/Tooltip.js.map +1 -1
- package/dist-cjs/tooltip/TooltipBase.js +62 -0
- package/dist-cjs/tooltip/TooltipBase.js.map +1 -0
- package/dist-cjs/tooltip/useAriaAnnounce.js +1 -1
- package/dist-cjs/tooltip/useTooltip.js +16 -9
- package/dist-cjs/tooltip/useTooltip.js.map +1 -1
- package/dist-cjs/utils/useFloatingUI/useFloatingUI.js +124 -0
- package/dist-cjs/utils/useFloatingUI/useFloatingUI.js.map +1 -0
- package/dist-cjs/viewport/ViewportProvider.js +1 -1
- package/dist-es/accordion/Accordion.js +1 -1
- package/dist-es/accordion/AccordionContext.js +1 -1
- package/dist-es/accordion/AccordionGroup.js +1 -1
- package/dist-es/accordion/AccordionGroup.js.map +1 -1
- package/dist-es/accordion/AccordionHeader.js +1 -1
- package/dist-es/accordion/AccordionHeader.js.map +1 -1
- package/dist-es/accordion/AccordionPanel.js +1 -1
- package/dist-es/accordion/AccordionPanel.js.map +1 -1
- package/dist-es/aria-announcer/useAriaAnnouncer.js +1 -1
- package/dist-es/avatar/Avatar.js +1 -1
- package/dist-es/avatar/useAvatarImage.js +1 -1
- package/dist-es/banner/Banner.js +1 -1
- package/dist-es/banner/BannerActions.js +17 -15
- package/dist-es/banner/BannerActions.js.map +1 -1
- package/dist-es/banner/BannerContent.js +17 -15
- package/dist-es/banner/BannerContent.js.map +1 -1
- package/dist-es/border-item/BorderItem.js +1 -1
- package/dist-es/border-item/BorderItem.js.map +1 -1
- package/dist-es/border-layout/BorderLayout.js +1 -1
- package/dist-es/button/Button.css.js +1 -1
- package/dist-es/button/Button.js +1 -1
- package/dist-es/button/Button.js.map +1 -1
- package/dist-es/card/Card.js +1 -1
- package/dist-es/card/InteractableCard.js +1 -1
- package/dist-es/checkbox/Checkbox.js +1 -1
- package/dist-es/checkbox/CheckboxGroup.js +1 -1
- package/dist-es/checkbox/CheckboxIcon.js +1 -1
- package/dist-es/flex-item/FlexItem.js +1 -1
- package/dist-es/flex-item/FlexItem.js.map +1 -1
- package/dist-es/flex-layout/FlexLayout.js +1 -1
- package/dist-es/flex-layout/FlexLayout.js.map +1 -1
- package/dist-es/form-field/FormField.css.js +1 -1
- package/dist-es/form-field/FormField.js +1 -1
- package/dist-es/form-field/FormFieldHelperText.js +1 -1
- package/dist-es/form-field/FormFieldLabel.js +1 -1
- package/dist-es/form-field-context/FormFieldContext.js +1 -1
- package/dist-es/grid-item/GridItem.js +1 -1
- package/dist-es/grid-item/GridItem.js.map +1 -1
- package/dist-es/grid-layout/GridLayout.js +1 -1
- package/dist-es/index.js +1 -1
- package/dist-es/input/Input.js +1 -1
- package/dist-es/link/Link.js +1 -1
- package/dist-es/multiline-input/MultilineInput.js +1 -1
- package/dist-es/panel/Panel.js +1 -1
- package/dist-es/radio-button/RadioButton.js +1 -1
- package/dist-es/radio-button/RadioButtonGroup.js +1 -1
- package/dist-es/radio-button/RadioButtonIcon.js +1 -1
- package/dist-es/radio-button/internal/RadioGroupContext.js +1 -1
- package/dist-es/salt-provider/SaltProvider.js +1 -1
- package/dist-es/spinner/Spinner.js +1 -1
- package/dist-es/spinner/Spinner.js.map +1 -1
- package/dist-es/spinner/svgSpinners/SpinnerSVG.js +1 -1
- package/dist-es/stack-layout/StackLayout.js +1 -1
- package/dist-es/status-adornment/StatusAdornment.js +1 -1
- package/dist-es/status-indicator/StatusIndicator.js +1 -1
- package/dist-es/status-indicator/ValidationStatus.js.map +1 -1
- package/dist-es/text/Display.js +1 -1
- package/dist-es/text/Text.js +1 -1
- package/dist-es/theme/Density.js.map +1 -1
- package/dist-es/theme/Mode.js.map +1 -1
- package/dist-es/toast/Toast.js +1 -1
- package/dist-es/toast/ToastContent.js +1 -1
- package/dist-es/toast/ToastContent.js.map +1 -1
- package/dist-es/toggle-button/ToggleButton.js +1 -1
- package/dist-es/toggle-button-group/ToggleButtonGroup.js +1 -1
- package/dist-es/toggle-button-group/ToggleButtonGroupContext.js +1 -1
- package/dist-es/tooltip/Tooltip.js +19 -53
- package/dist-es/tooltip/Tooltip.js.map +1 -1
- package/dist-es/tooltip/TooltipBase.js +58 -0
- package/dist-es/tooltip/TooltipBase.js.map +1 -0
- package/dist-es/tooltip/useAriaAnnounce.js +1 -1
- package/dist-es/tooltip/useTooltip.js +16 -9
- package/dist-es/tooltip/useTooltip.js.map +1 -1
- package/dist-es/utils/useFloatingUI/useFloatingUI.js +115 -0
- package/dist-es/utils/useFloatingUI/useFloatingUI.js.map +1 -0
- package/dist-es/viewport/ViewportProvider.js +1 -1
- package/dist-types/accordion/AccordionGroup.d.ts +8 -3
- package/dist-types/accordion/AccordionHeader.d.ts +8 -3
- package/dist-types/accordion/AccordionPanel.d.ts +8 -3
- package/dist-types/aria-announcer/AriaAnnouncerContext.d.ts +0 -1
- package/dist-types/banner/BannerActions.d.ts +9 -2
- package/dist-types/banner/BannerContent.d.ts +9 -2
- package/dist-types/border-item/BorderItem.d.ts +1 -1
- package/dist-types/button/Button.d.ts +1 -1
- package/dist-types/checkbox/CheckboxIcon.d.ts +0 -1
- package/dist-types/checkbox/internal/CheckboxGroupContext.d.ts +0 -1
- package/dist-types/flex-item/FlexItem.d.ts +1 -1
- package/dist-types/flex-layout/FlexLayout.d.ts +2 -2
- package/dist-types/form-field/FormFieldHelperText.d.ts +0 -1
- package/dist-types/form-field/FormFieldLabel.d.ts +0 -1
- package/dist-types/form-field-context/FormFieldContext.d.ts +0 -1
- package/dist-types/grid-item/GridItem.d.ts +1 -1
- package/dist-types/spinner/Spinner.d.ts +1 -1
- package/dist-types/status-adornment/ErrorAdornment.d.ts +0 -1
- package/dist-types/status-adornment/StatusAdornment.d.ts +0 -1
- package/dist-types/status-adornment/SuccessAdornment.d.ts +0 -1
- package/dist-types/status-adornment/WarningAdornment.d.ts +0 -1
- package/dist-types/status-indicator/StatusIndicator.d.ts +0 -1
- package/dist-types/status-indicator/ValidationStatus.d.ts +1 -1
- package/dist-types/text/Display.d.ts +0 -1
- package/dist-types/text/Headings.d.ts +0 -1
- package/dist-types/text/Label.d.ts +0 -1
- package/dist-types/theme/Density.d.ts +1 -1
- package/dist-types/theme/Mode.d.ts +1 -1
- package/dist-types/toast/ToastContent.d.ts +8 -2
- package/dist-types/tooltip/TooltipBase.d.ts +12 -0
- package/dist-types/tooltip/useTooltip.d.ts +12 -5
- package/dist-types/utils/useFloatingUI/index.d.ts +1 -0
- package/dist-types/utils/useFloatingUI/useFloatingUI.d.ts +77 -0
- package/package.json +1 -1
- package/dist-cjs/utils/useFloatingUI.js +0 -38
- package/dist-cjs/utils/useFloatingUI.js.map +0 -1
- package/dist-es/utils/useFloatingUI.js +0 -33
- package/dist-es/utils/useFloatingUI.js.map +0 -1
- package/dist-types/utils/useFloatingUI.d.ts +0 -34
|
@@ -6,7 +6,7 @@ import { HTMLAttributes } from "react";
|
|
|
6
6
|
* <Spinner size="default | large" />
|
|
7
7
|
*/
|
|
8
8
|
export declare const SpinnerSizeValues: readonly ["default", "large"];
|
|
9
|
-
export declare type SpinnerSize = typeof SpinnerSizeValues[number];
|
|
9
|
+
export declare type SpinnerSize = (typeof SpinnerSizeValues)[number];
|
|
10
10
|
export interface SpinnerProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
11
|
/**
|
|
12
12
|
* Determines the interval on which the component will continue to announce the aria-label. Defaults to 5000ms (5s)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { IconProps } from "@salt-ds/icons";
|
|
3
2
|
export declare type ErrorAdornmentIconProps = IconProps;
|
|
4
3
|
export declare const ErrorAdornmentIcon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { IconProps } from "@salt-ds/icons";
|
|
3
2
|
export declare type SuccessAdornmentIconProps = IconProps;
|
|
4
3
|
export declare const SuccessAdornmentIcon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { IconProps } from "@salt-ds/icons";
|
|
3
2
|
export declare type WarningAdornmentIconProps = IconProps;
|
|
4
3
|
export declare const WarningAdornmentIcon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const VALIDATION_NAMED_STATUS: readonly ["error", "warning", "success", "info"];
|
|
2
|
-
export declare type ValidationStatus = typeof VALIDATION_NAMED_STATUS[number];
|
|
2
|
+
export declare type ValidationStatus = (typeof VALIDATION_NAMED_STATUS)[number];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { TextProps } from "./Text";
|
|
3
2
|
export declare const Display1: import("react").ForwardRefExoticComponent<Omit<Omit<TextProps<"span">, "as">, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
4
3
|
export declare const Display2: import("react").ForwardRefExoticComponent<Omit<Omit<TextProps<"span">, "as">, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { TextProps } from "./Text";
|
|
3
2
|
export declare const H1: import("react").ForwardRefExoticComponent<Omit<Omit<TextProps<"h1">, "as">, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
4
3
|
export declare const H2: import("react").ForwardRefExoticComponent<Omit<Omit<TextProps<"h2">, "as">, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const DensityValues: readonly ["high", "medium", "low", "touch"];
|
|
2
|
-
export declare type Density = typeof DensityValues[number];
|
|
2
|
+
export declare type Density = (typeof DensityValues)[number];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const ModeValues: readonly ["light", "dark"];
|
|
2
|
-
export declare type Mode = typeof ModeValues[number];
|
|
2
|
+
export declare type Mode = (typeof ModeValues)[number];
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
export interface ToastContentProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
|
+
/**
|
|
4
|
+
* The content of Toast Content
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const ToastContent: import("react").ForwardRefExoticComponent<ToastContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValidationStatus } from "../status-indicator";
|
|
2
|
+
import { FloatingArrowProps } from "@floating-ui/react";
|
|
3
|
+
import { TooltipProps } from "./Tooltip";
|
|
4
|
+
interface TooltipBaseProps extends Omit<TooltipProps, "children"> {
|
|
5
|
+
arrowProps: FloatingArrowProps;
|
|
6
|
+
/**
|
|
7
|
+
* A string to determine the status of the Tooltip. Defaults to `info`.
|
|
8
|
+
*/
|
|
9
|
+
status: ValidationStatus;
|
|
10
|
+
}
|
|
11
|
+
export declare const TooltipBase: (props: TooltipBaseProps) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -26,12 +26,12 @@ export declare function useTooltip(props?: UseTooltipProps): {
|
|
|
26
26
|
context: {
|
|
27
27
|
x: number | null;
|
|
28
28
|
y: number | null;
|
|
29
|
-
placement: import("@floating-ui/
|
|
30
|
-
strategy: import("@floating-ui/
|
|
31
|
-
middlewareData: import("@floating-ui/
|
|
32
|
-
update: () => void;
|
|
29
|
+
placement: import("@floating-ui/utils").Placement;
|
|
30
|
+
strategy: import("@floating-ui/utils").Strategy;
|
|
31
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
33
32
|
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
34
33
|
floating: (node: HTMLElement | null) => void;
|
|
34
|
+
update: () => void;
|
|
35
35
|
isPositioned: boolean;
|
|
36
36
|
open: boolean;
|
|
37
37
|
onOpenChange: (open: boolean) => void;
|
|
@@ -43,7 +43,7 @@ export declare function useTooltip(props?: UseTooltipProps): {
|
|
|
43
43
|
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
44
44
|
};
|
|
45
45
|
style: {
|
|
46
|
-
position: import("@floating-ui/
|
|
46
|
+
position: import("@floating-ui/utils").Strategy;
|
|
47
47
|
left: number;
|
|
48
48
|
top: number;
|
|
49
49
|
};
|
|
@@ -53,4 +53,11 @@ export declare function useTooltip(props?: UseTooltipProps): {
|
|
|
53
53
|
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
54
54
|
getTooltipProps: () => HTMLProps<HTMLDivElement>;
|
|
55
55
|
getTriggerProps: () => Record<string, unknown>;
|
|
56
|
+
getTooltipPosition: () => {
|
|
57
|
+
top: number;
|
|
58
|
+
left: number;
|
|
59
|
+
position: import("@floating-ui/utils").Strategy;
|
|
60
|
+
width: number | undefined;
|
|
61
|
+
height: number | undefined;
|
|
62
|
+
};
|
|
56
63
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useFloatingUI";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Middleware, Placement, Platform, Strategy, useFloating } from "@floating-ui/react";
|
|
2
|
+
import { ReactNode, PropsWithChildren, ForwardRefExoticComponent } from "react";
|
|
3
|
+
declare type CombinedFloatingComponentProps = PropsWithChildren<FloatingComponentProps>;
|
|
4
|
+
export interface FloatingComponentProps {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the floating component is open (used for determinig whether to show the component)
|
|
7
|
+
* We pass this as a prop rather than not rendering the component to allow more advanced use-cases e.g.
|
|
8
|
+
* for caching windows and reusing them, rather than always spawning a new one
|
|
9
|
+
*/
|
|
10
|
+
open: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Position props for the floating component
|
|
13
|
+
*/
|
|
14
|
+
top: number;
|
|
15
|
+
left: number;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
position: Strategy;
|
|
19
|
+
}
|
|
20
|
+
export interface FloatingComponentContextType {
|
|
21
|
+
Component: ForwardRefExoticComponent<CombinedFloatingComponentProps>;
|
|
22
|
+
}
|
|
23
|
+
export interface FloatingComponentProviderProps extends FloatingComponentContextType {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export declare function FloatingComponentProvider(props: FloatingComponentProviderProps): JSX.Element;
|
|
27
|
+
export declare function useFloatingComponent(): FloatingComponentContextType;
|
|
28
|
+
export interface UseFloatingUIProps {
|
|
29
|
+
/**
|
|
30
|
+
* Sets position relative to trigger.
|
|
31
|
+
*/
|
|
32
|
+
placement?: Placement;
|
|
33
|
+
strategy?: Strategy;
|
|
34
|
+
/**
|
|
35
|
+
* Function to update the default middleware used to extend or replace it
|
|
36
|
+
*/
|
|
37
|
+
middleware?: Middleware[];
|
|
38
|
+
/**
|
|
39
|
+
* Sets visible state.
|
|
40
|
+
*/
|
|
41
|
+
open?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Callback function triggered when open state changes.
|
|
44
|
+
*/
|
|
45
|
+
onOpenChange?: (open: boolean) => void;
|
|
46
|
+
}
|
|
47
|
+
declare type GetMiddleware = (middleware: Middleware[]) => Middleware[];
|
|
48
|
+
interface FloatingPlatformContextType {
|
|
49
|
+
platform: Platform;
|
|
50
|
+
middleware: GetMiddleware;
|
|
51
|
+
animationFrame: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface FloatingPlatformProviderProps {
|
|
54
|
+
platform?: Platform;
|
|
55
|
+
middleware?: GetMiddleware;
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
animationFrame?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare function FloatingPlatformProvider(props: FloatingPlatformProviderProps): JSX.Element;
|
|
60
|
+
export declare function useFloatingPlatform(): FloatingPlatformContextType;
|
|
61
|
+
export declare const DEFAULT_FLOATING_UI_MIDDLEWARE: {
|
|
62
|
+
name: string;
|
|
63
|
+
options?: any;
|
|
64
|
+
fn: (state: {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
initialPlacement: Placement;
|
|
68
|
+
placement: Placement;
|
|
69
|
+
strategy: Strategy;
|
|
70
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
71
|
+
rects: import("@floating-ui/utils").ElementRects;
|
|
72
|
+
platform: import("@floating-ui/core").Platform;
|
|
73
|
+
elements: import("@floating-ui/dom").Elements;
|
|
74
|
+
}) => import("@floating-ui/core").MiddlewareReturn | Promise<import("@floating-ui/core").MiddlewareReturn>;
|
|
75
|
+
}[];
|
|
76
|
+
export declare function useFloatingUI(props: UseFloatingUIProps): ReturnType<typeof useFloating>;
|
|
77
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var react = require('@floating-ui/react');
|
|
6
|
-
|
|
7
|
-
const DEFAULT_FLOATING_UI_MIDDLEWARE = [
|
|
8
|
-
react.flip(),
|
|
9
|
-
react.shift({ limiter: react.limitShift() })
|
|
10
|
-
];
|
|
11
|
-
function useFloatingUI(props) {
|
|
12
|
-
const {
|
|
13
|
-
placement,
|
|
14
|
-
strategy,
|
|
15
|
-
middleware = DEFAULT_FLOATING_UI_MIDDLEWARE,
|
|
16
|
-
open = false,
|
|
17
|
-
onOpenChange
|
|
18
|
-
} = props;
|
|
19
|
-
const { reference, floating, refs, update, ...rest } = react.useFloating({
|
|
20
|
-
placement,
|
|
21
|
-
strategy,
|
|
22
|
-
middleware,
|
|
23
|
-
open,
|
|
24
|
-
onOpenChange,
|
|
25
|
-
whileElementsMounted: react.autoUpdate
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
reference,
|
|
29
|
-
floating,
|
|
30
|
-
refs,
|
|
31
|
-
update,
|
|
32
|
-
...rest
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
exports.DEFAULT_FLOATING_UI_MIDDLEWARE = DEFAULT_FLOATING_UI_MIDDLEWARE;
|
|
37
|
-
exports.useFloatingUI = useFloatingUI;
|
|
38
|
-
//# sourceMappingURL=useFloatingUI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingUI.js","sources":["../src/utils/useFloatingUI.tsx"],"sourcesContent":["import type { Middleware, Placement, Strategy } from \"@floating-ui/react\";\nimport {\n autoUpdate,\n flip,\n limitShift,\n shift,\n useFloating,\n} from \"@floating-ui/react\";\n\nexport type UseFloatingUIProps = {\n /**\n * Sets position relative to trigger.\n */\n placement?: Placement;\n strategy?: Strategy;\n middleware?: Middleware[];\n /**\n * Sets visible state.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n};\n\nexport const DEFAULT_FLOATING_UI_MIDDLEWARE = [\n flip(),\n shift({ limiter: limitShift() }),\n];\n\nexport function useFloatingUI(\n props: UseFloatingUIProps\n): ReturnType<typeof useFloating> {\n const {\n placement,\n strategy,\n middleware = DEFAULT_FLOATING_UI_MIDDLEWARE,\n open = false,\n onOpenChange,\n } = props;\n\n const { reference, floating, refs, update, ...rest } = useFloating({\n placement,\n strategy,\n middleware,\n open,\n onOpenChange,\n whileElementsMounted: autoUpdate,\n });\n\n return {\n reference,\n floating,\n refs,\n update,\n ...rest,\n };\n}\n"],"names":["flip","shift","limitShift","useFloating","autoUpdate"],"mappings":";;;;;;AA0BO,MAAM,8BAAiC,GAAA;AAAA,EAC5CA,UAAK,EAAA;AAAA,EACLC,WAAM,CAAA,EAAE,OAAS,EAAAC,gBAAA,IAAc,CAAA;AACjC,EAAA;AAEO,SAAS,cACd,KACgC,EAAA;AAChC,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAa,GAAA,8BAAA;AAAA,IACb,IAAO,GAAA,KAAA;AAAA,IACP,YAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,EAAE,SAAW,EAAA,QAAA,EAAU,MAAM,MAAW,EAAA,GAAA,IAAA,KAASC,iBAAY,CAAA;AAAA,IACjE,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAA;AAAA,IACA,oBAAsB,EAAAC,gBAAA;AAAA,GACvB,CAAA,CAAA;AAED,EAAO,OAAA;AAAA,IACL,SAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAG,IAAA;AAAA,GACL,CAAA;AACF;;;;;"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { flip, shift, limitShift, useFloating, autoUpdate } from '@floating-ui/react';
|
|
2
|
-
|
|
3
|
-
const DEFAULT_FLOATING_UI_MIDDLEWARE = [
|
|
4
|
-
flip(),
|
|
5
|
-
shift({ limiter: limitShift() })
|
|
6
|
-
];
|
|
7
|
-
function useFloatingUI(props) {
|
|
8
|
-
const {
|
|
9
|
-
placement,
|
|
10
|
-
strategy,
|
|
11
|
-
middleware = DEFAULT_FLOATING_UI_MIDDLEWARE,
|
|
12
|
-
open = false,
|
|
13
|
-
onOpenChange
|
|
14
|
-
} = props;
|
|
15
|
-
const { reference, floating, refs, update, ...rest } = useFloating({
|
|
16
|
-
placement,
|
|
17
|
-
strategy,
|
|
18
|
-
middleware,
|
|
19
|
-
open,
|
|
20
|
-
onOpenChange,
|
|
21
|
-
whileElementsMounted: autoUpdate
|
|
22
|
-
});
|
|
23
|
-
return {
|
|
24
|
-
reference,
|
|
25
|
-
floating,
|
|
26
|
-
refs,
|
|
27
|
-
update,
|
|
28
|
-
...rest
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { DEFAULT_FLOATING_UI_MIDDLEWARE, useFloatingUI };
|
|
33
|
-
//# sourceMappingURL=useFloatingUI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingUI.js","sources":["../src/utils/useFloatingUI.tsx"],"sourcesContent":["import type { Middleware, Placement, Strategy } from \"@floating-ui/react\";\nimport {\n autoUpdate,\n flip,\n limitShift,\n shift,\n useFloating,\n} from \"@floating-ui/react\";\n\nexport type UseFloatingUIProps = {\n /**\n * Sets position relative to trigger.\n */\n placement?: Placement;\n strategy?: Strategy;\n middleware?: Middleware[];\n /**\n * Sets visible state.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n};\n\nexport const DEFAULT_FLOATING_UI_MIDDLEWARE = [\n flip(),\n shift({ limiter: limitShift() }),\n];\n\nexport function useFloatingUI(\n props: UseFloatingUIProps\n): ReturnType<typeof useFloating> {\n const {\n placement,\n strategy,\n middleware = DEFAULT_FLOATING_UI_MIDDLEWARE,\n open = false,\n onOpenChange,\n } = props;\n\n const { reference, floating, refs, update, ...rest } = useFloating({\n placement,\n strategy,\n middleware,\n open,\n onOpenChange,\n whileElementsMounted: autoUpdate,\n });\n\n return {\n reference,\n floating,\n refs,\n update,\n ...rest,\n };\n}\n"],"names":[],"mappings":";;AA0BO,MAAM,8BAAiC,GAAA;AAAA,EAC5C,IAAK,EAAA;AAAA,EACL,KAAM,CAAA,EAAE,OAAS,EAAA,UAAA,IAAc,CAAA;AACjC,EAAA;AAEO,SAAS,cACd,KACgC,EAAA;AAChC,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAa,GAAA,8BAAA;AAAA,IACb,IAAO,GAAA,KAAA;AAAA,IACP,YAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,EAAE,SAAW,EAAA,QAAA,EAAU,MAAM,MAAW,EAAA,GAAA,IAAA,KAAS,WAAY,CAAA;AAAA,IACjE,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,IAAA;AAAA,IACA,YAAA;AAAA,IACA,oBAAsB,EAAA,UAAA;AAAA,GACvB,CAAA,CAAA;AAED,EAAO,OAAA;AAAA,IACL,SAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAG,IAAA;AAAA,GACL,CAAA;AACF;;;;"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Middleware, Placement, Strategy } from "@floating-ui/react";
|
|
2
|
-
import { useFloating } from "@floating-ui/react";
|
|
3
|
-
export declare type UseFloatingUIProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Sets position relative to trigger.
|
|
6
|
-
*/
|
|
7
|
-
placement?: Placement;
|
|
8
|
-
strategy?: Strategy;
|
|
9
|
-
middleware?: Middleware[];
|
|
10
|
-
/**
|
|
11
|
-
* Sets visible state.
|
|
12
|
-
*/
|
|
13
|
-
open?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Callback function triggered when open state changes.
|
|
16
|
-
*/
|
|
17
|
-
onOpenChange?: (open: boolean) => void;
|
|
18
|
-
};
|
|
19
|
-
export declare const DEFAULT_FLOATING_UI_MIDDLEWARE: {
|
|
20
|
-
name: string;
|
|
21
|
-
options?: any;
|
|
22
|
-
fn: (state: {
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
initialPlacement: Placement;
|
|
26
|
-
placement: Placement;
|
|
27
|
-
strategy: Strategy;
|
|
28
|
-
middlewareData: import("@floating-ui/react").MiddlewareData;
|
|
29
|
-
rects: import("@floating-ui/react").ElementRects;
|
|
30
|
-
platform: import("@floating-ui/core").Platform;
|
|
31
|
-
elements: import("@floating-ui/react").Elements;
|
|
32
|
-
}) => import("@floating-ui/react").MiddlewareReturn | Promise<import("@floating-ui/react").MiddlewareReturn>;
|
|
33
|
-
}[];
|
|
34
|
-
export declare function useFloatingUI(props: UseFloatingUIProps): ReturnType<typeof useFloating>;
|