@kubit-ui-web/react-components 2.0.0-beta.2 → 2.0.0-beta.3
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/carousel/hooks/useCarousel.js +1 -1
- package/dist/cjs/components/carousel/hooks/useCarouselKeyNavigation.js +1 -1
- package/dist/cjs/components/carousel/hooks/useCarouselSwipe.js +1 -1
- package/dist/cjs/components/carousel/hooks/utils/calc.utils.js +1 -1
- package/dist/cjs/components/carousel/hooks/utils/dom.utils.js +1 -1
- package/dist/cjs/components/popover/hooks/positioning/middlewareUtils.js +1 -1
- package/dist/cjs/components/popover/hooks/usePopoverLifecycle.js +1 -1
- package/dist/cjs/components/popover/hooks/usePopoverPositioning.js +1 -1
- package/dist/cjs/components/popover/popover.js +1 -1
- package/dist/cjs/components/text/textStandAlone.js +1 -1
- package/dist/cjs/components/tooltip/hooks/useTooltip.js +1 -1
- package/dist/cjs/lib/provider/stylesProvider/stylesProvider.js +1 -1
- package/dist/esm/components/carousel/hooks/useCarousel.js +1 -1
- package/dist/esm/components/carousel/hooks/useCarouselKeyNavigation.js +1 -1
- package/dist/esm/components/carousel/hooks/useCarouselSwipe.js +1 -1
- package/dist/esm/components/carousel/hooks/utils/calc.utils.js +1 -1
- package/dist/esm/components/carousel/hooks/utils/dom.utils.js +1 -1
- package/dist/esm/components/popover/hooks/positioning/middlewareUtils.js +1 -1
- package/dist/esm/components/popover/hooks/usePopoverLifecycle.js +1 -1
- package/dist/esm/components/popover/hooks/usePopoverPositioning.js +1 -1
- package/dist/esm/components/popover/popover.js +1 -1
- package/dist/esm/components/text/textStandAlone.js +1 -1
- package/dist/esm/components/tooltip/hooks/useTooltip.js +1 -1
- package/dist/esm/lib/provider/stylesProvider/stylesProvider.js +2 -2
- package/package.json +8 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),n=require("../../../lib/utils/resizeObserver/resizeObserver.js"),t=require("./useCarouselKeyNavigation.js"),r=require("./useCarouselSwipe.js"),a=require("./utils/calc.utils.js"),i=require("./utils/constants.js"),u=require("./utils/dom.utils.js");exports.useCarousel=({
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),n=require("../../../lib/utils/resizeObserver/resizeObserver.js"),t=require("./useCarouselKeyNavigation.js"),r=require("./useCarouselSwipe.js"),a=require("./utils/calc.utils.js"),i=require("./utils/constants.js"),u=require("./utils/dom.utils.js");exports.useCarousel=({allowModifySliceWidth:s=!1,autoFitContainer:l=!1,centerExtremesWhenExtraPadding:c=!1,centerMode:o=!1,circular:d=!0,contentContainerRef:g,defaultPage:P=0,disabled:f=!1,elements:m,extraPadding:C=0,numElementsPerPage:w,numElementsToSlide:h,onePageAlign:E="center",onNumElementsPerPageChange:I,onNumPagesChange:x,onPageChange:R,rootContainerRef:b,viewerContainerRef:v})=>{const N=e.useRef(!0),S=e.useRef(P),p=e.useRef(P),y=e.useRef(w),L=e.useRef(0),V=e.useCallback(e=>{const n=g.current;if(!n||!y.current||e.propertyName!==i.default.PROPERTY_TO_HANDLE_TRANSITION_END||L.current<1)return;n.setAttribute("data-shifting","false");const{newPage:t}=u.default.udpateCarouselPositionOnEdge({contentContainer:n,currentPage:p.current,elementsLength:m.length,extraPadding:C,numElementsPerPage:y.current,numPages:L.current});p.current=t,S.current!==p.current&&(S.current=p.current,R?.(p.current));const{firstIndexInView:r,lastIndexInView:s}=a.default.calcFirstAndLastIndexInCarouselView({currentPage:p.current,elementsLength:m.length,isCircular:d,numElementsPerPage:y.current,numElementsToSlide:h});u.default.updateContentElementsAriaVisibility({contentContainer:n,firstIndexInView:r,lastIndexInView:s}),o&&u.default.applyCenterMode({contentContainer:n,firstIndexInView:r,lastIndexInView:s,numElementsPerPage:y.current}),N.current=!0},[m,C,h,d,o,R]),T=e.useCallback(({animated:e=!0,newPage:n})=>{const t=v.current,r=g.current;if(!t||!r||!N.current||!y.current||!m.length||L.current<1||(d?n<-1:n<0)||(d?n>L.current:n>L.current-1))return;e&&r.setAttribute("data-shifting","true"),u.default.deleteCenterMode({contentContainer:r}),p.current=n;const{firstIndexInView:l,lastIndexInView:o}=a.default.calcFirstAndLastIndexInCarouselView({currentPage:p.current,elementsLength:m.length,isCircular:d,numElementsPerPage:y.current,numElementsToSlide:h});s||u.default.updateViewerWidth({contentContainer:r,extraPadding:C,firstIndexInView:l,lastIndexInView:o,viewerContainer:t});const P=r.style.left,f=a.default.calcContentContainerLeftPosition({centerExtremesWhenExtraPadding:c,circular:d,contentContainer:r,currentPage:p.current,extraPadding:C,firstIndexInView:l,numPages:L.current});r.style.left=f,e&&P!==f?N.current=!1:V({propertyName:i.default.PROPERTY_TO_HANDLE_TRANSITION_END})},[m,h,d,s,C,c,V]),O=e.useCallback(()=>{const e=v.current,n=g.current;e&&n&&y.current&&(s&&(e.style.width="100%",u.default.updateSlicesWidth({centerMode:o,contentContainer:n,extraPadding:C,numElementsPerPage:y.current,viewerContainer:e})),u.default.manageCircularClones({circular:d,contentContainer:n,elementsLength:m.length,numElementsPerPage:y.current}),T({animated:!1,newPage:p.current}))},[s,o,d,m,C,T]),A=e.useCallback(()=>{const e=b.current,n=v.current,t=g.current;if(!e||!n||!t)return;e.style.width="100%";const r=w||a.default.calcNumElementsPerPage({contentContainer:t,elementsLength:m.length,extraPadding:C,rootContainer:e,viewerContainer:n})||1;l&&(e.style.width="fit-content"),r!==y.current&&(y.current=r,I?.(r));const i=a.default.calcNumPages({elementsLength:m.length,numElementsPerPage:r,numElementsToSlide:h});L.current!==i&&(L.current=i,x?.(i),p.current=Math.min(Math.max(0,P),i-1)),i<=1&&u.default.alignOnePageCarousel({allowModifySliceWidth:s,contentContainer:t,onePageAlign:E,rootContainer:e})},[s,m,C,w,h,E,l,I,x,R]),M=e.useCallback(()=>{A(),O()},[A,O]);return e.useEffect(()=>{const e=g.current;if(!e)return;M(),window.addEventListener("resize",M);const t=new n.ResizeObserver(M);return t.observe(e),()=>{window.removeEventListener("resize",M),t.disconnect()}},[M]),e.useEffect(()=>{const e=g.current;return e?.addEventListener("transitionend",V),()=>{e?.removeEventListener("transitionend",V)}},[V]),r.useCarouselSwipe({allowShiftRef:N,centerExtremesWhenExtraPadding:c,changePage:T,circular:d,contentContainerRef:g,currentPageRef:p,disabled:f,elements:m,extraPadding:C,numElementsPerPageRef:y,numPagesRef:L,viewerContainerRef:v}),t.useCarouselKeyNavigation({allowShiftRef:N,changePage:T,circular:d,currentPageRef:p,disabled:f,numPagesRef:L,rootContainerRef:b}),{allowShiftRef:N,changePage:T,currentPageRef:p,numElementsPerPageRef:y,numPagesRef:L}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../../../lib/utils/keyboard/keyboard.js");exports.useCarouselKeyNavigation=({
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../../../lib/utils/keyboard/keyboard.js");exports.useCarouselKeyNavigation=({allowShiftRef:t,changePage:n,circular:u,currentPageRef:o,disabled:s=!1,numPagesRef:c,rootContainerRef:a})=>{e.useEffect(()=>{if(s)return;const e=e=>{!t.current||c.current<=1||(r.isArrowLeftPressed(e.key)?t.current&&(u||0!==o.current)&&n({newPage:o.current-1}):r.isArrowRightPressed(e.key)&&t.current&&(u||o.current!==c.current-1)&&n({newPage:o.current+1}))},i=a.current;return i?.addEventListener("keydown",e),()=>{i?.removeEventListener("keydown",e)}},[u,n,s])};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("../../../lib/hooks/useScrollBlock/useScrollBlock.js"),r=require("./utils/calc.utils.js"),n=require("./utils/constants.js");exports.useCarouselSwipe=({
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("../../../lib/hooks/useScrollBlock/useScrollBlock.js"),r=require("./utils/calc.utils.js"),n=require("./utils/constants.js");exports.useCarouselSwipe=({allowShiftRef:c,centerExtremesWhenExtraPadding:u,changePage:s,circular:l,contentContainerRef:o,currentPageRef:a,disabled:i=!1,elements:f,extraPadding:d,numElementsPerPageRef:v,numPagesRef:E,viewerContainerRef:m})=>{const h=e.useRef(!1),L=e.useRef(!1),R=e.useRef(!1),_=e.useRef(),p=e.useRef(0),D=e.useRef(0),S=e.useRef(0),g=e.useRef(0),b=e.useCallback(()=>{c.current&&(l||a.current!==E.current-1)&&s({newPage:a.current+1})},[l,s]),C=e.useCallback(()=>{c.current&&(l||0!==a.current)&&s({newPage:a.current-1})},[l,s]),{allowScroll:y,blockScroll:P}=t.useScrollBlock(),X=e.useCallback(e=>{const t=o.current;!t||E.current<=1||(_.current=parseFloat(t.style.left||"0"),"touchstart"===e.type?(p.current=e.touches[0].clientX,S.current=e.touches[0].clientX,g.current=e.touches[0].clientY):(p.current=e.clientX,S.current=e.clientX,g.current=e.clientY),h.current=!0)},[]),k=e.useCallback(e=>{const t=o.current;if(!t||!h.current||!v?.current||E.current<=1)return;let c,s;"touchmove"===e.type?(D.current=p.current-e.touches[0].clientX,p.current=e.touches[0].clientX,c=e.touches[0].clientX-S.current,s=e.touches[0].clientY-g.current):(D.current=p.current-e.clientX,p.current=e.clientX,c=e.clientX-S.current,s=e.clientY-g.current);const i=parseFloat(t.style.left||"0")-D.current;if(L.current||R.current||(Math.abs(c)>n.default.THRESHOLD_TO_DECIDE_IF_ALLOW_DRAGGING?(L.current=!0,P()):Math.abs(s)>n.default.THRESHOLD_TO_DECIDE_IF_ALLOW_DRAGGING&&(R.current=!0)),L.current)if(l&&f.length>v.current)t.style.left=`${i}px`;else{const e=r.default.calcXDistanceBetween2Elements(t.firstChild,t.children[t.children.length-v.current]);if(u)i-d<0&&-i<e-d&&(t.style.left=`${i}px`);else{let r=l?d:0;!l&&d&&a.current===E.current-1&&(r=2*d),i-r<0&&-i<e-r&&(t.style.left=`${i}px`)}}},[P,u,l,f,d]),O=e.useCallback(()=>{const e=o.current;if(R.current=!1,L.current&&y(),L.current=!1,!e||!h.current||void 0===_.current||E.current<=1)return;h.current=!1;const t=parseFloat(e.style.left||"0");t-_.current<-0?b():t-_.current>n.default.THRESHOLD_TO_DECIDE_IF_SWIPE_ON_DRAG_ENDS?C():e.style.left=`${_.current}px`},[y,b,C]);e.useEffect(()=>{if(i)return;const e=m.current,t={passive:!0};return e?.addEventListener("touchstart",X,t),e?.addEventListener("touchend",O,t),e?.addEventListener("touchmove",k,t),e?.addEventListener("mousedown",X,t),e?.addEventListener("mouseup",O,t),e?.addEventListener("mousemove",k,t),e?.addEventListener("mouseleave",O,t),()=>{e?.removeEventListener("touchstart",X,t),e?.removeEventListener("touchend",O,t),e?.removeEventListener("touchmove",k,t),e?.removeEventListener("mousedown",X,t),e?.removeEventListener("mouseup",O,t),e?.removeEventListener("mousemove",k,t),e?.removeEventListener("mouseleave",O,t)}},[X,O,k,i])};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=({element:e})=>{const t=window.getComputedStyle(e);return parseFloat(t.getPropertyValue("padding-left")||"0")+parseFloat(t.getPropertyValue("padding-right")||"0")},t=(e,t)=>{if(!e||!t)return 0;const n=e.offsetLeft,r=t.offsetLeft;return Math.abs(r-n)},n=({numElementsPerPage:e,numElementsToSlide:t})=>t?Math.max(1,Math.min(t,e)):e,r=({elementsLength:e,numElementsPerPage:t,numElementsToSlide:r})=>{if(e<=t)return 1;const l=n({numElementsToSlide:r
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=({element:e})=>{const t=window.getComputedStyle(e);return parseFloat(t.getPropertyValue("padding-left")||"0")+parseFloat(t.getPropertyValue("padding-right")||"0")},t=(e,t)=>{if(!e||!t)return 0;const n=e.offsetLeft,r=t.offsetLeft;return Math.abs(r-n)},n=({numElementsPerPage:e,numElementsToSlide:t})=>t?Math.max(1,Math.min(t,e)):e,r=({elementsLength:e,numElementsPerPage:t,numElementsToSlide:r})=>{if(e<=t)return 1;const l=n({numElementsPerPage:t,numElementsToSlide:r});return Math.ceil((e-t+l)/l)},l=({currentPage:e,elementsLength:t,isCircular:l,numElementsPerPage:s,numElementsToSlide:i})=>{if(t<=s)return{firstIndexInView:0,lastIndexInView:t-1};const o=n({numElementsPerPage:s,numElementsToSlide:i});let a=e*o+s-1;let c=0;l&&t>s&&(c=s+1,a+=c),e===r({elementsLength:t,numElementsPerPage:s,numElementsToSlide:o})?a=c+t+s-1:e<0?a=c-1:a-c>t-1&&(a=c+t-1);return{firstIndexInView:a-s+1,lastIndexInView:a}},s=({contentContainer:t,elementsLength:n,extraPadding:r,rootContainer:l,viewerContainer:s})=>{const i=t.firstElementChild;if(!i)return;let o=l.offsetWidth;o-=2*r;o-=e({element:s});let a=0;const c=i.offsetLeft;for(let e=0;e<t.children.length;e++){const n=t.children[e];if(c+n.offsetLeft+n.offsetWidth>o)break;a++}return Math.max(Math.min(n,a),1)},i=({centerMode:e,contentContainer:t})=>{let n=0;if(t.childNodes.length<2)return n;const r=t.childNodes[0],l=t.childNodes[1];e&&r.style&&l.style&&(r.style.transition="none",l.style.transition="none",r.style.transform="scale(1)",l.style.transform="scale(1)");const s=r?.getBoundingClientRect()?.right,i=l?.getBoundingClientRect()?.left;return e&&r.style&&l.style&&(r.style.removeProperty("transform"),l.style.removeProperty("transform"),r.offsetHeight,l.offsetHeight,r.style.removeProperty("transition"),l.style.removeProperty("transition")),void 0!==s&&void 0!==i&&(n=Math.abs(s-i)),n},o=({centerMode:t,contentContainer:n,extraPadding:r,numElementsPerPage:l,viewerContainer:s})=>{const o=(l-1)*i({centerMode:t,contentContainer:n}),a=e({element:s});return(s.getBoundingClientRect().width-o-2*r-a)/l},a=({contentContainer:n,extraPadding:r,firstIndexInView:l,lastIndexInView:s,viewerContainer:i})=>{const o=n.children[l],a=n.children[s],c=t(o,a),d=e({element:i});return`${c+a.offsetWidth+2*r+d}px`},c=({centerExtremesWhenExtraPadding:e,circular:n,contentContainer:r,currentPage:l,extraPadding:s,firstIndexInView:i,numPages:o})=>{let a=t(r.firstChild,r.children[i]);return s&&(e||n||0!==l&&l!==o-1?a-=s:n||l!==o-1||(a-=2*s)),-a+"px"},d={calcAdjustedNumElementsToSlide:n,calcContentContainerLeftPosition:c,calcFirstAndLastIndexInCarouselView:l,calcGapBetweenContentContainerElements:i,calcNumElementsPerPage:s,calcNumPages:r,calcSliceWidth:o,calcViewerWidth:a,calcXDistanceBetween2Elements:t};exports.calcAdjustedNumElementsToSlide=n,exports.calcContentContainerLeftPosition=c,exports.calcFirstAndLastIndexInCarouselView=l,exports.calcGapBetweenContentContainerElements=i,exports.calcHorizontalElementPadding=e,exports.calcNumElementsPerPage=s,exports.calcNumPages=r,exports.calcSliceWidth=o,exports.calcViewerWidth=a,exports.calcXDistanceBetween2Elements=t,exports.default=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calc.utils.js"),t=({
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calc.utils.js"),t=({centerMode:t,contentContainer:n,extraPadding:i,numElementsPerPage:r,viewerContainer:l})=>{const o=e.default.calcSliceWidth({centerMode:t,contentContainer:n,extraPadding:i,numElementsPerPage:r,viewerContainer:l});for(let e=0;e<n.childNodes.length;e++){const t=n.childNodes[e];t instanceof HTMLElement&&(t.style.width=`${o}px`)}},n=({contentContainer:e,firstIndexInView:t,lastIndexInView:n})=>{for(let i=0;i<e.children.length;i++)i<t||i>n?e.children[i].setAttribute("inert",""):e.children[i].removeAttribute("inert")},i=({contentContainer:t,extraPadding:n,firstIndexInView:i,lastIndexInView:r,viewerContainer:l})=>{const o=e.default.calcViewerWidth({contentContainer:t,extraPadding:n,firstIndexInView:i,lastIndexInView:r,viewerContainer:l});l.style.width=o},r=({contentContainer:e,firstIndexInView:t,lastIndexInView:n,numElementsPerPage:i})=>{if(i%2!=0){const i=t+(n-t)/2;e.children[i].setAttribute("data-highlighted","true")}},l=({contentContainer:e})=>{for(let t=0;t<e.children.length;t++)e.children[t].removeAttribute("data-highlighted")},o=({circular:e,contentContainer:t,elementsLength:n,numElementsPerPage:i})=>{if(t.children.length>n){const e=(t.children.length-n)/2;for(let n=0;n<e;n++)t.firstElementChild&&t.removeChild(t.firstElementChild),t.lastElementChild&&t.removeChild(t.lastElementChild)}if(e&&n>i){const e=[],n=[],r=t.children.length,l=i+1;for(let i=0;i<l;i++){const l=t.children[i];l&&e.push(l.cloneNode(!0));const o=t.children[r-1-i];o&&n.push(o.cloneNode(!0))}e.forEach(e=>t.appendChild(e)),n.forEach(e=>t.insertBefore(e,t.firstChild))}},a={center:"center",left:"flex-start",right:"flex-end"},d=({allowModifySliceWidth:e,contentContainer:t,onePageAlign:n,rootContainer:i})=>{e?t.style.justifyContent=a[n]:i.style.justifyContent=a[n]},s=({contentContainer:t,currentPage:n,elementsLength:i,extraPadding:r,numElementsPerPage:l,numPages:o})=>{const a=n===o;if(a||-1===n){const n=a?l+1:i+1;let d=e.default.calcXDistanceBetween2Elements(t.firstChild,t.children[n]);return d-=r,t.style.left=-d+"px",{newPage:a?0:o-1}}return{newPage:n}},c={alignOnePageCarousel:d,applyCenterMode:r,deleteCenterMode:l,manageCircularClones:o,udpateCarouselPositionOnEdge:s,updateContentElementsAriaVisibility:n,updateSlicesWidth:t,updateViewerWidth:i};exports.alignOnePageCarousel=d,exports.applyCenterMode=r,exports.default=c,exports.deleteCenterMode=l,exports.manageCircularClones=o,exports.udpateCarouselPositionOnEdge=s,exports.updateContentElementsAriaVisibility=n,exports.updateSlicesWidth=t,exports.updateViewerWidth=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@floating-ui/dom"),t=require("../../utils/placement.utils.js");exports.calculateMainAxisOffset=({arrowSize:e,hasArrow:t,offsetDistance:i})=>"number"==typeof i?.[0]?i[0]:t?e:0,exports.getMiddlewareStack=({arrowElement:i,customMiddlewares:s,edgePadding:r,hideWhenDetached:a,isBodyAnchor:n,mainAxisOffset:d,offsetDistance:o,placement:h})=>{let c=[];return c=s?.length?[...s]:n?((i,s)=>{const r=t.getPlacementDirection(i),a=[];return"center"===r?a.push(e.shift({crossAxis:!0,mainAxis:!0,padding:s})):r.startsWith("right")||r.startsWith("left")?a.push(e.offset({alignmentAxis:0,mainAxis:0})):(r.startsWith("bottom")||r.startsWith("top"))&&a.push(e.offset({mainAxis:0})),a})(h,r):((t,i,s)=>{const r=[];return r.push(e.offset({crossAxis:i?.[1]||0,mainAxis:t})),r.push(e.flip({fallbackAxisSideDirection:"start",padding:s})),r.push(e.shift({padding:s})),r})(d,o,r),(({
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@floating-ui/dom"),t=require("../../utils/placement.utils.js");exports.calculateMainAxisOffset=({arrowSize:e,hasArrow:t,offsetDistance:i})=>"number"==typeof i?.[0]?i[0]:t?e:0,exports.getMiddlewareStack=({arrowElement:i,customMiddlewares:s,edgePadding:r,hideWhenDetached:a,isBodyAnchor:n,mainAxisOffset:d,offsetDistance:o,placement:h})=>{let c=[];return c=s?.length?[...s]:n?((i,s)=>{const r=t.getPlacementDirection(i),a=[];return"center"===r?a.push(e.shift({crossAxis:!0,mainAxis:!0,padding:s})):r.startsWith("right")||r.startsWith("left")?a.push(e.offset({alignmentAxis:0,mainAxis:0})):(r.startsWith("bottom")||r.startsWith("top"))&&a.push(e.offset({mainAxis:0})),a})(h,r):((t,i,s)=>{const r=[];return r.push(e.offset({crossAxis:i?.[1]||0,mainAxis:t})),r.push(e.flip({fallbackAxisSideDirection:"start",padding:s})),r.push(e.shift({padding:s})),r})(d,o,r),(({arrowElement:t,edgePadding:i,hideWhenDetached:s,isBodyAnchor:r,middlewareStack:a})=>{!r&&s&&a.push(e.hide()),t&&a.push(e.arrow({element:t,padding:i}))})({arrowElement:i,edgePadding:r,hideWhenDetached:a,isBodyAnchor:n,middlewareStack:c}),c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../../../lib/hooks/syncRefs/syncRefs.js"),l=require("../../../lib/hooks/useScrollBlock/useScrollBlock.js"),n=require("../../../lib/hooks/useSwipeDown/utils/convertDurationToNumber.js"),o=require("../../../lib/utils/focusHandlers/focusHandlers.js");exports.usePopoverLifecycle=({animationExitDuration:s=200,disableAnimations:t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../../../lib/hooks/syncRefs/syncRefs.js"),l=require("../../../lib/hooks/useScrollBlock/useScrollBlock.js"),n=require("../../../lib/hooks/useSwipeDown/utils/convertDurationToNumber.js"),o=require("../../../lib/utils/focusHandlers/focusHandlers.js");exports.usePopoverLifecycle=({animationExitDuration:s=200,disableAnimations:t,disableAutoFocusFirstDescendant:u=!1,disableAutoFocusFirstDescendantAfterClose:c=!0,disableRestoreFocusAfterClose:i=!1,disableScrollBackground:a=!1,open:f=!1,popoverContainerRef:d,preventScrollOnCloseFocus:b=!1})=>{const m=e.useRef(null),S=e.useRef(!1),k=e.useRef(null),p=e.useRef(null),[R,v]=e.useState(f),[C,w]=e.useState(!1),F=n.convertDurationToNumber(s),{allowScroll:D,blockScroll:y}=l.useScrollBlock(),A=e.useCallback(()=>{!u&&m.current&&o.focusFirstDescendant({element:m.current,preventScroll:!0})},[u]),T=e.useCallback(()=>{i?c||o.focusFirstDescendant({element:document.body}):p.current?.focus({preventScroll:b})},[i,b,c]);e.useEffect(()=>{f&&(p.current=document.activeElement,v(!0),w(!1))},[f]),e.useEffect(()=>(!f&&R&&(t?(T(),v(!1),w(!1)):(w(!0),k.current=window.setTimeout(()=>{T(),v(!1),w(!1)},F))),()=>{null!==k.current&&(window.clearTimeout(k.current),k.current=null)}),[f,R,t,F,T]);const j=e.useCallback(e=>{m.current=e,A(),a&&!S.current&&(S.current=!0,y({elementsToOmit:[m.current]}))},[y,A,a]),q=e.useCallback(()=>{S.current&&D(),m.current=null},[D]);return{handleInnerRef:e.useCallback(e=>{e?j(e):q(),r.syncInnerAndForwardedRef({forwardedRef:d,innerRef:m})},[d,q,j]),isClosing:C,isVisible:R,popoverRef:m}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@floating-ui/dom"),t=require("react"),r=require("./positioning/arrowPositionStyles.js"),n=require("./positioning/middlewareUtils.js"),i=require("./positioning/positionCalculation.js"),a=require("./positioning/positionStyles.js");exports.usePopoverPositioning=({anchorElement:s,arrowStyles:o,isVisible:c,middlewareOptions:d={},middlewares:l=[],placement:u,ref:m,strategy:f})=>{const{edgePadding:p=0,hideWhenDetached:g,offsetDistance:w}=d,y=t.useRef(document.body),h=t.useRef(null),b=t.useRef({anchorElement:s,arrowStyles:o,isVisible:c,middlewareOptions:{edgePadding:p,hideWhenDetached:g,offsetDistance:w},middlewares:l,placement:u,ref:m,strategy:f});t.useEffect(()=>{b.current={anchorElement:s,arrowStyles:o,isVisible:c,middlewareOptions:{edgePadding:p,hideWhenDetached:g,offsetDistance:w},middlewares:l,placement:u,ref:m,strategy:f}},[s,u,w,p,g,l,f,c,m,o]);const S=t.useCallback(()=>m?.current&&c&&o?(h.current=m.current.querySelector('[data-kbt-id="popover-arrow"]'),h.current):null,[m,c,o]);t.useEffect(()=>{const e=()=>{!S()&&c&&o&&m?.current&&requestAnimationFrame(e)};e()},[S,c,o]);const P=t.useCallback((e,t)=>e&&t?.current&&document.body.contains(t.current),[]),k=t.useCallback((e,t,n,i,s,c,d,l,u,m,f,p,g,w=[],y=[])=>{e?.current&&(a.applyPositionStyles({edgePadding:d,hasCustomMiddlewares:w.length>0,isBodyAnchor:t,middlewareStack:y,placement:n,ref:e,strategy:c,x:i,y:s}),t||e.current.setAttribute("data-kbt-placement",m),r.positionArrow(!!o,l,u,m,f,p),g?.())},[o]),D=t.useCallback((e,t,r,i,a,s,c)=>{const d=n.calculateMainAxisOffset({arrowSize:t,hasArrow:!!o,offsetDistance:e}),l=h.current;return{arrowElement:l,middlewareStack:n.getMiddlewareStack({arrowElement:l,customMiddlewares:s,edgePadding:i,hideWhenDetached:c?.hideWhenDetached,isBodyAnchor:r,mainAxisOffset:d,offsetDistance:e,placement:a})}},[o]),E=t.useCallback((e,t,r,n,i,a,s,o,c,d,l,u,m,f=[],p=[])=>{const g=t.hide?.referenceHidden||t.hide?.escaped;e.current&&(e.current.style.opacity=g?"0":"",e.current.style.pointerEvents=g?"none":""),g||k(e,r,n,i,a,s,o,c,t,d,l,u,m,f,p)},[k]),C=t.useCallback(async()=>{const{anchorElement:t,arrowStyles:r,middlewareOptions:n,middlewares:a,onPositioned:s,placement:o,ref:c,strategy:d}=b.current,l=n?.offsetDistance,u=n?.edgePadding??8,m=r?.size||0,f=t||y.current;if(!c?.current||!P(f,c))return;const p=f===document.body,{arrowElement:g,middlewareStack:w}=D(l,m,p,u,o,a,n||{}),{actualPlacement:h,autoStrategy:S}=i.determinePositioningConfig(p,d,o),k="center"===h?"top":h,C=await e.computePosition(f,c.current,{middleware:w,placement:k,strategy:S}),{middlewareData:q,placement:A,x:O,y:x}=C;E(c,q,p,h,O,x,d,u,g,A,l,m,s,a,w)},[]);t.useEffect(()=>{if(!c||!m?.current)return;m.current.offsetHeight,C();const t=s??y.current;let r=()=>{};return r=e.autoUpdate(t,m.current,C,{ancestorResize:!0,ancestorScroll:!0,animationFrame:!1,elementResize:!0}),()=>{r()}},[c,s,C])};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../_virtual/jsx-runtime.js"),s=require("react"),o=require("../../lib/hooks/useClassName/useClassName.js"),r=require("../../lib/hooks/useTrapFocus/useTrapFocus.js"),i=require("./hooks/usePopoverInteractions.js"),l=require("./hooks/usePopoverLifecycle.js"),a=require("./hooks/usePopoverPositioning.js"),n=require("./popoverStandAlone.js"),t=s.forwardRef(({additionalClasses:s,anchorElement:t,animationExitDuration:u=200,disableAnimations:c=!1,disableAutoFocusFirstDescendant:p=!1,disableAutoFocusFirstDescendantAfterClose:d=!0,disableClickOverlayClose:C=!1,disableEscapeClose:b=!1,disableRestoreFocusAfterClose:m=!1,disableScrollBackground:v=!1,disableTrapFocus:f=!1,middlewareOptions:F,middlewares:A,onClose:P,open:O=!1,preventCloseOnClickElements:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../_virtual/jsx-runtime.js"),s=require("react"),o=require("../../lib/hooks/useClassName/useClassName.js"),r=require("../../lib/hooks/useTrapFocus/useTrapFocus.js"),i=require("./hooks/usePopoverInteractions.js"),l=require("./hooks/usePopoverLifecycle.js"),a=require("./hooks/usePopoverPositioning.js"),n=require("./popoverStandAlone.js"),t=s.forwardRef(({additionalClasses:s,anchorElement:t,animationExitDuration:u=200,disableAnimations:c=!1,disableAutoFocusFirstDescendant:p=!1,disableAutoFocusFirstDescendantAfterClose:d=!0,disableClickOverlayClose:C=!1,disableEscapeClose:b=!1,disableRestoreFocusAfterClose:m=!1,disableScrollBackground:v=!1,disableTrapFocus:f=!1,middlewareOptions:F,middlewares:A,onClose:P,open:O=!1,popoverContainerRef:g,preventCloseOnClickElements:j=[],preventScrollOnCloseFocus:k=!1,strategy:y="absolute",...E},R)=>{const S=c||!!t,h=o.useClassName({additionalClassNames:s,component:"POPOVER"}),{handleInnerRef:q,isClosing:w,isVisible:x,popoverRef:D}=l.usePopoverLifecycle({animationExitDuration:u,disableAnimations:S,disableAutoFocusFirstDescendant:p,disableAutoFocusFirstDescendantAfterClose:d,disableRestoreFocusAfterClose:m,disableScrollBackground:v,open:O,popoverContainerRef:g,preventScrollOnCloseFocus:k});return r.useTrapFocus({ref:D,trapFocus:!f&&x}),i.usePopoverInteractions({disableClickOverlayClose:C,disableEscapeClose:b,isVisible:x,onClose:P,popoverRef:D,preventCloseOnClickElements:j}),a.usePopoverPositioning({anchorElement:t,arrowStyles:E.arrowStyles,isVisible:x,middlewareOptions:F,middlewares:A,placement:E.placement,ref:D,strategy:y}),e.jsxRuntimeExports.jsx(n.PopoverStandAlone,{ref:R,...E,anchorElement:!!t,cssClasses:h,disableAnimations:S,isClosing:w,isVisible:x,middlewareOptions:F,popoverContainerRef:q,strategy:y})});exports.Popover=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../_virtual/jsx-runtime.js");;/* empty css */const e=require("react"),r=require("../../lib/utils/classNames/classNames.js"),s=require("../../lib/utils/pickCustomAttributes/pickCustomAttributes.js"),o=require("../../lib/components/customComponent/customComponent.js"),i=e.forwardRef(({align:e,children:i,color:a,component:n,cssClasses:l,cursor:c,customAttributes:u,decoration:d,disabled:m,display:x,draggable:p,filter:b,htmlFor:g,id:j,maxTruncatedLines:k,onClick:C,role:f,target:A,textSizeAdjust:h,textWrap:q,transform:w,truncate:y,weight:S,wordBreak:W,wordWrap:N,...T},v)=>{const z=s.pickCustomAttributes({...T,...u}),B=r.classNames("kbt-text",l?.text,{"kbt-text--disabled":m??!1},{"kbt-text--truncate":y||!!k}),F={color:a,cursor:c,display:x,filter:b,fontWeight:S,textAlign:e,textDecoration:d,textTransform:w,textWrap:q,wordBreak:W,wordWrap:N
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../_virtual/jsx-runtime.js");;/* empty css */const e=require("react"),r=require("../../lib/utils/classNames/classNames.js"),s=require("../../lib/utils/pickCustomAttributes/pickCustomAttributes.js"),o=require("../../lib/components/customComponent/customComponent.js"),i=e.forwardRef(({align:e,children:i,color:a,component:n,cssClasses:l,cursor:c,customAttributes:u,decoration:d,disabled:m,display:x,draggable:p,filter:b,htmlFor:g,id:j,maxTruncatedLines:k,onClick:C,role:f,target:A,textSizeAdjust:h,textWrap:q,transform:w,truncate:y,weight:S,wordBreak:W,wordWrap:N,...T},v)=>{const z=s.pickCustomAttributes({...T,...u}),B=r.classNames("kbt-text",l?.text,{"kbt-text--disabled":m??!1},{"kbt-text--truncate":y||!!k}),F={color:a,cursor:c,display:x,filter:b,fontWeight:S,textAlign:e,textDecoration:d,textSizeAdjust:h,textTransform:w,textWrap:q,wordBreak:W,wordWrap:N};return t.jsxRuntimeExports.jsx(o.CustomComponent,{ref:v,className:B,component:n,"data-testid":"text",draggable:p,htmlFor:g,id:j,role:f,style:F,target:A,onClick:C,...z,children:i})});exports.TextStandAlone=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@floating-ui/dom"),t=require("react"),o=require("../../../lib/hooks/useClassName/useClassName.js"),r=require("../../../lib/hooks/useClickOutside/useClickOutside.js"),s=require("../../../lib/hooks/useEscPressed/useEscPressed.js"),i=require("../../../lib/hooks/useMediaDevice/useActiveBreakpoints.js"),l=require("../../../lib/types/breakpoints/breakpoints.js"),n=require("../../../lib/types/positions/positions.js"),a=require("../../../lib/utils/focusHandlers/focusHandlers.js"),u=require("../positioning/computePosition.js");exports.useTooltip=({align:c=n.POSITIONS.TOP,...p})=>{const{device:d,isDesktop:f,isTablet:O}=i.useActiveBreakpoints(),m=f||O,b=t.useRef(null),P=t.useRef(!0),y=t.useRef(!1),[T,E]=t.useState(!1),[R,S]=t.useState(c),v=o.useClassName({additionalClassNames:p.additionalClasses,component:"TOOLTIP",variant:p.variant}),g=async()=>{if(!p.labelRef.current||!p.tooltipRef.current)return;const t=p.tooltipRef.current.lastElementChild;try{const o=await u.computePosition(p.labelRef.current,p.tooltipRef.current,{middleware:[e.flip(),e.shift({padding:4}),e.arrow({element:t})],placement:c,strategy:"absolute"}),{middlewareData:r,placement:s,x:i,y:a}=o;S(s),Object.assign(p.tooltipRef.current.style,{left:`${i}px`,top:`${a}px`});const{x:d,y:f}=r.arrow,O={bottom:n.POSITIONS.TOP,left:n.POSITIONS.RIGHT,right:n.POSITIONS.LEFT,top:n.POSITIONS.BOTTOM}[R.split("-")[0]],m={bottom:"",left:null!==d?`${d}px`:"",right:"",[O]:`calc(${v.tooltipexternalcontainer?.[l.DEVICE_BREAKPOINTS.DESKTOP]?.padding??0} - ${v.arrowposition?.[l.DEVICE_BREAKPOINTS.DESKTOP]?.top??"0px"} / 2)`,top:null!==f?`${f}px`:""};t&&t.style&&(t.style.removeProperty("left"),t.style.removeProperty("top"),t.style.removeProperty("right"),t.style.removeProperty("bottom"),Object.assign(t?.style,m))}catch(o){}},w=e=>{p.tooltipRef.current?.contains(e.target)||g()};t.useEffect(()=>{const e=()=>{g()};return window.addEventListener("scroll",w,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",e)}},[]);const C=t.useCallback(()=>{if(y.current){if(y.current=!1,P.current=!1,p.tooltipAsModal&&b.current?.focus({preventScroll:!0}),P.current=!0,m){if(!p.tooltipRef.current)return;p.tooltipRef.current.style.display="none"}E(!1),p.onOpenClose?.(!1)}},[d,p.onOpenClose,p.tooltipAsModal]),I=t.useCallback(e=>{y.current&&(e.stopPropagation(),C())},[C]);return s.useEscPressed({disableStopPropagation:!0,onEscPress:I,ref:p.labelRef}),r.useClickOutside(p.tooltipRef,C,[p.labelRef.current]),{allowFocusOpenTooltip:P,hideTooltip:C,open:T,placement:R,showTooltip:()=>{if(!y.current){if(y.current=!0,b.current=document.activeElement,m){if(!p.tooltipRef.current)return;p.tooltipRef.current.style.display="flex",g(),a.focusElementOrFirstDescendant(p.tooltipRef.current,{preventScroll:!0})}E(!0),p.onOpenClose?.(!0)}}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../_virtual/jsx-runtime.js"),t=require("react"),s=require("../cssProvider/provider.js"),r=t.createContext(void 0),n={lg:992,md:768,sm:576,xl:1200};exports.StylesContext=r,exports.StylesProvider=({breakpoints:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../_virtual/jsx-runtime.js"),t=require("react"),s=require("../cssProvider/provider.js"),r=t.createContext(void 0),n={lg:992,md:768,sm:576,xl:1200};exports.StylesContext=r,exports.StylesProvider=({bernovaProvider:o,breakpoints:i=n,children:l,icons:a={},illustrations:d={},jsInCss:m=!0,linkId:c="kb-styled-provider",themeSelected:u})=>{const x=i,h=(e=>({onlyDesktop:`(max-width: ${e.xl}px)`,onlyLargeDesktop:`(min-width: ${e.xl}px)`,onlyMobile:`(max-width: ${e.md-1}px)`,onlyTablet:`(min-width: ${e.md}px) and (max-width: ${e.lg-1}px)`}))(i),p=a,v=d,y=t.useMemo(()=>new(o||s.Provider)({jsInCss:m,linkId:c}),[]),[S,C]=t.useState(u||y.themeSelected);y.themeSelected=S||"";return e.jsxRuntimeExports.jsx(r.Provider,{value:{breakpoints:x,changeTheme:e=>{try{y.themeSelected=e,C(e)}catch(t){}},classes:[],currentTheme:S,getComponentStyles:({additionalClassNames:e,component:t,variant:s})=>{try{return y.getComponentStyles({additionalClassNames:e,component:t,variant:s||""})}catch(r){return{}}},icons:p,illustrations:v,mediaQueries:h,themeClassNames:y.classNames,themes:y.allThemes,themeVariables:y.variables},children:l})},exports.useStylesContext=()=>{const e=t.useContext(r);if(!e)throw new Error("useStylesContext must be used within a StylesProvider");return e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRef as e,useCallback as n,useEffect as t}from"react";import{ResizeObserver as r}from"../../../lib/utils/resizeObserver/resizeObserver.js";import{useCarouselKeyNavigation as a}from"./useCarouselKeyNavigation.js";import{useCarouselSwipe as i}from"./useCarouselSwipe.js";import c from"./utils/calc.utils.js";import o from"./utils/constants.js";import s from"./utils/dom.utils.js";const u=({
|
|
1
|
+
import{useRef as e,useCallback as n,useEffect as t}from"react";import{ResizeObserver as r}from"../../../lib/utils/resizeObserver/resizeObserver.js";import{useCarouselKeyNavigation as a}from"./useCarouselKeyNavigation.js";import{useCarouselSwipe as i}from"./useCarouselSwipe.js";import c from"./utils/calc.utils.js";import o from"./utils/constants.js";import s from"./utils/dom.utils.js";const u=({allowModifySliceWidth:u=!1,autoFitContainer:l=!1,centerExtremesWhenExtraPadding:d=!1,centerMode:m=!1,circular:g=!0,contentContainerRef:P,defaultPage:f=0,disabled:C=!1,elements:h,extraPadding:w=0,numElementsPerPage:E,numElementsToSlide:I,onePageAlign:x="center",onNumElementsPerPageChange:R,onNumPagesChange:p,onPageChange:v,rootContainerRef:L,viewerContainerRef:N})=>{const V=e(!0),S=e(f),y=e(f),T=e(E),A=e(0),b=n(e=>{const n=P.current;if(!n||!T.current||e.propertyName!==o.PROPERTY_TO_HANDLE_TRANSITION_END||A.current<1)return;n.setAttribute("data-shifting","false");const{newPage:t}=s.udpateCarouselPositionOnEdge({contentContainer:n,currentPage:y.current,elementsLength:h.length,extraPadding:w,numElementsPerPage:T.current,numPages:A.current});y.current=t,S.current!==y.current&&(S.current=y.current,v?.(y.current));const{firstIndexInView:r,lastIndexInView:a}=c.calcFirstAndLastIndexInCarouselView({currentPage:y.current,elementsLength:h.length,isCircular:g,numElementsPerPage:T.current,numElementsToSlide:I});s.updateContentElementsAriaVisibility({contentContainer:n,firstIndexInView:r,lastIndexInView:a}),m&&s.applyCenterMode({contentContainer:n,firstIndexInView:r,lastIndexInView:a,numElementsPerPage:T.current}),V.current=!0},[h,w,I,g,m,v]),O=n(({animated:e=!0,newPage:n})=>{const t=N.current,r=P.current;if(!t||!r||!V.current||!T.current||!h.length||A.current<1||(g?n<-1:n<0)||(g?n>A.current:n>A.current-1))return;e&&r.setAttribute("data-shifting","true"),s.deleteCenterMode({contentContainer:r}),y.current=n;const{firstIndexInView:a,lastIndexInView:i}=c.calcFirstAndLastIndexInCarouselView({currentPage:y.current,elementsLength:h.length,isCircular:g,numElementsPerPage:T.current,numElementsToSlide:I});u||s.updateViewerWidth({contentContainer:r,extraPadding:w,firstIndexInView:a,lastIndexInView:i,viewerContainer:t});const l=r.style.left,m=c.calcContentContainerLeftPosition({centerExtremesWhenExtraPadding:d,circular:g,contentContainer:r,currentPage:y.current,extraPadding:w,firstIndexInView:a,numPages:A.current});r.style.left=m,e&&l!==m?V.current=!1:b({propertyName:o.PROPERTY_TO_HANDLE_TRANSITION_END})},[h,I,g,u,w,d,b]),M=n(()=>{const e=N.current,n=P.current;e&&n&&T.current&&(u&&(e.style.width="100%",s.updateSlicesWidth({centerMode:m,contentContainer:n,extraPadding:w,numElementsPerPage:T.current,viewerContainer:e})),s.manageCircularClones({circular:g,contentContainer:n,elementsLength:h.length,numElementsPerPage:T.current}),O({animated:!1,newPage:y.current}))},[u,m,g,h,w,O]),_=n(()=>{const e=L.current,n=N.current,t=P.current;if(!e||!n||!t)return;e.style.width="100%";const r=E||c.calcNumElementsPerPage({contentContainer:t,elementsLength:h.length,extraPadding:w,rootContainer:e,viewerContainer:n})||1;l&&(e.style.width="fit-content"),r!==T.current&&(T.current=r,R?.(r));const a=c.calcNumPages({elementsLength:h.length,numElementsPerPage:r,numElementsToSlide:I});A.current!==a&&(A.current=a,p?.(a),y.current=Math.min(Math.max(0,f),a-1)),a<=1&&s.alignOnePageCarousel({allowModifySliceWidth:u,contentContainer:t,onePageAlign:x,rootContainer:e})},[u,h,w,E,I,x,l,R,p,v]),W=n(()=>{_(),M()},[_,M]);return t(()=>{const e=P.current;if(!e)return;W(),window.addEventListener("resize",W);const n=new r(W);return n.observe(e),()=>{window.removeEventListener("resize",W),n.disconnect()}},[W]),t(()=>{const e=P.current;return e?.addEventListener("transitionend",b),()=>{e?.removeEventListener("transitionend",b)}},[b]),i({allowShiftRef:V,centerExtremesWhenExtraPadding:d,changePage:O,circular:g,contentContainerRef:P,currentPageRef:y,disabled:C,elements:h,extraPadding:w,numElementsPerPageRef:T,numPagesRef:A,viewerContainerRef:N}),a({allowShiftRef:V,changePage:O,circular:g,currentPageRef:y,disabled:C,numPagesRef:A,rootContainerRef:L}),{allowShiftRef:V,changePage:O,currentPageRef:y,numElementsPerPageRef:T,numPagesRef:A}};export{u as useCarousel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as e}from"react";import{isArrowLeftPressed as r,isArrowRightPressed as n}from"../../../lib/utils/keyboard/keyboard.js";const t=({
|
|
1
|
+
import{useEffect as e}from"react";import{isArrowLeftPressed as r,isArrowRightPressed as n}from"../../../lib/utils/keyboard/keyboard.js";const t=({allowShiftRef:t,changePage:c,circular:o,currentPageRef:u,disabled:a=!1,numPagesRef:i,rootContainerRef:d})=>{e(()=>{if(a)return;const e=e=>{!t.current||i.current<=1||(r(e.key)?t.current&&(o||0!==u.current)&&c({newPage:u.current-1}):n(e.key)&&t.current&&(o||u.current!==i.current-1)&&c({newPage:u.current+1}))},f=d.current;return f?.addEventListener("keydown",e),()=>{f?.removeEventListener("keydown",e)}},[o,c,a])};export{t as useCarouselKeyNavigation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRef as e,useCallback as t,useEffect as r}from"react";import{useScrollBlock as n}from"../../../lib/hooks/useScrollBlock/useScrollBlock.js";import c from"./utils/calc.utils.js";import u from"./utils/constants.js";const s=({
|
|
1
|
+
import{useRef as e,useCallback as t,useEffect as r}from"react";import{useScrollBlock as n}from"../../../lib/hooks/useScrollBlock/useScrollBlock.js";import c from"./utils/calc.utils.js";import u from"./utils/constants.js";const s=({allowShiftRef:s,centerExtremesWhenExtraPadding:o,changePage:l,circular:i,contentContainerRef:a,currentPageRef:m,disabled:v=!1,elements:E,extraPadding:d,numElementsPerPageRef:h,numPagesRef:f,viewerContainerRef:L})=>{const p=e(!1),_=e(!1),D=e(!1),R=e(),g=e(0),X=e(0),P=e(0),S=e(0),y=t(()=>{s.current&&(i||m.current!==f.current-1)&&l({newPage:m.current+1})},[i,l]),I=t(()=>{s.current&&(i||0!==m.current)&&l({newPage:m.current-1})},[i,l]),{allowScroll:O,blockScroll:w}=n(),x=t(e=>{const t=a.current;!t||f.current<=1||(R.current=parseFloat(t.style.left||"0"),"touchstart"===e.type?(g.current=e.touches[0].clientX,P.current=e.touches[0].clientX,S.current=e.touches[0].clientY):(g.current=e.clientX,P.current=e.clientX,S.current=e.clientY),p.current=!0)},[]),G=t(e=>{const t=a.current;if(!t||!p.current||!h?.current||f.current<=1)return;let r,n;"touchmove"===e.type?(X.current=g.current-e.touches[0].clientX,g.current=e.touches[0].clientX,r=e.touches[0].clientX-P.current,n=e.touches[0].clientY-S.current):(X.current=g.current-e.clientX,g.current=e.clientX,r=e.clientX-P.current,n=e.clientY-S.current);const s=parseFloat(t.style.left||"0")-X.current;if(_.current||D.current||(Math.abs(r)>u.THRESHOLD_TO_DECIDE_IF_ALLOW_DRAGGING?(_.current=!0,w()):Math.abs(n)>u.THRESHOLD_TO_DECIDE_IF_ALLOW_DRAGGING&&(D.current=!0)),_.current)if(i&&E.length>h.current)t.style.left=`${s}px`;else{const e=c.calcXDistanceBetween2Elements(t.firstChild,t.children[t.children.length-h.current]);if(o)s-d<0&&-s<e-d&&(t.style.left=`${s}px`);else{let r=i?d:0;!i&&d&&m.current===f.current-1&&(r=2*d),s-r<0&&-s<e-r&&(t.style.left=`${s}px`)}}},[w,o,i,E,d]),C=t(()=>{const e=a.current;if(D.current=!1,_.current&&O(),_.current=!1,!e||!p.current||void 0===R.current||f.current<=1)return;p.current=!1;const t=parseFloat(e.style.left||"0");t-R.current<-0?y():t-R.current>u.THRESHOLD_TO_DECIDE_IF_SWIPE_ON_DRAG_ENDS?I():e.style.left=`${R.current}px`},[O,y,I]);r(()=>{if(v)return;const e=L.current,t={passive:!0};return e?.addEventListener("touchstart",x,t),e?.addEventListener("touchend",C,t),e?.addEventListener("touchmove",G,t),e?.addEventListener("mousedown",x,t),e?.addEventListener("mouseup",C,t),e?.addEventListener("mousemove",G,t),e?.addEventListener("mouseleave",C,t),()=>{e?.removeEventListener("touchstart",x,t),e?.removeEventListener("touchend",C,t),e?.removeEventListener("touchmove",G,t),e?.removeEventListener("mousedown",x,t),e?.removeEventListener("mouseup",C,t),e?.removeEventListener("mousemove",G,t),e?.removeEventListener("mouseleave",C,t)}},[x,C,G,v])};export{s as useCarouselSwipe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=({element:e})=>{const t=window.getComputedStyle(e);return parseFloat(t.getPropertyValue("padding-left")||"0")+parseFloat(t.getPropertyValue("padding-right")||"0")},t=(e,t)=>{if(!e||!t)return 0;const n=e.offsetLeft,r=t.offsetLeft;return Math.abs(r-n)},n=({numElementsPerPage:e,numElementsToSlide:t})=>t?Math.max(1,Math.min(t,e)):e,r=({elementsLength:e,numElementsPerPage:t,numElementsToSlide:r})=>{if(e<=t)return 1;const i=n({numElementsToSlide:r
|
|
1
|
+
const e=({element:e})=>{const t=window.getComputedStyle(e);return parseFloat(t.getPropertyValue("padding-left")||"0")+parseFloat(t.getPropertyValue("padding-right")||"0")},t=(e,t)=>{if(!e||!t)return 0;const n=e.offsetLeft,r=t.offsetLeft;return Math.abs(r-n)},n=({numElementsPerPage:e,numElementsToSlide:t})=>t?Math.max(1,Math.min(t,e)):e,r=({elementsLength:e,numElementsPerPage:t,numElementsToSlide:r})=>{if(e<=t)return 1;const i=n({numElementsPerPage:t,numElementsToSlide:r});return Math.ceil((e-t+i)/i)},i=({currentPage:e,elementsLength:t,isCircular:i,numElementsPerPage:l,numElementsToSlide:s})=>{if(t<=l)return{firstIndexInView:0,lastIndexInView:t-1};const o=n({numElementsPerPage:l,numElementsToSlide:s});let a=e*o+l-1;let d=0;i&&t>l&&(d=l+1,a+=d),e===r({elementsLength:t,numElementsPerPage:l,numElementsToSlide:o})?a=d+t+l-1:e<0?a=d-1:a-d>t-1&&(a=d+t-1);return{firstIndexInView:a-l+1,lastIndexInView:a}},l=({contentContainer:t,elementsLength:n,extraPadding:r,rootContainer:i,viewerContainer:l})=>{const s=t.firstElementChild;if(!s)return;let o=i.offsetWidth;o-=2*r;o-=e({element:l});let a=0;const d=s.offsetLeft;for(let e=0;e<t.children.length;e++){const n=t.children[e];if(d+n.offsetLeft+n.offsetWidth>o)break;a++}return Math.max(Math.min(n,a),1)},s=({centerMode:e,contentContainer:t})=>{let n=0;if(t.childNodes.length<2)return n;const r=t.childNodes[0],i=t.childNodes[1];e&&r.style&&i.style&&(r.style.transition="none",i.style.transition="none",r.style.transform="scale(1)",i.style.transform="scale(1)");const l=r?.getBoundingClientRect()?.right,s=i?.getBoundingClientRect()?.left;return e&&r.style&&i.style&&(r.style.removeProperty("transform"),i.style.removeProperty("transform"),r.offsetHeight,i.offsetHeight,r.style.removeProperty("transition"),i.style.removeProperty("transition")),void 0!==l&&void 0!==s&&(n=Math.abs(l-s)),n},o=({centerMode:t,contentContainer:n,extraPadding:r,numElementsPerPage:i,viewerContainer:l})=>{const o=(i-1)*s({centerMode:t,contentContainer:n}),a=e({element:l});return(l.getBoundingClientRect().width-o-2*r-a)/i},a=({contentContainer:n,extraPadding:r,firstIndexInView:i,lastIndexInView:l,viewerContainer:s})=>{const o=n.children[i],a=n.children[l],d=t(o,a),c=e({element:s});return`${d+a.offsetWidth+2*r+c}px`},d=({centerExtremesWhenExtraPadding:e,circular:n,contentContainer:r,currentPage:i,extraPadding:l,firstIndexInView:s,numPages:o})=>{let a=t(r.firstChild,r.children[s]);return l&&(e||n||0!==i&&i!==o-1?a-=l:n||i!==o-1||(a-=2*l)),-a+"px"},c={calcAdjustedNumElementsToSlide:n,calcContentContainerLeftPosition:d,calcFirstAndLastIndexInCarouselView:i,calcGapBetweenContentContainerElements:s,calcNumElementsPerPage:l,calcNumPages:r,calcSliceWidth:o,calcViewerWidth:a,calcXDistanceBetween2Elements:t};export{n as calcAdjustedNumElementsToSlide,d as calcContentContainerLeftPosition,i as calcFirstAndLastIndexInCarouselView,s as calcGapBetweenContentContainerElements,e as calcHorizontalElementPadding,l as calcNumElementsPerPage,r as calcNumPages,o as calcSliceWidth,a as calcViewerWidth,t as calcXDistanceBetween2Elements,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./calc.utils.js";const t=({
|
|
1
|
+
import e from"./calc.utils.js";const t=({centerMode:t,contentContainer:n,extraPadding:i,numElementsPerPage:r,viewerContainer:l})=>{const o=e.calcSliceWidth({centerMode:t,contentContainer:n,extraPadding:i,numElementsPerPage:r,viewerContainer:l});for(let e=0;e<n.childNodes.length;e++){const t=n.childNodes[e];t instanceof HTMLElement&&(t.style.width=`${o}px`)}},n=({contentContainer:e,firstIndexInView:t,lastIndexInView:n})=>{for(let i=0;i<e.children.length;i++)i<t||i>n?e.children[i].setAttribute("inert",""):e.children[i].removeAttribute("inert")},i=({contentContainer:t,extraPadding:n,firstIndexInView:i,lastIndexInView:r,viewerContainer:l})=>{const o=e.calcViewerWidth({contentContainer:t,extraPadding:n,firstIndexInView:i,lastIndexInView:r,viewerContainer:l});l.style.width=o},r=({contentContainer:e,firstIndexInView:t,lastIndexInView:n,numElementsPerPage:i})=>{if(i%2!=0){const i=t+(n-t)/2;e.children[i].setAttribute("data-highlighted","true")}},l=({contentContainer:e})=>{for(let t=0;t<e.children.length;t++)e.children[t].removeAttribute("data-highlighted")},o=({circular:e,contentContainer:t,elementsLength:n,numElementsPerPage:i})=>{if(t.children.length>n){const e=(t.children.length-n)/2;for(let n=0;n<e;n++)t.firstElementChild&&t.removeChild(t.firstElementChild),t.lastElementChild&&t.removeChild(t.lastElementChild)}if(e&&n>i){const e=[],n=[],r=t.children.length,l=i+1;for(let i=0;i<l;i++){const l=t.children[i];l&&e.push(l.cloneNode(!0));const o=t.children[r-1-i];o&&n.push(o.cloneNode(!0))}e.forEach(e=>t.appendChild(e)),n.forEach(e=>t.insertBefore(e,t.firstChild))}},a={center:"center",left:"flex-start",right:"flex-end"},d=({allowModifySliceWidth:e,contentContainer:t,onePageAlign:n,rootContainer:i})=>{e?t.style.justifyContent=a[n]:i.style.justifyContent=a[n]},s=({contentContainer:t,currentPage:n,elementsLength:i,extraPadding:r,numElementsPerPage:l,numPages:o})=>{const a=n===o;if(a||-1===n){const n=a?l+1:i+1;let d=e.calcXDistanceBetween2Elements(t.firstChild,t.children[n]);return d-=r,t.style.left=-d+"px",{newPage:a?0:o-1}}return{newPage:n}},c={alignOnePageCarousel:d,applyCenterMode:r,deleteCenterMode:l,manageCircularClones:o,udpateCarouselPositionOnEdge:s,updateContentElementsAriaVisibility:n,updateSlicesWidth:t,updateViewerWidth:i};export{d as alignOnePageCarousel,r as applyCenterMode,c as default,l as deleteCenterMode,o as manageCircularClones,s as udpateCarouselPositionOnEdge,n as updateContentElementsAriaVisibility,t as updateSlicesWidth,i as updateViewerWidth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shift as e,offset as t,flip as i,hide as s,arrow as n}from"@floating-ui/dom";import{getPlacementDirection as a}from"../../utils/placement.utils.js";const r=({arrowElement:r,customMiddlewares:d,edgePadding:o,hideWhenDetached:h,isBodyAnchor:m,mainAxisOffset:c,offsetDistance:p,placement:l})=>{let u=[];return u=d?.length?[...d]:m?((i,s)=>{const n=a(i),r=[];return"center"===n?r.push(e({crossAxis:!0,mainAxis:!0,padding:s})):n.startsWith("right")||n.startsWith("left")?r.push(t({alignmentAxis:0,mainAxis:0})):(n.startsWith("bottom")||n.startsWith("top"))&&r.push(t({mainAxis:0})),r})(l,o):((s,n,a)=>{const r=[];return r.push(t({crossAxis:n?.[1]||0,mainAxis:s})),r.push(i({fallbackAxisSideDirection:"start",padding:a})),r.push(e({padding:a})),r})(c,p,o),(({
|
|
1
|
+
import{shift as e,offset as t,flip as i,hide as s,arrow as n}from"@floating-ui/dom";import{getPlacementDirection as a}from"../../utils/placement.utils.js";const r=({arrowElement:r,customMiddlewares:d,edgePadding:o,hideWhenDetached:h,isBodyAnchor:m,mainAxisOffset:c,offsetDistance:p,placement:l})=>{let u=[];return u=d?.length?[...d]:m?((i,s)=>{const n=a(i),r=[];return"center"===n?r.push(e({crossAxis:!0,mainAxis:!0,padding:s})):n.startsWith("right")||n.startsWith("left")?r.push(t({alignmentAxis:0,mainAxis:0})):(n.startsWith("bottom")||n.startsWith("top"))&&r.push(t({mainAxis:0})),r})(l,o):((s,n,a)=>{const r=[];return r.push(t({crossAxis:n?.[1]||0,mainAxis:s})),r.push(i({fallbackAxisSideDirection:"start",padding:a})),r.push(e({padding:a})),r})(c,p,o),(({arrowElement:e,edgePadding:t,hideWhenDetached:i,isBodyAnchor:a,middlewareStack:r})=>{!a&&i&&r.push(s()),e&&r.push(n({element:e,padding:t}))})({arrowElement:r,edgePadding:o,hideWhenDetached:h,isBodyAnchor:m,middlewareStack:u}),u},d=({arrowSize:e,hasArrow:t,offsetDistance:i})=>"number"==typeof i?.[0]?i[0]:t?e:0;export{d as calculateMainAxisOffset,r as getMiddlewareStack};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRef as e,useState as r,useCallback as o,useEffect as n}from"react";import{syncInnerAndForwardedRef as l}from"../../../lib/hooks/syncRefs/syncRefs.js";import{useScrollBlock as t}from"../../../lib/hooks/useScrollBlock/useScrollBlock.js";import{convertDurationToNumber as s}from"../../../lib/hooks/useSwipeDown/utils/convertDurationToNumber.js";import{focusFirstDescendant as c}from"../../../lib/utils/focusHandlers/focusHandlers.js";const u=({animationExitDuration:u=200,disableAnimations:i,
|
|
1
|
+
import{useRef as e,useState as r,useCallback as o,useEffect as n}from"react";import{syncInnerAndForwardedRef as l}from"../../../lib/hooks/syncRefs/syncRefs.js";import{useScrollBlock as t}from"../../../lib/hooks/useScrollBlock/useScrollBlock.js";import{convertDurationToNumber as s}from"../../../lib/hooks/useSwipeDown/utils/convertDurationToNumber.js";import{focusFirstDescendant as c}from"../../../lib/utils/focusHandlers/focusHandlers.js";const u=({animationExitDuration:u=200,disableAnimations:i,disableAutoFocusFirstDescendant:a=!1,disableAutoFocusFirstDescendantAfterClose:m=!0,disableRestoreFocusAfterClose:d=!1,disableScrollBackground:f=!1,open:p=!1,popoverContainerRef:b,preventScrollOnCloseFocus:S=!1})=>{const w=e(null),R=e(!1),k=e(null),v=e(null),[F,A]=r(p),[C,D]=r(!1),h=s(u),{allowScroll:j,blockScroll:T}=t(),y=o(()=>{!a&&w.current&&c({element:w.current,preventScroll:!0})},[a]),B=o(()=>{d?m||c({element:document.body}):v.current?.focus({preventScroll:S})},[d,S,m]);n(()=>{p&&(v.current=document.activeElement,A(!0),D(!1))},[p]),n(()=>(!p&&F&&(i?(B(),A(!1),D(!1)):(D(!0),k.current=window.setTimeout(()=>{B(),A(!1),D(!1)},h))),()=>{null!==k.current&&(window.clearTimeout(k.current),k.current=null)}),[p,F,i,h,B]);const g=o(e=>{w.current=e,y(),f&&!R.current&&(R.current=!0,T({elementsToOmit:[w.current]}))},[T,y,f]),x=o(()=>{R.current&&j(),w.current=null},[j]);return{handleInnerRef:o(e=>{e?g(e):x(),l({forwardedRef:b,innerRef:w})},[b,x,g]),isClosing:C,isVisible:F,popoverRef:w}};export{u as usePopoverLifecycle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{computePosition as e,autoUpdate as t}from"@floating-ui/dom";import{useRef as r,useEffect as n,useCallback as i}from"react";import{positionArrow as a}from"./positioning/arrowPositionStyles.js";import{calculateMainAxisOffset as o,getMiddlewareStack as s}from"./positioning/middlewareUtils.js";import{determinePositioningConfig as c}from"./positioning/positionCalculation.js";import{applyPositionStyles as d}from"./positioning/positionStyles.js";const l=({anchorElement:l,arrowStyles:m,isVisible:u,middlewareOptions:p={},middlewares:f=[],placement:w,ref:h,strategy:g})=>{const{edgePadding:y=0,hideWhenDetached:S,offsetDistance:D}=p,b=r(document.body),P=r(null),E=r({anchorElement:l,arrowStyles:m,isVisible:u,middlewareOptions:{edgePadding:y,hideWhenDetached:S,offsetDistance:D},middlewares:f,placement:w,ref:h,strategy:g});n(()=>{E.current={anchorElement:l,arrowStyles:m,isVisible:u,middlewareOptions:{edgePadding:y,hideWhenDetached:S,offsetDistance:D},middlewares:f,placement:w,ref:h,strategy:g}},[l,w,D,y,S,f,g,u,h,m]);const A=i(()=>h?.current&&u&&m?(P.current=h.current.querySelector('[data-kbt-id="popover-arrow"]'),P.current):null,[h,u,m]);n(()=>{const e=()=>{!A()&&u&&m&&h?.current&&requestAnimationFrame(e)};e()},[A,u,m]);const k=i((e,t)=>e&&t?.current&&document.body.contains(t.current),[]),O=i((e,t,r,n,i,o,s,c,l,u,p,f,w,h=[],g=[])=>{e?.current&&(d({edgePadding:s,hasCustomMiddlewares:h.length>0,isBodyAnchor:t,middlewareStack:g,placement:r,ref:e,strategy:o,x:n,y:i}),t||e.current.setAttribute("data-kbt-placement",u),a(!!m,c,l,u,p,f),w?.())},[m]),W=i((e,t,r,n,i,a,c)=>{const d=o({arrowSize:t,hasArrow:!!m,offsetDistance:e}),l=P.current;return{arrowElement:l,middlewareStack:s({arrowElement:l,customMiddlewares:a,edgePadding:n,hideWhenDetached:c?.hideWhenDetached,isBodyAnchor:r,mainAxisOffset:d,offsetDistance:e,placement:i})}},[m]),j=i((e,t,r,n,i,a,o,s,c,d,l,m,u,p=[],f=[])=>{const w=t.hide?.referenceHidden||t.hide?.escaped;e.current&&(e.current.style.opacity=w?"0":"",e.current.style.pointerEvents=w?"none":""),w||O(e,r,n,i,a,o,s,c,t,d,l,m,u,p,f)},[O]),x=i(async()=>{const{anchorElement:t,arrowStyles:r,middlewareOptions:n,middlewares:i,onPositioned:a,placement:o,ref:s,strategy:d}=E.current,l=n?.offsetDistance,m=n?.edgePadding??8,u=r?.size||0,p=t||b.current;if(!s?.current||!k(p,s))return;const f=p===document.body,{arrowElement:w,middlewareStack:h}=W(l,u,f,m,o,i,n||{}),{actualPlacement:g,autoStrategy:y}=c(f,d,o),S="center"===g?"top":g,D=await e(p,s.current,{middleware:h,placement:S,strategy:y}),{middlewareData:P,placement:A,x:O,y:x}=D;j(s,P,f,g,O,x,d,m,w,A,l,u,a,i,h)},[]);n(()=>{if(!u||!h?.current)return;h.current.offsetHeight,x();const e=l??b.current;let r=()=>{};return r=t(e,h.current,x,{ancestorResize:!0,ancestorScroll:!0,animationFrame:!1,elementResize:!0}),()=>{r()}},[u,l,x])};export{l as usePopoverPositioning};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"../../_virtual/jsx-runtime.js";import{forwardRef as s}from"react";import{useClassName as o}from"../../lib/hooks/useClassName/useClassName.js";import{useTrapFocus as i}from"../../lib/hooks/useTrapFocus/useTrapFocus.js";import{usePopoverInteractions as r}from"./hooks/usePopoverInteractions.js";import{usePopoverLifecycle as l}from"./hooks/usePopoverLifecycle.js";import{usePopoverPositioning as a}from"./hooks/usePopoverPositioning.js";import{PopoverStandAlone as t}from"./popoverStandAlone.js";const n=s(({additionalClasses:s,anchorElement:n,animationExitDuration:p=200,disableAnimations:c=!1,disableAutoFocusFirstDescendant:d=!1,disableAutoFocusFirstDescendantAfterClose:m=!0,disableClickOverlayClose:u=!1,disableEscapeClose:C=!1,disableRestoreFocusAfterClose:b=!1,disableScrollBackground:f=!1,disableTrapFocus:v=!1,middlewareOptions:F,middlewares:A,onClose:k,open:O=!1,preventCloseOnClickElements:
|
|
1
|
+
import{j as e}from"../../_virtual/jsx-runtime.js";import{forwardRef as s}from"react";import{useClassName as o}from"../../lib/hooks/useClassName/useClassName.js";import{useTrapFocus as i}from"../../lib/hooks/useTrapFocus/useTrapFocus.js";import{usePopoverInteractions as r}from"./hooks/usePopoverInteractions.js";import{usePopoverLifecycle as l}from"./hooks/usePopoverLifecycle.js";import{usePopoverPositioning as a}from"./hooks/usePopoverPositioning.js";import{PopoverStandAlone as t}from"./popoverStandAlone.js";const n=s(({additionalClasses:s,anchorElement:n,animationExitDuration:p=200,disableAnimations:c=!1,disableAutoFocusFirstDescendant:d=!1,disableAutoFocusFirstDescendantAfterClose:m=!0,disableClickOverlayClose:u=!1,disableEscapeClose:C=!1,disableRestoreFocusAfterClose:b=!1,disableScrollBackground:f=!1,disableTrapFocus:v=!1,middlewareOptions:F,middlewares:A,onClose:k,open:O=!1,popoverContainerRef:j,preventCloseOnClickElements:E=[],preventScrollOnCloseFocus:h=!1,strategy:R="absolute",...g},y)=>{const w=c||!!n,S=o({additionalClassNames:s,component:"POPOVER"}),{handleInnerRef:D,isClosing:P,isVisible:x,popoverRef:V}=l({animationExitDuration:p,disableAnimations:w,disableAutoFocusFirstDescendant:d,disableAutoFocusFirstDescendantAfterClose:m,disableRestoreFocusAfterClose:b,disableScrollBackground:f,open:O,popoverContainerRef:j,preventScrollOnCloseFocus:h});return i({ref:V,trapFocus:!v&&x}),r({disableClickOverlayClose:u,disableEscapeClose:C,isVisible:x,onClose:k,popoverRef:V,preventCloseOnClickElements:E}),a({anchorElement:n,arrowStyles:g.arrowStyles,isVisible:x,middlewareOptions:F,middlewares:A,placement:g.placement,ref:V,strategy:R}),/* @__PURE__ */e.jsx(t,{ref:y,...g,anchorElement:!!n,cssClasses:S,disableAnimations:w,isClosing:P,isVisible:x,middlewareOptions:F,popoverContainerRef:D,strategy:R})});export{n as Popover};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as t}from"../../_virtual/jsx-runtime.js";/* empty css */import{forwardRef as r}from"react";import{classNames as e}from"../../lib/utils/classNames/classNames.js";import{pickCustomAttributes as o}from"../../lib/utils/pickCustomAttributes/pickCustomAttributes.js";import{CustomComponent as s}from"../../lib/components/customComponent/customComponent.js";const i=r(({align:r,children:i,color:a,component:l,cssClasses:m,cursor:c,customAttributes:n,decoration:d,disabled:p,display:u,draggable:x,filter:b,htmlFor:f,id:g,maxTruncatedLines:j,onClick:k,role:C,target:h,textSizeAdjust:A,textWrap:w,transform:W,truncate:y,weight:N,wordBreak:z,wordWrap:B,...F},S)=>{const T=o({...F,...n}),v=e("kbt-text",m?.text,{"kbt-text--disabled":p??!1},{"kbt-text--truncate":y||!!j}),D={color:a,cursor:c,display:u,filter:b,fontWeight:N,textAlign:r,textDecoration:d,textTransform:W,textWrap:w,wordBreak:z,wordWrap:B
|
|
1
|
+
import{j as t}from"../../_virtual/jsx-runtime.js";/* empty css */import{forwardRef as r}from"react";import{classNames as e}from"../../lib/utils/classNames/classNames.js";import{pickCustomAttributes as o}from"../../lib/utils/pickCustomAttributes/pickCustomAttributes.js";import{CustomComponent as s}from"../../lib/components/customComponent/customComponent.js";const i=r(({align:r,children:i,color:a,component:l,cssClasses:m,cursor:c,customAttributes:n,decoration:d,disabled:p,display:u,draggable:x,filter:b,htmlFor:f,id:g,maxTruncatedLines:j,onClick:k,role:C,target:h,textSizeAdjust:A,textWrap:w,transform:W,truncate:y,weight:N,wordBreak:z,wordWrap:B,...F},S)=>{const T=o({...F,...n}),v=e("kbt-text",m?.text,{"kbt-text--disabled":p??!1},{"kbt-text--truncate":y||!!j}),D={color:a,cursor:c,display:u,filter:b,fontWeight:N,textAlign:r,textDecoration:d,textSizeAdjust:A,textTransform:W,textWrap:w,wordBreak:z,wordWrap:B};/* @__PURE__ */
|
|
2
2
|
return t.jsx(s,{ref:S,className:v,component:l,"data-testid":"text",draggable:x,htmlFor:f,id:g,role:C,style:D,target:h,onClick:k,...T,children:i})});export{i as TextStandAlone};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{flip as e,shift as t,arrow as o}from"@floating-ui/dom";import{useRef as r,useState as s,useEffect as i,useCallback as n}from"react";import{useClassName as l}from"../../../lib/hooks/useClassName/useClassName.js";import{useClickOutside as p}from"../../../lib/hooks/useClickOutside/useClickOutside.js";import{useEscPressed as a}from"../../../lib/hooks/useEscPressed/useEscPressed.js";import{useActiveBreakpoints as c}from"../../../lib/hooks/useMediaDevice/useActiveBreakpoints.js";import{DEVICE_BREAKPOINTS as u}from"../../../lib/types/breakpoints/breakpoints.js";import{POSITIONS as m}from"../../../lib/types/positions/positions.js";import{focusElementOrFirstDescendant as f}from"../../../lib/utils/focusHandlers/focusHandlers.js";import{computePosition as d}from"../positioning/computePosition.js";const y=({align:y=m.TOP,...b})=>{const{device:v,isDesktop:O,isTablet:R}=c(),w=O||R,P=r(null),g=r(!0),T=r(!1),[E,h]=s(!1),[j,k]=s(y),x=l({additionalClassNames:b.additionalClasses,component:"TOOLTIP",variant:b.variant}),C=async()=>{if(!b.labelRef.current||!b.tooltipRef.current)return;const r=b.tooltipRef.current.lastElementChild;try{const s=await d(b.labelRef.current,b.tooltipRef.current,{middleware:[e(),t({padding:4}),o({element:r})],placement:y,strategy:"absolute"}),{middlewareData:i,placement:n,x:l,y:p}=s;k(n),Object.assign(b.tooltipRef.current.style,{left:`${l}px`,top:`${p}px`});const{x:a,y:c}=i.arrow,f={bottom:m.TOP,left:m.RIGHT,right:m.LEFT,top:m.BOTTOM}[j.split("-")[0]],v={bottom:"",left:null!==a?`${a}px`:"",right:"",[f]:`calc(${x.tooltipexternalcontainer?.[u.DESKTOP]?.padding??0} - ${x.arrowposition?.[u.DESKTOP]?.top??"0px"} / 2)`,top:null!==c?`${c}px`:""};r&&r.style&&(r.style.removeProperty("left"),r.style.removeProperty("top"),r.style.removeProperty("right"),r.style.removeProperty("bottom"),Object.assign(r?.style,v))}catch(s){}},L=e=>{b.tooltipRef.current?.contains(e.target)||C()};i(()=>{const e=()=>{C()};return window.addEventListener("scroll",L,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",e)}},[]);const $=n(()=>{if(T.current){if(T.current=!1,g.current=!1,b.tooltipAsModal&&P.current?.focus({preventScroll:!0}),g.current=!0,w){if(!b.tooltipRef.current)return;b.tooltipRef.current.style.display="none"}h(!1),b.onOpenClose?.(!1)}},[v,b.onOpenClose,b.tooltipAsModal]),D=n(e=>{T.current&&(e.stopPropagation(),$())},[$]);return a({disableStopPropagation:!0,onEscPress:D,ref:b.labelRef}),p(b.tooltipRef,$,[b.labelRef.current]),{allowFocusOpenTooltip:g,hideTooltip:$,open:E,placement:j,showTooltip:()=>{if(!T.current){if(T.current=!0,P.current=document.activeElement,w){if(!b.tooltipRef.current)return;b.tooltipRef.current.style.display="flex",C(),f(b.tooltipRef.current,{preventScroll:!0})}h(!0),b.onOpenClose?.(!0)}}}};export{y as useTooltip};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"../../../_virtual/jsx-runtime.js";import{createContext as t,useContext as s,useMemo as r,useState as n}from"react";import{Provider as i}from"../cssProvider/provider.js";const o=t(void 0),a=()=>{const e=s(o);if(!e)throw new Error("useStylesContext must be used within a StylesProvider");return e},l={lg:992,md:768,sm:576,xl:1200},m=({breakpoints:
|
|
2
|
-
return e.jsx(o.Provider,{value:{breakpoints:x,changeTheme:e=>{try{b.themeSelected=e,C(e)}catch(t){}},classes:[],currentTheme:w,getComponentStyles:({additionalClassNames:e,component:t,variant:s})=>{try{return b.getComponentStyles({additionalClassNames:e,component:t,variant:s||""})}catch(r){return{}}},icons:v,illustrations:y,mediaQueries:u,themeClassNames:b.classNames,themes:b.allThemes,themeVariables:b.variables},children:
|
|
1
|
+
import{j as e}from"../../../_virtual/jsx-runtime.js";import{createContext as t,useContext as s,useMemo as r,useState as n}from"react";import{Provider as i}from"../cssProvider/provider.js";const o=t(void 0),a=()=>{const e=s(o);if(!e)throw new Error("useStylesContext must be used within a StylesProvider");return e},l={lg:992,md:768,sm:576,xl:1200},m=({bernovaProvider:t,breakpoints:s=l,children:a,icons:m={},illustrations:d={},jsInCss:c=!0,linkId:h="kb-styled-provider",themeSelected:p})=>{const x=s,u=(e=>({onlyDesktop:`(max-width: ${e.xl}px)`,onlyLargeDesktop:`(min-width: ${e.xl}px)`,onlyMobile:`(max-width: ${e.md-1}px)`,onlyTablet:`(min-width: ${e.md}px) and (max-width: ${e.lg-1}px)`}))(s),v=m,y=d,b=r(()=>new(t||i)({jsInCss:c,linkId:h}),[]),[w,C]=n(p||b.themeSelected);b.themeSelected=w||"";/* @__PURE__ */
|
|
2
|
+
return e.jsx(o.Provider,{value:{breakpoints:x,changeTheme:e=>{try{b.themeSelected=e,C(e)}catch(t){}},classes:[],currentTheme:w,getComponentStyles:({additionalClassNames:e,component:t,variant:s})=>{try{return b.getComponentStyles({additionalClassNames:e,component:t,variant:s||""})}catch(r){return{}}},icons:v,illustrations:y,mediaQueries:u,themeClassNames:b.classNames,themes:b.allThemes,themeVariables:b.variables},children:a})};export{o as StylesContext,m as StylesProvider,a as useStylesContext};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubit-ui-web/react-components",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"description": "Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Kubit",
|
|
@@ -109,6 +109,8 @@
|
|
|
109
109
|
"dev": "vite",
|
|
110
110
|
"lint": "eslint src",
|
|
111
111
|
"lint:fix": "eslint src --fix",
|
|
112
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,scss,md}\"",
|
|
113
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css,scss,md}\"",
|
|
112
114
|
"predist": "rm -rf dist",
|
|
113
115
|
"dist": "vite build",
|
|
114
116
|
"test": "yarn lint && yarn typecheck && vitest --coverage.enabled=true --silent --run",
|
|
@@ -116,7 +118,7 @@
|
|
|
116
118
|
"test:watch": "vitest --watch",
|
|
117
119
|
"test:coverage": "vitest --coverage.enabled=true --run",
|
|
118
120
|
"typecheck": "tsc --noEmit",
|
|
119
|
-
"validate": "yarn lint && yarn typecheck && yarn dist",
|
|
121
|
+
"validate": "yarn format:check && yarn lint && yarn typecheck && yarn dist",
|
|
120
122
|
"publish-figma": "npx figma connect publish",
|
|
121
123
|
"pack:check": "npm pack --dry-run",
|
|
122
124
|
"pack:size": "npm pack --dry-run 2>&1 | grep -E '(unpacked size|package size|total files)'",
|
|
@@ -128,9 +130,7 @@
|
|
|
128
130
|
"react-dom": ">=17.0.0 || >=18.3.1"
|
|
129
131
|
},
|
|
130
132
|
"dependencies": {
|
|
131
|
-
"@floating-ui/dom": "^1.7.4"
|
|
132
|
-
"react": "18.3.1",
|
|
133
|
-
"react-dom": "18.3.1"
|
|
133
|
+
"@floating-ui/dom": "^1.7.4"
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
|
136
136
|
"@figma/code-connect": "^1.3.12",
|
|
@@ -144,24 +144,23 @@
|
|
|
144
144
|
"@testing-library/react": "^16.3.1",
|
|
145
145
|
"@testing-library/user-event": "^14.6.1",
|
|
146
146
|
"@trivago/prettier-plugin-sort-imports": "^6.0.0",
|
|
147
|
-
"@types/html-validator": "^5.0.6",
|
|
148
147
|
"@types/node": "^25.0.3",
|
|
149
148
|
"@types/react": "^18.3.12",
|
|
150
149
|
"@types/react-dom": "^18.3.1",
|
|
151
150
|
"@types/testing-library__jest-dom": "^6.0.0",
|
|
152
|
-
"@typescript-eslint/parser": "^8.50.1",
|
|
153
151
|
"@vitejs/plugin-react": "^5.1.2",
|
|
154
152
|
"@vitest/coverage-v8": "^4.0.16",
|
|
155
153
|
"@vitest/ui": "^4.0.16",
|
|
156
154
|
"bernova": "^0.2.0",
|
|
157
155
|
"eslint": "^9.39.2",
|
|
158
156
|
"eslint-config-kubit": "1.2.0",
|
|
159
|
-
"eslint-plugin-perfectionist": "^5.1.0",
|
|
160
157
|
"eslint-plugin-storybook": "10.1.10",
|
|
161
158
|
"glob": "^13.0.0",
|
|
162
159
|
"html-validate": "^10.5.0",
|
|
163
|
-
"jsdom": "^27.
|
|
160
|
+
"jsdom": "^27.4.0",
|
|
164
161
|
"prettier": "^3.7.4",
|
|
162
|
+
"react": "18.3.1",
|
|
163
|
+
"react-dom": "18.3.1",
|
|
165
164
|
"storybook": "^10.1.10",
|
|
166
165
|
"storybook-addon-deep-controls": "^0.10.0",
|
|
167
166
|
"storybook-addon-pseudo-states": "^10.1.10",
|