@react-spectrum/utils 3.12.0 → 3.12.2

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.
@@ -44,9 +44,9 @@ function $e81916440cf6fd84$export$365cf34cda9978e2(cssModule) {
44
44
  }, {});
45
45
  }
46
46
  function $e81916440cf6fd84$export$8107b24b91795686(props) {
47
- // eslint-disable-next-line react-hooks/exhaustive-deps
48
- let parentSlots = (0, $iTRw5$react.useContext)($e81916440cf6fd84$var$SlotContext) || {};
49
- let { slots: slots = {}, children: children } = props;
47
+ const emptyObj = (0, $iTRw5$react.useMemo)(()=>({}), []);
48
+ let parentSlots = (0, $iTRw5$react.useContext)($e81916440cf6fd84$var$SlotContext) || emptyObj;
49
+ let { slots: slots = emptyObj, children: children } = props;
50
50
  // Merge props for each slot from parent context and props
51
51
  let value = (0, $iTRw5$react.useMemo)(()=>Object.keys(parentSlots).concat(Object.keys(slots)).reduce((o, p)=>({
52
52
  ...o,
@@ -61,12 +61,13 @@ function $e81916440cf6fd84$export$8107b24b91795686(props) {
61
61
  }
62
62
  function $e81916440cf6fd84$export$ceb145244332b7a2(props) {
63
63
  let { children: children, ...otherProps } = props;
64
+ const emptyObj = (0, $iTRw5$react.useMemo)(()=>({}), []);
64
65
  let content = children;
65
66
  if ((0, ($parcel$interopDefault($iTRw5$react))).Children.toArray(children).length <= 1) {
66
67
  if (typeof children === 'function') content = /*#__PURE__*/ (0, ($parcel$interopDefault($iTRw5$react))).cloneElement((0, ($parcel$interopDefault($iTRw5$react))).Children.only(children), otherProps);
67
68
  }
68
69
  return /*#__PURE__*/ (0, ($parcel$interopDefault($iTRw5$react))).createElement($e81916440cf6fd84$var$SlotContext.Provider, {
69
- value: {}
70
+ value: emptyObj
70
71
  }, content);
71
72
  }
72
73
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AASD,IAAI,kDAAc,CAAA,GAAA,sCAAI,EAAE,a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O,CAAC,UAAU,MAAM,IAAI,GAC7C;QAAA,IAAI,OAAO,aAAa,YACtB,wBAAU,CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW;IAC9D;IAEF,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO,CAAC;OAC3B;AAGP","sources":["packages/@react-spectrum/utils/src/Slots.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useMemo} from 'react';\n\ninterface SlotProps {\n slot?: string\n}\n\nlet SlotContext = React.createContext<{} | null>(null);\n\nexport function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string): T {\n let slot = (props as SlotProps).slot || defaultSlot;\n // @ts-ignore TODO why is slot an object and not just string or undefined?\n let {[slot]: slotProps = {}} = useContext(SlotContext) || {};\n\n return mergeProps(props, mergeProps(slotProps, {id: props.id}));\n}\n\nexport function cssModuleToSlots(cssModule) {\n return Object.keys(cssModule).reduce((acc, slot) => {\n acc[slot] = {UNSAFE_className: cssModule[slot]};\n return acc;\n }, {});\n}\n\nexport function SlotProvider(props) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let parentSlots = useContext(SlotContext) || {};\n let {slots = {}, children} = props;\n\n // Merge props for each slot from parent context and props\n let value = useMemo(() =>\n Object.keys(parentSlots)\n .concat(Object.keys(slots))\n .reduce((o, p) => ({\n ...o,\n [p]: mergeProps(parentSlots[p] || {}, slots[p] || {})}), {})\n , [parentSlots, slots]);\n\n return (\n <SlotContext.Provider value={value}>\n {children}\n </SlotContext.Provider>\n );\n}\n\nexport function ClearSlots(props) {\n let {children, ...otherProps} = props;\n let content = children;\n if (React.Children.toArray(children).length <= 1) {\n if (typeof children === 'function') { // need to know if the node is a string or something else that react can render that doesn't get props\n content = React.cloneElement(React.Children.only(children), otherProps);\n }\n }\n return (\n <SlotContext.Provider value={{}}>\n {content}\n </SlotContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"Slots.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AASD,IAAI,kDAAc,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAY;AAE1C,SAAS,0CAAgB,KAAwB,EAAE,WAAoB;IAC5E,IAAI,OAAO,AAAC,MAAoB,IAAI,IAAI;IACxC,0EAA0E;IAC1E,IAAI,EAAC,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,sCAAgB,CAAC;IAE3D,OAAO,CAAA,GAAA,gCAAS,EAAE,OAAO,CAAA,GAAA,gCAAS,EAAE,WAAW;QAAC,IAAI,MAAM,EAAE;IAAA;AAC9D;AAEO,SAAS,0CAAiB,SAAS;IACxC,OAAO,OAAO,IAAI,CAAC,WAAW,MAAM,CAAC,CAAC,KAAK;QACzC,GAAG,CAAC,KAAK,GAAG;YAAC,kBAAkB,SAAS,CAAC,KAAK;QAAA;QAC9C,OAAO;IACT,GAAG,CAAC;AACN;AAEO,SAAS,0CAAa,KAAK;IAChC,MAAM,WAAW,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA,CAAC,CAAA,GAAI,EAAE;IAEvC,IAAI,cAAc,CAAA,GAAA,uBAAS,EAAE,sCAAgB;IAC7C,IAAI,SAAC,QAAQ,oBAAU,QAAQ,EAAC,GAAG;IAEnC,0DAA0D;IAC1D,IAAI,QAAQ,CAAA,GAAA,oBAAM,EAAE,IAClB,OAAO,IAAI,CAAC,aACT,MAAM,CAAC,OAAO,IAAI,CAAC,QACnB,MAAM,CAAC,CAAC,GAAG,IAAO,CAAA;gBACjB,GAAG,CAAC;gBACJ,CAAC,EAAE,EAAE,CAAA,GAAA,gCAAS,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC;YAAE,CAAA,GAAI,CAAC,IAC1D;QAAC;QAAa;KAAM;IAE1B,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAEO,SAAS,0CAAW,KAAK;IAC9B,IAAI,YAAC,QAAQ,EAAE,GAAG,YAAW,GAAG;IAEhC,MAAM,WAAW,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA,CAAC,CAAA,GAAI,EAAE;IAEvC,IAAI,UAAU;IACd,IAAI,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,MAAM,IAAI,GAC7C;QAAA,IAAI,OAAO,aAAa,YACtB,wBAAU,CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW;IAC9D;IAEF,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP","sources":["packages/@react-spectrum/utils/src/Slots.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useMemo} from 'react';\n\ninterface SlotProps {\n slot?: string\n}\n\nlet SlotContext = React.createContext<{} | null>(null);\n\nexport function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string): T {\n let slot = (props as SlotProps).slot || defaultSlot;\n // @ts-ignore TODO why is slot an object and not just string or undefined?\n let {[slot]: slotProps = {}} = useContext(SlotContext) || {};\n\n return mergeProps(props, mergeProps(slotProps, {id: props.id}));\n}\n\nexport function cssModuleToSlots(cssModule) {\n return Object.keys(cssModule).reduce((acc, slot) => {\n acc[slot] = {UNSAFE_className: cssModule[slot]};\n return acc;\n }, {});\n}\n\nexport function SlotProvider(props) {\n const emptyObj = useMemo(() => ({}), []);\n \n let parentSlots = useContext(SlotContext) || emptyObj;\n let {slots = emptyObj, children} = props;\n\n // Merge props for each slot from parent context and props\n let value = useMemo(() =>\n Object.keys(parentSlots)\n .concat(Object.keys(slots))\n .reduce((o, p) => ({\n ...o,\n [p]: mergeProps(parentSlots[p] || {}, slots[p] || {})}), {})\n , [parentSlots, slots]);\n\n return (\n <SlotContext.Provider value={value}>\n {children}\n </SlotContext.Provider>\n );\n}\n\nexport function ClearSlots(props) {\n let {children, ...otherProps} = props;\n\n const emptyObj = useMemo(() => ({}), []);\n\n let content = children;\n if (React.Children.toArray(children).length <= 1) {\n if (typeof children === 'function') { // need to know if the node is a string or something else that react can render that doesn't get props\n content = React.cloneElement(React.Children.only(children), otherProps);\n }\n }\n return (\n <SlotContext.Provider value={emptyObj}>\n {content}\n </SlotContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"Slots.main.js.map"}
package/dist/Slots.mjs CHANGED
@@ -31,9 +31,9 @@ function $59d09bcc83651bf9$export$365cf34cda9978e2(cssModule) {
31
31
  }, {});
32
32
  }
33
33
  function $59d09bcc83651bf9$export$8107b24b91795686(props) {
34
- // eslint-disable-next-line react-hooks/exhaustive-deps
35
- let parentSlots = (0, $doF98$useContext)($59d09bcc83651bf9$var$SlotContext) || {};
36
- let { slots: slots = {}, children: children } = props;
34
+ const emptyObj = (0, $doF98$useMemo)(()=>({}), []);
35
+ let parentSlots = (0, $doF98$useContext)($59d09bcc83651bf9$var$SlotContext) || emptyObj;
36
+ let { slots: slots = emptyObj, children: children } = props;
37
37
  // Merge props for each slot from parent context and props
38
38
  let value = (0, $doF98$useMemo)(()=>Object.keys(parentSlots).concat(Object.keys(slots)).reduce((o, p)=>({
39
39
  ...o,
@@ -48,12 +48,13 @@ function $59d09bcc83651bf9$export$8107b24b91795686(props) {
48
48
  }
49
49
  function $59d09bcc83651bf9$export$ceb145244332b7a2(props) {
50
50
  let { children: children, ...otherProps } = props;
51
+ const emptyObj = (0, $doF98$useMemo)(()=>({}), []);
51
52
  let content = children;
52
53
  if ((0, $doF98$react).Children.toArray(children).length <= 1) {
53
54
  if (typeof children === 'function') content = /*#__PURE__*/ (0, $doF98$react).cloneElement((0, $doF98$react).Children.only(children), otherProps);
54
55
  }
55
56
  return /*#__PURE__*/ (0, $doF98$react).createElement($59d09bcc83651bf9$var$SlotContext.Provider, {
56
- value: {}
57
+ value: emptyObj
57
58
  }, content);
58
59
  }
59
60
 
@@ -31,9 +31,9 @@ function $59d09bcc83651bf9$export$365cf34cda9978e2(cssModule) {
31
31
  }, {});
32
32
  }
33
33
  function $59d09bcc83651bf9$export$8107b24b91795686(props) {
34
- // eslint-disable-next-line react-hooks/exhaustive-deps
35
- let parentSlots = (0, $doF98$useContext)($59d09bcc83651bf9$var$SlotContext) || {};
36
- let { slots: slots = {}, children: children } = props;
34
+ const emptyObj = (0, $doF98$useMemo)(()=>({}), []);
35
+ let parentSlots = (0, $doF98$useContext)($59d09bcc83651bf9$var$SlotContext) || emptyObj;
36
+ let { slots: slots = emptyObj, children: children } = props;
37
37
  // Merge props for each slot from parent context and props
38
38
  let value = (0, $doF98$useMemo)(()=>Object.keys(parentSlots).concat(Object.keys(slots)).reduce((o, p)=>({
39
39
  ...o,
@@ -48,12 +48,13 @@ function $59d09bcc83651bf9$export$8107b24b91795686(props) {
48
48
  }
49
49
  function $59d09bcc83651bf9$export$ceb145244332b7a2(props) {
50
50
  let { children: children, ...otherProps } = props;
51
+ const emptyObj = (0, $doF98$useMemo)(()=>({}), []);
51
52
  let content = children;
52
53
  if ((0, $doF98$react).Children.toArray(children).length <= 1) {
53
54
  if (typeof children === 'function') content = /*#__PURE__*/ (0, $doF98$react).cloneElement((0, $doF98$react).Children.only(children), otherProps);
54
55
  }
55
56
  return /*#__PURE__*/ (0, $doF98$react).createElement($59d09bcc83651bf9$var$SlotContext.Provider, {
56
- value: {}
57
+ value: emptyObj
57
58
  }, content);
58
59
  }
59
60
 
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AASD,IAAI,kDAAc,CAAA,GAAA,YAAI,EAAE,aAAa,CAAY;AAE1C,SAAS,0CAAgB,KAAwB,EAAE,WAAoB;IAC5E,IAAI,OAAO,AAAC,MAAoB,IAAI,IAAI;IACxC,0EAA0E;IAC1E,IAAI,EAAC,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,sCAAgB,CAAC;IAE3D,OAAO,CAAA,GAAA,iBAAS,EAAE,OAAO,CAAA,GAAA,iBAAS,EAAE,WAAW;QAAC,IAAI,MAAM,EAAE;IAAA;AAC9D;AAEO,SAAS,0CAAiB,SAAS;IACxC,OAAO,OAAO,IAAI,CAAC,WAAW,MAAM,CAAC,CAAC,KAAK;QACzC,GAAG,CAAC,KAAK,GAAG;YAAC,kBAAkB,SAAS,CAAC,KAAK;QAAA;QAC9C,OAAO;IACT,GAAG,CAAC;AACN;AAEO,SAAS,0CAAa,KAAK;IAChC,uDAAuD;IACvD,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,sCAAgB,CAAC;IAC9C,IAAI,SAAC,QAAQ,CAAC,aAAG,QAAQ,EAAC,GAAG;IAE7B,0DAA0D;IAC1D,IAAI,QAAQ,CAAA,GAAA,cAAM,EAAE,IAClB,OAAO,IAAI,CAAC,aACT,MAAM,CAAC,OAAO,IAAI,CAAC,QACnB,MAAM,CAAC,CAAC,GAAG,IAAO,CAAA;gBACjB,GAAG,CAAC;gBACJ,CAAC,EAAE,EAAE,CAAA,GAAA,iBAAS,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC;YAAE,CAAA,GAAI,CAAC,IAC1D;QAAC;QAAa;KAAM;IAE1B,qBACE,gCAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAEO,SAAS,0CAAW,KAAK;IAC9B,IAAI,YAAC,QAAQ,EAAE,GAAG,YAAW,GAAG;IAChC,IAAI,UAAU;IACd,IAAI,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,MAAM,IAAI,GAC7C;QAAA,IAAI,OAAO,aAAa,YACtB,wBAAU,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW;IAC9D;IAEF,qBACE,gCAAC,kCAAY,QAAQ;QAAC,OAAO,CAAC;OAC3B;AAGP","sources":["packages/@react-spectrum/utils/src/Slots.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useMemo} from 'react';\n\ninterface SlotProps {\n slot?: string\n}\n\nlet SlotContext = React.createContext<{} | null>(null);\n\nexport function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string): T {\n let slot = (props as SlotProps).slot || defaultSlot;\n // @ts-ignore TODO why is slot an object and not just string or undefined?\n let {[slot]: slotProps = {}} = useContext(SlotContext) || {};\n\n return mergeProps(props, mergeProps(slotProps, {id: props.id}));\n}\n\nexport function cssModuleToSlots(cssModule) {\n return Object.keys(cssModule).reduce((acc, slot) => {\n acc[slot] = {UNSAFE_className: cssModule[slot]};\n return acc;\n }, {});\n}\n\nexport function SlotProvider(props) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n let parentSlots = useContext(SlotContext) || {};\n let {slots = {}, children} = props;\n\n // Merge props for each slot from parent context and props\n let value = useMemo(() =>\n Object.keys(parentSlots)\n .concat(Object.keys(slots))\n .reduce((o, p) => ({\n ...o,\n [p]: mergeProps(parentSlots[p] || {}, slots[p] || {})}), {})\n , [parentSlots, slots]);\n\n return (\n <SlotContext.Provider value={value}>\n {children}\n </SlotContext.Provider>\n );\n}\n\nexport function ClearSlots(props) {\n let {children, ...otherProps} = props;\n let content = children;\n if (React.Children.toArray(children).length <= 1) {\n if (typeof children === 'function') { // need to know if the node is a string or something else that react can render that doesn't get props\n content = React.cloneElement(React.Children.only(children), otherProps);\n }\n }\n return (\n <SlotContext.Provider value={{}}>\n {content}\n </SlotContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"Slots.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AASD,IAAI,kDAAc,CAAA,GAAA,YAAI,EAAE,aAAa,CAAY;AAE1C,SAAS,0CAAgB,KAAwB,EAAE,WAAoB;IAC5E,IAAI,OAAO,AAAC,MAAoB,IAAI,IAAI;IACxC,0EAA0E;IAC1E,IAAI,EAAC,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,sCAAgB,CAAC;IAE3D,OAAO,CAAA,GAAA,iBAAS,EAAE,OAAO,CAAA,GAAA,iBAAS,EAAE,WAAW;QAAC,IAAI,MAAM,EAAE;IAAA;AAC9D;AAEO,SAAS,0CAAiB,SAAS;IACxC,OAAO,OAAO,IAAI,CAAC,WAAW,MAAM,CAAC,CAAC,KAAK;QACzC,GAAG,CAAC,KAAK,GAAG;YAA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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 {mergeProps} from '@react-aria/utils';\nimport React, {useContext, useMemo} from 'react';\n\ninterface SlotProps {\n slot?: string\n}\n\nlet SlotContext = React.createContext<{} | null>(null);\n\nexport function useSlotProps<T>(props: T & {id?: string}, defaultSlot?: string): T {\n let slot = (props as SlotProps).slot || defaultSlot;\n // @ts-ignore TODO why is slot an object and not just string or undefined?\n let {[slot]: slotProps = {}} = useContext(SlotContext) || {};\n\n return mergeProps(props, mergeProps(slotProps, {id: props.id}));\n}\n\nexport function cssModuleToSlots(cssModule) {\n return Object.keys(cssModule).reduce((acc, slot) => {\n acc[slot] = {UNSAFE_className: cssModule[slot]};\n return acc;\n }, {});\n}\n\nexport function SlotProvider(props) {\n const emptyObj = useMemo(() => ({}), []);\n \n let parentSlots = useContext(SlotContext) || emptyObj;\n let {slots = emptyObj, children} = props;\n\n // Merge props for each slot from parent context and props\n let value = useMemo(() =>\n Object.keys(parentSlots)\n .concat(Object.keys(slots))\n .reduce((o, p) => ({\n ...o,\n [p]: mergeProps(parentSlots[p] || {}, slots[p] || {})}), {})\n , [parentSlots, slots]);\n\n return (\n <SlotContext.Provider value={value}>\n {children}\n </SlotContext.Provider>\n );\n}\n\nexport function ClearSlots(props) {\n let {children, ...otherProps} = props;\n\n const emptyObj = useMemo(() => ({}), []);\n\n let content = children;\n if (React.Children.toArray(children).length <= 1) {\n if (typeof children === 'function') { // need to know if the node is a string or something else that react can render that doesn't get props\n content = React.cloneElement(React.Children.only(children), otherProps);\n }\n }\n return (\n <SlotContext.Provider value={emptyObj}>\n {content}\n </SlotContext.Provider>\n );\n}\n"],"names":[],"version":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AAI,CAAC,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,CAIjK;AAED,6BAA6B,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,UAAU,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,CAM9G;AAED,gCAAgC,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,UAAU,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,GAAI,UAAU,CAAC,GAAG,IAAI,CAAC,CAElH;ACnCD,6BAA6B,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,CAMjF;AAED,iCAAiC,SAAS,KAAA,MAKzC;AAED,6BAA6B,KAAK,KAAA,qBAmBjC;AAED,2BAA2B,KAAK,KAAA,qBAa/B;ACtDD,4BAA4B,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,WAM5E;ACND,qCAAqC,OAAO,CAO3C;ACSD,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/BreakpointProvider.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/styleProps.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/classNames.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/getWrappedElement.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useMediaQuery.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useDOMRef.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/Slots.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useHasChild.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useIsMobileDevice.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/index.ts","packages/@react-spectrum/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 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\n/// <reference types=\"css-module-types\" />\n\nexport type {StyleHandlers} from './styleProps';\nexport {shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames} from './classNames';\nexport {getWrappedElement} from './getWrappedElement';\nexport {useMediaQuery} from './useMediaQuery';\nexport {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from './useDOMRef';\nexport {\n baseStyleProps,\n viewStyleProps,\n dimensionValue,\n responsiveDimensionValue,\n convertStyleProps,\n useStyleProps,\n passthroughStyle,\n getResponsiveProp\n} from './styleProps';\nexport {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from './Slots';\nexport {useHasChild} from './useHasChild';\nexport {useIsMobileDevice} from './useIsMobileDevice';\nexport {useValueEffect} from '@react-aria/utils';\nexport {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from './BreakpointProvider';\nexport {useResizeObserver} from '@react-aria/utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AAGA;IACE,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACrC;AAED;IACE,kBAAkB,EAAE,MAAM,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,CAAC,GAAG,IAAI,CAAC,GAAI,UAAU,CAAC,GAAG,IAAI,CAAC,CAElH;ACnCD,6BAA6B,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,CAMjF;AAED,iCAAiC,SAAS,KAAA,MAKzC;AAED,6BAA6B,KAAK,KAAA,qBAoBjC;AAED,2BAA2B,KAAK,KAAA,qBAgB/B;AC1DD,4BAA4B,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,WAM5E;ACND,qCAAqC,OAAO,CAO3C;ACSD,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/BreakpointProvider.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/styleProps.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/classNames.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/getWrappedElement.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useMediaQuery.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useDOMRef.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/Slots.tsx","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useHasChild.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/useIsMobileDevice.ts","packages/@react-spectrum/utils/src/packages/@react-spectrum/utils/src/index.ts","packages/@react-spectrum/utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 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\n/// <reference types=\"css-module-types\" />\n\nexport type {StyleHandlers} from './styleProps';\nexport {shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames} from './classNames';\nexport {getWrappedElement} from './getWrappedElement';\nexport {useMediaQuery} from './useMediaQuery';\nexport {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from './useDOMRef';\nexport {\n baseStyleProps,\n viewStyleProps,\n dimensionValue,\n responsiveDimensionValue,\n convertStyleProps,\n useStyleProps,\n passthroughStyle,\n getResponsiveProp\n} from './styleProps';\nexport {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from './Slots';\nexport {useHasChild} from './useHasChild';\nexport {useIsMobileDevice} from './useIsMobileDevice';\nexport {useValueEffect} from '@react-aria/utils';\nexport {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from './BreakpointProvider';\nexport {useResizeObserver} from '@react-aria/utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/utils",
3
- "version": "3.12.0",
3
+ "version": "3.12.2",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -24,18 +24,19 @@
24
24
  "url": "https://github.com/adobe/react-spectrum"
25
25
  },
26
26
  "dependencies": {
27
- "@react-aria/i18n": "^3.12.4",
27
+ "@react-aria/i18n": "^3.12.6",
28
28
  "@react-aria/ssr": "^3.9.7",
29
- "@react-aria/utils": "^3.26.0",
30
- "@react-types/shared": "^3.26.0",
29
+ "@react-aria/utils": "^3.28.0",
30
+ "@react-types/shared": "^3.28.0",
31
31
  "@swc/helpers": "^0.5.0",
32
32
  "clsx": "^2.0.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
35
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
36
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
36
37
  },
37
38
  "publishConfig": {
38
39
  "access": "public"
39
40
  },
40
- "gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849"
41
+ "gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
41
42
  }
package/src/Slots.tsx CHANGED
@@ -35,9 +35,10 @@ export function cssModuleToSlots(cssModule) {
35
35
  }
36
36
 
37
37
  export function SlotProvider(props) {
38
- // eslint-disable-next-line react-hooks/exhaustive-deps
39
- let parentSlots = useContext(SlotContext) || {};
40
- let {slots = {}, children} = props;
38
+ const emptyObj = useMemo(() => ({}), []);
39
+
40
+ let parentSlots = useContext(SlotContext) || emptyObj;
41
+ let {slots = emptyObj, children} = props;
41
42
 
42
43
  // Merge props for each slot from parent context and props
43
44
  let value = useMemo(() =>
@@ -57,6 +58,9 @@ export function SlotProvider(props) {
57
58
 
58
59
  export function ClearSlots(props) {
59
60
  let {children, ...otherProps} = props;
61
+
62
+ const emptyObj = useMemo(() => ({}), []);
63
+
60
64
  let content = children;
61
65
  if (React.Children.toArray(children).length <= 1) {
62
66
  if (typeof children === 'function') { // need to know if the node is a string or something else that react can render that doesn't get props
@@ -64,7 +68,7 @@ export function ClearSlots(props) {
64
68
  }
65
69
  }
66
70
  return (
67
- <SlotContext.Provider value={{}}>
71
+ <SlotContext.Provider value={emptyObj}>
68
72
  {content}
69
73
  </SlotContext.Provider>
70
74
  );