@dxos/react-ui-masonry 0.8.4-main.422d1c7879 → 0.8.4-main.4668b7de9b

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/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2022 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
@@ -6,7 +6,8 @@ import { VirtuosoMasonry } from "@virtuoso.dev/masonry";
6
6
  import React, { useMemo, useRef } from "react";
7
7
  import { useResizeDetector } from "react-resize-detector";
8
8
  import { ScrollArea, usePx } from "@dxos/react-ui";
9
- import { cardMaxInlineSize, cardMinInlineSize, composable, composableProps, scrollbar } from "@dxos/ui-theme";
9
+ import { composable, composableProps, scrollbar } from "@dxos/react-ui";
10
+ import { cardMaxInlineSize, cardMinInlineSize } from "@dxos/ui-theme";
10
11
  var MASONRY_NAME = "Masonry";
11
12
  var [MasonryProvider, useMasonryContext] = createContext(MASONRY_NAME);
12
13
  var [MasonryContentProvider, useMasonryContentContext] = createContext("Masonry.Content");
@@ -36,10 +37,11 @@ var MasonryContentInner = composable(({ children, centered, thin = true, padding
36
37
  }, children));
37
38
  });
38
39
  MasonryContentInner.displayName = "Masonry.Content";
40
+ var MasonryContent = MasonryContentInner;
39
41
  var MasonryViewportInner = composable(({ items, getId, ...props }, forwardedRef) => {
40
42
  const { Tile, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter } = useMasonryContext("Masonry.Viewport");
41
43
  const { width } = useMasonryContentContext("Masonry.Viewport");
42
- const columnCount = useColumnCount(width - (scrollbar.thin.size + scrollbar.thin.padding), columns, maxColumns, minColumnWidth, maxColumnWidth, gutter);
44
+ const columnCount = useColumnCount(width - (scrollbar.md.size + scrollbar.md.padding), columns, maxColumns, minColumnWidth, maxColumnWidth, gutter);
43
45
  const arrowNavigationAttrs = useArrowNavigationGroup({
44
46
  axis: "both",
45
47
  memorizeCurrent: true,
@@ -82,7 +84,6 @@ var ComposableVirtuosoMasonry = composable(({ ...props }, _forwardedRef) => {
82
84
  return /* @__PURE__ */ React.createElement(VirtuosoMasonry, props);
83
85
  });
84
86
  MasonryViewportInner.displayName = "Masonry.Viewport";
85
- var MasonryContent = MasonryContentInner;
86
87
  var MasonryViewport = MasonryViewportInner;
87
88
  var useColumnCount = (width, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter) => {
88
89
  const remInPx = usePx(1);
@@ -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 { 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\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 MasonryContent = MasonryContentInner as (\n props: MasonryContentProps & {\n ref?: Ref<HTMLDivElement | null>;\n },\n) => JSX.Element;\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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,mBAAmBxD,iBAAiBsD;AAC1C,UAAMG,mBAAmBvD,iBAAiBoD;AAC1C,UAAMI,WAAWtD,SAASkD;AAC1B,QAAIrC,SAAS,KAAKuC,oBAAoB,GAAG;AACvC,aAAO;IACT;AAIA,QAAIG,OAAOC,KAAKC,MAAM5C,SAASuC,mBAAmBE,SAAO;AACzD,QAAID,mBAAmB,GAAG;AACxB,YAAMK,oBAAoB7C,QAAQ0C,OAAOD;AACzC,UAAII,oBAAoBL,kBAAkB;AAExC,cAAMM,UAAUH,KAAKI,KAAK/C,SAASwC,mBAAmBC,SAAO;AAC7D,YAAIzC,QAAQ8C,UAAUL,YAAYF,kBAAkB;AAClDG,iBAAOI;QACT;MACF;IACF;AAEA,UAAME,UAAUlE,cAAc,OAAO6D,KAAKM,IAAIP,MAAM5D,UAAAA,IAAc4D;AAClE,WAAOC,KAAKO,IAAI,GAAGF,OAAAA;EACrB,GAAG;IAACX;IAASrC;IAAOpB;IAASE;IAAYC;IAAgBE;IAAgBE;GAAO;AAClF;AAMO,IAAMgE,UAAU;EACrB/C,MAAM3B;EACN2E,SAASjB;EACTP,UAAUQ;AACZ;",
6
- "names": ["useArrowNavigationGroup", "useComposedRefs", "createContext", "VirtuosoMasonry", "React", "useMemo", "useRef", "useResizeDetector", "ScrollArea", "usePx", "cardMaxInlineSize", "cardMinInlineSize", "composable", "composableProps", "scrollbar", "MASONRY_NAME", "MasonryProvider", "useMasonryContext", "createContext", "MasonryContentProvider", "useMasonryContentContext", "MasonryRoot", "children", "Tile", "columns", "undefined", "maxColumns", "minColumnWidth", "cardMinInlineSize", "maxColumnWidth", "cardMaxInlineSize", "gutter", "displayName", "MasonryContentInner", "composable", "centered", "thin", "padding", "props", "forwardedRef", "rootRef", "useRef", "composedRef", "useComposedRefs", "width", "useResizeDetector", "targetRef", "ScrollArea", "Root", "composableProps", "ref", "MasonryViewportInner", "items", "getId", "columnCount", "useColumnCount", "scrollbar", "size", "arrowNavigationAttrs", "useArrowNavigationGroup", "axis", "memorizeCurrent", "tabbable", "TileAdapter", "useMemo", "Adapter", "data", "index", "div", "role", "style", "paddingBottom", "Viewport", "asChild", "ComposableVirtuosoMasonry", "gap", "ItemContent", "_forwardedRef", "VirtuosoMasonry", "MasonryContent", "MasonryViewport", "remInPx", "usePx", "minColumnWidthPx", "maxColumnWidthPx", "gutterPx", "cols", "Math", "floor", "effectiveColWidth", "maxCols", "ceil", "clamped", "min", "max", "Masonry", "Content"]
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 { composable, composableProps, scrollbar } from '@dxos/react-ui';\nimport { cardMaxInlineSize, cardMinInlineSize } 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.md.size + scrollbar.md.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,YAAYC,iBAAiBC,iBAAiB;AACvD,SAASC,mBAAmBC,yBAAyB;AAqBrD,IAAMC,eAAe;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AG;AACxB,YAAMK,oBAAoBtC,QAAQmC,OAAOD;AACzC,UAAII,oBAAoBL,kBAAkB;AAExC,cAAMM,UAAUH,KAAKI,KAAKxC,SAASiC,mBAAmBC,SAAO;AAC7D,YAAIlC,QAAQuC,UAAUL,YAAYF,kBAAkB;AAClDG,iBAAOI;QACT;MACF;IACF;AAEA,UAAME,UAAUtD,cAAc,OAAOiD,KAAKM,IAAIP,MAAMhD,UAAAA,IAAcgD;AAClE,WAAOC,KAAKO,IAAI,GAAGF,OAAAA;EACrB,GAAG;IAACV;IAAS/B;IAAOf;IAASE;IAAYC;IAAgBC;IAAgBC;GAAO;AAClF;AAMO,IAAMsD,UAAU;EACrB1C,MAAMpB;EACN+D,SAASzC;EACToB,UAAUM;AACZ;",
6
+ "names": ["useArrowNavigationGroup", "useComposedRefs", "createContext", "VirtuosoMasonry", "React", "useMemo", "useRef", "useResizeDetector", "ScrollArea", "usePx", "composable", "composableProps", "scrollbar", "cardMaxInlineSize", "cardMinInlineSize", "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", "md", "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":23084,"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":454,"imports":[{"path":"src/Masonry.tsx","kind":"import-statement","original":"./Masonry"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12484},"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
+ {"inputs":{"src/Masonry.tsx":{"bytes":23095,"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/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":12312},"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/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":4463},"src/index.ts":{"bytesInOutput":0}},"bytes":4539}}}
@@ -8,7 +8,8 @@ import { VirtuosoMasonry } from "@virtuoso.dev/masonry";
8
8
  import React, { useMemo, useRef } from "react";
9
9
  import { useResizeDetector } from "react-resize-detector";
10
10
  import { ScrollArea, usePx } from "@dxos/react-ui";
11
- import { cardMaxInlineSize, cardMinInlineSize, composable, composableProps, scrollbar } from "@dxos/ui-theme";
11
+ import { composable, composableProps, scrollbar } from "@dxos/react-ui";
12
+ import { cardMaxInlineSize, cardMinInlineSize } from "@dxos/ui-theme";
12
13
  var MASONRY_NAME = "Masonry";
13
14
  var [MasonryProvider, useMasonryContext] = createContext(MASONRY_NAME);
14
15
  var [MasonryContentProvider, useMasonryContentContext] = createContext("Masonry.Content");
@@ -38,10 +39,11 @@ var MasonryContentInner = composable(({ children, centered, thin = true, padding
38
39
  }, children));
39
40
  });
40
41
  MasonryContentInner.displayName = "Masonry.Content";
42
+ var MasonryContent = MasonryContentInner;
41
43
  var MasonryViewportInner = composable(({ items, getId, ...props }, forwardedRef) => {
42
44
  const { Tile, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter } = useMasonryContext("Masonry.Viewport");
43
45
  const { width } = useMasonryContentContext("Masonry.Viewport");
44
- const columnCount = useColumnCount(width - (scrollbar.thin.size + scrollbar.thin.padding), columns, maxColumns, minColumnWidth, maxColumnWidth, gutter);
46
+ const columnCount = useColumnCount(width - (scrollbar.md.size + scrollbar.md.padding), columns, maxColumns, minColumnWidth, maxColumnWidth, gutter);
45
47
  const arrowNavigationAttrs = useArrowNavigationGroup({
46
48
  axis: "both",
47
49
  memorizeCurrent: true,
@@ -84,7 +86,6 @@ var ComposableVirtuosoMasonry = composable(({ ...props }, _forwardedRef) => {
84
86
  return /* @__PURE__ */ React.createElement(VirtuosoMasonry, props);
85
87
  });
86
88
  MasonryViewportInner.displayName = "Masonry.Viewport";
87
- var MasonryContent = MasonryContentInner;
88
89
  var MasonryViewport = MasonryViewportInner;
89
90
  var useColumnCount = (width, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter) => {
90
91
  const remInPx = usePx(1);
@@ -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 { 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\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 MasonryContent = MasonryContentInner as (\n props: MasonryContentProps & {\n ref?: Ref<HTMLDivElement | null>;\n },\n) => JSX.Element;\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: M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AACb,QAAIxC,WAAW,MAAM;AACnB,aAAOA;IACT;AAEA,UAAM2D,mBAAmBxD,iBAAiBsD;AAC1C,UAAMG,mBAAmBvD,iBAAiBoD;AAC1C,UAAMI,WAAWtD,SAASkD;AAC1B,QAAIrC,SAAS,KAAKuC,oBAAoB,GAAG;AACvC,aAAO;IACT;AAIA,QAAIG,OAAOC,KAAKC,MAAM5C,SAASuC,mBAAmBE,SAAO;AACzD,QAAID,mBAAmB,GAAG;AACxB,YAAMK,oBAAoB7C,QAAQ0C,OAAOD;AACzC,UAAII,oBAAoBL,kBAAkB;AAExC,cAAMM,UAAUH,KAAKI,KAAK/C,SAASwC,mBAAmBC,SAAO;AAC7D,YAAIzC,QAAQ8C,UAAUL,YAAYF,kBAAkB;AAClDG,iBAAOI;QACT;MACF;IACF;AAEA,UAAME,UAAUlE,cAAc,OAAO6D,KAAKM,IAAIP,MAAM5D,UAAAA,IAAc4D;AAClE,WAAOC,KAAKO,IAAI,GAAGF,OAAAA;EACrB,GAAG;IAACX;IAASrC;IAAOpB;IAASE;IAAYC;IAAgBE;IAAgBE;GAAO;AAClF;AAMO,IAAMgE,UAAU;EACrB/C,MAAM3B;EACN2E,SAASjB;EACTP,UAAUQ;AACZ;",
6
- "names": ["useArrowNavigationGroup", "useComposedRefs", "createContext", "VirtuosoMasonry", "React", "useMemo", "useRef", "useResizeDetector", "ScrollArea", "usePx", "cardMaxInlineSize", "cardMinInlineSize", "composable", "composableProps", "scrollbar", "MASONRY_NAME", "MasonryProvider", "useMasonryContext", "createContext", "MasonryContentProvider", "useMasonryContentContext", "MasonryRoot", "children", "Tile", "columns", "undefined", "maxColumns", "minColumnWidth", "cardMinInlineSize", "maxColumnWidth", "cardMaxInlineSize", "gutter", "displayName", "MasonryContentInner", "composable", "centered", "thin", "padding", "props", "forwardedRef", "rootRef", "useRef", "composedRef", "useComposedRefs", "width", "useResizeDetector", "targetRef", "ScrollArea", "Root", "composableProps", "ref", "MasonryViewportInner", "items", "getId", "columnCount", "useColumnCount", "scrollbar", "size", "arrowNavigationAttrs", "useArrowNavigationGroup", "axis", "memorizeCurrent", "tabbable", "TileAdapter", "useMemo", "Adapter", "data", "index", "div", "role", "style", "paddingBottom", "Viewport", "asChild", "ComposableVirtuosoMasonry", "gap", "ItemContent", "_forwardedRef", "VirtuosoMasonry", "MasonryContent", "MasonryViewport", "remInPx", "usePx", "minColumnWidthPx", "maxColumnWidthPx", "gutterPx", "cols", "Math", "floor", "effectiveColWidth", "maxCols", "ceil", "clamped", "min", "max", "Masonry", "Content"]
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 { composable, composableProps, scrollbar } from '@dxos/react-ui';\nimport { cardMaxInlineSize, cardMinInlineSize } 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.md.size + scrollbar.md.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,YAAYC,iBAAiBC,i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AKC,MAAMrC,SAASgC,mBAAmBE,SAAO;AACzD,QAAID,mBAAmB,GAAG;AACxB,YAAMK,oBAAoBtC,QAAQmC,OAAOD;AACzC,UAAII,oBAAoBL,kBAAkB;AAExC,cAAMM,UAAUH,KAAKI,KAAKxC,SAASiC,mBAAmBC,SAAO;AAC7D,YAAIlC,QAAQuC,UAAUL,YAAYF,kBAAkB;AAClDG,iBAAOI;QACT;MACF;IACF;AAEA,UAAME,UAAUtD,cAAc,OAAOiD,KAAKM,IAAIP,MAAMhD,UAAAA,IAAcgD;AAClE,WAAOC,KAAKO,IAAI,GAAGF,OAAAA;EACrB,GAAG;IAACV;IAAS/B;IAAOf;IAASE;IAAYC;IAAgBC;IAAgBC;GAAO;AAClF;AAMO,IAAMsD,UAAU;EACrB1C,MAAMpB;EACN+D,SAASzC;EACToB,UAAUM;AACZ;",
6
+ "names": ["useArrowNavigationGroup", "useComposedRefs", "createContext", "VirtuosoMasonry", "React", "useMemo", "useRef", "useResizeDetector", "ScrollArea", "usePx", "composable", "composableProps", "scrollbar", "cardMaxInlineSize", "cardMinInlineSize", "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", "md", "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":23084,"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":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":12486},"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}}}
1
+ {"inputs":{"src/Masonry.tsx":{"bytes":23095,"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/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":12314},"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/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":4463},"src/index.ts":{"bytesInOutput":0}},"bytes":4632}}}
@@ -18,6 +18,10 @@ type MasonryContextValue = {
18
18
  gutter: number;
19
19
  };
20
20
  type MasonryRootProps = PropsWithChildren<Partial<MasonryContextValue>>;
21
+ declare function MasonryRoot({ children, Tile, columns, maxColumns, minColumnWidth, maxColumnWidth, gutter }: MasonryRootProps): JSX.Element;
22
+ declare namespace MasonryRoot {
23
+ var displayName: string;
24
+ }
21
25
  type MasonryContentProps = ThemedClassName<PropsWithChildren<Pick<ScrollAreaRootProps, 'centered' | 'thin' | 'padding'>>>;
22
26
  type MasonryViewportProps<Item> = ThemedClassName<{
23
27
  /** Items to render in the masonry grid. */
@@ -1 +1 @@
1
- {"version":3,"file":"Masonry.d.ts","sourceRoot":"","sources":["../../../src/Masonry.tsx"],"names":[],"mappings":"AAQA,OAAc,EAAE,KAAK,aAAa,EAAE,KAAK,GAAG,EAAE,KAAK,iBAAiB,EAAE,KAAK,GAAG,EAAmB,MAAM,OAAO,CAAC;AAG/G,OAAO,EAAc,mBAAmB,EAAE,eAAe,EAAS,MAAM,gBAA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MAAM,OAAO;IAClB,IAAI;2FAvLH,gBAAgB;;;IAwLjB,OAAO,UA1IA,mBAAmB,GAAG;QAC3B,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;KAClC,KACE,GAAG,CAAC,OAAO;IAwId,QAAQ,GAtDuC,IAAI,SAC5C,oBAAoB,CAAC,IAAI,CAAC,GAAG;QAClC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;KAClC,KACE,GAAG,CAAC,OAAO;CAmDf,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Masonry.stories.d.ts","sourceRoot":"","sources":["../../../src/Masonry.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAW,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAgCtD,QAAA,MAAM,IAAI;;oBAbmB,gBAAgB;;;;;CAgC7B,CAAC;AAEjB,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
1
+ {"version":3,"file":"Masonry.stories.d.ts","sourceRoot":"","sources":["../../../src/Masonry.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAW,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAgCtD,QAAA,MAAM,IAAI;;oBAbmB,gBAAgB;;;QA8BzC,MAAM;;CAEM,CAAC;eAEF,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}