@radix-ui/react-popper
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -5,5 +5,6 @@ import * as React from "react"; | ||
import * as Polymorphic from "@radix-ui/react-polymorphic"; | ||
import { Side, Align, MeasurableElement, Merge } from "@radix-ui/utils"; | ||
type PopperOwnProps = Merge<Polymorphic.OwnProps<typeof Primitive>, { | ||
anchorRef: React.RefObject<MeasurableElement>; | ||
import { Side, Align } from "@radix-ui/popper"; | ||
import { Measurable } from "@radix-ui/rect"; | ||
type PopperOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Primitive>, { | ||
anchorRef: React.RefObject<Measurable>; | ||
side?: Side; | ||
@@ -18,3 +19,3 @@ sideOffset?: number; | ||
export const Popper: PopperPrimitive; | ||
type PopperArrowOwnProps = Merge<Polymorphic.OwnProps<typeof Arrow>, { | ||
type PopperArrowOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Arrow>, { | ||
offset?: number; | ||
@@ -21,0 +22,0 @@ }>; |
@@ -1,2 +0,2 @@ | ||
var e,r,t=require("@radix-ui/utils"),n=t.getSelector,o=t.getSelectorObj,i=t.makeRect,a=require("@radix-ui/react-arrow").Arrow,l=require("@radix-ui/react-primitive").Primitive,c=require("@radix-ui/react-utils"),s=c.createContext,u=c.useRect,f=c.useSize,p=c.useComposedRefs,d=require("@radix-ui/popper").getPlacementData,y=(e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e);function v(){return(v=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function w(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?w(Object(t),!0).forEach((function(r){O(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):w(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function O(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function m(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function g(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return h(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var j=g(s("PopperContext","Popper"),2),P=j[0],S=j[1],A=y.forwardRef((function(e,r){var t=e.selector,a=void 0===t?n("Popper"):t,c=e.anchorRef,s=e.side,w=void 0===s?"bottom":s,O=e.sideOffset,h=e.align,j=void 0===h?"center":h,S=e.alignOffset,A=e.collisionTolerance,E=e.avoidCollisions,x=void 0===E||E,R=m(e,["selector","anchorRef","side","sideOffset","align","alignOffset","collisionTolerance","avoidCollisions"]),C=g(y.useState(),2),k=C[0],q=C[1],T=u(c),z=y.useRef(null),D=f(z),I=y.useRef(null),M=f(I),L=p(r,z),N=function(){var e=g(y.useState(void 0),2),r=e[0],t=e[1];return y.useEffect((function(){var e;function r(){t({width:window.innerWidth,height:window.innerHeight})}function n(){window.clearTimeout(e),e=window.setTimeout(r,100)}return r(),window.addEventListener("resize",n),function(){return window.removeEventListener("resize",n)}}),[]),r}(),_=N?i(N,{x:0,y:0}):void 0,B=d({anchorRect:T,popperSize:D,arrowSize:M,arrowOffset:k,side:w,sideOffset:O,align:j,alignOffset:S,shouldAvoidCollisions:x,collisionBoundariesRect:_,collisionTolerance:A}),H=B.popperStyles,U=B.arrowStyles,W=B.placedSide,$=B.placedAlign,F=void 0!==W,G=y.useMemo((function(){return{arrowRef:I,arrowStyles:U,setArrowOffset:q}}),[U]);return y.createElement("div",v({style:H},a?o(a+"-wrapper"):void 0),y.createElement(P.Provider,{value:G},y.createElement(l,v({selector:a},R,{style:b(b({},R.style),{},{animation:F?void 0:"none"}),ref:L,"data-side":W,"data-align":$}))))}));exports.Popper=A,A.displayName="Popper";var E=y.forwardRef((function(e,r){var t=e.selector,o=void 0===t?n("PopperArrow"):t,i=e.offset,l=m(e,["selector","offset"]),c=S("PopperArrow"),s=c.arrowRef,u=c.setArrowOffset,f=c.arrowStyles;return y.useEffect((function(){return u(i)}),[u,i]),y.createElement("span",{style:b(b({},f),{},{pointerEvents:"none"})},y.createElement("span",{ref:s,style:{display:"inline-block",verticalAlign:"top",pointerEvents:"auto"}},y.createElement(a,v({},l,{selector:o,ref:r,style:b(b({},l.style),{},{display:"block"})}))))}));exports.PopperArrow=E,E.displayName="PopperArrow";var x=A;exports.Root=x;var R=E;exports.Arrow=R; | ||
var e,r,t=require("@radix-ui/react-arrow").Arrow,n=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-use-size").useSize,i=require("@radix-ui/react-use-rect").useRect,a=require("@radix-ui/react-context").createContext,l=require("@radix-ui/react-compose-refs").useComposedRefs,c=require("@radix-ui/popper").getPlacementData,u=(e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e);function s(){return(s=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function f(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?f(Object(t),!0).forEach((function(r){d(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function d(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function y(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function v(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw i}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return w(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return w(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var b=v(a("Popper"),2),O=b[0],m=b[1],g=u.forwardRef((function(e,r){var t=e.anchorRef,a=e.side,f=void 0===a?"bottom":a,d=e.sideOffset,w=e.align,b=void 0===w?"center":w,m=e.alignOffset,g=e.collisionTolerance,h=e.avoidCollisions,j=void 0===h||h,P=y(e,["anchorRef","side","sideOffset","align","alignOffset","collisionTolerance","avoidCollisions"]),S=v(u.useState(),2),x=S[0],E=S[1],A=i(t),R=u.useRef(null),q=o(R),C=u.useRef(null),z=o(C),D=l(r,R),T=function(){var e=v(u.useState(void 0),2),r=e[0],t=e[1];return u.useEffect((function(){var e;function r(){t({width:window.innerWidth,height:window.innerHeight})}function n(){window.clearTimeout(e),e=window.setTimeout(r,100)}return r(),window.addEventListener("resize",n),function(){return window.removeEventListener("resize",n)}}),[]),r}(),k=T?DOMRect.fromRect(p(p({},T),{},{x:0,y:0})):void 0,I=c({anchorRect:A,popperSize:q,arrowSize:z,arrowOffset:x,side:f,sideOffset:d,align:b,alignOffset:m,shouldAvoidCollisions:j,collisionBoundariesRect:k,collisionTolerance:g}),M=I.popperStyles,L=I.arrowStyles,N=I.placedSide,_=I.placedAlign,B=void 0!==N;return u.createElement("div",{style:M,"data-radix-popper-wrapper":""},u.createElement(O,{arrowRef:C,arrowStyles:L,onArrowOffsetChange:E},u.createElement(n,s({"data-side":N,"data-align":_},P,{style:p(p({},P.style),{},{animation:B?void 0:"none"}),ref:D}))))}));exports.Popper=g,g.displayName="Popper";var h=u.forwardRef((function(e,r){var n=e.offset,o=y(e,["offset"]),i=m("PopperArrow"),a=i.onArrowOffsetChange;return u.useEffect((function(){return a(n)}),[a,n]),u.createElement("span",{style:p(p({},i.arrowStyles),{},{pointerEvents:"none"})},u.createElement("span",{ref:i.arrowRef,style:{display:"inline-block",verticalAlign:"top",pointerEvents:"auto"}},u.createElement(t,s({},o,{ref:r,style:p(p({},o.style),{},{display:"block"})}))))}));exports.PopperArrow=h,h.displayName="PopperArrow";var j=g;exports.Root=j;var P=h;exports.Arrow=P; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{getSelector as e,getSelectorObj as r,makeRect as t}from"@radix-ui/utils";import{Arrow as o}from"@radix-ui/react-arrow";import{Primitive as n}from"@radix-ui/react-primitive";import{createContext as i,useRect as s,useSize as l,useComposedRefs as a}from"@radix-ui/react-utils";import{getPlacementData as c}from"@radix-ui/popper";import*as p from"react";function f(){return(f=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)}function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?u(Object(t),!0).forEach((function(r){w(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function w(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function y(e,r){if(null==e)return{};var t,o,n=function(e,r){if(null==e)return{};var t,o,n={},i=Object.keys(e);for(o=0;o<i.length;o++)t=i[o],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)t=i[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}const[O,m]=i("PopperContext","Popper"),b="Popper";export const Popper=p.forwardRef(((o,i)=>{const{selector:u=e(b),anchorRef:w,side:m="bottom",sideOffset:v,align:g="center",alignOffset:P,collisionTolerance:h,avoidCollisions:j=!0}=o,E=y(o,["selector","anchorRef","side","sideOffset","align","alignOffset","collisionTolerance","avoidCollisions"]),[x,S]=p.useState(),A=s(w),R=p.useRef(null),T=l(R),k=p.useRef(null),z=l(k),C=a(i,R),D=function(){const[e,r]=p.useState(void 0);return p.useEffect((()=>{let e;function t(){r({width:window.innerWidth,height:window.innerHeight})}function o(){window.clearTimeout(e),e=window.setTimeout(t,100)}return t(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)}),[]),e}(),L=D?t(D,{x:0,y:0}):void 0,{popperStyles:N,arrowStyles:B,placedSide:H,placedAlign:I}=c({anchorRect:A,popperSize:T,arrowSize:z,arrowOffset:x,side:m,sideOffset:v,align:g,alignOffset:P,shouldAvoidCollisions:j,collisionBoundariesRect:L,collisionTolerance:h}),M=void 0!==H,W=p.useMemo((()=>({arrowRef:k,arrowStyles:B,setArrowOffset:S})),[B]);return p.createElement("div",f({style:N},u?r(u+"-wrapper"):void 0),p.createElement(O.Provider,{value:W},p.createElement(n,f({selector:u},E,{style:d(d({},E.style),{},{animation:M?void 0:"none"}),ref:C,"data-side":H,"data-align":I}))))}));Popper.displayName=b;const v="PopperArrow";export const PopperArrow=p.forwardRef((function(r,t){const{selector:n=e(v),offset:i}=r,s=y(r,["selector","offset"]),{arrowRef:l,setArrowOffset:a,arrowStyles:c}=m(v);return p.useEffect((()=>a(i)),[a,i]),p.createElement("span",{style:d(d({},c),{},{pointerEvents:"none"})},p.createElement("span",{ref:l,style:{display:"inline-block",verticalAlign:"top",pointerEvents:"auto"}},p.createElement(o,f({},s,{selector:n,ref:t,style:d(d({},s.style),{},{display:"block"})}))))}));PopperArrow.displayName=v;export const Root=Popper;export const Arrow=PopperArrow; | ||
import{Arrow as e}from"@radix-ui/react-arrow";import{Primitive as r}from"@radix-ui/react-primitive";import{useSize as o}from"@radix-ui/react-use-size";import{useRect as t}from"@radix-ui/react-use-rect";import{createContext as i}from"@radix-ui/react-context";import{useComposedRefs as n}from"@radix-ui/react-compose-refs";import{getPlacementData as a}from"@radix-ui/popper";import*as s from"react";function p(){return(p=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}const[l,c]=i("Popper");export const Popper=s.forwardRef(((e,i)=>{const{anchorRef:c,side:f="bottom",sideOffset:d,align:u="center",alignOffset:w,collisionTolerance:m,avoidCollisions:y=!0,...v}=e,[x,g]=s.useState(),h=t(c),A=s.useRef(null),E=o(A),R=s.useRef(null),O=o(R),P=n(i,A),S=function(){const[e,r]=s.useState(void 0);return s.useEffect((()=>{let e;function o(){r({width:window.innerWidth,height:window.innerHeight})}function t(){window.clearTimeout(e),e=window.setTimeout(o,100)}return o(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)}),[]),e}(),b=S?DOMRect.fromRect({...S,x:0,y:0}):void 0,{popperStyles:z,arrowStyles:C,placedSide:T,placedAlign:j}=a({anchorRect:h,popperSize:E,arrowSize:O,arrowOffset:x,side:f,sideOffset:d,align:u,alignOffset:w,shouldAvoidCollisions:y,collisionBoundariesRect:b,collisionTolerance:m}),k=void 0!==T;return s.createElement("div",{style:z,"data-radix-popper-wrapper":""},s.createElement(l,{arrowRef:R,arrowStyles:C,onArrowOffsetChange:g},s.createElement(r,p({"data-side":T,"data-align":j},v,{style:{...v.style,animation:k?void 0:"none"},ref:P}))))}));Popper.displayName="Popper";export const PopperArrow=s.forwardRef((function(r,o){const{offset:t,...i}=r,n=c("PopperArrow"),{onArrowOffsetChange:a}=n;return s.useEffect((()=>a(t)),[a,t]),s.createElement("span",{style:{...n.arrowStyles,pointerEvents:"none"}},s.createElement("span",{ref:n.arrowRef,style:{display:"inline-block",verticalAlign:"top",pointerEvents:"auto"}},s.createElement(e,p({},i,{ref:o,style:{...i.style,display:"block"}}))))}));PopperArrow.displayName="PopperArrow";export const Root=Popper;export const Arrow=PopperArrow; | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-popper", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"license": "MIT", | ||
@@ -19,8 +19,11 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@radix-ui/popper": "0.0.4", | ||
"@radix-ui/react-arrow": "0.0.5", | ||
"@radix-ui/react-polymorphic": "0.0.5", | ||
"@radix-ui/react-primitive": "0.0.4", | ||
"@radix-ui/react-utils": "0.0.5", | ||
"@radix-ui/utils": "0.0.3" | ||
"@radix-ui/popper": "0.0.5", | ||
"@radix-ui/react-arrow": "0.0.6", | ||
"@radix-ui/react-compose-refs": "0.0.1", | ||
"@radix-ui/react-context": "0.0.1", | ||
"@radix-ui/react-polymorphic": "0.0.6", | ||
"@radix-ui/react-primitive": "0.0.5", | ||
"@radix-ui/react-use-rect": "0.0.1", | ||
"@radix-ui/react-use-size": "0.0.1", | ||
"@radix-ui/rect": "0.0.1" | ||
}, | ||
@@ -27,0 +30,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30953
10
54
+ Added@radix-ui/rect@0.0.1
+ Added@radix-ui/popper@0.0.5(transitive)
+ Added@radix-ui/react-arrow@0.0.6(transitive)
+ Added@radix-ui/react-compose-refs@0.0.1(transitive)
+ Added@radix-ui/react-context@0.0.1(transitive)
+ Added@radix-ui/react-polymorphic@0.0.6(transitive)
+ Added@radix-ui/react-primitive@0.0.5(transitive)
+ Added@radix-ui/react-use-layout-effect@0.0.1(transitive)
+ Added@radix-ui/react-use-rect@0.0.1(transitive)
+ Added@radix-ui/react-use-size@0.0.1(transitive)
+ Added@radix-ui/rect@0.0.1(transitive)
- Removed@radix-ui/react-utils@0.0.5
- Removed@radix-ui/utils@0.0.3
- Removed@radix-ui/popper@0.0.4(transitive)
- Removed@radix-ui/react-arrow@0.0.5(transitive)
- Removed@radix-ui/react-polymorphic@0.0.5(transitive)
- Removed@radix-ui/react-primitive@0.0.4(transitive)
- Removed@radix-ui/react-utils@0.0.5(transitive)
- Removed@radix-ui/utils@0.0.3(transitive)
Updated@radix-ui/popper@0.0.5
Updated@radix-ui/react-arrow@0.0.6