{"version":3,"file":"index.cjs","names":["elementRef: React.RefObject<T>","flushImmediately: boolean","refValue: T","useIsoLayoutEffect: typeof useEffect","useLayoutEffect","useEffect","nodes: HTMLElement[]","result: Record<number, NodePosition>","lastRowKey: number | undefined","containerRef: React.RefObject<HTMLElement | null>","overflowRef: React.RefObject<HTMLElement | null>","DEFAULT_OVERFLOW_BUTTON_STYLES: React.CSSProperties","DefaultOverflowElement","props: DefaultOverflowElementProps<T>","ref: React.ForwardedRef<HTMLDivElement>","OverflowList","props: OverflowListProps<T>","forwardedRef: React.Ref<HTMLElement>","containerStyles: React.CSSProperties","React","OverflowList: OverflowListComponent","DEFAULT_CONTAINER_STYLES: React.CSSProperties"],"sources":["../src/hooks/useResizeObserver.ts","../src/hooks/useForkRef.tsx","../src/hooks/useIsoLayoutEffect.ts","../src/utils/index.ts","../src/hooks/useOverflowList.ts","../src/components/DefaultOverflowMenu.tsx","../src/components/OverflowList.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\n\nexport interface ResizeObserverDimensions {\n  width: number;\n  height: number;\n  contentWidth: number;\n  contentHeight: number;\n}\n\nexport function useResizeObserver<T extends HTMLElement | null>(\n  elementRef: React.RefObject<T>,\n  flushImmediately: boolean = false,\n): ResizeObserverDimensions | null {\n  const resizeObserverRef = useRef<ResizeObserver | null>(null);\n  const [dimensions, setDimensions] = useState<ResizeObserverDimensions | null>(null);\n\n  // Initialize resize observer\n  useEffect(() => {\n    if (!elementRef.current) return;\n\n    // Create resize observer\n    resizeObserverRef.current = new ResizeObserver((entries) => {\n      if (entries[0]) {\n        const entry = entries[0];\n        const updateDimensions = () => {\n          setDimensions({\n            width: entry.borderBoxSize[0]?.inlineSize ?? entry.target.clientWidth,\n            height: entry.borderBoxSize[0]?.blockSize ?? entry.target.clientHeight,\n            contentWidth: entry.contentRect.width,\n            contentHeight: entry.contentRect.height,\n          });\n        };\n\n        if (flushImmediately) {\n          // Update DOM immediately using flushSync\n          flushSync(updateDimensions);\n        } else {\n          // Use requestAnimationFrame to defer this update and avoid forced reflow\n          requestAnimationFrame(updateDimensions);\n        }\n      }\n    });\n\n    resizeObserverRef.current.observe(elementRef.current);\n\n    return () => {\n      if (resizeObserverRef.current) {\n        resizeObserverRef.current.disconnect();\n        resizeObserverRef.current = null;\n      }\n    };\n  }, [elementRef.current, flushImmediately]);\n\n  return dimensions;\n}\n","// Utility to combine refs (similar to MUI's useForkRef but simpler)\nimport React from \"react\";\n\nexport const useForkRef = <T,>(...refs: (React.Ref<T> | null)[]): React.RefCallback<T> | null => {\n  return React.useMemo(() => {\n    if (refs.every((ref) => ref == null)) {\n      return null;\n    }\n    return (refValue: T) => {\n      refs.forEach((ref) => {\n        if (typeof ref === \"function\") {\n          ref(refValue);\n        } else if (ref) {\n          (ref as React.RefObject<T>).current = refValue;\n        }\n      });\n    };\n  }, refs);\n};\n","import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useIsoLayoutEffect: typeof useEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","import React from \"react\";\n\n/**\n * Groups HTML elements by their vertical position (top coordinate)\n * and includes bottom position information\n */\nexport interface NodePosition {\n  elements: Set<HTMLElement>;\n  bottom: number;\n  top: number;\n}\n\nexport function groupNodesByTopPosition(nodes: HTMLElement[]): Record<number, NodePosition> {\n  if (nodes.length === 0) return {};\n\n  const result: Record<number, NodePosition> = {};\n  let lastRowKey: number | undefined;\n\n  nodes.forEach((node) => {\n    const rect = node.getBoundingClientRect();\n    const top = Math.round(rect.top);\n    const bottom = Math.round(rect.bottom);\n\n    // Check if this element overlaps vertically with the last row\n    const lastRow = lastRowKey !== undefined ? result[lastRowKey] : undefined;\n    if (lastRow && top < lastRow.bottom && bottom > lastRow.top) {\n      lastRow.top = Math.min(lastRow.top, top);\n      lastRow.bottom = Math.max(lastRow.bottom, bottom);\n      lastRow.elements.add(node);\n    } else {\n      result[top] = {\n        elements: new Set<HTMLElement>(),\n        bottom: bottom,\n        top: top,\n      };\n      result[top].elements.add(node);\n      lastRowKey = top;\n    }\n  });\n\n  return result;\n}\n\n/**\n * Helper function to get row information from container\n * Returns itemsSizesMap, rowPositions, and children or null if the container is not available\n */\nexport function getRowPositionsData(\n  containerRef: React.RefObject<HTMLElement | null>,\n  overflowRef: React.RefObject<HTMLElement | null>,\n): {\n  itemsSizesMap: Record<number, NodePosition>;\n  rowPositions: number[];\n  children: HTMLElement[];\n} | null {\n  if (!containerRef.current) return null;\n\n  const container = containerRef.current;\n  const children = Array.from(container.children).filter((child) => overflowRef.current !== child) as HTMLElement[];\n\n  if (children.length === 0) return null;\n\n  // Group elements by their vertical position (rows)\n  const itemsSizesMap = groupNodesByTopPosition(children);\n\n  // Get all the vertical positions (rows)\n  const rowPositions = Object.keys(itemsSizesMap).map(Number);\n\n  return { itemsSizesMap, rowPositions, children };\n}\n","// Headless hook driving the responsive-overflow-list measurement state machine.\n// Mirrors the original `OverflowList` primitive's logic exactly so that any consumer —\n// the JSX `OverflowList` wrapper or a custom layout (e.g. FilterChipBar) — gets\n// identical visible/hidden item behaviour.\n//\n// Technical details:\n// Uses a three-phases approach:\n// 1. \"measuring\" renders all items to calculate positions,\n// 2. \"measuring overflow\" render all items fit in the container, try to add the overflow indicator item to the container. check if it opens a new row, if so, remove the last item from the last row.\n// 3. \"normal\" phase shows only what fits within constraints. (this is the stable state that we want to keep)\n\nimport { useRef, useState } from \"react\";\n\nimport { getRowPositionsData } from \"../utils\";\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect\";\nimport { useResizeObserver } from \"./useResizeObserver\";\n\nexport type OverflowListPhase = \"normal\" | \"measuring\" | \"measuring-overflow-indicator\";\n\nexport interface UseOverflowListOptions {\n  /** Total number of items the consumer wants to render. */\n  itemCount: number;\n  /** Max rows the items are allowed to occupy. Default 1. */\n  maxRows?: number;\n  /** Hard cap on visible items. Default 100. */\n  maxVisibleItems?: number;\n  /**\n   * After the container dimensions change, flush the state immediately (default is true).\n   * If true, using flushSync to update the state immediately - this can affect performance but avoid flickering.\n   * If false, using requestAnimationFrame to update the state - this avoid forced reflow and improve performance.\n   */\n  flushImmediately?: boolean;\n}\n\nexport interface UseOverflowListReturn<\n  TContainer extends HTMLElement = HTMLElement,\n  TOverflow extends HTMLElement = HTMLElement,\n> {\n  /** Attach to the flex-wrap container that holds the items. */\n  containerRef: React.RefObject<TContainer | null>;\n  /** Attach to the overflow indicator element so its width is measured. */\n  overflowIndicatorRef: React.RefObject<TOverflow | null>;\n  /** Final visible count = visibleCount - subtractCount (matches original primitive's `finalVisibleCount`). */\n  visibleCount: number;\n  /** Number of items hidden by the overflow indicator (items.length - visibleCount). */\n  hiddenCount: number;\n  /** Current measurement phase — consumers must use this to decide item visibility. */\n  phase: OverflowListPhase;\n  /**\n   * True when the overflow indicator should be rendered. False during the initial\n   * \"measuring\" phase so all items can be measured without the indicator interfering.\n   */\n  showOverflow: boolean;\n}\n\nexport function useOverflowList<\n  TContainer extends HTMLElement = HTMLElement,\n  TOverflow extends HTMLElement = HTMLElement,\n>({\n  itemCount,\n  maxRows = 1,\n  maxVisibleItems = 100,\n  flushImmediately = true,\n}: UseOverflowListOptions): UseOverflowListReturn<TContainer, TOverflow> {\n  const [visibleCount, setVisibleCount] = useState(itemCount);\n  const [subtractCount, setSubtractCount] = useState(0);\n  const [phase, setPhase] = useState<OverflowListPhase>(\"normal\");\n\n  const containerRef = useRef<TContainer | null>(null);\n  const overflowIndicatorRef = useRef<TOverflow | null>(null);\n\n  const finalVisibleCount = visibleCount - subtractCount;\n  const overflowCount = itemCount - finalVisibleCount;\n  const showOverflow = overflowCount > 0 && phase !== \"measuring\";\n\n  // Unified method that handles both growing and shrinking\n  // this function is called in measuring phase, and it is used to measure how many items can fit in the container\n  const countVisibleItems = () => {\n    const rowData = getRowPositionsData(containerRef, overflowIndicatorRef);\n    if (!rowData) return;\n\n    const { itemsSizesMap, rowPositions } = rowData;\n\n    // edge case: if only 1 item is given, check if its width is bigger than the container width, if so set the maxRows to 0 (there is not enough space for the item, so we showing overflow indicator)\n    if (itemCount === 1) {\n      const itemRef = itemsSizesMap[rowPositions[0]].elements.values().next().value;\n      const containerWidth = containerRef.current?.getBoundingClientRect().width ?? 0;\n      const itemWidth = itemRef?.getBoundingClientRect().width ?? 0;\n\n      if (itemWidth > containerWidth) {\n        setVisibleCount(0);\n      } else setVisibleCount(1);\n      return;\n    }\n\n    // Only take up to maxRows\n    const visibleRowPositions = rowPositions.slice(0, maxRows);\n\n    // only items in rows that conform to the maxRows constraint can be visible\n    let fittingCount = visibleRowPositions.reduce((acc, position) => {\n      return acc + itemsSizesMap[position].elements.size;\n    }, 0);\n\n    // Ensure we respect maxVisibleItems\n    fittingCount = Math.min(fittingCount, maxVisibleItems);\n\n    // Only update state if the number of visible items has changed\n    setVisibleCount(fittingCount);\n  };\n\n  const updateOverflowIndicator = () => {\n    // Nothing left to subtract—either we already hid every visible item or there were none to begin with.\n    // Avoid looping indefinitely by exiting early.\n    if (finalVisibleCount <= 0) {\n      return false;\n    }\n\n    if (!overflowIndicatorRef.current) return false;\n    const rowData = getRowPositionsData(containerRef, overflowIndicatorRef);\n    if (!rowData) return false;\n\n    const { rowPositions, itemsSizesMap } = rowData;\n\n    const overflowRect = overflowIndicatorRef.current.getBoundingClientRect();\n    const overflowMiddleY = overflowRect.top + overflowRect.height / 2;\n    const lastRowTop = rowPositions[rowPositions.length - 1];\n    const lastRow = itemsSizesMap[lastRowTop];\n\n    // if the overflow indicator item opens a new row(we check it by the middle of the item)\n    if (overflowMiddleY > lastRow.bottom) {\n      setSubtractCount((c) => c + 1);\n      return true;\n    }\n    return false;\n  };\n\n  // Reset state when items change\n  useIsoLayoutEffect(() => {\n    setPhase(\"measuring\");\n    setVisibleCount(itemCount);\n    setSubtractCount(0);\n  }, [itemCount, maxRows]);\n\n  useIsoLayoutEffect(() => {\n    // in measurement, evaluate results\n    if (phase === \"measuring\") {\n      countVisibleItems();\n      setPhase(\"measuring-overflow-indicator\");\n    }\n  }, [phase]);\n\n  useIsoLayoutEffect(() => {\n    // After placing the overflow indicator, evaluate if it ends up opening a new row\n    if (phase === \"measuring-overflow-indicator\") {\n      const updateWasNeeded = updateOverflowIndicator();\n      if (!updateWasNeeded) {\n        setPhase(\"normal\");\n      }\n    }\n  }, [phase, subtractCount]);\n\n  // if the container dimensions change, re-measure\n  const containerDims = useResizeObserver(containerRef, flushImmediately);\n  useIsoLayoutEffect(() => {\n    if (phase === \"normal\") {\n      setPhase(\"measuring\");\n      setSubtractCount(0);\n    }\n  }, [containerDims]);\n\n  return {\n    containerRef,\n    overflowIndicatorRef,\n    visibleCount: finalVisibleCount,\n    hiddenCount: overflowCount,\n    phase,\n    showOverflow,\n  };\n}\n","import React, { useState } from \"react\";\nimport { OverflowElementProps } from \"./OverflowList\";\n\nconst DEFAULT_OVERFLOW_BUTTON_STYLES: React.CSSProperties = {\n  display: \"flex\",\n  alignItems: \"center\",\n  justifyContent: \"center\",\n  borderRadius: \"4px\",\n  border: \"1px solid #ccc\",\n  padding: \"4px 8px\",\n  fontSize: \"12px\",\n};\n\n/**\n * Simple default overflow menu component that displays hidden items in a basic dropdown\n */\n\ninterface DefaultOverflowElementProps<T> extends OverflowElementProps<T> {}\n\nexport const DefaultOverflowElement = React.forwardRef(function DefaultOverflowElement<T>(\n  props: DefaultOverflowElementProps<T>,\n  ref: React.ForwardedRef<HTMLDivElement>,\n) {\n  const { items } = props;\n  const count = items.length;\n\n  return (\n    <div ref={ref} style={DEFAULT_OVERFLOW_BUTTON_STYLES}>\n      {`+${count} more`}\n    </div>\n  );\n}) as <T>(props: DefaultOverflowElementProps<T> & { ref?: React.Ref<HTMLDivElement> }) => React.ReactElement;\n","import React from \"react\";\nimport { useForkRef, useOverflowList } from \"../hooks\";\nimport { DefaultOverflowElement } from \"./DefaultOverflowMenu\";\n\ntype BaseComponentProps = React.HTMLAttributes<HTMLElement>;\n\nexport type RenderItemVisibilityMeta = {\n  visible: boolean;\n  index: number;\n};\n\ntype BaseOverflowListProps<T> = BaseComponentProps & {\n  // Polymorphic component prop - allows changing the host element\n  as?: React.ElementType;\n\n  // would define the maximum number of rows that can be visible (default is 1)\n  maxRows?: number;\n\n  // would define the maximum number of items that can be visible (default is 100)\n  maxVisibleItems?: number;\n\n  // would define the overflow item renderer, applied only to overflow items (default is the same as renderItem)\n  renderOverflowItem?: (item: NoInfer<T>, index: number) => React.ReactNode;\n  // overflow renderer, applied only to overflow items (default is a dropdown menu - DefaultOverflowMenu component)\n  renderOverflow?: (items: NoInfer<T>[]) => React.ReactNode;\n  // would define the props to pass to the overflow indicator button\n  renderOverflowProps?: Partial<OverflowElementProps<T>>;\n\n  // after the container dimensions change, flush the state immediately (default is true)\n  // if true, using flushSync to update the state immediately - this can affect performance but avoid flickering\n  // if false, using requestAnimationFrame to update the state - this avoid forced reflow and improve performance\n  flushImmediately?: boolean;\n\n  // customize how each item is shown/hidden during measurement so you can keep custom elements mounted\n  renderItemVisibility?: (node: React.ReactNode, meta: RenderItemVisibilityMeta) => React.ReactNode;\n};\n\ntype OverflowListWithItems<T> = BaseOverflowListProps<T> & {\n  // would define the items to render in the list\n  items: T[];\n  // would define the default item renderer, applied both to visible and overflow items\n  renderItem: (item: NoInfer<T>, index: number) => React.ReactNode;\n  children?: never;\n};\n\ntype OverflowListWithChildren<T> = BaseOverflowListProps<T> & {\n  children: React.ReactNode;\n  items?: never;\n  renderItem?: never;\n};\n\nexport type OverflowListProps<T> = OverflowListWithItems<T> | OverflowListWithChildren<T>;\n\nexport type OverflowListComponent = <T>(\n  props: OverflowListProps<T> & { ref?: React.Ref<HTMLElement> },\n) => React.ReactElement;\n\nexport interface OverflowElementProps<T> {\n  items: T[];\n}\n\n/**\n * Responsive container that shows as many items as can fit within maxRows,\n * hiding overflow items behind a configurable overflow renderer.\n * Automatically recalculates visible items on resize.\n *\n * Thin wrapper around `useOverflowList`: that hook owns the measurement state\n * machine; this component handles rendering items and the overflow indicator.\n */\nconst OverflowListComponent = React.memo(\n  React.forwardRef(function OverflowList<T>(props: OverflowListProps<T>, forwardedRef: React.Ref<HTMLElement>) {\n    const {\n      as: Component = \"div\",\n      children,\n      // if items is not provided, use children as items\n      items = React.Children.toArray(children),\n      renderOverflow,\n      // if renderItem is not provided, this component is used in the children pattern, means each item is simply a React.ReactNode\n      renderItem = (item) => item as React.ReactNode,\n      renderOverflowItem,\n      renderOverflowProps,\n      renderItemVisibility,\n      maxRows = 1,\n      maxVisibleItems = 100,\n      flushImmediately = true,\n      ...containerProps\n    } = props;\n\n    const {\n      containerRef,\n      overflowIndicatorRef,\n      visibleCount: finalVisibleCount,\n      phase,\n      showOverflow,\n    } = useOverflowList<HTMLElement, HTMLElement>({\n      itemCount: items.length,\n      maxRows,\n      maxVisibleItems,\n      flushImmediately,\n    });\n    const finalContainerRef = useForkRef(containerRef, forwardedRef);\n\n    const finalRenderOverflow = renderOverflow?.(items.slice(finalVisibleCount) as T[]) ?? (\n      <DefaultOverflowElement items={items.slice(finalVisibleCount) as T[]} {...renderOverflowProps} />\n    );\n\n    const overflowElement = showOverflow ? finalRenderOverflow : null;\n\n    // @ts-expect-error - ref is not exposed as type in jsx elements but it exists\n    const finalOverflowRef = useForkRef(overflowIndicatorRef, overflowElement?.ref);\n\n    // Cloned overflow element that ensures ref is passed so we could measure dimensions on this element\n    const clonedOverflowElement = overflowElement\n      ? React.cloneElement(overflowElement as React.ReactElement<any>, {\n          ref: finalOverflowRef,\n        })\n      : null;\n\n    // Get the items to render based on current state\n\n    // we can render only up to maxVisibleItems items and maxRows rows\n    let finalItems = items;\n    if (maxVisibleItems) {\n      finalItems = finalItems.slice(0, maxVisibleItems);\n    }\n\n    const containerStyles: React.CSSProperties = {\n      ...DEFAULT_CONTAINER_STYLES,\n      ...containerProps.style,\n    };\n\n    const finalRenderItemVisibility =\n      renderItemVisibility ??\n      ((node, meta) => {\n        // prefer react 19.2 new Activity component to control visibility without forcing mount/unmount\n        // @ts-ignore -- Activity is an experimental React 19.2 API not yet in types\n        const Activity = React.Activity;\n        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n        if (Activity) {\n          return (\n            <Activity key={meta.index} mode={meta.visible ? \"visible\" : \"hidden\"}>\n              {node}\n            </Activity>\n          );\n        }\n\n        // below react 19.2, simply return null if the item is not visible\n        if (!meta.visible) return null;\n        return <React.Fragment key={meta.index}>{node}</React.Fragment>;\n      });\n\n    return (\n      <Component {...containerProps} ref={finalContainerRef} style={containerStyles}>\n        {finalItems.map((item, index) => {\n          const isVisible =\n            phase ===\n              // in measuring phase, show all items\n              \"measuring\" ||\n            // in 'normal' phase, show only the N items that fit\n            index < finalVisibleCount;\n\n          const itemComponent = renderItem(item as T, index);\n\n          return finalRenderItemVisibility(itemComponent, { index, visible: isVisible });\n        })}\n\n        {clonedOverflowElement}\n      </Component>\n    );\n  }),\n);\n\nexport const OverflowList: OverflowListComponent = OverflowListComponent as OverflowListComponent;\n\nconst DEFAULT_CONTAINER_STYLES: React.CSSProperties = {\n  display: \"flex\",\n  flexWrap: \"wrap\",\n  contain: \"layout style\",\n  minWidth: 0,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAgB,kBACdA,YACAC,mBAA4B,OACK;CACjC,MAAM,oBAAoB,kBAA8B,KAAK;CAC7D,MAAM,CAAC,YAAY,cAAc,GAAG,oBAA0C,KAAK;AAGnF,sBAAU,MAAM;AACd,OAAK,WAAW,QAAS;AAGzB,oBAAkB,UAAU,IAAI,eAAe,CAAC,YAAY;AAC1D,OAAI,QAAQ,IAAI;IACd,MAAM,QAAQ,QAAQ;IACtB,MAAM,mBAAmB,MAAM;AAC7B,mBAAc;MACZ,OAAO,MAAM,cAAc,IAAI,cAAc,MAAM,OAAO;MAC1D,QAAQ,MAAM,cAAc,IAAI,aAAa,MAAM,OAAO;MAC1D,cAAc,MAAM,YAAY;MAChC,eAAe,MAAM,YAAY;KAClC,EAAC;IACH;AAED,QAAI,iBAEF,0BAAU,iBAAiB;QAG3B,uBAAsB,iBAAiB;GAE1C;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