@tapcart/mobile-components 0.12.16 → 0.12.19

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.
@@ -1 +1 @@
1
- {"version":3,"file":"use-infinite-scroll.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-infinite-scroll.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAmB,MAAM,iBAAiB,CAAA;AAE1E,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAG5D,UAAU,QAAQ;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,GAAG,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;CACxC;AAED,UAAU,sBAAsB;IAE9B,YAAY,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAGxC,WAAW,CAAC,EAAE,QAAQ,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAGpC,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IAChD,YAAY,CAAC,EAAE,CACb,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,GAAG,GAAG,IAAI,EAC5B,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,GAAG,CAAA;IACR,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,UAAU,uBAAuB;IAC/B,IAAI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ch: shouldSkipFetchProp, }) => {
143
143
  return result;
144
144
  })
145
145
  : (...args) => __awaiter(void 0, void 0, void 0, function* () {
146
- const effectiveFetcher = customFetcher || apiFetcher;
147
- return effectiveFetcher(...args);
146
+ var _l, _m;
147
+ if (customFetcher) {
148
+ const result = yield customFetcher(...args);
149
+ productCount.current += (_m = (_l = result === null || result === void 0 ? void 0 : result.products) === null || _l === void 0 ? void 0 : _l.length) !== null && _m !== void 0 ? _m : 0;
150
+ return result;
151
+ }
152
+ return apiFetcher(args[0]);
148
153
  });
149
154
  // Check if caller provided pre-fetched products to display while SWR fetches
150
155
  const hasInitialProducts = Boolean((_a = initialData === null || initialData === void 0 ? void 0 : initialData.products) === null || _a === void 0 ? void 0 : _a.length);
@@ -7,11 +7,12 @@ type VideoAttributes = {
7
7
  autoplay: boolean;
8
8
  videoSound: boolean;
9
9
  };
10
- interface VideoProps extends React.VideoHTMLAttributes<HTMLVideoElement> {
10
+ interface VideoProps extends Omit<React.VideoHTMLAttributes<HTMLVideoElement>, "onLoadedData"> {
11
11
  src: string;
12
12
  videoAttributes: VideoAttributes;
13
13
  naturalAspectRatio?: string;
14
14
  className?: string;
15
+ onLoadedData?: (target: HTMLVideoElement | Event) => void;
15
16
  }
16
17
  declare const Video: React.ForwardRefExoticComponent<VideoProps & React.RefAttributes<HTMLVideoElement>>;
17
18
  export { Video as VideoEnhanced };
@@ -1 +1 @@
1
- {"version":3,"file":"video-enhanced.d.ts","sourceRoot":"","sources":["../../../components/ui/video-enhanced.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,UAAU,UAAW,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACtE,GAAG,EAAE,MAAM,CAAA;IACX,eAAe,EAAE,eAAe,CAAA;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,KAAK,qFA4OV,CAAA;AAID,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,CAAA"}
1
+ {"version":3,"file":"video-enhanced.d.ts","sourceRoot":"","sources":["../../../components/ui/video-enhanced.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkB9B,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,UAAU,UACR,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC;IACzE,GAAG,EAAE,MAAM,CAAA;IACX,eAAe,EAAE,eAAe,CAAA;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAKlB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,GAAG,KAAK,KAAK,IAAI,CAAA;CAC1D;AAED,QAAA,MAAM,KAAK,qFAkQV,CAAA;AAID,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,CAAA"}
@@ -28,6 +28,12 @@ const videoVariants = {
28
28
  contain: "object-contain",
29
29
  },
30
30
  };
31
+ // If `loadeddata` (first frame, readyState 2) has not fired this long after
32
+ // metadata is available, reveal anyway — the element is renderable and the
33
+ // environment is not going to advance readyState on its own (no autoplay,
34
+ // offscreen, or `preload="metadata"` honored). Healthy connections decode the
35
+ // first frame well within this window, so they still reveal via `loadeddata`.
36
+ const LOADED_DATA_FALLBACK_MS = 1000;
31
37
  const Video = React.forwardRef((_a, ref) => {
32
38
  var { src, videoAttributes, naturalAspectRatio = "1/1", className, onLoadedData } = _a, props = __rest(_a, ["src", "videoAttributes", "naturalAspectRatio", "className", "onLoadedData"]);
33
39
  const autoPlayEnabled = videoAttributes.autoplay && !videoAttributes.videoSound;
@@ -35,6 +41,12 @@ const Video = React.forwardRef((_a, ref) => {
35
41
  const videoRef = ref || internalRef;
36
42
  const observerRef = React.useRef(null);
37
43
  const lastPositionRef = React.useRef(0);
44
+ // The loaded-data effect runs once (empty deps), so read the callback
45
+ // through a ref to always invoke the latest one without re-arming listeners.
46
+ const onLoadedDataRef = React.useRef(onLoadedData);
47
+ React.useEffect(() => {
48
+ onLoadedDataRef.current = onLoadedData;
49
+ }, [onLoadedData]);
38
50
  const [isLoaded, setIsLoaded] = React.useState(false);
39
51
  const [isVisible, setIsVisible] = React.useState(false);
40
52
  const [isPlaying, setIsPlaying] = React.useState(false);
@@ -160,6 +172,25 @@ const Video = React.forwardRef((_a, ref) => {
160
172
  const video = videoRef.current;
161
173
  if (!video)
162
174
  return;
175
+ // Notify the parent at most once. Prefer `loadeddata` (first frame
176
+ // decoded, readyState >= 2), but fall back to a short timer armed on
177
+ // `loadedmetadata`: environments that honor `preload="metadata"` and
178
+ // defer/block autoplay (iOS WebView, Low Power Mode) or keep the element
179
+ // offscreen (e.g. a carousel slide that never intersects) can settle at
180
+ // readyState 1 and never advance to 2, so `loadeddata` never fires. The
181
+ // parent's fade-in (opacity-0 -> opacity-100) is gated on this callback,
182
+ // so without the fallback the video stays invisible forever.
183
+ let notified = false;
184
+ let metadataFallback = null;
185
+ const notifyLoaded = () => {
186
+ var _a;
187
+ if (notified)
188
+ return;
189
+ notified = true;
190
+ if (metadataFallback)
191
+ clearTimeout(metadataFallback);
192
+ (_a = onLoadedDataRef.current) === null || _a === void 0 ? void 0 : _a.call(onLoadedDataRef, video);
193
+ };
163
194
  const handleLoadedMetadata = () => {
164
195
  setIsLoaded(true);
165
196
  if (autoPlayEnabled && isVisible) {
@@ -169,23 +200,23 @@ const Video = React.forwardRef((_a, ref) => {
169
200
  console.error("Error playing video:", error);
170
201
  });
171
202
  }
172
- };
173
- const handleLoadedData = () => {
174
- onLoadedData === null || onLoadedData === void 0 ? void 0 : onLoadedData({
175
- target: video,
176
- });
203
+ if (!notified && metadataFallback === null) {
204
+ metadataFallback = setTimeout(notifyLoaded, LOADED_DATA_FALLBACK_MS);
205
+ }
177
206
  };
178
207
  if (video.readyState >= 1) {
179
208
  handleLoadedMetadata();
180
209
  }
181
210
  if (video.readyState >= 2) {
182
- handleLoadedData();
211
+ notifyLoaded();
183
212
  }
184
213
  video.addEventListener("loadedmetadata", handleLoadedMetadata);
185
- video.addEventListener("loadeddata", handleLoadedData);
214
+ video.addEventListener("loadeddata", notifyLoaded);
186
215
  return () => {
187
216
  video.removeEventListener("loadedmetadata", handleLoadedMetadata);
188
- video.removeEventListener("loadeddata", handleLoadedData);
217
+ video.removeEventListener("loadeddata", notifyLoaded);
218
+ if (metadataFallback)
219
+ clearTimeout(metadataFallback);
189
220
  };
190
221
  }, []);
191
222
  const videoStyle = {
package/dist/styles.css CHANGED
@@ -997,6 +997,9 @@ video {
997
997
  .mt-0 {
998
998
  margin-top: 0px;
999
999
  }
1000
+ .mt-0\.5 {
1001
+ margin-top: 0.125rem;
1002
+ }
1000
1003
  .mt-1 {
1001
1004
  margin-top: 0.25rem;
1002
1005
  }
@@ -1183,6 +1186,9 @@ video {
1183
1186
  .h-\[68px\] {
1184
1187
  height: 68px;
1185
1188
  }
1189
+ .h-\[70px\] {
1190
+ height: 70px;
1191
+ }
1186
1192
  .h-\[80vh\] {
1187
1193
  height: 80vh;
1188
1194
  }
@@ -1214,6 +1220,9 @@ video {
1214
1220
  .min-h-11 {
1215
1221
  min-height: 2.75rem;
1216
1222
  }
1223
+ .min-h-12 {
1224
+ min-height: 3rem;
1225
+ }
1217
1226
  .min-h-16 {
1218
1227
  min-height: 4rem;
1219
1228
  }
@@ -1268,6 +1277,9 @@ video {
1268
1277
  .w-1\/2 {
1269
1278
  width: 50%;
1270
1279
  }
1280
+ .w-1\/3 {
1281
+ width: 33.333333%;
1282
+ }
1271
1283
  .w-1\/4 {
1272
1284
  width: 25%;
1273
1285
  }
@@ -1316,6 +1328,9 @@ video {
1316
1328
  .w-4 {
1317
1329
  width: 1rem;
1318
1330
  }
1331
+ .w-4\/5 {
1332
+ width: 80%;
1333
+ }
1319
1334
  .w-5 {
1320
1335
  width: 1.25rem;
1321
1336
  }
@@ -1340,6 +1355,9 @@ video {
1340
1355
  .w-\[138px\] {
1341
1356
  width: 138px;
1342
1357
  }
1358
+ .w-\[180px\] {
1359
+ width: 180px;
1360
+ }
1343
1361
  .w-\[1px\] {
1344
1362
  width: 1px;
1345
1363
  }
@@ -1358,9 +1376,18 @@ video {
1358
1376
  .w-\[40px\] {
1359
1377
  width: 40px;
1360
1378
  }
1379
+ .w-\[42\%\] {
1380
+ width: 42%;
1381
+ }
1382
+ .w-\[46px\] {
1383
+ width: 46px;
1384
+ }
1361
1385
  .w-\[65\%\] {
1362
1386
  width: 65%;
1363
1387
  }
1388
+ .w-\[calc\(100\%-2rem\)\] {
1389
+ width: calc(100% - 2rem);
1390
+ }
1364
1391
  .w-auto {
1365
1392
  width: auto;
1366
1393
  }
@@ -1390,6 +1417,9 @@ video {
1390
1417
  .min-w-6 {
1391
1418
  min-width: 1.5rem;
1392
1419
  }
1420
+ .min-w-8 {
1421
+ min-width: 2rem;
1422
+ }
1393
1423
  .min-w-\[8rem\] {
1394
1424
  min-width: 8rem;
1395
1425
  }
@@ -1400,6 +1430,9 @@ video {
1400
1430
  .max-w-\[140px\] {
1401
1431
  max-width: 140px;
1402
1432
  }
1433
+ .max-w-\[174px\] {
1434
+ max-width: 174px;
1435
+ }
1403
1436
  .max-w-\[198px\] {
1404
1437
  max-width: 198px;
1405
1438
  }
@@ -1738,6 +1771,9 @@ video {
1738
1771
  .gap-4 {
1739
1772
  gap: 1rem;
1740
1773
  }
1774
+ .gap-5 {
1775
+ gap: 1.25rem;
1776
+ }
1741
1777
  .gap-\[7px\] {
1742
1778
  gap: 7px;
1743
1779
  }
@@ -2280,6 +2316,10 @@ video {
2280
2316
  padding-left: 2rem;
2281
2317
  padding-right: 2rem;
2282
2318
  }
2319
+ .px-\[18px\] {
2320
+ padding-left: 18px;
2321
+ padding-right: 18px;
2322
+ }
2283
2323
  .px-\[7px\] {
2284
2324
  padding-left: 7px;
2285
2325
  padding-right: 7px;
@@ -2320,6 +2360,10 @@ video {
2320
2360
  padding-top: 1rem;
2321
2361
  padding-bottom: 1rem;
2322
2362
  }
2363
+ .py-5 {
2364
+ padding-top: 1.25rem;
2365
+ padding-bottom: 1.25rem;
2366
+ }
2323
2367
  .py-8 {
2324
2368
  padding-top: 2rem;
2325
2369
  padding-bottom: 2rem;
@@ -2454,9 +2498,15 @@ video {
2454
2498
  .text-\[15px\] {
2455
2499
  font-size: 15px;
2456
2500
  }
2501
+ .text-\[16px\] {
2502
+ font-size: 16px;
2503
+ }
2457
2504
  .text-\[18px\] {
2458
2505
  font-size: 18px;
2459
2506
  }
2507
+ .text-\[22px\] {
2508
+ font-size: 22px;
2509
+ }
2460
2510
  .text-\[23px\] {
2461
2511
  font-size: 23px;
2462
2512
  }
@@ -2503,6 +2553,9 @@ video {
2503
2553
  .italic {
2504
2554
  font-style: italic;
2505
2555
  }
2556
+ .leading-4 {
2557
+ line-height: 1rem;
2558
+ }
2506
2559
  .leading-6 {
2507
2560
  line-height: 1.5rem;
2508
2561
  }
@@ -2521,9 +2574,21 @@ video {
2521
2574
  .leading-\[160\%\] {
2522
2575
  line-height: 160%;
2523
2576
  }
2577
+ .leading-\[20px\] {
2578
+ line-height: 20px;
2579
+ }
2580
+ .leading-\[22\.4px\] {
2581
+ line-height: 22.4px;
2582
+ }
2583
+ .leading-\[22px\] {
2584
+ line-height: 22px;
2585
+ }
2524
2586
  .leading-\[24px\] {
2525
2587
  line-height: 24px;
2526
2588
  }
2589
+ .leading-\[28px\] {
2590
+ line-height: 28px;
2591
+ }
2527
2592
  .leading-none {
2528
2593
  line-height: 1;
2529
2594
  }
@@ -3275,10 +3340,18 @@ body::-webkit-scrollbar {
3275
3340
  color: var(--stateColors-disabled);
3276
3341
  }
3277
3342
 
3343
+ .disabled\:opacity-40:disabled {
3344
+ opacity: 0.4;
3345
+ }
3346
+
3278
3347
  .disabled\:opacity-50:disabled {
3279
3348
  opacity: 0.5;
3280
3349
  }
3281
3350
 
3351
+ .disabled\:opacity-60:disabled {
3352
+ opacity: 0.6;
3353
+ }
3354
+
3282
3355
  .disabled\:opacity-70:disabled {
3283
3356
  opacity: 0.7;
3284
3357
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.12.16",
3
+ "version": "0.12.19",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",