@lindle/linoardo 1.0.8 → 1.0.9

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React6 = require('react');
3
+ var React5 = require('react');
4
4
  var tailwindMerge = require('tailwind-merge');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
@@ -22,7 +22,7 @@ function _interopNamespace(e) {
22
22
  return Object.freeze(n);
23
23
  }
24
24
 
25
- var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
25
+ var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
26
26
 
27
27
  // src/Containment/Button/index.tsx
28
28
 
@@ -121,7 +121,7 @@ var sizeClasses = {
121
121
  large: "px-6 py-3 text-lg",
122
122
  "x-large": "px-7 py-3.5 text-xl"
123
123
  };
124
- var Button = React6__namespace.forwardRef(
124
+ var Button = React5__namespace.forwardRef(
125
125
  ({
126
126
  variant = "solid",
127
127
  color = "primary",
@@ -260,7 +260,7 @@ var resolveIconClassName2 = (icon) => {
260
260
  const normalized = iconName.startsWith("mdi-") ? iconName : `mdi-${iconName}`;
261
261
  return Array.from(/* @__PURE__ */ new Set([...baseClasses, normalized])).join(" ");
262
262
  };
263
- var Chip = React6__namespace.forwardRef(
263
+ var Chip = React5__namespace.forwardRef(
264
264
  ({
265
265
  variant = "solid",
266
266
  color = "primary",
@@ -292,7 +292,7 @@ var Chip = React6__namespace.forwardRef(
292
292
  const appendIconClassName = resolveIconClassName2(appendIcon);
293
293
  const closeIconClassName = resolveIconClassName2(closeIcon);
294
294
  const filterIconClassName = filter && selected ? resolveIconClassName2(filterIcon) : void 0;
295
- const handleClick = React6__namespace.useCallback(
295
+ const handleClick = React5__namespace.useCallback(
296
296
  (event) => {
297
297
  if (disabled) {
298
298
  event.preventDefault();
@@ -303,7 +303,7 @@ var Chip = React6__namespace.forwardRef(
303
303
  },
304
304
  [disabled, onClick]
305
305
  );
306
- const handleKeyDown = React6__namespace.useCallback(
306
+ const handleKeyDown = React5__namespace.useCallback(
307
307
  (event) => {
308
308
  onKeyDown?.(event);
309
309
  if (event.defaultPrevented || disabled || !interactive) {
@@ -316,7 +316,7 @@ var Chip = React6__namespace.forwardRef(
316
316
  },
317
317
  [disabled, interactive, onKeyDown]
318
318
  );
319
- const handleCloseClick = React6__namespace.useCallback(
319
+ const handleCloseClick = React5__namespace.useCallback(
320
320
  (event) => {
321
321
  event.stopPropagation();
322
322
  if (disabled) {
@@ -327,7 +327,7 @@ var Chip = React6__namespace.forwardRef(
327
327
  },
328
328
  [disabled, onClose]
329
329
  );
330
- const handleCloseKeyDown = React6__namespace.useCallback((event) => {
330
+ const handleCloseKeyDown = React5__namespace.useCallback((event) => {
331
331
  if (event.key === " " || event.key === "Enter") {
332
332
  event.stopPropagation();
333
333
  }
@@ -378,15 +378,6 @@ var Chip = React6__namespace.forwardRef(
378
378
  );
379
379
  Chip.displayName = "Chip";
380
380
  var Chip_default = Chip;
381
- var defaultListContext = {
382
- density: "default",
383
- lines: "one",
384
- nav: false,
385
- divided: false,
386
- color: "primary"
387
- };
388
- var ListContext = React6__namespace.createContext(defaultListContext);
389
- var useListContext = () => React6__namespace.useContext(ListContext);
390
381
  var listItemBaseClasses = "relative flex w-full items-center gap-4 bg-transparent text-left text-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-white hover:bg-neutral-200";
391
382
  var densityClasses = {
392
383
  default: "px-4 py-3 text-base",
@@ -407,7 +398,7 @@ var accentClasses = {
407
398
  danger: { text: "text-red-600", bg: "bg-red-50", indicator: "bg-red-500" },
408
399
  surface: { text: "text-gray-900", bg: "bg-gray-100", indicator: "bg-gray-900" }
409
400
  };
410
- var ListItem = React6__namespace.forwardRef((props, ref) => {
401
+ var ListItem = React5__namespace.forwardRef((props, ref) => {
411
402
  const {
412
403
  component,
413
404
  href,
@@ -424,18 +415,22 @@ var ListItem = React6__namespace.forwardRef((props, ref) => {
424
415
  inset = false,
425
416
  density: densityOverride,
426
417
  lines: linesOverride,
418
+ nav: navOverride,
419
+ divided: dividedOverride,
420
+ color: colorOverride,
427
421
  className,
428
422
  children,
429
423
  tabIndex,
430
424
  role,
431
425
  ...rest
432
426
  } = props;
433
- const listContext = useListContext();
434
- const density = densityOverride ?? listContext.density;
435
- const lines = linesOverride ?? listContext.lines;
436
- const nav = listContext.nav;
437
- const accent = accentClasses[listContext.color] ?? accentClasses.primary;
438
- const shapeClass = listContext.divided ? "rounded-none" : "rounded-lg";
427
+ const density = densityOverride ?? "default";
428
+ const lines = linesOverride ?? "one";
429
+ const nav = navOverride ?? false;
430
+ const divided = dividedOverride ?? false;
431
+ const color = colorOverride ?? "primary";
432
+ const accent = accentClasses[color] ?? accentClasses.primary;
433
+ const shapeClass = divided ? "rounded-none" : "rounded-lg";
439
434
  const Component = component ?? (href ? "a" : "div");
440
435
  const interactive = typeof rest.onClick === "function" || Component === "a" || Component === "button";
441
436
  const resolvedRole = role ?? "listitem";
@@ -514,7 +509,14 @@ var listRoundedClasses = {
514
509
  xl: "rounded-xl",
515
510
  pill: "rounded-full"
516
511
  };
517
- var List = React6__namespace.forwardRef((props, ref) => {
512
+ var isListItemElement = (element) => {
513
+ if (!React5__namespace.isValidElement(element)) {
514
+ return false;
515
+ }
516
+ const elementType = element.type;
517
+ return element.type === Item_default || elementType.displayName === Item_default.displayName;
518
+ };
519
+ var List = React5__namespace.forwardRef((props, ref) => {
518
520
  const {
519
521
  variant = "solid",
520
522
  density = "default",
@@ -534,31 +536,43 @@ var List = React6__namespace.forwardRef((props, ref) => {
534
536
  const gapClass = divided ? "p-0" : "gap-1 p-1";
535
537
  const navClass = nav ? "py-1" : void 0;
536
538
  const accentColor = variant === "bw" ? "surface" : color;
537
- const contextValue = React6__namespace.useMemo(
538
- () => ({
539
- density,
540
- lines,
541
- nav,
542
- divided,
543
- color: accentColor
544
- }),
545
- [accentColor, density, lines, nav, divided]
546
- );
547
- return /* @__PURE__ */ jsxRuntime.jsx(ListContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
539
+ const enhanceChild = (child) => {
540
+ if (!React5__namespace.isValidElement(child)) {
541
+ return child;
542
+ }
543
+ if (isListItemElement(child)) {
544
+ return React5__namespace.cloneElement(child, {
545
+ density: child.props.density ?? density,
546
+ lines: child.props.lines ?? lines,
547
+ nav: child.props.nav ?? nav,
548
+ divided: child.props.divided ?? divided,
549
+ color: child.props.color ?? accentColor
550
+ });
551
+ }
552
+ if (child.props && typeof child.props === "object" && "children" in child.props) {
553
+ const nestedChildren = React5__namespace.Children.map(child.props.children, enhanceChild);
554
+ if (nestedChildren !== child.props.children) {
555
+ return React5__namespace.cloneElement(child, void 0, nestedChildren);
556
+ }
557
+ }
558
+ return child;
559
+ };
560
+ const resolvedChildren = React5__namespace.Children.map(children, enhanceChild);
561
+ return /* @__PURE__ */ jsxRuntime.jsx(
548
562
  "div",
549
563
  {
550
564
  ...rest,
551
565
  ref,
552
566
  role: role ?? "list",
553
567
  className: tailwindMerge.twMerge(listBaseClasses, variantClass, roundedClass, dividerClass, gapClass, navClass, className),
554
- children
568
+ children: resolvedChildren
555
569
  }
556
- ) });
570
+ );
557
571
  });
558
572
  List.displayName = "List";
559
573
  var List_default = List;
560
574
  var isBrowser = typeof window !== "undefined";
561
- var useIsomorphicLayoutEffect = isBrowser ? React6__namespace.useLayoutEffect : React6__namespace.useEffect;
575
+ var useIsomorphicLayoutEffect = isBrowser ? React5__namespace.useLayoutEffect : React5__namespace.useEffect;
562
576
  var placementClasses = {
563
577
  "bottom-start": "left-0 top-full origin-top-left",
564
578
  bottom: "left-1/2 top-full -translate-x-1/2 origin-top",
@@ -573,7 +587,7 @@ var offsetClasses = {
573
587
  };
574
588
  var menuBaseClasses = "absolute z-50 min-w-[10rem] rounded-xl border border-gray-200/80 bg-white/95 p-2 text-sm text-gray-700 shadow-lg shadow-gray-900/10 ring-1 ring-black/5 backdrop-blur-md transition-all duration-150 data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data-[state=open]:opacity-100 data-[state=open]:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2";
575
589
  var overlayBaseClasses = "fixed inset-0 z-40 bg-gray-900/30 backdrop-blur-[1px]";
576
- var Menu = React6__namespace.forwardRef((props, ref) => {
590
+ var Menu = React5__namespace.forwardRef((props, ref) => {
577
591
  const {
578
592
  activator,
579
593
  children,
@@ -595,17 +609,17 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
595
609
  onMouseLeave: rootMouseLeave,
596
610
  ...rest
597
611
  } = props;
598
- const baseId = React6__namespace.useId();
612
+ const baseId = React5__namespace.useId();
599
613
  const menuId = `${baseId}-menu`;
600
614
  const activatorId = `${baseId}-activator`;
601
615
  const isControlled = typeof openProp === "boolean";
602
- const [internalOpen, setInternalOpen] = React6__namespace.useState(defaultOpen);
616
+ const [internalOpen, setInternalOpen] = React5__namespace.useState(defaultOpen);
603
617
  const open = isControlled ? Boolean(openProp) : internalOpen;
604
- const localRootRef = React6__namespace.useRef(null);
605
- const menuRef = React6__namespace.useRef(null);
606
- const activatorRef = React6__namespace.useRef(null);
607
- const closeTimeoutRef = React6__namespace.useRef(null);
608
- const mergedRootRef = React6__namespace.useCallback(
618
+ const localRootRef = React5__namespace.useRef(null);
619
+ const menuRef = React5__namespace.useRef(null);
620
+ const activatorRef = React5__namespace.useRef(null);
621
+ const closeTimeoutRef = React5__namespace.useRef(null);
622
+ const mergedRootRef = React5__namespace.useCallback(
609
623
  (node) => {
610
624
  localRootRef.current = node;
611
625
  if (typeof ref === "function") {
@@ -616,8 +630,8 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
616
630
  },
617
631
  [ref]
618
632
  );
619
- const [activatorWidth, setActivatorWidth] = React6__namespace.useState();
620
- const updateActivatorWidth = React6__namespace.useCallback(() => {
633
+ const [activatorWidth, setActivatorWidth] = React5__namespace.useState();
634
+ const updateActivatorWidth = React5__namespace.useCallback(() => {
621
635
  if (!matchActivatorWidth) {
622
636
  setActivatorWidth(void 0);
623
637
  return;
@@ -640,7 +654,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
640
654
  observer.observe(activatorRef.current);
641
655
  return () => observer.disconnect();
642
656
  }, [matchActivatorWidth, updateActivatorWidth]);
643
- const setOpen = React6__namespace.useCallback(
657
+ const setOpen = React5__namespace.useCallback(
644
658
  (nextOpen) => {
645
659
  if (disabled || open === nextOpen) {
646
660
  return;
@@ -652,7 +666,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
652
666
  },
653
667
  [disabled, isControlled, onOpenChange, open]
654
668
  );
655
- React6__namespace.useEffect(() => {
669
+ React5__namespace.useEffect(() => {
656
670
  if (!disabled || !open) {
657
671
  return;
658
672
  }
@@ -661,7 +675,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
661
675
  }
662
676
  onOpenChange?.(false);
663
677
  }, [disabled, open, isControlled, onOpenChange]);
664
- React6__namespace.useEffect(() => {
678
+ React5__namespace.useEffect(() => {
665
679
  if (!open) {
666
680
  return;
667
681
  }
@@ -689,7 +703,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
689
703
  document.removeEventListener("keydown", handleKeyDown);
690
704
  };
691
705
  }, [open, setOpen]);
692
- React6__namespace.useEffect(() => {
706
+ React5__namespace.useEffect(() => {
693
707
  if (!open) {
694
708
  return;
695
709
  }
@@ -702,7 +716,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
702
716
  });
703
717
  return () => window.cancelAnimationFrame(id);
704
718
  }, [open]);
705
- const setActivatorNode = React6__namespace.useCallback(
719
+ const setActivatorNode = React5__namespace.useCallback(
706
720
  (node) => {
707
721
  activatorRef.current = node;
708
722
  if (node && matchActivatorWidth) {
@@ -711,7 +725,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
711
725
  },
712
726
  [matchActivatorWidth]
713
727
  );
714
- const handleActivatorClick = React6__namespace.useCallback(
728
+ const handleActivatorClick = React5__namespace.useCallback(
715
729
  (event) => {
716
730
  event.preventDefault();
717
731
  if (disabled) {
@@ -721,7 +735,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
721
735
  },
722
736
  [disabled, open, setOpen]
723
737
  );
724
- const handleActivatorKeyDown = React6__namespace.useCallback(
738
+ const handleActivatorKeyDown = React5__namespace.useCallback(
725
739
  (event) => {
726
740
  if (event.key === "Enter" || event.key === " ") {
727
741
  event.preventDefault();
@@ -734,7 +748,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
734
748
  },
735
749
  [open, setOpen]
736
750
  );
737
- const clearCloseTimeout = React6__namespace.useCallback(() => {
751
+ const clearCloseTimeout = React5__namespace.useCallback(() => {
738
752
  if (closeTimeoutRef.current !== null) {
739
753
  if (isBrowser) {
740
754
  window.clearTimeout(closeTimeoutRef.current);
@@ -742,7 +756,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
742
756
  closeTimeoutRef.current = null;
743
757
  }
744
758
  }, []);
745
- const scheduleClose = React6__namespace.useCallback(() => {
759
+ const scheduleClose = React5__namespace.useCallback(() => {
746
760
  if (!isBrowser) {
747
761
  setOpen(false);
748
762
  return;
@@ -753,10 +767,10 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
753
767
  closeTimeoutRef.current = null;
754
768
  }, 150);
755
769
  }, [clearCloseTimeout, setOpen]);
756
- React6__namespace.useEffect(() => {
770
+ React5__namespace.useEffect(() => {
757
771
  return () => clearCloseTimeout();
758
772
  }, [clearCloseTimeout]);
759
- const isMovingWithinMenu = React6__namespace.useCallback(
773
+ const isMovingWithinMenu = React5__namespace.useCallback(
760
774
  (event) => {
761
775
  const nextTarget = event.relatedTarget;
762
776
  if (!nextTarget || !localRootRef.current) {
@@ -766,7 +780,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
766
780
  },
767
781
  [localRootRef]
768
782
  );
769
- const handleRootMouseEnter = React6__namespace.useCallback(
783
+ const handleRootMouseEnter = React5__namespace.useCallback(
770
784
  (event) => {
771
785
  rootMouseEnter?.(event);
772
786
  if (event.defaultPrevented) {
@@ -779,7 +793,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
779
793
  },
780
794
  [clearCloseTimeout, openOnHover, rootMouseEnter, setOpen]
781
795
  );
782
- const handleRootMouseLeave = React6__namespace.useCallback(
796
+ const handleRootMouseLeave = React5__namespace.useCallback(
783
797
  (event) => {
784
798
  rootMouseLeave?.(event);
785
799
  if (event.defaultPrevented) {
@@ -794,7 +808,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
794
808
  },
795
809
  [isMovingWithinMenu, openOnHover, rootMouseLeave, scheduleClose]
796
810
  );
797
- const handleActivatorMouseEnter = React6__namespace.useCallback(
811
+ const handleActivatorMouseEnter = React5__namespace.useCallback(
798
812
  (_event) => {
799
813
  if (disabled) {
800
814
  return;
@@ -804,7 +818,7 @@ var Menu = React6__namespace.forwardRef((props, ref) => {
804
818
  },
805
819
  [clearCloseTimeout, disabled, setOpen]
806
820
  );
807
- const handleActivatorMouseLeave = React6__namespace.useCallback(
821
+ const handleActivatorMouseLeave = React5__namespace.useCallback(
808
822
  (event) => {
809
823
  if (disabled || !openOnHover) {
810
824
  return;