@zenkigen-inc/component-ui 1.14.4 → 1.15.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,27 @@
1
+ /**
2
+ * モーダル表示時にバックグラウンドのスクロールを防止するコンポーネント。
3
+ * コンポーネントがマウントされている間、position: fixedアプローチを使用して
4
+ * body要素にスクロールロックを適用します。
5
+ * 縦横両方のスクロール位置を保存し、コンポーネントのアンマウント時に復元します。
6
+ * スクロールバーの有無を検出し、その幅を考慮してレイアウトシフトを防止します。
7
+ * position、top、left、width、overflow、padding-rightを変更し、
8
+ * 最小限の変更でスクロールを防止します。
9
+ * グローバルCSSに依存せず、すべてインラインスタイルで実装されています。
10
+ * このコンポーネントは実際のDOM要素をレンダリングせず、効果のみを適用します。
11
+ *
12
+ * @example
13
+ * // モーダルコンポーネント内で使用する例
14
+ * const Modal = ({ isOpen, children }) => {
15
+ * return (
16
+ * <>
17
+ * {isOpen && <BodyScrollLock />}
18
+ * {isOpen && (
19
+ * <div className="modal">
20
+ * {children}
21
+ * </div>
22
+ * )}
23
+ * </>
24
+ * );
25
+ * };
26
+ */
27
+ export declare const BodyScrollLock: () => null;
@@ -9,7 +9,7 @@ type Props = {
9
9
  onClose?: () => void;
10
10
  portalTargetRef?: MutableRefObject<HTMLElement | null>;
11
11
  };
12
- export declare function Modal({ children, width, height, isOpen, onClose, portalTargetRef }: PropsWithChildren<Props>): import("react").ReactPortal | null;
12
+ export declare function Modal({ children, width, height, isOpen, onClose, portalTargetRef }: PropsWithChildren<Props>): import("react").JSX.Element | null;
13
13
  export declare namespace Modal {
14
14
  var Body: typeof ModalBody;
15
15
  var Header: typeof ModalHeader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenkigen-inc/component-ui",
3
- "version": "1.14.4",
3
+ "version": "1.15.0",
4
4
  "repository": "https://github.com/zenkigen/zenkigen-component",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -20,15 +20,15 @@
20
20
  "devDependencies": {
21
21
  "hygen": "6.2.11",
22
22
  "microbundle": "0.15.1",
23
- "typescript": "5.5.4"
23
+ "typescript": "5.8.3"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": "^18.0.0 || ^19.0.0",
27
27
  "react-dom": "^18.0.0 || ^19.0.0"
28
28
  },
29
29
  "dependencies": {
30
- "@zenkigen-inc/component-icons": "1.14.4",
31
- "@zenkigen-inc/component-theme": "1.14.4",
30
+ "@zenkigen-inc/component-icons": "1.15.0",
31
+ "@zenkigen-inc/component-theme": "1.15.0",
32
32
  "clsx": "2.1.1"
33
33
  }
34
34
  }