infinity-ui-elements 1.7.2 → 1.7.4

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
@@ -115,6 +115,7 @@ const avatarVariants = classVarianceAuthority.cva("inline-flex items-center just
115
115
  size: {
116
116
  small: "h-[24px] w-[24px] text-body-medium-regular rounded-large",
117
117
  medium: "h-[32px] w-[32px] text-body-medium-regular rounded-xlarge",
118
+ xlarge: "h-[36px] w-[36px] text-body-medium-regular rounded-xlarge",
118
119
  },
119
120
  },
120
121
  defaultVariants: {
@@ -127,6 +128,7 @@ const statusVariants = classVarianceAuthority.cva("absolute flex items-center ju
127
128
  size: {
128
129
  small: "h-5 w-5 -bottom-0.5 -right-0.5",
129
130
  medium: "h-6 w-6 -bottom-1 -right-1",
131
+ xlarge: "h-6 w-6 -bottom-1 -right-1",
130
132
  },
131
133
  statusColor: {
132
134
  positive: "bg-action-fill-positive-default",
@@ -309,7 +311,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
309
311
  variants: {
310
312
  variant: {
311
313
  primary: "bg-action-fill-primary-default text-action-ink-on-primary-normal hover:bg-action-fill-primary-hover",
312
- secondary: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
314
+ secondary: "border",
313
315
  tertiary: "hover:bg-accent hover:text-accent-foreground",
314
316
  },
315
317
  color: {
@@ -323,8 +325,8 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
323
325
  size: {
324
326
  xsmall: "md:h-[28px] px-3 rounded-medium text-body-small-medium",
325
327
  small: "md:h-[32px] px-4 rounded-medium text-body-small-medium",
326
- medium: "md:h-[36px] px-6 py-2 rounded-medium text-body-medium-medium",
327
- large: "md:h-[44px] px-6 rounded-xlarge text-body-large-medium",
328
+ medium: "md:h-[36px] px-5 py-2 rounded-large text-body-medium-medium",
329
+ large: "md:h-[44px] px-6 rounded-large text-body-large-medium",
328
330
  },
329
331
  isIconOnly: {
330
332
  true: "aspect-square p-0",
@@ -410,7 +412,7 @@ const buttonVariants = classVarianceAuthority.cva("items-center gap-3 justify-ce
410
412
  variant: "secondary",
411
413
  color: "primary",
412
414
  class: `
413
- border-action-outline-info-faded
415
+ border-action-outline-primary-faded
414
416
  text-action-ink-primary-normal
415
417
  hover:border-action-outline-primary-faded-hover
416
418
  hover:bg-action-fill-primary-faded-hover
@@ -1882,7 +1884,9 @@ const selectVariants = classVarianceAuthority.cva("relative flex items-center ga
1882
1884
  const Select = React__namespace.forwardRef(({ className, options = [], value: controlledValue, defaultValue, onChange, placeholder = "Select an option", label, helperText, errorText, successText, validationState = "none", isDisabled = false, isRequired = false, isOptional = false, isLoading = false, size = "medium", prefix, suffix, showClearButton = false, onClear, containerClassName, labelClassName, triggerClassName, menuClassName, menuWidth = "full", sectionHeading, emptyTitle = "No options available", emptyDescription = "There are no options to select from.", emptyIcon, infoHeading, infoDescription, linkText, linkHref, onLinkClick, ...props }, ref) => {
1883
1885
  const [uncontrolledValue, setUncontrolledValue] = React__namespace.useState(defaultValue);
1884
1886
  const [isOpen, setIsOpen] = React__namespace.useState(false);
1887
+ const [dropdownPlacement, setDropdownPlacement] = React__namespace.useState("bottom");
1885
1888
  const selectRef = React__namespace.useRef(null);
1889
+ const dropdownContainerRef = React__namespace.useRef(null);
1886
1890
  const value = controlledValue !== undefined ? controlledValue : uncontrolledValue;
1887
1891
  // Find the selected option
1888
1892
  const selectedOption = options.find((opt) => opt.value === value);
@@ -1921,6 +1925,55 @@ const Select = React__namespace.forwardRef(({ className, options = [], value: co
1921
1925
  onChange?.("", {});
1922
1926
  }
1923
1927
  };
1928
+ const updateDropdownPlacement = React__namespace.useCallback(() => {
1929
+ if (typeof window === "undefined")
1930
+ return;
1931
+ const trigger = selectRef.current;
1932
+ if (!trigger)
1933
+ return;
1934
+ const triggerRect = trigger.getBoundingClientRect();
1935
+ const spaceBelow = window.innerHeight - triggerRect.bottom;
1936
+ const spaceAbove = triggerRect.top;
1937
+ const dropdownHeight = dropdownContainerRef.current
1938
+ ? dropdownContainerRef.current.offsetHeight
1939
+ : 0;
1940
+ if (dropdownHeight === 0) {
1941
+ setDropdownPlacement(spaceBelow >= spaceAbove ? "bottom" : "top");
1942
+ return;
1943
+ }
1944
+ if (spaceBelow >= dropdownHeight || spaceBelow >= spaceAbove) {
1945
+ setDropdownPlacement("bottom");
1946
+ }
1947
+ else {
1948
+ setDropdownPlacement("top");
1949
+ }
1950
+ }, []);
1951
+ const attachDropdownListeners = React__namespace.useCallback(() => {
1952
+ if (!isOpen)
1953
+ return;
1954
+ if (typeof window === "undefined")
1955
+ return;
1956
+ let rafId = requestAnimationFrame(updateDropdownPlacement);
1957
+ const handleUpdate = () => updateDropdownPlacement();
1958
+ window.addEventListener("resize", handleUpdate);
1959
+ window.addEventListener("scroll", handleUpdate, true);
1960
+ return () => {
1961
+ cancelAnimationFrame(rafId);
1962
+ window.removeEventListener("resize", handleUpdate);
1963
+ window.removeEventListener("scroll", handleUpdate, true);
1964
+ };
1965
+ }, [isOpen, updateDropdownPlacement]);
1966
+ React__namespace.useEffect(() => {
1967
+ const detach = attachDropdownListeners();
1968
+ return () => {
1969
+ detach?.();
1970
+ };
1971
+ }, [attachDropdownListeners]);
1972
+ React__namespace.useEffect(() => {
1973
+ if (isOpen) {
1974
+ updateDropdownPlacement();
1975
+ }
1976
+ }, [isOpen, options.length, updateDropdownPlacement]);
1924
1977
  // Close dropdown when clicking outside
1925
1978
  React__namespace.useEffect(() => {
1926
1979
  const handleClickOutside = (event) => {
@@ -2021,7 +2074,9 @@ const Select = React__namespace.forwardRef(({ className, options = [], value: co
2021
2074
  ? "text-feedback-ink-positive-intense"
2022
2075
  : currentValidationState === "negative"
2023
2076
  ? "text-feedback-ink-negative-subtle"
2024
- : "text-surface-ink-neutral-muted", isOpen && "transform rotate-180") }), isOpen && !isDisabled && !isLoading && (jsxRuntime.jsx("div", { className: "absolute z-50 left-0 right-0 top-full mt-1", children: jsxRuntime.jsx(DropdownMenu, { ref: ref, items: menuItems, sectionHeading: sectionHeading, isEmpty: options.length === 0, emptyTitle: emptyTitle, emptyDescription: emptyDescription, emptyIcon: emptyIcon, disableFooter: true, onClose: () => handleOpenChange(false), className: menuClassName, width: widthStyle }) }))] }), jsxRuntime.jsx(FormFooter, { helperText: displayHelperText, validationState: currentValidationState === "none"
2077
+ : "text-surface-ink-neutral-muted", isOpen && "transform rotate-180") }), isOpen && !isDisabled && !isLoading && (jsxRuntime.jsx("div", { ref: dropdownContainerRef, className: cn("absolute z-50 left-0 right-0", dropdownPlacement === "bottom"
2078
+ ? "top-full mt-1"
2079
+ : "bottom-full mb-1"), children: jsxRuntime.jsx(DropdownMenu, { ref: ref, items: menuItems, sectionHeading: sectionHeading, isEmpty: options.length === 0, emptyTitle: emptyTitle, emptyDescription: emptyDescription, emptyIcon: emptyIcon, disableFooter: true, onClose: () => handleOpenChange(false), className: menuClassName, width: widthStyle }) }))] }), jsxRuntime.jsx(FormFooter, { helperText: displayHelperText, validationState: currentValidationState === "none"
2025
2080
  ? "default"
2026
2081
  : currentValidationState, size: size, isDisabled: isDisabled, className: "mt-1" })] }));
2027
2082
  });