@dxos/react-ui-masonry 0.8.4-main.ef1bc66f44 → 0.8.4-main.fcc0d83b33

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.
@@ -1,84 +1,127 @@
1
1
  // src/Masonry.tsx
2
+ import { useArrowNavigationGroup } from "@fluentui/react-tabster";
2
3
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
3
- import { useMasonry, usePositioner, useResizeObserver } from "masonic";
4
- import React, { forwardRef, useMemo, useRef } from "react";
4
+ import { createContext } from "@radix-ui/react-context";
5
+ import { VirtuosoMasonry } from "@virtuoso.dev/masonry";
6
+ import React, { useMemo, useRef } from "react";
5
7
  import { useResizeDetector } from "react-resize-detector";
6
- import { useScroller } from "@dxos/react-hooks";
7
- import { usePx } from "@dxos/react-ui";
8
- import { cardMaxInlineSize, cardMinInlineSize } from "@dxos/ui-theme";
9
- import { mx } from "@dxos/ui-theme";
10
- var usePxProps = (remProps) => {
11
- const remInPx = usePx(1);
12
- return useMemo(() => {
13
- return Object.fromEntries(Object.entries(remProps).filter(([_, value]) => Number.isFinite(value)).map(([key, value]) => {
14
- return [
15
- key,
16
- value * remInPx
17
- ];
18
- }));
19
- }, [
20
- remProps,
21
- remInPx
22
- ]);
23
- };
24
- var MasonryRootImpl = ({ columnCount, maxColumnCount, columnWidth = cardMinInlineSize, maxColumnWidth = cardMaxInlineSize, columnGutter = 1, rowGutter, items, itemHeightEstimate = 256, itemKey, overscanBy = 6, render, onRender, classNames, intrinsicHeight, ...props }, forwardedRef) => {
8
+ import { ScrollArea, usePx } from "@dxos/react-ui";
9
+ import { cardMaxInlineSize, cardMinInlineSize, composable, composableProps, scrollbar } from "@dxos/ui-theme";
10
+ var MASONRY_NAME = "Masonry";
11
+ var [MasonryProvider, useMasonryContext] = createContext(MASONRY_NAME);
12
+ var [MasonryContentProvider, useMasonryContentContext] = createContext("Masonry.Content");
13
+ var MasonryRoot = ({ children, Tile, columns = void 0, maxColumns = void 0, minColumnWidth = cardMinInlineSize, maxColumnWidth = cardMaxInlineSize, gutter = 0.75 }) => /* @__PURE__ */ React.createElement(MasonryProvider, {
14
+ Tile,
15
+ columns,
16
+ maxColumns,
17
+ minColumnWidth,
18
+ maxColumnWidth,
19
+ gutter
20
+ }, children);
21
+ MasonryRoot.displayName = "Masonry.Root";
22
+ var MasonryContentInner = composable(({ children, centered, thin = true, padding = true, ...props }, forwardedRef) => {
25
23
  const rootRef = useRef(null);
26
- const ref = useComposedRefs(rootRef, forwardedRef);
27
- const { width = 0, height = 0 } = useResizeDetector({
24
+ const composedRef = useComposedRefs(rootRef, forwardedRef);
25
+ const { width = 0 } = useResizeDetector({
28
26
  targetRef: rootRef
29
27
  });
30
- const { scrollTop, isScrolling } = useScroller(rootRef);
31
- const remProps = useMemo(() => ({
32
- columnWidth,
33
- maxColumnWidth,
34
- columnGutter,
35
- rowGutter
36
- }), [
37
- columnWidth,
38
- maxColumnWidth,
39
- columnGutter,
40
- rowGutter
28
+ return /* @__PURE__ */ React.createElement(ScrollArea.Root, {
29
+ ...composableProps(props),
30
+ centered,
31
+ thin,
32
+ padding,
33
+ ref: composedRef
34
+ }, /* @__PURE__ */ React.createElement(MasonryContentProvider, {
35
+ width
36
+ }, children));
37
+ });
38
+ MasonryContentInner.displayName = "Masonry.Content";
39
+ var MasonryContent = MasonryContentInner;
40
+ var MasonryViewportInner = composable(({ items, getId, ...props }, forwardedRef) => {
41
+ const { Tile, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter } = useMasonryContext("Masonry.Viewport");
42
+ const { width } = useMasonryContentContext("Masonry.Viewport");
43
+ const columnCount = useColumnCount(width - (scrollbar.thin.size + scrollbar.thin.padding), columns, maxColumns, minColumnWidth, maxColumnWidth, gutter);
44
+ const arrowNavigationAttrs = useArrowNavigationGroup({
45
+ axis: "both",
46
+ memorizeCurrent: true,
47
+ tabbable: true
48
+ });
49
+ const TileAdapter = useMemo(() => {
50
+ const Adapter = ({ data, index }) => /* @__PURE__ */ React.createElement("div", {
51
+ role: "listitem",
52
+ style: {
53
+ paddingBottom: `${gutter}rem`
54
+ }
55
+ }, /* @__PURE__ */ React.createElement(Tile, {
56
+ index,
57
+ data
58
+ }));
59
+ Adapter.displayName = "Masonry.TileAdapter";
60
+ return Adapter;
61
+ }, [
62
+ Tile,
63
+ gutter
41
64
  ]);
42
- const pxProps = usePxProps(remProps);
43
- const numItems = items.length;
44
- const positionerProps = useMemo(() => ({
45
- width,
65
+ if (width <= 0) {
66
+ return null;
67
+ }
68
+ return /* @__PURE__ */ React.createElement(ScrollArea.Viewport, {
69
+ asChild: true
70
+ }, /* @__PURE__ */ React.createElement(ComposableVirtuosoMasonry, {
71
+ ...arrowNavigationAttrs,
72
+ ...composableProps(props),
73
+ ref: forwardedRef,
74
+ style: {
75
+ gap: `${gutter}rem`
76
+ },
77
+ data: items,
46
78
  columnCount,
47
- maxColumnCount: Math.max(maxColumnCount ?? 1, numItems),
48
- ...pxProps
49
- }), [
79
+ ItemContent: TileAdapter
80
+ }));
81
+ });
82
+ var ComposableVirtuosoMasonry = composable(({ ...props }, _forwardedRef) => {
83
+ return /* @__PURE__ */ React.createElement(VirtuosoMasonry, props);
84
+ });
85
+ MasonryViewportInner.displayName = "Masonry.Viewport";
86
+ var MasonryViewport = MasonryViewportInner;
87
+ var useColumnCount = (width, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter) => {
88
+ const remInPx = usePx(1);
89
+ return useMemo(() => {
90
+ if (columns != null) {
91
+ return columns;
92
+ }
93
+ const minColumnWidthPx = minColumnWidth * remInPx;
94
+ const maxColumnWidthPx = maxColumnWidth * remInPx;
95
+ const gutterPx = gutter * remInPx;
96
+ if (width <= 0 || minColumnWidthPx <= 0) {
97
+ return 1;
98
+ }
99
+ let cols = Math.floor(width / (minColumnWidthPx + gutterPx));
100
+ if (maxColumnWidthPx > 0) {
101
+ const effectiveColWidth = width / cols - gutterPx;
102
+ if (effectiveColWidth > maxColumnWidthPx) {
103
+ const maxCols = Math.ceil(width / (maxColumnWidthPx + gutterPx));
104
+ if (width / maxCols - gutterPx >= minColumnWidthPx) {
105
+ cols = maxCols;
106
+ }
107
+ }
108
+ }
109
+ const clamped = maxColumns != null ? Math.min(cols, maxColumns) : cols;
110
+ return Math.max(1, clamped);
111
+ }, [
112
+ remInPx,
50
113
  width,
51
- columnCount,
52
- maxColumnCount,
53
- numItems,
54
- pxProps
55
- ]);
56
- const positioner = usePositioner(positionerProps, [
57
- positionerProps
114
+ columns,
115
+ maxColumns,
116
+ minColumnWidth,
117
+ maxColumnWidth,
118
+ gutter
58
119
  ]);
59
- const resizeObserver = useResizeObserver(positioner);
60
- const children = useMasonry({
61
- height: intrinsicHeight ? Infinity : height,
62
- scrollTop,
63
- isScrolling,
64
- resizeObserver,
65
- positioner,
66
- items,
67
- itemHeightEstimate,
68
- itemKey,
69
- overscanBy,
70
- render,
71
- onRender
72
- });
73
- return /* @__PURE__ */ React.createElement("div", {
74
- className: mx(classNames),
75
- ...props,
76
- ref
77
- }, children);
78
120
  };
79
- var MasonryRoot = /* @__PURE__ */ forwardRef(MasonryRootImpl);
80
121
  var Masonry = {
81
- Root: MasonryRoot
122
+ Root: MasonryRoot,
123
+ Content: MasonryContent,
124
+ Viewport: MasonryViewport
82
125
  };
83
126
  export {
84
127
  Masonry
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/Masonry.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport {\n type UseMasonryOptions,\n type UsePositionerOptions,\n useMasonry,\n usePositioner,\n useResizeObserver,\n} from 'masonic';\nimport React, {\n type ComponentPropsWithRef,\n type ForwardedRef,\n type JSX,\n type Ref,\n forwardRef,\n useMemo,\n useRef,\n} from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { useScroller } from '@dxos/react-hooks';\nimport { type ThemedClassName, usePx } from '@dxos/react-ui';\nimport { cardMaxInlineSize, cardMinInlineSize } from '@dxos/ui-theme';\nimport { mx } from '@dxos/ui-theme';\n\ntype MasonryRootProps<Item> = ThemedClassName<ComponentPropsWithRef<'div'>> &\n Omit<UsePositionerOptions, 'width'> &\n Omit<\n UseMasonryOptions<Item>,\n | 'height'\n | 'scrollTop'\n | 'isScrolling'\n | 'resizeObserver'\n | 'positioner'\n | 'as'\n | 'id'\n | 'itemAs'\n | 'itemStyle'\n | 'className'\n | 'style'\n | 'role'\n | 'tabIndex'\n | 'containerRef'\n > & { intrinsicHeight?: boolean };\n\nconst usePxProps = (remProps: Omit<UsePositionerOptions, 'width' | 'columnCount' | 'maxColumnCount'>) => {\n const remInPx = usePx(1);\n return useMemo(() => {\n return Object.fromEntries(\n Object.entries(remProps)\n .filter(([_, value]) => Number.isFinite(value))\n .map(([key, value]) => {\n return [key, value * remInPx];\n }),\n );\n }, [remProps, remInPx]);\n};\n\nconst MasonryRootImpl = <Item,>(\n {\n columnCount,\n maxColumnCount,\n columnWidth = cardMinInlineSize,\n maxColumnWidth = cardMaxInlineSize,\n columnGutter = 1,\n rowGutter,\n items,\n itemHeightEstimate = 256,\n itemKey,\n overscanBy = 6,\n render,\n onRender,\n classNames,\n intrinsicHeight,\n ...props\n }: MasonryRootProps<Item>,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const ref = useComposedRefs(rootRef, forwardedRef);\n const { width = 0, height = 0 } = useResizeDetector({ targetRef: rootRef });\n const { scrollTop, isScrolling } = useScroller(rootRef);\n const remProps = useMemo(\n () => ({ columnWidth, maxColumnWidth, columnGutter, rowGutter }),\n [columnWidth, maxColumnWidth, columnGutter, rowGutter],\n );\n const pxProps = usePxProps(remProps);\n const numItems = items.length;\n const positionerProps = useMemo<UsePositionerOptions>(\n () => ({\n width,\n columnCount,\n maxColumnCount: Math.max(maxColumnCount ?? 1, numItems),\n ...pxProps,\n }),\n [width, columnCount, maxColumnCount, numItems, pxProps],\n );\n const positioner = usePositioner(positionerProps, [positionerProps]);\n const resizeObserver = useResizeObserver(positioner);\n const children = useMasonry({\n height: intrinsicHeight ? Infinity : height,\n scrollTop,\n isScrolling,\n resizeObserver,\n positioner,\n items,\n itemHeightEstimate,\n itemKey,\n overscanBy,\n render,\n onRender,\n });\n\n return (\n <div className={mx(classNames)} {...props} ref={ref}>\n {children}\n </div>\n );\n};\n\nconst MasonryRoot = forwardRef(MasonryRootImpl) as <Item>(\n props: MasonryRootProps<Item> & {\n ref?: Ref<HTMLDivElement | null>;\n },\n) => JSX.Element;\n\nexport const Masonry = {\n Root: MasonryRoot,\n};\n\nexport type { MasonryRootProps };\n"],
5
- "mappings": ";AAIA,SAASA,uBAAuB;AAChC,SAGEC,YACAC,eACAC,yBACK;AACP,OAAOC,SAKLC,YACAC,SACAC,cACK;AACP,SAASC,yBAAyB;AAElC,SAASC,mBAAmB;AAC5B,SAA+BC,aAAa;AAC5C,SAASC,mBAAmBC,yBAAyB;AACrD,SAASC,UAAU;AAsBnB,IAAMC,aAAa,CAACC,aAAAA;AAClB,QAAMC,UAAUC,MAAM,CAAA;AACtB,SAAOC,QAAQ,MAAA;AACb,WAAOC,OAAOC,YACZD,OAAOE,QAAQN,QAAAA,EACZO,OAAO,CAAC,CAACC,GAAGC,KAAAA,MAAWC,OAAOC,SAASF,KAAAA,CAAAA,EACvCG,IAAI,CAAC,CAACC,KAAKJ,KAAAA,MAAM;AAChB,aAAO;QAACI;QAAKJ,QAAQR;;IACvB,CAAA,CAAA;EAEN,GAAG;IAACD;IAAUC;GAAQ;AACxB;AAEA,IAAMa,kBAAkB,CACtB,EACEC,aACAC,gBACAC,cAAcC,mBACdC,iBAAiBC,mBACjBC,eAAe,GACfC,WACAC,OACAC,qBAAqB,KACrBC,SACAC,aAAa,GACbC,QACAC,UACAC,YACAC,iBACA,GAAGC,MAAAA,GAELC,iBAAAA;AAEA,QAAMC,UAAUC,OAA8B,IAAA;AAC9C,QAAMC,MAAMC,gBAAgBH,SAASD,YAAAA;AACrC,QAAM,EAAEK,QAAQ,GAAGC,SAAS,EAAC,IAAKC,kBAAkB;IAAEC,WAAWP;EAAQ,CAAA;AACzE,QAAM,EAAEQ,WAAWC,YAAW,IAAKC,YAAYV,OAAAA;AAC/C,QAAMjC,WAAWG,QACf,OAAO;IAAEc;IAAaE;IAAgBE;IAAcC;EAAU,IAC9D;IAACL;IAAaE;IAAgBE;IAAcC;GAAU;AAExD,QAAMsB,UAAU7C,WAAWC,QAAAA;AAC3B,QAAM6C,WAAWtB,MAAMuB;AACvB,QAAMC,kBAAkB5C,QACtB,OAAO;IACLkC;IACAtB;IACAC,gBAAgBgC,KAAKC,IAAIjC,kBAAkB,GAAG6B,QAAAA;IAC9C,GAAGD;EACL,IACA;IAACP;IAAOtB;IAAaC;IAAgB6B;IAAUD;GAAQ;AAEzD,QAAMM,aAAaC,cAAcJ,iBAAiB;IAACA;GAAgB;AACnE,QAAMK,iBAAiBC,kBAAkBH,UAAAA;AACzC,QAAMI,WAAWC,WAAW;IAC1BjB,QAAQR,kBAAkB0B,WAAWlB;IACrCG;IACAC;IACAU;IACAF;IACA3B;IACAC;IACAC;IACAC;IACAC;IACAC;EACF,CAAA;AAEA,SACE,sBAAA,cAAC6B,OAAAA;IAAIC,WAAWC,GAAG9B,UAAAA;IAAc,GAAGE;IAAOI;KACxCmB,QAAAA;AAGP;AAEA,IAAMM,cAAcC,2BAAW/C,eAAAA;AAMxB,IAAMgD,UAAU;EACrBC,MAAMH;AACR;",
6
- "names": ["useComposedRefs", "useMasonry", "usePositioner", "useResizeObserver", "React", "forwardRef", "useMemo", "useRef", "useResizeDetector", "useScroller", "usePx", "cardMaxInlineSize", "cardMinInlineSize", "mx", "usePxProps", "remProps", "remInPx", "usePx", "useMemo", "Object", "fromEntries", "entries", "filter", "_", "value", "Number", "isFinite", "map", "key", "MasonryRootImpl", "columnCount", "maxColumnCount", "columnWidth", "cardMinInlineSize", "maxColumnWidth", "cardMaxInlineSize", "columnGutter", "rowGutter", "items", "itemHeightEstimate", "itemKey", "overscanBy", "render", "onRender", "classNames", "intrinsicHeight", "props", "forwardedRef", "rootRef", "useRef", "ref", "useComposedRefs", "width", "height", "useResizeDetector", "targetRef", "scrollTop", "isScrolling", "useScroller", "pxProps", "numItems", "length", "positionerProps", "Math", "max", "positioner", "usePositioner", "resizeObserver", "useResizeObserver", "children", "useMasonry", "Infinity", "div", "className", "mx", "MasonryRoot", "forwardRef", "Masonry", "Root"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { VirtuosoMasonry, type VirtuosoMasonryProps } from '@virtuoso.dev/masonry';\nimport React, { type ComponentType, type JSX, type PropsWithChildren, type Ref, useMemo, useRef } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { ScrollArea, ScrollAreaRootProps, ThemedClassName, usePx } from '@dxos/react-ui';\nimport { cardMaxInlineSize, cardMinInlineSize, composable, composableProps, scrollbar } from '@dxos/ui-theme';\n\n//\n// Context\n//\n\ntype MasonryContextValue = {\n /** Render component for each masonry item. */\n Tile: ComponentType<{ data: any; index: number }>;\n /** Override auto-calculated column count. */\n columns: number | undefined;\n /** Upper bound on number of columns. */\n maxColumns: number | undefined;\n /** Minimum column width in rem. */\n minColumnWidth: number;\n /** Maximum column width in rem. */\n maxColumnWidth: number;\n /** Space between columns and rows in rem. */\n gutter: number;\n};\n\nconst MASONRY_NAME = 'Masonry';\n\nconst [MasonryProvider, useMasonryContext] = createContext<MasonryContextValue>(MASONRY_NAME);\n\n/** Content-scoped context: measured width of the ScrollArea.Root, shared with Viewport. */\ntype MasonryContentContextValue = {\n width: number;\n};\n\nconst [MasonryContentProvider, useMasonryContentContext] = createContext<MasonryContentContextValue>('Masonry.Content');\n\n//\n// Root\n//\n\ntype MasonryRootProps = PropsWithChildren<Partial<MasonryContextValue>>;\n\nconst MasonryRoot = ({\n children,\n Tile,\n columns = undefined,\n maxColumns = undefined,\n minColumnWidth = cardMinInlineSize,\n maxColumnWidth = cardMaxInlineSize,\n gutter = 0.75,\n}: MasonryRootProps) => (\n <MasonryProvider\n Tile={Tile!}\n columns={columns}\n maxColumns={maxColumns}\n minColumnWidth={minColumnWidth}\n maxColumnWidth={maxColumnWidth}\n gutter={gutter}\n >\n {children}\n </MasonryProvider>\n);\n\nMasonryRoot.displayName = 'Masonry.Root';\n\n//\n// Content\n//\n// The outer wrapper: renders the ScrollArea.Root, measures available width,\n// and publishes that width via context for Masonry.Viewport to consume.\n// Style this layer (centered/thin/padding) to control the scroll container.\n//\n\ntype MasonryContentProps = ThemedClassName<\n PropsWithChildren<Pick<ScrollAreaRootProps, 'centered' | 'thin' | 'padding'>>\n>;\n\nconst MasonryContentInner = composable<HTMLDivElement, MasonryContentProps>(\n ({ children, centered, thin = true, padding = true, ...props }, forwardedRef) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const composedRef = useComposedRefs(rootRef, forwardedRef);\n const { width = 0 } = useResizeDetector({ targetRef: rootRef });\n\n // NOTE: Masonry currently doesn't support an external scroller.\n // https://github.com/petyosi/react-virtuoso/issues/1305\n return (\n <ScrollArea.Root {...composableProps(props)} centered={centered} thin={thin} padding={padding} ref={composedRef}>\n <MasonryContentProvider width={width}>{children}</MasonryContentProvider>\n </ScrollArea.Root>\n );\n },\n);\n\nMasonryContentInner.displayName = 'Masonry.Content';\n\nconst MasonryContent = MasonryContentInner as (\n props: MasonryContentProps & {\n ref?: Ref<HTMLDivElement | null>;\n },\n) => JSX.Element;\n\n//\n// Viewport\n//\n// The inner render layer: renders the ScrollArea.Viewport wrapped around\n// VirtuosoMasonry. Style this layer separately from Content to control\n// the tile grid (e.g. inner padding, alignment).\n//\n\ntype MasonryViewportProps<Item> = ThemedClassName<{\n /** Items to render in the masonry grid. */\n items: Item[];\n /** Extract a stable key from an item, aligned with react-ui-mosaic's getId. */\n getId?: (data: Item) => string;\n}>;\n\nconst MasonryViewportInner = composable<HTMLDivElement, MasonryViewportProps<any>>(\n ({ items, getId, ...props }, forwardedRef) => {\n const { Tile, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter } = useMasonryContext('Masonry.Viewport');\n const { width } = useMasonryContentContext('Masonry.Viewport');\n const columnCount = useColumnCount(\n width - (scrollbar.thin.size + scrollbar.thin.padding),\n columns,\n maxColumns,\n minColumnWidth,\n maxColumnWidth,\n gutter,\n );\n\n // Arrow-key navigation across tiles. Uses Tabster's `both` axis so all\n // four arrows move focus through the items. True 2D (grid) axis doesn't\n // work inside a masonry because VirtuosoMasonry lays items out column-\n // first in the DOM — tabster's Grid direction requires the next DOM\n // element to be to the right of the current for ArrowRight, which is\n // never the case between columns here. `both` treats the keys as flat\n // next/previous-focusable, which gives predictable wrap-around in DOM\n // order for all four directions.\n const arrowNavigationAttrs = useArrowNavigationGroup({\n axis: 'both',\n memorizeCurrent: true,\n tabbable: true,\n });\n\n const TileAdapter = useMemo(() => {\n const Adapter = ({ data, index }: { data: any; index: number }) => (\n <div role='listitem' style={{ paddingBottom: `${gutter}rem` }}>\n <Tile index={index} data={data} />\n </div>\n );\n Adapter.displayName = 'Masonry.TileAdapter';\n return Adapter;\n }, [Tile, gutter]);\n\n if (width <= 0) {\n return null;\n }\n\n return (\n <ScrollArea.Viewport asChild>\n <ComposableVirtuosoMasonry\n {...arrowNavigationAttrs}\n {...composableProps(props)}\n ref={forwardedRef}\n style={{ gap: `${gutter}rem` }}\n data={items}\n columnCount={columnCount}\n ItemContent={TileAdapter}\n />\n </ScrollArea.Viewport>\n );\n },\n);\n\nconst ComposableVirtuosoMasonry = composable<HTMLDivElement, VirtuosoMasonryProps<any, any>>(\n ({ ...props }, _forwardedRef) => {\n return <VirtuosoMasonry {...props} />;\n },\n);\n\nMasonryViewportInner.displayName = 'Masonry.Viewport';\n\nconst MasonryViewport = MasonryViewportInner as <Item>(\n props: MasonryViewportProps<Item> & {\n ref?: Ref<HTMLDivElement | null>;\n },\n) => JSX.Element;\n\n/** Compute column count from container width and column constraints. */\nconst useColumnCount = (\n width: number,\n columns: number | undefined,\n maxColumns: number | undefined,\n minColumnWidth: number,\n maxColumnWidth: number,\n gutter: number,\n) => {\n const remInPx = usePx(1);\n return useMemo(() => {\n if (columns != null) {\n return columns;\n }\n\n const minColumnWidthPx = minColumnWidth * remInPx;\n const maxColumnWidthPx = maxColumnWidth * remInPx;\n const gutterPx = gutter * remInPx;\n if (width <= 0 || minColumnWidthPx <= 0) {\n return 1;\n }\n\n // Each tile has paddingRight: gutter, so every slot (including the last) occupies\n // (colWidth + gutterPx). The container therefore fits floor(containerWidth / (colWidth + gutterPx)) columns.\n let cols = Math.floor(width / (minColumnWidthPx + gutterPx));\n if (maxColumnWidthPx > 0) {\n const effectiveColWidth = width / cols - gutterPx;\n if (effectiveColWidth > maxColumnWidthPx) {\n // Try to add columns to keep cards below maxColumnWidth, but never violate minColumnWidth.\n const maxCols = Math.ceil(width / (maxColumnWidthPx + gutterPx));\n if (width / maxCols - gutterPx >= minColumnWidthPx) {\n cols = maxCols;\n }\n }\n }\n\n const clamped = maxColumns != null ? Math.min(cols, maxColumns) : cols;\n return Math.max(1, clamped);\n }, [remInPx, width, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter]);\n};\n\n//\n// Masonry\n//\n\nexport const Masonry = {\n Root: MasonryRoot,\n Content: MasonryContent,\n Viewport: MasonryViewport,\n};\n\nexport type { MasonryRootProps, MasonryContentProps, MasonryViewportProps };\n"],
5
+ "mappings": ";AAIA,SAASA,+BAA+B;AACxC,SAASC,uBAAuB;AAChC,SAASC,qBAAqB;AAC9B,SAASC,uBAAkD;AAC3D,OAAOC,SAAyEC,SAASC,cAAc;AACvG,SAASC,yBAAyB;AAElC,SAASC,YAAkDC,aAAa;AACxE,SAASC,mBAAmBC,mBAAmBC,YAAYC,iBAAiBC,iBAAiB;AAqB7F,IAAMC,eAAe;AA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AACxB,YAAMK,oBAAoBrC,QAAQkC,OAAOD;AACzC,UAAII,oBAAoBL,kBAAkB;AAExC,cAAMM,UAAUH,KAAKI,KAAKvC,SAASgC,mBAAmBC,SAAO;AAC7D,YAAIjC,QAAQsC,UAAUL,YAAYF,kBAAkB;AAClDG,iBAAOI;QACT;MACF;IACF;AAEA,UAAME,UAAUrD,cAAc,OAAOgD,KAAKM,IAAIP,MAAM/C,UAAAA,IAAc+C;AAClE,WAAOC,KAAKO,IAAI,GAAGF,OAAAA;EACrB,GAAG;IAACV;IAAS9B;IAAOf;IAASE;IAAYC;IAAgBC;IAAgBC;GAAO;AAClF;AAMO,IAAMqD,UAAU;EACrBzC,MAAMpB;EACN8D,SAASxC;EACTmB,UAAUM;AACZ;",
6
+ "names": ["useArrowNavigationGroup", "useComposedRefs", "createContext", "VirtuosoMasonry", "React", "useMemo", "useRef", "useResizeDetector", "ScrollArea", "usePx", "cardMaxInlineSize", "cardMinInlineSize", "composable", "composableProps", "scrollbar", "MASONRY_NAME", "MasonryProvider", "useMasonryContext", "MasonryContentProvider", "useMasonryContentContext", "MasonryRoot", "children", "Tile", "columns", "undefined", "maxColumns", "minColumnWidth", "maxColumnWidth", "gutter", "displayName", "MasonryContentInner", "centered", "thin", "padding", "props", "forwardedRef", "rootRef", "composedRef", "width", "targetRef", "Root", "ref", "MasonryContent", "MasonryViewportInner", "items", "getId", "columnCount", "useColumnCount", "size", "arrowNavigationAttrs", "axis", "memorizeCurrent", "tabbable", "TileAdapter", "Adapter", "data", "index", "div", "role", "style", "paddingBottom", "Viewport", "asChild", "ComposableVirtuosoMasonry", "gap", "ItemContent", "_forwardedRef", "MasonryViewport", "remInPx", "minColumnWidthPx", "maxColumnWidthPx", "gutterPx", "cols", "Math", "floor", "effectiveColWidth", "maxCols", "ceil", "clamped", "min", "max", "Masonry", "Content"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/Masonry.tsx":{"bytes":10952,"imports":[{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"masonic","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":454,"imports":[{"path":"src/Masonry.tsx","kind":"import-statement","original":"./Masonry"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6174},"dist/lib/browser/index.mjs":{"imports":[{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"masonic","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Masonry"],"entryPoint":"src/index.ts","inputs":{"src/Masonry.tsx":{"bytesInOutput":2398},"src/index.ts":{"bytesInOutput":0}},"bytes":2474}}}
1
+ {"inputs":{"src/Masonry.tsx":{"bytes":23002,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@virtuoso.dev/masonry","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":375,"imports":[{"path":"src/Masonry.tsx","kind":"import-statement","original":"./Masonry"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12269},"dist/lib/browser/index.mjs":{"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@virtuoso.dev/masonry","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Masonry"],"entryPoint":"src/index.ts","inputs":{"src/Masonry.tsx":{"bytesInOutput":4434},"src/index.ts":{"bytesInOutput":0}},"bytes":4510}}}
@@ -1,86 +1,129 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
 
3
3
  // src/Masonry.tsx
4
+ import { useArrowNavigationGroup } from "@fluentui/react-tabster";
4
5
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
5
- import { useMasonry, usePositioner, useResizeObserver } from "masonic";
6
- import React, { forwardRef, useMemo, useRef } from "react";
6
+ import { createContext } from "@radix-ui/react-context";
7
+ import { VirtuosoMasonry } from "@virtuoso.dev/masonry";
8
+ import React, { useMemo, useRef } from "react";
7
9
  import { useResizeDetector } from "react-resize-detector";
8
- import { useScroller } from "@dxos/react-hooks";
9
- import { usePx } from "@dxos/react-ui";
10
- import { cardMaxInlineSize, cardMinInlineSize } from "@dxos/ui-theme";
11
- import { mx } from "@dxos/ui-theme";
12
- var usePxProps = (remProps) => {
13
- const remInPx = usePx(1);
14
- return useMemo(() => {
15
- return Object.fromEntries(Object.entries(remProps).filter(([_, value]) => Number.isFinite(value)).map(([key, value]) => {
16
- return [
17
- key,
18
- value * remInPx
19
- ];
20
- }));
21
- }, [
22
- remProps,
23
- remInPx
24
- ]);
25
- };
26
- var MasonryRootImpl = ({ columnCount, maxColumnCount, columnWidth = cardMinInlineSize, maxColumnWidth = cardMaxInlineSize, columnGutter = 1, rowGutter, items, itemHeightEstimate = 256, itemKey, overscanBy = 6, render, onRender, classNames, intrinsicHeight, ...props }, forwardedRef) => {
10
+ import { ScrollArea, usePx } from "@dxos/react-ui";
11
+ import { cardMaxInlineSize, cardMinInlineSize, composable, composableProps, scrollbar } from "@dxos/ui-theme";
12
+ var MASONRY_NAME = "Masonry";
13
+ var [MasonryProvider, useMasonryContext] = createContext(MASONRY_NAME);
14
+ var [MasonryContentProvider, useMasonryContentContext] = createContext("Masonry.Content");
15
+ var MasonryRoot = ({ children, Tile, columns = void 0, maxColumns = void 0, minColumnWidth = cardMinInlineSize, maxColumnWidth = cardMaxInlineSize, gutter = 0.75 }) => /* @__PURE__ */ React.createElement(MasonryProvider, {
16
+ Tile,
17
+ columns,
18
+ maxColumns,
19
+ minColumnWidth,
20
+ maxColumnWidth,
21
+ gutter
22
+ }, children);
23
+ MasonryRoot.displayName = "Masonry.Root";
24
+ var MasonryContentInner = composable(({ children, centered, thin = true, padding = true, ...props }, forwardedRef) => {
27
25
  const rootRef = useRef(null);
28
- const ref = useComposedRefs(rootRef, forwardedRef);
29
- const { width = 0, height = 0 } = useResizeDetector({
26
+ const composedRef = useComposedRefs(rootRef, forwardedRef);
27
+ const { width = 0 } = useResizeDetector({
30
28
  targetRef: rootRef
31
29
  });
32
- const { scrollTop, isScrolling } = useScroller(rootRef);
33
- const remProps = useMemo(() => ({
34
- columnWidth,
35
- maxColumnWidth,
36
- columnGutter,
37
- rowGutter
38
- }), [
39
- columnWidth,
40
- maxColumnWidth,
41
- columnGutter,
42
- rowGutter
30
+ return /* @__PURE__ */ React.createElement(ScrollArea.Root, {
31
+ ...composableProps(props),
32
+ centered,
33
+ thin,
34
+ padding,
35
+ ref: composedRef
36
+ }, /* @__PURE__ */ React.createElement(MasonryContentProvider, {
37
+ width
38
+ }, children));
39
+ });
40
+ MasonryContentInner.displayName = "Masonry.Content";
41
+ var MasonryContent = MasonryContentInner;
42
+ var MasonryViewportInner = composable(({ items, getId, ...props }, forwardedRef) => {
43
+ const { Tile, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter } = useMasonryContext("Masonry.Viewport");
44
+ const { width } = useMasonryContentContext("Masonry.Viewport");
45
+ const columnCount = useColumnCount(width - (scrollbar.thin.size + scrollbar.thin.padding), columns, maxColumns, minColumnWidth, maxColumnWidth, gutter);
46
+ const arrowNavigationAttrs = useArrowNavigationGroup({
47
+ axis: "both",
48
+ memorizeCurrent: true,
49
+ tabbable: true
50
+ });
51
+ const TileAdapter = useMemo(() => {
52
+ const Adapter = ({ data, index }) => /* @__PURE__ */ React.createElement("div", {
53
+ role: "listitem",
54
+ style: {
55
+ paddingBottom: `${gutter}rem`
56
+ }
57
+ }, /* @__PURE__ */ React.createElement(Tile, {
58
+ index,
59
+ data
60
+ }));
61
+ Adapter.displayName = "Masonry.TileAdapter";
62
+ return Adapter;
63
+ }, [
64
+ Tile,
65
+ gutter
43
66
  ]);
44
- const pxProps = usePxProps(remProps);
45
- const numItems = items.length;
46
- const positionerProps = useMemo(() => ({
47
- width,
67
+ if (width <= 0) {
68
+ return null;
69
+ }
70
+ return /* @__PURE__ */ React.createElement(ScrollArea.Viewport, {
71
+ asChild: true
72
+ }, /* @__PURE__ */ React.createElement(ComposableVirtuosoMasonry, {
73
+ ...arrowNavigationAttrs,
74
+ ...composableProps(props),
75
+ ref: forwardedRef,
76
+ style: {
77
+ gap: `${gutter}rem`
78
+ },
79
+ data: items,
48
80
  columnCount,
49
- maxColumnCount: Math.max(maxColumnCount ?? 1, numItems),
50
- ...pxProps
51
- }), [
81
+ ItemContent: TileAdapter
82
+ }));
83
+ });
84
+ var ComposableVirtuosoMasonry = composable(({ ...props }, _forwardedRef) => {
85
+ return /* @__PURE__ */ React.createElement(VirtuosoMasonry, props);
86
+ });
87
+ MasonryViewportInner.displayName = "Masonry.Viewport";
88
+ var MasonryViewport = MasonryViewportInner;
89
+ var useColumnCount = (width, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter) => {
90
+ const remInPx = usePx(1);
91
+ return useMemo(() => {
92
+ if (columns != null) {
93
+ return columns;
94
+ }
95
+ const minColumnWidthPx = minColumnWidth * remInPx;
96
+ const maxColumnWidthPx = maxColumnWidth * remInPx;
97
+ const gutterPx = gutter * remInPx;
98
+ if (width <= 0 || minColumnWidthPx <= 0) {
99
+ return 1;
100
+ }
101
+ let cols = Math.floor(width / (minColumnWidthPx + gutterPx));
102
+ if (maxColumnWidthPx > 0) {
103
+ const effectiveColWidth = width / cols - gutterPx;
104
+ if (effectiveColWidth > maxColumnWidthPx) {
105
+ const maxCols = Math.ceil(width / (maxColumnWidthPx + gutterPx));
106
+ if (width / maxCols - gutterPx >= minColumnWidthPx) {
107
+ cols = maxCols;
108
+ }
109
+ }
110
+ }
111
+ const clamped = maxColumns != null ? Math.min(cols, maxColumns) : cols;
112
+ return Math.max(1, clamped);
113
+ }, [
114
+ remInPx,
52
115
  width,
53
- columnCount,
54
- maxColumnCount,
55
- numItems,
56
- pxProps
57
- ]);
58
- const positioner = usePositioner(positionerProps, [
59
- positionerProps
116
+ columns,
117
+ maxColumns,
118
+ minColumnWidth,
119
+ maxColumnWidth,
120
+ gutter
60
121
  ]);
61
- const resizeObserver = useResizeObserver(positioner);
62
- const children = useMasonry({
63
- height: intrinsicHeight ? Infinity : height,
64
- scrollTop,
65
- isScrolling,
66
- resizeObserver,
67
- positioner,
68
- items,
69
- itemHeightEstimate,
70
- itemKey,
71
- overscanBy,
72
- render,
73
- onRender
74
- });
75
- return /* @__PURE__ */ React.createElement("div", {
76
- className: mx(classNames),
77
- ...props,
78
- ref
79
- }, children);
80
122
  };
81
- var MasonryRoot = /* @__PURE__ */ forwardRef(MasonryRootImpl);
82
123
  var Masonry = {
83
- Root: MasonryRoot
124
+ Root: MasonryRoot,
125
+ Content: MasonryContent,
126
+ Viewport: MasonryViewport
84
127
  };
85
128
  export {
86
129
  Masonry
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/Masonry.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport {\n type UseMasonryOptions,\n type UsePositionerOptions,\n useMasonry,\n usePositioner,\n useResizeObserver,\n} from 'masonic';\nimport React, {\n type ComponentPropsWithRef,\n type ForwardedRef,\n type JSX,\n type Ref,\n forwardRef,\n useMemo,\n useRef,\n} from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { useScroller } from '@dxos/react-hooks';\nimport { type ThemedClassName, usePx } from '@dxos/react-ui';\nimport { cardMaxInlineSize, cardMinInlineSize } from '@dxos/ui-theme';\nimport { mx } from '@dxos/ui-theme';\n\ntype MasonryRootProps<Item> = ThemedClassName<ComponentPropsWithRef<'div'>> &\n Omit<UsePositionerOptions, 'width'> &\n Omit<\n UseMasonryOptions<Item>,\n | 'height'\n | 'scrollTop'\n | 'isScrolling'\n | 'resizeObserver'\n | 'positioner'\n | 'as'\n | 'id'\n | 'itemAs'\n | 'itemStyle'\n | 'className'\n | 'style'\n | 'role'\n | 'tabIndex'\n | 'containerRef'\n > & { intrinsicHeight?: boolean };\n\nconst usePxProps = (remProps: Omit<UsePositionerOptions, 'width' | 'columnCount' | 'maxColumnCount'>) => {\n const remInPx = usePx(1);\n return useMemo(() => {\n return Object.fromEntries(\n Object.entries(remProps)\n .filter(([_, value]) => Number.isFinite(value))\n .map(([key, value]) => {\n return [key, value * remInPx];\n }),\n );\n }, [remProps, remInPx]);\n};\n\nconst MasonryRootImpl = <Item,>(\n {\n columnCount,\n maxColumnCount,\n columnWidth = cardMinInlineSize,\n maxColumnWidth = cardMaxInlineSize,\n columnGutter = 1,\n rowGutter,\n items,\n itemHeightEstimate = 256,\n itemKey,\n overscanBy = 6,\n render,\n onRender,\n classNames,\n intrinsicHeight,\n ...props\n }: MasonryRootProps<Item>,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const ref = useComposedRefs(rootRef, forwardedRef);\n const { width = 0, height = 0 } = useResizeDetector({ targetRef: rootRef });\n const { scrollTop, isScrolling } = useScroller(rootRef);\n const remProps = useMemo(\n () => ({ columnWidth, maxColumnWidth, columnGutter, rowGutter }),\n [columnWidth, maxColumnWidth, columnGutter, rowGutter],\n );\n const pxProps = usePxProps(remProps);\n const numItems = items.length;\n const positionerProps = useMemo<UsePositionerOptions>(\n () => ({\n width,\n columnCount,\n maxColumnCount: Math.max(maxColumnCount ?? 1, numItems),\n ...pxProps,\n }),\n [width, columnCount, maxColumnCount, numItems, pxProps],\n );\n const positioner = usePositioner(positionerProps, [positionerProps]);\n const resizeObserver = useResizeObserver(positioner);\n const children = useMasonry({\n height: intrinsicHeight ? Infinity : height,\n scrollTop,\n isScrolling,\n resizeObserver,\n positioner,\n items,\n itemHeightEstimate,\n itemKey,\n overscanBy,\n render,\n onRender,\n });\n\n return (\n <div className={mx(classNames)} {...props} ref={ref}>\n {children}\n </div>\n );\n};\n\nconst MasonryRoot = forwardRef(MasonryRootImpl) as <Item>(\n props: MasonryRootProps<Item> & {\n ref?: Ref<HTMLDivElement | null>;\n },\n) => JSX.Element;\n\nexport const Masonry = {\n Root: MasonryRoot,\n};\n\nexport type { MasonryRootProps };\n"],
5
- "mappings": ";;;AAIA,SAASA,uBAAuB;AAChC,SAGEC,YACAC,eACAC,yBACK;AACP,OAAOC,SAKLC,YACAC,SACAC,cACK;AACP,SAASC,yBAAyB;AAElC,SAASC,mBAAmB;AAC5B,SAA+BC,aAAa;AAC5C,SAASC,mBAAmBC,yBAAyB;AACrD,SAASC,UAAU;AAsBnB,IAAMC,aAAa,CAACC,aAAAA;AAClB,QAAMC,UAAUC,MAAM,CAAA;AACtB,SAAOC,QAAQ,MAAA;AACb,WAAOC,OAAOC,YACZD,OAAOE,QAAQN,QAAAA,EACZO,OAAO,CAAC,CAACC,GAAGC,KAAAA,MAAWC,OAAOC,SAASF,KAAAA,CAAAA,EACvCG,IAAI,CAAC,CAACC,KAAKJ,KAAAA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,eAAAA;AAMxB,IAAMgD,UAAU;EACrBC,MAAMH;AACR;",
6
- "names": ["useComposedRefs", "useMasonry", "usePositioner", "useResizeObserver", "React", "forwardRef", "useMemo", "useRef", "useResizeDetector", "useScroller", "usePx", "cardMaxInlineSize", "cardMinInlineSize", "mx", "usePxProps", "remProps", "remInPx", "usePx", "useMemo", "Object", "fromEntries", "entries", "filter", "_", "value", "Number", "isFinite", "map", "key", "MasonryRootImpl", "columnCount", "maxColumnCount", "columnWidth", "cardMinInlineSize", "maxColumnWidth", "cardMaxInlineSize", "columnGutter", "rowGutter", "items", "itemHeightEstimate", "itemKey", "overscanBy", "render", "onRender", "classNames", "intrinsicHeight", "props", "forwardedRef", "rootRef", "useRef", "ref", "useComposedRefs", "width", "height", "useResizeDetector", "targetRef", "scrollTop", "isScrolling", "useScroller", "pxProps", "numItems", "length", "positionerProps", "Math", "max", "positioner", "usePositioner", "resizeObserver", "useResizeObserver", "children", "useMasonry", "Infinity", "div", "className", "mx", "MasonryRoot", "forwardRef", "Masonry", "Root"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { VirtuosoMasonry, type VirtuosoMasonryProps } from '@virtuoso.dev/masonry';\nimport React, { type ComponentType, type JSX, type PropsWithChildren, type Ref, useMemo, useRef } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { ScrollArea, ScrollAreaRootProps, ThemedClassName, usePx } from '@dxos/react-ui';\nimport { cardMaxInlineSize, cardMinInlineSize, composable, composableProps, scrollbar } from '@dxos/ui-theme';\n\n//\n// Context\n//\n\ntype MasonryContextValue = {\n /** Render component for each masonry item. */\n Tile: ComponentType<{ data: any; index: number }>;\n /** Override auto-calculated column count. */\n columns: number | undefined;\n /** Upper bound on number of columns. */\n maxColumns: number | undefined;\n /** Minimum column width in rem. */\n minColumnWidth: number;\n /** Maximum column width in rem. */\n maxColumnWidth: number;\n /** Space between columns and rows in rem. */\n gutter: number;\n};\n\nconst MASONRY_NAME = 'Masonry';\n\nconst [MasonryProvider, useMasonryContext] = createContext<MasonryContextValue>(MASONRY_NAME);\n\n/** Content-scoped context: measured width of the ScrollArea.Root, shared with Viewport. */\ntype MasonryContentContextValue = {\n width: number;\n};\n\nconst [MasonryContentProvider, useMasonryContentContext] = createContext<MasonryContentContextValue>('Masonry.Content');\n\n//\n// Root\n//\n\ntype MasonryRootProps = PropsWithChildren<Partial<MasonryContextValue>>;\n\nconst MasonryRoot = ({\n children,\n Tile,\n columns = undefined,\n maxColumns = undefined,\n minColumnWidth = cardMinInlineSize,\n maxColumnWidth = cardMaxInlineSize,\n gutter = 0.75,\n}: MasonryRootProps) => (\n <MasonryProvider\n Tile={Tile!}\n columns={columns}\n maxColumns={maxColumns}\n minColumnWidth={minColumnWidth}\n maxColumnWidth={maxColumnWidth}\n gutter={gutter}\n >\n {children}\n </MasonryProvider>\n);\n\nMasonryRoot.displayName = 'Masonry.Root';\n\n//\n// Content\n//\n// The outer wrapper: renders the ScrollArea.Root, measures available width,\n// and publishes that width via context for Masonry.Viewport to consume.\n// Style this layer (centered/thin/padding) to control the scroll container.\n//\n\ntype MasonryContentProps = ThemedClassName<\n PropsWithChildren<Pick<ScrollAreaRootProps, 'centered' | 'thin' | 'padding'>>\n>;\n\nconst MasonryContentInner = composable<HTMLDivElement, MasonryContentProps>(\n ({ children, centered, thin = true, padding = true, ...props }, forwardedRef) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const composedRef = useComposedRefs(rootRef, forwardedRef);\n const { width = 0 } = useResizeDetector({ targetRef: rootRef });\n\n // NOTE: Masonry currently doesn't support an external scroller.\n // https://github.com/petyosi/react-virtuoso/issues/1305\n return (\n <ScrollArea.Root {...composableProps(props)} centered={centered} thin={thin} padding={padding} ref={composedRef}>\n <MasonryContentProvider width={width}>{children}</MasonryContentProvider>\n </ScrollArea.Root>\n );\n },\n);\n\nMasonryContentInner.displayName = 'Masonry.Content';\n\nconst MasonryContent = MasonryContentInner as (\n props: MasonryContentProps & {\n ref?: Ref<HTMLDivElement | null>;\n },\n) => JSX.Element;\n\n//\n// Viewport\n//\n// The inner render layer: renders the ScrollArea.Viewport wrapped around\n// VirtuosoMasonry. Style this layer separately from Content to control\n// the tile grid (e.g. inner padding, alignment).\n//\n\ntype MasonryViewportProps<Item> = ThemedClassName<{\n /** Items to render in the masonry grid. */\n items: Item[];\n /** Extract a stable key from an item, aligned with react-ui-mosaic's getId. */\n getId?: (data: Item) => string;\n}>;\n\nconst MasonryViewportInner = composable<HTMLDivElement, MasonryViewportProps<any>>(\n ({ items, getId, ...props }, forwardedRef) => {\n const { Tile, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter } = useMasonryContext('Masonry.Viewport');\n const { width } = useMasonryContentContext('Masonry.Viewport');\n const columnCount = useColumnCount(\n width - (scrollbar.thin.size + scrollbar.thin.padding),\n columns,\n maxColumns,\n minColumnWidth,\n maxColumnWidth,\n gutter,\n );\n\n // Arrow-key navigation across tiles. Uses Tabster's `both` axis so all\n // four arrows move focus through the items. True 2D (grid) axis doesn't\n // work inside a masonry because VirtuosoMasonry lays items out column-\n // first in the DOM — tabster's Grid direction requires the next DOM\n // element to be to the right of the current for ArrowRight, which is\n // never the case between columns here. `both` treats the keys as flat\n // next/previous-focusable, which gives predictable wrap-around in DOM\n // order for all four directions.\n const arrowNavigationAttrs = useArrowNavigationGroup({\n axis: 'both',\n memorizeCurrent: true,\n tabbable: true,\n });\n\n const TileAdapter = useMemo(() => {\n const Adapter = ({ data, index }: { data: any; index: number }) => (\n <div role='listitem' style={{ paddingBottom: `${gutter}rem` }}>\n <Tile index={index} data={data} />\n </div>\n );\n Adapter.displayName = 'Masonry.TileAdapter';\n return Adapter;\n }, [Tile, gutter]);\n\n if (width <= 0) {\n return null;\n }\n\n return (\n <ScrollArea.Viewport asChild>\n <ComposableVirtuosoMasonry\n {...arrowNavigationAttrs}\n {...composableProps(props)}\n ref={forwardedRef}\n style={{ gap: `${gutter}rem` }}\n data={items}\n columnCount={columnCount}\n ItemContent={TileAdapter}\n />\n </ScrollArea.Viewport>\n );\n },\n);\n\nconst ComposableVirtuosoMasonry = composable<HTMLDivElement, VirtuosoMasonryProps<any, any>>(\n ({ ...props }, _forwardedRef) => {\n return <VirtuosoMasonry {...props} />;\n },\n);\n\nMasonryViewportInner.displayName = 'Masonry.Viewport';\n\nconst MasonryViewport = MasonryViewportInner as <Item>(\n props: MasonryViewportProps<Item> & {\n ref?: Ref<HTMLDivElement | null>;\n },\n) => JSX.Element;\n\n/** Compute column count from container width and column constraints. */\nconst useColumnCount = (\n width: number,\n columns: number | undefined,\n maxColumns: number | undefined,\n minColumnWidth: number,\n maxColumnWidth: number,\n gutter: number,\n) => {\n const remInPx = usePx(1);\n return useMemo(() => {\n if (columns != null) {\n return columns;\n }\n\n const minColumnWidthPx = minColumnWidth * remInPx;\n const maxColumnWidthPx = maxColumnWidth * remInPx;\n const gutterPx = gutter * remInPx;\n if (width <= 0 || minColumnWidthPx <= 0) {\n return 1;\n }\n\n // Each tile has paddingRight: gutter, so every slot (including the last) occupies\n // (colWidth + gutterPx). The container therefore fits floor(containerWidth / (colWidth + gutterPx)) columns.\n let cols = Math.floor(width / (minColumnWidthPx + gutterPx));\n if (maxColumnWidthPx > 0) {\n const effectiveColWidth = width / cols - gutterPx;\n if (effectiveColWidth > maxColumnWidthPx) {\n // Try to add columns to keep cards below maxColumnWidth, but never violate minColumnWidth.\n const maxCols = Math.ceil(width / (maxColumnWidthPx + gutterPx));\n if (width / maxCols - gutterPx >= minColumnWidthPx) {\n cols = maxCols;\n }\n }\n }\n\n const clamped = maxColumns != null ? Math.min(cols, maxColumns) : cols;\n return Math.max(1, clamped);\n }, [remInPx, width, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter]);\n};\n\n//\n// Masonry\n//\n\nexport const Masonry = {\n Root: MasonryRoot,\n Content: MasonryContent,\n Viewport: MasonryViewport,\n};\n\nexport type { MasonryRootProps, MasonryContentProps, MasonryViewportProps };\n"],
5
+ "mappings": ";;;AAIA,SAASA,+BAA+B;AACxC,SAASC,uBAAuB;AAChC,SAASC,qBAAqB;AAC9B,SAASC,uBAAkD;AAC3D,OAAOC,SAAyEC,SAASC,cAAc;AACvG,SAASC,yBAAyB;AAElC,SAASC,YAAkDC,aAAa;AACxE,SAASC,mBAAmBC,mBAAmBC,YAAYC,iBAAiBC,iBAAiB;AAqB7F,IAAMC,eAAe;AAErB,IAAM,CAACC,iBAAiBC,iBAAAA,IAAqBf,cAAmCa,YAAAA;AAOhF,IAAM,CAACG,wBAAwBC,wBAAAA,IAA4BjB,cAA0C,iBAAA;AAQrG,IAAMkB,cAAc,CAAC,EACnBC,UACAC,MACAC,UAAUC,QACVC,aAAaD,QACbE,iBAAiBf,mBACjBgB,iBAAiBjB,mBACjBkB,SAAS,KAAI,MAEb,sBAAA,cAACZ,iBAAAA;EACCM;EACAC;EACAE;EACAC;EACAC;EACAC;GAECP,QAAAA;AAILD,YAAYS,cAAc;AAc1B,IAAMC,sBAAsBlB,WAC1B,CAAC,EAAES,UAAUU,UAAUC,OAAO,MAAMC,UAAU,MAAM,GAAGC,MAAAA,GAASC,iBAAAA;AAC9D,QAAMC,UAAU9B,OAA8B,IAAA;AAC9C,QAAM+B,cAAcpC,gBAAgBmC,SAASD,YAAAA;AAC7C,QAAM,EAAEG,QAAQ,EAAC,IAAK/B,kBAAkB;IAAEgC,WAAWH;EAAQ,CAAA;AAI7D,SACE,sBAAA,cAAC5B,WAAWgC,MAAI;IAAE,GAAG3B,gBAAgBqB,KAAAA;IAAQH;IAAoBC;IAAYC;IAAkBQ,KAAKJ;KAClG,sBAAA,cAACnB,wBAAAA;IAAuBoB;KAAejB,QAAAA,CAAAA;AAG7C,CAAA;AAGFS,oBAAoBD,cAAc;AAElC,IAAMa,iBAAiBZ;AAqBvB,IAAMa,uBAAuB/B,WAC3B,CAAC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UAAU3D,MAAM,CAAA;AACtB,SAAOJ,QAAQ,MAAA;AACb,QAAIkB,WAAW,MAAM;AACnB,aAAOA;IACT;AAEA,UAAM8C,mBAAmB3C,iBAAiB0C;AAC1C,UAAME,mBAAmB3C,iBAAiByC;AAC1C,UAAMG,WAAW3C,SAASwC;AAC1B,QAAI9B,SAAS,KAAK+B,oBAAoB,GAAG;AACvC,aAAO;IACT;AAIA,QAAIG,OAAOC,KAAKC,MAAMpC,SAAS+B,mBAAmBE,SAAO;AACzD,QAAID,mBAAmB,GAAG;AACxB,YAAMK,oBAAoBrC,QAAQkC,OAAOD;AACzC,UAAII,oBAAoBL,kBAAkB;AAExC,cAAMM,UAAUH,KAAKI,KAAKvC,SAASgC,mBAAmBC,SAAO;AAC7D,YAAIjC,QAAQsC,UAAUL,YAAYF,kBAAkB;AAClDG,iBAAOI;QACT;MACF;IACF;AAEA,UAAME,UAAUrD,cAAc,OAAOgD,KAAKM,IAAIP,MAAM/C,UAAAA,IAAc+C;AAClE,WAAOC,KAAKO,IAAI,GAAGF,OAAAA;EACrB,GAAG;IAACV;IAAS9B;IAAOf;IAASE;IAAYC;IAAgBC;IAAgBC;GAAO;AAClF;AAMO,IAAMqD,UAAU;EACrBzC,MAAMpB;EACN8D,SAASxC;EACTmB,UAAUM;AACZ;",
6
+ "names": ["useArrowNavigationGroup", "useComposedRefs", "createContext", "VirtuosoMasonry", "React", "useMemo", "useRef", "useResizeDetector", "ScrollArea", "usePx", "cardMaxInlineSize", "cardMinInlineSize", "composable", "composableProps", "scrollbar", "MASONRY_NAME", "MasonryProvider", "useMasonryContext", "MasonryContentProvider", "useMasonryContentContext", "MasonryRoot", "children", "Tile", "columns", "undefined", "maxColumns", "minColumnWidth", "maxColumnWidth", "gutter", "displayName", "MasonryContentInner", "centered", "thin", "padding", "props", "forwardedRef", "rootRef", "composedRef", "width", "targetRef", "Root", "ref", "MasonryContent", "MasonryViewportInner", "items", "getId", "columnCount", "useColumnCount", "size", "arrowNavigationAttrs", "axis", "memorizeCurrent", "tabbable", "TileAdapter", "Adapter", "data", "index", "div", "role", "style", "paddingBottom", "Viewport", "asChild", "ComposableVirtuosoMasonry", "gap", "ItemContent", "_forwardedRef", "MasonryViewport", "remInPx", "minColumnWidthPx", "maxColumnWidthPx", "gutterPx", "cols", "Math", "floor", "effectiveColWidth", "maxCols", "ceil", "clamped", "min", "max", "Masonry", "Content"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/Masonry.tsx":{"bytes":10952,"imports":[{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"masonic","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":454,"imports":[{"path":"src/Masonry.tsx","kind":"import-statement","original":"./Masonry"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6176},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"masonic","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Masonry"],"entryPoint":"src/index.ts","inputs":{"src/Masonry.tsx":{"bytesInOutput":2398},"src/index.ts":{"bytesInOutput":0}},"bytes":2567}}}
1
+ {"inputs":{"src/Masonry.tsx":{"bytes":23002,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@virtuoso.dev/masonry","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":375,"imports":[{"path":"src/Masonry.tsx","kind":"import-statement","original":"./Masonry"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12271},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@virtuoso.dev/masonry","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Masonry"],"entryPoint":"src/index.ts","inputs":{"src/Masonry.tsx":{"bytesInOutput":4434},"src/index.ts":{"bytesInOutput":0}},"bytes":4603}}}