react-zoom-pan-pinch 4.0.0 → 4.0.2

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 (82) hide show
  1. package/package.json +4 -3
  2. package/src/stories/assets/big-image.jpeg +0 -0
  3. package/src/stories/assets/map.jpg +0 -0
  4. package/src/stories/assets/medium-image.jpg +0 -0
  5. package/src/stories/assets/pin.svg +0 -1
  6. package/src/stories/assets/small-image.jpg +0 -0
  7. package/src/stories/assets/svg-example.svg +0 -14
  8. package/src/stories/docs/DocTable.tsx +0 -59
  9. package/src/stories/docs/HandlerCards.tsx +0 -102
  10. package/src/stories/docs/Introduction.stories.mdx +0 -135
  11. package/src/stories/docs/PropTable.tsx +0 -116
  12. package/src/stories/docs/docs.module.css +0 -370
  13. package/src/stories/docs/handlers.stories.mdx +0 -7
  14. package/src/stories/docs/handlers.tsx +0 -111
  15. package/src/stories/docs/props.stories.mdx +0 -11
  16. package/src/stories/docs/props.tsx +0 -571
  17. package/src/stories/examples/axis-lock/axis-lock.stories.mdx +0 -35
  18. package/src/stories/examples/axis-lock/example.tsx +0 -114
  19. package/src/stories/examples/bounds/bounds.data.tsx +0 -191
  20. package/src/stories/examples/bounds/bounds.stories.mdx +0 -99
  21. package/src/stories/examples/center-zoomed-out/center-zoomed-out.stories.mdx +0 -206
  22. package/src/stories/examples/cinema/cinema-data.tsx +0 -578
  23. package/src/stories/examples/cinema/cinema.stories.mdx +0 -30
  24. package/src/stories/examples/cinema/example.tsx +0 -378
  25. package/src/stories/examples/cinema/image.png +0 -0
  26. package/src/stories/examples/content/content.stories.mdx +0 -172
  27. package/src/stories/examples/content/mixed-content.data.tsx +0 -624
  28. package/src/stories/examples/content-rerendering/content-updating.stories.mdx +0 -34
  29. package/src/stories/examples/content-rerendering/example.tsx +0 -631
  30. package/src/stories/examples/controls/controls.stories.mdx +0 -120
  31. package/src/stories/examples/image/example.tsx +0 -149
  32. package/src/stories/examples/image/image.stories.mdx +0 -46
  33. package/src/stories/examples/image-annotations/example.tsx +0 -1442
  34. package/src/stories/examples/image-annotations/image-annotations.stories.mdx +0 -39
  35. package/src/stories/examples/image-responsive/example.tsx +0 -152
  36. package/src/stories/examples/image-responsive/image-responsive.stories.mdx +0 -51
  37. package/src/stories/examples/image-zoomed-out/image-zoomed-out.stories.mdx +0 -107
  38. package/src/stories/examples/initial-transform/example.tsx +0 -233
  39. package/src/stories/examples/initial-transform/initial-transform.stories.mdx +0 -37
  40. package/src/stories/examples/keep-scale/example.tsx +0 -882
  41. package/src/stories/examples/keep-scale/keep-scale.stories.mdx +0 -30
  42. package/src/stories/examples/keep-scale/map.stories.mdx +0 -28
  43. package/src/stories/examples/medical-viewer/chest-xray.tsx +0 -246
  44. package/src/stories/examples/medical-viewer/example.tsx +0 -690
  45. package/src/stories/examples/medical-viewer/medical-viewer.stories.mdx +0 -49
  46. package/src/stories/examples/mini-map/example.tsx +0 -122
  47. package/src/stories/examples/mini-map/mini-map.stories.mdx +0 -26
  48. package/src/stories/examples/miro/example.tsx +0 -1573
  49. package/src/stories/examples/miro/miro.stories.mdx +0 -31
  50. package/src/stories/examples/padding/example.tsx +0 -147
  51. package/src/stories/examples/padding/padding.stories.mdx +0 -35
  52. package/src/stories/examples/product-card/example.tsx +0 -594
  53. package/src/stories/examples/product-card/product-card.stories.mdx +0 -29
  54. package/src/stories/examples/stadium/example.tsx +0 -1040
  55. package/src/stories/examples/stadium/stadium-data.ts +0 -224
  56. package/src/stories/examples/stadium/stadium.stories.mdx +0 -32
  57. package/src/stories/examples/stress/example.tsx +0 -59
  58. package/src/stories/examples/stress/stress-test.stories.mdx +0 -28
  59. package/src/stories/examples/svg-zoom-to-element/creativity.svg +0 -143
  60. package/src/stories/examples/svg-zoom-to-element/example.tsx +0 -95
  61. package/src/stories/examples/svg-zoom-to-element/svg-zoom-to-element.stories.mdx +0 -28
  62. package/src/stories/examples/text-selection/example.tsx +0 -221
  63. package/src/stories/examples/text-selection/text-selection.stories.mdx +0 -31
  64. package/src/stories/examples/velocity/example.tsx +0 -908
  65. package/src/stories/examples/velocity/velocity.stories.mdx +0 -35
  66. package/src/stories/examples/virtualize/example.tsx +0 -239
  67. package/src/stories/examples/virtualize/virtualize.stories.mdx +0 -84
  68. package/src/stories/examples/zoom-to-element/example.tsx +0 -219
  69. package/src/stories/examples/zoom-to-element/zoom-to-element.stories.mdx +0 -31
  70. package/src/stories/hooks/use-controls.stories.mdx +0 -86
  71. package/src/stories/hooks/use-transform-component.stories.mdx +0 -108
  72. package/src/stories/hooks/use-transform-context.stories.mdx +0 -92
  73. package/src/stories/hooks/use-transform-effect.stories.mdx +0 -114
  74. package/src/stories/hooks/use-transform-init.stories.mdx +0 -105
  75. package/src/stories/types/args.types.ts +0 -192
  76. package/src/stories/utils/args.utils.ts +0 -35
  77. package/src/stories/utils/bounds-overlay.tsx +0 -168
  78. package/src/stories/utils/code.utils.tsx +0 -22
  79. package/src/stories/utils/controls.utils.tsx +0 -347
  80. package/src/stories/utils/index.ts +0 -5
  81. package/src/stories/utils/styles.module.css +0 -223
  82. package/src/stories/utils/viewer.styles.ts +0 -34
@@ -1,223 +0,0 @@
1
- .wrapper {
2
- width: calc(100vw - 200px);
3
- height: calc(100vh - 200px);
4
- }
5
-
6
- /* ── Control bar (glassmorphism toolbar) ─────────────────────── */
7
-
8
- .controlBar {
9
- position: absolute;
10
- z-index: 10;
11
- display: flex;
12
- align-items: center;
13
- gap: 2px;
14
- padding: 4px;
15
- border-radius: 12px;
16
- background: rgba(15, 15, 20, 0.72);
17
- backdrop-filter: blur(16px) saturate(1.6);
18
- -webkit-backdrop-filter: blur(16px) saturate(1.6);
19
- border: 1px solid rgba(255, 255, 255, 0.08);
20
- box-shadow:
21
- 0 2px 8px rgba(0, 0, 0, 0.3),
22
- 0 0 0 0.5px rgba(255, 255, 255, 0.04) inset;
23
- font-family: system-ui, -apple-system, sans-serif;
24
- }
25
-
26
- .controlsTopLeft {
27
- top: 25px;
28
- left: 25px;
29
- }
30
-
31
- .controlsTopCenter {
32
- top: 25px;
33
- left: 50%;
34
- transform: translateX(-50%);
35
- }
36
-
37
- .controlsTopRight {
38
- top: 25px;
39
- right: 25px;
40
- }
41
-
42
- .controlsBottomLeft {
43
- bottom: 25px;
44
- left: 25px;
45
- }
46
-
47
- .controlsBottomRight {
48
- bottom: 25px;
49
- right: 25px;
50
- }
51
-
52
- /* ── Button groups ───────────────────────────────────────────── */
53
-
54
- .controlGroup {
55
- display: flex;
56
- align-items: center;
57
- gap: 2px;
58
- }
59
-
60
- .controlDivider {
61
- width: 1px;
62
- height: 20px;
63
- margin: 0 4px;
64
- background: rgba(255, 255, 255, 0.1);
65
- border-radius: 1px;
66
- flex-shrink: 0;
67
- }
68
-
69
- /* ── Icon button ─────────────────────────────────────────────── */
70
-
71
- .controlIcon {
72
- position: relative;
73
- display: flex;
74
- align-items: center;
75
- justify-content: center;
76
- width: 32px;
77
- height: 32px;
78
- padding: 0;
79
- border: none;
80
- border-radius: 8px;
81
- background: transparent;
82
- color: rgba(255, 255, 255, 0.7);
83
- cursor: pointer;
84
- transition:
85
- background 0.15s ease,
86
- color 0.15s ease;
87
- }
88
-
89
- .controlIconActive {
90
- background: rgba(96, 165, 250, 0.2);
91
- color: rgba(191, 219, 254, 0.95);
92
- box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35) inset;
93
- }
94
-
95
- .controlIcon:hover {
96
- background: rgba(255, 255, 255, 0.1);
97
- color: #fff;
98
- }
99
-
100
- .controlIcon:active {
101
- background: rgba(255, 255, 255, 0.16);
102
- color: #fff;
103
- transform: scale(0.94);
104
- }
105
-
106
- .controlIcon:focus-visible {
107
- outline: 2px solid rgba(100, 160, 255, 0.6);
108
- outline-offset: -1px;
109
- }
110
-
111
- /* ── Tooltip ─────────────────────────────────────────────────── */
112
-
113
- .controlIcon[data-tooltip]::after,
114
- .controlText[data-tooltip]::after {
115
- content: attr(data-tooltip);
116
- position: absolute;
117
- bottom: calc(100% + 8px);
118
- left: 50%;
119
- transform: translateX(-50%) scale(0.92);
120
- padding: 5px 10px;
121
- border-radius: 8px;
122
- background: rgba(10, 10, 14, 0.92);
123
- border: 1px solid rgba(255, 255, 255, 0.1);
124
- backdrop-filter: blur(10px);
125
- -webkit-backdrop-filter: blur(10px);
126
- color: #e4e4e7;
127
- font-size: 11px;
128
- font-weight: 600;
129
- font-family: inherit;
130
- white-space: nowrap;
131
- pointer-events: none;
132
- opacity: 0;
133
- transition:
134
- opacity 0.15s ease,
135
- transform 0.15s ease;
136
- z-index: 100;
137
- }
138
-
139
- .controlIcon[data-tooltip]:hover::after,
140
- .controlText[data-tooltip]:hover::after {
141
- opacity: 1;
142
- transform: translateX(-50%) scale(1);
143
- }
144
-
145
- /* ── Text button (for labels like "Zoom to X") ───────────────── */
146
-
147
- .controlText {
148
- position: relative;
149
- display: flex;
150
- align-items: center;
151
- justify-content: center;
152
- height: 32px;
153
- padding: 0 12px;
154
- border: none;
155
- border-radius: 8px;
156
- background: transparent;
157
- color: rgba(255, 255, 255, 0.7);
158
- font-size: 12px;
159
- font-weight: 600;
160
- letter-spacing: 0.02em;
161
- white-space: nowrap;
162
- cursor: pointer;
163
- font-family: inherit;
164
- transition:
165
- background 0.15s ease,
166
- color 0.15s ease;
167
- }
168
-
169
- .controlText:hover {
170
- background: rgba(255, 255, 255, 0.1);
171
- color: #fff;
172
- }
173
-
174
- .controlText:active {
175
- background: rgba(255, 255, 255, 0.16);
176
- color: #fff;
177
- transform: scale(0.97);
178
- }
179
-
180
- .controlText:focus-visible {
181
- outline: 2px solid rgba(100, 160, 255, 0.6);
182
- outline-offset: -1px;
183
- }
184
-
185
- /* ── Legacy single button (kept for stories still using it) ─── */
186
-
187
- .controlPanel {
188
- position: absolute;
189
- z-index: 2;
190
- transform: translate(10px, 10px);
191
- max-width: calc(100vw - 20px);
192
- }
193
-
194
- .controlBtn {
195
- padding: 6px 12px;
196
- background: white;
197
- border: 1px solid grey;
198
- border-radius: 5px;
199
- margin-right: 10px;
200
- font-size: 12px;
201
- text-transform: uppercase;
202
- font-weight: 600;
203
- cursor: pointer;
204
- }
205
-
206
- .controlBtn:focus {
207
- filter: brightness(90%);
208
- }
209
-
210
- .controlBtn:hover {
211
- filter: brightness(120%);
212
- }
213
-
214
- .controlBtn:active {
215
- opacity: 0.9;
216
- }
217
-
218
- /* ── Stress-test grid ────────────────────────────────────────── */
219
-
220
- .grid {
221
- display: grid;
222
- grid-template-columns: repeat(100, 1fr);
223
- }
@@ -1,34 +0,0 @@
1
- import type React from "react";
2
-
3
- /**
4
- * Checkerboard "transparency grid" background — reusable across stories.
5
- * Apply to TransformComponent's `wrapperStyle` so zoomed-out content shows
6
- * a visible canvas boundary instead of a flat dark void.
7
- */
8
- export const checkerboard: React.CSSProperties = {
9
- background: "#0a0a14",
10
- backgroundImage: [
11
- "linear-gradient(45deg, #0e0e1a 25%, transparent 25%)",
12
- "linear-gradient(-45deg, #0e0e1a 25%, transparent 25%)",
13
- "linear-gradient(45deg, transparent 75%, #0e0e1a 75%)",
14
- "linear-gradient(-45deg, transparent 75%, #0e0e1a 75%)",
15
- ].join(", "),
16
- backgroundSize: "20px 20px",
17
- backgroundPosition: "0 0, 0 10px, 10px -10px, -10px 0px",
18
- };
19
-
20
- /** Common glass-panel frame used by most story viewers. */
21
- export const viewerFrame: React.CSSProperties = {
22
- borderRadius: "12px",
23
- border: "2px solid rgba(255,255,255,0.08)",
24
- boxShadow: "0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.03)",
25
- };
26
-
27
- /**
28
- * Full "viewer chrome" — frame + checkerboard.
29
- * Spread into `wrapperStyle` together with sizing overrides.
30
- */
31
- export const viewerChrome: React.CSSProperties = {
32
- ...viewerFrame,
33
- ...checkerboard,
34
- };