ingred-ui 21.4.2 → 22.1.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.
@@ -2,32 +2,32 @@ import React, { type ReactNode } from "react";
2
2
  import { type Item } from "./types";
3
3
  type DualListBox2Props = {
4
4
  /**
5
- * 選択済みの「追加」項目
6
- **/
5
+ * 選択済みの「追加」項目の配列
6
+ */
7
7
  included: Item[];
8
8
  /**
9
- * 選択済みの「除外」項目
10
- **/
9
+ * 選択済みの「除外」項目の配列
10
+ */
11
11
  excluded: Item[];
12
12
  /**
13
- * 追加ボタンを非活性にし、「排他のみモード」にするかどうか
14
- **/
13
+ * 追加ボタンを非活性にし、「除外のみモード」にするかどうか
14
+ */
15
15
  disableInclude?: boolean;
16
16
  /**
17
- * 除外ボタンを非活性にし、「排他のみモード」にするかどうか
18
- **/
17
+ * 除外ボタンを非活性にし、「追加のみモード」にするかどうか
18
+ */
19
19
  disableExclude?: boolean;
20
20
  /**
21
- * メニューに表示するボタン要素
22
- **/
21
+ * メニューに表示するカスタムボタン要素
22
+ */
23
23
  menuButtons?: ReactNode;
24
24
  /**
25
- * ローディング中かどうかのフラグ
26
- **/
25
+ * データ読み込み中かどうかを示すフラグ
26
+ */
27
27
  loading?: boolean;
28
28
  /**
29
- * 項目リスト(DualListBox2Item, DualListBox2Accordion, DualListBox2Section のいずれかのみ)
30
- **/
29
+ * 項目リスト(DualListBox2Item, DualListBox2Accordion, DualListBox2Section のいずれかのコンポーネントのみ許可)
30
+ */
31
31
  children: ReactNode;
32
32
  /**
33
33
  * 「追加」状態の変更イベントハンドラ
@@ -57,6 +57,14 @@ type DualListBox2Props = {
57
57
  * 1ページあたりの表示件数が変更されたときのハンドラ
58
58
  **/
59
59
  onPageSizeChange?: (pageSize: number) => void;
60
+ /**
61
+ * 検索フィルターの文字列
62
+ **/
63
+ filter?: string;
64
+ /**
65
+ * 検索フィルターが変更されたときのハンドラ
66
+ **/
67
+ onFilterChange?: (filter: string) => void;
60
68
  };
61
69
  export declare const DualListBox2: React.ForwardRefExoticComponent<DualListBox2Props & React.RefAttributes<HTMLDivElement>>;
62
70
  export {};
@@ -1,11 +1,16 @@
1
1
  import React from "react";
2
- import { StoryObj, ComponentStory } from "@storybook/react";
3
- import { type Item, DualListBox2 } from "./index";
2
+ import { StoryObj } from "@storybook/react";
3
+ import { DualListBox2 } from "./DualListBox2";
4
+ export type Item = {
5
+ id: string;
6
+ label: string;
7
+ groupName?: string;
8
+ };
4
9
  declare const meta: {
5
10
  title: string;
6
11
  component: React.ForwardRefExoticComponent<{
7
- included: Item[];
8
- excluded: Item[];
12
+ included: import("./types").Item[];
13
+ excluded: import("./types").Item[];
9
14
  disableInclude?: boolean | undefined;
10
15
  disableExclude?: boolean | undefined;
11
16
  menuButtons?: React.ReactNode;
@@ -18,45 +23,42 @@ declare const meta: {
18
23
  pageSize?: number | undefined;
19
24
  pageSizeOptions?: number[] | undefined;
20
25
  onPageSizeChange?: ((pageSize: number) => void) | undefined;
26
+ filter?: string | undefined;
27
+ onFilterChange?: ((filter: string) => void) | undefined;
21
28
  } & React.RefAttributes<HTMLDivElement>>;
22
- argTypes: {};
29
+ tags: string[];
30
+ parameters: {
31
+ docs: {
32
+ description: {
33
+ component: string;
34
+ };
35
+ };
36
+ };
23
37
  };
24
38
  export default meta;
39
+ type Story = StoryObj<typeof DualListBox2>;
25
40
  /**
26
41
  * #### ベーシックなタイプ
27
42
  *
28
43
  * 件数の上限が不明で都度サーバへ問い合わせる必要がある場合、上限が決まっている場合いずれにも使えます。
29
- *
30
- * ---
31
- *
32
- * `included` と `excluded` で選択中の値を指定します。
33
- * 選択状態変更時は、`onIncludedChange` と `onExcludedChange` で、新しい `included` と `excluded` を受け取れるので、これを使って `included` と `excluded` を更新してください。
34
- *
35
- * children には、左パネル用の選択できる項目を渡します。右パネルの内容は状態に応じて自動で表示管理されます。
36
- *
37
- * モバイルサイズでは、タブで左右パネルの表示を切り替える
38
- *
39
- * included はフラットな配列。アコーディオンやセクションの group ごとに分けて配置する
40
44
  */
41
- export declare const Default: ComponentStory<typeof DualListBox2>;
45
+ export declare const Default: Story;
42
46
  /**
43
- * #### 選択候補がアコーディオンで折りたたまれているタイプ
47
+ * #### アコーディオンタイプ
44
48
  *
45
- * 件数の上限が決まっていて、多い場合や区切りたい場合に利用します。
46
- * セクションごとに一括選択もできます。
49
+ * グループ化されたアイテムを表示する場合に使用します。
47
50
  */
48
- export declare const Accordion: StoryObj<typeof DualListBox2>;
51
+ export declare const Accordion: Story;
49
52
  /**
50
- * 「追加」「除外」のいずれかしかできない場合の例です。
53
+ * #### 「追加」「除外」のいずれかしかできない場合
54
+ *
51
55
  * 状況に応じて、`disableExclude`(除外無効)、`disableInclude`(追加無効) に `true` を指定して制御してください。
52
56
  */
53
- export declare const Either: StoryObj<typeof DualListBox2>;
57
+ export declare const Either: Story;
54
58
  /**
55
59
  * #### 選択候補がセクションで分かれているタイプ
56
60
  *
57
61
  * 件数の上限が不明で都度サーバへ問い合わせる必要がある場合に利用します。
58
62
  * 検索は各セクションに移動後に使えます。
59
- *
60
- * 任意のセクション選択中は、その他のセクションは非表示となります。
61
63
  */
62
- export declare const Section: StoryObj<typeof DualListBox2>;
64
+ export declare const Section: Story;
@@ -1,12 +1,10 @@
1
- import { type ReactNode } from "react";
2
- type DualListBox2ItemProps = {
1
+ import React, { type ReactNode } from "react";
2
+ export type DualListBox2ItemProps = {
3
3
  id: string;
4
4
  children: ReactNode;
5
+ isIncluded?: boolean;
6
+ isExcluded?: boolean;
5
7
  disableInclude?: boolean;
6
8
  disableExclude?: boolean;
7
9
  };
8
- export declare const DualListBox2Item: {
9
- ({ id, disableInclude, disableExclude, children, }: DualListBox2ItemProps): JSX.Element | null;
10
- displayName: string;
11
- };
12
- export {};
10
+ export declare const DualListBox2Item: React.FC<DualListBox2ItemProps>;
@@ -9,6 +9,7 @@ export declare const LeftPanel: import("styled-components").StyledComponent<"div
9
9
  export declare const LeftPanelBody: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
10
  export declare const LeftPanelHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
11
11
  export declare const HeaderSearch: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
+ export declare const HeaderSearchReset: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
12
13
  export declare const HeaderMenuButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
13
14
  export declare const HeaderCount: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
14
15
  export declare const HeaderButtons: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;