infinity-ui-elements 1.8.59 → 1.8.60

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
@@ -59,9 +59,10 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
59
59
  */
60
60
  const iconRegistry = {
61
61
  // Tick/Check icon
62
- tick: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
63
- <path d="M10.364 15.1924L19.5564 6L20.9706 7.41421L10.364 18.0208L4 11.6569L5.41422 10.2427L10.364 15.1924Z" fill="#081416"/>
64
- </svg>`,
62
+ tick: `<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
63
+ <path d="M7.99907 1.77063L8.63188 2.42981L8.69829 2.49915L8.63188 2.56848L3.88188 7.50891L3.80962 7.58411L3.73833 7.50891L0.887741 4.54504L0.821335 4.47571L0.887741 4.40637L1.52153 3.74719L1.5938 3.672L1.66508 3.74719L3.80962 5.97766L7.85454 1.77063L7.9268 1.69543L7.99907 1.77063Z" fill="white" stroke="white" stroke-width="0.2"/>
64
+ </svg>
65
+ `,
65
66
  // Alias: check points to the same icon as tick
66
67
  check: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
67
68
  <path d="M10.364 15.1924L19.5564 6L20.9706 7.41421L10.364 18.0208L4 11.6569L5.41422 10.2427L10.364 15.1924Z" fill="#081416"/>
@@ -1514,9 +1515,9 @@ FormFooter.displayName = "FormFooter";
1514
1515
  const checkboxVariants = classVarianceAuthority.cva("relative inline-flex items-center justify-center shrink-0 transition-all cursor-pointer box-border", {
1515
1516
  variants: {
1516
1517
  size: {
1517
- small: "w-[10px] h-[10px] rounded-small border-[1.5px]",
1518
- medium: "w-[12px] h-[12px] rounded-small border-[1.5px]",
1519
- large: "w-[16px] h-[16px] rounded-medium border-[2px]",
1518
+ small: "w-[14px] h-[14px] rounded-small border-[1.5px]",
1519
+ medium: "w-[16px] h-[16px] rounded-small border-[1.5px]",
1520
+ large: "w-[20px] h-[20px] rounded-medium border-[2px]",
1520
1521
  },
1521
1522
  validationState: {
1522
1523
  none: "",
@@ -1584,7 +1585,6 @@ const Checkbox = React__namespace.forwardRef(({ label, errorText, size = "medium
1584
1585
  const [internalChecked, setInternalChecked] = React__namespace.useState(false);
1585
1586
  const [showRipple, setShowRipple] = React__namespace.useState(false);
1586
1587
  const inputRef = React__namespace.useRef(null);
1587
- const rippleTimeoutRef = React__namespace.useRef(null);
1588
1588
  // Use forwarded ref or internal ref
1589
1589
  React__namespace.useImperativeHandle(ref, () => inputRef.current);
1590
1590
  const isChecked = checked !== undefined ? checked : internalChecked;
@@ -1594,14 +1594,6 @@ const Checkbox = React__namespace.forwardRef(({ label, errorText, size = "medium
1594
1594
  inputRef.current.indeterminate = isIndeterminate;
1595
1595
  }
1596
1596
  }, [isIndeterminate]);
1597
- // Cleanup timeout on unmount
1598
- React__namespace.useEffect(() => {
1599
- return () => {
1600
- if (rippleTimeoutRef.current) {
1601
- clearTimeout(rippleTimeoutRef.current);
1602
- }
1603
- };
1604
- }, []);
1605
1597
  const handleChange = (e) => {
1606
1598
  if (onChange) {
1607
1599
  onChange(e);
@@ -1611,28 +1603,31 @@ const Checkbox = React__namespace.forwardRef(({ label, errorText, size = "medium
1611
1603
  }
1612
1604
  };
1613
1605
  const triggerRipple = () => {
1614
- if (!isDisabled && !showRipple) {
1615
- // Clear any existing timeout
1616
- if (rippleTimeoutRef.current) {
1617
- clearTimeout(rippleTimeoutRef.current);
1618
- }
1606
+ if (!isDisabled) {
1619
1607
  setShowRipple(true);
1620
- rippleTimeoutRef.current = setTimeout(() => {
1608
+ setTimeout(() => {
1621
1609
  setShowRipple(false);
1622
- rippleTimeoutRef.current = null;
1623
- }, 400); // Match animation duration (0.4s)
1610
+ }, 360); // Match animation duration (0.36s)
1624
1611
  }
1625
1612
  };
1626
1613
  const handleContainerClick = () => {
1627
1614
  if (!isDisabled && inputRef.current) {
1628
- triggerRipple();
1615
+ // Only show ripple when checking or entering indeterminate state (not unchecking)
1616
+ const willBeChecked = !isChecked || isIndeterminate;
1617
+ if (willBeChecked) {
1618
+ triggerRipple();
1619
+ }
1629
1620
  inputRef.current.click();
1630
1621
  }
1631
1622
  };
1632
1623
  const handleKeyDown = (e) => {
1633
1624
  if ((e.key === " " || e.key === "Enter") && !isDisabled) {
1634
1625
  e.preventDefault();
1635
- triggerRipple();
1626
+ // Only show ripple when checking or entering indeterminate state (not unchecking)
1627
+ const willBeChecked = !isChecked || isIndeterminate;
1628
+ if (willBeChecked) {
1629
+ triggerRipple();
1630
+ }
1636
1631
  inputRef.current?.click();
1637
1632
  }
1638
1633
  };
@@ -1641,23 +1636,23 @@ const Checkbox = React__namespace.forwardRef(({ label, errorText, size = "medium
1641
1636
  small: {
1642
1637
  gap: "gap-2",
1643
1638
  labelSize: "text-body-small-regular",
1644
- iconSize: 10,
1639
+ iconSize: 7,
1645
1640
  },
1646
1641
  medium: {
1647
1642
  gap: "gap-2",
1648
1643
  labelSize: "text-body-small-regular",
1649
- iconSize: 12,
1644
+ iconSize: 9.6,
1650
1645
  },
1651
1646
  large: {
1652
1647
  gap: "gap-3",
1653
1648
  labelSize: "text-body-medium-regular",
1654
- iconSize: 14,
1649
+ iconSize: 13.33,
1655
1650
  },
1656
1651
  };
1657
1652
  const config = sizeConfig[size];
1658
1653
  // Determine if we should show the error text
1659
1654
  const shouldShowError = errorText && showErrorText;
1660
- return (jsxRuntime.jsxs("div", { className: cn("inline-flex flex-col px-2", containerClassName), children: [jsxRuntime.jsxs("div", { className: cn("inline-flex items-center", config.gap, isDisabled ? "cursor-not-allowed" : "cursor-pointer"), onClick: handleContainerClick, onKeyDown: handleKeyDown, role: "checkbox", "aria-checked": isIndeterminate ? "mixed" : isChecked, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : 0, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "checkbox", className: "sr-only", checked: isChecked, onChange: handleChange, disabled: isDisabled, ...props }), jsxRuntime.jsxs("div", { className: "relative inline-flex shrink-0", children: [showRipple && (jsxRuntime.jsx("div", { className: cn("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full pointer-events-none w-full h-full", validationState === "error"
1655
+ return (jsxRuntime.jsxs("div", { className: cn("inline-flex flex-col py-0.5", containerClassName), children: [jsxRuntime.jsxs("div", { className: cn("inline-flex items-center", config.gap, isDisabled ? "cursor-not-allowed" : "cursor-pointer"), onClick: handleContainerClick, onKeyDown: handleKeyDown, role: "checkbox", "aria-checked": isIndeterminate ? "mixed" : isChecked, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : 0, children: [jsxRuntime.jsx("input", { ref: inputRef, type: "checkbox", className: "sr-only", checked: isChecked, onChange: handleChange, disabled: isDisabled, ...props }), jsxRuntime.jsxs("div", { className: "relative inline-flex shrink-0", children: [showRipple && (jsxRuntime.jsx("div", { className: cn("absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full pointer-events-none w-full h-full", validationState === "error"
1661
1656
  ? "bg-action-outline-negative-faded"
1662
1657
  : "bg-action-outline-primary-faded"), style: {
1663
1658
  animation: "var(--animate-checkbox-ripple)",