@react-aria/collections 3.0.0-nightly-e1b72a79f-241017 → 3.0.0-nightly-0ddbe6f95-241019

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.
@@ -32,9 +32,7 @@ function $245f3f827bea6653$export$727c8fc270210f13(props) {
32
32
  var _rendered_props_id, _ref;
33
33
  // @ts-ignore
34
34
  let key = (_ref = (_rendered_props_id = rendered.props.id) !== null && _rendered_props_id !== void 0 ? _rendered_props_id : item.key) !== null && _ref !== void 0 ? _ref : item.id;
35
- // eslint-disable-next-line max-depth
36
35
  if (key == null) throw new Error('Could not determine key for item');
37
- // eslint-disable-next-line max-depth
38
36
  if (idScope) key = idScope + ':' + key;
39
37
  // Note: only works if wrapped Item passes through id...
40
38
  rendered = (0, $6Tq0m$react.cloneElement)(rendered, addIdAndValue ? {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAsBM,SAAS,0CAAoC,KAA+B;IACjF,IAAI,YAAC,QAAQ,SAAE,KAAK,WAAE,OAAO,iBAAE,aAAa,gBAAE,eAAe,EAAE,EAAC,GAAG;IAEnE,0DAA0D;IAC1D,uDAAuD;IACvD,IAAI,QAAQ,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,WAAW;IACzC,OAAO,CAAA,GAAA,oBAAM,EAAE;QACb,IAAI,SAAS,OAAO,aAAa,YAAY;YAC3C,IAAI,MAAsB,EAAE;YAC5B,KAAK,IAAI,QAAQ,MAAO;gBACtB,IAAI,WAAW,MAAM,GAAG,CAAC;gBACzB,IAAI,CAAC,UAAU;oBACb,WAAW,SAAS;wBAEV,oBAAA;oBADV,aAAa;oBACb,IAAI,MAAM,CAAA,OAAA,CAAA,qBAAA,SAAS,KAAK,CAAC,EAAE,cAAjB,gCAAA,qBAAqB,KAAK,GAAG,cAA7B,kBAAA,OAAiC,KAAK,EAAE;oBAClD,qCAAqC;oBACrC,IAAI,OAAO,MACT,MAAM,IAAI,MAAM;oBAElB,qCAAqC;oBACrC,IAAI,SACF,MAAM,UAAU,MAAM;oBAExB,wDAAwD;oBACxD,WAAW,CAAA,GAAA,yBAAW,EACpB,UACA,gBAAgB;6BAAC;wBAAK,IAAI;wBAAK,OAAO;oBAAI,IAAI;6BAAC;oBAAG;oBAEpD,MAAM,GAAG,CAAC,MAAM;gBAClB;gBACA,IAAI,IAAI,CAAC;YACX;YACA,OAAO;QACT,OAAO,IAAI,OAAO,aAAa,YAC7B,OAAO;IAEX,GAAG;QAAC;QAAU;QAAO;QAAO;QAAS;KAAc;AACrD","sources":["packages/@react-aria/collections/src/useCachedChildren.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {cloneElement, ReactElement, ReactNode, useMemo} from 'react';\nimport {Key} from '@react-types/shared';\n\nexport interface CachedChildrenOptions<T> {\n /** Item objects in the collection. */\n items?: Iterable<T>,\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[],\n /** A scope to prepend to all child item ids to ensure they are unique. */\n idScope?: Key,\n /** Whether to add `id` and `value` props to all child items. */\n addIdAndValue?: boolean\n}\n\n/**\n * Maps over a list of items and renders React elements for them. Each rendered item is\n * cached based on object identity, and React keys are generated from the `key` or `id` property.\n */\nexport function useCachedChildren<T extends object>(props: CachedChildrenOptions<T>): ReactNode {\n let {children, items, idScope, addIdAndValue, dependencies = []} = props;\n\n // Invalidate the cache whenever the parent value changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let cache = useMemo(() => new WeakMap(), dependencies);\n return useMemo(() => {\n if (items && typeof children === 'function') {\n let res: ReactElement[] = [];\n for (let item of items) {\n let rendered = cache.get(item);\n if (!rendered) {\n rendered = children(item);\n // @ts-ignore\n let key = rendered.props.id ?? item.key ?? item.id;\n // eslint-disable-next-line max-depth\n if (key == null) {\n throw new Error('Could not determine key for item');\n }\n // eslint-disable-next-line max-depth\n if (idScope) {\n key = idScope + ':' + key;\n }\n // Note: only works if wrapped Item passes through id...\n rendered = cloneElement(\n rendered,\n addIdAndValue ? {key, id: key, value: item} : {key}\n );\n cache.set(item, rendered);\n }\n res.push(rendered);\n }\n return res;\n } else if (typeof children !== 'function') {\n return children;\n }\n }, [children, items, cache, idScope, addIdAndValue]);\n}\n"],"names":[],"version":3,"file":"useCachedChildren.main.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAsBM,SAAS,0CAAoC,KAA+B;IACjF,IAAI,YAAC,QAAQ,SAAE,KAAK,WAAE,OAAO,iBAAE,aAAa,gBAAE,eAAe,EAAE,EAAC,GAAG;IAEnE,0DAA0D;IAC1D,uDAAuD;IACvD,IAAI,QAAQ,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,WAAW;IACzC,OAAO,CAAA,GAAA,oBAAM,EAAE;QACb,IAAI,SAAS,OAAO,aAAa,YAAY;YAC3C,IAAI,MAAsB,EAAE;YAC5B,KAAK,IAAI,QAAQ,MAAO;gBACtB,IAAI,WAAW,MAAM,GAAG,CAAC;gBACzB,IAAI,CAAC,UAAU;oBACb,WAAW,SAAS;wBAEV,oBAAA;oBADV,aAAa;oBACb,IAAI,MAAM,CAAA,OAAA,CAAA,qBAAA,SAAS,KAAK,CAAC,EAAE,cAAjB,gCAAA,qBAAqB,KAAK,GAAG,cAA7B,kBAAA,OAAiC,KAAK,EAAE;oBAElD,IAAI,OAAO,MACT,MAAM,IAAI,MAAM;oBAGlB,IAAI,SACF,MAAM,UAAU,MAAM;oBAExB,wDAAwD;oBACxD,WAAW,CAAA,GAAA,yBAAW,EACpB,UACA,gBAAgB;6BAAC;wBAAK,IAAI;wBAAK,OAAO;oBAAI,IAAI;6BAAC;oBAAG;oBAEpD,MAAM,GAAG,CAAC,MAAM;gBAClB;gBACA,IAAI,IAAI,CAAC;YACX;YACA,OAAO;QACT,OAAO,IAAI,OAAO,aAAa,YAC7B,OAAO;IAEX,GAAG;QAAC;QAAU;QAAO;QAAO;QAAS;KAAc;AACrD","sources":["packages/@react-aria/collections/src/useCachedChildren.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {cloneElement, ReactElement, ReactNode, useMemo} from 'react';\nimport {Key} from '@react-types/shared';\n\nexport interface CachedChildrenOptions<T> {\n /** Item objects in the collection. */\n items?: Iterable<T>,\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[],\n /** A scope to prepend to all child item ids to ensure they are unique. */\n idScope?: Key,\n /** Whether to add `id` and `value` props to all child items. */\n addIdAndValue?: boolean\n}\n\n/**\n * Maps over a list of items and renders React elements for them. Each rendered item is\n * cached based on object identity, and React keys are generated from the `key` or `id` property.\n */\nexport function useCachedChildren<T extends object>(props: CachedChildrenOptions<T>): ReactNode {\n let {children, items, idScope, addIdAndValue, dependencies = []} = props;\n\n // Invalidate the cache whenever the parent value changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let cache = useMemo(() => new WeakMap(), dependencies);\n return useMemo(() => {\n if (items && typeof children === 'function') {\n let res: ReactElement[] = [];\n for (let item of items) {\n let rendered = cache.get(item);\n if (!rendered) {\n rendered = children(item);\n // @ts-ignore\n let key = rendered.props.id ?? item.key ?? item.id;\n \n if (key == null) {\n throw new Error('Could not determine key for item');\n }\n \n if (idScope) {\n key = idScope + ':' + key;\n }\n // Note: only works if wrapped Item passes through id...\n rendered = cloneElement(\n rendered,\n addIdAndValue ? {key, id: key, value: item} : {key}\n );\n cache.set(item, rendered);\n }\n res.push(rendered);\n }\n return res;\n } else if (typeof children !== 'function') {\n return children;\n }\n }, [children, items, cache, idScope, addIdAndValue]);\n}\n"],"names":[],"version":3,"file":"useCachedChildren.main.js.map"}
@@ -26,9 +26,7 @@ function $e948873055cbafe4$export$727c8fc270210f13(props) {
26
26
  var _rendered_props_id, _ref;
27
27
  // @ts-ignore
28
28
  let key = (_ref = (_rendered_props_id = rendered.props.id) !== null && _rendered_props_id !== void 0 ? _rendered_props_id : item.key) !== null && _ref !== void 0 ? _ref : item.id;
29
- // eslint-disable-next-line max-depth
30
29
  if (key == null) throw new Error('Could not determine key for item');
31
- // eslint-disable-next-line max-depth
32
30
  if (idScope) key = idScope + ':' + key;
33
31
  // Note: only works if wrapped Item passes through id...
34
32
  rendered = (0, $luMFQ$cloneElement)(rendered, addIdAndValue ? {
@@ -26,9 +26,7 @@ function $e948873055cbafe4$export$727c8fc270210f13(props) {
26
26
  var _rendered_props_id, _ref;
27
27
  // @ts-ignore
28
28
  let key = (_ref = (_rendered_props_id = rendered.props.id) !== null && _rendered_props_id !== void 0 ? _rendered_props_id : item.key) !== null && _ref !== void 0 ? _ref : item.id;
29
- // eslint-disable-next-line max-depth
30
29
  if (key == null) throw new Error('Could not determine key for item');
31
- // eslint-disable-next-line max-depth
32
30
  if (idScope) key = idScope + ':' + key;
33
31
  // Note: only works if wrapped Item passes through id...
34
32
  rendered = (0, $luMFQ$cloneElement)(rendered, addIdAndValue ? {
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAsBM,SAAS,0CAAoC,KAA+B;IACjF,IAAI,YAAC,QAAQ,SAAE,KAAK,WAAE,OAAO,iBAAE,aAAa,gBAAE,eAAe,EAAE,EAAC,GAAG;IAEnE,0DAA0D;IAC1D,uDAAuD;IACvD,IAAI,QAAQ,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,WAAW;IACzC,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,IAAI,SAAS,OAAO,aAAa,YAAY;YAC3C,IAAI,MAAsB,EAAE;YAC5B,KAAK,IAAI,QAAQ,MAAO;gBACtB,IAAI,WAAW,MAAM,GAAG,CAAC;gBACzB,IAAI,CAAC,UAAU;oBACb,WAAW,SAAS;wBAEV,oBAAA;oBADV,aAAa;oBACb,IAAI,MAAM,CAAA,OAAA,CAAA,qBAAA,SAAS,KAAK,CAAC,EAAE,cAAjB,gCAAA,qBAAqB,KAAK,GAAG,cAA7B,kBAAA,OAAiC,KAAK,EAAE;oBAClD,qCAAqC;oBACrC,IAAI,OAAO,MACT,MAAM,IAAI,MAAM;oBAElB,qCAAqC;oBACrC,IAAI,SACF,MAAM,UAAU,MAAM;oBAExB,wDAAwD;oBACxD,WAAW,CAAA,GAAA,mBAAW,EACpB,UACA,gBAAgB;6BAAC;wBAAK,IAAI;wBAAK,OAAO;oBAAI,IAAI;6BAAC;oBAAG;oBAEpD,MAAM,GAAG,CAAC,MAAM;gBAClB;gBACA,IAAI,IAAI,CAAC;YACX;YACA,OAAO;QACT,OAAO,IAAI,OAAO,aAAa,YAC7B,OAAO;IAEX,GAAG;QAAC;QAAU;QAAO;QAAO;QAAS;KAAc;AACrD","sources":["packages/@react-aria/collections/src/useCachedChildren.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {cloneElement, ReactElement, ReactNode, useMemo} from 'react';\nimport {Key} from '@react-types/shared';\n\nexport interface CachedChildrenOptions<T> {\n /** Item objects in the collection. */\n items?: Iterable<T>,\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[],\n /** A scope to prepend to all child item ids to ensure they are unique. */\n idScope?: Key,\n /** Whether to add `id` and `value` props to all child items. */\n addIdAndValue?: boolean\n}\n\n/**\n * Maps over a list of items and renders React elements for them. Each rendered item is\n * cached based on object identity, and React keys are generated from the `key` or `id` property.\n */\nexport function useCachedChildren<T extends object>(props: CachedChildrenOptions<T>): ReactNode {\n let {children, items, idScope, addIdAndValue, dependencies = []} = props;\n\n // Invalidate the cache whenever the parent value changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let cache = useMemo(() => new WeakMap(), dependencies);\n return useMemo(() => {\n if (items && typeof children === 'function') {\n let res: ReactElement[] = [];\n for (let item of items) {\n let rendered = cache.get(item);\n if (!rendered) {\n rendered = children(item);\n // @ts-ignore\n let key = rendered.props.id ?? item.key ?? item.id;\n // eslint-disable-next-line max-depth\n if (key == null) {\n throw new Error('Could not determine key for item');\n }\n // eslint-disable-next-line max-depth\n if (idScope) {\n key = idScope + ':' + key;\n }\n // Note: only works if wrapped Item passes through id...\n rendered = cloneElement(\n rendered,\n addIdAndValue ? {key, id: key, value: item} : {key}\n );\n cache.set(item, rendered);\n }\n res.push(rendered);\n }\n return res;\n } else if (typeof children !== 'function') {\n return children;\n }\n }, [children, items, cache, idScope, addIdAndValue]);\n}\n"],"names":[],"version":3,"file":"useCachedChildren.module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAsBM,SAAS,0CAAoC,KAA+B;IACjF,IAAI,YAAC,QAAQ,SAAE,KAAK,WAAE,OAAO,iBAAE,aAAa,gBAAE,eAAe,EAAE,EAAC,GAAG;IAEnE,0DAA0D;IAC1D,uDAAuD;IACvD,IAAI,QAAQ,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,WAAW;IACzC,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,IAAI,SAAS,OAAO,aAAa,YAAY;YAC3C,IAAI,MAAsB,EAAE;YAC5B,KAAK,IAAI,QAAQ,MAAO;gBACtB,IAAI,WAAW,MAAM,GAAG,CAAC;gBACzB,IAAI,CAAC,UAAU;oBACb,WAAW,SAAS;wBAEV,oBAAA;oBADV,aAAa;oBACb,IAAI,MAAM,CAAA,OAAA,CAAA,qBAAA,SAAS,KAAK,CAAC,EAAE,cAAjB,gCAAA,qBAAqB,KAAK,GAAG,cAA7B,kBAAA,OAAiC,KAAK,EAAE;oBAElD,IAAI,OAAO,MACT,MAAM,IAAI,MAAM;oBAGlB,IAAI,SACF,MAAM,UAAU,MAAM;oBAExB,wDAAwD;oBACxD,WAAW,CAAA,GAAA,mBAAW,EACpB,UACA,gBAAgB;6BAAC;wBAAK,IAAI;wBAAK,OAAO;oBAAI,IAAI;6BAAC;oBAAG;oBAEpD,MAAM,GAAG,CAAC,MAAM;gBAClB;gBACA,IAAI,IAAI,CAAC;YACX;YACA,OAAO;QACT,OAAO,IAAI,OAAO,aAAa,YAC7B,OAAO;IAEX,GAAG;QAAC;QAAU;QAAO;QAAO;QAAS;KAAc;AACrD","sources":["packages/@react-aria/collections/src/useCachedChildren.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {cloneElement, ReactElement, ReactNode, useMemo} from 'react';\nimport {Key} from '@react-types/shared';\n\nexport interface CachedChildrenOptions<T> {\n /** Item objects in the collection. */\n items?: Iterable<T>,\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[],\n /** A scope to prepend to all child item ids to ensure they are unique. */\n idScope?: Key,\n /** Whether to add `id` and `value` props to all child items. */\n addIdAndValue?: boolean\n}\n\n/**\n * Maps over a list of items and renders React elements for them. Each rendered item is\n * cached based on object identity, and React keys are generated from the `key` or `id` property.\n */\nexport function useCachedChildren<T extends object>(props: CachedChildrenOptions<T>): ReactNode {\n let {children, items, idScope, addIdAndValue, dependencies = []} = props;\n\n // Invalidate the cache whenever the parent value changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let cache = useMemo(() => new WeakMap(), dependencies);\n return useMemo(() => {\n if (items && typeof children === 'function') {\n let res: ReactElement[] = [];\n for (let item of items) {\n let rendered = cache.get(item);\n if (!rendered) {\n rendered = children(item);\n // @ts-ignore\n let key = rendered.props.id ?? item.key ?? item.id;\n \n if (key == null) {\n throw new Error('Could not determine key for item');\n }\n \n if (idScope) {\n key = idScope + ':' + key;\n }\n // Note: only works if wrapped Item passes through id...\n rendered = cloneElement(\n rendered,\n addIdAndValue ? {key, id: key, value: item} : {key}\n );\n cache.set(item, rendered);\n }\n res.push(rendered);\n }\n return res;\n } else if (typeof children !== 'function') {\n return children;\n }\n }, [children, items, cache, idScope, addIdAndValue]);\n}\n"],"names":[],"version":3,"file":"useCachedChildren.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/collections",
3
- "version": "3.0.0-nightly-e1b72a79f-241017",
3
+ "version": "3.0.0-nightly-0ddbe6f95-241019",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,9 +22,9 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/ssr": "^3.0.0-nightly-e1b72a79f-241017",
26
- "@react-aria/utils": "^3.0.0-nightly-e1b72a79f-241017",
27
- "@react-types/shared": "^3.0.0-nightly-e1b72a79f-241017",
25
+ "@react-aria/ssr": "^3.0.0-nightly-0ddbe6f95-241019",
26
+ "@react-aria/utils": "^3.0.0-nightly-0ddbe6f95-241019",
27
+ "@react-types/shared": "^3.0.0-nightly-0ddbe6f95-241019",
28
28
  "@swc/helpers": "^0.5.0",
29
29
  "use-sync-external-store": "^1.2.0"
30
30
  },
@@ -45,11 +45,11 @@ export function useCachedChildren<T extends object>(props: CachedChildrenOptions
45
45
  rendered = children(item);
46
46
  // @ts-ignore
47
47
  let key = rendered.props.id ?? item.key ?? item.id;
48
- // eslint-disable-next-line max-depth
48
+
49
49
  if (key == null) {
50
50
  throw new Error('Could not determine key for item');
51
51
  }
52
- // eslint-disable-next-line max-depth
52
+
53
53
  if (idScope) {
54
54
  key = idScope + ':' + key;
55
55
  }