@qwanyx/carousel 0.1.4 → 0.1.6

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/index.js CHANGED
@@ -749,11 +749,21 @@ function Thumbnails({
749
749
  // src/components/Carousel.tsx
750
750
  var import_jsx_runtime3 = require("react/jsx-runtime");
751
751
  function extractSlideUrl(slide) {
752
- const layer = slide.layers?.[0];
753
- if (!layer) return void 0;
754
- const imageObj = layer.objects?.find((obj) => obj.type === "image");
755
- if (imageObj && "src" in imageObj) {
756
- return imageObj.src;
752
+ for (const layer of slide.layers || []) {
753
+ for (const obj of layer.objects || []) {
754
+ if ("src" in obj && typeof obj.src === "string") {
755
+ return obj.src;
756
+ }
757
+ if ("url" in obj && typeof obj.url === "string") {
758
+ return obj.url;
759
+ }
760
+ }
761
+ }
762
+ if (slide.url) {
763
+ return slide.url;
764
+ }
765
+ if (slide.src) {
766
+ return slide.src;
757
767
  }
758
768
  return void 0;
759
769
  }
@@ -893,6 +903,9 @@ var Carousel = (0, import_react4.forwardRef)(
893
903
  (0, import_react4.useEffect)(() => {
894
904
  if (!nav.keyboard) return;
895
905
  const handleKeyDown = (e) => {
906
+ const target = e.target;
907
+ const isFormElement = target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT" || target.isContentEditable;
908
+ if (isFormElement) return;
896
909
  switch (e.key) {
897
910
  case "ArrowRight":
898
911
  case "ArrowDown":
package/dist/index.mjs CHANGED
@@ -714,11 +714,21 @@ function Thumbnails({
714
714
  // src/components/Carousel.tsx
715
715
  import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
716
716
  function extractSlideUrl(slide) {
717
- const layer = slide.layers?.[0];
718
- if (!layer) return void 0;
719
- const imageObj = layer.objects?.find((obj) => obj.type === "image");
720
- if (imageObj && "src" in imageObj) {
721
- return imageObj.src;
717
+ for (const layer of slide.layers || []) {
718
+ for (const obj of layer.objects || []) {
719
+ if ("src" in obj && typeof obj.src === "string") {
720
+ return obj.src;
721
+ }
722
+ if ("url" in obj && typeof obj.url === "string") {
723
+ return obj.url;
724
+ }
725
+ }
726
+ }
727
+ if (slide.url) {
728
+ return slide.url;
729
+ }
730
+ if (slide.src) {
731
+ return slide.src;
722
732
  }
723
733
  return void 0;
724
734
  }
@@ -858,6 +868,9 @@ var Carousel = forwardRef(
858
868
  useEffect3(() => {
859
869
  if (!nav.keyboard) return;
860
870
  const handleKeyDown = (e) => {
871
+ const target = e.target;
872
+ const isFormElement = target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT" || target.isContentEditable;
873
+ if (isFormElement) return;
861
874
  switch (e.key) {
862
875
  case "ArrowRight":
863
876
  case "ArrowDown":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwanyx/carousel",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"