ingred-ui 23.24.0 → 24.0.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,28 +1,4 @@
1
1
  import * as React from "react";
2
- import { MenuProps } from "../Menu";
3
- import { ButtonSize, ButtonColor } from "../Button/Button";
4
- import { ContentProp } from "../MenuList/MenuList";
5
- import { Placement } from "@floating-ui/react";
6
- import { AutoPlacement } from "../../hooks/usePlacement";
7
- type DropdownButtonColor = Exclude<ButtonColor, "danger">;
8
- export type DropdownButtonProps = {
9
- size?: ButtonSize;
10
- color?: DropdownButtonColor;
11
- onClick?: () => void;
12
- split?: boolean;
13
- /**
14
- * props of [MenuList](/?path=/docs/components-navigation-menulist)
15
- */
16
- contents: ContentProp[];
17
- disabled?: boolean;
18
- /**
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.
21
- */
22
- positionPriority?: (Placement | AutoPlacement)[];
23
- menuMaxHeight?: MenuProps["maxHeight"];
24
- menuProps?: Partial<MenuProps>;
25
- children?: React.ReactNode;
26
- };
27
- declare const DropdownButton: React.ForwardRefExoticComponent<DropdownButtonProps & React.RefAttributes<HTMLDivElement>>;
2
+ import { DropdownButtonProps } from "./types";
3
+ declare const DropdownButton: React.FC<DropdownButtonProps>;
28
4
  export default DropdownButton;
@@ -1,20 +1,18 @@
1
1
  import * as React from "react";
2
- import { DropdownButtonProps } from "./DropdownButton";
2
+ import type { DropdownButtonProps } from "./types";
3
3
  import { StoryObj } from "@storybook/react";
4
4
  declare const _default: {
5
5
  title: string;
6
- component: React.ForwardRefExoticComponent<DropdownButtonProps & React.RefAttributes<HTMLDivElement>>;
6
+ component: React.FC<DropdownButtonProps>;
7
7
  args: {
8
8
  contents: ({
9
9
  text: string;
10
10
  onClick: () => void;
11
- type: string;
12
11
  divideTop?: undefined;
13
12
  } | {
14
13
  text: string;
15
14
  onClick: () => void;
16
15
  divideTop: boolean;
17
- type: string;
18
16
  })[];
19
17
  };
20
18
  };
@@ -22,4 +20,9 @@ export default _default;
22
20
  export declare const Example: StoryObj<DropdownButtonProps>;
23
21
  export declare const Colors: StoryObj<DropdownButtonProps>;
24
22
  export declare const Sizes: StoryObj<DropdownButtonProps>;
23
+ export declare const WithIcon: StoryObj<DropdownButtonProps>;
25
24
  export declare const Split: StoryObj<DropdownButtonProps>;
25
+ export declare const SplitWithIcon: StoryObj<DropdownButtonProps>;
26
+ export declare const WithSelectedValue: StoryObj<DropdownButtonProps>;
27
+ export declare const WithConfirmModal: StoryObj<DropdownButtonProps>;
28
+ export declare const WithLoading: StoryObj<DropdownButtonProps>;
@@ -1,2 +1,2 @@
1
1
  export { default } from "./DropdownButton";
2
- export type { DropdownButtonProps } from "./DropdownButton";
2
+ export type { DropdownButtonProps, ContextMenu2ContentProp } from "./types";
@@ -0,0 +1,54 @@
1
+ import type { ReactNode } from "react";
2
+ import { ButtonSize, ButtonColor } from "../Button/Button";
3
+ export type DropdownButtonColor = Exclude<ButtonColor, "danger">;
4
+ export type ContextMenu2ContentProp = {
5
+ text: string;
6
+ onClick: () => void;
7
+ divideTop?: boolean;
8
+ disabled?: boolean;
9
+ icon?: ReactNode;
10
+ color?: "danger";
11
+ checked?: boolean;
12
+ onChange?: (checked: boolean) => void;
13
+ };
14
+ export type DropdownButtonProps = {
15
+ size?: ButtonSize;
16
+ color?: DropdownButtonColor;
17
+ onClick?: () => void;
18
+ split?: boolean;
19
+ /**
20
+ * ContextMenu2のコンテンツ
21
+ */
22
+ contents?: ContextMenu2ContentProp[];
23
+ disabled?: boolean;
24
+ children?: React.ReactNode;
25
+ /**
26
+ * ボタンに表示するアイコン
27
+ */
28
+ icon?: ReactNode;
29
+ /**
30
+ * ボタンに表示する選択値。undefinedの場合はchildrenが使用されます。
31
+ */
32
+ selectedValue?: string;
33
+ /**
34
+ * ドロップダウンメニューの幅
35
+ */
36
+ menuWidth?: number;
37
+ /**
38
+ * ローディング状態を表示するかどうか。文字列を指定した場合はそれがローディングテキストとして使用されます。
39
+ * - `true`: デフォルトの"Loading..."テキストを使用
40
+ * - `string`: 指定した文字列をローディングテキストとして使用
41
+ * - `false` または `undefined`: ローディング状態を表示しない
42
+ *
43
+ * ボタンの内容に応じた動作:
44
+ * - アイコンのみ: スピナーのみを表示(ローディングテキストは無視)
45
+ * - テキストのみ: ローディングテキストのみを表示(`true`の場合はデフォルトで"Loading...")
46
+ * - アイコン + テキスト: スピナー + ローディングテキストを表示(`true`の場合はデフォルトで"Loading...")
47
+ */
48
+ loading?: boolean | string;
49
+ };
50
+ export type DropdownButtonSizeConfig = {
51
+ arrowIconSize: number;
52
+ arrowButtonPadding: string;
53
+ };
54
+ export declare const DROPDOWN_BUTTON_SIZES: Record<ButtonSize, DropdownButtonSizeConfig>;