@react-spectrum/utils 3.12.11 → 3.13.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.
- package/dist/import.mjs +13 -11
- package/dist/main.js +42 -40
- package/dist/main.js.map +1 -1
- package/dist/module.js +13 -11
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +12 -0
- package/package.json +15 -15
- package/src/index.ts +13 -21
- package/dist/BreakpointProvider.main.js +0 -75
- package/dist/BreakpointProvider.main.js.map +0 -1
- package/dist/BreakpointProvider.mjs +0 -64
- package/dist/BreakpointProvider.module.js +0 -64
- package/dist/BreakpointProvider.module.js.map +0 -1
- package/dist/Slots.main.js +0 -75
- package/dist/Slots.main.js.map +0 -1
- package/dist/Slots.mjs +0 -63
- package/dist/Slots.module.js +0 -63
- package/dist/Slots.module.js.map +0 -1
- package/dist/classNames.main.js +0 -50
- package/dist/classNames.main.js.map +0 -1
- package/dist/classNames.mjs +0 -39
- package/dist/classNames.module.js +0 -39
- package/dist/classNames.module.js.map +0 -1
- package/dist/getWrappedElement.main.js +0 -32
- package/dist/getWrappedElement.main.js.map +0 -1
- package/dist/getWrappedElement.mjs +0 -23
- package/dist/getWrappedElement.module.js +0 -23
- package/dist/getWrappedElement.module.js.map +0 -1
- package/dist/styleProps.main.js +0 -468
- package/dist/styleProps.main.js.map +0 -1
- package/dist/styleProps.mjs +0 -456
- package/dist/styleProps.module.js +0 -456
- package/dist/styleProps.module.js.map +0 -1
- package/dist/types.d.ts +0 -75
- package/dist/types.d.ts.map +0 -1
- package/dist/useDOMRef.main.js +0 -64
- package/dist/useDOMRef.main.js.map +0 -1
- package/dist/useDOMRef.mjs +0 -54
- package/dist/useDOMRef.module.js +0 -54
- package/dist/useDOMRef.module.js.map +0 -1
- package/dist/useHasChild.main.js +0 -35
- package/dist/useHasChild.main.js.map +0 -1
- package/dist/useHasChild.mjs +0 -30
- package/dist/useHasChild.module.js +0 -30
- package/dist/useHasChild.module.js.map +0 -1
- package/dist/useIsMobileDevice.main.js +0 -28
- package/dist/useIsMobileDevice.main.js.map +0 -1
- package/dist/useIsMobileDevice.mjs +0 -23
- package/dist/useIsMobileDevice.module.js +0 -23
- package/dist/useIsMobileDevice.module.js.map +0 -1
- package/dist/useMediaQuery.main.js +0 -46
- package/dist/useMediaQuery.main.js.map +0 -1
- package/dist/useMediaQuery.mjs +0 -41
- package/dist/useMediaQuery.module.js +0 -41
- package/dist/useMediaQuery.module.js.map +0 -1
- package/src/BreakpointProvider.tsx +0 -92
- package/src/Slots.tsx +0 -75
- package/src/classNames.ts +0 -58
- package/src/getWrappedElement.tsx +0 -23
- package/src/styleProps.ts +0 -315
- package/src/useDOMRef.ts +0 -57
- package/src/useHasChild.ts +0 -23
- package/src/useIsMobileDevice.ts +0 -24
- package/src/useMediaQuery.ts +0 -44
package/dist/import.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {getWrappedElement as $
|
|
3
|
-
import {useMediaQuery as $
|
|
4
|
-
import {createDOMRef as $
|
|
5
|
-
import {baseStyleProps as $
|
|
6
|
-
import {
|
|
7
|
-
import {useHasChild as $
|
|
8
|
-
import {useIsMobileDevice as $
|
|
9
|
-
import {BreakpointProvider as $
|
|
10
|
-
import {useValueEffect as $
|
|
1
|
+
import {shouldKeepSpectrumClassNames as $3be06b86be7cc064$re_export$shouldKeepSpectrumClassNames, keepSpectrumClassNames as $3be06b86be7cc064$re_export$keepSpectrumClassNames, classNames as $3be06b86be7cc064$re_export$classNames} from "@adobe/react-spectrum/private/utils/classNames";
|
|
2
|
+
import {getWrappedElement as $3be06b86be7cc064$re_export$getWrappedElement} from "@adobe/react-spectrum/private/utils/getWrappedElement";
|
|
3
|
+
import {useMediaQuery as $3be06b86be7cc064$re_export$useMediaQuery} from "@adobe/react-spectrum/private/utils/useMediaQuery";
|
|
4
|
+
import {createDOMRef as $3be06b86be7cc064$re_export$createDOMRef, createFocusableRef as $3be06b86be7cc064$re_export$createFocusableRef, useDOMRef as $3be06b86be7cc064$re_export$useDOMRef, useFocusableRef as $3be06b86be7cc064$re_export$useFocusableRef, unwrapDOMRef as $3be06b86be7cc064$re_export$unwrapDOMRef, useUnwrapDOMRef as $3be06b86be7cc064$re_export$useUnwrapDOMRef} from "@adobe/react-spectrum/private/utils/useDOMRef";
|
|
5
|
+
import {baseStyleProps as $3be06b86be7cc064$re_export$baseStyleProps, viewStyleProps as $3be06b86be7cc064$re_export$viewStyleProps, dimensionValue as $3be06b86be7cc064$re_export$dimensionValue, responsiveDimensionValue as $3be06b86be7cc064$re_export$responsiveDimensionValue, convertStyleProps as $3be06b86be7cc064$re_export$convertStyleProps, useStyleProps as $3be06b86be7cc064$re_export$useStyleProps, passthroughStyle as $3be06b86be7cc064$re_export$passthroughStyle, getResponsiveProp as $3be06b86be7cc064$re_export$getResponsiveProp} from "@adobe/react-spectrum/private/utils/styleProps";
|
|
6
|
+
import {useSlotProps as $3be06b86be7cc064$re_export$useSlotProps, cssModuleToSlots as $3be06b86be7cc064$re_export$cssModuleToSlots, SlotProvider as $3be06b86be7cc064$re_export$SlotProvider, ClearSlots as $3be06b86be7cc064$re_export$ClearSlots} from "@adobe/react-spectrum/private/utils/Slots";
|
|
7
|
+
import {useHasChild as $3be06b86be7cc064$re_export$useHasChild} from "@adobe/react-spectrum/private/utils/useHasChild";
|
|
8
|
+
import {useIsMobileDevice as $3be06b86be7cc064$re_export$useIsMobileDevice} from "@adobe/react-spectrum/private/utils/useIsMobileDevice";
|
|
9
|
+
import {BreakpointProvider as $3be06b86be7cc064$re_export$BreakpointProvider, useMatchedBreakpoints as $3be06b86be7cc064$re_export$useMatchedBreakpoints, useBreakpoint as $3be06b86be7cc064$re_export$useBreakpoint} from "@adobe/react-spectrum/private/utils/BreakpointProvider";
|
|
10
|
+
import {useValueEffect as $3be06b86be7cc064$re_export$useValueEffect} from "react-aria/private/utils/useValueEffect";
|
|
11
|
+
import {useResizeObserver as $3be06b86be7cc064$re_export$useResizeObserver} from "react-aria/private/utils/useResizeObserver";
|
|
11
12
|
|
|
12
13
|
/*
|
|
13
14
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -32,5 +33,6 @@ import {useValueEffect as $857d64dbfd73d664$re_export$useValueEffect, useResizeO
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
|
|
37
|
+
export {$3be06b86be7cc064$re_export$shouldKeepSpectrumClassNames as shouldKeepSpectrumClassNames, $3be06b86be7cc064$re_export$keepSpectrumClassNames as keepSpectrumClassNames, $3be06b86be7cc064$re_export$classNames as classNames, $3be06b86be7cc064$re_export$getWrappedElement as getWrappedElement, $3be06b86be7cc064$re_export$useMediaQuery as useMediaQuery, $3be06b86be7cc064$re_export$createDOMRef as createDOMRef, $3be06b86be7cc064$re_export$createFocusableRef as createFocusableRef, $3be06b86be7cc064$re_export$useDOMRef as useDOMRef, $3be06b86be7cc064$re_export$useFocusableRef as useFocusableRef, $3be06b86be7cc064$re_export$unwrapDOMRef as unwrapDOMRef, $3be06b86be7cc064$re_export$useUnwrapDOMRef as useUnwrapDOMRef, $3be06b86be7cc064$re_export$baseStyleProps as baseStyleProps, $3be06b86be7cc064$re_export$viewStyleProps as viewStyleProps, $3be06b86be7cc064$re_export$dimensionValue as dimensionValue, $3be06b86be7cc064$re_export$responsiveDimensionValue as responsiveDimensionValue, $3be06b86be7cc064$re_export$convertStyleProps as convertStyleProps, $3be06b86be7cc064$re_export$useStyleProps as useStyleProps, $3be06b86be7cc064$re_export$passthroughStyle as passthroughStyle, $3be06b86be7cc064$re_export$getResponsiveProp as getResponsiveProp, $3be06b86be7cc064$re_export$useSlotProps as useSlotProps, $3be06b86be7cc064$re_export$cssModuleToSlots as cssModuleToSlots, $3be06b86be7cc064$re_export$SlotProvider as SlotProvider, $3be06b86be7cc064$re_export$ClearSlots as ClearSlots, $3be06b86be7cc064$re_export$useHasChild as useHasChild, $3be06b86be7cc064$re_export$useIsMobileDevice as useIsMobileDevice, $3be06b86be7cc064$re_export$BreakpointProvider as BreakpointProvider, $3be06b86be7cc064$re_export$useMatchedBreakpoints as useMatchedBreakpoints, $3be06b86be7cc064$re_export$useBreakpoint as useBreakpoint, $3be06b86be7cc064$re_export$useValueEffect as useValueEffect, $3be06b86be7cc064$re_export$useResizeObserver as useResizeObserver};
|
|
36
38
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
5
|
-
var $
|
|
6
|
-
var $
|
|
7
|
-
var $
|
|
8
|
-
var $
|
|
9
|
-
var $
|
|
10
|
-
var $
|
|
1
|
+
var $gh77R$adobereactspectrumprivateutilsclassNames = require("@adobe/react-spectrum/private/utils/classNames");
|
|
2
|
+
var $gh77R$adobereactspectrumprivateutilsgetWrappedElement = require("@adobe/react-spectrum/private/utils/getWrappedElement");
|
|
3
|
+
var $gh77R$adobereactspectrumprivateutilsuseMediaQuery = require("@adobe/react-spectrum/private/utils/useMediaQuery");
|
|
4
|
+
var $gh77R$adobereactspectrumprivateutilsuseDOMRef = require("@adobe/react-spectrum/private/utils/useDOMRef");
|
|
5
|
+
var $gh77R$adobereactspectrumprivateutilsstyleProps = require("@adobe/react-spectrum/private/utils/styleProps");
|
|
6
|
+
var $gh77R$adobereactspectrumprivateutilsSlots = require("@adobe/react-spectrum/private/utils/Slots");
|
|
7
|
+
var $gh77R$adobereactspectrumprivateutilsuseHasChild = require("@adobe/react-spectrum/private/utils/useHasChild");
|
|
8
|
+
var $gh77R$adobereactspectrumprivateutilsuseIsMobileDevice = require("@adobe/react-spectrum/private/utils/useIsMobileDevice");
|
|
9
|
+
var $gh77R$adobereactspectrumprivateutilsBreakpointProvider = require("@adobe/react-spectrum/private/utils/BreakpointProvider");
|
|
10
|
+
var $gh77R$reactariaprivateutilsuseValueEffect = require("react-aria/private/utils/useValueEffect");
|
|
11
|
+
var $gh77R$reactariaprivateutilsuseResizeObserver = require("react-aria/private/utils/useResizeObserver");
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
function $parcel$export(e, n, v, s) {
|
|
14
15
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
$parcel$export(module.exports, "shouldKeepSpectrumClassNames", ()
|
|
18
|
-
$parcel$export(module.exports, "keepSpectrumClassNames", ()
|
|
19
|
-
$parcel$export(module.exports, "classNames", ()
|
|
20
|
-
$parcel$export(module.exports, "getWrappedElement", ()
|
|
21
|
-
$parcel$export(module.exports, "useMediaQuery", ()
|
|
22
|
-
$parcel$export(module.exports, "createDOMRef", ()
|
|
23
|
-
$parcel$export(module.exports, "createFocusableRef", ()
|
|
24
|
-
$parcel$export(module.exports, "useDOMRef", ()
|
|
25
|
-
$parcel$export(module.exports, "useFocusableRef", ()
|
|
26
|
-
$parcel$export(module.exports, "unwrapDOMRef", ()
|
|
27
|
-
$parcel$export(module.exports, "useUnwrapDOMRef", ()
|
|
28
|
-
$parcel$export(module.exports, "baseStyleProps", ()
|
|
29
|
-
$parcel$export(module.exports, "viewStyleProps", ()
|
|
30
|
-
$parcel$export(module.exports, "dimensionValue", ()
|
|
31
|
-
$parcel$export(module.exports, "responsiveDimensionValue", ()
|
|
32
|
-
$parcel$export(module.exports, "convertStyleProps", ()
|
|
33
|
-
$parcel$export(module.exports, "useStyleProps", ()
|
|
34
|
-
$parcel$export(module.exports, "passthroughStyle", ()
|
|
35
|
-
$parcel$export(module.exports, "getResponsiveProp", ()
|
|
36
|
-
$parcel$export(module.exports, "useSlotProps", ()
|
|
37
|
-
$parcel$export(module.exports, "cssModuleToSlots", ()
|
|
38
|
-
$parcel$export(module.exports, "SlotProvider", ()
|
|
39
|
-
$parcel$export(module.exports, "ClearSlots", ()
|
|
40
|
-
$parcel$export(module.exports, "useHasChild", ()
|
|
41
|
-
$parcel$export(module.exports, "useIsMobileDevice", ()
|
|
42
|
-
$parcel$export(module.exports, "
|
|
43
|
-
$parcel$export(module.exports, "
|
|
44
|
-
$parcel$export(module.exports, "
|
|
45
|
-
$parcel$export(module.exports, "
|
|
46
|
-
$parcel$export(module.exports, "useResizeObserver", ()
|
|
18
|
+
$parcel$export(module.exports, "shouldKeepSpectrumClassNames", function () { return $gh77R$adobereactspectrumprivateutilsclassNames.shouldKeepSpectrumClassNames; });
|
|
19
|
+
$parcel$export(module.exports, "keepSpectrumClassNames", function () { return $gh77R$adobereactspectrumprivateutilsclassNames.keepSpectrumClassNames; });
|
|
20
|
+
$parcel$export(module.exports, "classNames", function () { return $gh77R$adobereactspectrumprivateutilsclassNames.classNames; });
|
|
21
|
+
$parcel$export(module.exports, "getWrappedElement", function () { return $gh77R$adobereactspectrumprivateutilsgetWrappedElement.getWrappedElement; });
|
|
22
|
+
$parcel$export(module.exports, "useMediaQuery", function () { return $gh77R$adobereactspectrumprivateutilsuseMediaQuery.useMediaQuery; });
|
|
23
|
+
$parcel$export(module.exports, "createDOMRef", function () { return $gh77R$adobereactspectrumprivateutilsuseDOMRef.createDOMRef; });
|
|
24
|
+
$parcel$export(module.exports, "createFocusableRef", function () { return $gh77R$adobereactspectrumprivateutilsuseDOMRef.createFocusableRef; });
|
|
25
|
+
$parcel$export(module.exports, "useDOMRef", function () { return $gh77R$adobereactspectrumprivateutilsuseDOMRef.useDOMRef; });
|
|
26
|
+
$parcel$export(module.exports, "useFocusableRef", function () { return $gh77R$adobereactspectrumprivateutilsuseDOMRef.useFocusableRef; });
|
|
27
|
+
$parcel$export(module.exports, "unwrapDOMRef", function () { return $gh77R$adobereactspectrumprivateutilsuseDOMRef.unwrapDOMRef; });
|
|
28
|
+
$parcel$export(module.exports, "useUnwrapDOMRef", function () { return $gh77R$adobereactspectrumprivateutilsuseDOMRef.useUnwrapDOMRef; });
|
|
29
|
+
$parcel$export(module.exports, "baseStyleProps", function () { return $gh77R$adobereactspectrumprivateutilsstyleProps.baseStyleProps; });
|
|
30
|
+
$parcel$export(module.exports, "viewStyleProps", function () { return $gh77R$adobereactspectrumprivateutilsstyleProps.viewStyleProps; });
|
|
31
|
+
$parcel$export(module.exports, "dimensionValue", function () { return $gh77R$adobereactspectrumprivateutilsstyleProps.dimensionValue; });
|
|
32
|
+
$parcel$export(module.exports, "responsiveDimensionValue", function () { return $gh77R$adobereactspectrumprivateutilsstyleProps.responsiveDimensionValue; });
|
|
33
|
+
$parcel$export(module.exports, "convertStyleProps", function () { return $gh77R$adobereactspectrumprivateutilsstyleProps.convertStyleProps; });
|
|
34
|
+
$parcel$export(module.exports, "useStyleProps", function () { return $gh77R$adobereactspectrumprivateutilsstyleProps.useStyleProps; });
|
|
35
|
+
$parcel$export(module.exports, "passthroughStyle", function () { return $gh77R$adobereactspectrumprivateutilsstyleProps.passthroughStyle; });
|
|
36
|
+
$parcel$export(module.exports, "getResponsiveProp", function () { return $gh77R$adobereactspectrumprivateutilsstyleProps.getResponsiveProp; });
|
|
37
|
+
$parcel$export(module.exports, "useSlotProps", function () { return $gh77R$adobereactspectrumprivateutilsSlots.useSlotProps; });
|
|
38
|
+
$parcel$export(module.exports, "cssModuleToSlots", function () { return $gh77R$adobereactspectrumprivateutilsSlots.cssModuleToSlots; });
|
|
39
|
+
$parcel$export(module.exports, "SlotProvider", function () { return $gh77R$adobereactspectrumprivateutilsSlots.SlotProvider; });
|
|
40
|
+
$parcel$export(module.exports, "ClearSlots", function () { return $gh77R$adobereactspectrumprivateutilsSlots.ClearSlots; });
|
|
41
|
+
$parcel$export(module.exports, "useHasChild", function () { return $gh77R$adobereactspectrumprivateutilsuseHasChild.useHasChild; });
|
|
42
|
+
$parcel$export(module.exports, "useIsMobileDevice", function () { return $gh77R$adobereactspectrumprivateutilsuseIsMobileDevice.useIsMobileDevice; });
|
|
43
|
+
$parcel$export(module.exports, "BreakpointProvider", function () { return $gh77R$adobereactspectrumprivateutilsBreakpointProvider.BreakpointProvider; });
|
|
44
|
+
$parcel$export(module.exports, "useMatchedBreakpoints", function () { return $gh77R$adobereactspectrumprivateutilsBreakpointProvider.useMatchedBreakpoints; });
|
|
45
|
+
$parcel$export(module.exports, "useBreakpoint", function () { return $gh77R$adobereactspectrumprivateutilsBreakpointProvider.useBreakpoint; });
|
|
46
|
+
$parcel$export(module.exports, "useValueEffect", function () { return $gh77R$reactariaprivateutilsuseValueEffect.useValueEffect; });
|
|
47
|
+
$parcel$export(module.exports, "useResizeObserver", function () { return $gh77R$reactariaprivateutilsuseResizeObserver.useResizeObserver; });
|
|
47
48
|
/*
|
|
48
49
|
* Copyright 2020 Adobe. All rights reserved.
|
|
49
50
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -67,4 +68,5 @@ $parcel$export(module.exports, "useResizeObserver", () => $cRUfp$reactariautils.
|
|
|
67
68
|
|
|
68
69
|
|
|
69
70
|
|
|
71
|
+
|
|
70
72
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/utils/src/index.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\n/// <reference types=\"css-module-types\" />\n\nexport {shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames} from '@adobe/react-spectrum/private/utils/classNames';\n\nexport {getWrappedElement} from '@adobe/react-spectrum/private/utils/getWrappedElement';\nexport {useMediaQuery} from '@adobe/react-spectrum/private/utils/useMediaQuery';\nexport {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from '@adobe/react-spectrum/private/utils/useDOMRef';\nexport {baseStyleProps, viewStyleProps, dimensionValue, responsiveDimensionValue, convertStyleProps, useStyleProps, passthroughStyle, getResponsiveProp} from '@adobe/react-spectrum/private/utils/styleProps';\nexport {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from '@adobe/react-spectrum/private/utils/Slots';\nexport {useHasChild} from '@adobe/react-spectrum/private/utils/useHasChild';\nexport {useIsMobileDevice} from '@adobe/react-spectrum/private/utils/useIsMobileDevice';\nexport {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from '@adobe/react-spectrum/private/utils/BreakpointProvider';\nexport type {StyleHandlers} from '@adobe/react-spectrum/private/utils/styleProps';\nexport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\nexport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {getWrappedElement as $
|
|
3
|
-
import {useMediaQuery as $
|
|
4
|
-
import {createDOMRef as $
|
|
5
|
-
import {baseStyleProps as $
|
|
6
|
-
import {
|
|
7
|
-
import {useHasChild as $
|
|
8
|
-
import {useIsMobileDevice as $
|
|
9
|
-
import {BreakpointProvider as $
|
|
10
|
-
import {useValueEffect as $
|
|
1
|
+
import {shouldKeepSpectrumClassNames as $3be06b86be7cc064$re_export$shouldKeepSpectrumClassNames, keepSpectrumClassNames as $3be06b86be7cc064$re_export$keepSpectrumClassNames, classNames as $3be06b86be7cc064$re_export$classNames} from "@adobe/react-spectrum/private/utils/classNames";
|
|
2
|
+
import {getWrappedElement as $3be06b86be7cc064$re_export$getWrappedElement} from "@adobe/react-spectrum/private/utils/getWrappedElement";
|
|
3
|
+
import {useMediaQuery as $3be06b86be7cc064$re_export$useMediaQuery} from "@adobe/react-spectrum/private/utils/useMediaQuery";
|
|
4
|
+
import {createDOMRef as $3be06b86be7cc064$re_export$createDOMRef, createFocusableRef as $3be06b86be7cc064$re_export$createFocusableRef, useDOMRef as $3be06b86be7cc064$re_export$useDOMRef, useFocusableRef as $3be06b86be7cc064$re_export$useFocusableRef, unwrapDOMRef as $3be06b86be7cc064$re_export$unwrapDOMRef, useUnwrapDOMRef as $3be06b86be7cc064$re_export$useUnwrapDOMRef} from "@adobe/react-spectrum/private/utils/useDOMRef";
|
|
5
|
+
import {baseStyleProps as $3be06b86be7cc064$re_export$baseStyleProps, viewStyleProps as $3be06b86be7cc064$re_export$viewStyleProps, dimensionValue as $3be06b86be7cc064$re_export$dimensionValue, responsiveDimensionValue as $3be06b86be7cc064$re_export$responsiveDimensionValue, convertStyleProps as $3be06b86be7cc064$re_export$convertStyleProps, useStyleProps as $3be06b86be7cc064$re_export$useStyleProps, passthroughStyle as $3be06b86be7cc064$re_export$passthroughStyle, getResponsiveProp as $3be06b86be7cc064$re_export$getResponsiveProp} from "@adobe/react-spectrum/private/utils/styleProps";
|
|
6
|
+
import {useSlotProps as $3be06b86be7cc064$re_export$useSlotProps, cssModuleToSlots as $3be06b86be7cc064$re_export$cssModuleToSlots, SlotProvider as $3be06b86be7cc064$re_export$SlotProvider, ClearSlots as $3be06b86be7cc064$re_export$ClearSlots} from "@adobe/react-spectrum/private/utils/Slots";
|
|
7
|
+
import {useHasChild as $3be06b86be7cc064$re_export$useHasChild} from "@adobe/react-spectrum/private/utils/useHasChild";
|
|
8
|
+
import {useIsMobileDevice as $3be06b86be7cc064$re_export$useIsMobileDevice} from "@adobe/react-spectrum/private/utils/useIsMobileDevice";
|
|
9
|
+
import {BreakpointProvider as $3be06b86be7cc064$re_export$BreakpointProvider, useMatchedBreakpoints as $3be06b86be7cc064$re_export$useMatchedBreakpoints, useBreakpoint as $3be06b86be7cc064$re_export$useBreakpoint} from "@adobe/react-spectrum/private/utils/BreakpointProvider";
|
|
10
|
+
import {useValueEffect as $3be06b86be7cc064$re_export$useValueEffect} from "react-aria/private/utils/useValueEffect";
|
|
11
|
+
import {useResizeObserver as $3be06b86be7cc064$re_export$useResizeObserver} from "react-aria/private/utils/useResizeObserver";
|
|
11
12
|
|
|
12
13
|
/*
|
|
13
14
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -32,5 +33,6 @@ import {useValueEffect as $857d64dbfd73d664$re_export$useValueEffect, useResizeO
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
|
|
37
|
+
export {$3be06b86be7cc064$re_export$shouldKeepSpectrumClassNames as shouldKeepSpectrumClassNames, $3be06b86be7cc064$re_export$keepSpectrumClassNames as keepSpectrumClassNames, $3be06b86be7cc064$re_export$classNames as classNames, $3be06b86be7cc064$re_export$getWrappedElement as getWrappedElement, $3be06b86be7cc064$re_export$useMediaQuery as useMediaQuery, $3be06b86be7cc064$re_export$createDOMRef as createDOMRef, $3be06b86be7cc064$re_export$createFocusableRef as createFocusableRef, $3be06b86be7cc064$re_export$useDOMRef as useDOMRef, $3be06b86be7cc064$re_export$useFocusableRef as useFocusableRef, $3be06b86be7cc064$re_export$unwrapDOMRef as unwrapDOMRef, $3be06b86be7cc064$re_export$useUnwrapDOMRef as useUnwrapDOMRef, $3be06b86be7cc064$re_export$baseStyleProps as baseStyleProps, $3be06b86be7cc064$re_export$viewStyleProps as viewStyleProps, $3be06b86be7cc064$re_export$dimensionValue as dimensionValue, $3be06b86be7cc064$re_export$responsiveDimensionValue as responsiveDimensionValue, $3be06b86be7cc064$re_export$convertStyleProps as convertStyleProps, $3be06b86be7cc064$re_export$useStyleProps as useStyleProps, $3be06b86be7cc064$re_export$passthroughStyle as passthroughStyle, $3be06b86be7cc064$re_export$getResponsiveProp as getResponsiveProp, $3be06b86be7cc064$re_export$useSlotProps as useSlotProps, $3be06b86be7cc064$re_export$cssModuleToSlots as cssModuleToSlots, $3be06b86be7cc064$re_export$SlotProvider as SlotProvider, $3be06b86be7cc064$re_export$ClearSlots as ClearSlots, $3be06b86be7cc064$re_export$useHasChild as useHasChild, $3be06b86be7cc064$re_export$useIsMobileDevice as useIsMobileDevice, $3be06b86be7cc064$re_export$BreakpointProvider as BreakpointProvider, $3be06b86be7cc064$re_export$useMatchedBreakpoints as useMatchedBreakpoints, $3be06b86be7cc064$re_export$useBreakpoint as useBreakpoint, $3be06b86be7cc064$re_export$useValueEffect as useValueEffect, $3be06b86be7cc064$re_export$useResizeObserver as useResizeObserver};
|
|
36
38
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/utils/src/index.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\n/// <reference types=\"css-module-types\" />\n\nexport {shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames} from '@adobe/react-spectrum/private/utils/classNames';\n\nexport {getWrappedElement} from '@adobe/react-spectrum/private/utils/getWrappedElement';\nexport {useMediaQuery} from '@adobe/react-spectrum/private/utils/useMediaQuery';\nexport {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from '@adobe/react-spectrum/private/utils/useDOMRef';\nexport {baseStyleProps, viewStyleProps, dimensionValue, responsiveDimensionValue, convertStyleProps, useStyleProps, passthroughStyle, getResponsiveProp} from '@adobe/react-spectrum/private/utils/styleProps';\nexport {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from '@adobe/react-spectrum/private/utils/Slots';\nexport {useHasChild} from '@adobe/react-spectrum/private/utils/useHasChild';\nexport {useIsMobileDevice} from '@adobe/react-spectrum/private/utils/useIsMobileDevice';\nexport {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from '@adobe/react-spectrum/private/utils/BreakpointProvider';\nexport type {StyleHandlers} from '@adobe/react-spectrum/private/utils/styleProps';\nexport {useValueEffect} from 'react-aria/private/utils/useValueEffect';\nexport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames } from '@adobe/react-spectrum/private/utils/classNames';
|
|
2
|
+
export { getWrappedElement } from '@adobe/react-spectrum/private/utils/getWrappedElement';
|
|
3
|
+
export { useMediaQuery } from '@adobe/react-spectrum/private/utils/useMediaQuery';
|
|
4
|
+
export { createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef } from '@adobe/react-spectrum/private/utils/useDOMRef';
|
|
5
|
+
export { baseStyleProps, viewStyleProps, dimensionValue, responsiveDimensionValue, convertStyleProps, useStyleProps, passthroughStyle, getResponsiveProp } from '@adobe/react-spectrum/private/utils/styleProps';
|
|
6
|
+
export { useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots } from '@adobe/react-spectrum/private/utils/Slots';
|
|
7
|
+
export { useHasChild } from '@adobe/react-spectrum/private/utils/useHasChild';
|
|
8
|
+
export { useIsMobileDevice } from '@adobe/react-spectrum/private/utils/useIsMobileDevice';
|
|
9
|
+
export { BreakpointProvider, useMatchedBreakpoints, useBreakpoint } from '@adobe/react-spectrum/private/utils/BreakpointProvider';
|
|
10
|
+
export type { StyleHandlers } from '@adobe/react-spectrum/private/utils/styleProps';
|
|
11
|
+
export { useValueEffect } from 'react-aria/private/utils/useValueEffect';
|
|
12
|
+
export { useResizeObserver } from 'react-aria/private/utils/useResizeObserver';
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/utils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"import": "./dist/import.mjs",
|
|
13
|
+
"require": "./dist/main.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
@@ -28,12 +28,9 @@
|
|
|
28
28
|
"url": "https://github.com/adobe/react-spectrum"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@react-
|
|
32
|
-
"@react-aria/ssr": "^3.9.10",
|
|
33
|
-
"@react-aria/utils": "^3.33.0",
|
|
34
|
-
"@react-types/shared": "^3.33.0",
|
|
31
|
+
"@adobe/react-spectrum": "3.47.0",
|
|
35
32
|
"@swc/helpers": "^0.5.0",
|
|
36
|
-
"
|
|
33
|
+
"react-aria": "3.48.0"
|
|
37
34
|
},
|
|
38
35
|
"peerDependencies": {
|
|
39
36
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
@@ -42,5 +39,8 @@
|
|
|
42
39
|
"publishConfig": {
|
|
43
40
|
"access": "public"
|
|
44
41
|
},
|
|
45
|
-
"
|
|
42
|
+
"targets": {
|
|
43
|
+
"types": false
|
|
44
|
+
},
|
|
45
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
46
46
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,24 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
/// <reference types="css-module-types" />
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
export {getWrappedElement} from '
|
|
18
|
-
export {useMediaQuery} from '
|
|
19
|
-
export {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from '
|
|
20
|
-
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
getResponsiveProp
|
|
29
|
-
} from './styleProps';
|
|
30
|
-
export {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from './Slots';
|
|
31
|
-
export {useHasChild} from './useHasChild';
|
|
32
|
-
export {useIsMobileDevice} from './useIsMobileDevice';
|
|
33
|
-
export {useValueEffect} from '@react-aria/utils';
|
|
34
|
-
export {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from './BreakpointProvider';
|
|
35
|
-
export {useResizeObserver} from '@react-aria/utils';
|
|
15
|
+
export {shouldKeepSpectrumClassNames, keepSpectrumClassNames, classNames} from '@adobe/react-spectrum/private/utils/classNames';
|
|
16
|
+
|
|
17
|
+
export {getWrappedElement} from '@adobe/react-spectrum/private/utils/getWrappedElement';
|
|
18
|
+
export {useMediaQuery} from '@adobe/react-spectrum/private/utils/useMediaQuery';
|
|
19
|
+
export {createDOMRef, createFocusableRef, useDOMRef, useFocusableRef, unwrapDOMRef, useUnwrapDOMRef} from '@adobe/react-spectrum/private/utils/useDOMRef';
|
|
20
|
+
export {baseStyleProps, viewStyleProps, dimensionValue, responsiveDimensionValue, convertStyleProps, useStyleProps, passthroughStyle, getResponsiveProp} from '@adobe/react-spectrum/private/utils/styleProps';
|
|
21
|
+
export {useSlotProps, cssModuleToSlots, SlotProvider, ClearSlots} from '@adobe/react-spectrum/private/utils/Slots';
|
|
22
|
+
export {useHasChild} from '@adobe/react-spectrum/private/utils/useHasChild';
|
|
23
|
+
export {useIsMobileDevice} from '@adobe/react-spectrum/private/utils/useIsMobileDevice';
|
|
24
|
+
export {BreakpointProvider, useMatchedBreakpoints, useBreakpoint} from '@adobe/react-spectrum/private/utils/BreakpointProvider';
|
|
25
|
+
export type {StyleHandlers} from '@adobe/react-spectrum/private/utils/styleProps';
|
|
26
|
+
export {useValueEffect} from 'react-aria/private/utils/useValueEffect';
|
|
27
|
+
export {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
var $OaNl0$react = require("react");
|
|
2
|
-
var $OaNl0$reactariassr = require("@react-aria/ssr");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function $parcel$interopDefault(a) {
|
|
6
|
-
return a && a.__esModule ? a.default : a;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function $parcel$export(e, n, v, s) {
|
|
10
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
$parcel$export(module.exports, "BreakpointProvider", () => $893a66ba513f4a66$export$8214320346cf5104);
|
|
14
|
-
$parcel$export(module.exports, "useMatchedBreakpoints", () => $893a66ba513f4a66$export$140ae7baa51cca23);
|
|
15
|
-
$parcel$export(module.exports, "useBreakpoint", () => $893a66ba513f4a66$export$199d6754bdf4e1e3);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const $893a66ba513f4a66$var$Context = /*#__PURE__*/ (0, ($parcel$interopDefault($OaNl0$react))).createContext(null);
|
|
19
|
-
$893a66ba513f4a66$var$Context.displayName = 'BreakpointContext';
|
|
20
|
-
function $893a66ba513f4a66$export$8214320346cf5104(props) {
|
|
21
|
-
let { children: children, matchedBreakpoints: matchedBreakpoints } = props;
|
|
22
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($OaNl0$react))).createElement($893a66ba513f4a66$var$Context.Provider, {
|
|
23
|
-
value: {
|
|
24
|
-
matchedBreakpoints: matchedBreakpoints
|
|
25
|
-
}
|
|
26
|
-
}, children);
|
|
27
|
-
}
|
|
28
|
-
function $893a66ba513f4a66$export$140ae7baa51cca23(breakpoints) {
|
|
29
|
-
let entries = Object.entries(breakpoints).sort(([, valueA], [, valueB])=>valueB - valueA);
|
|
30
|
-
let breakpointQueries = entries.map(([, value])=>`(min-width: ${value}px)`);
|
|
31
|
-
let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
|
|
32
|
-
let getBreakpointHandler = ()=>{
|
|
33
|
-
let matched = [];
|
|
34
|
-
for(let i in breakpointQueries){
|
|
35
|
-
let query = breakpointQueries[i];
|
|
36
|
-
if (window.matchMedia(query).matches) matched.push(entries[i][0]);
|
|
37
|
-
}
|
|
38
|
-
matched.push('base');
|
|
39
|
-
return matched;
|
|
40
|
-
};
|
|
41
|
-
let [breakpoint, setBreakpoint] = (0, $OaNl0$react.useState)(()=>supportsMatchMedia ? getBreakpointHandler() : [
|
|
42
|
-
'base'
|
|
43
|
-
]);
|
|
44
|
-
(0, $OaNl0$react.useEffect)(()=>{
|
|
45
|
-
if (!supportsMatchMedia) return;
|
|
46
|
-
let onResize = ()=>{
|
|
47
|
-
const breakpointHandler = getBreakpointHandler();
|
|
48
|
-
setBreakpoint((previousBreakpointHandler)=>{
|
|
49
|
-
if (previousBreakpointHandler.length !== breakpointHandler.length || previousBreakpointHandler.some((breakpoint, idx)=>breakpoint !== breakpointHandler[idx])) return [
|
|
50
|
-
...breakpointHandler
|
|
51
|
-
]; // Return a new array to force state change
|
|
52
|
-
return previousBreakpointHandler;
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
window.addEventListener('resize', onResize);
|
|
56
|
-
return ()=>{
|
|
57
|
-
window.removeEventListener('resize', onResize);
|
|
58
|
-
};
|
|
59
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
-
}, [
|
|
61
|
-
supportsMatchMedia
|
|
62
|
-
]);
|
|
63
|
-
// If in SSR, the media query should never match. Once the page hydrates,
|
|
64
|
-
// this will update and the real value will be returned.
|
|
65
|
-
let isSSR = (0, $OaNl0$reactariassr.useIsSSR)();
|
|
66
|
-
return isSSR ? [
|
|
67
|
-
'base'
|
|
68
|
-
] : breakpoint;
|
|
69
|
-
}
|
|
70
|
-
function $893a66ba513f4a66$export$199d6754bdf4e1e3() {
|
|
71
|
-
return (0, $OaNl0$react.useContext)($893a66ba513f4a66$var$Context);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
//# sourceMappingURL=BreakpointProvider.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAM,8CAAU,CAAA,GAAA,sCAAI,EAAE,aAAa,CAA2B;AAC9D,8BAAQ,WAAW,GAAG;AAOf,SAAS,0CAAmB,KAA8B;IAC/D,IAAI,YACF,QAAQ,sBACR,kBAAkB,EACnB,GAAG;IACJ,qBACE,0DAAC,8BAAQ,QAAQ;QACf,OAAO;gCAAC;QAAkB;OACzB;AAGP;AAEO,SAAS,0CAAsB,WAAwB;IAC5D,IAAI,UAAU,OAAO,OAAO,CAAC,aAAa,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,GAAK,SAAU;IACrF,IAAI,oBAAoB,QAAQ,GAAG,CAAC,CAAC,GAAG,MAAM,GAAK,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC;IAE5E,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,uBAAuB;QACzB,IAAI,UAAoB,EAAE;QAC1B,IAAK,IAAI,KAAK,kBAAmB;YAC/B,IAAI,QAAQ,iBAAiB,CAAC,EAAE;YAChC,IAAI,OAAO,UAAU,CAAC,OAAO,OAAO,EAClC,QAAQ,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAE9B;QACA,QAAQ,IAAI,CAAC;QACb,OAAO;IACT;IAEA,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,qBAAO,EAAE,IACzC,qBACI,yBACA;YAAC;SAAO;IAGd,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,WAAW;YACb,MAAM,oBAAoB;YAE1B,cAAc,CAAA;gBACZ,IAAI,0BAA0B,MAAM,KAAK,kBAAkB,MAAM,IAC/D,0BAA0B,IAAI,CAAC,CAAC,YAAY,MAAQ,eAAe,iBAAiB,CAAC,IAAI,GACzF,OAAO;uBAAI;iBAAkB,EAAE,2CAA2C;gBAG5E,OAAO;YACT;QACF;QAEA,OAAO,gBAAgB,CAAC,UAAU;QAClC,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU;QACvC;IACF,uDAAuD;IACvD,GAAG;QAAC;KAAmB;IAEvB,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,4BAAO;IACnB,OAAO,QAAQ;QAAC;KAAO,GAAG;AAC5B;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/utils/src/BreakpointProvider.tsx"],"sourcesContent":["import React, {ReactNode, useContext, useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\ninterface Breakpoints {\n S?: number,\n M?: number,\n L?: number,\n [custom: string]: number | undefined\n}\n\ninterface BreakpointContext {\n matchedBreakpoints: string[]\n}\n\nconst Context = React.createContext<BreakpointContext | null>(null);\nContext.displayName = 'BreakpointContext';\n\ninterface BreakpointProviderProps {\n children?: ReactNode,\n matchedBreakpoints: string[]\n}\n\nexport function BreakpointProvider(props: BreakpointProviderProps): ReactNode {\n let {\n children,\n matchedBreakpoints\n } = props;\n return (\n <Context.Provider\n value={{matchedBreakpoints}} >\n {children}\n </Context.Provider>\n );\n}\n\nexport function useMatchedBreakpoints(breakpoints: Breakpoints): string[] {\n let entries = Object.entries(breakpoints).sort(([, valueA], [, valueB]) => valueB! - valueA!);\n let breakpointQueries = entries.map(([, value]) => `(min-width: ${value}px)`);\n\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let getBreakpointHandler = () => {\n let matched: string[] = [];\n for (let i in breakpointQueries) {\n let query = breakpointQueries[i];\n if (window.matchMedia(query).matches) {\n matched.push(entries[i][0]);\n }\n }\n matched.push('base');\n return matched;\n };\n\n let [breakpoint, setBreakpoint] = useState(() =>\n supportsMatchMedia\n ? getBreakpointHandler()\n : ['base']\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let onResize = () => {\n const breakpointHandler = getBreakpointHandler();\n\n setBreakpoint(previousBreakpointHandler => {\n if (previousBreakpointHandler.length !== breakpointHandler.length ||\n previousBreakpointHandler.some((breakpoint, idx) => breakpoint !== breakpointHandler[idx])) {\n return [...breakpointHandler]; // Return a new array to force state change\n }\n\n return previousBreakpointHandler;\n });\n };\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [supportsMatchMedia]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? ['base'] : breakpoint;\n}\n\nexport function useBreakpoint(): BreakpointContext | null {\n return useContext(Context);\n}\n"],"names":[],"version":3,"file":"BreakpointProvider.main.js.map"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import $9wJsi$react, {useState as $9wJsi$useState, useEffect as $9wJsi$useEffect, useContext as $9wJsi$useContext} from "react";
|
|
2
|
-
import {useIsSSR as $9wJsi$useIsSSR} from "@react-aria/ssr";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const $1051245f87c5981d$var$Context = /*#__PURE__*/ (0, $9wJsi$react).createContext(null);
|
|
7
|
-
$1051245f87c5981d$var$Context.displayName = 'BreakpointContext';
|
|
8
|
-
function $1051245f87c5981d$export$8214320346cf5104(props) {
|
|
9
|
-
let { children: children, matchedBreakpoints: matchedBreakpoints } = props;
|
|
10
|
-
return /*#__PURE__*/ (0, $9wJsi$react).createElement($1051245f87c5981d$var$Context.Provider, {
|
|
11
|
-
value: {
|
|
12
|
-
matchedBreakpoints: matchedBreakpoints
|
|
13
|
-
}
|
|
14
|
-
}, children);
|
|
15
|
-
}
|
|
16
|
-
function $1051245f87c5981d$export$140ae7baa51cca23(breakpoints) {
|
|
17
|
-
let entries = Object.entries(breakpoints).sort(([, valueA], [, valueB])=>valueB - valueA);
|
|
18
|
-
let breakpointQueries = entries.map(([, value])=>`(min-width: ${value}px)`);
|
|
19
|
-
let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
|
|
20
|
-
let getBreakpointHandler = ()=>{
|
|
21
|
-
let matched = [];
|
|
22
|
-
for(let i in breakpointQueries){
|
|
23
|
-
let query = breakpointQueries[i];
|
|
24
|
-
if (window.matchMedia(query).matches) matched.push(entries[i][0]);
|
|
25
|
-
}
|
|
26
|
-
matched.push('base');
|
|
27
|
-
return matched;
|
|
28
|
-
};
|
|
29
|
-
let [breakpoint, setBreakpoint] = (0, $9wJsi$useState)(()=>supportsMatchMedia ? getBreakpointHandler() : [
|
|
30
|
-
'base'
|
|
31
|
-
]);
|
|
32
|
-
(0, $9wJsi$useEffect)(()=>{
|
|
33
|
-
if (!supportsMatchMedia) return;
|
|
34
|
-
let onResize = ()=>{
|
|
35
|
-
const breakpointHandler = getBreakpointHandler();
|
|
36
|
-
setBreakpoint((previousBreakpointHandler)=>{
|
|
37
|
-
if (previousBreakpointHandler.length !== breakpointHandler.length || previousBreakpointHandler.some((breakpoint, idx)=>breakpoint !== breakpointHandler[idx])) return [
|
|
38
|
-
...breakpointHandler
|
|
39
|
-
]; // Return a new array to force state change
|
|
40
|
-
return previousBreakpointHandler;
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
window.addEventListener('resize', onResize);
|
|
44
|
-
return ()=>{
|
|
45
|
-
window.removeEventListener('resize', onResize);
|
|
46
|
-
};
|
|
47
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
-
}, [
|
|
49
|
-
supportsMatchMedia
|
|
50
|
-
]);
|
|
51
|
-
// If in SSR, the media query should never match. Once the page hydrates,
|
|
52
|
-
// this will update and the real value will be returned.
|
|
53
|
-
let isSSR = (0, $9wJsi$useIsSSR)();
|
|
54
|
-
return isSSR ? [
|
|
55
|
-
'base'
|
|
56
|
-
] : breakpoint;
|
|
57
|
-
}
|
|
58
|
-
function $1051245f87c5981d$export$199d6754bdf4e1e3() {
|
|
59
|
-
return (0, $9wJsi$useContext)($1051245f87c5981d$var$Context);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export {$1051245f87c5981d$export$8214320346cf5104 as BreakpointProvider, $1051245f87c5981d$export$140ae7baa51cca23 as useMatchedBreakpoints, $1051245f87c5981d$export$199d6754bdf4e1e3 as useBreakpoint};
|
|
64
|
-
//# sourceMappingURL=BreakpointProvider.module.js.map
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import $9wJsi$react, {useState as $9wJsi$useState, useEffect as $9wJsi$useEffect, useContext as $9wJsi$useContext} from "react";
|
|
2
|
-
import {useIsSSR as $9wJsi$useIsSSR} from "@react-aria/ssr";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const $1051245f87c5981d$var$Context = /*#__PURE__*/ (0, $9wJsi$react).createContext(null);
|
|
7
|
-
$1051245f87c5981d$var$Context.displayName = 'BreakpointContext';
|
|
8
|
-
function $1051245f87c5981d$export$8214320346cf5104(props) {
|
|
9
|
-
let { children: children, matchedBreakpoints: matchedBreakpoints } = props;
|
|
10
|
-
return /*#__PURE__*/ (0, $9wJsi$react).createElement($1051245f87c5981d$var$Context.Provider, {
|
|
11
|
-
value: {
|
|
12
|
-
matchedBreakpoints: matchedBreakpoints
|
|
13
|
-
}
|
|
14
|
-
}, children);
|
|
15
|
-
}
|
|
16
|
-
function $1051245f87c5981d$export$140ae7baa51cca23(breakpoints) {
|
|
17
|
-
let entries = Object.entries(breakpoints).sort(([, valueA], [, valueB])=>valueB - valueA);
|
|
18
|
-
let breakpointQueries = entries.map(([, value])=>`(min-width: ${value}px)`);
|
|
19
|
-
let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';
|
|
20
|
-
let getBreakpointHandler = ()=>{
|
|
21
|
-
let matched = [];
|
|
22
|
-
for(let i in breakpointQueries){
|
|
23
|
-
let query = breakpointQueries[i];
|
|
24
|
-
if (window.matchMedia(query).matches) matched.push(entries[i][0]);
|
|
25
|
-
}
|
|
26
|
-
matched.push('base');
|
|
27
|
-
return matched;
|
|
28
|
-
};
|
|
29
|
-
let [breakpoint, setBreakpoint] = (0, $9wJsi$useState)(()=>supportsMatchMedia ? getBreakpointHandler() : [
|
|
30
|
-
'base'
|
|
31
|
-
]);
|
|
32
|
-
(0, $9wJsi$useEffect)(()=>{
|
|
33
|
-
if (!supportsMatchMedia) return;
|
|
34
|
-
let onResize = ()=>{
|
|
35
|
-
const breakpointHandler = getBreakpointHandler();
|
|
36
|
-
setBreakpoint((previousBreakpointHandler)=>{
|
|
37
|
-
if (previousBreakpointHandler.length !== breakpointHandler.length || previousBreakpointHandler.some((breakpoint, idx)=>breakpoint !== breakpointHandler[idx])) return [
|
|
38
|
-
...breakpointHandler
|
|
39
|
-
]; // Return a new array to force state change
|
|
40
|
-
return previousBreakpointHandler;
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
window.addEventListener('resize', onResize);
|
|
44
|
-
return ()=>{
|
|
45
|
-
window.removeEventListener('resize', onResize);
|
|
46
|
-
};
|
|
47
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
-
}, [
|
|
49
|
-
supportsMatchMedia
|
|
50
|
-
]);
|
|
51
|
-
// If in SSR, the media query should never match. Once the page hydrates,
|
|
52
|
-
// this will update and the real value will be returned.
|
|
53
|
-
let isSSR = (0, $9wJsi$useIsSSR)();
|
|
54
|
-
return isSSR ? [
|
|
55
|
-
'base'
|
|
56
|
-
] : breakpoint;
|
|
57
|
-
}
|
|
58
|
-
function $1051245f87c5981d$export$199d6754bdf4e1e3() {
|
|
59
|
-
return (0, $9wJsi$useContext)($1051245f87c5981d$var$Context);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export {$1051245f87c5981d$export$8214320346cf5104 as BreakpointProvider, $1051245f87c5981d$export$140ae7baa51cca23 as useMatchedBreakpoints, $1051245f87c5981d$export$199d6754bdf4e1e3 as useBreakpoint};
|
|
64
|
-
//# sourceMappingURL=BreakpointProvider.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;AAcA,MAAM,8CAAU,CAAA,GAAA,YAAI,EAAE,aAAa,CAA2B;AAC9D,8BAAQ,WAAW,GAAG;AAOf,SAAS,0CAAmB,KAA8B;IAC/D,IAAI,YACF,QAAQ,sBACR,kBAAkB,EACnB,GAAG;IACJ,qBACE,gCAAC,8BAAQ,QAAQ;QACf,OAAO;gCAAC;QAAkB;OACzB;AAGP;AAEO,SAAS,0CAAsB,WAAwB;IAC5D,IAAI,UAAU,OAAO,OAAO,CAAC,aAAa,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,GAAK,SAAU;IACrF,IAAI,oBAAoB,QAAQ,GAAG,CAAC,CAAC,GAAG,MAAM,GAAK,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC;IAE5E,IAAI,qBAAqB,OAAO,WAAW,eAAe,OAAO,OAAO,UAAU,KAAK;IACvF,IAAI,uBAAuB;QACzB,IAAI,UAAoB,EAAE;QAC1B,IAAK,IAAI,KAAK,kBAAmB;YAC/B,IAAI,QAAQ,iBAAiB,CAAC,EAAE;YAChC,IAAI,OAAO,UAAU,CAAC,OAAO,OAAO,EAClC,QAAQ,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAE9B;QACA,QAAQ,IAAI,CAAC;QACb,OAAO;IACT;IAEA,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE,IACzC,qBACI,yBACA;YAAC;SAAO;IAGd,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,oBACH;QAGF,IAAI,WAAW;YACb,MAAM,oBAAoB;YAE1B,cAAc,CAAA;gBACZ,IAAI,0BAA0B,MAAM,KAAK,kBAAkB,MAAM,IAC/D,0BAA0B,IAAI,CAAC,CAAC,YAAY,MAAQ,eAAe,iBAAiB,CAAC,IAAI,GACzF,OAAO;uBAAI;iBAAkB,EAAE,2CAA2C;gBAG5E,OAAO;YACT;QACF;QAEA,OAAO,gBAAgB,CAAC,UAAU;QAClC,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU;QACvC;IACF,uDAAuD;IACvD,GAAG;QAAC;KAAmB;IAEvB,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,QAAQ,CAAA,GAAA,eAAO;IACnB,OAAO,QAAQ;QAAC;KAAO,GAAG;AAC5B;AAEO,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/utils/src/BreakpointProvider.tsx"],"sourcesContent":["import React, {ReactNode, useContext, useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\ninterface Breakpoints {\n S?: number,\n M?: number,\n L?: number,\n [custom: string]: number | undefined\n}\n\ninterface BreakpointContext {\n matchedBreakpoints: string[]\n}\n\nconst Context = React.createContext<BreakpointContext | null>(null);\nContext.displayName = 'BreakpointContext';\n\ninterface BreakpointProviderProps {\n children?: ReactNode,\n matchedBreakpoints: string[]\n}\n\nexport function BreakpointProvider(props: BreakpointProviderProps): ReactNode {\n let {\n children,\n matchedBreakpoints\n } = props;\n return (\n <Context.Provider\n value={{matchedBreakpoints}} >\n {children}\n </Context.Provider>\n );\n}\n\nexport function useMatchedBreakpoints(breakpoints: Breakpoints): string[] {\n let entries = Object.entries(breakpoints).sort(([, valueA], [, valueB]) => valueB! - valueA!);\n let breakpointQueries = entries.map(([, value]) => `(min-width: ${value}px)`);\n\n let supportsMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n let getBreakpointHandler = () => {\n let matched: string[] = [];\n for (let i in breakpointQueries) {\n let query = breakpointQueries[i];\n if (window.matchMedia(query).matches) {\n matched.push(entries[i][0]);\n }\n }\n matched.push('base');\n return matched;\n };\n\n let [breakpoint, setBreakpoint] = useState(() =>\n supportsMatchMedia\n ? getBreakpointHandler()\n : ['base']\n );\n\n useEffect(() => {\n if (!supportsMatchMedia) {\n return;\n }\n\n let onResize = () => {\n const breakpointHandler = getBreakpointHandler();\n\n setBreakpoint(previousBreakpointHandler => {\n if (previousBreakpointHandler.length !== breakpointHandler.length ||\n previousBreakpointHandler.some((breakpoint, idx) => breakpoint !== breakpointHandler[idx])) {\n return [...breakpointHandler]; // Return a new array to force state change\n }\n\n return previousBreakpointHandler;\n });\n };\n\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('resize', onResize);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [supportsMatchMedia]);\n\n // If in SSR, the media query should never match. Once the page hydrates,\n // this will update and the real value will be returned.\n let isSSR = useIsSSR();\n return isSSR ? ['base'] : breakpoint;\n}\n\nexport function useBreakpoint(): BreakpointContext | null {\n return useContext(Context);\n}\n"],"names":[],"version":3,"file":"BreakpointProvider.module.js.map"}
|