react-zoom-pan-pinch 3.3.0 → 3.4.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 (186) hide show
  1. package/dist/index.cjs.js +38 -2
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.esm.js +38 -2
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +4 -1
  7. package/.eslintignore +0 -6
  8. package/.github/CODEOWNERS +0 -36
  9. package/.github/FUNDING.yml +0 -13
  10. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  11. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  12. package/.github/workflows/docs.yml +0 -34
  13. package/.github/workflows/release.yml +0 -46
  14. package/.github/workflows/tests.yml +0 -42
  15. package/.prettierrc +0 -10
  16. package/.releaserc.json +0 -63
  17. package/.storybook/main.js +0 -23
  18. package/.storybook/preview-head.html +0 -5
  19. package/.storybook/preview.js +0 -11
  20. package/.storybook/theme-overrides.css +0 -49
  21. package/CHANGELOG.md +0 -26
  22. package/Code_of_Conduct.md +0 -61
  23. package/Contributing.md +0 -236
  24. package/__tests__/features/props.spec.tsx +0 -11
  25. package/__tests__/features/rendering.spec.tsx +0 -36
  26. package/__tests__/shared/render.shared.tsx +0 -41
  27. package/__tests__/utils/controls.utils.tsx +0 -25
  28. package/__tests__/utils/example.tsx +0 -81
  29. package/commitlint.config.js +0 -1
  30. package/dist/__tests__/features/props.spec.d.ts +0 -1
  31. package/dist/__tests__/features/rendering.spec.d.ts +0 -1
  32. package/dist/__tests__/shared/render.shared.d.ts +0 -11
  33. package/dist/__tests__/utils/controls.utils.d.ts +0 -3
  34. package/dist/__tests__/utils/example.d.ts +0 -6
  35. package/dist/src/components/index.d.ts +0 -4
  36. package/dist/src/components/keep-scale/keep-scale.d.ts +0 -2
  37. package/dist/src/components/mini-map/mini-map.d.ts +0 -8
  38. package/dist/src/components/mini-map/use-resize.hook.d.ts +0 -8
  39. package/dist/src/components/transform-component/transform-component.d.ts +0 -12
  40. package/dist/src/components/transform-wrapper/transform-wrapper.d.ts +0 -5
  41. package/dist/src/constants/state.constants.d.ts +0 -3
  42. package/dist/src/core/animations/animations.constants.d.ts +0 -16
  43. package/dist/src/core/animations/animations.utils.d.ts +0 -4
  44. package/dist/src/core/bounds/bounds.types.d.ts +0 -8
  45. package/dist/src/core/bounds/bounds.utils.d.ts +0 -17
  46. package/dist/src/core/double-click/double-click.logic.d.ts +0 -5
  47. package/dist/src/core/handlers/handlers.logic.d.ts +0 -8
  48. package/dist/src/core/handlers/handlers.utils.d.ts +0 -14
  49. package/dist/src/core/instance.core.d.ts +0 -77
  50. package/dist/src/core/pan/panning.logic.d.ts +0 -5
  51. package/dist/src/core/pan/panning.utils.d.ts +0 -10
  52. package/dist/src/core/pan/velocity.logic.d.ts +0 -5
  53. package/dist/src/core/pan/velocity.utils.d.ts +0 -5
  54. package/dist/src/core/pinch/pinch.logic.d.ts +0 -4
  55. package/dist/src/core/pinch/pinch.utils.d.ts +0 -6
  56. package/dist/src/core/wheel/wheel.logic.d.ts +0 -4
  57. package/dist/src/core/wheel/wheel.utils.d.ts +0 -7
  58. package/dist/src/core/zoom/zoom.logic.d.ts +0 -3
  59. package/dist/src/core/zoom/zoom.utils.d.ts +0 -3
  60. package/dist/src/hooks/index.d.ts +0 -4
  61. package/dist/src/hooks/use-controls.d.ts +0 -2
  62. package/dist/src/hooks/use-transform-context.d.ts +0 -1
  63. package/dist/src/hooks/use-transform-effect.d.ts +0 -2
  64. package/dist/src/hooks/use-transform-init.d.ts +0 -2
  65. package/dist/src/index.d.ts +0 -5
  66. package/dist/src/models/calculations.model.d.ts +0 -25
  67. package/dist/src/models/context.model.d.ts +0 -127
  68. package/dist/src/models/helpers.model.d.ts +0 -5
  69. package/dist/src/models/index.d.ts +0 -3
  70. package/dist/src/stories/docs/handlers.d.ts +0 -12
  71. package/dist/src/stories/docs/props.d.ts +0 -14
  72. package/dist/src/stories/examples/content-rerendering/example.d.ts +0 -2
  73. package/dist/src/stories/examples/image-responsive/example.d.ts +0 -2
  74. package/dist/src/stories/examples/keep-scale/example.d.ts +0 -2
  75. package/dist/src/stories/examples/mini-map/example.d.ts +0 -1
  76. package/dist/src/stories/examples/stress/example.d.ts +0 -2
  77. package/dist/src/stories/examples/svg-zoom-to-element/example.d.ts +0 -2
  78. package/dist/src/stories/examples/zoom-to-element/example.d.ts +0 -2
  79. package/dist/src/stories/types/args.types.d.ts +0 -280
  80. package/dist/src/stories/utils/args.utils.d.ts +0 -3
  81. package/dist/src/stories/utils/code.utils.d.ts +0 -6
  82. package/dist/src/stories/utils/controls.utils.d.ts +0 -3
  83. package/dist/src/stories/utils/index.d.ts +0 -3
  84. package/dist/src/utils/calculations.utils.d.ts +0 -11
  85. package/dist/src/utils/callback.utils.d.ts +0 -2
  86. package/dist/src/utils/context.utils.d.ts +0 -4
  87. package/dist/src/utils/event.utils.d.ts +0 -1
  88. package/dist/src/utils/helpers.utils.d.ts +0 -2
  89. package/dist/src/utils/index.d.ts +0 -8
  90. package/dist/src/utils/ref.utils.d.ts +0 -2
  91. package/dist/src/utils/state.utils.d.ts +0 -3
  92. package/dist/src/utils/styles.utils.d.ts +0 -4
  93. package/jest.config.ts +0 -45
  94. package/rollup.config.js +0 -51
  95. package/src/.eslintrc.json +0 -90
  96. package/src/components/index.ts +0 -4
  97. package/src/components/keep-scale/keep-scale.tsx +0 -28
  98. package/src/components/mini-map/mini-map.tsx +0 -188
  99. package/src/components/mini-map/use-resize.hook.ts +0 -69
  100. package/src/components/transform-component/transform-component.module.css +0 -30
  101. package/src/components/transform-component/transform-component.tsx +0 -61
  102. package/src/components/transform-wrapper/transform-wrapper.tsx +0 -39
  103. package/src/constants/state.constants.ts +0 -77
  104. package/src/core/animations/animations.constants.ts +0 -78
  105. package/src/core/animations/animations.utils.ts +0 -114
  106. package/src/core/bounds/bounds.types.ts +0 -8
  107. package/src/core/bounds/bounds.utils.ts +0 -187
  108. package/src/core/double-click/double-click.logic.ts +0 -116
  109. package/src/core/handlers/handlers.logic.ts +0 -115
  110. package/src/core/handlers/handlers.utils.ts +0 -195
  111. package/src/core/instance.core.ts +0 -503
  112. package/src/core/pan/panning.logic.ts +0 -100
  113. package/src/core/pan/panning.utils.ts +0 -196
  114. package/src/core/pan/velocity.logic.ts +0 -149
  115. package/src/core/pan/velocity.utils.ts +0 -79
  116. package/src/core/pinch/pinch.logic.ts +0 -81
  117. package/src/core/pinch/pinch.utils.ts +0 -88
  118. package/src/core/wheel/wheel.logic.ts +0 -121
  119. package/src/core/wheel/wheel.utils.ts +0 -122
  120. package/src/core/zoom/zoom.logic.ts +0 -69
  121. package/src/core/zoom/zoom.utils.ts +0 -58
  122. package/src/hooks/index.ts +0 -4
  123. package/src/hooks/use-controls.tsx +0 -9
  124. package/src/hooks/use-transform-context.tsx +0 -13
  125. package/src/hooks/use-transform-effect.tsx +0 -22
  126. package/src/hooks/use-transform-init.tsx +0 -27
  127. package/src/index.ts +0 -6
  128. package/src/models/calculations.model.ts +0 -26
  129. package/src/models/context.model.ts +0 -199
  130. package/src/models/helpers.model.ts +0 -15
  131. package/src/models/index.ts +0 -3
  132. package/src/react-app-env.d.ts +0 -1
  133. package/src/stories/assets/big-image.jpeg +0 -0
  134. package/src/stories/assets/map.jpg +0 -0
  135. package/src/stories/assets/medium-image.jpg +0 -0
  136. package/src/stories/assets/pin.svg +0 -1
  137. package/src/stories/assets/small-image.jpg +0 -0
  138. package/src/stories/assets/svg-example.svg +0 -14
  139. package/src/stories/docs/Introduction.stories.mdx +0 -174
  140. package/src/stories/docs/handlers.stories.mdx +0 -48
  141. package/src/stories/docs/handlers.tsx +0 -107
  142. package/src/stories/docs/props.stories.mdx +0 -92
  143. package/src/stories/docs/props.tsx +0 -526
  144. package/src/stories/examples/content/content.stories.mdx +0 -121
  145. package/src/stories/examples/content-rerendering/content-updating.stories.mdx +0 -45
  146. package/src/stories/examples/content-rerendering/example.tsx +0 -73
  147. package/src/stories/examples/controls/controls.stories.mdx +0 -71
  148. package/src/stories/examples/image-big/image-big.stories.mdx +0 -43
  149. package/src/stories/examples/image-medium/image-medium.stories.mdx +0 -41
  150. package/src/stories/examples/image-responsive/example.tsx +0 -103
  151. package/src/stories/examples/image-responsive/image-responsive.stories.mdx +0 -32
  152. package/src/stories/examples/image-small/image-small.stories.mdx +0 -41
  153. package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +0 -46
  154. package/src/stories/examples/keep-scale/example.tsx +0 -92
  155. package/src/stories/examples/keep-scale/keep-scale.stories.mdx +0 -45
  156. package/src/stories/examples/mini-map/example.tsx +0 -54
  157. package/src/stories/examples/mini-map/mini-map.stories.mdx +0 -33
  158. package/src/stories/examples/stress/example.tsx +0 -23
  159. package/src/stories/examples/stress/stress-test.stories.mdx +0 -28
  160. package/src/stories/examples/svg-zoom-to-element/creativity.svg +0 -143
  161. package/src/stories/examples/svg-zoom-to-element/example.tsx +0 -57
  162. package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +0 -28
  163. package/src/stories/examples/zoom-to-element/example.tsx +0 -94
  164. package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +0 -28
  165. package/src/stories/hooks/use-controls.stories.mdx +0 -24
  166. package/src/stories/hooks/use-transform-context.stories.mdx +0 -15
  167. package/src/stories/hooks/use-transform-effect.stories.mdx +0 -29
  168. package/src/stories/hooks/use-transform-init.stories.mdx +0 -25
  169. package/src/stories/types/args.types.ts +0 -211
  170. package/src/stories/utils/args.utils.ts +0 -34
  171. package/src/stories/utils/code.utils.tsx +0 -24
  172. package/src/stories/utils/controls.utils.tsx +0 -43
  173. package/src/stories/utils/index.ts +0 -3
  174. package/src/stories/utils/styles.module.css +0 -34
  175. package/src/styles.css +0 -8
  176. package/src/typings.d.ts +0 -10
  177. package/src/utils/calculations.utils.ts +0 -16
  178. package/src/utils/callback.utils.ts +0 -11
  179. package/src/utils/context.utils.ts +0 -48
  180. package/src/utils/event.utils.ts +0 -22
  181. package/src/utils/helpers.utils.ts +0 -27
  182. package/src/utils/index.ts +0 -8
  183. package/src/utils/ref.utils.ts +0 -16
  184. package/src/utils/state.utils.ts +0 -40
  185. package/src/utils/styles.utils.ts +0 -44
  186. package/tsconfig.json +0 -33
@@ -1,526 +0,0 @@
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
- wheel: {
175
- wheel: {
176
- type: [""],
177
- defaultValue: "",
178
- description: "",
179
- },
180
- step: {
181
- type: ["number"],
182
- defaultValue: String(initialSetup.wheel.step),
183
- description: "The sensitivity of zooming with the wheel/touchpad.",
184
- },
185
- smoothStep: {
186
- type: ["number"],
187
- defaultValue: String(initialSetup.wheel.smoothStep),
188
- description:
189
- "The sensitivity multiplier of zooming with the wheel/touchpad used, instead of the step value, when smooth scrolling is enabled.",
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
- velocityDisabled: {
234
- type: ["boolean"],
235
- defaultValue: String(initialSetup.panning.velocityDisabled),
236
- description:
237
- "Disable the panning velocity feature. It's triggered when you release the mouse button so the content is still moving after it and slowing down with calculated time.",
238
- },
239
- lockAxisX: {
240
- type: ["boolean"],
241
- defaultValue: String(initialSetup.panning.lockAxisX),
242
- description:
243
- "Disable the panning feature for the X axis (prevents horizontal panning).",
244
- },
245
- lockAxisY: {
246
- type: ["boolean"],
247
- defaultValue: String(initialSetup.panning.lockAxisY),
248
- description:
249
- "Disable the panning feature for the Y axis (prevents vertical panning).",
250
- },
251
- allowLeftClickPan: {
252
- type: ["boolean"],
253
- defaultValue: String(initialSetup.panning.allowLeftClickPan),
254
- description:
255
- "Allow left click to initiate panning",
256
- },
257
- allowMiddleClickPan: {
258
- type: ["boolean"],
259
- defaultValue: String(initialSetup.panning.allowMiddleClickPan),
260
- description:
261
- "Allow middle click to initiate panning",
262
- },
263
- allowRightClickPan: {
264
- type: ["boolean"],
265
- defaultValue: String(initialSetup.panning.allowRightClickPan),
266
- description:
267
- "Allow right click to initiate panning",
268
- },
269
- activationKeys: {
270
- type: ["string[]"],
271
- defaultValue: String(initialSetup.panning.activationKeys),
272
- description:
273
- "List of keys which, when held down, should activate this feature.",
274
- },
275
- excluded: {
276
- type: ["string[]"],
277
- defaultValue: String(initialSetup.panning.excluded),
278
- description:
279
- "List of the class names or tags that should not activate this feature. (E.g. ['my-custom-class-name', 'div', 'a'])",
280
- },
281
- },
282
- pinch: {
283
- pinch: {
284
- type: [""],
285
- defaultValue: "",
286
- description: "",
287
- },
288
- step: {
289
- type: ["number"],
290
- defaultValue: String(initialSetup.pinch.step),
291
- description: "The sensitivity of zooming with the wheel/touchpad.",
292
- },
293
- disabled: {
294
- type: ["boolean"],
295
- defaultValue: String(initialSetup.pinch.disabled),
296
- description:
297
- "Disable the pinching zoom functionality, it will NOT affect mouse wheel/touchpad zooming.",
298
- },
299
- excluded: {
300
- type: ["string[]"],
301
- defaultValue: String(initialSetup.pinch.excluded),
302
- description:
303
- "List of the class names or tags that should not activate this feature. (E.g. ['my-custom-class-name', 'div', 'a'])",
304
- },
305
- },
306
- doubleClick: {
307
- doubleClick: {
308
- type: [""],
309
- defaultValue: "",
310
- description: "",
311
- },
312
- disabled: {
313
- type: ["boolean"],
314
- defaultValue: String(initialSetup.doubleClick.disabled),
315
- description: "Disable the double click feature.",
316
- },
317
- step: {
318
- type: ["number"],
319
- defaultValue: String(initialSetup.doubleClick.step),
320
- description:
321
- "The sensitivity of zooming in or out when the double click mode is set to 'zoomIn' or 'zoomOut'.",
322
- },
323
- mode: {
324
- type: ["zoomIn", "zoomOut", "reset"],
325
- defaultValue: String(initialSetup.doubleClick.mode),
326
- description:
327
- "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.",
328
- },
329
- animationTime: {
330
- type: ["number"],
331
- defaultValue: String(initialSetup.doubleClick.animationTime),
332
- description: "Time of the triggered double click animation.",
333
- },
334
- animationType: {
335
- type: Object.keys(animations),
336
- defaultValue: String(initialSetup.doubleClick.animationType),
337
- description: "Animations types to choose from.",
338
- },
339
- excluded: {
340
- type: ["string[]"],
341
- defaultValue: String(initialSetup.doubleClick.excluded),
342
- description:
343
- "List of the class names or tags that should not activate this feature. (E.g. ['my-custom-class-name', 'div', 'a'])",
344
- },
345
- },
346
- zoomAnimation: {
347
- zoomAnimation: {
348
- type: [""],
349
- defaultValue: "",
350
- description: "",
351
- },
352
- disabled: {
353
- type: ["boolean"],
354
- defaultValue: String(initialSetup.zoomAnimation.disabled),
355
- description: "Disable the double click feature.",
356
- },
357
- size: {
358
- type: ["number"],
359
- defaultValue: String(initialSetup.zoomAnimation.size),
360
- description:
361
- "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.",
362
- },
363
- animationTime: {
364
- type: ["number"],
365
- defaultValue: String(initialSetup.zoomAnimation.animationTime),
366
- description: "Time of the triggered double click animation.",
367
- },
368
- animationType: {
369
- type: Object.keys(animations),
370
- defaultValue: String(initialSetup.zoomAnimation.animationType),
371
- description: "Animations types to choose from.",
372
- },
373
- },
374
- alignmentAnimation: {
375
- alignmentAnimation: {
376
- type: [""],
377
- defaultValue: "",
378
- description: "",
379
- },
380
- disabled: {
381
- type: ["boolean"],
382
- defaultValue: String(initialSetup.alignmentAnimation.disabled),
383
- description: "Disable the double click feature.",
384
- },
385
- sizeX: {
386
- type: ["number"],
387
- defaultValue: String(initialSetup.alignmentAnimation.sizeX),
388
- description:
389
- "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.",
390
- },
391
- sizeY: {
392
- type: ["number"],
393
- defaultValue: String(initialSetup.alignmentAnimation.sizeY),
394
- description:
395
- "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.",
396
- },
397
- velocityAlignmentTime: {
398
- type: ["number"],
399
- defaultValue: String(initialSetup.alignmentAnimation.animationTime),
400
- description:
401
- "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)",
402
- },
403
- animationTime: {
404
- type: ["number"],
405
- defaultValue: String(initialSetup.alignmentAnimation.animationTime),
406
- description: "Time of the alignment animation.",
407
- },
408
- animationType: {
409
- type: Object.keys(animations),
410
- defaultValue: String(initialSetup.alignmentAnimation.animationType),
411
- description: "Animations types to choose from.",
412
- },
413
- },
414
- velocityAnimation: {
415
- velocityAnimation: {
416
- type: [""],
417
- defaultValue: "",
418
- description: "",
419
- },
420
- disabled: {
421
- type: ["boolean"],
422
- defaultValue: String(initialSetup.velocityAnimation.disabled),
423
- description: "Disable the double click feature.",
424
- },
425
- sensitivity: {
426
- type: ["number"],
427
- defaultValue: String(initialSetup.velocityAnimation.animationTime),
428
- description:
429
- "Additional variable that allows you to control the sensitivity of panning velocity",
430
- },
431
- animationTime: {
432
- type: ["number"],
433
- defaultValue: String(initialSetup.velocityAnimation.animationTime),
434
- description: "Time of the triggered double click animation.",
435
- },
436
- animationType: {
437
- type: Object.keys(animations),
438
- defaultValue: String(initialSetup.velocityAnimation.animationType),
439
- description: "Animations types to choose from.",
440
- },
441
- equalToMove: {
442
- type: ["boolean"],
443
- defaultValue: String(initialSetup.velocityAnimation.equalToMove),
444
- description:
445
- "The calculation of the velocity animation duration is adjusted to the length of the mouse movement",
446
- },
447
- },
448
- onWheelStart: {
449
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
450
- defaultValue: "undefined",
451
- description: "Callback fired when wheel/touchpad events are started",
452
- },
453
- onWheel: {
454
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
455
- defaultValue: "undefined",
456
- description: "Callback fired when wheel/touchpad events are ongoing",
457
- },
458
- onWheelStop: {
459
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
460
- defaultValue: "undefined",
461
- description: "Callback fired when wheel/touchpad events are finished",
462
- },
463
- onPanningStart: {
464
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
465
- defaultValue: "undefined",
466
- description: "Callback fired when panning event has started",
467
- },
468
- onPanning: {
469
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
470
- defaultValue: "undefined",
471
- description: "Callback fired when panning event is ongoing",
472
- },
473
- onPanningStop: {
474
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
475
- defaultValue: "undefined",
476
- description: "Callback fired when panning event has finished",
477
- },
478
- onPinchingStart: {
479
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
480
- defaultValue: "undefined",
481
- description: "Callback fired when pinch event has started",
482
- },
483
- onPinching: {
484
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
485
- defaultValue: "undefined",
486
- description: "Callback fired when pinch event is ongoing",
487
- },
488
- onPinchingStop: {
489
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
490
- defaultValue: "undefined",
491
- description: "Callback fired when pinch event has finished",
492
- },
493
- onZoomStart: {
494
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
495
- defaultValue: "undefined",
496
- description:
497
- "Callback fired when any of zoom events are started (wheel/touchpad/pinch)",
498
- },
499
- onZoom: {
500
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
501
- defaultValue: "undefined",
502
- description:
503
- "Callback fired when any of zoom events are ongoing (wheel/touchpad/pinch)",
504
- },
505
- onZoomStop: {
506
- type: ["(ref: ReactZoomPanPinchRef, event) => void"],
507
- defaultValue: "undefined",
508
- description:
509
- "Callback fired when any of zoom events are finished (wheel/touchpad/pinch)",
510
- },
511
- onTransformed: {
512
- type: [
513
- "(ref: ReactZoomPanPinchRef, state: { scale: number; positionX: number; positionY: number } ) => void",
514
- ],
515
- defaultValue: "undefined",
516
- description: "Callback fired when on each transform",
517
- },
518
- onInit: {
519
- type: ["(ref: ReactZoomPanPinchRef) => void"],
520
- defaultValue: "undefined",
521
- description: "Callback fired when components get mounted",
522
- },
523
- };
524
-
525
- export const componentProps = getPropsTable(componentPropsTable);
526
- export const wrapperProps = getPropsTable(wrapperPropsTable);
@@ -1,121 +0,0 @@
1
- import { Meta, Story, ArgsTable, Canvas } from "@storybook/addon-docs/blocks";
2
- import { action } from "@storybook/addon-actions";
3
-
4
- import { TransformWrapper, TransformComponent } from "../../../components";
5
- import { argsTypes } from "../../types/args.types.ts";
6
- import { normalizeArgs } from "../../utils";
7
-
8
- import exampleImg from "../../assets/small-image.jpg";
9
-
10
- export const Template = (args) => (
11
- <TransformWrapper {...normalizeArgs(args)}>
12
- <TransformComponent
13
- wrapperStyle={{ maxWidth: "100%", maxHeight: "calc(100vh - 50px)" }}
14
- >
15
- <div style={{ background: "#444", color: "white", padding: "50px" }}>
16
- <h1>No scrollbars needed</h1>
17
- <h2>Use mouse or gestures to move around</h2>
18
- <button
19
- onClick={() => alert("You can still interact with click events!")}
20
- >
21
- Click me!
22
- </button>
23
- <div
24
- style={{
25
- display: "flex",
26
- overflow: "auto",
27
- maxWidth: "100%",
28
- padding: "10px",
29
- }}
30
- >
31
- <div
32
- style={{
33
- width: "100px",
34
- height: "100px",
35
- padding: "10px",
36
- background: "red",
37
- }}
38
- className="panningDisabled"
39
- >
40
- Panning is DISABLED on this element
41
- </div>
42
- <div
43
- style={{
44
- width: "100px",
45
- height: "100px",
46
- padding: "10px",
47
- background: "blue",
48
- }}
49
- className="wheelDisabled"
50
- >
51
- Wheel is DISABLED on this element
52
- </div>
53
- <div
54
- style={{
55
- width: "100px",
56
- height: "100px",
57
- padding: "10px",
58
- background: "green",
59
- }}
60
- className="pinchDisabled"
61
- >
62
- Pinch is DISABLED on this element
63
- </div>
64
- </div>
65
- <p>
66
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
67
- eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
68
- minim veniam, quis nostrud exercitation ullamco laboris nisi ut
69
- aliquip ex ea commodo consequat. Duis aute irure dolor in
70
- reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
71
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
72
- culpa qui officia deserunt mollit anim id est laborum
73
- </p>
74
- <img src={exampleImg} alt="" />
75
- <p>
76
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
77
- eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
78
- minim veniam, quis nostrud exercitation ullamco laboris nisi ut
79
- aliquip ex ea commodo consequat. Duis aute irure dolor in
80
- reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
81
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
82
- culpa qui officia deserunt mollit anim id est laborum
83
- </p>
84
- </div>
85
- </TransformComponent>
86
- </TransformWrapper>
87
- );
88
-
89
- <Meta
90
- title="Examples/Mixed Content"
91
- component={TransformWrapper}
92
- argTypes={{
93
- ...argsTypes,
94
- "wheel.excluded": {
95
- ...argsTypes["wheel.excluded"],
96
- defaultValue: ["wheelDisabled"],
97
- },
98
- "panning.excluded": {
99
- ...argsTypes["panning.excluded"],
100
- defaultValue: ["panningDisabled"],
101
- },
102
- "pinch.excluded": {
103
- ...argsTypes["pinch.excluded"],
104
- defaultValue: ["pinchDisabled"],
105
- },
106
- }}
107
- />
108
-
109
- # Mixed Content
110
-
111
- <br />
112
-
113
- ### Preview:
114
-
115
- <Canvas>
116
- <Story name="Mixed Content">{(args) => <Template {...args} />}</Story>
117
- </Canvas>
118
-
119
- ## Component API
120
-
121
- <ArgsTable story="Mixed Content" />
@@ -1,45 +0,0 @@
1
- import { Meta, Story, ArgsTable, Canvas } from "@storybook/addon-docs/blocks";
2
- import { action } from "@storybook/addon-actions";
3
-
4
- import { TransformWrapper, TransformComponent } from "../../../components";
5
- import { argsTypes } from "../../types/args.types";
6
- import { Example } from "./example";
7
-
8
- export const Template = (args) => <Example {...args} />;
9
-
10
- <Meta
11
- title="Examples/Rerendering content"
12
- component={TransformWrapper}
13
- argTypes={{
14
- ...argsTypes,
15
- "wheel.excluded": {
16
- ...argsTypes["wheel.excluded"],
17
- defaultValue: ["wheelDisabled"],
18
- },
19
- "panning.excluded": {
20
- ...argsTypes["panning.excluded"],
21
- defaultValue: ["panningDisabled"],
22
- },
23
- "pinch.excluded": {
24
- ...argsTypes["pinch.excluded"],
25
- defaultValue: ["pinchDisabled"],
26
- },
27
- centerOnInit: {
28
- defaultValue: true,
29
- },
30
- }}
31
- />
32
-
33
- # Rerendering content
34
-
35
- <br />
36
-
37
- ### Preview:
38
-
39
- <Canvas>
40
- <Story name="Rerendering content">{(args) => <Template {...args} />}</Story>
41
- </Canvas>
42
-
43
- ## Component API
44
-
45
- <ArgsTable story="Rerendering content" />