@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20261016035045 → 0.8.1-dev.20261016054542

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.
@@ -88,6 +88,7 @@ var LineTextInput = (props) => {
88
88
  autoFocus: props?.attributes?.autoFocus,
89
89
  required: props?.attributes?.required,
90
90
  placeholder: props?.attributes?.placeholder,
91
+ size: props?.attributes?.size,
91
92
  maxLength: props?.attributes?.maxLength,
92
93
  pattern: props?.attributes?.pattern,
93
94
  disabled: props?.attributes?.readOnly,
package/dist/index.d.mts CHANGED
@@ -169,6 +169,7 @@ interface InputControlProps {
169
169
  label?: string;
170
170
  hintText?: string;
171
171
  placeholder?: string;
172
+ size?: number;
172
173
  required?: boolean;
173
174
  errorMessage?: string;
174
175
  helpText?: string;
package/dist/index.d.ts CHANGED
@@ -169,6 +169,7 @@ interface InputControlProps {
169
169
  label?: string;
170
170
  hintText?: string;
171
171
  placeholder?: string;
172
+ size?: number;
172
173
  required?: boolean;
173
174
  errorMessage?: string;
174
175
  helpText?: string;
package/dist/index.js CHANGED
@@ -2268,6 +2268,7 @@ var init_LineTextInput = __esm({
2268
2268
  autoFocus: props?.attributes?.autoFocus,
2269
2269
  required: props?.attributes?.required,
2270
2270
  placeholder: props?.attributes?.placeholder,
2271
+ size: props?.attributes?.size,
2271
2272
  maxLength: props?.attributes?.maxLength,
2272
2273
  pattern: props?.attributes?.pattern,
2273
2274
  disabled: props?.attributes?.readOnly,
@@ -7194,8 +7195,15 @@ var init_Slider = __esm({
7194
7195
  );
7195
7196
  const [isPlaying, setIsPlaying] = (0, import_react62.useState)(autoplay);
7196
7197
  const trackRef = (0, import_react62.useRef)(null);
7197
- console.log("trackRef:", trackRef);
7198
7198
  const [videoProgress, setVideoProgress] = (0, import_react62.useState)(null);
7199
+ const activeVideosRef = (0, import_react62.useRef)([]);
7200
+ const completedVideosRef = (0, import_react62.useRef)(/* @__PURE__ */ new Set());
7201
+ const nextSlideRef = (0, import_react62.useRef)(() => {
7202
+ });
7203
+ const isPlayingRef = (0, import_react62.useRef)(isPlaying);
7204
+ (0, import_react62.useEffect)(() => {
7205
+ isPlayingRef.current = isPlaying;
7206
+ }, [isPlaying]);
7199
7207
  (0, import_react62.useEffect)(() => {
7200
7208
  if (typeof initialSlidesToShow === "number") {
7201
7209
  setSlidesToShowState(initialSlidesToShow);
@@ -7214,51 +7222,6 @@ var init_Slider = __esm({
7214
7222
  window.addEventListener("resize", handleResize);
7215
7223
  return () => window.removeEventListener("resize", handleResize);
7216
7224
  }, [initialSlidesToShow]);
7217
- (0, import_react62.useEffect)(() => {
7218
- if (!autoplay) return;
7219
- const activeSlideElement = trackRef.current?.children[currentSlide];
7220
- const videoElement = activeSlideElement?.querySelector("video");
7221
- if (videoElement) {
7222
- videoElement.loop = false;
7223
- setVideoProgress(0);
7224
- if (videoElement.ended) {
7225
- videoElement.currentTime = 0;
7226
- }
7227
- videoElement.play().catch(() => {
7228
- });
7229
- const handleTimeUpdate = () => {
7230
- if (videoElement.duration && !isNaN(videoElement.duration) && videoElement.duration > 0) {
7231
- const pct = videoElement.currentTime / videoElement.duration * 100;
7232
- setVideoProgress(pct);
7233
- }
7234
- };
7235
- const handleVideoEnded = () => {
7236
- setVideoProgress(100);
7237
- nextSlide();
7238
- };
7239
- const handleVideoError = () => {
7240
- nextSlide();
7241
- };
7242
- videoElement.addEventListener("timeupdate", handleTimeUpdate);
7243
- videoElement.addEventListener("loadedmetadata", handleTimeUpdate);
7244
- videoElement.addEventListener("ended", handleVideoEnded, { once: true });
7245
- videoElement.addEventListener("error", handleVideoError, { once: true });
7246
- return () => {
7247
- videoElement.removeEventListener("timeupdate", handleTimeUpdate);
7248
- videoElement.removeEventListener("loadedmetadata", handleTimeUpdate);
7249
- videoElement.removeEventListener("ended", handleVideoEnded);
7250
- videoElement.removeEventListener("error", handleVideoError);
7251
- videoElement.pause();
7252
- setVideoProgress(null);
7253
- };
7254
- }
7255
- const timer = setInterval(() => {
7256
- if (isPlaying) {
7257
- nextSlide();
7258
- }
7259
- }, autoplay_speed);
7260
- return () => clearInterval(timer);
7261
- }, [autoplay, autoplay_speed, currentSlide, isPlaying]);
7262
7225
  const totalSlides = import_react62.Children.count(children);
7263
7226
  const numColumns = columns ?? slidesToShowState;
7264
7227
  const slideWidthPercentage = (() => {
@@ -7274,17 +7237,18 @@ var init_Slider = __esm({
7274
7237
  const effectiveSlidesToShow = 100 / slideWidthPercentage;
7275
7238
  const maxSlide = Math.max(0, Math.ceil(totalSlides - effectiveSlidesToShow));
7276
7239
  const step = scrollByColumns ? Math.max(1, Math.floor(effectiveSlidesToShow)) : 1;
7277
- const slidePositions = Array.from(
7240
+ const rawPositions = Array.from(
7278
7241
  { length: Math.ceil(maxSlide / step) + 1 },
7279
7242
  (_, index) => Math.min(index * step, maxSlide)
7280
7243
  );
7244
+ const slidePositions = Array.from(new Set(rawPositions));
7281
7245
  const currentStepIndex = slidePositions.reduce(
7282
7246
  (closestIndex, position, index) => Math.abs(position - currentSlide) < Math.abs(slidePositions[closestIndex] - currentSlide) ? index : closestIndex,
7283
7247
  0
7284
7248
  );
7285
7249
  const nextSlide = () => {
7286
7250
  if (currentStepIndex >= slidePositions.length - 1) {
7287
- if (infinite_scroll) {
7251
+ if (infinite_scroll || autoplay) {
7288
7252
  setTransition(true);
7289
7253
  setCurrentSlide(0);
7290
7254
  }
@@ -7293,6 +7257,7 @@ var init_Slider = __esm({
7293
7257
  setCurrentSlide(slidePositions[currentStepIndex + 1]);
7294
7258
  }
7295
7259
  };
7260
+ nextSlideRef.current = nextSlide;
7296
7261
  const prevSlide = () => {
7297
7262
  if (currentStepIndex <= 0) {
7298
7263
  if (infinite_scroll) {
@@ -7314,6 +7279,242 @@ var init_Slider = __esm({
7314
7279
  setIsPlaying(true);
7315
7280
  }
7316
7281
  };
7282
+ const getVisibleSlideElements = () => {
7283
+ if (!trackRef.current) return [];
7284
+ const childEls = Array.from(trackRef.current.children);
7285
+ if (childEls.length === 0) return [];
7286
+ const container = trackRef.current.parentElement;
7287
+ if (container) {
7288
+ const containerRect = container.getBoundingClientRect();
7289
+ if (containerRect.width > 0) {
7290
+ const visibleByRect = childEls.filter((child) => {
7291
+ const rect = child.getBoundingClientRect();
7292
+ const visibleLeft = Math.max(containerRect.left, rect.left);
7293
+ const visibleRight = Math.min(containerRect.right, rect.right);
7294
+ const visibleWidth = visibleRight - visibleLeft;
7295
+ return visibleWidth > 20 || visibleWidth / (rect.width || 1) > 0.15;
7296
+ });
7297
+ if (visibleByRect.length > 0) {
7298
+ return visibleByRect;
7299
+ }
7300
+ }
7301
+ }
7302
+ const cols = columns ?? slidesToShowState ?? 1;
7303
+ const numCols = Math.max(1, Math.round(effectiveSlidesToShow || cols || 1));
7304
+ const startIndex = Math.max(0, Math.min(currentSlide, childEls.length - 1));
7305
+ return childEls.slice(startIndex, Math.min(childEls.length, startIndex + numCols));
7306
+ };
7307
+ const getVisibleVideos = () => {
7308
+ const slideEls = getVisibleSlideElements();
7309
+ const vids = [];
7310
+ for (const el of slideEls) {
7311
+ const found = el.querySelectorAll("video");
7312
+ found.forEach((v) => {
7313
+ if (!vids.includes(v)) {
7314
+ vids.push(v);
7315
+ }
7316
+ });
7317
+ }
7318
+ return vids;
7319
+ };
7320
+ const pauseInactiveVideos = (activeVids) => {
7321
+ if (!trackRef.current) return;
7322
+ const allVideos = Array.from(trackRef.current.querySelectorAll("video"));
7323
+ for (const vid of allVideos) {
7324
+ if (!activeVids.includes(vid)) {
7325
+ vid.pause();
7326
+ try {
7327
+ if (!vid.ended && vid.currentTime > 0) {
7328
+ vid.currentTime = 0;
7329
+ }
7330
+ } catch {
7331
+ }
7332
+ }
7333
+ }
7334
+ for (const vid of Array.from(completedVideosRef.current)) {
7335
+ if (!activeVids.includes(vid)) {
7336
+ completedVideosRef.current.delete(vid);
7337
+ }
7338
+ }
7339
+ };
7340
+ (0, import_react62.useEffect)(() => {
7341
+ const vids = activeVideosRef.current;
7342
+ if (!vids || vids.length === 0) return;
7343
+ for (const video of vids) {
7344
+ if (isPlaying) {
7345
+ video.play().catch(() => {
7346
+ });
7347
+ } else {
7348
+ video.pause();
7349
+ }
7350
+ }
7351
+ }, [isPlaying]);
7352
+ (0, import_react62.useEffect)(() => {
7353
+ if (!autoplay) return;
7354
+ let isEffectActive = true;
7355
+ let cleanupVideo = null;
7356
+ let timer = null;
7357
+ let observer = null;
7358
+ const setupVisibleVideos = (videosToPlay) => {
7359
+ if (!isEffectActive) return;
7360
+ if (timer) {
7361
+ clearInterval(timer);
7362
+ timer = null;
7363
+ }
7364
+ const allVisVideos = getVisibleVideos();
7365
+ pauseInactiveVideos(allVisVideos);
7366
+ activeVideosRef.current = videosToPlay;
7367
+ const pendingVideos = videosToPlay.filter((v) => !completedVideosRef.current.has(v));
7368
+ if (pendingVideos.length === 0) {
7369
+ setVideoProgress(100);
7370
+ nextSlideRef.current();
7371
+ return;
7372
+ }
7373
+ const startedVideos = /* @__PURE__ */ new Set();
7374
+ let hasTriggeredNext = false;
7375
+ const checkAllPendingEnded = () => {
7376
+ if (!isEffectActive || hasTriggeredNext) return;
7377
+ for (const vid of pendingVideos) {
7378
+ if (!completedVideosRef.current.has(vid)) {
7379
+ const hasStarted = startedVideos.has(vid);
7380
+ const isAtEnd = vid.ended || vid.duration > 0 && vid.currentTime >= vid.duration - 0.25;
7381
+ if (hasStarted && isAtEnd) {
7382
+ completedVideosRef.current.add(vid);
7383
+ }
7384
+ }
7385
+ }
7386
+ const allFinished = pendingVideos.every((v) => completedVideosRef.current.has(v));
7387
+ if (allFinished) {
7388
+ hasTriggeredNext = true;
7389
+ setVideoProgress(100);
7390
+ nextSlideRef.current();
7391
+ }
7392
+ };
7393
+ const handleTimeUpdate = () => {
7394
+ if (!isEffectActive || hasTriggeredNext) return;
7395
+ let maxDuration = 0;
7396
+ let activeProgress = 0;
7397
+ for (const v of pendingVideos) {
7398
+ if (v.currentTime > 0.05 || !v.paused) {
7399
+ startedVideos.add(v);
7400
+ }
7401
+ if (v.duration && !isNaN(v.duration) && v.duration > maxDuration) {
7402
+ maxDuration = v.duration;
7403
+ activeProgress = v.currentTime / v.duration * 100;
7404
+ }
7405
+ }
7406
+ if (maxDuration > 0) {
7407
+ setVideoProgress(Math.min(100, Math.max(0, activeProgress)));
7408
+ }
7409
+ checkAllPendingEnded();
7410
+ };
7411
+ const handleVideoEnded = (e) => {
7412
+ const vid = e.target;
7413
+ if (vid) {
7414
+ startedVideos.add(vid);
7415
+ completedVideosRef.current.add(vid);
7416
+ }
7417
+ checkAllPendingEnded();
7418
+ };
7419
+ const handlePlaying = (e) => {
7420
+ const vid = e.target;
7421
+ if (vid) {
7422
+ startedVideos.add(vid);
7423
+ }
7424
+ };
7425
+ const handleVideoError = (e) => {
7426
+ const vid = e.target;
7427
+ if (vid) {
7428
+ completedVideosRef.current.add(vid);
7429
+ }
7430
+ checkAllPendingEnded();
7431
+ };
7432
+ for (const vid of pendingVideos) {
7433
+ vid.muted = true;
7434
+ vid.defaultMuted = true;
7435
+ vid.playsInline = true;
7436
+ vid.loop = false;
7437
+ vid.removeAttribute("loop");
7438
+ if (vid.ended || vid.duration && vid.currentTime >= vid.duration - 0.25) {
7439
+ vid.currentTime = 0;
7440
+ }
7441
+ vid.addEventListener("timeupdate", handleTimeUpdate);
7442
+ vid.addEventListener("loadedmetadata", handleTimeUpdate);
7443
+ vid.addEventListener("ended", handleVideoEnded);
7444
+ vid.addEventListener("playing", handlePlaying);
7445
+ vid.addEventListener("error", handleVideoError);
7446
+ if (isPlayingRef.current) {
7447
+ vid.play().catch(() => {
7448
+ });
7449
+ } else {
7450
+ vid.pause();
7451
+ }
7452
+ }
7453
+ cleanupVideo = () => {
7454
+ for (const vid of pendingVideos) {
7455
+ vid.removeEventListener("timeupdate", handleTimeUpdate);
7456
+ vid.removeEventListener("loadedmetadata", handleTimeUpdate);
7457
+ vid.removeEventListener("ended", handleVideoEnded);
7458
+ vid.removeEventListener("playing", handlePlaying);
7459
+ vid.removeEventListener("error", handleVideoError);
7460
+ vid.pause();
7461
+ }
7462
+ activeVideosRef.current = [];
7463
+ setVideoProgress(null);
7464
+ };
7465
+ };
7466
+ const initialVideos = getVisibleVideos();
7467
+ const initialPending = initialVideos.filter((v) => !completedVideosRef.current.has(v));
7468
+ if (initialPending.length > 0) {
7469
+ setupVisibleVideos(initialPending);
7470
+ } else {
7471
+ pauseInactiveVideos([]);
7472
+ activeVideosRef.current = [];
7473
+ setVideoProgress(null);
7474
+ if (trackRef.current && typeof MutationObserver !== "undefined") {
7475
+ observer = new MutationObserver(() => {
7476
+ const asyncVideos = getVisibleVideos();
7477
+ const asyncPending = asyncVideos.filter((v) => !completedVideosRef.current.has(v));
7478
+ if (asyncPending.length > 0) {
7479
+ const hasNew = asyncPending.some((v) => !activeVideosRef.current.includes(v));
7480
+ if (hasNew) {
7481
+ if (observer) {
7482
+ observer.disconnect();
7483
+ observer = null;
7484
+ }
7485
+ setupVisibleVideos(asyncPending);
7486
+ }
7487
+ }
7488
+ });
7489
+ observer.observe(trackRef.current, { childList: true, subtree: true });
7490
+ }
7491
+ timer = setInterval(() => {
7492
+ const currentVids = getVisibleVideos();
7493
+ const currentPending = currentVids.filter((v) => !completedVideosRef.current.has(v));
7494
+ if (currentPending.length > 0) {
7495
+ clearInterval(timer);
7496
+ timer = null;
7497
+ setupVisibleVideos(currentPending);
7498
+ return;
7499
+ }
7500
+ if (isPlayingRef.current) {
7501
+ nextSlideRef.current();
7502
+ }
7503
+ }, autoplay_speed);
7504
+ }
7505
+ return () => {
7506
+ isEffectActive = false;
7507
+ if (cleanupVideo) {
7508
+ cleanupVideo();
7509
+ }
7510
+ if (timer) {
7511
+ clearInterval(timer);
7512
+ }
7513
+ if (observer) {
7514
+ observer.disconnect();
7515
+ }
7516
+ };
7517
+ }, [autoplay, autoplay_speed, currentSlide, slidesToShowState, columns]);
7317
7518
  const handleMouseEnter = () => {
7318
7519
  if (autoplay) {
7319
7520
  setIsPlaying(false);
@@ -7509,7 +7710,7 @@ var init_Slider = __esm({
7509
7710
  }
7510
7711
  };
7511
7712
  const renderProgressBar = () => {
7512
- if (style === "modern" && isActive) {
7713
+ if ((style === "modern" || style === "cumulative") && isActive) {
7513
7714
  const displayProgress = customProgress ?? progress;
7514
7715
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
7515
7716
  "div",
@@ -11053,6 +11254,7 @@ var DataList = (props) => {
11053
11254
  console.log(props.addLinkText);
11054
11255
  const [isDataFound, setIsDataFound] = (0, import_react69.useState)(null);
11055
11256
  const [searchTerm, setSearchTerm] = (0, import_react69.useState)(props.query?.searchTerm ?? "");
11257
+ const searchPlaceholder = `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`;
11056
11258
  (0, import_react69.useEffect)(() => {
11057
11259
  setSearchTerm(props.query?.searchTerm ?? "");
11058
11260
  }, [props.query?.searchTerm]);
@@ -11342,7 +11544,8 @@ var DataList = (props) => {
11342
11544
  callback: (e) => setSearchTerm(e.value),
11343
11545
  attributes: {
11344
11546
  autoFocus: true,
11345
- placeholder: `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`
11547
+ placeholder: searchPlaceholder,
11548
+ size: searchPlaceholder.length
11346
11549
  }
11347
11550
  }
11348
11551
  ),
@@ -11540,7 +11743,8 @@ var DataList = (props) => {
11540
11743
  callback: (e) => setSearchTerm(e.value),
11541
11744
  attributes: {
11542
11745
  autoFocus: true,
11543
- placeholder: `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`
11746
+ placeholder: searchPlaceholder,
11747
+ size: searchPlaceholder.length
11544
11748
  }
11545
11749
  }
11546
11750
  ),
package/dist/index.mjs CHANGED
@@ -31,7 +31,7 @@ import {
31
31
  getDialCodeByCountryCode,
32
32
  resolveCountry,
33
33
  splitPhoneNumber
34
- } from "./chunk-RNLQULF4.mjs";
34
+ } from "./chunk-GNIFUHGR.mjs";
35
35
  import {
36
36
  Constants,
37
37
  Hyperlink,
@@ -463,7 +463,7 @@ var ViewControl_default = ViewControl;
463
463
 
464
464
  // src/components/controls/edit/InputControl.tsx
465
465
  import dynamic7 from "next/dynamic";
466
- var InputControl = dynamic7(() => import("./InputControlClient-7CUK6ECL.mjs"), {
466
+ var InputControl = dynamic7(() => import("./InputControlClient-IKQYB764.mjs"), {
467
467
  ssr: false
468
468
  });
469
469
  var InputControl_default = InputControl;
@@ -2551,7 +2551,7 @@ var Pagination = dynamic16(() => import("./Pagination-6R4XZLF6.mjs"), { ssr: tru
2551
2551
  var DataBindingControls = dynamic16(() => import("./DataBindingControls-VSLL4WV2.mjs"), {
2552
2552
  ssr: true
2553
2553
  });
2554
- var Slider = dynamic16(() => import("./Slider-XDYPGJYI.mjs"), {
2554
+ var Slider = dynamic16(() => import("./Slider-TMKPDMQ4.mjs"), {
2555
2555
  ssr: false
2556
2556
  });
2557
2557
  function toCamelCase(str) {
@@ -3476,6 +3476,7 @@ var DataList = (props) => {
3476
3476
  console.log(props.addLinkText);
3477
3477
  const [isDataFound, setIsDataFound] = useState2(null);
3478
3478
  const [searchTerm, setSearchTerm] = useState2(props.query?.searchTerm ?? "");
3479
+ const searchPlaceholder = `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`;
3479
3480
  useEffect3(() => {
3480
3481
  setSearchTerm(props.query?.searchTerm ?? "");
3481
3482
  }, [props.query?.searchTerm]);
@@ -3765,7 +3766,8 @@ var DataList = (props) => {
3765
3766
  callback: (e) => setSearchTerm(e.value),
3766
3767
  attributes: {
3767
3768
  autoFocus: true,
3768
- placeholder: `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`
3769
+ placeholder: searchPlaceholder,
3770
+ size: searchPlaceholder.length
3769
3771
  }
3770
3772
  }
3771
3773
  ),
@@ -3963,7 +3965,8 @@ var DataList = (props) => {
3963
3965
  callback: (e) => setSearchTerm(e.value),
3964
3966
  attributes: {
3965
3967
  autoFocus: true,
3966
- placeholder: `Search by ${props.columns.filter((col) => col.isSearchable).map((col) => col.label).join(", ")}`
3968
+ placeholder: searchPlaceholder,
3969
+ size: searchPlaceholder.length
3967
3970
  }
3968
3971
  }
3969
3972
  ),