react-zoom-pan-pinch 3.3.0 → 3.4.1

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 +46 -3
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +4 -1
  4. package/dist/index.esm.js +46 -3
  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,15 +0,0 @@
1
- /* eslint-disable @typescript-eslint/ban-types */
2
-
3
- export type DeepNonNullable<T> = T extends (...args: any[]) => any
4
- ? T
5
- : T extends any[]
6
- ? DeepNonNullableArray<T[number]>
7
- : T extends object
8
- ? DeepNonNullableObject<T>
9
- : T;
10
-
11
- export type DeepNonNullableArray<T> = Array<DeepNonNullable<NonNullable<T>>>;
12
-
13
- export type DeepNonNullableObject<T> = {
14
- [P in keyof T]-?: DeepNonNullable<NonNullable<T[P]>>;
15
- };
@@ -1,3 +0,0 @@
1
- export * from "./context.model";
2
- export * from "./helpers.model";
3
- export * from "./calculations.model";
@@ -1 +0,0 @@
1
- /// <reference types="react-scripts" />
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- <svg enable-background="new 0 0 24 24" height="512" viewBox="0 0 24 24" width="512" xmlns="http://www.w3.org/2000/svg"><path d="m12 0c-4.962 0-9 4.066-9 9.065 0 7.103 8.154 14.437 8.501 14.745.143.127.321.19.499.19s.356-.063.499-.189c.347-.309 8.501-7.643 8.501-14.746 0-4.999-4.038-9.065-9-9.065zm0 14c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z"/></svg>
Binary file
@@ -1,14 +0,0 @@
1
- <svg version="1.1"
2
- baseProfile="full"
3
- width="300" height="200"
4
- xmlns="http://www.w3.org/2000/svg"
5
- id="example-svg"
6
- >
7
-
8
- <rect width="100%" height="100%" fill="red" />
9
-
10
- <circle cx="150" cy="100" r="80" fill="green" />
11
-
12
- <text x="150" y="125" font-size="30" text-anchor="middle" fill="white" id="text-svg">Example</text>
13
-
14
- </svg>
@@ -1,174 +0,0 @@
1
- import { Meta } from "@storybook/addon-docs/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://github.com/semantic-release/semantic-release">
21
- <img src="https://custom-icon-badges.demolab.com/badge/semver-commitzen-e10079?logo=semantic-release&color=e76f51" />
22
- </a>
23
- <a href="https://www.npmjs.com/package/react-zoom-pan-pinch">
24
- <img src="https://custom-icon-badges.demolab.com/npm/dm/react-zoom-pan-pinch?logoColor=fff&logo=trending-up" />
25
- </a>
26
- <a href="https://www.npmjs.com/package/react-zoom-pan-pinch">
27
- <img src="https://custom-icon-badges.demolab.com/bundlephobia/minzip/react-zoom-pan-pinch?color=E10098&logo=package" />
28
- </a>
29
- <a href="https://github.com/prc5/react-zoom-pan-pinch">
30
- <img src="https://custom-icon-badges.demolab.com/badge/typescript-%23007ACC.svg?logo=typescript&logoColor=white" />
31
- </a>
32
- <a href="https://hits.sh/github.com/prc5/react-zoom-pan-pinch/">
33
- <img src="https://hits.sh/github.com/prc5/react-zoom-pan-pinch.svg?color=64BC4B&logo=bookmeter" />
34
- </a>
35
- <a href="https://twitter.com/maciej_pyrc">
36
- <img
37
- alt="Twitter Follow"
38
- src="https://img.shields.io/twitter/follow/maciej_pyrc?label=Follow%20&style=social"
39
- />
40
- </a>
41
- </p>
42
-
43
- > Super fast and light react npm package for zooming, panning and pinching html
44
- > elements in easy way
45
-
46
- - [Demo](https://prc5.github.io/react-zoom-pan-pinch/?path=/story/examples-big-image--big-image)
47
- - [Docs](https://prc5.github.io/react-zoom-pan-pinch/?path=/story/docs-props--page)
48
-
49
- ## Key Features
50
-
51
- - 🚀 Fast and easy to use
52
- - 🏭 Light, without external dependencies
53
- - 💎 Mobile gestures, touchpad gestures and desktop mouse events support
54
- - 🎁 Powerful context usage, which gives you a lot of freedom
55
- - 🔧 Highly customizable
56
- - 👑 Animations and Utils to create own tools
57
- - 🔮 Advanced hooks and components
58
-
59
- ## Help me keep working on this project ❤️
60
-
61
- - [Become a Sponsor on GitHub](https://github.com/sponsors/prc5)
62
-
63
- ---
64
-
65
- ## Installation
66
-
67
- ```bash
68
- npm install --save react-zoom-pan-pinch
69
- or
70
- yarn add react-zoom-pan-pinch
71
- ```
72
-
73
- ## Examples
74
-
75
- ```jsx
76
- import React, { Component } from "react";
77
-
78
- import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
79
-
80
- const Example = () => {
81
- return (
82
- <TransformWrapper>
83
- <TransformComponent>
84
- <img src="image.jpg" alt="test" />
85
- </TransformComponent>
86
- </TransformWrapper>
87
- );
88
- };
89
- ```
90
-
91
- or
92
-
93
- ```jsx
94
- import React, { Component } from "react";
95
-
96
- import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
97
-
98
- const Example = () => {
99
- return (
100
- <TransformWrapper
101
- initialScale={1}
102
- initialPositionX={200}
103
- initialPositionY={100}
104
- >
105
- {({ zoomIn, zoomOut, resetTransform, ...rest }) => (
106
- <React.Fragment>
107
- <div className="tools">
108
- <button onClick={() => zoomIn()}>+</button>
109
- <button onClick={() => zoomOut()}>-</button>
110
- <button onClick={() => resetTransform()}>x</button>
111
- </div>
112
- <TransformComponent>
113
- <img src="image.jpg" alt="test" />
114
- <div>Example text</div>
115
- </TransformComponent>
116
- </React.Fragment>
117
- )}
118
- </TransformWrapper>
119
- );
120
- };
121
- ```
122
-
123
- or
124
-
125
- ```tsx
126
- import React, { useRef } from "react";
127
- import {
128
- TransformWrapper,
129
- TransformComponent,
130
- ReactZoomPanPinchRef,
131
- } from "react-zoom-pan-pinch";
132
-
133
- const Controls = ({ zoomIn, zoomOut, resetTransform }) => (
134
- <>
135
- <button onClick={() => zoomIn()}>+</button>
136
- <button onClick={() => zoomOut()}>-</button>
137
- <button onClick={() => resetTransform()}>x</button>
138
- </>
139
- );
140
-
141
- const Component = () => {
142
- const transformComponentRef = useRef<ReactZoomPanPinchRef | null>(null);
143
-
144
- const zoomToImage = () => {
145
- if (transformComponentRef.current) {
146
- const { zoomToElement } = transformComponentRef.current;
147
- zoomToElement("imgExample");
148
- }
149
- };
150
-
151
- return (
152
- <TransformWrapper
153
- initialScale={1}
154
- initialPositionX={200}
155
- initialPositionY={100}
156
- ref={transformComponentRef}
157
- >
158
- {(utils) => (
159
- <React.Fragment>
160
- <Controls {...utils} />
161
- <TransformComponent>
162
- <img src="image.jpg" alt="test" id="imgExample" />
163
- <div onClick={zoomToImage}>Example text</div>
164
- </TransformComponent>
165
- </React.Fragment>
166
- )}
167
- </TransformWrapper>
168
- );
169
- };
170
- ```
171
-
172
- ## License
173
-
174
- MIT © [prc5](https://github.com/prc5)
@@ -1,48 +0,0 @@
1
- import { Meta } from "@storybook/addon-docs/blocks";
2
-
3
- import { getHandlersTable } from "./handlers.tsx";
4
- import { Code } from "../utils";
5
-
6
- <Meta title="Docs/Handlers" />
7
-
8
- # Handlers
9
-
10
- List of additionaly added handlers - you can acces them via ref or render props
11
-
12
- <table className="handlers-table">
13
- <thead>
14
- <tr>
15
- <th>
16
- Name
17
- </th>
18
- <th>
19
- Type
20
- </th>
21
- <th>
22
- Default
23
- </th>
24
- <th>
25
- Description
26
- </th>
27
- </tr>
28
- </thead>
29
- <tbody>
30
- {getHandlersTable().map(row => (
31
- <tr className={row.isObjectRow ? "is-object-row" : ""}>
32
- <td>
33
- {row.name}
34
- </td>
35
- <td>
36
- {row.type.map(type => (<Code code={type} />))}
37
- </td>
38
- <td>
39
- {row.parameters.map(param => (<Code code={param} />))}
40
- </td>
41
- <td>
42
- {row.description}
43
- </td>
44
- </tr>
45
- ))}
46
- </tbody>
47
-
48
- </table>
@@ -1,107 +0,0 @@
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).reduce<ControlsFnOptionsType[]>(
81
- (acc, key) => {
82
- if (Array.isArray(handlersTable[key]?.type)) {
83
- acc.push({
84
- ...handlersTable[key],
85
- name: key,
86
- });
87
- } else {
88
- Object.keys(handlersTable[key]).forEach((prop) => {
89
- acc.push({
90
- ...handlersTable[key][prop],
91
- isObjectRow: key === prop,
92
- name:
93
- key === prop ? (
94
- <b>{prop}</b>
95
- ) : (
96
- <>
97
- {key}.<b>{prop}</b>
98
- </>
99
- ),
100
- });
101
- });
102
- }
103
- return acc;
104
- },
105
- [],
106
- );
107
- };
@@ -1,92 +0,0 @@
1
- import { Meta } from "@storybook/addon-docs/blocks";
2
-
3
- import { componentProps, wrapperProps } from "./props.tsx";
4
- import { Code } from "../utils";
5
-
6
- <Meta title="Docs/Props" />
7
-
8
- # TransformComponent Props
9
-
10
- List of props
11
-
12
- <table className="props-table">
13
- <thead>
14
- <tr>
15
- <th>
16
- Name
17
- </th>
18
- <th>
19
- Type
20
- </th>
21
- <th>
22
- Default
23
- </th>
24
- <th>
25
- Description
26
- </th>
27
- </tr>
28
- </thead>
29
- <tbody>
30
- {componentProps.map(row => (
31
- <tr className={row.isObjectRow ? "is-object-row" : ""}>
32
- <td>
33
- {row.name}
34
- </td>
35
- <td>
36
- {row.type.map(type => (<Code code={type} />))}
37
- </td>
38
- <td>
39
- <Code code={row.defaultValue} />
40
- </td>
41
- <td>
42
- {row.description}
43
- </td>
44
- </tr>
45
- ))}
46
- </tbody>
47
-
48
- </table>
49
-
50
- <br />
51
-
52
- # TransformWrapper Props
53
-
54
- List of props
55
-
56
- <table className="props-table">
57
- <thead>
58
- <tr>
59
- <th>
60
- Name
61
- </th>
62
- <th>
63
- Type
64
- </th>
65
- <th>
66
- Default
67
- </th>
68
- <th>
69
- Description
70
- </th>
71
- </tr>
72
- </thead>
73
- <tbody>
74
- {wrapperProps.map(row => (
75
- <tr className={row.isObjectRow ? "is-object-row" : ""}>
76
- <td>
77
- {row.name}
78
- </td>
79
- <td>
80
- {row.type.map(type => (<Code code={type} />))}
81
- </td>
82
- <td>
83
- <Code code={row.defaultValue} />
84
- </td>
85
- <td>
86
- {row.description}
87
- </td>
88
- </tr>
89
- ))}
90
- </tbody>
91
-
92
- </table>