@radix-ui/react-collection 1.0.3 → 1.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,22 +1,35 @@
1
- import React from "react";
2
- import { Slot } from "@radix-ui/react-slot";
3
- import * as Radix from "@radix-ui/react-primitive";
4
- type SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;
5
- export interface CollectionProps extends SlotProps {
1
+ import * as React from 'react';
2
+ import React__default from 'react';
3
+ import { Slot } from '@radix-ui/react-slot';
4
+ import * as Radix from '@radix-ui/react-primitive';
5
+
6
+ declare type Scope<C = any> = {
7
+ [scopeName: string]: React.Context<C>[];
8
+ } | undefined;
9
+ declare type ScopeHook = (scope: Scope) => {
10
+ [__scopeProp: string]: Scope;
11
+ };
12
+ interface CreateScope {
13
+ scopeName: string;
14
+ (): ScopeHook;
15
+ }
16
+
17
+ declare type SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;
18
+ interface CollectionProps extends SlotProps {
6
19
  scope: any;
7
20
  }
8
- export function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
9
- readonly Provider: React.FC<{
10
- children?: React.ReactNode;
21
+ declare function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
22
+ readonly Provider: React__default.FC<{
23
+ children?: React__default.ReactNode;
11
24
  scope: any;
12
25
  }>;
13
- readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
14
- readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
15
- children: React.ReactNode;
26
+ readonly Slot: React__default.ForwardRefExoticComponent<CollectionProps & React__default.RefAttributes<HTMLElement>>;
27
+ readonly ItemSlot: React__default.ForwardRefExoticComponent<React__default.PropsWithoutRef<ItemData & {
28
+ children: React__default.ReactNode;
16
29
  scope: any;
17
- }> & React.RefAttributes<ItemElement>>;
30
+ }> & React__default.RefAttributes<ItemElement>>;
18
31
  }, (scope: any) => () => ({
19
- ref: React.RefObject<ItemElement>;
20
- } & ItemData)[], import("@radix-ui/react-context").CreateScope];
32
+ ref: React__default.RefObject<ItemElement>;
33
+ } & ItemData)[], CreateScope];
21
34
 
22
- //# sourceMappingURL=index.d.ts.map
35
+ export { type CollectionProps, createCollection };
package/dist/index.d.ts CHANGED
@@ -1,22 +1,35 @@
1
- import React from "react";
2
- import { Slot } from "@radix-ui/react-slot";
3
- import * as Radix from "@radix-ui/react-primitive";
4
- type SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;
5
- export interface CollectionProps extends SlotProps {
1
+ import * as React from 'react';
2
+ import React__default from 'react';
3
+ import { Slot } from '@radix-ui/react-slot';
4
+ import * as Radix from '@radix-ui/react-primitive';
5
+
6
+ declare type Scope<C = any> = {
7
+ [scopeName: string]: React.Context<C>[];
8
+ } | undefined;
9
+ declare type ScopeHook = (scope: Scope) => {
10
+ [__scopeProp: string]: Scope;
11
+ };
12
+ interface CreateScope {
13
+ scopeName: string;
14
+ (): ScopeHook;
15
+ }
16
+
17
+ declare type SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;
18
+ interface CollectionProps extends SlotProps {
6
19
  scope: any;
7
20
  }
8
- export function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
9
- readonly Provider: React.FC<{
10
- children?: React.ReactNode;
21
+ declare function createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string): readonly [{
22
+ readonly Provider: React__default.FC<{
23
+ children?: React__default.ReactNode;
11
24
  scope: any;
12
25
  }>;
13
- readonly Slot: React.ForwardRefExoticComponent<CollectionProps & React.RefAttributes<HTMLElement>>;
14
- readonly ItemSlot: React.ForwardRefExoticComponent<React.PropsWithoutRef<ItemData & {
15
- children: React.ReactNode;
26
+ readonly Slot: React__default.ForwardRefExoticComponent<CollectionProps & React__default.RefAttributes<HTMLElement>>;
27
+ readonly ItemSlot: React__default.ForwardRefExoticComponent<React__default.PropsWithoutRef<ItemData & {
28
+ children: React__default.ReactNode;
16
29
  scope: any;
17
- }> & React.RefAttributes<ItemElement>>;
30
+ }> & React__default.RefAttributes<ItemElement>>;
18
31
  }, (scope: any) => () => ({
19
- ref: React.RefObject<ItemElement>;
20
- } & ItemData)[], import("@radix-ui/react-context").CreateScope];
32
+ ref: React__default.RefObject<ItemElement>;
33
+ } & ItemData)[], CreateScope];
21
34
 
22
- //# sourceMappingURL=index.d.ts.map
35
+ export { type CollectionProps, createCollection };
package/dist/index.js CHANGED
@@ -1,117 +1,99 @@
1
- var $hnlpS$react = require("react");
2
- var $hnlpS$radixuireactcontext = require("@radix-ui/react-context");
3
- var $hnlpS$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
4
- var $hnlpS$radixuireactslot = require("@radix-ui/react-slot");
5
-
6
- function $parcel$export(e, n, v, s) {
7
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
- }
9
- function $parcel$interopDefault(a) {
10
- return a && a.__esModule ? a.default : a;
11
- }
12
-
13
- $parcel$export(module.exports, "createCollection", () => $1a96635ec239608b$export$c74125a8e3af6bb2);
14
-
15
-
16
-
1
+ "use strict";
2
+ (() => {
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
+ }) : x)(function(x) {
12
+ if (typeof require !== "undefined") return require.apply(this, arguments);
13
+ throw Error('Dynamic require of "' + x + '" is not supported');
14
+ });
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
17
31
 
18
- // We have resorted to returning slots directly rather than exposing primitives that can then
19
- // be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
20
- // This is because we encountered issues with generic types that cannot be statically analysed
21
- // due to creating them dynamically via createCollection.
22
- function $1a96635ec239608b$export$c74125a8e3af6bb2(name) {
23
- /* -----------------------------------------------------------------------------------------------
24
- * CollectionProvider
25
- * ---------------------------------------------------------------------------------------------*/ const PROVIDER_NAME = name + 'CollectionProvider';
26
- const [createCollectionContext, createCollectionScope] = $hnlpS$radixuireactcontext.createContextScope(PROVIDER_NAME);
27
- const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
28
- collectionRef: {
29
- current: null
30
- },
31
- itemMap: new Map()
32
- });
33
- const CollectionProvider = (props)=>{
34
- const { scope: scope , children: children } = props;
35
- const ref = ($parcel$interopDefault($hnlpS$react)).useRef(null);
36
- const itemMap = ($parcel$interopDefault($hnlpS$react)).useRef(new Map()).current;
37
- return /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).createElement(CollectionProviderImpl, {
38
- scope: scope,
39
- itemMap: itemMap,
40
- collectionRef: ref
41
- }, children);
32
+ // packages/react/collection/src/Collection.tsx
33
+ var import_react = __toESM(__require("react"));
34
+ var import_react_context = __require("@radix-ui/react-context");
35
+ var import_react_compose_refs = __require("@radix-ui/react-compose-refs");
36
+ var import_react_slot = __require("@radix-ui/react-slot");
37
+ var import_jsx_runtime = __require("react/jsx-runtime");
38
+ function createCollection(name) {
39
+ const PROVIDER_NAME = name + "CollectionProvider";
40
+ const [createCollectionContext, createCollectionScope] = (0, import_react_context.createContextScope)(PROVIDER_NAME);
41
+ const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
42
+ PROVIDER_NAME,
43
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
44
+ );
45
+ const CollectionProvider = (props) => {
46
+ const { scope, children } = props;
47
+ const ref = import_react.default.useRef(null);
48
+ const itemMap = import_react.default.useRef(/* @__PURE__ */ new Map()).current;
49
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
42
50
  };
43
- /*#__PURE__*/ Object.assign(CollectionProvider, {
44
- displayName: PROVIDER_NAME
45
- });
46
- /* -----------------------------------------------------------------------------------------------
47
- * CollectionSlot
48
- * ---------------------------------------------------------------------------------------------*/ const COLLECTION_SLOT_NAME = name + 'CollectionSlot';
49
- const CollectionSlot = /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).forwardRef((props, forwardedRef)=>{
50
- const { scope: scope , children: children } = props;
51
+ CollectionProvider.displayName = PROVIDER_NAME;
52
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
53
+ const CollectionSlot = import_react.default.forwardRef(
54
+ (props, forwardedRef) => {
55
+ const { scope, children } = props;
51
56
  const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
52
- const composedRefs = $hnlpS$radixuireactcomposerefs.useComposedRefs(forwardedRef, context.collectionRef);
53
- return /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).createElement($hnlpS$radixuireactslot.Slot, {
54
- ref: composedRefs
55
- }, children);
56
- });
57
- /*#__PURE__*/ Object.assign(CollectionSlot, {
58
- displayName: COLLECTION_SLOT_NAME
59
- });
60
- /* -----------------------------------------------------------------------------------------------
61
- * CollectionItem
62
- * ---------------------------------------------------------------------------------------------*/ const ITEM_SLOT_NAME = name + 'CollectionItemSlot';
63
- const ITEM_DATA_ATTR = 'data-radix-collection-item';
64
- const CollectionItemSlot = /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).forwardRef((props, forwardedRef)=>{
65
- const { scope: scope , children: children , ...itemData } = props;
66
- const ref = ($parcel$interopDefault($hnlpS$react)).useRef(null);
67
- const composedRefs = $hnlpS$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
57
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, context.collectionRef);
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slot, { ref: composedRefs, children });
59
+ }
60
+ );
61
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
62
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
63
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
64
+ const CollectionItemSlot = import_react.default.forwardRef(
65
+ (props, forwardedRef) => {
66
+ const { scope, children, ...itemData } = props;
67
+ const ref = import_react.default.useRef(null);
68
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
68
69
  const context = useCollectionContext(ITEM_SLOT_NAME, scope);
69
- ($parcel$interopDefault($hnlpS$react)).useEffect(()=>{
70
- context.itemMap.set(ref, {
71
- ref: ref,
72
- ...itemData
73
- });
74
- return ()=>void context.itemMap.delete(ref)
75
- ;
70
+ import_react.default.useEffect(() => {
71
+ context.itemMap.set(ref, { ref, ...itemData });
72
+ return () => void context.itemMap.delete(ref);
76
73
  });
77
- return /*#__PURE__*/ ($parcel$interopDefault($hnlpS$react)).createElement($hnlpS$radixuireactslot.Slot, {
78
- [ITEM_DATA_ATTR]: '',
79
- ref: composedRefs
80
- }, children);
81
- });
82
- /*#__PURE__*/ Object.assign(CollectionItemSlot, {
83
- displayName: ITEM_SLOT_NAME
84
- });
85
- /* -----------------------------------------------------------------------------------------------
86
- * useCollection
87
- * ---------------------------------------------------------------------------------------------*/ function useCollection(scope) {
88
- const context = useCollectionContext(name + 'CollectionConsumer', scope);
89
- const getItems = ($parcel$interopDefault($hnlpS$react)).useCallback(()=>{
90
- const collectionNode = context.collectionRef.current;
91
- if (!collectionNode) return [];
92
- const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
93
- const items = Array.from(context.itemMap.values());
94
- const orderedItems = items.sort((a, b)=>orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
95
- );
96
- return orderedItems;
97
- }, [
98
- context.collectionRef,
99
- context.itemMap
100
- ]);
101
- return getItems;
74
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
75
+ }
76
+ );
77
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
78
+ function useCollection(scope) {
79
+ const context = useCollectionContext(name + "CollectionConsumer", scope);
80
+ const getItems = import_react.default.useCallback(() => {
81
+ const collectionNode = context.collectionRef.current;
82
+ if (!collectionNode) return [];
83
+ const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
84
+ const items = Array.from(context.itemMap.values());
85
+ const orderedItems = items.sort(
86
+ (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
87
+ );
88
+ return orderedItems;
89
+ }, [context.collectionRef, context.itemMap]);
90
+ return getItems;
102
91
  }
103
92
  return [
104
- {
105
- Provider: CollectionProvider,
106
- Slot: CollectionSlot,
107
- ItemSlot: CollectionItemSlot
108
- },
109
- useCollection,
110
- createCollectionScope
93
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
94
+ useCollection,
95
+ createCollectionScope
111
96
  ];
112
- }
113
-
114
-
115
-
116
-
97
+ }
98
+ })();
117
99
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -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YAGA,OAAOgC,YAAP,CAAA;SARe,EASd;YAACnB,OAAO,CAACd,aAAT;YAAwBc,OAAO,CAACZ,OAAhC;SATc,CAAjB,AASC;QAED,OAAOsB,QAAP,CAAA;KACD;IAED,OAAO;QACL;YAAEc,QAAQ,EAAElC,kBAAZ;YAAgCX,IAAI,EAAEkB,cAAtC;YAAsD4B,QAAQ,EAAErB,kBAAVqB;SADjD;QAELhB,aAFK;QAGL1B,qBAHK;KAAP,CACE;CAIH;;AD9HD","sources":["packages/react/collection/src/index.ts","packages/react/collection/src/Collection.tsx"],"sourcesContent":["export { createCollection } from './Collection';\nexport type { CollectionProps } from './Collection';\n","import React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement>;\n itemMap: Map<React.RefObject<ItemElement>, { ref: React.RefObject<ItemElement> } & ItemData>;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() }\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <Slot ref={composedRefs}>{children}</Slot>;\n }\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n <Slot {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </Slot>\n );\n }\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n"],"names":["createCollection","React","createContextScope","useComposedRefs","Slot","name","PROVIDER_NAME","createCollectionContext","createCollectionScope","CollectionProviderImpl","useCollectionContext","collectionRef","current","itemMap","Map","CollectionProvider","props","scope","children","ref","useRef","COLLECTION_SLOT_NAME","CollectionSlot","forwardRef","forwardedRef","context","composedRefs","ITEM_SLOT_NAME","ITEM_DATA_ATTR","CollectionItemSlot","itemData","useEffect","set","delete","useCollection","getItems","useCallback","collectionNode","orderedNodes","Array","from","querySelectorAll","items","values","orderedItems","sort","a","b","indexOf","Provider","ItemSlot"],"version":3,"file":"index.js.map"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Collection.tsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>\u2026</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement>;\n itemMap: Map<React.RefObject<ItemElement>, { ref: React.RefObject<ItemElement> } & ItemData>;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() }\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <Slot ref={composedRefs}>{children}</Slot>;\n }\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n <Slot {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </Slot>\n );\n }\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAkB;AAClB,6BAAmC;AACnC,kCAAgC;AAChC,0BAAqB;AAsCf;AAvBN,WAAS,iBAAiE,MAAc;AAKtF,UAAM,gBAAgB,OAAO;AAC7B,UAAM,CAAC,yBAAyB,qBAAqB,QAAI,yCAAmB,aAAa;AAOzF,UAAM,CAAC,wBAAwB,oBAAoB,IAAI;AAAA,MACrD;AAAA,MACA,EAAE,eAAe,EAAE,SAAS,KAAK,GAAG,SAAS,oBAAI,IAAI,EAAE;AAAA,IACzD;AAEA,UAAM,qBAA2E,CAAC,UAAU;AAC1F,YAAM,EAAE,OAAO,SAAS,IAAI;AA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,QAAQ,cAAc;AAC7C,YAAI,CAAC,eAAgB,QAAO,CAAC;AAC7B,cAAM,eAAe,MAAM,KAAK,eAAe,iBAAiB,IAAI,cAAc,GAAG,CAAC;AACtF,cAAM,QAAQ,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AACjD,cAAM,eAAe,MAAM;AAAA,UACzB,CAAC,GAAG,MAAM,aAAa,QAAQ,EAAE,IAAI,OAAQ,IAAI,aAAa,QAAQ,EAAE,IAAI,OAAQ;AAAA,QACtF;AACA,eAAO;AAAA,MACT,GAAG,CAAC,QAAQ,eAAe,QAAQ,OAAO,CAAC;AAE3C,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,MACL,EAAE,UAAU,oBAAoB,MAAM,gBAAgB,UAAU,mBAAmB;AAAA,MACnF;AAAA,MACA;AAAA,IACF;AAAA,EACF;",
6
+ "names": ["React"]
7
+ }
package/dist/index.mjs CHANGED
@@ -1,110 +1,70 @@
1
- import $6vYhU$react from "react";
2
- import {createContextScope as $6vYhU$createContextScope} from "@radix-ui/react-context";
3
- import {useComposedRefs as $6vYhU$useComposedRefs} from "@radix-ui/react-compose-refs";
4
- import {Slot as $6vYhU$Slot} from "@radix-ui/react-slot";
5
-
6
-
7
-
8
-
9
-
10
- // We have resorted to returning slots directly rather than exposing primitives that can then
11
- // be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
12
- // This is because we encountered issues with generic types that cannot be statically analysed
13
- // due to creating them dynamically via createCollection.
14
- function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
15
- /* -----------------------------------------------------------------------------------------------
16
- * CollectionProvider
17
- * ---------------------------------------------------------------------------------------------*/ const PROVIDER_NAME = name + 'CollectionProvider';
18
- const [createCollectionContext, createCollectionScope] = $6vYhU$createContextScope(PROVIDER_NAME);
19
- const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
20
- collectionRef: {
21
- current: null
22
- },
23
- itemMap: new Map()
24
- });
25
- const CollectionProvider = (props)=>{
26
- const { scope: scope , children: children } = props;
27
- const ref = $6vYhU$react.useRef(null);
28
- const itemMap = $6vYhU$react.useRef(new Map()).current;
29
- return /*#__PURE__*/ $6vYhU$react.createElement(CollectionProviderImpl, {
30
- scope: scope,
31
- itemMap: itemMap,
32
- collectionRef: ref
33
- }, children);
34
- };
35
- /*#__PURE__*/ Object.assign(CollectionProvider, {
36
- displayName: PROVIDER_NAME
37
- });
38
- /* -----------------------------------------------------------------------------------------------
39
- * CollectionSlot
40
- * ---------------------------------------------------------------------------------------------*/ const COLLECTION_SLOT_NAME = name + 'CollectionSlot';
41
- const CollectionSlot = /*#__PURE__*/ $6vYhU$react.forwardRef((props, forwardedRef)=>{
42
- const { scope: scope , children: children } = props;
43
- const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
44
- const composedRefs = $6vYhU$useComposedRefs(forwardedRef, context.collectionRef);
45
- return /*#__PURE__*/ $6vYhU$react.createElement($6vYhU$Slot, {
46
- ref: composedRefs
47
- }, children);
48
- });
49
- /*#__PURE__*/ Object.assign(CollectionSlot, {
50
- displayName: COLLECTION_SLOT_NAME
51
- });
52
- /* -----------------------------------------------------------------------------------------------
53
- * CollectionItem
54
- * ---------------------------------------------------------------------------------------------*/ const ITEM_SLOT_NAME = name + 'CollectionItemSlot';
55
- const ITEM_DATA_ATTR = 'data-radix-collection-item';
56
- const CollectionItemSlot = /*#__PURE__*/ $6vYhU$react.forwardRef((props, forwardedRef)=>{
57
- const { scope: scope , children: children , ...itemData } = props;
58
- const ref = $6vYhU$react.useRef(null);
59
- const composedRefs = $6vYhU$useComposedRefs(forwardedRef, ref);
60
- const context = useCollectionContext(ITEM_SLOT_NAME, scope);
61
- $6vYhU$react.useEffect(()=>{
62
- context.itemMap.set(ref, {
63
- ref: ref,
64
- ...itemData
65
- });
66
- return ()=>void context.itemMap.delete(ref)
67
- ;
68
- });
69
- return /*#__PURE__*/ $6vYhU$react.createElement($6vYhU$Slot, {
70
- [ITEM_DATA_ATTR]: '',
71
- ref: composedRefs
72
- }, children);
73
- });
74
- /*#__PURE__*/ Object.assign(CollectionItemSlot, {
75
- displayName: ITEM_SLOT_NAME
76
- });
77
- /* -----------------------------------------------------------------------------------------------
78
- * useCollection
79
- * ---------------------------------------------------------------------------------------------*/ function useCollection(scope) {
80
- const context = useCollectionContext(name + 'CollectionConsumer', scope);
81
- const getItems = $6vYhU$react.useCallback(()=>{
82
- const collectionNode = context.collectionRef.current;
83
- if (!collectionNode) return [];
84
- const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
85
- const items = Array.from(context.itemMap.values());
86
- const orderedItems = items.sort((a, b)=>orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
87
- );
88
- return orderedItems;
89
- }, [
90
- context.collectionRef,
91
- context.itemMap
92
- ]);
93
- return getItems;
1
+ // packages/react/collection/src/Collection.tsx
2
+ import React from "react";
3
+ import { createContextScope } from "@radix-ui/react-context";
4
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
5
+ import { Slot } from "@radix-ui/react-slot";
6
+ import { jsx } from "react/jsx-runtime";
7
+ function createCollection(name) {
8
+ const PROVIDER_NAME = name + "CollectionProvider";
9
+ const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
10
+ const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
11
+ PROVIDER_NAME,
12
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
13
+ );
14
+ const CollectionProvider = (props) => {
15
+ const { scope, children } = props;
16
+ const ref = React.useRef(null);
17
+ const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
18
+ return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
19
+ };
20
+ CollectionProvider.displayName = PROVIDER_NAME;
21
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
22
+ const CollectionSlot = React.forwardRef(
23
+ (props, forwardedRef) => {
24
+ const { scope, children } = props;
25
+ const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
26
+ const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
27
+ return /* @__PURE__ */ jsx(Slot, { ref: composedRefs, children });
94
28
  }
95
- return [
96
- {
97
- Provider: CollectionProvider,
98
- Slot: CollectionSlot,
99
- ItemSlot: CollectionItemSlot
100
- },
101
- useCollection,
102
- createCollectionScope
103
- ];
29
+ );
30
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
31
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
32
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
33
+ const CollectionItemSlot = React.forwardRef(
34
+ (props, forwardedRef) => {
35
+ const { scope, children, ...itemData } = props;
36
+ const ref = React.useRef(null);
37
+ const composedRefs = useComposedRefs(forwardedRef, ref);
38
+ const context = useCollectionContext(ITEM_SLOT_NAME, scope);
39
+ React.useEffect(() => {
40
+ context.itemMap.set(ref, { ref, ...itemData });
41
+ return () => void context.itemMap.delete(ref);
42
+ });
43
+ return /* @__PURE__ */ jsx(Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
44
+ }
45
+ );
46
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
47
+ function useCollection(scope) {
48
+ const context = useCollectionContext(name + "CollectionConsumer", scope);
49
+ const getItems = React.useCallback(() => {
50
+ const collectionNode = context.collectionRef.current;
51
+ if (!collectionNode) return [];
52
+ const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
53
+ const items = Array.from(context.itemMap.values());
54
+ const orderedItems = items.sort(
55
+ (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
56
+ );
57
+ return orderedItems;
58
+ }, [context.collectionRef, context.itemMap]);
59
+ return getItems;
60
+ }
61
+ return [
62
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
63
+ useCollection,
64
+ createCollectionScope
65
+ ];
104
66
  }
105
-
106
-
107
-
108
-
109
- export {$e02a7d9cb1dc128c$export$c74125a8e3af6bb2 as createCollection};
67
+ export {
68
+ createCollection
69
+ };
110
70
  //# sourceMappingURL=index.mjs.map
@@ -1 +1,7 @@
1
- {"mappings":";;;;;ACAA;;;;AAaA,6FAAA;AACA,oEAAA;AACA,8FAAA;AACA,yDAAA;AAEA,SAASA,yCAAT,CAA0EK,IAA1E,EAAwF;IACtF;;oGAEF,CAEE,MAAMC,aAAa,GAAGD,IAAI,GAAG,oBAA7B,AAAA;IACA,MAAM,CAACE,uBAAD,EAA0BC,qBAA1B,CAAA,GAAmDN,yBAAkB,CAACI,aAAD,CAA3E,AAAA;IAOA,MAAM,CAACG,sBAAD,EAAyBC,oBAAzB,CAAA,GAAiDH,uBAAuB,CAC5ED,aAD4E,EAE5E;QAAEK,aAAa,EAAE;YAAEC,OAAO,EAAE,IAATA;SAAnB;QAAoCC,OAAO,EAAE,IAAIC,GAAJ,EAATD;KAFwC,CAA9E,AAEE;IAGF,MAAME,kBAAwE,GAAIC,CAAAA,KAAD,GAAW;QAC1F,MAAM,EArCV,OAqCYC,KAAF,CAAA,EArCV,UAqCmBC,QAAAA,CAAAA,EAAT,GAAsBF,KAA5B,AAAM;QACN,MAAMG,GAAG,GAAGlB,YAAK,CAACmB,MAAN,CAAgC,IAAhC,CAAZ,AAAA;QACA,MAAMP,OAAO,GAAGZ,YAAK,CAACmB,MAAN,CAAsC,IAAIN,GAAJ,EAAtC,CAAA,CAAiDF,OAAjE,AAAA;QACA,OAAA,aACE,CAAA,YAAA,CAAA,aAAA,CAAC,sBAAD,EADF;YAC0B,KAAK,EAAEK,KAA/B;YAAsC,OAAO,EAAEJ,OAA/C;YAAwD,aAAa,EAAEM,GAAf;SAAxD,EACGD,QADH,CADF,CACE;KALJ,AASC;IAED,aAAA,CAAA,MAAA,CAAA,MAAA,CAAA,kBAAA,EAAA;QAAA,WAAA,EAAA,aAAA;KAAA,CAAA,CAAA;IAEA;;oGAEF,CAEE,MAA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AAA,GAAuC0B,YAAY,CAACU,OAAb,CAAqBD,CAAC,CAAC5B,GAAF,CAAMP,OAA3B,CAD9B;YAAA,CAArB,AAAA;YAGA,OAAOgC,YAAP,CAAA;SARe,EASd;YAACnB,OAAO,CAACd,aAAT;YAAwBc,OAAO,CAACZ,OAAhC;SATc,CAAjB,AASC;QAED,OAAOsB,QAAP,CAAA;KACD;IAED,OAAO;QACL;YAAEc,QAAQ,EAAElC,kBAAZ;YAAgCX,IAAI,EAAEkB,cAAtC;YAAsD4B,QAAQ,EAAErB,kBAAVqB;SADjD;QAELhB,aAFK;QAGL1B,qBAHK;KAAP,CACE;CAIH;;AD9HD","sources":["packages/react/collection/src/index.ts","packages/react/collection/src/Collection.tsx"],"sourcesContent":["export { createCollection } from './Collection';\nexport type { CollectionProps } from './Collection';\n","import React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement>;\n itemMap: Map<React.RefObject<ItemElement>, { ref: React.RefObject<ItemElement> } & ItemData>;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() }\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <Slot ref={composedRefs}>{children}</Slot>;\n }\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n <Slot {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </Slot>\n );\n }\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n"],"names":["createCollection","React","createContextScope","useComposedRefs","Slot","name","PROVIDER_NAME","createCollectionContext","createCollectionScope","CollectionProviderImpl","useCollectionContext","collectionRef","current","itemMap","Map","CollectionProvider","props","scope","children","ref","useRef","COLLECTION_SLOT_NAME","CollectionSlot","forwardRef","forwardedRef","context","composedRefs","ITEM_SLOT_NAME","ITEM_DATA_ATTR","CollectionItemSlot","itemData","useEffect","set","delete","useCollection","getItems","useCallback","collectionNode","orderedNodes","Array","from","querySelectorAll","items","values","orderedItems","sort","a","b","indexOf","Provider","ItemSlot"],"version":3,"file":"index.mjs.map"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/Collection.tsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>\u2026</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData = {}>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = name + 'CollectionProvider';\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement>;\n itemMap: Map<React.RefObject<ItemElement>, { ref: React.RefObject<ItemElement> } & ItemData>;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: new Map() }\n );\n\n const CollectionProvider: React.FC<{ children?: React.ReactNode; scope: any }> = (props) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = name + 'CollectionSlot';\n\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return <Slot ref={composedRefs}>{children}</Slot>;\n }\n );\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = name + 'CollectionItemSlot';\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n return () => void context.itemMap.delete(ref);\n });\n\n return (\n <Slot {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </Slot>\n );\n }\n );\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n function useCollection(scope: any) {\n const context = useCollectionContext(name + 'CollectionConsumer', scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n return getItems;\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps };\n"],
5
+ "mappings": ";AAAA,OAAO,WAAW;AAClB,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,YAAY;AAsCf;AAvBN,SAAS,iBAAiE,MAAc;AAKtF,QAAM,gBAAgB,OAAO;AAC7B,QAAM,CAAC,yBAAyB,qBAAqB,IAAI,mBAAmB,aAAa;AAOzF,QAAM,CAAC,wBAAwB,oBAAoB,IAAI;AAAA,IACrD;AAAA,IACA,EAAE,eAAe,EAAE,SAAS,KAAK,GAAG,SAAS,oBAAI,IAAI,EAAE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Y,MAAM;AACvC,YAAM,iBAAiB,QAAQ,cAAc;AAC7C,UAAI,CAAC,eAAgB,QAAO,CAAC;AAC7B,YAAM,eAAe,MAAM,KAAK,eAAe,iBAAiB,IAAI,cAAc,GAAG,CAAC;AACtF,YAAM,QAAQ,MAAM,KAAK,QAAQ,QAAQ,OAAO,CAAC;AACjD,YAAM,eAAe,MAAM;AAAA,QACzB,CAAC,GAAG,MAAM,aAAa,QAAQ,EAAE,IAAI,OAAQ,IAAI,aAAa,QAAQ,EAAE,IAAI,OAAQ;AAAA,MACtF;AACA,aAAO;AAAA,IACT,GAAG,CAAC,QAAQ,eAAe,QAAQ,OAAO,CAAC;AAE3C,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,EAAE,UAAU,oBAAoB,MAAM,gBAAgB,UAAU,mBAAmB;AAAA,IACnF;AAAA,IACA;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-collection",
3
- "version": "1.0.3",
3
+ "version": "1.1.0-rc.1",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -28,11 +28,10 @@
28
28
  "version": "yarn version"
29
29
  },
30
30
  "dependencies": {
31
- "@babel/runtime": "^7.13.10",
32
- "@radix-ui/react-compose-refs": "1.0.1",
33
- "@radix-ui/react-context": "1.0.1",
34
- "@radix-ui/react-primitive": "1.0.3",
35
- "@radix-ui/react-slot": "1.0.2"
31
+ "@radix-ui/react-compose-refs": "1.1.0-rc.1",
32
+ "@radix-ui/react-context": "1.1.0-rc.1",
33
+ "@radix-ui/react-primitive": "1.1.0-rc.1",
34
+ "@radix-ui/react-slot": "1.1.0-rc.1"
36
35
  },
37
36
  "peerDependencies": {
38
37
  "@types/react": "*",
@@ -55,5 +54,6 @@
55
54
  },
56
55
  "bugs": {
57
56
  "url": "https://github.com/radix-ui/primitives/issues"
58
- }
57
+ },
58
+ "stableVersion": "1.0.3"
59
59
  }
@@ -1 +0,0 @@
1
- {"mappings":";;;AAOA,iBAAiB,MAAM,wBAAwB,CAAC,WAAW,CAAC,CAAC;AAE7D,gCAA0B,SAAQ,SAAS;IACzC,KAAK,EAAE,GAAG,CAAC;CACZ;AAOD,iCAA0B,WAAW,SAAS,WAAW,EAAE,QAAQ,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM;;mBAkBpC,MAAM,SAAS;eAAS,GAAG;;;;kBAsC/D,MAAM,SAAS;eAClB,GAAG;;WA6BkB,GAAG;SA5EmB,MAAM,SAAS,CAAC,WAAW,CAAC;kFAkGjF","sources":["packages/react/collection/src/packages/react/collection/src/Collection.tsx","packages/react/collection/src/packages/react/collection/src/index.ts","packages/react/collection/src/index.ts"],"sourcesContent":[null,null,"export { createCollection } from './Collection';\nexport type { CollectionProps } from './Collection';\n"],"names":[],"version":3,"file":"index.d.ts.map"}