ingred-ui 14.2.2 → 14.3.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.
@@ -1,8 +1,9 @@
1
- import * as PopperJS from "@popperjs/core";
2
1
  import * as React from "react";
3
2
  import { ActionButtonProps } from "../ActionButton";
4
3
  import { MenuProps } from "../Menu";
5
4
  import { ContentProp } from "../MenuList/MenuList";
5
+ import { Placement } from "@floating-ui/react";
6
+ import { AutoPlacement } from "../../hooks/usePlacement";
6
7
  export type ContextMenuProps = {
7
8
  /**
8
9
  * `type ContentProp = React.ComponentPropsWithoutRef<"div"> & {
@@ -14,9 +15,10 @@ export type ContextMenuProps = {
14
15
  */
15
16
  contents: ContentProp[];
16
17
  /**
17
- * Define priority of position. Please check [this](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements).
18
+ * Define priority of position. Please check [this](https://floating-ui.com/docs/tutorial#placements).
19
+ * For backward compatibility, `"auto" | "auto-start" | "auto-end"` are included in addition to the above positions.
18
20
  */
19
- positionPriority?: PopperJS.Placement[];
21
+ positionPriority?: (Placement | AutoPlacement)[];
20
22
  menuMaxHeight?: MenuProps["maxHeight"];
21
23
  /**
22
24
  * props of [Menu](/?path=/docs/components-navigation-menu)
@@ -1,8 +1,9 @@
1
1
  import * as React from "react";
2
- import * as PopperJS from "@popperjs/core";
3
2
  import { MenuProps } from "../Menu";
4
3
  import { ButtonSize, ButtonColor } from "../Button/Button";
5
4
  import { ContentProp } from "../MenuList/MenuList";
5
+ import { Placement } from "@floating-ui/react";
6
+ import { AutoPlacement } from "../../hooks/usePlacement";
6
7
  type DropdownButtonColor = Exclude<ButtonColor, "danger">;
7
8
  export type DropdownButtonProps = {
8
9
  size?: ButtonSize;
@@ -15,9 +16,10 @@ export type DropdownButtonProps = {
15
16
  contents: ContentProp[];
16
17
  disabled?: boolean;
17
18
  /**
18
- * Define priority of position. Please check [this](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements).
19
+ * Define priority of position. Please check [this](https://floating-ui.com/docs/tutorial#placements).
20
+ * For backward compatibility, `"auto" | "auto-start" | "auto-end"` are included in addition to the above positions.
19
21
  */
20
- positionPriority?: PopperJS.Placement[];
22
+ positionPriority?: (Placement | AutoPlacement)[];
21
23
  menuMaxHeight?: MenuProps["maxHeight"];
22
24
  menuProps?: Partial<MenuProps>;
23
25
  children?: React.ReactNode;
@@ -1,7 +1,8 @@
1
- import * as PopperJS from "@popperjs/core";
2
1
  import * as React from "react";
3
2
  import { ModalCloseReason } from "../Modal";
4
3
  import { PopoverProps } from "../Popover";
4
+ import { Placement } from "@floating-ui/react";
5
+ import { AutoPlacement } from "../../hooks/usePlacement";
5
6
  export type FloatingTipCloseReason = "clickCloseIcon";
6
7
  export type FloatingTipProps = {
7
8
  /**
@@ -9,9 +10,10 @@ export type FloatingTipProps = {
9
10
  */
10
11
  baseElement: HTMLElement | null;
11
12
  /**
12
- * Define priority of position. Please check [this](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements).
13
+ * Define priority of position. Please check [this](https://floating-ui.com/docs/tutorial#placements).
14
+ * For backward compatibility, `"auto" | "auto-start" | "auto-end"` are included in addition to the above positions.
13
15
  */
14
- positionPriority?: PopperJS.Placement[];
16
+ positionPriority?: (Placement | AutoPlacement)[];
15
17
  offset?: [number, number];
16
18
  isOpen: boolean;
17
19
  children: React.ReactNode;
@@ -1,8 +1,9 @@
1
- import * as PopperJS from "@popperjs/core";
2
1
  import * as React from "react";
3
2
  import { ContentProp, MenuListProps } from "../MenuList/MenuList";
4
3
  import { ModalCloseReason } from "../Modal";
5
4
  import { PopoverProps } from "../Popover";
5
+ import { Placement } from "@floating-ui/react";
6
+ import { AutoPlacement } from "../../hooks/usePlacement";
6
7
  export type MenuCloseReason = "clickMenuList";
7
8
  export type MenuProps = {
8
9
  isOpen?: boolean;
@@ -20,9 +21,10 @@ export type MenuProps = {
20
21
  */
21
22
  contents: ContentProp[];
22
23
  /**
23
- * Define priority of position. Please check [this](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements).
24
+ * Define priority of position. Please check [this](https://floating-ui.com/docs/tutorial#placements).
25
+ * For backward compatibility, `"auto" | "auto-start" | "auto-end"` are included in addition to the above positions.
24
26
  */
25
- positionPriority?: PopperJS.Placement[];
27
+ positionPriority?: (Placement | AutoPlacement)[];
26
28
  onClose?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>, reason: ModalCloseReason | MenuCloseReason) => void;
27
29
  maxHeight?: MenuListProps["maxHeight"];
28
30
  /**
@@ -26,7 +26,7 @@ export declare const Basic: {
26
26
  isOpen?: boolean | undefined;
27
27
  baseElement?: HTMLElement | null | undefined;
28
28
  contents: import("..").ContentProp[];
29
- positionPriority?: import("@popperjs/core").Placement[] | undefined;
29
+ positionPriority?: ("auto" | "auto-start" | "auto-end" | import("@floating-ui/react-dom").Placement)[] | undefined;
30
30
  onClose?: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>, reason: "backdropClick" | "clickMenuList") => void) | undefined;
31
31
  maxHeight?: import("csstype").Property.MaxHeight<0 | (string & {})> | undefined;
32
32
  menuListProps?: Partial<import("..").MenuListProps> | undefined;
@@ -57,7 +57,7 @@ export declare const Group: {
57
57
  isOpen?: boolean | undefined;
58
58
  baseElement?: HTMLElement | null | undefined;
59
59
  contents: import("..").ContentProp[];
60
- positionPriority?: import("@popperjs/core").Placement[] | undefined;
60
+ positionPriority?: ("auto" | "auto-start" | "auto-end" | import("@floating-ui/react-dom").Placement)[] | undefined;
61
61
  onClose?: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>, reason: "backdropClick" | "clickMenuList") => void) | undefined;
62
62
  maxHeight?: import("csstype").Property.MaxHeight<0 | (string & {})> | undefined;
63
63
  menuListProps?: Partial<import("..").MenuListProps> | undefined;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { Property } from "csstype";
3
3
  import { Theme } from "../../themes";
4
+ import { IconName } from "../Icon";
4
5
  export type ContentType = "default" | "warning" | "disabled";
5
6
  export type ContentTypeStyle = {
6
7
  normal: {
@@ -22,6 +23,7 @@ export type SingleContentProp = React.ComponentPropsWithoutRef<"div"> & {
22
23
  onClick: () => void;
23
24
  divideTop?: boolean;
24
25
  type?: ContentType;
26
+ iconName?: IconName;
25
27
  /**
26
28
  * @deprecated
27
29
  *
@@ -19,11 +19,17 @@ declare const _default: {
19
19
  export default _default;
20
20
  export declare const Basic: {
21
21
  args: {
22
- contents: {
22
+ contents: ({
23
23
  text: string;
24
24
  onClick: import("@storybook/addon-actions").HandlerFunction;
25
25
  type: string;
26
- }[];
26
+ iconName?: undefined;
27
+ } | {
28
+ text: string;
29
+ onClick: import("@storybook/addon-actions").HandlerFunction;
30
+ type: string;
31
+ iconName: string;
32
+ })[];
27
33
  maxHeight: string;
28
34
  };
29
35
  decorators?: import("@storybook/types").DecoratorFunction<import("@storybook/react/dist/types-0a347bb9").R, {
@@ -5,10 +5,14 @@ type ContainerProps = {
5
5
  inline: boolean;
6
6
  maxHeight: Property.MaxHeight;
7
7
  };
8
+ type IconProps = {
9
+ disabled: boolean;
10
+ };
8
11
  export declare const Container: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ContainerProps, never>;
9
12
  export declare const TitleContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
13
+ export declare const Icon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, IconProps, never>;
10
14
  export declare const Text: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../Typography").TypographyProps & import("react").RefAttributes<HTMLElement>>, import("styled-components").DefaultTheme, {}, never>;
11
- export declare const TextContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ContentTypeStyle & {
15
+ export declare const MenuContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ContentTypeStyle & {
12
16
  disabled: boolean;
13
17
  }, never>;
14
18
  export {};
@@ -1,20 +1,19 @@
1
- import * as PopperJS from "@popperjs/core";
1
+ import { Placement } from "@floating-ui/core";
2
2
  import * as React from "react";
3
3
  import { ModalProps } from "../Modal";
4
+ import { AutoPlacement } from "../../hooks/usePlacement";
4
5
  export type PopoverProps = React.ComponentPropsWithoutRef<"div"> & {
5
6
  /**
6
7
  * If `false`, children becomes `visibility: hidden`.
7
8
  */
8
9
  isOpen?: boolean;
9
10
  onClose?: ModalProps["onClose"];
10
- /**
11
- * That becomes position reference of this component.
12
- */
13
11
  baseElement: HTMLElement | null;
14
12
  /**
15
- * Define priority of position. Please check [this](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements).
13
+ * Define priority of position. Please check [this](https://floating-ui.com/docs/tutorial#placements).
14
+ * If not specified, it will be auto.
16
15
  */
17
- positionPriority?: PopperJS.Placement[];
16
+ positionPriority?: (Placement | AutoPlacement)[];
18
17
  offset?: [number, number];
19
18
  /**
20
19
  * props of [Modal](/?path=/docs/components-utils-modal)
@@ -28,14 +27,12 @@ declare const Popover: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLPr
28
27
  */
29
28
  isOpen?: boolean | undefined;
30
29
  onClose?: ModalProps["onClose"];
31
- /**
32
- * That becomes position reference of this component.
33
- */
34
30
  baseElement: HTMLElement | null;
35
31
  /**
36
- * Define priority of position. Please check [this](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements).
32
+ * Define priority of position. Please check [this](https://floating-ui.com/docs/tutorial#placements).
33
+ * If not specified, it will be auto.
37
34
  */
38
- positionPriority?: PopperJS.Placement[] | undefined;
35
+ positionPriority?: ("auto" | "auto-start" | "auto-end" | Placement)[] | undefined;
39
36
  offset?: [number, number] | undefined;
40
37
  /**
41
38
  * props of [Modal](/?path=/docs/components-utils-modal)
@@ -7,7 +7,7 @@ declare const _default: {
7
7
  isOpen?: boolean | undefined;
8
8
  onClose?: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>, reason: "backdropClick") => void) | undefined;
9
9
  baseElement: HTMLElement | null;
10
- positionPriority?: import("@popperjs/core").Placement[] | undefined;
10
+ positionPriority?: ("auto" | "auto-start" | "auto-end" | import("@floating-ui/core").Placement)[] | undefined;
11
11
  offset?: [number, number] | undefined;
12
12
  modalProps?: Partial<import("..").ModalProps> | undefined;
13
13
  children: React.ComponentElement<HTMLElement, any>;
@@ -1,16 +1,17 @@
1
1
  import * as React from "react";
2
- import * as PopperJS from "@popperjs/core";
2
+ import { Placement } from "@floating-ui/core";
3
3
  import { CSSTransitionProps } from "../../utils/reactTransitionGroup";
4
+ import { AutoPlacement } from "../../hooks/usePlacement";
4
5
  export type TooltipProps = React.ComponentPropsWithoutRef<"div"> & {
5
- content: React.ReactChild;
6
+ content: React.ReactNode;
6
7
  open?: boolean;
7
8
  disableHoverListener?: boolean;
8
9
  enterDelay?: number;
9
10
  leaveDelay?: number;
10
11
  /**
11
- * Define priority of position. Please check [this](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements).
12
+ * Define priority of position. Please check [this](https://floating-ui.com/docs/tutorial#placements).
12
13
  */
13
- positionPriority?: PopperJS.Placement[];
14
+ positionPriority?: (Placement | AutoPlacement)[];
14
15
  offset?: [number, number];
15
16
  width?: string;
16
17
  disabled?: boolean;
@@ -21,15 +22,15 @@ export type TooltipProps = React.ComponentPropsWithoutRef<"div"> & {
21
22
  children: React.ComponentElement<HTMLElement, any>;
22
23
  };
23
24
  declare const Tooltip: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
24
- content: React.ReactChild;
25
+ content: React.ReactNode;
25
26
  open?: boolean | undefined;
26
27
  disableHoverListener?: boolean | undefined;
27
28
  enterDelay?: number | undefined;
28
29
  leaveDelay?: number | undefined;
29
30
  /**
30
- * Define priority of position. Please check [this](https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements).
31
+ * Define priority of position. Please check [this](https://floating-ui.com/docs/tutorial#placements).
31
32
  */
32
- positionPriority?: PopperJS.Placement[] | undefined;
33
+ positionPriority?: ("auto" | "auto-start" | "auto-end" | Placement)[] | undefined;
33
34
  offset?: [number, number] | undefined;
34
35
  width?: string | undefined;
35
36
  disabled?: boolean | undefined;
@@ -4,12 +4,12 @@ import { StoryObj } from "@storybook/react";
4
4
  declare const _default: {
5
5
  title: string;
6
6
  component: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
7
- content: React.ReactChild;
7
+ content: React.ReactNode;
8
8
  open?: boolean | undefined;
9
9
  disableHoverListener?: boolean | undefined;
10
10
  enterDelay?: number | undefined;
11
11
  leaveDelay?: number | undefined;
12
- positionPriority?: import("@popperjs/core").Placement[] | undefined;
12
+ positionPriority?: ("auto" | "auto-start" | "auto-end" | import("@floating-ui/core").Placement)[] | undefined;
13
13
  offset?: [number, number] | undefined;
14
14
  width?: string | undefined;
15
15
  disabled?: boolean | undefined;
@@ -1,8 +1,3 @@
1
- import { DefaultTheme } from "styled-components";
2
- import * as PopperJS from "@popperjs/core";
3
- export declare const Arrow: import("styled-components").StyledComponent<"div", DefaultTheme, {
4
- placement?: PopperJS.Placement | undefined;
5
- }, never>;
6
- export declare const Tooltip: import("styled-components").StyledComponent<"div", DefaultTheme, {
1
+ export declare const Tooltip: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
7
2
  width?: string | undefined;
8
3
  }, never>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Placement } from "@floating-ui/react";
2
+ export declare const autoPlacements: readonly ["auto", "auto-start", "auto-end"];
3
+ export type AutoPlacement = typeof autoPlacements[number];
4
+ export declare const usePlacement: (placements: (Placement | AutoPlacement)[]) => {
5
+ placements: Placement[];
6
+ isAuto: boolean;
7
+ };