react-zoom-pan-pinch 3.7.0 → 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 +785 -310
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +117 -23
  4. package/dist/index.esm.js +781 -302
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +73 -62
  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,111 @@
1
+ import React from "react";
2
+
3
+ import { ReactZoomPanPinchHandlers } from "../../models/context.model";
4
+
5
+ export type ControlsFnOptionsType = {
6
+ name: React.ReactNode;
7
+ type: string[];
8
+ parameters: string[];
9
+ description: string;
10
+ isObjectRow?: boolean;
11
+ };
12
+
13
+ export type ComponentProps = Record<
14
+ keyof ReactZoomPanPinchHandlers,
15
+ | Omit<ControlsFnOptionsType, "name" | "isObjectRow">
16
+ | Record<string, Omit<ControlsFnOptionsType, "name" | "isObjectRow">>
17
+ >;
18
+
19
+ export const handlersTable: ComponentProps = {
20
+ zoomIn: {
21
+ type: ["function(step, animationTime, animationName)"],
22
+ parameters: [
23
+ "step: number = 0.5",
24
+ "animationTime: number = 300",
25
+ "animationName: string = easeOut",
26
+ ],
27
+ description: "Function used for zoom in button",
28
+ },
29
+ zoomOut: {
30
+ type: ["function(step, animationTime, animationName)"],
31
+ parameters: [
32
+ "step: number = 0.5",
33
+ "animationTime: number = 300",
34
+ "animationName: string = easeOut",
35
+ ],
36
+ description: "Function used for zoom out button",
37
+ },
38
+ setTransform: {
39
+ type: ["function(x, y, scale, animationTime, animationName)"],
40
+ parameters: [
41
+ "x: number",
42
+ "y: number",
43
+ "scale: number",
44
+ "animationTime: number = 300",
45
+ "animationName: string = easeOut",
46
+ ],
47
+ description: "Function used for custom transformation animation",
48
+ },
49
+ resetTransform: {
50
+ type: ["function(animationTime, animationName)"],
51
+ parameters: [
52
+ "animationTime: number = 300",
53
+ "animationName: string = easeOut",
54
+ ],
55
+ description: "Function used for reset button",
56
+ },
57
+ centerView: {
58
+ type: ["function(scale, animationTime, animationName)"],
59
+ parameters: [
60
+ "scale: number = undefined",
61
+ "animationTime: number = 300",
62
+ "animationName: string = easeOut",
63
+ ],
64
+ description: "Function used for centering the content component",
65
+ },
66
+ zoomToElement: {
67
+ type: ["function(node, customZoom, animationTime, animationName)"],
68
+ parameters: [
69
+ "node: HTMLElement | string",
70
+ "customScale: number = undefined",
71
+ "animationTime: number = 300",
72
+ "animationName: string = easeOut",
73
+ ],
74
+ description:
75
+ "This function make a transition for certain node provided to the function(as node element or it's id string). It allows only to zoom elements with offsetWidth and offsetHeight properties - since SVG's doesn't have those, it is impossible to perform it on such elements.",
76
+ },
77
+ };
78
+
79
+ export const getHandlersTable = (): ControlsFnOptionsType[] => {
80
+ return (Object.keys(handlersTable) as (keyof ComponentProps)[]).reduce<
81
+ ControlsFnOptionsType[]
82
+ >((acc, key) => {
83
+ const entry = handlersTable[key];
84
+ if ("type" in entry && Array.isArray(entry.type)) {
85
+ acc.push({
86
+ ...(entry as Omit<ControlsFnOptionsType, "name" | "isObjectRow">),
87
+ name: key,
88
+ });
89
+ } else {
90
+ const nested = entry as Record<
91
+ string,
92
+ Omit<ControlsFnOptionsType, "name" | "isObjectRow">
93
+ >;
94
+ Object.keys(nested).forEach((prop) => {
95
+ acc.push({
96
+ ...nested[prop],
97
+ isObjectRow: key === prop,
98
+ name:
99
+ key === prop ? (
100
+ <b>{prop}</b>
101
+ ) : (
102
+ <>
103
+ {key}.<b>{prop}</b>
104
+ </>
105
+ ),
106
+ });
107
+ });
108
+ }
109
+ return acc;
110
+ }, []);
111
+ };
@@ -0,0 +1,11 @@
1
+ import { Meta } from "@storybook/blocks";
2
+ import { componentProps, wrapperProps } from "./props.tsx";
3
+ import { PropTable } from "./PropTable.tsx";
4
+
5
+ <Meta title="Docs/Props" />
6
+
7
+ <PropTable rows={componentProps} title="TransformComponent Props" />
8
+
9
+ <br />
10
+
11
+ <PropTable rows={wrapperProps} title="TransformWrapper Props" />
@@ -0,0 +1,571 @@
1
+ import React from "react";
2
+
3
+ import { ReactZoomPanPinchProps } from "models";
4
+ import { initialSetup, initialState } from "../../constants/state.constants";
5
+ import { animations } from "../../core/animations/animations.constants";
6
+
7
+ export type ControlsOptionsType = {
8
+ name: React.ReactNode;
9
+ type: string[];
10
+ defaultValue: string;
11
+ description: string;
12
+ isObjectRow?: boolean;
13
+ };
14
+
15
+ export type ComponentProps = Record<
16
+ keyof Omit<ReactZoomPanPinchProps, "children">,
17
+ | Omit<ControlsOptionsType, "name" | "isObjectRow">
18
+ | Record<string, Omit<ControlsOptionsType, "name" | "isObjectRow">>
19
+ >;
20
+
21
+ const getPropsTable = (propsTable: any): ControlsOptionsType[] => {
22
+ return Object.keys(propsTable).reduce<ControlsOptionsType[]>((acc, key) => {
23
+ if (Array.isArray(propsTable[key]?.type)) {
24
+ acc.push({
25
+ ...propsTable[key],
26
+ name: key,
27
+ });
28
+ } else {
29
+ Object.keys(propsTable[key]).forEach((prop) => {
30
+ acc.push({
31
+ ...propsTable[key][prop],
32
+ isObjectRow: key === prop,
33
+ name:
34
+ key === prop ? (
35
+ <b>{prop}</b>
36
+ ) : (
37
+ <>
38
+ {key}.<b>{prop}</b>
39
+ </>
40
+ ),
41
+ });
42
+ });
43
+ }
44
+ return acc;
45
+ }, []);
46
+ };
47
+
48
+ export const componentPropsTable: Record<
49
+ string,
50
+ Omit<ControlsOptionsType, "name">
51
+ > = {
52
+ wrapperClass: {
53
+ type: ["string"],
54
+ defaultValue: "''",
55
+ description: "Wrapper element class",
56
+ },
57
+ contentClass: {
58
+ type: ["string"],
59
+ defaultValue: "''",
60
+ description: "Content element class",
61
+ },
62
+ wrapperStyle: {
63
+ type: ["ReactCSSProperties"],
64
+ defaultValue: "undefined",
65
+ description: "Wrapper element style object",
66
+ },
67
+ contentStyle: {
68
+ type: ["ReactCSSProperties"],
69
+ defaultValue: "undefined",
70
+ description: "Content element style object",
71
+ },
72
+ };
73
+
74
+ export const wrapperPropsTable: ComponentProps = {
75
+ ref: {
76
+ type: ["React.Ref<ReactZoomPanPinchRef>"],
77
+ defaultValue: "undefined",
78
+ description: "Get ref value of the react-zoom-pan-pinch context",
79
+ },
80
+ initialScale: {
81
+ type: ["number"],
82
+ defaultValue: String(initialState.scale),
83
+ description:
84
+ "Scale used only as initial value. It will be also used when triggering resetTransform() method or double click feature with 'reset' mode.",
85
+ },
86
+ initialPositionX: {
87
+ type: ["number"],
88
+ defaultValue: String(initialState.positionX),
89
+ description:
90
+ "Position X used only as initial value. It will be also used when triggering resetTransform() method or double click feature with 'reset' mode. Value should be provided in px.",
91
+ },
92
+ initialPositionY: {
93
+ type: ["number"],
94
+ defaultValue: String(initialState.positionY),
95
+ description:
96
+ "Position Y used only as initial value. It will be also used when triggering resetTransform() method or double click feature with 'reset' mode. Value should be provided in px.",
97
+ },
98
+ disabled: {
99
+ type: ["boolean"],
100
+ defaultValue: String(initialSetup.disabled),
101
+ description:
102
+ "This is 'global' disable props. Setting it as a 'true' value blocks all functionalities of library. For disabling parts of it like panning, zooming, pinch - checkout the dedicated sections below.",
103
+ },
104
+ minPositionX: {
105
+ type: ["number"],
106
+ defaultValue: String(initialSetup.minPositionX),
107
+ description:
108
+ "Bounding position which will limit the transformation to given value. Value should be provided in px.",
109
+ },
110
+ maxPositionX: {
111
+ type: ["number"],
112
+ defaultValue: String(initialSetup.maxPositionX),
113
+ description:
114
+ "Bounding position which will limit the transformation to given value. Value should be provided in px.",
115
+ },
116
+ minPositionY: {
117
+ type: ["number"],
118
+ defaultValue: String(initialSetup.minPositionY),
119
+ description:
120
+ "Bounding position which will limit the transformation to given value. Value should be provided in px.",
121
+ },
122
+ maxPositionY: {
123
+ type: ["number"],
124
+ defaultValue: String(initialSetup.minPositionY),
125
+ description:
126
+ "Bounding position which will limit the transformation to given value. Value should be provided in px.",
127
+ },
128
+ minScale: {
129
+ type: ["number"],
130
+ defaultValue: String(initialSetup.minScale),
131
+ description: "Bounding position which will limit the scale to given value",
132
+ },
133
+ maxScale: {
134
+ type: ["number"],
135
+ defaultValue: String(initialSetup.maxScale),
136
+ description: "Bounding position which will limit the scale to given value",
137
+ },
138
+ limitToBounds: {
139
+ type: ["boolean"],
140
+ defaultValue: String(initialSetup.limitToBounds),
141
+ description:
142
+ "Prop used to block panning/zooming outside of the scaled element, so the library will always keep it inside the wrapper view.",
143
+ },
144
+ centerZoomedOut: {
145
+ type: ["boolean"],
146
+ defaultValue: String(initialSetup.centerZoomedOut),
147
+ description:
148
+ "When the zoom goes under the 1 value, the library will keep the content component always in the center. Setting it to false will allow to move the scaled element.",
149
+ },
150
+ centerOnInit: {
151
+ type: ["boolean"],
152
+ defaultValue: String(initialSetup.centerOnInit),
153
+ description:
154
+ "When the prop is set to truth the content component will get centered based on the size of it's wrapper.",
155
+ },
156
+ disablePadding: {
157
+ type: ["boolean"],
158
+ defaultValue: String(initialSetup.disablePadding),
159
+ description:
160
+ "Used to disable panning, zooming boundary padding effect. By enabling this option, you will not be able to zoom outside the image area.",
161
+ },
162
+ customTransform: {
163
+ type: ["function"],
164
+ defaultValue: "undefined",
165
+ description:
166
+ "We can provide custom transform function to provide different way of handling our transform logic. If we need performance we can import getMatrixTransformStyles functions and replace default one. WARNING: default transform prevents svg blur on the safari.",
167
+ },
168
+ smooth: {
169
+ type: ["boolean"],
170
+ defaultValue: String(initialSetup.smooth),
171
+ description:
172
+ "Enable smooth scrolling by multiplying the scroll delta with the smooth step factor.",
173
+ },
174
+ detached: {
175
+ type: ["boolean"],
176
+ defaultValue: String(initialSetup.smooth),
177
+ description:
178
+ "Allows to prevent CSS being applied to content element. It allows to add the functionality to canvas with some custom transforming logic.",
179
+ },
180
+ wheel: {
181
+ wheel: {
182
+ type: [""],
183
+ defaultValue: "",
184
+ description: "",
185
+ },
186
+ step: {
187
+ type: ["number"],
188
+ defaultValue: String(initialSetup.wheel.step),
189
+ description: "The sensitivity of zooming with the wheel/touchpad.",
190
+ },
191
+ disabled: {
192
+ type: ["boolean"],
193
+ defaultValue: String(initialSetup.wheel.disabled),
194
+ description:
195
+ "Disable the mouse wheel and touchpad zooming functionalities, it will NOT affect pinching.",
196
+ },
197
+ wheelDisabled: {
198
+ type: ["boolean"],
199
+ defaultValue: String(initialSetup.wheel.wheelDisabled),
200
+ description:
201
+ "Disable only mouse wheel zooming functionality, it will NOT affect pinching and touchpad.",
202
+ },
203
+ touchPadDisabled: {
204
+ type: ["boolean"],
205
+ defaultValue: String(initialSetup.wheel.touchPadDisabled),
206
+ description:
207
+ "Disable only touchpad zooming functionality, it will NOT affect pinching and mouse wheel.",
208
+ },
209
+ activationKeys: {
210
+ type: ["string[]"],
211
+ defaultValue: String(initialSetup.wheel.activationKeys),
212
+ description:
213
+ "List of keys which, when held down, should activate this feature.",
214
+ },
215
+ excluded: {
216
+ type: ["string[]"],
217
+ defaultValue: String(initialSetup.wheel.excluded),
218
+ description:
219
+ "List of the class names or tags that should not activate this feature. (E.g. ['my-custom-class-name', 'div', 'a'])",
220
+ },
221
+ },
222
+ panning: {
223
+ panning: {
224
+ type: [""],
225
+ defaultValue: "",
226
+ description: "",
227
+ },
228
+ disabled: {
229
+ type: ["boolean"],
230
+ defaultValue: String(initialSetup.panning.disabled),
231
+ description: "Disable the panning feature.",
232
+ },
233
+ lockAxisX: {
234
+ type: ["boolean"],
235
+ defaultValue: String(initialSetup.panning.lockAxisX),
236
+ description:
237
+ "Disable the panning feature for the X axis (prevents horizontal panning).",
238
+ },
239
+ lockAxisY: {
240
+ type: ["boolean"],
241
+ defaultValue: String(initialSetup.panning.lockAxisY),
242
+ description:
243
+ "Disable the panning feature for the Y axis (prevents vertical panning).",
244
+ },
245
+ allowLeftClickPan: {
246
+ type: ["boolean"],
247
+ defaultValue: String(initialSetup.panning.allowLeftClickPan),
248
+ description: "Allow left click to initiate panning",
249
+ },
250
+ allowMiddleClickPan: {
251
+ type: ["boolean"],
252
+ defaultValue: String(initialSetup.panning.allowMiddleClickPan),
253
+ description: "Allow middle click to initiate panning",
254
+ },
255
+ allowRightClickPan: {
256
+ type: ["boolean"],
257
+ defaultValue: String(initialSetup.panning.allowRightClickPan),
258
+ description: "Allow right click to initiate panning",
259
+ },
260
+ activationKeys: {
261
+ type: ["string[]"],
262
+ defaultValue: String(initialSetup.panning.activationKeys),
263
+ description:
264
+ "List of keys which, when held down, should activate this feature.",
265
+ },
266
+ excluded: {
267
+ type: ["string[]"],
268
+ defaultValue: String(initialSetup.panning.excluded),
269
+ description:
270
+ "List of the class names or tags that should not activate this feature. (E.g. ['my-custom-class-name', 'div', 'a'])",
271
+ },
272
+ },
273
+ pinch: {
274
+ pinch: {
275
+ type: [""],
276
+ defaultValue: "",
277
+ description: "",
278
+ },
279
+ step: {
280
+ type: ["number"],
281
+ defaultValue: String(initialSetup.pinch.step),
282
+ description: "The sensitivity of zooming with the wheel/touchpad.",
283
+ },
284
+ disabled: {
285
+ type: ["boolean"],
286
+ defaultValue: String(initialSetup.pinch.disabled),
287
+ description:
288
+ "Disable the pinching zoom functionality, it will NOT affect mouse wheel/touchpad zooming.",
289
+ },
290
+ excluded: {
291
+ type: ["string[]"],
292
+ defaultValue: String(initialSetup.pinch.excluded),
293
+ description:
294
+ "List of the class names or tags that should not activate this feature. (E.g. ['my-custom-class-name', 'div', 'a'])",
295
+ },
296
+ },
297
+ trackPadPanning: {
298
+ trackPadPanning: {
299
+ type: [""],
300
+ defaultValue: "",
301
+ description: "",
302
+ },
303
+ disabled: {
304
+ type: ["boolean"],
305
+ defaultValue: String(initialSetup.panning.disabled),
306
+ description: "Disable the panning feature.",
307
+ },
308
+ lockAxisX: {
309
+ type: ["boolean"],
310
+ defaultValue: String(initialSetup.panning.lockAxisX),
311
+ description:
312
+ "Disable the panning feature for the X axis (prevents horizontal panning).",
313
+ },
314
+ lockAxisY: {
315
+ type: ["boolean"],
316
+ defaultValue: String(initialSetup.panning.lockAxisY),
317
+ description:
318
+ "Disable the panning feature for the Y axis (prevents vertical panning).",
319
+ },
320
+ activationKeys: {
321
+ type: ["string[]"],
322
+ defaultValue: String(initialSetup.panning.activationKeys),
323
+ description:
324
+ "List of keys which, when held down, should activate this feature.",
325
+ },
326
+ excluded: {
327
+ type: ["string[]"],
328
+ defaultValue: String(initialSetup.panning.excluded),
329
+ description:
330
+ "List of the class names or tags that should not activate this feature. (E.g. ['my-custom-class-name', 'div', 'a'])",
331
+ },
332
+ },
333
+ doubleClick: {
334
+ doubleClick: {
335
+ type: [""],
336
+ defaultValue: "",
337
+ description: "",
338
+ },
339
+ disabled: {
340
+ type: ["boolean"],
341
+ defaultValue: String(initialSetup.doubleClick.disabled),
342
+ description: "Disable the double click feature.",
343
+ },
344
+ step: {
345
+ type: ["number"],
346
+ defaultValue: String(initialSetup.doubleClick.step),
347
+ description:
348
+ "The sensitivity of zooming in or out when the double click mode is set to 'zoomIn' or 'zoomOut'.",
349
+ },
350
+ mode: {
351
+ type: ["zoomIn", "zoomOut", "reset", "toggle"],
352
+ defaultValue: String(initialSetup.doubleClick.mode),
353
+ description:
354
+ "The mode of the double click feature. Zoom in/Zoom out will change the scale with the given step settings. The reset functionality will take change transform to the initial values. The toggle functionality will toggle between zooming in and out.",
355
+ },
356
+ animationTime: {
357
+ type: ["number"],
358
+ defaultValue: String(initialSetup.doubleClick.animationTime),
359
+ description: "Time of the triggered double click animation.",
360
+ },
361
+ animationType: {
362
+ type: Object.keys(animations),
363
+ defaultValue: String(initialSetup.doubleClick.animationType),
364
+ description: "Animations types to choose from.",
365
+ },
366
+ excluded: {
367
+ type: ["string[]"],
368
+ defaultValue: String(initialSetup.doubleClick.excluded),
369
+ description:
370
+ "List of the class names or tags that should not activate this feature. (E.g. ['my-custom-class-name', 'div', 'a'])",
371
+ },
372
+ },
373
+ zoomAnimation: {
374
+ zoomAnimation: {
375
+ type: [""],
376
+ defaultValue: "",
377
+ description: "",
378
+ },
379
+ disabled: {
380
+ type: ["boolean"],
381
+ defaultValue: String(initialSetup.zoomAnimation.disabled),
382
+ description: "Disable the double click feature.",
383
+ },
384
+ size: {
385
+ type: ["number"],
386
+ defaultValue: String(initialSetup.zoomAnimation.size),
387
+ description:
388
+ "Thanks to size, we can control the zoom out values larger than that controlled by the value of another 'minScale' prop. This results in an animated return of the value to the minimum scale when the zooming has finished. This works for both touchpad zooming and pinching.",
389
+ },
390
+ animationTime: {
391
+ type: ["number"],
392
+ defaultValue: String(initialSetup.zoomAnimation.animationTime),
393
+ description: "Time of the triggered double click animation.",
394
+ },
395
+ animationType: {
396
+ type: Object.keys(animations),
397
+ defaultValue: String(initialSetup.zoomAnimation.animationType),
398
+ description: "Animations types to choose from.",
399
+ },
400
+ },
401
+ autoAlignment: {
402
+ autoAlignment: {
403
+ type: [""],
404
+ defaultValue: "",
405
+ description: "",
406
+ },
407
+ disabled: {
408
+ type: ["boolean"],
409
+ defaultValue: String(initialSetup.autoAlignment.disabled),
410
+ description: "Disable the double click feature.",
411
+ },
412
+ sizeX: {
413
+ type: ["number"],
414
+ defaultValue: String(initialSetup.autoAlignment.sizeX),
415
+ description:
416
+ "Thanks to size, we can control the movement of our content component beyond the calculated limits. This results in an animation of a fallback to the closest accepted limits, however, this is only possible when the other 'limitToBounds' prop is set to true.",
417
+ },
418
+ sizeY: {
419
+ type: ["number"],
420
+ defaultValue: String(initialSetup.autoAlignment.sizeY),
421
+ description:
422
+ "Thanks to size, we can control the movement of our content component beyond the calculated limits. This results in an animation of a fallback to the closest accepted limits, however, this is only possible when the other 'limitToBounds' prop is set to true.",
423
+ },
424
+ velocityAlignmentTime: {
425
+ type: ["number"],
426
+ defaultValue: String(initialSetup.autoAlignment.animationTime),
427
+ description:
428
+ "Time of the velocity alignment animation. It is fired when acceleration begins when we are outside the wrapper limits (in the area defined by the above prop size)",
429
+ },
430
+ animationTime: {
431
+ type: ["number"],
432
+ defaultValue: String(initialSetup.autoAlignment.animationTime),
433
+ description: "Time of the alignment animation.",
434
+ },
435
+ animationType: {
436
+ type: Object.keys(animations),
437
+ defaultValue: String(initialSetup.autoAlignment.animationType),
438
+ description: "Animations types to choose from.",
439
+ },
440
+ },
441
+ velocityAnimation: {
442
+ velocityAnimation: {
443
+ type: [""],
444
+ defaultValue: "",
445
+ description: "",
446
+ },
447
+ disabled: {
448
+ type: ["boolean"],
449
+ defaultValue: String(initialSetup.velocityAnimation.disabled),
450
+ description: "Disable the double click feature.",
451
+ },
452
+ sensitivity: {
453
+ type: ["number"],
454
+ defaultValue: String(initialSetup.velocityAnimation.animationTime),
455
+ description:
456
+ "Additional variable that allows you to control the sensitivity of panning velocity",
457
+ },
458
+ maxStrengthMouse: {
459
+ type: ["number"],
460
+ defaultValue: String(initialSetup.velocityAnimation.maxStrengthMouse),
461
+ description:
462
+ "The maximum strength of the velocity animation. The higher the value, the faster the animation will be allowed. Affecting only mouse/trackpad interactions.",
463
+ },
464
+ maxStrengthTouch: {
465
+ type: ["number"],
466
+ defaultValue: String(initialSetup.velocityAnimation.maxStrengthTouch),
467
+ description:
468
+ "The maximum strength of the velocity animation. The higher the value, the faster the animation will be allowed. Affecting only touch interactions.",
469
+ },
470
+ inertia: {
471
+ type: ["number"],
472
+ defaultValue: String(initialSetup.velocityAnimation.inertia),
473
+ description:
474
+ "Allows for defining longer animation time which is equal to the panning move we made. Setting it to '0' disables the inertia effect.",
475
+ },
476
+ animationTime: {
477
+ type: ["number"],
478
+ defaultValue: String(initialSetup.velocityAnimation.animationTime),
479
+ description:
480
+ "Time of the animation when the velocity is triggered. It could be longer depending on the enabled inertia effect.",
481
+ },
482
+ maxAnimationTime: {
483
+ type: ["number"],
484
+ defaultValue: String(initialSetup.velocityAnimation.maxAnimationTime),
485
+ description: "Maximum animation time including inertia effect.",
486
+ },
487
+ animationType: {
488
+ type: Object.keys(animations),
489
+ defaultValue: String(initialSetup.velocityAnimation.animationType),
490
+ description: "Animations types to choose from.",
491
+ },
492
+ },
493
+ onWheelStart: {
494
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
495
+ defaultValue: "undefined",
496
+ description: "Callback fired when wheel/touchpad events are started",
497
+ },
498
+ onWheel: {
499
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
500
+ defaultValue: "undefined",
501
+ description: "Callback fired when wheel/touchpad events are ongoing",
502
+ },
503
+ onWheelStop: {
504
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
505
+ defaultValue: "undefined",
506
+ description: "Callback fired when wheel/touchpad events are finished",
507
+ },
508
+ onPanningStart: {
509
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
510
+ defaultValue: "undefined",
511
+ description: "Callback fired when panning event has started",
512
+ },
513
+ onPanning: {
514
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
515
+ defaultValue: "undefined",
516
+ description: "Callback fired when panning event is ongoing",
517
+ },
518
+ onPanningStop: {
519
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
520
+ defaultValue: "undefined",
521
+ description: "Callback fired when panning event has finished",
522
+ },
523
+ onPinchStart: {
524
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
525
+ defaultValue: "undefined",
526
+ description: "Callback fired when pinch event has started",
527
+ },
528
+ onPinch: {
529
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
530
+ defaultValue: "undefined",
531
+ description: "Callback fired when pinch event is ongoing",
532
+ },
533
+ onPinchStop: {
534
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
535
+ defaultValue: "undefined",
536
+ description: "Callback fired when pinch event has finished",
537
+ },
538
+ onZoomStart: {
539
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
540
+ defaultValue: "undefined",
541
+ description:
542
+ "Callback fired when any of zoom events are started (wheel/touchpad/pinch)",
543
+ },
544
+ onZoom: {
545
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
546
+ defaultValue: "undefined",
547
+ description:
548
+ "Callback fired when any of zoom events are ongoing (wheel/touchpad/pinch)",
549
+ },
550
+ onZoomStop: {
551
+ type: ["(ref: ReactZoomPanPinchRef, event) => void"],
552
+ defaultValue: "undefined",
553
+ description:
554
+ "Callback fired when any of zoom events are finished (wheel/touchpad/pinch)",
555
+ },
556
+ onTransform: {
557
+ type: [
558
+ "(ref: ReactZoomPanPinchRef, state: { scale: number; positionX: number; positionY: number } ) => void",
559
+ ],
560
+ defaultValue: "undefined",
561
+ description: "Callback fired when on each transform",
562
+ },
563
+ onInit: {
564
+ type: ["(ref: ReactZoomPanPinchRef) => void"],
565
+ defaultValue: "undefined",
566
+ description: "Callback fired when components get mounted",
567
+ },
568
+ };
569
+
570
+ export const componentProps = getPropsTable(componentPropsTable);
571
+ export const wrapperProps = getPropsTable(wrapperPropsTable);