react-stately 3.50.0 → 3.51.0

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.
Files changed (35) hide show
  1. package/dist/private/color/Color.cjs +5 -3
  2. package/dist/private/color/Color.cjs.map +1 -1
  3. package/dist/private/color/Color.js +5 -3
  4. package/dist/private/color/Color.js.map +1 -1
  5. package/dist/private/color/Color.mjs +5 -3
  6. package/dist/private/color/Color.mjs.map +1 -1
  7. package/dist/private/combobox/useComboBoxState.cjs +15 -1
  8. package/dist/private/combobox/useComboBoxState.cjs.map +1 -1
  9. package/dist/private/combobox/useComboBoxState.js +16 -2
  10. package/dist/private/combobox/useComboBoxState.js.map +1 -1
  11. package/dist/private/combobox/useComboBoxState.mjs +16 -2
  12. package/dist/private/combobox/useComboBoxState.mjs.map +1 -1
  13. package/dist/private/data/useTreeData.cjs +7 -2
  14. package/dist/private/data/useTreeData.cjs.map +1 -1
  15. package/dist/private/data/useTreeData.js +9 -2
  16. package/dist/private/data/useTreeData.js.map +1 -1
  17. package/dist/private/data/useTreeData.mjs +7 -2
  18. package/dist/private/data/useTreeData.mjs.map +1 -1
  19. package/dist/private/layout/ListLayout.cjs +4 -0
  20. package/dist/private/layout/ListLayout.cjs.map +1 -1
  21. package/dist/private/layout/ListLayout.js +4 -0
  22. package/dist/private/layout/ListLayout.js.map +1 -1
  23. package/dist/private/layout/ListLayout.mjs +4 -0
  24. package/dist/private/layout/ListLayout.mjs.map +1 -1
  25. package/dist/private/tooltip/useTooltipTriggerState.cjs.map +1 -1
  26. package/dist/private/tooltip/useTooltipTriggerState.js.map +1 -1
  27. package/dist/private/tooltip/useTooltipTriggerState.mjs.map +1 -1
  28. package/dist/private/utils/useControlledState.cjs +1 -1
  29. package/dist/private/utils/useControlledState.cjs.map +1 -1
  30. package/dist/private/utils/useControlledState.js +1 -1
  31. package/dist/private/utils/useControlledState.js.map +1 -1
  32. package/dist/private/utils/useControlledState.mjs +1 -1
  33. package/dist/private/utils/useControlledState.mjs.map +1 -1
  34. package/dist/types/src/tooltip/useTooltipTriggerState.d.ts +2 -2
  35. package/package.json +4 -4
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AA0CD,MAAM,sCAAgB,MAAM,yDAAyD;AACrF,MAAM,yCAAmB;AAoBzB,IAAI,iCAAW,CAAC;AAChB,IAAI,kCAAY;AAChB,IAAI,uCAAiB;AACrB,IAAI,4CAA4D;AAChE,IAAI,8CAA8D;AAO3D,SAAS,0CAAuB,QAA6B,CAAC,CAAC;IACpE,IAAI,SAAC,QAAQ,iDAAe,aAAa,wCAAiB,GAAG;IAC7D,IAAI,UAAC,MAAM,QAAE,IAAI,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAqB,EAAE;IACnD,yFAAyF;IACzF,oDAAoD;IACpD,IAAI,CAAC,qBAAqB,aAAa,GAAG,CAAA,GAAA,eAAO,EAAE;IACnD,IAAI,KAAK,CAAA,GAAA,cAAM,EAAE,IAAM,GAAG,EAAE,iCAAW,EAAE,EAAE;IAC3C,IAAI,eAAe,CAAA,GAAA,aAAK,EAAwC;IAChE,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAc;IAEvC,IAAI,qBAAqB;QACvB,8BAAQ,CAAC,GAAG,GAAG;IACjB;IAEA,IAAI,oBAAoB;QACtB,IAAK,IAAI,iBAAiB,+BACxB,IAAI,kBAAkB,IAAI;YACxB,gFAAgF;YAChF,iDAAiD;YACjD,8BAAQ,CAAC,cAAc,CAAC,MAAM;YAC9B,OAAO,8BAAQ,CAAC,cAAc;QAChC;IAEJ;IAEA,IAAI,cAAc,CAAC;QACjB,IAAI,aAAa,OAAO,EACtB,aAAa,aAAa,OAAO;QAEnC,aAAa,OAAO,GAAG;QACvB;QACA;QACA,aAAa,CAAC,CAAC;QACf,uCAAiB;QACjB;QACA,IAAI,2CAAqB;YACvB,aAAa;YACb,4CAAsB;QACxB;QACA,IAAI,6CAAuB;YACzB,aAAa;YAC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A,OAAO;IACT;AACF","sources":["packages/react-stately/src/tooltip/useTooltipTriggerState.ts"],"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 {OverlayTriggerProps, useOverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\nexport interface TooltipTriggerProps extends OverlayTriggerProps {\n /**\n * Whether the tooltip should be disabled, independent from the trigger.\n */\n isDisabled?: boolean;\n\n /**\n * The delay time for the tooltip to show up. [See\n * guidelines](https://spectrum.adobe.com/page/tooltip/#Immediate-or-delayed-appearance).\n *\n * @default 1500\n */\n delay?: number;\n\n /**\n * The delay time for the tooltip to close. [See\n * guidelines](https://spectrum.adobe.com/page/tooltip/#Warmup-and-cooldown).\n *\n * @default 500\n */\n closeDelay?: number;\n\n /**\n * By default, opens for both focus and hover. Can be made to open only for focus.\n *\n * @default 'hover'\n */\n trigger?: 'hover' | 'focus';\n\n /**\n * Whether the tooltip should close when the trigger is pressed.\n *\n * @default true\n */\n shouldCloseOnPress?: boolean;\n}\n\nconst TOOLTIP_DELAY = 1500; // this seems to be a 1.5 second delay, check with design\nconst TOOLTIP_COOLDOWN = 500;\n\nexport interface TooltipTriggerState {\n /** Whether the tooltip is currently showing. */\n isOpen: boolean;\n /**\n * Whether the tooltip is being shown or hidden without an animation. This is true while the\n * global warmup timer is active, i.e. when quickly moving between tooltips.\n */\n shouldSkipAnimation: boolean;\n /**\n * Shows the tooltip. By default, the tooltip becomes visible after a delay\n * depending on a global warmup timer. The `immediate` option shows the\n * tooltip immediately instead.\n */\n open(immediate?: boolean): void;\n /** Hides the tooltip. */\n close(immediate?: boolean): void;\n}\n\nlet tooltips = {};\nlet tooltipId = 0;\nlet globalWarmedUp = false;\nlet globalWarmUpTimeout: ReturnType<typeof setTimeout> | null = null;\nlet globalCooldownTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides\n * methods to toggle this state. Ensures only one tooltip is open at a time and controls\n * the delay for showing a tooltip.\n */\nexport function useTooltipTriggerState(props: TooltipTriggerProps = {}): TooltipTriggerState {\n let {delay = TOOLTIP_DELAY, closeDelay = TOOLTIP_COOLDOWN} = props;\n let {isOpen, open, close} = useOverlayTriggerState(props);\n // Whether the current open/close transition should skip its animation. Set when swapping\n // between tooltips during the global warmup period.\n let [shouldSkipAnimation, setIsInstant] = useState(false);\n let id = useMemo(() => `${++tooltipId}`, []);\n let closeTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n let closeCallback = useRef<() => void>(close);\n\n let ensureTooltipEntry = () => {\n tooltips[id] = hideTooltip;\n };\n\n let closeOpenTooltips = () => {\n for (let hideTooltipId in tooltips) {\n if (hideTooltipId !== id) {\n // Close other open tooltips instantly (no exit animation), since they are being\n // replaced by this one during the warmup period.\n tooltips[hideTooltipId](true, true);\n delete tooltips[hideTooltipId];\n }\n }\n };\n\n let showTooltip = (instant?: boolean) => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeOpenTooltips();\n ensureTooltipEntry();\n setIsInstant(!!instant);\n globalWarmedUp = true;\n open();\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n globalCooldownTimeout = null;\n }\n };\n\n let hideTooltip = (immediate?: boolean, instant?: boolean) => {\n setIsInstant(!!instant);\n if (immediate || closeDelay <= 0) {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeCallback.current();\n } else if (!closeTimeout.current) {\n closeTimeout.current = setTimeout(() => {\n closeTimeout.current = null;\n closeCallback.current();\n }, closeDelay);\n }\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalWarmedUp) {\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n }\n globalCooldownTimeout = setTimeout(\n () => {\n delete tooltips[id];\n globalCooldownTimeout = null;\n globalWarmedUp = false;\n },\n Math.max(TOOLTIP_COOLDOWN, closeDelay)\n );\n }\n };\n\n let warmupTooltip = () => {\n closeOpenTooltips();\n ensureTooltipEntry();\n if (!isOpen && !globalWarmedUp) {\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n }\n\n globalWarmUpTimeout = setTimeout(() => {\n globalWarmUpTimeout = null;\n globalWarmedUp = true;\n // First tooltip in a sequence: animate in.\n showTooltip(false);\n }, delay);\n } else if (!isOpen) {\n // Already warmed up: appear instantly without an animation.\n showTooltip(true);\n }\n };\n\n useEffect(() => {\n closeCallback.current = close;\n }, [close]);\n\n useEffect(() => {\n return () => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n let tooltip = tooltips[id];\n if (tooltip) {\n delete tooltips[id];\n }\n };\n }, [id]);\n\n return {\n isOpen,\n shouldSkipAnimation,\n open: immediate => {\n if (!immediate && delay > 0 && !closeTimeout.current) {\n warmupTooltip();\n } else {\n // Immediate opens (e.g. focus, or delay of 0) appear instantly without an animation\n // only if another tooltip is already warmed up.\n showTooltip(globalWarmedUp);\n }\n },\n close: hideTooltip\n };\n}\n"],"names":[],"version":3,"file":"useTooltipTriggerState.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AA0CD,MAAM,sCAAgB,MAAM,yDAAyD;AACrF,MAAM,yCAAmB;AAoBzB,IAAI,iCAAW,CAAC;AAChB,IAAI,kCAAY;AAChB,IAAI,uCAAiB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;YAChC,aAAa,OAAO,GAAG;YACvB,cAAc,OAAO;QACvB,GAAG;QAGL,IAAI,2CAAqB;YACvB,aAAa;YACb,4CAAsB;QACxB;QACA,IAAI,sCAAgB;YAClB,IAAI,6CACF,aAAa;YAEf,8CAAwB,WACtB;gBACE,OAAO,8BAAQ,CAAC,GAAG;gBACnB,8CAAwB;gBACxB,uCAAiB;YACnB,GACA,KAAK,GAAG,CAAC,wCAAkB;QAE/B;IACF;IAEA,IAAI,gBAAgB;QAClB;QACA;QACA,IAAI,CAAC,UAAU,CAAC,sCAAgB;YAC9B,IAAI,2CACF,aAAa;YAGf,4CAAsB,WAAW;gBAC/B,4CAAsB;gBACtB,uCAAiB;gBACjB,2CAA2C;gBAC3C,YAAY;YACd,GAAG;QACL,OAAO,IAAI,CAAC,QACV,4DAA4D;QAC5D,YAAY;IAEhB;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,cAAc,OAAO,GAAG;IAC1B,GAAG;QAAC;KAAM;IAEV,CAAA,GAAA,gBAAQ,EAAE;QACR,OAAO;YACL,IAAI,aAAa,OAAO,EACtB,aAAa,aAAa,OAAO;YAEnC,IAAI,UAAU,8BAAQ,CAAC,GAAG;YAC1B,IAAI,SACF,OAAO,8BAAQ,CAAC,GAAG;QAEvB;IACF,GAAG;QAAC;KAAG;IAEP,OAAO;gBACL;6BACA;QACA,MAAM,CAAA;YACJ,IAAI,CAAC,aAAa,QAAQ,KAAK,CAAC,aAAa,OAAO,EAClD;iBAEA,oFAAoF;YACpF,gDAAgD;YAChD,YAAY;QAEhB;QACA,OAAO;IACT;AACF","sources":["packages/react-stately/src/tooltip/useTooltipTriggerState.ts"],"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 {OverlayTriggerProps, useOverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\nexport interface TooltipTriggerProps extends OverlayTriggerProps {\n /**\n * Whether the tooltip should be disabled, independent from the trigger.\n */\n isDisabled?: boolean;\n\n /**\n * The delay time for the tooltip to show up. [See\n * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).\n *\n * @default 1500\n */\n delay?: number;\n\n /**\n * The delay time for the tooltip to close. [See\n * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).\n *\n * @default 500\n */\n closeDelay?: number;\n\n /**\n * By default, opens for both focus and hover. Can be made to open only for focus.\n *\n * @default 'hover'\n */\n trigger?: 'hover' | 'focus';\n\n /**\n * Whether the tooltip should close when the trigger is pressed.\n *\n * @default true\n */\n shouldCloseOnPress?: boolean;\n}\n\nconst TOOLTIP_DELAY = 1500; // this seems to be a 1.5 second delay, check with design\nconst TOOLTIP_COOLDOWN = 500;\n\nexport interface TooltipTriggerState {\n /** Whether the tooltip is currently showing. */\n isOpen: boolean;\n /**\n * Whether the tooltip is being shown or hidden without an animation. This is true while the\n * global warmup timer is active, i.e. when quickly moving between tooltips.\n */\n shouldSkipAnimation: boolean;\n /**\n * Shows the tooltip. By default, the tooltip becomes visible after a delay\n * depending on a global warmup timer. The `immediate` option shows the\n * tooltip immediately instead.\n */\n open(immediate?: boolean): void;\n /** Hides the tooltip. */\n close(immediate?: boolean): void;\n}\n\nlet tooltips = {};\nlet tooltipId = 0;\nlet globalWarmedUp = false;\nlet globalWarmUpTimeout: ReturnType<typeof setTimeout> | null = null;\nlet globalCooldownTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides\n * methods to toggle this state. Ensures only one tooltip is open at a time and controls\n * the delay for showing a tooltip.\n */\nexport function useTooltipTriggerState(props: TooltipTriggerProps = {}): TooltipTriggerState {\n let {delay = TOOLTIP_DELAY, closeDelay = TOOLTIP_COOLDOWN} = props;\n let {isOpen, open, close} = useOverlayTriggerState(props);\n // Whether the current open/close transition should skip its animation. Set when swapping\n // between tooltips during the global warmup period.\n let [shouldSkipAnimation, setIsInstant] = useState(false);\n let id = useMemo(() => `${++tooltipId}`, []);\n let closeTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n let closeCallback = useRef<() => void>(close);\n\n let ensureTooltipEntry = () => {\n tooltips[id] = hideTooltip;\n };\n\n let closeOpenTooltips = () => {\n for (let hideTooltipId in tooltips) {\n if (hideTooltipId !== id) {\n // Close other open tooltips instantly (no exit animation), since they are being\n // replaced by this one during the warmup period.\n tooltips[hideTooltipId](true, true);\n delete tooltips[hideTooltipId];\n }\n }\n };\n\n let showTooltip = (instant?: boolean) => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeOpenTooltips();\n ensureTooltipEntry();\n setIsInstant(!!instant);\n globalWarmedUp = true;\n open();\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n globalCooldownTimeout = null;\n }\n };\n\n let hideTooltip = (immediate?: boolean, instant?: boolean) => {\n setIsInstant(!!instant);\n if (immediate || closeDelay <= 0) {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeCallback.current();\n } else if (!closeTimeout.current) {\n closeTimeout.current = setTimeout(() => {\n closeTimeout.current = null;\n closeCallback.current();\n }, closeDelay);\n }\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalWarmedUp) {\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n }\n globalCooldownTimeout = setTimeout(\n () => {\n delete tooltips[id];\n globalCooldownTimeout = null;\n globalWarmedUp = false;\n },\n Math.max(TOOLTIP_COOLDOWN, closeDelay)\n );\n }\n };\n\n let warmupTooltip = () => {\n closeOpenTooltips();\n ensureTooltipEntry();\n if (!isOpen && !globalWarmedUp) {\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n }\n\n globalWarmUpTimeout = setTimeout(() => {\n globalWarmUpTimeout = null;\n globalWarmedUp = true;\n // First tooltip in a sequence: animate in.\n showTooltip(false);\n }, delay);\n } else if (!isOpen) {\n // Already warmed up: appear instantly without an animation.\n showTooltip(true);\n }\n };\n\n useEffect(() => {\n closeCallback.current = close;\n }, [close]);\n\n useEffect(() => {\n return () => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n let tooltip = tooltips[id];\n if (tooltip) {\n delete tooltips[id];\n }\n };\n }, [id]);\n\n return {\n isOpen,\n shouldSkipAnimation,\n open: immediate => {\n if (!immediate && delay > 0 && !closeTimeout.current) {\n warmupTooltip();\n } else {\n // Immediate opens (e.g. focus, or delay of 0) appear instantly without an animation\n // only if another tooltip is already warmed up.\n showTooltip(globalWarmedUp);\n }\n },\n close: hideTooltip\n };\n}\n"],"names":[],"version":3,"file":"useTooltipTriggerState.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AA0CD,MAAM,sCAAgB,MAAM,yDAAyD;AACrF,MAAM,yCAAmB;AAoBzB,IAAI,iCAAW,CAAC;AAChB,IAAI,kCAAY;AAChB,IAAI,uCAAiB;AACrB,IAAI,4CAA4D;AAChE,IAAI,8CAA8D;AAO3D,SAAS,0CAAuB,QAA6B,CAAC,CAAC;IACpE,IAAI,SAAC,QAAQ,iDAAe,aAAa,wCAAiB,GAAG;IAC7D,IAAI,UAAC,MAAM,QAAE,IAAI,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAqB,EAAE;IACnD,yFAAyF;IACzF,oDAAoD;IACpD,I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AC,wCAAkB;QAE/B;IACF;IAEA,IAAI,gBAAgB;QAClB;QACA;QACA,IAAI,CAAC,UAAU,CAAC,sCAAgB;YAC9B,IAAI,2CACF,aAAa;YAGf,4CAAsB,WAAW;gBAC/B,4CAAsB;gBACtB,uCAAiB;gBACjB,2CAA2C;gBAC3C,YAAY;YACd,GAAG;QACL,OAAO,IAAI,CAAC,QACV,4DAA4D;QAC5D,YAAY;IAEhB;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,cAAc,OAAO,GAAG;IAC1B,GAAG;QAAC;KAAM;IAEV,CAAA,GAAA,gBAAQ,EAAE;QACR,OAAO;YACL,IAAI,aAAa,OAAO,EACtB,aAAa,aAAa,OAAO;YAEnC,IAAI,UAAU,8BAAQ,CAAC,GAAG;YAC1B,IAAI,SACF,OAAO,8BAAQ,CAAC,GAAG;QAEvB;IACF,GAAG;QAAC;KAAG;IAEP,OAAO;gBACL;6BACA;QACA,MAAM,CAAA;YACJ,IAAI,CAAC,aAAa,QAAQ,KAAK,CAAC,aAAa,OAAO,EAClD;iBAEA,oFAAoF;YACpF,gDAAgD;YAChD,YAAY;QAEhB;QACA,OAAO;IACT;AACF","sources":["packages/react-stately/src/tooltip/useTooltipTriggerState.ts"],"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 {OverlayTriggerProps, useOverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\nexport interface TooltipTriggerProps extends OverlayTriggerProps {\n /**\n * Whether the tooltip should be disabled, independent from the trigger.\n */\n isDisabled?: boolean;\n\n /**\n * The delay time for the tooltip to show up. [See\n * guidelines](https://spectrum.adobe.com/page/tooltip/#Immediate-or-delayed-appearance).\n *\n * @default 1500\n */\n delay?: number;\n\n /**\n * The delay time for the tooltip to close. [See\n * guidelines](https://spectrum.adobe.com/page/tooltip/#Warmup-and-cooldown).\n *\n * @default 500\n */\n closeDelay?: number;\n\n /**\n * By default, opens for both focus and hover. Can be made to open only for focus.\n *\n * @default 'hover'\n */\n trigger?: 'hover' | 'focus';\n\n /**\n * Whether the tooltip should close when the trigger is pressed.\n *\n * @default true\n */\n shouldCloseOnPress?: boolean;\n}\n\nconst TOOLTIP_DELAY = 1500; // this seems to be a 1.5 second delay, check with design\nconst TOOLTIP_COOLDOWN = 500;\n\nexport interface TooltipTriggerState {\n /** Whether the tooltip is currently showing. */\n isOpen: boolean;\n /**\n * Whether the tooltip is being shown or hidden without an animation. This is true while the\n * global warmup timer is active, i.e. when quickly moving between tooltips.\n */\n shouldSkipAnimation: boolean;\n /**\n * Shows the tooltip. By default, the tooltip becomes visible after a delay\n * depending on a global warmup timer. The `immediate` option shows the\n * tooltip immediately instead.\n */\n open(immediate?: boolean): void;\n /** Hides the tooltip. */\n close(immediate?: boolean): void;\n}\n\nlet tooltips = {};\nlet tooltipId = 0;\nlet globalWarmedUp = false;\nlet globalWarmUpTimeout: ReturnType<typeof setTimeout> | null = null;\nlet globalCooldownTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides\n * methods to toggle this state. Ensures only one tooltip is open at a time and controls\n * the delay for showing a tooltip.\n */\nexport function useTooltipTriggerState(props: TooltipTriggerProps = {}): TooltipTriggerState {\n let {delay = TOOLTIP_DELAY, closeDelay = TOOLTIP_COOLDOWN} = props;\n let {isOpen, open, close} = useOverlayTriggerState(props);\n // Whether the current open/close transition should skip its animation. Set when swapping\n // between tooltips during the global warmup period.\n let [shouldSkipAnimation, setIsInstant] = useState(false);\n let id = useMemo(() => `${++tooltipId}`, []);\n let closeTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n let closeCallback = useRef<() => void>(close);\n\n let ensureTooltipEntry = () => {\n tooltips[id] = hideTooltip;\n };\n\n let closeOpenTooltips = () => {\n for (let hideTooltipId in tooltips) {\n if (hideTooltipId !== id) {\n // Close other open tooltips instantly (no exit animation), since they are being\n // replaced by this one during the warmup period.\n tooltips[hideTooltipId](true, true);\n delete tooltips[hideTooltipId];\n }\n }\n };\n\n let showTooltip = (instant?: boolean) => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeOpenTooltips();\n ensureTooltipEntry();\n setIsInstant(!!instant);\n globalWarmedUp = true;\n open();\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n globalCooldownTimeout = null;\n }\n };\n\n let hideTooltip = (immediate?: boolean, instant?: boolean) => {\n setIsInstant(!!instant);\n if (immediate || closeDelay <= 0) {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeCallback.current();\n } else if (!closeTimeout.current) {\n closeTimeout.current = setTimeout(() => {\n closeTimeout.current = null;\n closeCallback.current();\n }, closeDelay);\n }\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalWarmedUp) {\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n }\n globalCooldownTimeout = setTimeout(\n () => {\n delete tooltips[id];\n globalCooldownTimeout = null;\n globalWarmedUp = false;\n },\n Math.max(TOOLTIP_COOLDOWN, closeDelay)\n );\n }\n };\n\n let warmupTooltip = () => {\n closeOpenTooltips();\n ensureTooltipEntry();\n if (!isOpen && !globalWarmedUp) {\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n }\n\n globalWarmUpTimeout = setTimeout(() => {\n globalWarmUpTimeout = null;\n globalWarmedUp = true;\n // First tooltip in a sequence: animate in.\n showTooltip(false);\n }, delay);\n } else if (!isOpen) {\n // Already warmed up: appear instantly without an animation.\n showTooltip(true);\n }\n };\n\n useEffect(() => {\n closeCallback.current = close;\n }, [close]);\n\n useEffect(() => {\n return () => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n let tooltip = tooltips[id];\n if (tooltip) {\n delete tooltips[id];\n }\n };\n }, [id]);\n\n return {\n isOpen,\n shouldSkipAnimation,\n open: immediate => {\n if (!immediate && delay > 0 && !closeTimeout.current) {\n warmupTooltip();\n } else {\n // Immediate opens (e.g. focus, or delay of 0) appear instantly without an animation\n // only if another tooltip is already warmed up.\n showTooltip(globalWarmedUp);\n }\n },\n close: hideTooltip\n };\n}\n"],"names":[],"version":3,"file":"useTooltipTriggerState.mjs.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AA0CD,MAAM,sCAAgB,MAAM,yDAAyD;AACrF,MAAM,yCAAmB;AAoBzB,IAAI,iCAAW,CAAC;AAChB,IAAI,kCAAY;AAChB,IAAI,uCAAiB;AACrB,IAAI,4CAA4D;AAChE,IAAI,8CAA8D;AAO3D,SAAS,0CAAuB,QAA6B,CAAC,CAAC;IACpE,IAAI,SAAC,QAAQ,iDAAe,aAAa,wCAAiB,GAAG;IAC7D,IAAI,UAAC,MAAM,QAAE,IAAI,SAAE,KAAK,EAAC,GAAG,CAAA,GAAA,yCAAqB,EAAE;IACnD,yFAAyF;IACzF,oDAAoD;IACpD,IAAI,CAAC,qBAAqB,aAAa,GAAG,CAAA,GAAA,eAAO,EAAE;IACnD,IAAI,KAAK,CAAA,GAAA,cAAM,EAAE,IAAM,GAAG,EAAE,iCAAW,EAAE,EAAE;IAC3C,IAAI,eAAe,CAAA,GAAA,aAAK,EAAwC;IAChE,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAc;IAEvC,IAAI,qBAAqB;QACvB,8BAAQ,CA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AEhB;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,cAAc,OAAO,GAAG;IAC1B,GAAG;QAAC;KAAM;IAEV,CAAA,GAAA,gBAAQ,EAAE;QACR,OAAO;YACL,IAAI,aAAa,OAAO,EACtB,aAAa,aAAa,OAAO;YAEnC,IAAI,UAAU,8BAAQ,CAAC,GAAG;YAC1B,IAAI,SACF,OAAO,8BAAQ,CAAC,GAAG;QAEvB;IACF,GAAG;QAAC;KAAG;IAEP,OAAO;gBACL;6BACA;QACA,MAAM,CAAA;YACJ,IAAI,CAAC,aAAa,QAAQ,KAAK,CAAC,aAAa,OAAO,EAClD;iBAEA,oFAAoF;YACpF,gDAAgD;YAChD,YAAY;QAEhB;QACA,OAAO;IACT;AACF","sources":["packages/react-stately/src/tooltip/useTooltipTriggerState.ts"],"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 {OverlayTriggerProps, useOverlayTriggerState} from '../overlays/useOverlayTriggerState';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\nexport interface TooltipTriggerProps extends OverlayTriggerProps {\n /**\n * Whether the tooltip should be disabled, independent from the trigger.\n */\n isDisabled?: boolean;\n\n /**\n * The delay time for the tooltip to show up. [See\n * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).\n *\n * @default 1500\n */\n delay?: number;\n\n /**\n * The delay time for the tooltip to close. [See\n * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).\n *\n * @default 500\n */\n closeDelay?: number;\n\n /**\n * By default, opens for both focus and hover. Can be made to open only for focus.\n *\n * @default 'hover'\n */\n trigger?: 'hover' | 'focus';\n\n /**\n * Whether the tooltip should close when the trigger is pressed.\n *\n * @default true\n */\n shouldCloseOnPress?: boolean;\n}\n\nconst TOOLTIP_DELAY = 1500; // this seems to be a 1.5 second delay, check with design\nconst TOOLTIP_COOLDOWN = 500;\n\nexport interface TooltipTriggerState {\n /** Whether the tooltip is currently showing. */\n isOpen: boolean;\n /**\n * Whether the tooltip is being shown or hidden without an animation. This is true while the\n * global warmup timer is active, i.e. when quickly moving between tooltips.\n */\n shouldSkipAnimation: boolean;\n /**\n * Shows the tooltip. By default, the tooltip becomes visible after a delay\n * depending on a global warmup timer. The `immediate` option shows the\n * tooltip immediately instead.\n */\n open(immediate?: boolean): void;\n /** Hides the tooltip. */\n close(immediate?: boolean): void;\n}\n\nlet tooltips = {};\nlet tooltipId = 0;\nlet globalWarmedUp = false;\nlet globalWarmUpTimeout: ReturnType<typeof setTimeout> | null = null;\nlet globalCooldownTimeout: ReturnType<typeof setTimeout> | null = null;\n\n/**\n * Manages state for a tooltip trigger. Tracks whether the tooltip is open, and provides\n * methods to toggle this state. Ensures only one tooltip is open at a time and controls\n * the delay for showing a tooltip.\n */\nexport function useTooltipTriggerState(props: TooltipTriggerProps = {}): TooltipTriggerState {\n let {delay = TOOLTIP_DELAY, closeDelay = TOOLTIP_COOLDOWN} = props;\n let {isOpen, open, close} = useOverlayTriggerState(props);\n // Whether the current open/close transition should skip its animation. Set when swapping\n // between tooltips during the global warmup period.\n let [shouldSkipAnimation, setIsInstant] = useState(false);\n let id = useMemo(() => `${++tooltipId}`, []);\n let closeTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n let closeCallback = useRef<() => void>(close);\n\n let ensureTooltipEntry = () => {\n tooltips[id] = hideTooltip;\n };\n\n let closeOpenTooltips = () => {\n for (let hideTooltipId in tooltips) {\n if (hideTooltipId !== id) {\n // Close other open tooltips instantly (no exit animation), since they are being\n // replaced by this one during the warmup period.\n tooltips[hideTooltipId](true, true);\n delete tooltips[hideTooltipId];\n }\n }\n };\n\n let showTooltip = (instant?: boolean) => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeOpenTooltips();\n ensureTooltipEntry();\n setIsInstant(!!instant);\n globalWarmedUp = true;\n open();\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n globalCooldownTimeout = null;\n }\n };\n\n let hideTooltip = (immediate?: boolean, instant?: boolean) => {\n setIsInstant(!!instant);\n if (immediate || closeDelay <= 0) {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n closeTimeout.current = null;\n closeCallback.current();\n } else if (!closeTimeout.current) {\n closeTimeout.current = setTimeout(() => {\n closeTimeout.current = null;\n closeCallback.current();\n }, closeDelay);\n }\n\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n globalWarmUpTimeout = null;\n }\n if (globalWarmedUp) {\n if (globalCooldownTimeout) {\n clearTimeout(globalCooldownTimeout);\n }\n globalCooldownTimeout = setTimeout(\n () => {\n delete tooltips[id];\n globalCooldownTimeout = null;\n globalWarmedUp = false;\n },\n Math.max(TOOLTIP_COOLDOWN, closeDelay)\n );\n }\n };\n\n let warmupTooltip = () => {\n closeOpenTooltips();\n ensureTooltipEntry();\n if (!isOpen && !globalWarmedUp) {\n if (globalWarmUpTimeout) {\n clearTimeout(globalWarmUpTimeout);\n }\n\n globalWarmUpTimeout = setTimeout(() => {\n globalWarmUpTimeout = null;\n globalWarmedUp = true;\n // First tooltip in a sequence: animate in.\n showTooltip(false);\n }, delay);\n } else if (!isOpen) {\n // Already warmed up: appear instantly without an animation.\n showTooltip(true);\n }\n };\n\n useEffect(() => {\n closeCallback.current = close;\n }, [close]);\n\n useEffect(() => {\n return () => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current);\n }\n let tooltip = tooltips[id];\n if (tooltip) {\n delete tooltips[id];\n }\n };\n }, [id]);\n\n return {\n isOpen,\n shouldSkipAnimation,\n open: immediate => {\n if (!immediate && delay > 0 && !closeTimeout.current) {\n warmupTooltip();\n } else {\n // Immediate opens (e.g. focus, or delay of 0) appear instantly without an animation\n // only if another tooltip is already warmed up.\n showTooltip(globalWarmedUp);\n }\n },\n close: hideTooltip\n };\n}\n"],"names":[],"version":3,"file":"useTooltipTriggerState.mjs.map"}
@@ -22,7 +22,7 @@ $parcel$export(module.exports, "useControlledState", function () { return $14ced
22
22
  * governing permissions and limitations under the License.
23
23
  */
24
24
  // Use the earliest effect possible to reset the ref below.
25
- const $14cedf286405cc4b$var$useEarlyEffect = typeof document !== 'undefined' ? (0, ($parcel$interopDefault($hngmi$react)))['useInsertionEffect'] ?? (0, ($parcel$interopDefault($hngmi$react))).useLayoutEffect : ()=>{};
25
+ const $14cedf286405cc4b$var$useEarlyEffect = typeof document !== 'undefined' || parseInt((0, ($parcel$interopDefault($hngmi$react))).version, 10) >= 19 ? (0, ($parcel$interopDefault($hngmi$react)))['useInsertionEffect'] ?? (0, ($parcel$interopDefault($hngmi$react))).useLayoutEffect : ()=>{};
26
26
  function $14cedf286405cc4b$export$40bfa8c7b0832715(value, defaultValue, onChange) {
27
27
  // Store the value in both state and a ref. The state value will only be used when uncontrolled.
28
28
  // The ref is used to track the most current value, which is passed to the function setState callback.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAID,2DAA2D;AAC3D,MAAM,uCACJ,OAAO,aAAa,cACf,CAAA,GAAA,sCAAI,CAAC,CAAC,qBAAqB,IAAI,CAAA,GAAA,sCAAI,EAAE,eAAe,GACrD,KAAO;AAYN,SAAS,0CACd,KAAQ,EACR,YAAe,EACf,QAAyC;IAEzC,gGAAgG;IAChG,sGAAsG;IACtG,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,qBAAO,EAAE,SAAS;IACpD,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAE;IAEtB,IAAI,kBAAkB,CAAA,GAAA,mBAAK,EAAE,UAAU;IACvC,IAAI,eAAe,UAAU;IAC7B,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,gBAAgB,gBAAgB,OAAO;QAC3C,IAAI,kBAAkB,gBAAgB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC7D,QAAQ,IAAI,CACV,CAAC,+BAA+B,EAAE,gBAAgB,eAAe,eAAe,IAAI,EAAE,eAAe,eAAe,eAAe,CAAC,CAAC;QAGzI,gBAAgB,OAAO,GAAG;IAC5B,GAAG;QAAC;KAAa;IAEjB,0DAA0D;IAC1D,6DAA6D;IAC7D,4FAA4F;IAC5F,IAAI,eAAe,eAAe,QAAQ;IAC1C,qCAAe;QACb,SAAS,OAAO,GAAG;IACrB;IAEA,IAAI,GAAG,YAAY,GAAG,CAAA,GAAA,uBAAS,EAAE,IAAO,CAAA,CAAC,CAAA,GAAI,CAAC;IAC9C,IAAI,WAAW,CAAA,GAAA,wBAAU,EACvB,CAAC,OAA0B,GAAG;QAC5B,4DAA4D;QAC5D,IAAI,WAAW,OAAO,UAAU,aAAa,MAAM,SAAS,OAAO,IAAI;QACvE,IAAI,CAAC,OAAO,EAAE,CAAC,SAAS,OAAO,EAAE,WAAW;YAC1C,+EAA+E;YAC/E,SAAS,OAAO,GAAG;YAEnB,cAAc;YAEd,6GAA6G;YAC7G;YAEA,sFAAsF;YACtF,6DAA6D;YAC7D,WAAW,aAAa;QAC1B;IACF,GACA;QAAC;KAAS;IAGZ,OAAO;QAAC;QAAc;KAAS;AACjC","sources":["packages/react-stately/src/utils/useControlledState.ts"],"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 React, {SetStateAction, useCallback, useEffect, useReducer, useRef, useState} from 'react';\n\n// Use the earliest effect possible to reset the ref below.\nconst useEarlyEffect: typeof React.useLayoutEffect =\n typeof document !== 'undefined'\n ? (React['useInsertionEffect'] ?? React.useLayoutEffect)\n : () => {};\n\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined>,\n defaultValue: Exclude<T, undefined> | undefined,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined> | undefined,\n defaultValue: Exclude<T, undefined>,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: T,\n defaultValue: T,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void] {\n // Store the value in both state and a ref. The state value will only be used when uncontrolled.\n // The ref is used to track the most current value, which is passed to the function setState callback.\n let [stateValue, setStateValue] = useState(value || defaultValue);\n let valueRef = useRef(stateValue);\n\n let isControlledRef = useRef(value !== undefined);\n let isControlled = value !== undefined;\n useEffect(() => {\n let wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') {\n console.warn(\n `WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled]);\n\n // After each render, update the ref to the current value.\n // This ensures that the setState callback argument is reset.\n // Note: the effect should not have any dependencies so that controlled values always reset.\n let currentValue = isControlled ? value : stateValue;\n useEarlyEffect(() => {\n valueRef.current = currentValue;\n });\n\n let [, forceUpdate] = useReducer(() => ({}), {});\n let setValue = useCallback(\n (value: SetStateAction<T>, ...args: any[]) => {\n // @ts-ignore - TS doesn't know that T cannot be a function.\n let newValue = typeof value === 'function' ? value(valueRef.current) : value;\n if (!Object.is(valueRef.current, newValue)) {\n // Update the ref so that the next setState callback has the most recent value.\n valueRef.current = newValue;\n\n setStateValue(newValue);\n\n // Always trigger a re-render, even when controlled, so that the layout effect above runs to reset the value.\n forceUpdate();\n\n // Trigger onChange. Note that if setState is called multiple times in a single event,\n // onChange will be called for each one instead of only once.\n onChange?.(newValue, ...args);\n }\n },\n [onChange]\n );\n\n return [currentValue, setValue];\n}\n"],"names":[],"version":3,"file":"useControlledState.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAID,2DAA2D;AAC3D,MAAM,uCACJ,OAAO,aAAa,eAAe,SAAS,CAAA,GAAA,sCAAI,EAAE,OAAO,EAAE,OAAO,KAC7D,CAAA,GAAA,sCAAI,CAAC,CAAC,qBAAqB,IAAI,CAAA,GAAA,sCAAI,EAAE,eAAe,GACrD,KAAO;AAYN,SAAS,0CACd,KAAQ,EACR,YAAe,EACf,QAAyC;IAEzC,gGAAgG;IAChG,sGAAsG;IACtG,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,qBAAO,EAAE,SAAS;IACpD,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAE;IAEtB,IAAI,kBAAkB,CAAA,GAAA,mBAAK,EAAE,UAAU;IACvC,IAAI,eAAe,UAAU;IAC7B,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,gBAAgB,gBAAgB,OAAO;QAC3C,IAAI,kBAAkB,gBAAgB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC7D,QAAQ,IAAI,CACV,CAAC,+BAA+B,EAAE,gBAAgB,eAAe,eAAe,IAAI,EAAE,eAAe,eAAe,eAAe,CAAC,CAAC;QAGzI,gBAAgB,OAAO,GAAG;IAC5B,GAAG;QAAC;KAAa;IAEjB,0DAA0D;IAC1D,6DAA6D;IAC7D,4FAA4F;IAC5F,IAAI,eAAe,eAAe,QAAQ;IAC1C,qCAAe;QACb,SAAS,OAAO,GAAG;IACrB;IAEA,IAAI,GAAG,YAAY,GAAG,CAAA,GAAA,uBAAS,EAAE,IAAO,CAAA,CAAC,CAAA,GAAI,CAAC;IAC9C,IAAI,WAAW,CAAA,GAAA,wBAAU,EACvB,CAAC,OAA0B,GAAG;QAC5B,4DAA4D;QAC5D,IAAI,WAAW,OAAO,UAAU,aAAa,MAAM,SAAS,OAAO,IAAI;QACvE,IAAI,CAAC,OAAO,EAAE,CAAC,SAAS,OAAO,EAAE,WAAW;YAC1C,+EAA+E;YAC/E,SAAS,OAAO,GAAG;YAEnB,cAAc;YAEd,6GAA6G;YAC7G;YAEA,sFAAsF;YACtF,6DAA6D;YAC7D,WAAW,aAAa;QAC1B;IACF,GACA;QAAC;KAAS;IAGZ,OAAO;QAAC;QAAc;KAAS;AACjC","sources":["packages/react-stately/src/utils/useControlledState.ts"],"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 React, {SetStateAction, useCallback, useEffect, useReducer, useRef, useState} from 'react';\n\n// Use the earliest effect possible to reset the ref below.\nconst useEarlyEffect: typeof React.useLayoutEffect =\n typeof document !== 'undefined' || parseInt(React.version, 10) >= 19\n ? (React['useInsertionEffect'] ?? React.useLayoutEffect)\n : () => {};\n\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined>,\n defaultValue: Exclude<T, undefined> | undefined,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined> | undefined,\n defaultValue: Exclude<T, undefined>,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: T,\n defaultValue: T,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void] {\n // Store the value in both state and a ref. The state value will only be used when uncontrolled.\n // The ref is used to track the most current value, which is passed to the function setState callback.\n let [stateValue, setStateValue] = useState(value || defaultValue);\n let valueRef = useRef(stateValue);\n\n let isControlledRef = useRef(value !== undefined);\n let isControlled = value !== undefined;\n useEffect(() => {\n let wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') {\n console.warn(\n `WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled]);\n\n // After each render, update the ref to the current value.\n // This ensures that the setState callback argument is reset.\n // Note: the effect should not have any dependencies so that controlled values always reset.\n let currentValue = isControlled ? value : stateValue;\n useEarlyEffect(() => {\n valueRef.current = currentValue;\n });\n\n let [, forceUpdate] = useReducer(() => ({}), {});\n let setValue = useCallback(\n (value: SetStateAction<T>, ...args: any[]) => {\n // @ts-ignore - TS doesn't know that T cannot be a function.\n let newValue = typeof value === 'function' ? value(valueRef.current) : value;\n if (!Object.is(valueRef.current, newValue)) {\n // Update the ref so that the next setState callback has the most recent value.\n valueRef.current = newValue;\n\n setStateValue(newValue);\n\n // Always trigger a re-render, even when controlled, so that the layout effect above runs to reset the value.\n forceUpdate();\n\n // Trigger onChange. Note that if setState is called multiple times in a single event,\n // onChange will be called for each one instead of only once.\n onChange?.(newValue, ...args);\n }\n },\n [onChange]\n );\n\n return [currentValue, setValue];\n}\n"],"names":[],"version":3,"file":"useControlledState.cjs.map"}
@@ -13,7 +13,7 @@ import $mLnuJ$react, {useState as $mLnuJ$useState, useRef as $mLnuJ$useRef, useE
13
13
  */
14
14
  var $2a35a170cf8e413e$var$_React_useInsertionEffect;
15
15
  // Use the earliest effect possible to reset the ref below.
16
- const $2a35a170cf8e413e$var$useEarlyEffect = typeof document !== 'undefined' ? ($2a35a170cf8e413e$var$_React_useInsertionEffect = (0, $mLnuJ$react)['useInsertionEffect']) !== null && $2a35a170cf8e413e$var$_React_useInsertionEffect !== void 0 ? $2a35a170cf8e413e$var$_React_useInsertionEffect : (0, $mLnuJ$react).useLayoutEffect : ()=>{};
16
+ const $2a35a170cf8e413e$var$useEarlyEffect = typeof document !== 'undefined' || parseInt((0, $mLnuJ$react).version, 10) >= 19 ? ($2a35a170cf8e413e$var$_React_useInsertionEffect = (0, $mLnuJ$react)['useInsertionEffect']) !== null && $2a35a170cf8e413e$var$_React_useInsertionEffect !== void 0 ? $2a35a170cf8e413e$var$_React_useInsertionEffect : (0, $mLnuJ$react).useLayoutEffect : ()=>{};
17
17
  function $2a35a170cf8e413e$export$40bfa8c7b0832715(value, defaultValue, onChange) {
18
18
  // Store the value in both state and a ref. The state value will only be used when uncontrolled.
19
19
  // The ref is used to track the most current value, which is passed to the function setState callback.
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;IAOM;AAHP,2DAA2D;AAC3D,MAAM,uCACJ,OAAO,aAAa,cACf,CAAA,kDAAA,CAAA,GAAA,YAAI,CAAC,CAAC,qBAAqB,cAA3B,6DAAA,kDAA+B,CAAA,GAAA,YAAI,EAAE,eAAe,GACrD,KAAO;AAYN,SAAS,0CACd,KAAQ,EACR,YAAe,EACf,QAAyC;IAEzC,gGAAgG;IAChG,sGAAsG;IACtG,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE,SAAS;IACpD,IAAI,WAAW,CAAA,GAAA,aAAK,EAAE;IAEtB,IAAI,kBAAkB,CAAA,GAAA,aAAK,EAAE,UAAU;IACvC,IAAI,eAAe,UAAU;IAC7B,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,gBAAgB,gBAAgB,OAAO;QAC3C,IAAI,kBAAkB,gBAAgB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC7D,QAAQ,IAAI,CACV,CAAC,+BAA+B,EAAE,gBAAgB,eAAe,eAAe,IAAI,EAAE,eAAe,eAAe,eAAe,CAAC,CAAC;QAGzI,gBAAgB,OAAO,GAAG;IAC5B,GAAG;QAAC;KAAa;IAEjB,0DAA0D;IAC1D,6DAA6D;IAC7D,4FAA4F;IAC5F,IAAI,eAAe,eAAe,QAAQ;IAC1C,qCAAe;QACb,SAAS,OAAO,GAAG;IACrB;IAEA,IAAI,GAAG,YAAY,GAAG,CAAA,GAAA,iBAAS,EAAE,IAAO,CAAA,CAAC,CAAA,GAAI,CAAC;IAC9C,IAAI,WAAW,CAAA,GAAA,kBAAU,EACvB,CAAC,OAA0B,GAAG;QAC5B,4DAA4D;QAC5D,IAAI,WAAW,OAAO,UAAU,aAAa,MAAM,SAAS,OAAO,IAAI;QACvE,IAAI,CAAC,OAAO,EAAE,CAAC,SAAS,OAAO,EAAE,WAAW;YAC1C,+EAA+E;YAC/E,SAAS,OAAO,GAAG;YAEnB,cAAc;YAEd,6GAA6G;YAC7G;YAEA,sFAAsF;YACtF,6DAA6D;YAC7D,qBAAA,+BAAA,SAAW,aAAa;QAC1B;IACF,GACA;QAAC;KAAS;IAGZ,OAAO;QAAC;QAAc;KAAS;AACjC","sources":["packages/react-stately/src/utils/useControlledState.ts"],"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 React, {SetStateAction, useCallback, useEffect, useReducer, useRef, useState} from 'react';\n\n// Use the earliest effect possible to reset the ref below.\nconst useEarlyEffect: typeof React.useLayoutEffect =\n typeof document !== 'undefined'\n ? (React['useInsertionEffect'] ?? React.useLayoutEffect)\n : () => {};\n\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined>,\n defaultValue: Exclude<T, undefined> | undefined,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined> | undefined,\n defaultValue: Exclude<T, undefined>,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: T,\n defaultValue: T,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void] {\n // Store the value in both state and a ref. The state value will only be used when uncontrolled.\n // The ref is used to track the most current value, which is passed to the function setState callback.\n let [stateValue, setStateValue] = useState(value || defaultValue);\n let valueRef = useRef(stateValue);\n\n let isControlledRef = useRef(value !== undefined);\n let isControlled = value !== undefined;\n useEffect(() => {\n let wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') {\n console.warn(\n `WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled]);\n\n // After each render, update the ref to the current value.\n // This ensures that the setState callback argument is reset.\n // Note: the effect should not have any dependencies so that controlled values always reset.\n let currentValue = isControlled ? value : stateValue;\n useEarlyEffect(() => {\n valueRef.current = currentValue;\n });\n\n let [, forceUpdate] = useReducer(() => ({}), {});\n let setValue = useCallback(\n (value: SetStateAction<T>, ...args: any[]) => {\n // @ts-ignore - TS doesn't know that T cannot be a function.\n let newValue = typeof value === 'function' ? value(valueRef.current) : value;\n if (!Object.is(valueRef.current, newValue)) {\n // Update the ref so that the next setState callback has the most recent value.\n valueRef.current = newValue;\n\n setStateValue(newValue);\n\n // Always trigger a re-render, even when controlled, so that the layout effect above runs to reset the value.\n forceUpdate();\n\n // Trigger onChange. Note that if setState is called multiple times in a single event,\n // onChange will be called for each one instead of only once.\n onChange?.(newValue, ...args);\n }\n },\n [onChange]\n );\n\n return [currentValue, setValue];\n}\n"],"names":[],"version":3,"file":"useControlledState.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;IAOM;AAHP,2DAA2D;AAC3D,MAAM,uCACJ,OAAO,aAAa,eAAe,SAAS,CAAA,GAAA,YAAI,EAAE,OAAO,EAAE,OAAO,KAC7D,CAAA,kDAAA,CAAA,GAAA,YAAI,CAAC,CAAC,qBAAqB,cAA3B,6DAAA,kDAA+B,CAAA,GAAA,YAAI,EAAE,eAAe,GACrD,KAAO;AAYN,SAAS,0CACd,KAAQ,EACR,YAAe,EACf,QAAyC;IAEzC,gGAAgG;IAChG,sGAAsG;IACtG,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE,SAAS;IACpD,IAAI,WAAW,CAAA,GAAA,aAAK,EAAE;IAEtB,IAAI,kBAAkB,CAAA,GAAA,aAAK,EAAE,UAAU;IACvC,IAAI,eAAe,UAAU;IAC7B,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,gBAAgB,gBAAgB,OAAO;QAC3C,IAAI,kBAAkB,gBAAgB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC7D,QAAQ,IAAI,CACV,CAAC,+BAA+B,EAAE,gBAAgB,eAAe,eAAe,IAAI,EAAE,eAAe,eAAe,eAAe,CAAC,CAAC;QAGzI,gBAAgB,OAAO,GAAG;IAC5B,GAAG;QAAC;KAAa;IAEjB,0DAA0D;IAC1D,6DAA6D;IAC7D,4FAA4F;IAC5F,IAAI,eAAe,eAAe,QAAQ;IAC1C,qCAAe;QACb,SAAS,OAAO,GAAG;IACrB;IAEA,IAAI,GAAG,YAAY,GAAG,CAAA,GAAA,iBAAS,EAAE,IAAO,CAAA,CAAC,CAAA,GAAI,CAAC;IAC9C,IAAI,WAAW,CAAA,GAAA,kBAAU,EACvB,CAAC,OAA0B,GAAG;QAC5B,4DAA4D;QAC5D,IAAI,WAAW,OAAO,UAAU,aAAa,MAAM,SAAS,OAAO,IAAI;QACvE,IAAI,CAAC,OAAO,EAAE,CAAC,SAAS,OAAO,EAAE,WAAW;YAC1C,+EAA+E;YAC/E,SAAS,OAAO,GAAG;YAEnB,cAAc;YAEd,6GAA6G;YAC7G;YAEA,sFAAsF;YACtF,6DAA6D;YAC7D,qBAAA,+BAAA,SAAW,aAAa;QAC1B;IACF,GACA;QAAC;KAAS;IAGZ,OAAO;QAAC;QAAc;KAAS;AACjC","sources":["packages/react-stately/src/utils/useControlledState.ts"],"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 React, {SetStateAction, useCallback, useEffect, useReducer, useRef, useState} from 'react';\n\n// Use the earliest effect possible to reset the ref below.\nconst useEarlyEffect: typeof React.useLayoutEffect =\n typeof document !== 'undefined' || parseInt(React.version, 10) >= 19\n ? (React['useInsertionEffect'] ?? React.useLayoutEffect)\n : () => {};\n\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined>,\n defaultValue: Exclude<T, undefined> | undefined,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined> | undefined,\n defaultValue: Exclude<T, undefined>,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: T,\n defaultValue: T,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void] {\n // Store the value in both state and a ref. The state value will only be used when uncontrolled.\n // The ref is used to track the most current value, which is passed to the function setState callback.\n let [stateValue, setStateValue] = useState(value || defaultValue);\n let valueRef = useRef(stateValue);\n\n let isControlledRef = useRef(value !== undefined);\n let isControlled = value !== undefined;\n useEffect(() => {\n let wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') {\n console.warn(\n `WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled]);\n\n // After each render, update the ref to the current value.\n // This ensures that the setState callback argument is reset.\n // Note: the effect should not have any dependencies so that controlled values always reset.\n let currentValue = isControlled ? value : stateValue;\n useEarlyEffect(() => {\n valueRef.current = currentValue;\n });\n\n let [, forceUpdate] = useReducer(() => ({}), {});\n let setValue = useCallback(\n (value: SetStateAction<T>, ...args: any[]) => {\n // @ts-ignore - TS doesn't know that T cannot be a function.\n let newValue = typeof value === 'function' ? value(valueRef.current) : value;\n if (!Object.is(valueRef.current, newValue)) {\n // Update the ref so that the next setState callback has the most recent value.\n valueRef.current = newValue;\n\n setStateValue(newValue);\n\n // Always trigger a re-render, even when controlled, so that the layout effect above runs to reset the value.\n forceUpdate();\n\n // Trigger onChange. Note that if setState is called multiple times in a single event,\n // onChange will be called for each one instead of only once.\n onChange?.(newValue, ...args);\n }\n },\n [onChange]\n );\n\n return [currentValue, setValue];\n}\n"],"names":[],"version":3,"file":"useControlledState.js.map"}
@@ -12,7 +12,7 @@ import $1CcWn$react, {useState as $1CcWn$useState, useRef as $1CcWn$useRef, useE
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
  // Use the earliest effect possible to reset the ref below.
15
- const $3e6197669829fe11$var$useEarlyEffect = typeof document !== 'undefined' ? (0, $1CcWn$react)['useInsertionEffect'] ?? (0, $1CcWn$react).useLayoutEffect : ()=>{};
15
+ const $3e6197669829fe11$var$useEarlyEffect = typeof document !== 'undefined' || parseInt((0, $1CcWn$react).version, 10) >= 19 ? (0, $1CcWn$react)['useInsertionEffect'] ?? (0, $1CcWn$react).useLayoutEffect : ()=>{};
16
16
  function $3e6197669829fe11$export$40bfa8c7b0832715(value, defaultValue, onChange) {
17
17
  // Store the value in both state and a ref. The state value will only be used when uncontrolled.
18
18
  // The ref is used to track the most current value, which is passed to the function setState callback.
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAID,2DAA2D;AAC3D,MAAM,uCACJ,OAAO,aAAa,cACf,CAAA,GAAA,YAAI,CAAC,CAAC,qBAAqB,IAAI,CAAA,GAAA,YAAI,EAAE,eAAe,GACrD,KAAO;AAYN,SAAS,0CACd,KAAQ,EACR,YAAe,EACf,QAAyC;IAEzC,gGAAgG;IAChG,sGAAsG;IACtG,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE,SAAS;IACpD,IAAI,WAAW,CAAA,GAAA,aAAK,EAAE;IAEtB,IAAI,kBAAkB,CAAA,GAAA,aAAK,EAAE,UAAU;IACvC,IAAI,eAAe,UAAU;IAC7B,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,gBAAgB,gBAAgB,OAAO;QAC3C,IAAI,kBAAkB,gBAAgB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC7D,QAAQ,IAAI,CACV,CAAC,+BAA+B,EAAE,gBAAgB,eAAe,eAAe,IAAI,EAAE,eAAe,eAAe,eAAe,CAAC,CAAC;QAGzI,gBAAgB,OAAO,GAAG;IAC5B,GAAG;QAAC;KAAa;IAEjB,0DAA0D;IAC1D,6DAA6D;IAC7D,4FAA4F;IAC5F,IAAI,eAAe,eAAe,QAAQ;IAC1C,qCAAe;QACb,SAAS,OAAO,GAAG;IACrB;IAEA,IAAI,GAAG,YAAY,GAAG,CAAA,GAAA,iBAAS,EAAE,IAAO,CAAA,CAAC,CAAA,GAAI,CAAC;IAC9C,IAAI,WAAW,CAAA,GAAA,kBAAU,EACvB,CAAC,OAA0B,GAAG;QAC5B,4DAA4D;QAC5D,IAAI,WAAW,OAAO,UAAU,aAAa,MAAM,SAAS,OAAO,IAAI;QACvE,IAAI,CAAC,OAAO,EAAE,CAAC,SAAS,OAAO,EAAE,WAAW;YAC1C,+EAA+E;YAC/E,SAAS,OAAO,GAAG;YAEnB,cAAc;YAEd,6GAA6G;YAC7G;YAEA,sFAAsF;YACtF,6DAA6D;YAC7D,WAAW,aAAa;QAC1B;IACF,GACA;QAAC;KAAS;IAGZ,OAAO;QAAC;QAAc;KAAS;AACjC","sources":["packages/react-stately/src/utils/useControlledState.ts"],"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 React, {SetStateAction, useCallback, useEffect, useReducer, useRef, useState} from 'react';\n\n// Use the earliest effect possible to reset the ref below.\nconst useEarlyEffect: typeof React.useLayoutEffect =\n typeof document !== 'undefined'\n ? (React['useInsertionEffect'] ?? React.useLayoutEffect)\n : () => {};\n\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined>,\n defaultValue: Exclude<T, undefined> | undefined,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined> | undefined,\n defaultValue: Exclude<T, undefined>,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: T,\n defaultValue: T,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void] {\n // Store the value in both state and a ref. The state value will only be used when uncontrolled.\n // The ref is used to track the most current value, which is passed to the function setState callback.\n let [stateValue, setStateValue] = useState(value || defaultValue);\n let valueRef = useRef(stateValue);\n\n let isControlledRef = useRef(value !== undefined);\n let isControlled = value !== undefined;\n useEffect(() => {\n let wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') {\n console.warn(\n `WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled]);\n\n // After each render, update the ref to the current value.\n // This ensures that the setState callback argument is reset.\n // Note: the effect should not have any dependencies so that controlled values always reset.\n let currentValue = isControlled ? value : stateValue;\n useEarlyEffect(() => {\n valueRef.current = currentValue;\n });\n\n let [, forceUpdate] = useReducer(() => ({}), {});\n let setValue = useCallback(\n (value: SetStateAction<T>, ...args: any[]) => {\n // @ts-ignore - TS doesn't know that T cannot be a function.\n let newValue = typeof value === 'function' ? value(valueRef.current) : value;\n if (!Object.is(valueRef.current, newValue)) {\n // Update the ref so that the next setState callback has the most recent value.\n valueRef.current = newValue;\n\n setStateValue(newValue);\n\n // Always trigger a re-render, even when controlled, so that the layout effect above runs to reset the value.\n forceUpdate();\n\n // Trigger onChange. Note that if setState is called multiple times in a single event,\n // onChange will be called for each one instead of only once.\n onChange?.(newValue, ...args);\n }\n },\n [onChange]\n );\n\n return [currentValue, setValue];\n}\n"],"names":[],"version":3,"file":"useControlledState.mjs.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAID,2DAA2D;AAC3D,MAAM,uCACJ,OAAO,aAAa,eAAe,SAAS,CAAA,GAAA,YAAI,EAAE,OAAO,EAAE,OAAO,KAC7D,CAAA,GAAA,YAAI,CAAC,CAAC,qBAAqB,IAAI,CAAA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cesContent":["/*\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 React, {SetStateAction, useCallback, useEffect, useReducer, useRef, useState} from 'react';\n\n// Use the earliest effect possible to reset the ref below.\nconst useEarlyEffect: typeof React.useLayoutEffect =\n typeof document !== 'undefined' || parseInt(React.version, 10) >= 19\n ? (React['useInsertionEffect'] ?? React.useLayoutEffect)\n : () => {};\n\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined>,\n defaultValue: Exclude<T, undefined> | undefined,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: Exclude<T, undefined> | undefined,\n defaultValue: Exclude<T, undefined>,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void];\nexport function useControlledState<T, C = T>(\n value: T,\n defaultValue: T,\n onChange?: (v: C, ...args: any[]) => void\n): [T, (value: SetStateAction<T>, ...args: any[]) => void] {\n // Store the value in both state and a ref. The state value will only be used when uncontrolled.\n // The ref is used to track the most current value, which is passed to the function setState callback.\n let [stateValue, setStateValue] = useState(value || defaultValue);\n let valueRef = useRef(stateValue);\n\n let isControlledRef = useRef(value !== undefined);\n let isControlled = value !== undefined;\n useEffect(() => {\n let wasControlled = isControlledRef.current;\n if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') {\n console.warn(\n `WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`\n );\n }\n isControlledRef.current = isControlled;\n }, [isControlled]);\n\n // After each render, update the ref to the current value.\n // This ensures that the setState callback argument is reset.\n // Note: the effect should not have any dependencies so that controlled values always reset.\n let currentValue = isControlled ? value : stateValue;\n useEarlyEffect(() => {\n valueRef.current = currentValue;\n });\n\n let [, forceUpdate] = useReducer(() => ({}), {});\n let setValue = useCallback(\n (value: SetStateAction<T>, ...args: any[]) => {\n // @ts-ignore - TS doesn't know that T cannot be a function.\n let newValue = typeof value === 'function' ? value(valueRef.current) : value;\n if (!Object.is(valueRef.current, newValue)) {\n // Update the ref so that the next setState callback has the most recent value.\n valueRef.current = newValue;\n\n setStateValue(newValue);\n\n // Always trigger a re-render, even when controlled, so that the layout effect above runs to reset the value.\n forceUpdate();\n\n // Trigger onChange. Note that if setState is called multiple times in a single event,\n // onChange will be called for each one instead of only once.\n onChange?.(newValue, ...args);\n }\n },\n [onChange]\n );\n\n return [currentValue, setValue];\n}\n"],"names":[],"version":3,"file":"useControlledState.mjs.map"}
@@ -6,14 +6,14 @@ export interface TooltipTriggerProps extends OverlayTriggerProps {
6
6
  isDisabled?: boolean;
7
7
  /**
8
8
  * The delay time for the tooltip to show up. [See
9
- * guidelines](https://spectrum.adobe.com/page/tooltip/#Immediate-or-delayed-appearance).
9
+ * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).
10
10
  *
11
11
  * @default 1500
12
12
  */
13
13
  delay?: number;
14
14
  /**
15
15
  * The delay time for the tooltip to close. [See
16
- * guidelines](https://spectrum.adobe.com/page/tooltip/#Warmup-and-cooldown).
16
+ * guidelines](https://spectrum.adobe.com/web/rsp/components/tooltip#behaviors).
17
17
  *
18
18
  * @default 500
19
19
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-stately",
3
- "version": "3.50.0",
3
+ "version": "3.51.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/exports/index.cjs",
@@ -39,9 +39,9 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@internationalized/date": "^3.12.4",
42
- "@internationalized/number": "^3.6.8",
42
+ "@internationalized/number": "^3.6.9",
43
43
  "@internationalized/string": "^3.2.10",
44
- "@react-types/shared": "^3.36.1",
44
+ "@react-types/shared": "^3.37.0",
45
45
  "@swc/helpers": "^0.5.0",
46
46
  "use-sync-external-store": "^1.6.0"
47
47
  },
@@ -95,5 +95,5 @@
95
95
  }
96
96
  }
97
97
  },
98
- "gitHead": "0a2a7e68e4d896b3ac46c3647fe48fac9ea3ae2e"
98
+ "gitHead": "1abc52dd5ad238143f168912963ff3ad932547a4"
99
99
  }