ingred-ui 23.8.0 → 23.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.
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { DrawerProps } from "./types";
3
+ declare const Drawer: React.FC<DrawerProps>;
4
+ export default Drawer;
@@ -0,0 +1,11 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Drawer from "./Drawer";
3
+ declare const meta: Meta<typeof Drawer>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const Responsive: Story;
8
+ export declare const WithStickyHeaderFooter: Story;
9
+ export declare const WithCloseConfirmation: Story;
10
+ export declare const DynamicConfirmClose: Story;
11
+ export declare const AnchorTrigger: Story;
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1,2 @@
1
+ export { default } from "./Drawer";
2
+ export type { DrawerProps, ConfirmCloseConfig, CloseReason } from "./types";
@@ -0,0 +1,25 @@
1
+ export type BackdropProps = {
2
+ shouldShow: boolean;
3
+ transitionDuration: number;
4
+ };
5
+ export declare const Backdrop: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, BackdropProps, never>;
6
+ export type DrawerContainerProps = {
7
+ direction: "left" | "right" | "bottom";
8
+ currentSize: number;
9
+ shouldShow: boolean;
10
+ transitionDuration: number;
11
+ };
12
+ export declare const DrawerContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, DrawerContainerProps, never>;
13
+ export type ResizeHandleProps = {
14
+ direction: "left" | "right" | "bottom";
15
+ };
16
+ export declare const ResizeHandle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ResizeHandleProps, never>;
17
+ export type ResizeBarProps = ResizeHandleProps & {
18
+ active?: boolean;
19
+ };
20
+ export declare const ResizeBar: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ResizeHandleProps & {
21
+ active?: boolean | undefined;
22
+ }, never>;
23
+ export declare const StickyHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
24
+ export declare const ScrollableContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
25
+ export declare const StickyFooter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { ConfirmModalProps } from "../ConfirmModal/ConfirmModal";
3
+ export type ConfirmCloseConfig = Pick<ConfirmModalProps, "confirmText" | "cancelText" | "buttonColor"> & {
4
+ title?: string;
5
+ message?: string;
6
+ };
7
+ export type DrawerProps = {
8
+ isOpen: boolean;
9
+ direction: "left" | "right" | "bottom";
10
+ onClose?: (reason: "backdropClick" | "escapeKey") => void;
11
+ size?: string | number;
12
+ resizable?: boolean;
13
+ minSize?: string | number;
14
+ maxSize?: string | number;
15
+ onResize?: (newSize: number) => void;
16
+ stickyHeader?: React.ReactNode;
17
+ stickyFooter?: React.ReactNode;
18
+ confirmOnClose?: string | ConfirmCloseConfig;
19
+ children: React.ReactNode;
20
+ /**
21
+ * ドロワー表示中も背景をスクロール可能にする(Backdrop非表示)
22
+ */
23
+ allowBackgroundScroll?: boolean;
24
+ };
25
+ export type CloseReason = "backdropClick" | "escapeKey";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Drawerコンポーネント用のユーティリティ関数
3
+ *
4
+ * このファイルの主な目的:
5
+ * 1. 開発者体験の向上: Drawerのsize、minSize、maxSizeプロパティで
6
+ * 様々な単位(px, vw, vh, %)を受け入れ可能にする
7
+ * 2. 内部処理の統一: すべてのサイズ計算をpx値で統一し、
8
+ * リサイズ処理、バリデーション、アニメーション計算を簡潔にする
9
+ *
10
+ * 使用例:
11
+ * - size="40vw" (ビューポート幅の40%)
12
+ * - size="300px" (固定300ピクセル)
13
+ * - size={400} (数値、px扱い)
14
+ * - size="80%" (画面サイズの80%)
15
+ */
16
+ /**
17
+ * 相対値をpx値に変換するヘルパー関数
18
+ * @param value - 変換する値(数値またはvw/vh/%/px等の単位付き文字列)
19
+ * @param direction - Drawerの方向(変換時の基準値決定に使用)
20
+ * @returns px値(数値)
21
+ */
22
+ export declare const convertToPixels: (value: string | number, direction: "left" | "right" | "bottom") => number;
@@ -38,6 +38,8 @@ export { default as DateRangePicker } from "./DateRangePicker";
38
38
  export * from "./DateRangePicker";
39
39
  export { default as Divider } from "./Divider";
40
40
  export * from "./Divider";
41
+ export { default as Drawer } from "./Drawer";
42
+ export * from "./Drawer";
41
43
  export { default as DropdownButton } from "./DropdownButton";
42
44
  export * from "./DropdownButton";
43
45
  export { default as DualListBox } from "./DualListBox";