@pickaxeproject/react 1.3.6 → 1.3.8
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/cjs/components/Pickaxe/Addons/Scroll/hooks/useScroll.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/Questions/Dropdown.js +1 -1
- package/dist/cjs/src/components/Pickaxe/Form/Questions/Dropdown.d.ts +1 -1
- package/dist/esm/components/Pickaxe/Addons/Scroll/hooks/useScroll.js +1 -1
- package/dist/esm/components/Pickaxe/Form/Questions/Dropdown.js +1 -1
- package/dist/esm/src/components/Pickaxe/Form/Questions/Dropdown.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./useScrollContext.js");exports.useScroll=({auto:t})=>{const{scrollContainerRef:n,scrollTargetRef:o,isLocked:l,isScrollSession:s,isScrollIncreasing:c,setIsLocked:u,setIsScrollSession:i,setIsScrolling:d,setIsScrollIncreasing:v}=r.useScrollContext(),[a,f]=e.useState(0),g=e.useRef(!1),E=e.useMemo((()=>n&&n.current?n.current:"undefined"==typeof window?null:window),[n]);e.useEffect((()=>{if(!
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./useScrollContext.js");exports.useScroll=({auto:t})=>{const{scrollContainerRef:n,scrollTargetRef:o,isLocked:l,isScrollSession:s,isScrollIncreasing:c,setIsLocked:u,setIsScrollSession:i,setIsScrolling:d,setIsScrollIncreasing:v}=r.useScrollContext(),[a,f]=e.useState(0),g=e.useRef(!1),E=e.useMemo((()=>null!=t&&t&&s),[t,s]),S=e.useMemo((()=>n&&n.current?n.current:"undefined"==typeof window?null:window),[n]);e.useEffect((()=>{if(!S)return;const e=e=>{s&&l&&("mousedown"===e.type||"wheel"===e.type||"DOMMouseScroll"===e.type||"mousewheel"===e.type)&&u(!1)};return null==S||S.addEventListener("scroll",e),null==S||S.addEventListener("mousedown",e),null==S||S.addEventListener("wheel",e),null==S||S.addEventListener("DOMMouseScroll",e),null==S||S.addEventListener("mousewheel",e),()=>{null==S||S.removeEventListener("scroll",e),null==S||S.removeEventListener("mousedown",e),null==S||S.removeEventListener("wheel",e),null==S||S.removeEventListener("DOMMouseScroll",e),null==S||S.removeEventListener("mousewheel",e)}}),[S,s,l]),e.useEffect((()=>{g.current=!l}),[l]),e.useEffect((()=>{const e=setInterval((()=>{if(!n.current)return;const e=n.current.scrollHeight;if(e===a)return;const r=e>a;v(r),f(e),r&&t&&m()}),100);return()=>clearInterval(e)}),[n,a,t]),e.useEffect((()=>{const e=setInterval((()=>{if(n.current)return;if(!o.current)return;const e=o.current.getBoundingClientRect().top+o.current.getBoundingClientRect().height+window.scrollY;if(e===a)return;const r=e>a;v(r),f(e),r&&E&&p()}),100);return()=>clearInterval(e)}),[o,a,E]);const m=()=>{try{if(d(!0),!n.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollContainerRef not detected"));if(g.current)return;const e=n.current.scrollHeight;n.current.scrollTo({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollContainerRef")}finally{d(!1)}},p=()=>{try{if(d(!0),!o.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollTargetRef not detected"));if(g.current)return;const e=o.current.getBoundingClientRect().top+o.current.getBoundingClientRect().height+window.scrollY;window.scroll({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollTargetRef")}finally{d(!1)}};return{isScrollIncreasing:c,scrollStartSession:()=>{i(!0),u(!0),g.current=!1},scrollEndSession:()=>{i(!1)},scrollToBottom:m,scrollToTarget:p}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../../hooks/studio/useStyleInput.js"),t=require("../../../Core/Menu/index.js"),a=require("../../../Core/Menu/Button.js"),n=require("../../../Core/Menu/List.js"),i=require("../../../../common/cn.js");exports.default=({id:o,children:l,placeholder:c,value:d,className:u,style:j,closeOnSelect:x=!0,maxToken:p=50,isDropdown:b=!1})=>{const{styles:m,colors:f}=s.usePickaxeContext(),h=r.useStyleInput();return b?e.jsxs(t.default,Object.assign({id:o,closeOnSelect:x,className:"relative"},{children:[e.jsx(a.default,Object.assign({variant:"anchor",className:i.default("flex items-center justify-between rounded-sm border border-transparent py-3 pl-4 pr-3 shadow duration-300",u,p<=50&&"max-w-[400px]"),style:Object.assign(Object.assign({},h),j)},{children:e.jsx("p",Object.assign({className:"line-clamp-1 select-none"},{children:(null!=d?d:"")||c}))})),e.jsx(n.default,Object.assign({className:"p-3 shadow-md",border:"#ffffff"===f.secondaryText.toLowerCase()?"1px solid rgba(255,255,255,0.7)":"1px solid rgba(0,0,0,0.7)",align:"bottom-end",width:p<=50?"400px":"100%",style:Object.assign(Object.assign(Object.assign({},h),{borderRadius:m.cornerRadius}),j)},{children:l}))]})):e.jsx("div",{children:l})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as e,useRef as r,useMemo as n,useEffect as t}from"react";import{useScrollContext as o}from"./useScrollContext.js";const l=({auto:l})=>{const{scrollContainerRef:s,scrollTargetRef:c,isLocked:u,isScrollSession:i,isScrollIncreasing:d,setIsLocked:v,setIsScrollSession:a,setIsScrolling:g,setIsScrollIncreasing:f}=o(),[m,p]=e(0),w=r(!1),E=n((()=>s&&s.current?s.current:"undefined"==typeof window?null:window),[s]);t((()=>{if(!
|
|
1
|
+
import{useState as e,useRef as r,useMemo as n,useEffect as t}from"react";import{useScrollContext as o}from"./useScrollContext.js";const l=({auto:l})=>{const{scrollContainerRef:s,scrollTargetRef:c,isLocked:u,isScrollSession:i,isScrollIncreasing:d,setIsLocked:v,setIsScrollSession:a,setIsScrolling:g,setIsScrollIncreasing:f}=o(),[m,p]=e(0),w=r(!1),E=n((()=>null!=l&&l&&i),[l,i]),S=n((()=>s&&s.current?s.current:"undefined"==typeof window?null:window),[s]);t((()=>{if(!S)return;const e=e=>{i&&u&&("mousedown"===e.type||"wheel"===e.type||"DOMMouseScroll"===e.type||"mousewheel"===e.type)&&v(!1)};return null==S||S.addEventListener("scroll",e),null==S||S.addEventListener("mousedown",e),null==S||S.addEventListener("wheel",e),null==S||S.addEventListener("DOMMouseScroll",e),null==S||S.addEventListener("mousewheel",e),()=>{null==S||S.removeEventListener("scroll",e),null==S||S.removeEventListener("mousedown",e),null==S||S.removeEventListener("wheel",e),null==S||S.removeEventListener("DOMMouseScroll",e),null==S||S.removeEventListener("mousewheel",e)}}),[S,i,u]),t((()=>{w.current=!u}),[u]),t((()=>{const e=setInterval((()=>{if(!s.current)return;const e=s.current.scrollHeight;if(e===m)return;const r=e>m;f(r),p(e),r&&l&&h()}),100);return()=>clearInterval(e)}),[s,m,l]),t((()=>{const e=setInterval((()=>{if(s.current)return;if(!c.current)return;const e=c.current.getBoundingClientRect().top+c.current.getBoundingClientRect().height+window.scrollY;if(e===m)return;const r=e>m;f(r),p(e),r&&E&&L()}),100);return()=>clearInterval(e)}),[c,m,E]);const h=()=>{try{if(g(!0),!s.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollContainerRef not detected"));if(w.current)return;const e=s.current.scrollHeight;s.current.scrollTo({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollContainerRef")}finally{g(!1)}},L=()=>{try{if(g(!0),!c.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollTargetRef not detected"));if(w.current)return;const e=c.current.getBoundingClientRect().top+c.current.getBoundingClientRect().height+window.scrollY;window.scroll({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollTargetRef")}finally{g(!1)}};return{isScrollIncreasing:d,scrollStartSession:()=>{a(!0),v(!0),w.current=!1},scrollEndSession:()=>{a(!1)},scrollToBottom:h,scrollToTarget:L}};export{l as useScroll};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleInput as r}from"../../../../hooks/studio/useStyleInput.js";import t from"../../../Core/Menu/index.js";import n from"../../../Core/Menu/Button.js";import a from"../../../Core/Menu/List.js";import i from"../../../../common/cn.js";const c=({id:c,children:l,placeholder:d,value:m,className:p,style:u,closeOnSelect:b=!0,maxToken:j=50,isDropdown:f=!1})=>{const{styles:x,colors:h}=o(),g=r();return f?s(t,Object.assign({id:c,closeOnSelect:b,className:"relative"},{children:[e(n,Object.assign({variant:"anchor",className:i("flex items-center justify-between rounded-sm border border-transparent py-3 pl-4 pr-3 shadow duration-300",p,j<=50&&"max-w-[400px]"),style:Object.assign(Object.assign({},g),u)},{children:e("p",Object.assign({className:"line-clamp-1 select-none"},{children:(null!=m?m:"")||d}))})),e(a,Object.assign({className:"p-3 shadow-md",border:"#ffffff"===h.secondaryText.toLowerCase()?"1px solid rgba(255,255,255,0.7)":"1px solid rgba(0,0,0,0.7)",align:"bottom-end",width:j<=50?"400px":"100%",style:Object.assign(Object.assign(Object.assign({},g),{borderRadius:x.cornerRadius}),u)},{children:l}))]})):e("div",{children:l})};export{c as default};
|