react-instagram-stories 1.0.4 → 1.1.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.
package/dist/styles.css CHANGED
@@ -4,99 +4,6 @@
4
4
  -webkit-tap-highlight-color: transparent;
5
5
  }
6
6
 
7
- /* Demo container styles */
8
- .demo-container {
9
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
10
- max-width: 100%;
11
- margin: 0 auto;
12
- padding: 20px;
13
- }
14
-
15
- .demo-header {
16
- text-align: center;
17
- margin-bottom: 40px;
18
- }
19
-
20
- .demo-header h1 {
21
- font-size: 2.5rem;
22
- margin-bottom: 10px;
23
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
24
- -webkit-background-clip: text;
25
- -webkit-text-fill-color: transparent;
26
- background-clip: text;
27
- }
28
-
29
- .demo-header p {
30
- color: #666;
31
- font-size: 1.1rem;
32
- }
33
-
34
- .demo-controls {
35
- display: flex;
36
- gap: 10px;
37
- justify-content: center;
38
- margin: 20px 0;
39
- }
40
-
41
- .demo-btn {
42
- padding: 10px 20px;
43
- border: 2px solid #667eea;
44
- border-radius: 25px;
45
- background: white;
46
- color: #667eea;
47
- font-weight: 600;
48
- cursor: pointer;
49
- transition: all 0.3s ease;
50
- }
51
-
52
- .demo-btn:hover {
53
- background: #667eea;
54
- color: white;
55
- transform: translateY(-2px);
56
- box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
57
- }
58
-
59
- .demo-btn.active {
60
- background: #667eea;
61
- color: white;
62
- }
63
-
64
- .demo-features {
65
- max-width: 600px;
66
- margin: 30px auto;
67
- text-align: left;
68
- padding: 20px;
69
- background: #f8f9fa;
70
- border-radius: 12px;
71
- }
72
-
73
- .demo-features h3 {
74
- margin-top: 0;
75
- }
76
-
77
- .demo-features ul {
78
- list-style: none;
79
- padding: 0;
80
- }
81
-
82
- .demo-features li {
83
- padding: 8px 0;
84
- font-size: 0.95rem;
85
- }
86
-
87
- .demo-main {
88
- margin: 40px 0;
89
- }
90
-
91
- .demo-footer {
92
- text-align: center;
93
- color: #666;
94
- font-size: 0.9rem;
95
- margin-top: 60px;
96
- padding-top: 20px;
97
- border-top: 1px solid #eee;
98
- }
99
-
100
7
  /* ========================================
101
8
  AVATAR LIST STYLES
102
9
  ======================================== */
@@ -152,7 +59,14 @@
152
59
  position: relative;
153
60
  padding: 3px;
154
61
  border-radius: 50%;
155
- background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
62
+ background: linear-gradient(
63
+ 45deg,
64
+ #f09433 0%,
65
+ #e6683c 25%,
66
+ #dc2743 50%,
67
+ #cc2366 75%,
68
+ #bc1888 100%
69
+ );
156
70
  }
157
71
 
158
72
  .story-avatar-read .story-avatar-ring {
@@ -215,6 +129,7 @@
215
129
  display: flex;
216
130
  align-items: center;
217
131
  justify-content: center;
132
+ background: #000;
218
133
  animation: fadeIn 0.3s ease;
219
134
  }
220
135
 
@@ -243,7 +158,6 @@
243
158
  width: 100%;
244
159
  max-width: 500px;
245
160
  height: 100dvh;
246
- max-height: 900px;
247
161
  z-index: 2;
248
162
  display: flex;
249
163
  flex-direction: column;
@@ -251,17 +165,27 @@
251
165
  will-change: transform;
252
166
  }
253
167
 
254
- /* User transitions with native CSS animations */
255
- .story-viewer-transitioning {
256
- transition: transform 0.15s ease-out;
257
- }
168
+ /* ========================================
169
+ 3D CUBE TRANSITION (user-to-user)
170
+ Three faces (left / front / right) form a cube.
171
+ The wrapper rotates around Y; translateZ pulls
172
+ the cube back so it rotates in-place.
173
+ Geometry mirrors the proven CodePen approach.
174
+ ======================================== */
258
175
 
259
- .story-viewer-transition-left {
260
- transform: translateX(-100%);
176
+ .story-viewer-cube-viewport {
177
+ position: relative;
178
+ width: 100%;
179
+ max-width: 500px;
180
+ height: 100dvh;
181
+ z-index: 2;
261
182
  }
262
183
 
263
- .story-viewer-transition-right {
264
- transform: translateX(100%);
184
+ .story-viewer-cube-wrapper {
185
+ position: relative;
186
+ width: 100%;
187
+ height: 100%;
188
+ /* transform-style and transform set inline via JS only when cube is active */
265
189
  }
266
190
 
267
191
  /* Header */
@@ -272,7 +196,11 @@
272
196
  right: 0;
273
197
  z-index: 10;
274
198
  padding: 16px;
275
- background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
199
+ background: linear-gradient(
200
+ to bottom,
201
+ rgba(0, 0, 0, 0.6) 0%,
202
+ rgba(0, 0, 0, 0) 100%
203
+ );
276
204
  }
277
205
 
278
206
  .story-viewer-user-info {
@@ -353,16 +281,6 @@
353
281
  background: #000;
354
282
  }
355
283
 
356
- .story-viewer-item-wrapper {
357
- position: absolute;
358
- top: 0;
359
- left: 0;
360
- width: 100%;
361
- height: 100%;
362
- transition: opacity 0.3s ease, visibility 0.3s ease;
363
- will-change: opacity;
364
- }
365
-
366
284
  /* Story item types */
367
285
  .story-item {
368
286
  width: 100%;
@@ -473,7 +391,12 @@
473
391
 
474
392
  .story-viewer-content {
475
393
  max-width: 100%;
476
- max-height: 100dvh;
394
+ max-height: 100dvh;
395
+ }
396
+
397
+ .story-viewer-cube-viewport {
398
+ max-width: 100%;
399
+ max-height: 100dvh;
477
400
  }
478
401
 
479
402
  .story-avatar-image-wrapper {
@@ -507,6 +430,10 @@
507
430
  max-height: 100dvh;
508
431
  }
509
432
 
433
+ .story-viewer-cube-viewport {
434
+ max-height: 100dvh;
435
+ }
436
+
510
437
  .story-viewer-header {
511
438
  padding: 12px;
512
439
  }
@@ -522,9 +449,14 @@
522
449
 
523
450
  @media (min-width: 769px) {
524
451
  .story-viewer-content {
452
+ max-height: 900px;
525
453
  border-radius: 12px;
526
454
  overflow: hidden;
527
455
  }
456
+
457
+ .story-viewer-cube-viewport {
458
+ max-height: 900px;
459
+ }
528
460
  }
529
461
 
530
462
  /* ========================================
@@ -562,14 +494,14 @@
562
494
 
563
495
  /* GPU acceleration for animations */
564
496
  .story-avatar,
565
- .story-progress-bar-fill,
566
- .story-viewer-content,
567
- .story-viewer-item-wrapper {
497
+ .story-progress-bar-fill {
568
498
  transform: translate3d(0, 0, 0);
569
499
  backface-visibility: hidden;
570
- perspective: 1000px;
571
500
  }
572
501
 
502
+ /* story-viewer-content uses will-change:transform for GPU acceleration.
503
+ Do NOT set transform or perspective here — it breaks the 3D cube faces. */
504
+
573
505
  /* Reduce motion for accessibility */
574
506
  @media (prefers-reduced-motion: reduce) {
575
507
  * {
@@ -580,13 +512,17 @@
580
512
  }
581
513
 
582
514
  /* Touch action optimization */
583
- .story-viewer,
584
515
  .story-avatar-list {
585
516
  touch-action: pan-x pan-y;
586
517
  }
587
518
 
519
+ /* Prevent browser gestures from conflicting with cube drag */
520
+ .story-viewer {
521
+ touch-action: none;
522
+ }
523
+
588
524
  .story-viewer-content {
589
- touch-action: manipulation;
525
+ touch-action: none;
590
526
  }
591
527
 
592
528
  /* ========================================
@@ -594,7 +530,8 @@
594
530
  ======================================== */
595
531
 
596
532
  @keyframes pulse {
597
- 0%, 100% {
533
+ 0%,
534
+ 100% {
598
535
  opacity: 1;
599
536
  }
600
537
  50% {
@@ -629,8 +566,6 @@
629
566
  animation: spin 0.8s linear infinite;
630
567
  }
631
568
 
632
-
633
-
634
569
  @keyframes spin {
635
570
  to {
636
571
  transform: rotate(360deg);
@@ -641,267 +576,3 @@
641
576
  .story-item-video video {
642
577
  transition: opacity 0.3s ease;
643
578
  }
644
-
645
- /* ========================================
646
- SMOOTH SLIDE TRANSITIONS
647
- ======================================== */
648
-
649
- .story-viewer-slide {
650
- position: absolute;
651
- top: 0;
652
- left: 0;
653
- right: 0;
654
- bottom: 0;
655
- width: 100%;
656
- height: 100%;
657
- display: flex;
658
- align-items: center;
659
- justify-content: center;
660
- z-index: 10;
661
- will-change: transform, opacity;
662
- }
663
-
664
- .story-viewer-content {
665
- will-change: transform;
666
- }
667
-
668
- /* Slide animations are now handled by native CSS transitions in StoryViewer.tsx */
669
-
670
- /* ========================================
671
- PDP STORY STYLES
672
- ======================================== */
673
-
674
- .pdp-story {
675
- width: 100%;
676
- height: 100%;
677
- position: relative;
678
- display: flex;
679
- flex-direction: column;
680
- background: #000;
681
- }
682
-
683
- .pdp-story-image-container {
684
- position: relative;
685
- flex: 1;
686
- width: 100%;
687
- overflow: hidden;
688
- background: #000;
689
- }
690
-
691
- .pdp-story-loader {
692
- position: absolute;
693
- top: 0;
694
- left: 0;
695
- right: 0;
696
- bottom: 0;
697
- display: flex;
698
- align-items: center;
699
- justify-content: center;
700
- background: #000;
701
- z-index: 10;
702
- }
703
-
704
- .pdp-story-spinner {
705
- width: 40px;
706
- height: 40px;
707
- border: 3px solid rgba(255, 255, 255, 0.3);
708
- border-top-color: white;
709
- border-radius: 50%;
710
- animation: spin 0.8s linear infinite;
711
- }
712
-
713
- .pdp-story-image {
714
- width: 100%;
715
- height: 100%;
716
- object-fit: cover;
717
- transition: opacity 0.3s ease;
718
- user-select: none;
719
- -webkit-user-select: none;
720
- }
721
-
722
- .pdp-story-nav {
723
- position: absolute;
724
- top: 50%;
725
- transform: translateY(-50%);
726
- width: 44px;
727
- height: 44px;
728
- border-radius: 50%;
729
- border: none;
730
- background: rgba(0, 0, 0, 0.5);
731
- color: white;
732
- font-size: 24px;
733
- font-weight: bold;
734
- cursor: pointer;
735
- display: flex;
736
- align-items: center;
737
- justify-content: center;
738
- transition: background 0.2s ease;
739
- z-index: 15;
740
- }
741
-
742
- .pdp-story-nav:hover {
743
- background: rgba(0, 0, 0, 0.7);
744
- }
745
-
746
- .pdp-story-nav-prev {
747
- left: 16px;
748
- }
749
-
750
- .pdp-story-nav-next {
751
- right: 16px;
752
- }
753
-
754
- .pdp-story-indicators {
755
- position: absolute;
756
- bottom: 120px;
757
- left: 50%;
758
- transform: translateX(-50%);
759
- display: flex;
760
- gap: 8px;
761
- z-index: 15;
762
- }
763
-
764
- .pdp-story-indicator {
765
- width: 8px;
766
- height: 8px;
767
- border-radius: 50%;
768
- background: rgba(255, 255, 255, 0.5);
769
- transition: background 0.2s ease;
770
- }
771
-
772
- .pdp-story-indicator.active {
773
- background: white;
774
- }
775
-
776
- .pdp-story-content {
777
- position: absolute;
778
- bottom: 0;
779
- left: 0;
780
- right: 0;
781
- background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
782
- padding: 20px;
783
- color: white;
784
- z-index: 15;
785
- }
786
-
787
- .pdp-story-header {
788
- display: flex;
789
- justify-content: space-between;
790
- align-items: flex-start;
791
- margin-bottom: 16px;
792
- }
793
-
794
- .pdp-story-title {
795
- font-size: 20px;
796
- font-weight: 600;
797
- margin: 0;
798
- flex: 1;
799
- text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
800
- }
801
-
802
- .pdp-story-price {
803
- font-size: 18px;
804
- font-weight: 700;
805
- color: #4ade80;
806
- text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
807
- }
808
-
809
- .pdp-story-details {
810
- display: grid;
811
- grid-template-columns: 1fr 1fr;
812
- gap: 12px 16px;
813
- margin-bottom: 16px;
814
- }
815
-
816
- .pdp-story-detail {
817
- display: flex;
818
- flex-direction: column;
819
- gap: 4px;
820
- }
821
-
822
- .pdp-story-label {
823
- font-size: 12px;
824
- color: rgba(255, 255, 255, 0.7);
825
- font-weight: 500;
826
- text-transform: uppercase;
827
- letter-spacing: 0.5px;
828
- }
829
-
830
- .pdp-story-value {
831
- font-size: 14px;
832
- font-weight: 600;
833
- text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
834
- }
835
-
836
- .pdp-story-highlights {
837
- display: flex;
838
- gap: 16px;
839
- }
840
-
841
- .pdp-story-highlight {
842
- flex: 1;
843
- text-align: center;
844
- padding: 12px;
845
- background: rgba(255, 255, 255, 0.1);
846
- border-radius: 8px;
847
- backdrop-filter: blur(10px);
848
- }
849
-
850
- .pdp-story-highlight-value {
851
- display: block;
852
- font-size: 16px;
853
- font-weight: 700;
854
- margin-bottom: 4px;
855
- text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
856
- }
857
-
858
- .pdp-story-highlight-label {
859
- font-size: 12px;
860
- color: rgba(255, 255, 255, 0.8);
861
- font-weight: 500;
862
- text-transform: uppercase;
863
- letter-spacing: 0.5px;
864
- }
865
-
866
- /* Responsive adjustments for PDP story */
867
- @media (max-width: 768px) {
868
- .pdp-story-content {
869
- padding: 16px;
870
- }
871
-
872
- .pdp-story-title {
873
- font-size: 18px;
874
- }
875
-
876
- .pdp-story-price {
877
- font-size: 16px;
878
- }
879
-
880
- .pdp-story-details {
881
- grid-template-columns: 1fr;
882
- gap: 8px;
883
- }
884
-
885
- .pdp-story-highlights {
886
- gap: 12px;
887
- }
888
-
889
- .pdp-story-highlight {
890
- padding: 10px;
891
- }
892
-
893
- .pdp-story-highlight-value {
894
- font-size: 14px;
895
- }
896
-
897
- .pdp-story-nav {
898
- width: 40px;
899
- height: 40px;
900
- font-size: 20px;
901
- }
902
-
903
- .pdp-story-indicators {
904
- bottom: 100px;
905
- }
906
- }
907
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-instagram-stories",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "description": "High-performance, fully customizable Instagram-style Stories component for React with TypeScript support",
5
5
  "author": "Ankit Jangir",
6
6
  "license": "MIT",
@@ -46,8 +46,7 @@
46
46
  },
47
47
  "peerDependencies": {
48
48
  "react": ">=18.0.0",
49
- "react-dom": ">=18.0.0",
50
- "react-router-dom": ">=6.0.0"
49
+ "react-dom": ">=18.0.0"
51
50
  },
52
51
  "devDependencies": {
53
52
  "@types/node": "^25.0.9",
@@ -55,17 +54,15 @@
55
54
  "@types/react-dom": "^18.2.0",
56
55
  "@vitejs/plugin-react": "^4.0.0",
57
56
  "autoprefixer": "^10.4.23",
57
+ "framer-motion": "^12.26.2",
58
58
  "lucide-react": "^0.562.0",
59
59
  "postcss": "^8.5.6",
60
60
  "tailwindcss": "^3.4.19",
61
+ "tailwindcss-animate": "^1.0.7",
61
62
  "tsup": "^8.5.1",
62
63
  "typescript": "^5.0.0",
63
64
  "vite": "^4.3.0"
64
65
  },
65
- "dependencies": {
66
- "framer-motion": "^12.26.2",
67
- "tailwindcss-animate": "^1.0.7"
68
- },
69
66
  "sideEffects": [
70
67
  "*.css"
71
68
  ]