@tamagui/dismissable
Advanced tools
Comparing version 1.0.1-beta.75 to 1.0.1-beta.76
@@ -0,1 +1,32 @@ | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
var __objRest = (source, exclude) => { | ||
var target = {}; | ||
for (var prop in source) | ||
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) | ||
target[prop] = source[prop]; | ||
if (source != null && __getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(source)) { | ||
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) | ||
target[prop] = source[prop]; | ||
} | ||
return target; | ||
}; | ||
import { useCallbackRef } from "@radix-ui/react-use-callback-ref"; | ||
@@ -22,3 +53,3 @@ import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown"; | ||
const Dismissable = React.forwardRef((props, forwardedRef) => { | ||
const { | ||
const _a = props, { | ||
disableOutsidePointerEvents = false, | ||
@@ -29,5 +60,11 @@ onEscapeKeyDown, | ||
onInteractOutside, | ||
onDismiss, | ||
...layerProps | ||
} = props; | ||
onDismiss | ||
} = _a, layerProps = __objRest(_a, [ | ||
"disableOutsidePointerEvents", | ||
"onEscapeKeyDown", | ||
"onPointerDownOutside", | ||
"onFocusOutside", | ||
"onInteractOutside", | ||
"onDismiss" | ||
]); | ||
const context = React.useContext(DismissableContext); | ||
@@ -105,14 +142,12 @@ const [node, setNode] = React.useState(null); | ||
}, []); | ||
return /* @__PURE__ */ React.createElement("div", { | ||
...layerProps, | ||
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, layerProps), { | ||
ref: composedRefs, | ||
style: { | ||
style: __spreadValues({ | ||
display: "contents", | ||
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0, | ||
...props.style | ||
}, | ||
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0 | ||
}, props.style), | ||
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture), | ||
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture), | ||
onPointerDownCapture: composeEventHandlers(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture) | ||
}); | ||
})); | ||
}); | ||
@@ -134,7 +169,7 @@ Dismissable.displayName = DISMISSABLE_LAYER_NAME; | ||
}, [context.branches]); | ||
return /* @__PURE__ */ React.createElement("div", { | ||
style: { display: "contents" }, | ||
...props, | ||
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({ | ||
style: { display: "contents" } | ||
}, props), { | ||
ref: composedRefs | ||
}); | ||
})); | ||
}); | ||
@@ -141,0 +176,0 @@ DismissableBranch.displayName = BRANCH_NAME; |
{ | ||
"name": "@tamagui/dismissable", | ||
"version": "1.0.1-beta.75", | ||
"version": "1.0.1-beta.76", | ||
"sideEffects": true, | ||
@@ -24,4 +24,4 @@ "source": "src/index.ts", | ||
"@radix-ui/react-use-escape-keydown": "^0.1.0", | ||
"@tamagui/compose-refs": "^1.0.1-beta.75", | ||
"@tamagui/core": "^1.0.1-beta.75" | ||
"@tamagui/compose-refs": "^1.0.1-beta.76", | ||
"@tamagui/core": "^1.0.1-beta.76" | ||
}, | ||
@@ -33,3 +33,3 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@tamagui/build": "^1.0.1-beta.75", | ||
"@tamagui/build": "^1.0.1-beta.76", | ||
"react": "*", | ||
@@ -36,0 +36,0 @@ "react-dom": "*" |
Sorry, the diff of this file is not supported yet
90293
1204