react-zoom-pan-pinch 3.6.1 → 4.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.
Files changed (139) hide show
  1. package/dist/index.cjs.js +770 -277
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +116 -22
  4. package/dist/index.esm.js +766 -269
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +73 -60
  7. package/src/components/index.ts +5 -0
  8. package/src/components/keep-scale/keep-scale.tsx +28 -0
  9. package/src/components/mini-map/mini-map.tsx +292 -0
  10. package/src/components/mini-map/use-resize.hook.ts +74 -0
  11. package/src/components/transform-component/transform-component.module.css +43 -0
  12. package/src/components/transform-component/transform-component.tsx +96 -0
  13. package/src/components/transform-wrapper/transform-wrapper.tsx +39 -0
  14. package/src/components/virtualize/virtualize.tsx +133 -0
  15. package/src/components/virtualize/virtualize.utils.ts +104 -0
  16. package/src/constants/state.constants.ts +99 -0
  17. package/src/core/animations/animations.constants.ts +78 -0
  18. package/src/core/animations/animations.utils.ts +115 -0
  19. package/src/core/bounds/bounds.types.ts +8 -0
  20. package/src/core/bounds/bounds.utils.ts +226 -0
  21. package/src/core/double-click/double-click.logic.ts +127 -0
  22. package/src/core/handlers/handlers.logic.ts +122 -0
  23. package/src/core/handlers/handlers.utils.ts +243 -0
  24. package/src/core/instance.core.ts +704 -0
  25. package/src/core/pan/panning.logic.ts +122 -0
  26. package/src/core/pan/panning.utils.ts +216 -0
  27. package/src/core/pan/velocity.logic.ts +187 -0
  28. package/src/core/pan/velocity.utils.ts +83 -0
  29. package/src/core/pinch/pinch.logic.ts +139 -0
  30. package/src/core/pinch/pinch.utils.ts +95 -0
  31. package/src/core/wheel/wheel.logic.ts +161 -0
  32. package/src/core/wheel/wheel.utils.ts +157 -0
  33. package/src/core/zoom/zoom.logic.ts +71 -0
  34. package/src/core/zoom/zoom.utils.ts +62 -0
  35. package/src/hooks/index.ts +5 -0
  36. package/src/hooks/use-controls.tsx +9 -0
  37. package/src/hooks/use-transform-component.tsx +30 -0
  38. package/src/hooks/use-transform-context.tsx +13 -0
  39. package/src/hooks/use-transform-effect.tsx +22 -0
  40. package/src/hooks/use-transform-init.tsx +28 -0
  41. package/src/hooks/use-zoom-pan-pinch.tsx +48 -0
  42. package/src/index.ts +6 -0
  43. package/src/models/calculations.model.ts +34 -0
  44. package/src/models/context.model.ts +218 -0
  45. package/src/models/helpers.model.ts +15 -0
  46. package/src/models/index.ts +3 -0
  47. package/src/react-app-env.d.ts +1 -0
  48. package/src/stories/assets/big-image.jpeg +0 -0
  49. package/src/stories/assets/map.jpg +0 -0
  50. package/src/stories/assets/medium-image.jpg +0 -0
  51. package/src/stories/assets/pin.svg +1 -0
  52. package/src/stories/assets/small-image.jpg +0 -0
  53. package/src/stories/assets/svg-example.svg +14 -0
  54. package/src/stories/docs/DocTable.tsx +59 -0
  55. package/src/stories/docs/HandlerCards.tsx +102 -0
  56. package/src/stories/docs/Introduction.stories.mdx +135 -0
  57. package/src/stories/docs/PropTable.tsx +116 -0
  58. package/src/stories/docs/docs.module.css +370 -0
  59. package/src/stories/docs/handlers.stories.mdx +7 -0
  60. package/src/stories/docs/handlers.tsx +111 -0
  61. package/src/stories/docs/props.stories.mdx +11 -0
  62. package/src/stories/docs/props.tsx +571 -0
  63. package/src/stories/examples/axis-lock/axis-lock.stories.mdx +35 -0
  64. package/src/stories/examples/axis-lock/example.tsx +114 -0
  65. package/src/stories/examples/bounds/bounds.data.tsx +191 -0
  66. package/src/stories/examples/bounds/bounds.stories.mdx +99 -0
  67. package/src/stories/examples/center-zoomed-out/center-zoomed-out.stories.mdx +206 -0
  68. package/src/stories/examples/cinema/cinema-data.tsx +578 -0
  69. package/src/stories/examples/cinema/cinema.stories.mdx +30 -0
  70. package/src/stories/examples/cinema/example.tsx +378 -0
  71. package/src/stories/examples/cinema/image.png +0 -0
  72. package/src/stories/examples/content/content.stories.mdx +172 -0
  73. package/src/stories/examples/content/mixed-content.data.tsx +624 -0
  74. package/src/stories/examples/content-rerendering/content-updating.stories.mdx +34 -0
  75. package/src/stories/examples/content-rerendering/example.tsx +631 -0
  76. package/src/stories/examples/controls/controls.stories.mdx +120 -0
  77. package/src/stories/examples/image/example.tsx +149 -0
  78. package/src/stories/examples/image/image.stories.mdx +46 -0
  79. package/src/stories/examples/image-annotations/example.tsx +1442 -0
  80. package/src/stories/examples/image-annotations/image-annotations.stories.mdx +39 -0
  81. package/src/stories/examples/image-responsive/example.tsx +152 -0
  82. package/src/stories/examples/image-responsive/image-responsive.stories.mdx +51 -0
  83. package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +107 -0
  84. package/src/stories/examples/initial-transform/example.tsx +233 -0
  85. package/src/stories/examples/initial-transform/initial-transform.stories.mdx +37 -0
  86. package/src/stories/examples/keep-scale/example.tsx +882 -0
  87. package/src/stories/examples/keep-scale/keep-scale.stories.mdx +30 -0
  88. package/src/stories/examples/keep-scale/map.stories.mdx +28 -0
  89. package/src/stories/examples/medical-viewer/chest-xray.tsx +246 -0
  90. package/src/stories/examples/medical-viewer/example.tsx +690 -0
  91. package/src/stories/examples/medical-viewer/medical-viewer.stories.mdx +49 -0
  92. package/src/stories/examples/mini-map/example.tsx +122 -0
  93. package/src/stories/examples/mini-map/mini-map.stories.mdx +26 -0
  94. package/src/stories/examples/miro/example.tsx +1573 -0
  95. package/src/stories/examples/miro/miro.stories.mdx +31 -0
  96. package/src/stories/examples/padding/example.tsx +147 -0
  97. package/src/stories/examples/padding/padding.stories.mdx +35 -0
  98. package/src/stories/examples/product-card/example.tsx +594 -0
  99. package/src/stories/examples/product-card/product-card.stories.mdx +29 -0
  100. package/src/stories/examples/stadium/example.tsx +1040 -0
  101. package/src/stories/examples/stadium/stadium-data.ts +224 -0
  102. package/src/stories/examples/stadium/stadium.stories.mdx +32 -0
  103. package/src/stories/examples/stress/example.tsx +59 -0
  104. package/src/stories/examples/stress/stress-test.stories.mdx +28 -0
  105. package/src/stories/examples/svg-zoom-to-element/creativity.svg +143 -0
  106. package/src/stories/examples/svg-zoom-to-element/example.tsx +95 -0
  107. package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +28 -0
  108. package/src/stories/examples/text-selection/example.tsx +221 -0
  109. package/src/stories/examples/text-selection/text-selection.stories.mdx +31 -0
  110. package/src/stories/examples/velocity/example.tsx +908 -0
  111. package/src/stories/examples/velocity/velocity.stories.mdx +35 -0
  112. package/src/stories/examples/virtualize/example.tsx +239 -0
  113. package/src/stories/examples/virtualize/virtualize.stories.mdx +84 -0
  114. package/src/stories/examples/zoom-to-element/example.tsx +219 -0
  115. package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +31 -0
  116. package/src/stories/hooks/use-controls.stories.mdx +86 -0
  117. package/src/stories/hooks/use-transform-component.stories.mdx +108 -0
  118. package/src/stories/hooks/use-transform-context.stories.mdx +92 -0
  119. package/src/stories/hooks/use-transform-effect.stories.mdx +114 -0
  120. package/src/stories/hooks/use-transform-init.stories.mdx +105 -0
  121. package/src/stories/types/args.types.ts +192 -0
  122. package/src/stories/utils/args.utils.ts +35 -0
  123. package/src/stories/utils/bounds-overlay.tsx +168 -0
  124. package/src/stories/utils/code.utils.tsx +22 -0
  125. package/src/stories/utils/controls.utils.tsx +347 -0
  126. package/src/stories/utils/index.ts +5 -0
  127. package/src/stories/utils/styles.module.css +223 -0
  128. package/src/stories/utils/viewer.styles.ts +34 -0
  129. package/src/styles.css +8 -0
  130. package/src/typings.d.ts +21 -0
  131. package/src/utils/calculations.utils.ts +16 -0
  132. package/src/utils/callback.utils.ts +11 -0
  133. package/src/utils/context.utils.ts +49 -0
  134. package/src/utils/event.utils.ts +38 -0
  135. package/src/utils/helpers.utils.ts +22 -0
  136. package/src/utils/index.ts +8 -0
  137. package/src/utils/ref.utils.ts +32 -0
  138. package/src/utils/state.utils.ts +77 -0
  139. package/src/utils/styles.utils.ts +49 -0
@@ -0,0 +1,135 @@
1
+ import { Meta } from "@storybook/blocks";
2
+
3
+ <Meta title="Docs/Introduction" />
4
+
5
+ # React Zoom Pan Pinch
6
+
7
+ <p>
8
+ <a href="https://bettertyped.com/">
9
+ <img src="https://custom-icon-badges.demolab.com/static/v1?label=&message=BetterTyped&color=333&logo=BT" />
10
+ </a>
11
+ <a href="https://www.npmjs.com/package/react-zoom-pan-pinch">
12
+ <img src="https://custom-icon-badges.demolab.com/npm/v/react-zoom-pan-pinch.svg?logo=npm&color=e22121" />
13
+ </a>
14
+ <a href="https://github.com/prc5/react-zoom-pan-pinch">
15
+ <img src="https://custom-icon-badges.demolab.com/github/stars/prc5/react-zoom-pan-pinch?logo=star" />
16
+ </a>
17
+ <a href="https://github.com/prc5/react-zoom-pan-pinch/blob/main/License.md">
18
+ <img src="https://custom-icon-badges.demolab.com/github/license/prc5/react-zoom-pan-pinch?logo=law&color=yellow" />
19
+ </a>
20
+ <a href="https://www.npmjs.com/package/react-zoom-pan-pinch">
21
+ <img src="https://custom-icon-badges.demolab.com/npm/dm/react-zoom-pan-pinch?logoColor=fff&logo=trending-up" />
22
+ </a>
23
+ <a href="https://www.npmjs.com/package/react-zoom-pan-pinch">
24
+ <img src="https://custom-icon-badges.demolab.com/bundlephobia/minzip/react-zoom-pan-pinch?color=E10098&logo=package" />
25
+ </a>
26
+ <a href="https://github.com/prc5/react-zoom-pan-pinch">
27
+ <img src="https://custom-icon-badges.demolab.com/badge/typescript-%23007ACC.svg?logo=typescript&logoColor=white" />
28
+ </a>
29
+ </p>
30
+
31
+ > Super fast and light React library for zooming, panning, and pinching HTML
32
+ > elements with ease.
33
+
34
+ ## Key Features
35
+
36
+ - **Fast and lightweight** — no external dependencies
37
+ - **Touch, trackpad, and mouse** — full gesture support across devices
38
+ - **Render props and hooks** — flexible API for any component architecture
39
+ - **Highly customizable** — animations, bounds, velocity, padding, and more
40
+ - **Advanced components** — `KeepScale`, `MiniMap`, and programmatic controls
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ npm install react-zoom-pan-pinch
46
+ ```
47
+
48
+ or
49
+
50
+ ```bash
51
+ yarn add react-zoom-pan-pinch
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ The simplest setup — wrap any content with `TransformWrapper` and
57
+ `TransformComponent`:
58
+
59
+ ```tsx
60
+ import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
61
+
62
+ const App = () => (
63
+ <TransformWrapper>
64
+ <TransformComponent>
65
+ <img src="image.jpg" alt="Zoomable" />
66
+ </TransformComponent>
67
+ </TransformWrapper>
68
+ );
69
+ ```
70
+
71
+ ## With Controls (Render Props)
72
+
73
+ Access zoom/pan handlers through render props:
74
+
75
+ ```tsx
76
+ import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
77
+
78
+ const App = () => (
79
+ <TransformWrapper initialScale={1} initialPositionX={200} initialPositionY={100}>
80
+ {({ zoomIn, zoomOut, resetTransform }) => (
81
+ <>
82
+ <div className="tools">
83
+ <button onClick={() => zoomIn()}>+</button>
84
+ <button onClick={() => zoomOut()}>-</button>
85
+ <button onClick={() => resetTransform()}>x</button>
86
+ </div>
87
+ <TransformComponent>
88
+ <img src="image.jpg" alt="Zoomable" />
89
+ </TransformComponent>
90
+ </>
91
+ )}
92
+ </TransformWrapper>
93
+ );
94
+ ```
95
+
96
+ ## With Ref and zoomToElement
97
+
98
+ Use a ref for imperative access outside of render props:
99
+
100
+ ```tsx
101
+ import { useRef } from "react";
102
+ import {
103
+ TransformWrapper,
104
+ TransformComponent,
105
+ ReactZoomPanPinchRef,
106
+ } from "react-zoom-pan-pinch";
107
+
108
+ const App = () => {
109
+ const ref = useRef<ReactZoomPanPinchRef | null>(null);
110
+
111
+ const focusImage = () => {
112
+ ref.current?.zoomToElement("imgExample");
113
+ };
114
+
115
+ return (
116
+ <TransformWrapper ref={ref}>
117
+ {({ zoomIn, zoomOut, resetTransform }) => (
118
+ <>
119
+ <button onClick={() => zoomIn()}>+</button>
120
+ <button onClick={() => zoomOut()}>-</button>
121
+ <button onClick={() => resetTransform()}>x</button>
122
+ <TransformComponent>
123
+ <img src="image.jpg" alt="Zoomable" id="imgExample" />
124
+ <div onClick={focusImage}>Focus image</div>
125
+ </TransformComponent>
126
+ </>
127
+ )}
128
+ </TransformWrapper>
129
+ );
130
+ };
131
+ ```
132
+
133
+ ## License
134
+
135
+ MIT © [prc5](https://github.com/prc5)
@@ -0,0 +1,116 @@
1
+ /* eslint-disable react/no-array-index-key, no-nested-ternary, no-plusplus */
2
+ import React from "react";
3
+
4
+ import type { ControlsOptionsType } from "./props";
5
+
6
+ import styles from "./docs.module.css";
7
+
8
+ type Group = {
9
+ header: ControlsOptionsType | null;
10
+ children: ControlsOptionsType[];
11
+ };
12
+
13
+ export function PropTable({
14
+ rows,
15
+ title,
16
+ }: {
17
+ rows: ControlsOptionsType[];
18
+ title: string;
19
+ }) {
20
+ const groups: Group[] = [];
21
+ let current: Group | null = null;
22
+
23
+ rows.forEach((row) => {
24
+ if (row.isObjectRow) {
25
+ current = { header: row, children: [] };
26
+ groups.push(current);
27
+ } else if (current) {
28
+ current.children.push(row);
29
+ } else {
30
+ groups.push({ header: null, children: [row] });
31
+ }
32
+ });
33
+
34
+ let rowIndex = 0;
35
+
36
+ return (
37
+ <div className={styles.container}>
38
+ <div className={styles.sectionTitle}>
39
+ <span className={styles.sectionTitleAccent} />
40
+ {title}
41
+ </div>
42
+
43
+ <div className={styles.columnHeader}>
44
+ <span>Property</span>
45
+ <span>Type</span>
46
+ <span>Default</span>
47
+ <span>Description</span>
48
+ </div>
49
+
50
+ {groups.map((group, gi) => {
51
+ if (group.header) rowIndex = 0;
52
+ return (
53
+ <div key={gi}>
54
+ {group.header && (
55
+ <div className={styles.groupHeader}>
56
+ <span className={styles.groupName}>
57
+ {typeof group.header.name === "string"
58
+ ? group.header.name
59
+ : (
60
+ group.header.name as React.ReactElement<{
61
+ children?: React.ReactNode;
62
+ }>
63
+ )?.props?.children ?? ""}
64
+ </span>
65
+ {group.children.length > 0 && (
66
+ <span className={styles.groupCount}>
67
+ {group.children.length} props
68
+ </span>
69
+ )}
70
+ </div>
71
+ )}
72
+
73
+ {group.children.map((row, ri) => {
74
+ const isNested = !!group.header;
75
+ const propName = typeof row.name === "string" ? row.name : null;
76
+ const isAlt = rowIndex++ % 2 === 1;
77
+
78
+ const rowClass = isNested
79
+ ? isAlt
80
+ ? styles.propRowNestedAlt
81
+ : styles.propRowNested
82
+ : isAlt
83
+ ? styles.propRowAlt
84
+ : styles.propRow;
85
+
86
+ return (
87
+ <div key={ri} className={rowClass}>
88
+ <span className={styles.propName}>
89
+ {isNested && <span className={styles.nestDot}>.</span>}
90
+ {propName ?? row.name}
91
+ </span>
92
+
93
+ <span className={styles.typeText}>
94
+ {row.type.filter(Boolean).join(" | ")}
95
+ </span>
96
+
97
+ <span>
98
+ {row.defaultValue && row.defaultValue !== "" ? (
99
+ <span className={styles.defaultText}>
100
+ {row.defaultValue}
101
+ </span>
102
+ ) : (
103
+ <span className={styles.defaultEmpty}>—</span>
104
+ )}
105
+ </span>
106
+
107
+ <span className={styles.description}>{row.description}</span>
108
+ </div>
109
+ );
110
+ })}
111
+ </div>
112
+ );
113
+ })}
114
+ </div>
115
+ );
116
+ }
@@ -0,0 +1,370 @@
1
+ /* ── Shared doc-page styles ── */
2
+
3
+ .container {
4
+ max-width: 880px;
5
+ font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ }
8
+
9
+ /* ── Section title ── */
10
+
11
+ .sectionTitle {
12
+ font-size: 24px;
13
+ font-weight: 800;
14
+ color: #0f172a;
15
+ letter-spacing: -0.03em;
16
+ margin: 0 0 20px;
17
+ display: flex;
18
+ align-items: center;
19
+ gap: 12px;
20
+ }
21
+
22
+ .sectionTitleAccent {
23
+ display: inline-block;
24
+ width: 4px;
25
+ height: 24px;
26
+ border-radius: 2px;
27
+ background: linear-gradient(180deg, #6366f1, #a78bfa);
28
+ flex-shrink: 0;
29
+ }
30
+
31
+ /* ── Props table ── */
32
+
33
+ .columnHeader {
34
+ display: grid;
35
+ grid-template-columns: 180px 150px 90px 1fr;
36
+ gap: 0 20px;
37
+ padding: 0 16px 8px;
38
+ margin-top: 4px;
39
+ font-size: 10px;
40
+ font-weight: 800;
41
+ letter-spacing: 0.12em;
42
+ text-transform: uppercase;
43
+ color: #94a3b8;
44
+ border-bottom: 2px solid #e2e8f0;
45
+ }
46
+
47
+ .groupHeader {
48
+ margin-top: 8px;
49
+ padding: 10px 16px;
50
+ background: linear-gradient(135deg, #4f46e5, #7c3aed);
51
+ display: flex;
52
+ align-items: center;
53
+ gap: 12px;
54
+ border-radius: 8px;
55
+ }
56
+
57
+ .groupName {
58
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
59
+ font-size: 13px;
60
+ font-weight: 700;
61
+ color: #ffffff;
62
+ letter-spacing: 0.01em;
63
+ }
64
+
65
+ .groupCount {
66
+ font-size: 10px;
67
+ font-weight: 700;
68
+ color: rgba(255, 255, 255, 0.7);
69
+ background: rgba(255, 255, 255, 0.15);
70
+ padding: 2px 9px;
71
+ border-radius: 99px;
72
+ letter-spacing: 0.04em;
73
+ }
74
+
75
+ .propRow {
76
+ display: grid;
77
+ grid-template-columns: 180px 150px 90px 1fr;
78
+ gap: 0 20px;
79
+ padding: 8px 16px;
80
+ border-bottom: 1px solid #f1f5f9;
81
+ align-items: baseline;
82
+ transition: background 0.1s ease;
83
+ }
84
+
85
+ .propRowAlt {
86
+ composes: propRow;
87
+ background: #fafbfd;
88
+ }
89
+
90
+ .propRow:hover,
91
+ .propRowAlt:hover {
92
+ background: #f5f3ff;
93
+ }
94
+
95
+ .propRowNested {
96
+ composes: propRow;
97
+ padding-left: 32px;
98
+ }
99
+
100
+ .propRowNestedAlt {
101
+ composes: propRowNested;
102
+ background: #fafbfd;
103
+ }
104
+
105
+ .propRowNested:hover,
106
+ .propRowNestedAlt:hover {
107
+ background: #f5f3ff;
108
+ }
109
+
110
+ .propName {
111
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
112
+ font-size: 12.5px;
113
+ font-weight: 600;
114
+ color: #0f172a;
115
+ word-break: break-word;
116
+ line-height: 1.5;
117
+ }
118
+
119
+ .nestDot {
120
+ color: #a78bfa;
121
+ margin-right: 1px;
122
+ font-weight: 400;
123
+ }
124
+
125
+ .typeText {
126
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
127
+ font-size: 12px;
128
+ font-weight: 500;
129
+ color: #6366f1;
130
+ line-height: 1.5;
131
+ word-break: break-all;
132
+ }
133
+
134
+ .defaultText {
135
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
136
+ font-size: 12px;
137
+ font-weight: 500;
138
+ color: #475569;
139
+ line-height: 1.5;
140
+ }
141
+
142
+ .defaultEmpty {
143
+ font-size: 12px;
144
+ color: #d1d5db;
145
+ user-select: none;
146
+ }
147
+
148
+ .description {
149
+ font-size: 12.5px;
150
+ line-height: 1.55;
151
+ color: #64748b;
152
+ }
153
+
154
+ /* ── Handler cards ── */
155
+
156
+ .handlersIntro {
157
+ font-size: 14px;
158
+ line-height: 1.7;
159
+ color: #475569;
160
+ margin: 0 0 24px;
161
+ }
162
+
163
+ .handlersIntroHook {
164
+ display: inline-block;
165
+ padding: 1px 7px;
166
+ border-radius: 4px;
167
+ background: #f1f5f9;
168
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
169
+ font-size: 12px;
170
+ font-weight: 600;
171
+ color: #6366f1;
172
+ vertical-align: baseline;
173
+ }
174
+
175
+ .handlerGrid {
176
+ display: flex;
177
+ flex-direction: column;
178
+ gap: 16px;
179
+ }
180
+
181
+ .handlerCard {
182
+ border-radius: 12px;
183
+ background: #ffffff;
184
+ border: 1px solid #e2e8f0;
185
+ overflow: hidden;
186
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
187
+ transition: box-shadow 0.2s ease, transform 0.2s ease;
188
+ }
189
+
190
+ .handlerCard:hover {
191
+ box-shadow: 0 8px 30px rgba(99, 102, 241, 0.1), 0 1px 4px rgba(0, 0, 0, 0.04);
192
+ transform: translateY(-1px);
193
+ }
194
+
195
+ .handlerCardHeader {
196
+ background: linear-gradient(135deg, #4f46e5, #7c3aed);
197
+ padding: 12px 20px;
198
+ display: flex;
199
+ align-items: center;
200
+ justify-content: space-between;
201
+ }
202
+
203
+ .handlerName {
204
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
205
+ font-size: 15px;
206
+ font-weight: 700;
207
+ color: #ffffff;
208
+ letter-spacing: -0.01em;
209
+ }
210
+
211
+ .handlerNameParams {
212
+ color: rgba(255, 255, 255, 0.55);
213
+ font-weight: 400;
214
+ }
215
+
216
+ .handlerBadge {
217
+ font-size: 9px;
218
+ font-weight: 700;
219
+ color: rgba(255, 255, 255, 0.6);
220
+ background: rgba(255, 255, 255, 0.12);
221
+ padding: 2px 8px;
222
+ border-radius: 99px;
223
+ text-transform: uppercase;
224
+ letter-spacing: 0.08em;
225
+ }
226
+
227
+ .handlerCardBody {
228
+ padding: 16px 20px;
229
+ }
230
+
231
+ .paramsTable {
232
+ width: 100%;
233
+ border-collapse: collapse;
234
+ margin-bottom: 12px;
235
+ }
236
+
237
+ .paramsTableHeader {
238
+ font-size: 10px;
239
+ font-weight: 700;
240
+ letter-spacing: 0.1em;
241
+ text-transform: uppercase;
242
+ color: #94a3b8;
243
+ text-align: left;
244
+ padding: 0 0 6px;
245
+ border-bottom: 1px solid #f1f5f9;
246
+ }
247
+
248
+ .paramsTableCell {
249
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
250
+ font-size: 12px;
251
+ font-weight: 500;
252
+ color: #334155;
253
+ padding: 5px 12px 5px 0;
254
+ line-height: 1.5;
255
+ border-bottom: 1px solid #f8fafc;
256
+ vertical-align: baseline;
257
+ }
258
+
259
+ .paramsTableCellName {
260
+ composes: paramsTableCell;
261
+ font-weight: 600;
262
+ color: #0f172a;
263
+ }
264
+
265
+ .paramsTableCellType {
266
+ composes: paramsTableCell;
267
+ color: #6366f1;
268
+ }
269
+
270
+ .paramsTableCellDefault {
271
+ composes: paramsTableCell;
272
+ color: #64748b;
273
+ }
274
+
275
+ .handlerDescription {
276
+ margin: 0 0 12px;
277
+ font-size: 13px;
278
+ line-height: 1.6;
279
+ color: #475569;
280
+ }
281
+
282
+ .signatureBlock {
283
+ padding: 10px 14px;
284
+ border-radius: 6px;
285
+ background: #f8fafc;
286
+ border: 1px solid #f1f5f9;
287
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
288
+ font-size: 11.5px;
289
+ font-weight: 400;
290
+ color: #94a3b8;
291
+ line-height: 1.6;
292
+ overflow-x: auto;
293
+ }
294
+
295
+ /* ── Reusable doc table ── */
296
+
297
+ .docTable {
298
+ width: 100%;
299
+ border-collapse: collapse;
300
+ font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
301
+ font-size: 13px;
302
+ border: 1px solid #e2e8f0;
303
+ border-radius: 8px;
304
+ overflow: hidden;
305
+ }
306
+
307
+ .docTableHeadRow {
308
+ background: #f8fafc;
309
+ border-bottom: 2px solid #e2e8f0;
310
+ text-align: left;
311
+ }
312
+
313
+ .docTableTh {
314
+ padding: 10px 16px;
315
+ color: #64748b;
316
+ font-size: 11px;
317
+ font-weight: 700;
318
+ letter-spacing: 0.06em;
319
+ text-transform: uppercase;
320
+ }
321
+
322
+ .docTableRow {
323
+ border-bottom: 1px solid #f1f5f9;
324
+ transition: background 0.1s ease;
325
+ }
326
+
327
+ .docTableRowAlt {
328
+ composes: docTableRow;
329
+ background: #fafbfd;
330
+ }
331
+
332
+ .docTableRow:hover,
333
+ .docTableRowAlt:hover {
334
+ background: #f5f3ff;
335
+ }
336
+
337
+ .docTableCellName {
338
+ padding: 10px 16px;
339
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
340
+ font-size: 12.5px;
341
+ font-weight: 600;
342
+ color: #0f172a;
343
+ vertical-align: baseline;
344
+ }
345
+
346
+ .docTableCellType {
347
+ padding: 10px 16px;
348
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
349
+ font-size: 12px;
350
+ font-weight: 500;
351
+ color: #6366f1;
352
+ vertical-align: baseline;
353
+ }
354
+
355
+ .docTableCellDefault {
356
+ padding: 10px 16px;
357
+ font-family: "SF Mono", "Fira Code", "JetBrains Mono", ui-monospace, monospace;
358
+ font-size: 12px;
359
+ font-weight: 500;
360
+ color: #475569;
361
+ vertical-align: baseline;
362
+ }
363
+
364
+ .docTableCellText {
365
+ padding: 10px 16px;
366
+ font-size: 12.5px;
367
+ color: #475569;
368
+ line-height: 1.55;
369
+ vertical-align: baseline;
370
+ }
@@ -0,0 +1,7 @@
1
+ import { Meta } from "@storybook/blocks";
2
+ import { getHandlersTable } from "./handlers.tsx";
3
+ import { HandlerCards } from "./HandlerCards.tsx";
4
+
5
+ <Meta title="Docs/Handlers" />
6
+
7
+ <HandlerCards rows={getHandlersTable()} />