@primereact/headless 11.0.0-alpha.6 → 11.0.0-alpha.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/colorpicker/colorManager.d.ts +101 -0
- package/colorpicker/index.d.ts +3 -0
- package/colorpicker/index.mjs +2 -0
- package/colorpicker/index.mjs.map +1 -0
- package/colorpicker/input/index.d.ts +2 -0
- package/colorpicker/input/index.mjs +2 -0
- package/colorpicker/input/index.mjs.map +1 -0
- package/colorpicker/input/useColorPickerInput.d.ts +11 -0
- package/colorpicker/input/useColorPickerInput.props.d.ts +2 -0
- package/colorpicker/input/useColorPickerInput.test.d.ts +0 -0
- package/colorpicker/slider/index.d.ts +2 -0
- package/colorpicker/slider/index.mjs +2 -0
- package/colorpicker/slider/index.mjs.map +1 -0
- package/colorpicker/slider/useColorPickerSlider.d.ts +13 -0
- package/colorpicker/slider/useColorPickerSlider.props.d.ts +2 -0
- package/colorpicker/slider/useColorPickerSlider.test.d.ts +0 -0
- package/colorpicker/useColorPicker.d.ts +26 -0
- package/colorpicker/useColorPicker.props.d.ts +2 -0
- package/colorpicker/useColorPicker.test.d.ts +0 -0
- package/dataview/index.d.ts +2 -0
- package/dataview/index.mjs +2 -0
- package/dataview/index.mjs.map +1 -0
- package/dataview/useDataView.d.ts +3 -0
- package/dataview/useDataView.props.d.ts +2 -0
- package/dataview/useDataView.test.d.ts +0 -0
- package/datepicker/index.d.ts +2 -0
- package/datepicker/index.mjs +2 -0
- package/datepicker/index.mjs.map +1 -0
- package/datepicker/useDatePicker.d.ts +114 -0
- package/datepicker/useDatePicker.props.d.ts +2 -0
- package/datepicker/useDatePicker.test.d.ts +0 -0
- package/fileupload/index.d.ts +2 -0
- package/fileupload/index.mjs +2 -0
- package/fileupload/index.mjs.map +1 -0
- package/fileupload/useFileUpload.d.ts +26 -0
- package/fileupload/useFileUpload.props.d.ts +2 -0
- package/fileupload/useFileUpload.test.d.ts +0 -0
- package/gallery/index.d.ts +2 -0
- package/gallery/index.mjs +2 -0
- package/gallery/index.mjs.map +1 -0
- package/gallery/item/index.d.ts +2 -0
- package/gallery/item/index.mjs +2 -0
- package/gallery/item/index.mjs.map +1 -0
- package/gallery/item/useGalleryItem.d.ts +45 -0
- package/gallery/item/useGalleryItem.props.d.ts +2 -0
- package/gallery/useGallery.d.ts +31 -0
- package/gallery/useGallery.props.d.ts +2 -0
- package/gallery/useGallery.test.d.ts +0 -0
- package/listbox/index.d.ts +2 -0
- package/listbox/index.mjs +2 -0
- package/listbox/index.mjs.map +1 -0
- package/listbox/useListbox.d.ts +45 -0
- package/listbox/useListbox.props.d.ts +2 -0
- package/listbox/useListbox.test.d.ts +0 -0
- package/orgchart/index.d.ts +2 -0
- package/orgchart/index.mjs +2 -0
- package/orgchart/index.mjs.map +1 -0
- package/orgchart/useOrgChart.d.ts +20 -0
- package/orgchart/useOrgChart.props.d.ts +2 -0
- package/orgchart/useOrgChart.test.d.ts +0 -0
- package/overlay/index.d.ts +2 -0
- package/overlay/index.mjs +2 -0
- package/overlay/index.mjs.map +1 -0
- package/overlay/useOverlay.d.ts +16 -0
- package/overlay/useOverlay.props.d.ts +2 -0
- package/overlay/useOverlay.test.d.ts +0 -0
- package/package.json +4 -4
- package/password/index.d.ts +2 -0
- package/password/index.mjs +2 -0
- package/password/index.mjs.map +1 -0
- package/password/usePassword.d.ts +35 -0
- package/password/usePassword.props.d.ts +2 -0
- package/password/usePassword.test.d.ts +0 -0
- package/speeddial/index.mjs +1 -1
- package/speeddial/index.mjs.map +1 -1
- package/speeddial/useSpeedDial.d.ts +2 -1
- package/toast/index.d.ts +1 -0
- package/toast/index.mjs +1 -1
- package/toast/index.mjs.map +1 -1
- package/toast/item/index.css +1 -1
- package/toast/item/index.css.map +1 -1
- package/toast/item/index.mjs +1 -1
- package/toast/item/index.mjs.map +1 -1
- package/toast/item/useToastItem.d.ts +11 -7
- package/toast/toastStore.d.ts +39 -0
- package/toast/useToast.d.ts +12 -4
- package/toast/index.css +0 -2
- package/toast/index.css.map +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const useFileUpload: (inProps?: unknown) => import("@primereact/types/core").HeadlessInstance<import("@primereact/types/shared/fileupload").useFileUploadProps, unknown, {
|
|
3
|
+
state: {
|
|
4
|
+
files: File[];
|
|
5
|
+
messages: string[];
|
|
6
|
+
progress: number;
|
|
7
|
+
uploadedFiles: File[];
|
|
8
|
+
};
|
|
9
|
+
uploadedFileCount: React.RefObject<number>;
|
|
10
|
+
hasFiles: boolean;
|
|
11
|
+
hasUploadedFiles: boolean;
|
|
12
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
13
|
+
contentRef: React.RefObject<HTMLDivElement | null>;
|
|
14
|
+
upload: () => void;
|
|
15
|
+
onFileSelect: (event: React.ChangeEvent<HTMLInputElement> | DragEvent) => void;
|
|
16
|
+
choose: () => void;
|
|
17
|
+
uploader: (uploadFiles?: File[]) => void;
|
|
18
|
+
clear: () => void;
|
|
19
|
+
remove: (index: number) => void;
|
|
20
|
+
removeUploadedFile: (index: number) => void;
|
|
21
|
+
formatSize: (bytes: number) => string;
|
|
22
|
+
onDragEnter: (event: DragEvent) => void;
|
|
23
|
+
onDragOver: (event: DragEvent) => void;
|
|
24
|
+
onDragLeave: () => void;
|
|
25
|
+
onDrop: (event: DragEvent) => void;
|
|
26
|
+
}>;
|
|
File without changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{withHeadless as S}from"@primereact/core/headless";import*as t from"react";var h={activeIndex:0,onActiveIndexChange:void 0};var C=S({name:"useGallery",defaultProps:h,setup:({props:y,elementRef:u})=>{let{activeIndex:i=0,onActiveIndexChange:s=void 0}=y,g=t.useRef(null),o=t.useRef([]),x=t.useRef(null),w=t.useRef(null),E=t.useRef(null),I=t.useRef(null),[,b]=t.useState(0),[l,f]=t.useState(i),[d,p]=t.useState(!1);t.useEffect(()=>{f(i)},[i]);let z=e=>{if(!e)return-1;let c=o.current.findIndex(r=>r.current===e);return c===-1?(o.current.push({current:e}),b(r=>r+1),o.current.length-1):c},m=()=>{let e=(l+1)%o.current.length;f(e),s==null||s({originalEvent:void 0,value:e})},v=()=>{let e=(l-1+o.current.length)%o.current.length;f(e),s==null||s({originalEvent:void 0,value:e})},n=e=>()=>{var r;let c=(r=o.current[l])==null?void 0:r.current;if(c){let L=new CustomEvent("gallery-"+e,{detail:{action:e}});c.dispatchEvent(L)}},R=()=>{u.current&&(d?(Object.assign(u.current.style,{position:"relative",top:"",left:"",width:"",height:"",zIndex:""}),document.body.style.overflow="auto",p(!1)):(Object.assign(u.current.style,{position:"fixed",top:"0",left:"0",width:"100dvw",height:"100dvh",zIndex:"9999"}),document.body.style.overflow="hidden",p(!0)),setTimeout(()=>{window.dispatchEvent(new Event("resize"))},100))},a={zoomIn:n("zoom-in"),zoomOut:n("zoom-out"),rotateLeft:n("rotate-left"),rotateRight:n("rotate-right"),flipX:n("flip-x"),flipY:n("flip-y"),download:n("download"),next:m,prev:v,toggleFullScreen:R},H=t.useCallback(e=>{e&&a[e]&&a[e]()},[a]);return{state:{isFullscreen:d,activeIndex:l},registerItem:z,handleNext:m,handlePrev:v,createCustomEvent:n,toggleFullScreen:R,handleClickAction:H,actions:a,contentRef:g,toolbarRef:x,thumbnailRef:w,prevRef:E,nextRef:I}}});export{h as defaultProps,C as useGallery};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/gallery/useGallery.tsx","../../src/gallery/useGallery.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport type { CarouselInstance } from '@primereact/types/shared/carousel';\nimport * as React from 'react';\nimport { defaultProps } from './useGallery.props';\n\nexport const useGallery = withHeadless({\n name: 'useGallery',\n defaultProps,\n setup: ({ props, elementRef }) => {\n const { activeIndex: activeIndexProp = 0, onActiveIndexChange = undefined } = props;\n const contentRef = React.useRef<HTMLDivElement>(null);\n const itemsRef = React.useRef<React.RefObject<HTMLDivElement>[]>([]);\n const toolbarRef = React.useRef<HTMLDivElement>(null);\n const thumbnailRef = React.useRef<CarouselInstance | null>(null);\n const prevRef = React.useRef<HTMLButtonElement>(null);\n const nextRef = React.useRef<HTMLButtonElement>(null);\n const [, forceUpdate] = React.useState(0);\n const [activeIndex, setActiveIndex] = React.useState(activeIndexProp);\n\n const [isFullscreen, setIsFullscreen] = React.useState(false);\n\n React.useEffect(() => {\n setActiveIndex(activeIndexProp);\n }, [activeIndexProp]);\n\n const registerItem = (ref: HTMLDivElement | null): number => {\n if (!ref) return -1;\n\n const existingIndex = itemsRef.current.findIndex((item) => item.current === ref);\n\n if (existingIndex === -1) {\n itemsRef.current.push({ current: ref });\n forceUpdate((x) => x + 1);\n\n return itemsRef.current.length - 1;\n }\n\n return existingIndex;\n };\n\n const handleNext = () => {\n const newIndex = (activeIndex + 1) % itemsRef.current.length;\n\n setActiveIndex(newIndex);\n onActiveIndexChange?.({ originalEvent: undefined as unknown as React.SyntheticEvent, value: newIndex });\n };\n\n const handlePrev = () => {\n const newIndex = (activeIndex - 1 + itemsRef.current.length) % itemsRef.current.length;\n\n setActiveIndex(newIndex);\n onActiveIndexChange?.({ originalEvent: undefined as unknown as React.SyntheticEvent, value: newIndex });\n };\n\n const createCustomEvent = (action: string) => () => {\n const activeItem = itemsRef.current[activeIndex]?.current;\n\n if (activeItem) {\n const event = new CustomEvent('gallery-' + action, {\n detail: { action: action }\n });\n\n activeItem.dispatchEvent(event);\n }\n };\n\n const toggleFullScreen = () => {\n if (!elementRef.current) return;\n\n if (!isFullscreen) {\n Object.assign(elementRef.current.style, {\n position: 'fixed',\n top: '0',\n left: '0',\n width: '100dvw',\n height: '100dvh',\n zIndex: '9999'\n });\n\n document.body.style.overflow = 'hidden';\n\n setIsFullscreen(true);\n } else {\n Object.assign(elementRef.current.style, {\n position: 'relative',\n top: '',\n left: '',\n width: '',\n height: '',\n zIndex: ''\n });\n\n document.body.style.overflow = 'auto';\n\n setIsFullscreen(false);\n }\n\n setTimeout(() => {\n window.dispatchEvent(new Event('resize'));\n }, 100);\n };\n\n const actions = {\n zoomIn: createCustomEvent('zoom-in'),\n zoomOut: createCustomEvent('zoom-out'),\n rotateLeft: createCustomEvent('rotate-left'),\n rotateRight: createCustomEvent('rotate-right'),\n flipX: createCustomEvent('flip-x'),\n flipY: createCustomEvent('flip-y'),\n download: createCustomEvent('download'),\n next: handleNext,\n prev: handlePrev,\n toggleFullScreen: toggleFullScreen\n };\n\n const handleClickAction = React.useCallback(\n (action?: string) => {\n if (action && actions[action as keyof typeof actions]) {\n actions[action as keyof typeof actions]();\n }\n },\n [actions]\n );\n\n const state = {\n isFullscreen,\n activeIndex\n };\n\n return {\n state,\n registerItem,\n handleNext,\n handlePrev,\n createCustomEvent,\n toggleFullScreen,\n handleClickAction,\n actions,\n contentRef,\n toolbarRef,\n thumbnailRef,\n prevRef,\n nextRef\n };\n }\n});\n","import type { useGalleryProps } from '@primereact/types/shared/gallery';\n\nexport const defaultProps: useGalleryProps = {\n activeIndex: 0,\n onActiveIndexChange: undefined\n};\n"],"mappings":"AAAA,OAAS,gBAAAA,MAAoB,4BAE7B,UAAYC,MAAW,QCAhB,IAAMC,EAAgC,CACzC,YAAa,EACb,oBAAqB,MACzB,EDAO,IAAMC,EAAaC,EAAa,CACnC,KAAM,aACN,aAAAC,EACA,MAAO,CAAC,CAAE,MAAAC,EAAO,WAAAC,CAAW,IAAM,CAC9B,GAAM,CAAE,YAAaC,EAAkB,EAAG,oBAAAC,EAAsB,MAAU,EAAIH,EACxEI,EAAmB,SAAuB,IAAI,EAC9CC,EAAiB,SAA0C,CAAC,CAAC,EAC7DC,EAAmB,SAAuB,IAAI,EAC9CC,EAAqB,SAAgC,IAAI,EACzDC,EAAgB,SAA0B,IAAI,EAC9CC,EAAgB,SAA0B,IAAI,EAC9C,CAAC,CAAEC,CAAW,EAAU,WAAS,CAAC,EAClC,CAACC,EAAaC,CAAc,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,OAAO,OAAOb,EAAW,QAAQ,MAAO,CACpC,SAAU,QACV,IAAK,IACL,KAAM,IACN,MAAO,SACP,OAAQ,SACR,OAAQ,MACZ,CAAC,EAED,SAAS,KAAK,MAAM,SAAW,SAE/Ba,EAAgB,EAAI,GAgBxB,WAAW,IAAM,CACb,OAAO,cAAc,IAAI,MAAM,QAAQ,CAAC,CAC5C,EAAG,GAAG,EACV,EAEMe,EAAU,CACZ,OAAQN,EAAkB,SAAS,EACnC,QAASA,EAAkB,UAAU,EACrC,WAAYA,EAAkB,aAAa,EAC3C,YAAaA,EAAkB,cAAc,EAC7C,MAAOA,EAAkB,QAAQ,EACjC,MAAOA,EAAkB,QAAQ,EACjC,SAAUA,EAAkB,UAAU,EACtC,KAAMH,EACN,KAAME,EACN,iBAAkBM,CACtB,EAEME,EAA0B,cAC3BN,GAAoB,CACbA,GAAUK,EAAQL,CAA8B,GAChDK,EAAQL,CAA8B,EAAE,CAEhD,EACA,CAACK,CAAO,CACZ,EAOA,MAAO,CACH,MANU,CACV,aAAAhB,EACA,YAAAF,CACJ,EAII,aAAAI,EACA,WAAAK,EACA,WAAAE,EACA,kBAAAC,EACA,iBAAAK,EACA,kBAAAE,EACA,QAAAD,EACA,WAAAzB,EACA,WAAAE,EACA,aAAAC,EACA,QAAAC,EACA,QAAAC,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","React","defaultProps","useGallery","withHeadless","defaultProps","props","elementRef","activeIndexProp","onActiveIndexChange","contentRef","itemsRef","toolbarRef","thumbnailRef","prevRef","nextRef","forceUpdate","activeIndex","setActiveIndex","isFullscreen","setIsFullscreen","registerItem","ref","existingIndex","item","x","handleNext","newIndex","handlePrev","createCustomEvent","action","_a","activeItem","event","toggleFullScreen","actions","handleClickAction"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var ye=Object.defineProperty,ve=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var it=Object.getOwnPropertySymbols;var Ie=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var at=(o,r,s)=>r in o?ye(o,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[r]=s,P=(o,r)=>{for(var s in r||(r={}))Ie.call(r,s)&&at(o,s,r[s]);if(it)for(var s of it(r))Ge.call(r,s)&&at(o,s,r[s]);return o},b=(o,r)=>ve(o,be(r));import{withHeadless as xr}from"@primereact/core/headless";import{Component as lr}from"@primereact/core/component";import{useGallery as ur}from"@primereact/headless/gallery";import{styles as fr}from"@primereact/styles/gallery";import{mergeProps as dr}from"@primeuix/utils";import{withComponent as Re}from"@primereact/core/component";import{styles as Ee}from"@primereact/styles/base";var m=({name:o="UnknownComponent",defaultProps:r,styles:s=b(P({},Ee),{name:"global"}),components:t,setup:e,render:a})=>Re({name:o,defaultProps:r,styles:s,components:t,setup:e,render:a});import*as _ from"react";import{createOptionalContext as we}from"@primereact/core/utils";var[mt,f]=we();import*as pt from"@primereact/headless/gallery";var ct=b(P({},pt.defaultProps),{as:"div"});import{Component as Te}from"@primereact/core/component";import{mergeProps as Se}from"@primeuix/utils";import*as ut from"react";var lt={as:"div"};var ft=m({name:"GalleryBackdrop",defaultProps:lt,setup(){return{gallery:f()}},render(o){let{props:r,ptmi:s,gallery:t}=o,e=Se({className:t==null?void 0:t.cx("backdrop")},s("root"));return ut.createElement(Te,{instance:o,attrs:e,children:r.children})}});import{Component as ke}from"@primereact/core/component";import{mergeProps as Le}from"@primeuix/utils";import*as xt from"react";var dt={as:"div"};var ht=m({name:"GalleryContent",defaultProps:dt,setup(){return{gallery:f()}},render(o){let{props:r,ptmi:s,gallery:t}=o,e=Le({className:t==null?void 0:t.cx("content")},s("root"));return xt.createElement(ke,{instance:o,attrs:e,children:r.children,ref:t==null?void 0:t.contentRef})}});import{Component as Me}from"@primereact/core/component";import{useGalleryItem as ge}from"@primereact/headless/gallery/item";import{mergeProps as ze}from"@primeuix/utils";import*as K from"react";import{createOptionalContext as Ne}from"@primereact/core/utils";var[Ct,jr]=Ne();import*as Pt from"@primereact/headless/gallery";var yt=b(P({},Pt.defaultProps),{as:"div"});var vt=m({name:"GalleryItem",defaultProps:yt,setup(o){let r=f(),s=ge(o.inProps);return b(P({},s),{gallery:r})},render(o){let{id:r,props:s,ptmi:t,gallery:e,handleClick:a,handlePointerDown:N,handlePointerMove:S,handlePointerUp:k,handleDragStart:y,CSSVariables:L,attributes:x}=o,H=ze(P({id:r,className:e==null?void 0:e.cx("item"),onClick:a,onPointerDown:N,onPointerMove:S,onPointerUp:k,onDragStart:y,style:L},x),t("root"),e==null?void 0:e.ptm("item"));return K.createElement(Ct,{value:o},K.createElement(Me,{instance:o,attrs:H,children:s.children}))}});import{Component as De}from"@primereact/core/component";import{mergeProps as Xe}from"@primeuix/utils";import*as It from"react";var bt={as:"button"};var Gt=m({name:"GalleryNext",defaultProps:bt,setup(){return{gallery:f()}},render(o){var a;let{props:r,ptmi:s,gallery:t}=o,e=Xe({className:t==null?void 0:t.cx("next"),onClick:(a=t==null?void 0:t.actions)==null?void 0:a.next},s("root"));return It.createElement(De,{instance:o,attrs:e,children:r.children,ref:t==null?void 0:t.nextRef})}});import{Component as Ye}from"@primereact/core/component";import{mergeProps as He}from"@primeuix/utils";import*as Et from"react";var Rt={as:"button"};var wt=m({name:"GalleryPrev",defaultProps:Rt,setup(){return{gallery:f()}},render(o){var a;let{props:r,ptmi:s,gallery:t}=o,e=He({className:t==null?void 0:t.cx("prev"),onClick:(a=t==null?void 0:t.actions)==null?void 0:a.prev},s("root"));return Et.createElement(Ye,{instance:o,attrs:e,children:r.children,ref:t==null?void 0:t.prevRef})}});import{Component as er}from"@primereact/core/component";import{mergeProps as rr}from"@primeuix/utils";import{Component as Je}from"@primereact/core/component";import{useCarousel as Qe}from"@primereact/headless/carousel";import{styles as Ze}from"@primereact/styles/carousel";import{mergeProps as tr}from"@primeuix/utils";import*as q from"react";import{createOptionalContext as Oe}from"@primereact/core/utils";var[Tt,I]=Oe();import*as St from"@primereact/headless/carousel";var kt=b(P({},St.defaultProps),{as:"div"});import{Component as $e}from"@primereact/core/component";import{mergeProps as Nt}from"@primeuix/utils";import*as V from"react";var Lt={as:"div"};var Mt=m({name:"CarouselContent",defaultProps:Lt,setup(){return{carousel:I()}},render(o){let{props:r,ptmi:s,carousel:t}=o,e=Nt({className:t==null?void 0:t.cx("content",{orientation:t==null?void 0:t.props.orientation}),style:{"--p-swipe-amount-x":"0px","--p-swipe-amount-y":"0px","--p-spacing":`${t==null?void 0:t.props.spacing}px`},onPointerDown:t==null?void 0:t.handlePointerDown,onPointerMove:t==null?void 0:t.handlePointerMove,onPointerUp:t==null?void 0:t.handlePointerUp,onClick:t==null?void 0:t.handleClick,onClickCapture:t==null?void 0:t.handleClick},t==null?void 0:t.ptm("content"),s("root")),a=Nt({className:t==null?void 0:t.cx("viewport")},t==null?void 0:t.ptm("viewport"));return V.createElement("div",P({},a),V.createElement($e,{instance:o,attrs:e,children:r.children,ref:t==null?void 0:t.carouselRef}))}});import{Component as je}from"@primereact/core/component";import{mergeProps as Be}from"@primeuix/utils";import*as zt from"react";var gt={as:"button",snap:void 0,index:void 0};var W=m({name:"CarouselIndicator",defaultProps:gt,setup(){return{carousel:I()}},render(o){var a;let{props:r,ptmi:s,carousel:t}=o,e=Be({className:t==null?void 0:t.cx("indicator",{active:r.index===((a=t==null?void 0:t.state)==null?void 0:a.activeIndex)}),onClick:()=>t==null?void 0:t.slideTo(void 0,r.snap)},t==null?void 0:t.ptm("indicator"),s("root"));return zt.createElement(je,{instance:o,attrs:e,children:r.children})}});import{Component as Ae}from"@primereact/core/component";import{mergeProps as We}from"@primeuix/utils";import*as X from"react";var Dt={as:"div"};var Xt=m({name:"CarouselIndicators",defaultProps:Dt,setup(){return{carousel:I()}},render(o){var a,N;let{props:r,ptmi:s,carousel:t}=o,e=We({className:t==null?void 0:t.cx("indicators")},t==null?void 0:t.ptm("indicators"),s("root"));return X.createElement(Ae,{instance:o,attrs:e,children:(N=r.children)!=null?N:X.createElement(X.Fragment,null,(a=t==null?void 0:t.state)==null?void 0:a.snapPoints.map((S,k)=>X.createElement(W,{key:k,snap:S,index:k})))})}});import{Component as Ue}from"@primereact/core/component";import{mergeProps as Fe}from"@primeuix/utils";import*as Ht from"react";var Yt={as:"div",size:100};var Ot=m({name:"CarouselItem",defaultProps:Yt,setup(){return{carousel:I()}},render(o){let{props:r,ptmi:s,carousel:t}=o,e=Fe({className:t==null?void 0:t.cx("item"),style:{"--p-slide-size":`${r.size}%`}},t==null?void 0:t.ptm("item"),s("root"));return Ht.createElement(Ue,{instance:o,attrs:e,children:r.children,ref:t==null?void 0:t.addSlideRef})}});import{Component as Ke}from"@primereact/core/component";import{mergeProps as Ve}from"@primeuix/utils";import*as jt from"react";var $t={as:"button"};var Bt=m({name:"CarouselNext",defaultProps:$t,setup(){return{carousel:I()}},render(o){let{props:r,ptmi:s,carousel:t}=o,e=t==null?void 0:t.state.nextDisabled,a=Ve({className:t==null?void 0:t.cx("prev",{disabled:e}),onClick:t==null?void 0:t.handleNext,disabled:e},t==null?void 0:t.ptm("prev"),s("root"));return jt.createElement(Ke,{instance:o,attrs:a,children:r.children})}});import{Component as qe}from"@primereact/core/component";import{mergeProps as _e}from"@primeuix/utils";import*as Wt from"react";var At={as:"button"};var Ut=m({name:"CarouselPrev",defaultProps:At,setup(){return{carousel:I()}},render(o){let{props:r,ptmi:s,carousel:t}=o,e=t==null?void 0:t.state.prevDisabled,a=_e({className:t==null?void 0:t.cx("prev",{disabled:e}),onClick:t==null?void 0:t.handlePrev,disabled:e},t==null?void 0:t.ptm("prev"),s("root"));return Wt.createElement(qe,{instance:o,attrs:a,children:r.children})}});var Y=m({name:"Carousel",defaultProps:kt,styles:Ze,setup(o){return Qe(o.inProps)},render(o){let{id:r,props:s,ptmi:t,cx:e}=o,a=tr({id:r,className:e("root")},t("root"));return q.createElement(Tt,{value:o},q.createElement(Je,{instance:o,attrs:a,children:s.children}))},components:{Content:Mt,Item:Ot,Next:Bt,Prev:Ut,Indicators:Xt,Indicator:W}});import*as Kt from"react";var Ft={as:"div"};var Vt=m({name:"GalleryThumbnail",defaultProps:Ft,setup(){return{gallery:f()}},render(o){let{props:r,ptmi:s,gallery:t}=o,e=rr({className:t==null?void 0:t.cx("thumbnail")},s("root"));return Kt.createElement(er,{as:Y,instance:o,attrs:e,children:r.children,ref:t==null?void 0:t.thumbnailRef})}});import{Component as or}from"@primereact/core/component";import{mergeProps as nr}from"@primeuix/utils";import*as _t from"react";var qt={};var Jt=m({name:"GalleryThumbnailContent",defaultProps:qt,setup(){return{gallery:f()}},render(o){let{props:r,ptmi:s,gallery:t}=o,e=nr({className:t==null?void 0:t.cx("thumbnailContent")},s("root"));return _t.createElement(or,{as:Y.Content,instance:o,attrs:e,children:r.children})}});import{Component as sr}from"@primereact/core/component";import{mergeProps as ir}from"@primeuix/utils";import*as Zt from"react";var Qt={};var te=m({name:"GalleryThumbnailItem",defaultProps:Qt,setup(){return{gallery:f()}},render(o){let{props:r,ptmi:s,gallery:t}=o,e=ir({className:t==null?void 0:t.cx("thumbnailItem")},s("root"));return Zt.createElement(sr,{as:Y.Item,instance:o,attrs:e,children:r.children})}});import{Component as ar}from"@primereact/core/component";import{mergeProps as mr}from"@primeuix/utils";import*as re from"react";var ee={as:"div"};var oe=m({name:"GalleryToolbar",defaultProps:ee,setup(){return{gallery:f()}},render(o){let{props:r,ptmi:s,gallery:t}=o,e=mr({className:t==null?void 0:t.cx("toolbar")},s("root"));return re.createElement(ar,{instance:o,attrs:e,children:r.children,ref:t==null?void 0:t.toolbarRef})}});import{Component as pr}from"@primereact/core/component";import{mergeProps as cr}from"@primeuix/utils";import*as se from"react";var ne={as:"div",action:void 0,onClick:void 0};var ie=m({name:"GalleryToolbarItem",defaultProps:ne,setup(){return{gallery:f()}},render(o){let{props:r,ptmi:s,gallery:t}=o,e=cr({className:t==null?void 0:t.cx("toolbarItem"),onClick:()=>{var a;t==null||t.handleClickAction(r==null?void 0:r.action),(a=r==null?void 0:r.onClick)==null||a.call(r)}},s("root"));return se.createElement(pr,{instance:o,attrs:e,children:r.children})}});var Ks=m({name:"Gallery",defaultProps:ct,styles:fr,setup(o){return ur(o.inProps)},render(o){let{id:r,props:s,ptmi:t,cx:e}=o,a=dr({id:r,className:e("root")},t("root"));return _.createElement(mt,{value:o},_.createElement(lr,{instance:o,attrs:a,children:s.children}))},components:{Backdrop:ft,Content:ht,Item:vt,Next:Gt,Prev:wt,Toolbar:oe,ToolbarItem:ie,Thumbnail:Vt,ThumbnailContent:Jt,ThumbnailItem:te}});import*as p from"react";var ae={normalScale:1,zoomedScale:3};var oi=xr({name:"useGalleryItem",defaultProps:ae,setup:({props:o,elementRef:r})=>{let{normalScale:s=1,zoomedScale:t=3}=o,e=f(),[a,N]=p.useState(-1),[S,k]=p.useState(!1),[y,L]=p.useState({x:0,y:0}),[x,H]=p.useState(1),[T,J]=p.useState(0),[O,Q]=p.useState({x:1,y:1}),[Z,U]=p.useState(!1),[$,tt]=p.useState({x:0,y:0}),[F,j]=p.useState(!1),E=p.useRef(new Map),M=p.useRef(0),w=p.useCallback(()=>{if(!(e!=null&&e.contentRef.current)||!r.current)return;let n=e==null?void 0:e.contentRef.current.getBoundingClientRect(),i=r.current.firstElementChild;if(!i)return;let c=i.naturalWidth||i.offsetWidth,l=i.naturalHeight||i.offsetHeight;if(c===0||l===0)return;let C=Math.abs(T)%180===90;C&&([c,l]=[l,c]);let h=c/l,v=n.width/n.height,d,u;h>v?(d=Math.min(n.width*.99,c),u=d/h):(u=Math.min(n.height*.99,l),d=u*h),C?(i.style.width=`${u}px`,i.style.height=`${d}px`,r.current.style.width=`${u>0?u:"auto"}px`,r.current.style.height=`${d>0?d:"auto"}px`):(i.style.width=`${d}px`,i.style.height=`${u}px`,r.current.style.width=`${d>0?d:"auto"}px`,r.current.style.height=`${u>0?u:"auto"}px`),r.current.style.aspectRatio=`${c/l}`},[e==null?void 0:e.contentRef,T]),g=p.useCallback(n=>{if(!(e!=null&&e.contentRef.current)||!r.current)return{minX:0,maxX:0,minY:0,maxY:0};let i=e==null?void 0:e.contentRef.current.getBoundingClientRect(),c=n!==void 0?n:x,l=r.current.firstElementChild;if(!l)return{minX:0,maxX:0,minY:0,maxY:0};let C=l.offsetWidth,h=l.offsetHeight;Math.abs(T)%180===90&&([C,h]=[h,C]);let d=C*c,u=h*c,G=i.width/2,R=i.height/2,z=d/2,D=u/2,xe=z>G?z-G:0,he=z>G?-(z-G):0,Ce=D>R?D-R:0,Pe=D>R?-(D-R):0;return{minX:he,maxX:xe,minY:Pe,maxY:Ce}},[e==null?void 0:e.contentRef,x,T]),B=p.useCallback(()=>{H(t);let n={visibility:"hidden",opacity:0,pointerEvents:"none",userSelect:"none",touchAction:"none"};e!=null&&e.toolbarRef.current&&Object.assign(e==null?void 0:e.toolbarRef.current.style,n),e!=null&&e.thumbnailRef.current&&Object.assign(e==null?void 0:e.thumbnailRef.current.elementRef.current.style,n),e!=null&&e.prevRef.current&&Object.assign(e.prevRef.current.style,n),e!=null&&e.nextRef.current&&Object.assign(e.nextRef.current.style,n),r.current&&(r.current.style.cursor="zoom-out",r.current.style.pointerEvents="auto")},[t,e==null?void 0:e.toolbarRef,e==null?void 0:e.thumbnailRef,e==null?void 0:e.prevRef,e==null?void 0:e.nextRef]),A=p.useCallback(()=>{H(s),L({x:0,y:0});let n={visibility:"",opacity:"",pointerEvents:"",userSelect:"",touchAction:""};e!=null&&e.toolbarRef.current&&Object.assign(e.toolbarRef.current.style,n),e!=null&&e.thumbnailRef.current&&Object.assign(e.thumbnailRef.current.elementRef.current.style,n),e!=null&&e.prevRef.current&&Object.assign(e.prevRef.current.style,n),e!=null&&e.nextRef.current&&Object.assign(e.nextRef.current.style,n),r.current&&(r.current.style.cursor="zoom-in",r.current.style.pointerEvents="auto")},[s,e==null?void 0:e.toolbarRef,e==null?void 0:e.thumbnailRef,e==null?void 0:e.prevRef,e==null?void 0:e.nextRef]),et=()=>{r.current&&(r.current.style.transition="none",J(n=>n-90),setTimeout(()=>{r.current&&(r.current.style.transition="")},0))},rt=()=>{r.current&&(r.current.style.transition="none",J(n=>n+90),setTimeout(()=>{r.current&&(r.current.style.transition="")},0))},ot=()=>{Q(n=>b(P({},n),{x:Math.sign(n.x)*-1}))},nt=()=>{Q(n=>b(P({},n),{y:Math.sign(n.y)*-1}))},st=()=>{if(!r.current)return;let n=r.current.querySelector("img");if(!n||!n.src)return;let i=document.createElement("a");i.href=n.src;let c=n.src.split("/"),l=c[c.length-1]||"image.jpg";i.download=l,i.target="_blank",document.body.appendChild(i),i.click(),document.body.removeChild(i)},me=p.useCallback(n=>{if(F){j(!1);return}if(x===s){if(r.current){let i=r.current.getBoundingClientRect(),c=i.width/2,l=i.height/2,C=n.clientX-i.left,h=n.clientY-i.top,v=c-C,d=l-h,u=v*(t-1),G=d*(t-1),R=g(t),z=Math.max(R.minX,Math.min(R.maxX,u)),D=Math.max(R.minY,Math.min(R.maxY,G));L({x:z,y:D})}B()}else A()},[F,s,t,g,x,B,A]),pe=p.useCallback(n=>{n.preventDefault()},[]),ce=p.useCallback(n=>{n.currentTarget.setPointerCapture(n.pointerId),E.current.set(n.pointerId,{x:n.clientX,y:n.clientY}),x>1&&(n.pointerType==="mouse"?(U(!0),tt({x:n.clientX-y.x,y:n.clientY-y.y}),j(!1)):n.pointerType==="touch"&&E.current.size===1&&(U(!0),tt({x:n.clientX-y.x,y:n.clientY-y.y}),j(!1),M.current=0)),n.pointerType==="touch"&&E.current.size===1&&(M.current=0)},[x,y]),le=p.useCallback(n=>{if(!E.current.has(n.pointerId)||!r.current)return;r.current.style.transition="none",r.current.style.cursor||(r.current.style.cursor=x>s?"zoom-out":"zoom-in"),E.current.set(n.pointerId,{x:n.clientX,y:n.clientY});let c=Array.from(E.current.values());if(c.length===2){let[l,C]=c,h=Math.hypot(C.x-l.x,C.y-l.y);if(M.current>0){let v=(h-M.current)*.01;if(Math.abs(v)>.01){let d=x===s?t:s,u=g(d),G=Math.max(u.minX,Math.min(u.maxX,y.x)),R=Math.max(u.minY,Math.min(u.maxY,y.y));L({x:G,y:R}),H(d)}}M.current=h}else if(c.length===1&&Z){let l=c[0],C=l.x-$.x,h=l.y-$.y,v=g(),d=Math.max(v.minX,Math.min(v.maxX,C)),u=Math.max(v.minY,Math.min(v.maxY,h));L({x:d,y:u}),j(!0)}},[Z,$,x,s,t,y,g]),ue=p.useCallback(n=>{r.current&&(r.current.style.transition="",r.current.style.cursor=x>s?"zoom-out":"zoom-in",n.currentTarget.releasePointerCapture(n.pointerId),E.current.delete(n.pointerId),E.current.size<2&&(M.current=0),E.current.size===0&&U(!1))},[]);p.useEffect(()=>{x<=1&&L({x:0,y:0})},[x]),p.useEffect(()=>{(e==null?void 0:e.state.activeIndex)===a&&document.readyState==="complete"&&w()},[e==null?void 0:e.state.activeIndex,a,w]),p.useEffect(()=>{(e==null?void 0:e.state.activeIndex)===a&&w()},[T,w,e==null?void 0:e.state.activeIndex,a]),p.useEffect(()=>{(e==null?void 0:e.state.activeIndex)===a&&(e==null?void 0:e.state.isFullscreen)!==void 0&&w()},[e==null?void 0:e.state.isFullscreen,w,e==null?void 0:e.state.activeIndex,a]),p.useEffect(()=>{let n=()=>{(e==null?void 0:e.state.activeIndex)===a&&w()};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e==null?void 0:e.state.activeIndex,a,w]),p.useEffect(()=>{if(e&&r.current){let n=e.registerItem(r.current);N(n)}},[e]),p.useEffect(()=>{let n=c=>{var l,C,h,v,d,u,G;((l=c.detail)==null?void 0:l.action)==="zoom-in"?B():((C=c.detail)==null?void 0:C.action)==="zoom-out"?A():((h=c.detail)==null?void 0:h.action)==="rotate-left"?et():((v=c.detail)==null?void 0:v.action)==="rotate-right"?rt():((d=c.detail)==null?void 0:d.action)==="flip-x"?ot():((u=c.detail)==null?void 0:u.action)==="flip-y"?nt():((G=c.detail)==null?void 0:G.action)==="download"&&st()},i=r.current;return i&&(i.addEventListener("gallery-zoom-in",n),i.addEventListener("gallery-zoom-out",n),i.addEventListener("gallery-rotate-left",n),i.addEventListener("gallery-rotate-right",n),i.addEventListener("gallery-flip-x",n),i.addEventListener("gallery-flip-y",n),i.addEventListener("gallery-download",n)),()=>{i&&(i.removeEventListener("gallery-zoom-in",n),i.removeEventListener("gallery-zoom-out",n),i.removeEventListener("gallery-rotate-left",n),i.removeEventListener("gallery-rotate-right",n),i.removeEventListener("gallery-flip-x",n),i.removeEventListener("gallery-flip-y",n),i.removeEventListener("gallery-download",n))}},[s,t]),p.useEffect(()=>{(e==null?void 0:e.state.activeIndex)===a?k(!0):k(!1)},[e==null?void 0:e.state.activeIndex,a]);let fe=p.useMemo(()=>({"data-active":S}),[S]),de=p.useMemo(()=>({"--position-x":`${y.x}px`,"--position-y":`${y.y}px`,"--scale":`${x}`,"--rotation":`${T}deg`,"--flip-x":O.x,"--flip-y":O.y}),[y,x,T,O]);return{state:{index:a,position:y,scale:x,rotation:T,flip:O,isActive:S,dragStart:$,hasDragged:F},attributes:fe,CSSVariables:de,handlePointerUp:ue,handlePointerMove:le,handlePointerDown:ce,handleClick:me,handleDragStart:pe,zoomIn:B,zoomOut:A,rotateLeft:et,rotateRight:rt,flipX:ot,flipY:nt,download:st,calculateConstraints:g,calculateItemSize:w}}});export{ae as defaultItemProps,oi as useGalleryItem};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/gallery/item/useGalleryItem.tsx","../../../../primereact/src/gallery/Gallery.tsx","../../../../primereact/src/base/index.ts","../../../../primereact/src/gallery/Gallery.context.ts","../../../../primereact/src/gallery/Gallery.props.ts","../../../../primereact/src/gallery/backdrop/GalleryBackdrop.tsx","../../../../primereact/src/gallery/backdrop/GalleryBackdrop.props.ts","../../../../primereact/src/gallery/content/GalleryContent.tsx","../../../../primereact/src/gallery/content/GalleryContent.props.ts","../../../../primereact/src/gallery/item/GalleryItem.tsx","../../../../primereact/src/gallery/item/GalleryItem.context.ts","../../../../primereact/src/gallery/item/GalleryItem.props.ts","../../../../primereact/src/gallery/next/GalleryNext.tsx","../../../../primereact/src/gallery/next/GalleryNext.props.ts","../../../../primereact/src/gallery/prev/GalleryPrev.tsx","../../../../primereact/src/gallery/prev/GalleryPrev.props.ts","../../../../primereact/src/gallery/thumbnail/GalleryThumbnail.tsx","../../../../primereact/src/carousel/Carousel.tsx","../../../../primereact/src/carousel/Carousel.context.ts","../../../../primereact/src/carousel/Carousel.props.ts","../../../../primereact/src/carousel/content/CarouselContent.tsx","../../../../primereact/src/carousel/content/CarouselContent.props.ts","../../../../primereact/src/carousel/indicator/CarouselIndicator.tsx","../../../../primereact/src/carousel/indicator/CarouselIndicator.props.ts","../../../../primereact/src/carousel/indicators/CarouselIndicators.tsx","../../../../primereact/src/carousel/indicators/CarouselIndicators.props.ts","../../../../primereact/src/carousel/item/CarouselItem.tsx","../../../../primereact/src/carousel/item/CarouselItem.props.ts","../../../../primereact/src/carousel/next/CarouselNext.tsx","../../../../primereact/src/carousel/next/CarouselNext.props.ts","../../../../primereact/src/carousel/prev/CarouselPrev.tsx","../../../../primereact/src/carousel/prev/CarouselPrev.props.ts","../../../../primereact/src/gallery/thumbnail/GalleryThumbnail.props.ts","../../../../primereact/src/gallery/thumbnailcontent/GalleryThumbnailContent.tsx","../../../../primereact/src/gallery/thumbnailcontent/GalleryThumbnailContent.props.ts","../../../../primereact/src/gallery/thumbnailitem/GalleryThumbnailItem.tsx","../../../../primereact/src/gallery/thumbnailitem/GalleryThumbnailItem.props.ts","../../../../primereact/src/gallery/toolbar/GalleryToolbar.tsx","../../../../primereact/src/gallery/toolbar/GalleryToolbar.props.ts","../../../../primereact/src/gallery/toolbaritem/GalleryToolbarItem.tsx","../../../../primereact/src/gallery/toolbaritem/GalleryToolbarItem.props.ts","../../../src/gallery/item/useGalleryItem.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useGalleryContext } from 'primereact/gallery';\nimport * as React from 'react';\nimport { defaultItemProps } from './useGalleryItem.props';\n\nexport const useGalleryItem = withHeadless({\n name: 'useGalleryItem',\n defaultProps: defaultItemProps,\n setup: ({ props, elementRef }) => {\n const { normalScale = 1, zoomedScale = 3 } = props;\n\n const gallery = useGalleryContext();\n const [index, setIndex] = React.useState(-1);\n const [isActive, setIsActive] = React.useState(false);\n const [position, setPosition] = React.useState({ x: 0, y: 0 });\n const [scale, setScale] = React.useState(1);\n const [rotation, setRotation] = React.useState(0);\n const [flip, setFlip] = React.useState({ x: 1, y: 1 });\n\n const [isDragging, setIsDragging] = React.useState(false);\n const [dragStart, setDragStart] = React.useState({ x: 0, y: 0 });\n const [hasDragged, setHasDragged] = React.useState(false);\n\n const pointerDataRef = React.useRef<Map<number, { x: number; y: number }>>(new Map());\n const lastDistanceRef = React.useRef(0);\n\n const calculateItemSize = React.useCallback(() => {\n if (!gallery?.contentRef.current || !elementRef.current) return;\n\n const contentRect = gallery?.contentRef.current.getBoundingClientRect();\n\n const imageElement = elementRef.current.firstElementChild as HTMLImageElement;\n\n if (!imageElement) return;\n\n let naturalWidth = imageElement.naturalWidth || imageElement.offsetWidth;\n let naturalHeight = imageElement.naturalHeight || imageElement.offsetHeight;\n\n if (naturalWidth === 0 || naturalHeight === 0) return;\n\n const isRotated = Math.abs(rotation) % 180 === 90;\n\n if (isRotated) {\n [naturalWidth, naturalHeight] = [naturalHeight, naturalWidth];\n }\n\n const naturalAspectRatio = naturalWidth / naturalHeight;\n const contentAspectRatio = contentRect.width / contentRect.height;\n\n let targetWidth, targetHeight;\n\n if (naturalAspectRatio > contentAspectRatio) {\n targetWidth = Math.min(contentRect.width * 0.99, naturalWidth);\n targetHeight = targetWidth / naturalAspectRatio;\n } else {\n targetHeight = Math.min(contentRect.height * 0.99, naturalHeight);\n targetWidth = targetHeight * naturalAspectRatio;\n }\n\n if (isRotated) {\n imageElement.style.width = `${targetHeight}px`;\n imageElement.style.height = `${targetWidth}px`;\n elementRef.current.style.width = `${targetHeight > 0 ? targetHeight : 'auto'}px`;\n elementRef.current.style.height = `${targetWidth > 0 ? targetWidth : 'auto'}px`;\n } else {\n imageElement.style.width = `${targetWidth}px`;\n imageElement.style.height = `${targetHeight}px`;\n elementRef.current.style.width = `${targetWidth > 0 ? targetWidth : 'auto'}px`;\n elementRef.current.style.height = `${targetHeight > 0 ? targetHeight : 'auto'}px`;\n }\n\n elementRef.current.style.aspectRatio = `${naturalWidth / naturalHeight}`;\n }, [gallery?.contentRef, rotation]);\n\n const calculateConstraints = React.useCallback(\n (targetScale?: number) => {\n if (!gallery?.contentRef.current || !elementRef.current) return { minX: 0, maxX: 0, minY: 0, maxY: 0 };\n\n const contentRect = gallery?.contentRef.current.getBoundingClientRect();\n const scaleToUse = targetScale !== undefined ? targetScale : scale;\n\n const itemElement = elementRef.current.firstElementChild as HTMLElement;\n\n if (!itemElement) return { minX: 0, maxX: 0, minY: 0, maxY: 0 };\n\n let originalWidth = itemElement.offsetWidth;\n let originalHeight = itemElement.offsetHeight;\n\n const isRotated = Math.abs(rotation) % 180 === 90;\n\n if (isRotated) {\n [originalWidth, originalHeight] = [originalHeight, originalWidth];\n }\n\n const scaledWidth = originalWidth * scaleToUse;\n const scaledHeight = originalHeight * scaleToUse;\n\n const contentCenterX = contentRect.width / 2;\n const contentCenterY = contentRect.height / 2;\n\n const halfScaledWidth = scaledWidth / 2;\n const halfScaledHeight = scaledHeight / 2;\n\n const maxX = halfScaledWidth > contentCenterX ? halfScaledWidth - contentCenterX : 0;\n const minX = halfScaledWidth > contentCenterX ? -(halfScaledWidth - contentCenterX) : 0;\n\n const maxY = halfScaledHeight > contentCenterY ? halfScaledHeight - contentCenterY : 0;\n const minY = halfScaledHeight > contentCenterY ? -(halfScaledHeight - contentCenterY) : 0;\n\n return { minX, maxX, minY, maxY };\n },\n [gallery?.contentRef, scale, rotation]\n );\n\n const zoomIn = React.useCallback(() => {\n setScale(zoomedScale);\n\n const hiddenStyles = {\n visibility: 'hidden',\n opacity: 0,\n pointerEvents: 'none',\n userSelect: 'none',\n touchAction: 'none'\n };\n\n if (gallery?.toolbarRef.current) {\n Object.assign(gallery?.toolbarRef.current.style, hiddenStyles);\n }\n\n if (gallery?.thumbnailRef.current) {\n // @ts-expect-error - thumbnailRef may not have elementRef property\n Object.assign(gallery?.thumbnailRef.current.elementRef.current.style, hiddenStyles);\n }\n\n if (gallery?.prevRef.current) {\n Object.assign(gallery.prevRef.current.style, hiddenStyles);\n }\n\n if (gallery?.nextRef.current) {\n Object.assign(gallery.nextRef.current.style, hiddenStyles);\n }\n\n if (elementRef.current) {\n elementRef.current.style.cursor = 'zoom-out';\n elementRef.current.style.pointerEvents = 'auto';\n }\n }, [zoomedScale, gallery?.toolbarRef, gallery?.thumbnailRef, gallery?.prevRef, gallery?.nextRef]);\n\n const zoomOut = React.useCallback(() => {\n setScale(normalScale);\n setPosition({ x: 0, y: 0 });\n\n const resetStyles = {\n visibility: '',\n opacity: '',\n pointerEvents: '',\n userSelect: '',\n touchAction: ''\n };\n\n if (gallery?.toolbarRef.current) {\n Object.assign(gallery.toolbarRef.current.style, resetStyles);\n }\n\n if (gallery?.thumbnailRef.current) {\n // @ts-expect-error - thumbnailRef may not have elementRef property\n Object.assign(gallery.thumbnailRef.current.elementRef.current.style, resetStyles);\n }\n\n if (gallery?.prevRef.current) {\n Object.assign(gallery.prevRef.current.style, resetStyles);\n }\n\n if (gallery?.nextRef.current) {\n Object.assign(gallery.nextRef.current.style, resetStyles);\n }\n\n if (elementRef.current) {\n elementRef.current.style.cursor = 'zoom-in';\n elementRef.current.style.pointerEvents = 'auto';\n }\n }, [normalScale, gallery?.toolbarRef, gallery?.thumbnailRef, gallery?.prevRef, gallery?.nextRef]);\n\n const rotateLeft = () => {\n if (!elementRef.current) return;\n\n elementRef.current.style.transition = 'none';\n setRotation((prev) => prev - 90);\n setTimeout(() => {\n if (elementRef.current) {\n elementRef.current.style.transition = '';\n }\n }, 0);\n };\n\n const rotateRight = () => {\n if (!elementRef.current) return;\n\n elementRef.current.style.transition = 'none';\n setRotation((prev) => prev + 90);\n setTimeout(() => {\n if (elementRef.current) {\n elementRef.current.style.transition = '';\n }\n }, 0);\n };\n\n const flipX = () => {\n setFlip((prev) => ({ ...prev, x: Math.sign(prev.x) * -1 }));\n };\n\n const flipY = () => {\n setFlip((prev) => ({ ...prev, y: Math.sign(prev.y) * -1 }));\n };\n\n const download = () => {\n if (!elementRef.current) return;\n\n const imageElement = elementRef.current.querySelector('img') as HTMLImageElement;\n\n if (!imageElement || !imageElement.src) return;\n\n const link = document.createElement('a');\n\n link.href = imageElement.src;\n\n const urlParts = imageElement.src.split('/');\n const filename = urlParts[urlParts.length - 1] || 'image.jpg';\n\n link.download = filename;\n link.target = '_blank';\n\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n };\n\n const handleClick = React.useCallback(\n (e: React.MouseEvent) => {\n if (hasDragged) {\n setHasDragged(false);\n\n return;\n }\n\n if (scale === normalScale) {\n if (elementRef.current) {\n const itemRect = elementRef.current.getBoundingClientRect();\n\n const itemCenterX = itemRect.width / 2;\n const itemCenterY = itemRect.height / 2;\n\n const clickX = e.clientX - itemRect.left;\n const clickY = e.clientY - itemRect.top;\n\n const offsetX = itemCenterX - clickX;\n const offsetY = itemCenterY - clickY;\n\n const zoomOffsetX = offsetX * (zoomedScale - 1);\n const zoomOffsetY = offsetY * (zoomedScale - 1);\n\n const constraints = calculateConstraints(zoomedScale);\n const constrainedX = Math.max(constraints.minX, Math.min(constraints.maxX, zoomOffsetX));\n const constrainedY = Math.max(constraints.minY, Math.min(constraints.maxY, zoomOffsetY));\n\n setPosition({ x: constrainedX, y: constrainedY });\n }\n\n zoomIn();\n } else {\n zoomOut();\n }\n },\n [hasDragged, normalScale, zoomedScale, calculateConstraints, scale, zoomIn, zoomOut]\n );\n const handleDragStart = React.useCallback((e: React.DragEvent<HTMLDivElement>) => {\n e.preventDefault();\n }, []);\n\n const handlePointerDown = React.useCallback(\n (e: React.PointerEvent) => {\n e.currentTarget.setPointerCapture(e.pointerId);\n pointerDataRef.current.set(e.pointerId, { x: e.clientX, y: e.clientY });\n\n if (scale > 1) {\n if (e.pointerType === 'mouse') {\n setIsDragging(true);\n setDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });\n setHasDragged(false);\n } else if (e.pointerType === 'touch' && pointerDataRef.current.size === 1) {\n setIsDragging(true);\n setDragStart({ x: e.clientX - position.x, y: e.clientY - position.y });\n setHasDragged(false);\n lastDistanceRef.current = 0;\n }\n }\n\n if (e.pointerType === 'touch' && pointerDataRef.current.size === 1) {\n lastDistanceRef.current = 0;\n }\n },\n [scale, position]\n );\n\n const handlePointerMove = React.useCallback(\n (e: React.PointerEvent) => {\n if (!pointerDataRef.current.has(e.pointerId) || !elementRef.current) return;\n\n elementRef.current.style.transition = 'none';\n\n // Preserve cursor during move\n const currentCursor = elementRef.current.style.cursor;\n\n if (!currentCursor) {\n elementRef.current.style.cursor = scale > normalScale ? 'zoom-out' : 'zoom-in';\n }\n\n pointerDataRef.current.set(e.pointerId, { x: e.clientX, y: e.clientY });\n\n const pointers = Array.from(pointerDataRef.current.values());\n\n if (pointers.length === 2) {\n const [p1, p2] = pointers;\n const distance = Math.hypot(p2.x - p1.x, p2.y - p1.y);\n\n if (lastDistanceRef.current > 0) {\n const delta = (distance - lastDistanceRef.current) * 0.01;\n\n if (Math.abs(delta) > 0.01) {\n const newScale = scale === normalScale ? zoomedScale : normalScale;\n\n const constraints = calculateConstraints(newScale);\n const constrainedX = Math.max(constraints.minX, Math.min(constraints.maxX, position.x));\n const constrainedY = Math.max(constraints.minY, Math.min(constraints.maxY, position.y));\n\n setPosition({ x: constrainedX, y: constrainedY });\n\n setScale(newScale);\n }\n }\n\n lastDistanceRef.current = distance;\n } else if (pointers.length === 1 && isDragging) {\n const pointer = pointers[0];\n const newX = pointer.x - dragStart.x;\n const newY = pointer.y - dragStart.y;\n const constraints = calculateConstraints();\n\n const computedX = Math.max(constraints.minX, Math.min(constraints.maxX, newX));\n const computedY = Math.max(constraints.minY, Math.min(constraints.maxY, newY));\n\n setPosition({\n x: computedX,\n y: computedY\n });\n setHasDragged(true);\n }\n },\n [isDragging, dragStart, scale, normalScale, zoomedScale, position, calculateConstraints]\n );\n\n const handlePointerUp = React.useCallback((e: React.PointerEvent) => {\n if (!elementRef.current) return;\n\n elementRef.current.style.transition = '';\n // Restore proper cursor after interaction\n elementRef.current.style.cursor = scale > normalScale ? 'zoom-out' : 'zoom-in';\n e.currentTarget.releasePointerCapture(e.pointerId);\n pointerDataRef.current.delete(e.pointerId);\n\n if (pointerDataRef.current.size < 2) lastDistanceRef.current = 0;\n\n if (pointerDataRef.current.size === 0) {\n setIsDragging(false);\n }\n }, []);\n\n React.useEffect(() => {\n if (scale <= 1) {\n setPosition({ x: 0, y: 0 });\n }\n }, [scale]);\n\n React.useEffect(() => {\n if (gallery?.state.activeIndex === index && document.readyState === 'complete') {\n calculateItemSize();\n }\n }, [gallery?.state.activeIndex, index, calculateItemSize]);\n\n React.useEffect(() => {\n if (gallery?.state.activeIndex === index) {\n calculateItemSize();\n }\n }, [rotation, calculateItemSize, gallery?.state.activeIndex, index]);\n\n React.useEffect(() => {\n if (gallery?.state.activeIndex === index && gallery?.state.isFullscreen !== undefined) {\n calculateItemSize();\n }\n }, [gallery?.state.isFullscreen, calculateItemSize, gallery?.state.activeIndex, index]);\n\n React.useEffect(() => {\n const handleResize = () => {\n if (gallery?.state.activeIndex === index) {\n calculateItemSize();\n }\n };\n\n window.addEventListener('resize', handleResize);\n\n return () => window.removeEventListener('resize', handleResize);\n }, [gallery?.state.activeIndex, index, calculateItemSize]);\n\n React.useEffect(() => {\n if (gallery && elementRef.current) {\n const index = gallery.registerItem(elementRef.current as HTMLDivElement);\n\n setIndex(index);\n }\n }, [gallery]);\n\n React.useEffect(() => {\n const handleCustomEvent = (e: CustomEvent) => {\n if (e.detail?.action === 'zoom-in') {\n zoomIn();\n } else if (e.detail?.action === 'zoom-out') {\n zoomOut();\n } else if (e.detail?.action === 'rotate-left') {\n rotateLeft();\n } else if (e.detail?.action === 'rotate-right') {\n rotateRight();\n } else if (e.detail?.action === 'flip-x') {\n flipX();\n } else if (e.detail?.action === 'flip-y') {\n flipY();\n } else if (e.detail?.action === 'download') {\n download();\n }\n };\n\n const itemElement = elementRef.current;\n\n if (itemElement) {\n itemElement.addEventListener('gallery-zoom-in', handleCustomEvent as EventListener);\n itemElement.addEventListener('gallery-zoom-out', handleCustomEvent as EventListener);\n itemElement.addEventListener('gallery-rotate-left', handleCustomEvent as EventListener);\n itemElement.addEventListener('gallery-rotate-right', handleCustomEvent as EventListener);\n itemElement.addEventListener('gallery-flip-x', handleCustomEvent as EventListener);\n itemElement.addEventListener('gallery-flip-y', handleCustomEvent as EventListener);\n itemElement.addEventListener('gallery-download', handleCustomEvent as EventListener);\n }\n\n return () => {\n if (itemElement) {\n itemElement.removeEventListener('gallery-zoom-in', handleCustomEvent as EventListener);\n itemElement.removeEventListener('gallery-zoom-out', handleCustomEvent as EventListener);\n itemElement.removeEventListener('gallery-rotate-left', handleCustomEvent as EventListener);\n itemElement.removeEventListener('gallery-rotate-right', handleCustomEvent as EventListener);\n itemElement.removeEventListener('gallery-flip-x', handleCustomEvent as EventListener);\n itemElement.removeEventListener('gallery-flip-y', handleCustomEvent as EventListener);\n itemElement.removeEventListener('gallery-download', handleCustomEvent as EventListener);\n }\n };\n }, [normalScale, zoomedScale]);\n\n React.useEffect(() => {\n if (gallery?.state.activeIndex === index) {\n setIsActive(true);\n } else {\n setIsActive(false);\n }\n }, [gallery?.state.activeIndex, index]);\n\n const attributes = React.useMemo(() => {\n return {\n 'data-active': isActive\n };\n }, [isActive]);\n\n const CSSVariables = React.useMemo(() => {\n return {\n '--position-x': `${position.x}px`,\n '--position-y': `${position.y}px`,\n '--scale': `${scale}`,\n '--rotation': `${rotation}deg`,\n '--flip-x': flip.x,\n '--flip-y': flip.y\n } as React.CSSProperties;\n }, [position, scale, rotation, flip]);\n\n const state = {\n index,\n position,\n scale,\n rotation,\n flip,\n isActive,\n dragStart,\n hasDragged\n };\n\n return {\n state,\n attributes,\n CSSVariables,\n handlePointerUp,\n handlePointerMove,\n handlePointerDown,\n handleClick,\n handleDragStart,\n zoomIn,\n zoomOut,\n rotateLeft,\n rotateRight,\n flipX,\n flipY,\n download,\n calculateConstraints,\n calculateItemSize\n };\n }\n});\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { useGallery } from '@primereact/headless/gallery';\nimport { styles } from '@primereact/styles/gallery';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { GalleryProvider } from './Gallery.context';\nimport { defaultProps } from './Gallery.props';\nimport { GalleryBackdrop } from './backdrop/GalleryBackdrop';\nimport { GalleryContent } from './content/GalleryContent';\nimport { GalleryItem } from './item/GalleryItem';\nimport { GalleryNext } from './next/GalleryNext';\nimport { GalleryPrev } from './prev/GalleryPrev';\nimport { GalleryThumbnail } from './thumbnail/GalleryThumbnail';\nimport { GalleryThumbnailContent } from './thumbnailcontent/GalleryThumbnailContent';\nimport { GalleryThumbnailItem } from './thumbnailitem/GalleryThumbnailItem';\nimport { GalleryToolbar } from './toolbar/GalleryToolbar';\nimport { GalleryToolbarItem } from './toolbaritem/GalleryToolbarItem';\n\nexport const Gallery = withComponent({\n name: 'Gallery',\n defaultProps,\n styles,\n setup(instance) {\n const gallery = useGallery(instance.inProps);\n\n return gallery;\n },\n render(instance) {\n const { id, props, ptmi, cx } = instance;\n\n const rootProps = mergeProps(\n {\n id,\n className: cx('root')\n },\n ptmi('root')\n );\n\n return (\n <GalleryProvider value={instance}>\n <Component instance={instance} attrs={rootProps} children={props.children} />\n </GalleryProvider>\n );\n },\n components: {\n Backdrop: GalleryBackdrop,\n Content: GalleryContent,\n Item: GalleryItem,\n Next: GalleryNext,\n Prev: GalleryPrev,\n Toolbar: GalleryToolbar,\n ToolbarItem: GalleryToolbarItem,\n Thumbnail: GalleryThumbnail,\n ThumbnailContent: GalleryThumbnailContent,\n ThumbnailItem: GalleryThumbnailItem\n }\n});\n","import { withComponent as withComponentInCore } from '@primereact/core/component';\nimport { styles as baseStyles } from '@primereact/styles/base';\nimport type { withComponentOptions } from '@primereact/types/core';\nimport type { StylesOptions } from '@primereact/types/styles';\n\nexport const withComponent = <IProps, DProps, Exposes extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>, Styles = StylesOptions, CData = Record<string, unknown>>({\n name = 'UnknownComponent',\n defaultProps,\n styles = {\n ...baseStyles,\n name: 'global'\n } as Styles,\n components,\n setup,\n render\n}: withComponentOptions<IProps, DProps, Exposes, Styles, CData>) => {\n return withComponentInCore<IProps, DProps, Exposes, Styles, CData>({\n name,\n defaultProps,\n styles,\n components,\n setup,\n render\n });\n};\n","import { createOptionalContext } from '@primereact/core/utils';\nimport type { GalleryInstance } from '@primereact/types/shared/gallery';\n\nexport const [GalleryProvider, useGalleryContext] = createOptionalContext<GalleryInstance>();\n","import * as HeadlessGallery from '@primereact/headless/gallery';\nimport type { GalleryProps } from '@primereact/types/shared/gallery';\n\nexport const defaultProps: GalleryProps = {\n ...HeadlessGallery.defaultProps,\n as: 'div'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { defaultCloseProps } from './GalleryBackdrop.props';\n\nexport const GalleryBackdrop = withComponent({\n name: 'GalleryBackdrop',\n defaultProps: defaultCloseProps,\n setup() {\n const gallery = useGalleryContext();\n\n return { gallery };\n },\n render(instance) {\n const { props, ptmi, gallery } = instance;\n\n const rootProps = mergeProps(\n {\n className: gallery?.cx('backdrop')\n },\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} />;\n }\n});\n","import { GalleryBackdropProps } from '@primereact/types/shared/gallery';\n\nexport const defaultCloseProps: GalleryBackdropProps = {\n as: 'div'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { defaultContentProps } from './GalleryContent.props';\n\nexport const GalleryContent = withComponent({\n name: 'GalleryContent',\n defaultProps: defaultContentProps,\n setup() {\n const gallery = useGalleryContext();\n\n return { gallery };\n },\n render(instance) {\n const { props, ptmi, gallery } = instance;\n\n const rootProps = mergeProps(\n {\n className: gallery?.cx('content')\n },\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} ref={gallery?.contentRef} />;\n }\n});\n","import { GalleryContentProps } from '@primereact/types/shared/gallery';\n\nexport const defaultContentProps: GalleryContentProps = {\n as: 'div'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { useGalleryItem } from '@primereact/headless/gallery/item';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { GalleryItemProvider } from './GalleryItem.context';\nimport { defaultProps } from './GalleryItem.props';\n\nexport const GalleryItem = withComponent({\n name: 'GalleryItem',\n defaultProps,\n setup(instance) {\n const gallery = useGalleryContext();\n const galleryItem = useGalleryItem(instance.inProps);\n\n return { ...galleryItem, gallery };\n },\n render(instance) {\n const { id, props, ptmi, gallery, handleClick, handlePointerDown, handlePointerMove, handlePointerUp, handleDragStart, CSSVariables, attributes } = instance;\n\n const rootProps = mergeProps(\n {\n id,\n className: gallery?.cx('item'),\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n onPointerMove: handlePointerMove,\n onPointerUp: handlePointerUp,\n onDragStart: handleDragStart,\n style: CSSVariables,\n ...attributes\n },\n ptmi('root'),\n gallery?.ptm('item')\n );\n\n return (\n <GalleryItemProvider value={instance}>\n <Component instance={instance} attrs={rootProps} children={props.children} />\n </GalleryItemProvider>\n );\n }\n});\n","import { createOptionalContext } from '@primereact/core/utils';\nimport type { GalleryItemInstance } from '@primereact/types/shared/gallery';\n\nexport const [GalleryItemProvider, useGalleryItemContext] = createOptionalContext<GalleryItemInstance>();\n","import * as HeadlessGallery from '@primereact/headless/gallery';\nimport type { GalleryItemProps } from '@primereact/types/shared/gallery';\n\nexport const defaultProps: GalleryItemProps = {\n ...HeadlessGallery.defaultProps,\n as: 'div'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { defaultNextProps } from './GalleryNext.props';\n\nexport const GalleryNext = withComponent({\n name: 'GalleryNext',\n defaultProps: defaultNextProps,\n setup() {\n const gallery = useGalleryContext();\n\n return { gallery };\n },\n render(instance) {\n const { props, ptmi, gallery } = instance;\n\n const rootProps = mergeProps(\n {\n className: gallery?.cx('next'),\n onClick: gallery?.actions?.next\n },\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} ref={gallery?.nextRef} />;\n }\n});\n","import { GalleryNextProps } from '@primereact/types/shared/gallery';\n\nexport const defaultNextProps: GalleryNextProps = {\n as: 'button'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { defaultPrevProps } from './GalleryPrev.props';\n\nexport const GalleryPrev = withComponent({\n name: 'GalleryPrev',\n defaultProps: defaultPrevProps,\n setup() {\n const gallery = useGalleryContext();\n\n return { gallery };\n },\n render(instance) {\n const { props, ptmi, gallery } = instance;\n\n const rootProps = mergeProps(\n {\n className: gallery?.cx('prev'),\n onClick: gallery?.actions?.prev\n },\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} ref={gallery?.prevRef} />;\n }\n});\n","import { GalleryPrevProps } from '@primereact/types/shared/gallery';\n\nexport const defaultPrevProps: GalleryPrevProps = {\n as: 'button'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport { Carousel } from 'primereact/carousel';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { defaultThumbnailProps } from './GalleryThumbnail.props';\n\nexport const GalleryThumbnail = withComponent({\n name: 'GalleryThumbnail',\n defaultProps: defaultThumbnailProps,\n setup() {\n const gallery = useGalleryContext();\n\n return { gallery };\n },\n render(instance) {\n const { props, ptmi, gallery } = instance;\n\n const rootProps = mergeProps(\n {\n className: gallery?.cx('thumbnail')\n },\n ptmi('root')\n );\n\n return <Component as={Carousel} instance={instance} attrs={rootProps} children={props.children} ref={gallery?.thumbnailRef} />;\n }\n});\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { useCarousel } from '@primereact/headless/carousel';\nimport { styles } from '@primereact/styles/carousel';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { CarouselProvider } from './Carousel.context';\nimport { defaultProps } from './Carousel.props';\nimport { CarouselContent } from './content';\nimport { CarouselIndicator } from './indicator';\nimport { CarouselIndicators } from './indicators';\nimport { CarouselItem } from './item';\nimport { CarouselNext } from './next';\nimport { CarouselPrev } from './prev';\n\nexport const Carousel = withComponent({\n name: 'Carousel',\n defaultProps,\n styles,\n setup(instance) {\n const carousel = useCarousel(instance.inProps);\n\n return carousel;\n },\n render(instance) {\n const { id, props, ptmi, cx } = instance;\n\n const rootProps = mergeProps(\n {\n id,\n className: cx('root')\n },\n ptmi('root')\n );\n\n return (\n <CarouselProvider value={instance}>\n <Component instance={instance} attrs={rootProps} children={props.children} />\n </CarouselProvider>\n );\n },\n components: {\n Content: CarouselContent,\n Item: CarouselItem,\n Next: CarouselNext,\n Prev: CarouselPrev,\n Indicators: CarouselIndicators,\n Indicator: CarouselIndicator\n }\n});\n","import { createOptionalContext } from '@primereact/core/utils';\nimport type { CarouselInstance } from '@primereact/types/shared/carousel';\n\nexport const [CarouselProvider, useCarouselContext] = createOptionalContext<CarouselInstance>();\n","import * as HeadlessCarousel from '@primereact/headless/carousel';\nimport type { CarouselProps } from '@primereact/types/shared/carousel';\n\nexport const defaultProps: CarouselProps = {\n ...HeadlessCarousel.defaultProps,\n as: 'div'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useCarouselContext } from '../Carousel.context';\nimport { defaultContentProps } from './CarouselContent.props';\n\nexport const CarouselContent = withComponent({\n name: 'CarouselContent',\n defaultProps: defaultContentProps,\n setup() {\n const carousel = useCarouselContext();\n\n return { carousel };\n },\n render(instance) {\n const { props, ptmi, carousel } = instance;\n\n const contentProps = mergeProps(\n {\n className: carousel?.cx('content', { orientation: carousel?.props.orientation }),\n style: {\n ...({\n '--p-swipe-amount-x': `0px`,\n '--p-swipe-amount-y': `0px`,\n '--p-spacing': `${carousel?.props.spacing}px`\n } as React.CSSProperties)\n },\n onPointerDown: carousel?.handlePointerDown,\n onPointerMove: carousel?.handlePointerMove,\n onPointerUp: carousel?.handlePointerUp,\n onClick: carousel?.handleClick,\n onClickCapture: carousel?.handleClick\n },\n carousel?.ptm('content'),\n ptmi('root')\n );\n\n const viewportProps = mergeProps(\n {\n className: carousel?.cx('viewport')\n },\n carousel?.ptm('viewport')\n );\n\n return (\n <div {...viewportProps}>\n <Component instance={instance} attrs={contentProps} children={props.children} ref={carousel?.carouselRef} />\n </div>\n );\n }\n});\n","import type { CarouselContentProps } from '@primereact/types/shared/carousel';\n\nexport const defaultContentProps: CarouselContentProps = {\n as: 'div'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useCarouselContext } from '../Carousel.context';\nimport { defaultIndicatorProps } from './CarouselIndicator.props';\n\nexport const CarouselIndicator = withComponent({\n name: 'CarouselIndicator',\n defaultProps: defaultIndicatorProps,\n setup() {\n const carousel = useCarouselContext();\n\n return { carousel };\n },\n render(instance) {\n const { props, ptmi, carousel } = instance;\n\n const contentProps = mergeProps(\n {\n className: carousel?.cx('indicator', { active: props.index === carousel?.state?.activeIndex }),\n onClick: () => carousel?.slideTo(undefined, props.snap)\n },\n carousel?.ptm('indicator'),\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={contentProps} children={props.children} />;\n }\n});\n","import type { CarouselIndicatorProps } from '@primereact/types/shared/carousel';\n\nexport const defaultIndicatorProps: CarouselIndicatorProps = {\n as: 'button',\n snap: undefined,\n index: undefined\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useCarouselContext } from '../Carousel.context';\nimport { CarouselIndicator } from '../indicator/CarouselIndicator';\nimport { defaultIndicatorsProps } from './CarouselIndicators.props';\n\nexport const CarouselIndicators = withComponent({\n name: 'CarouselIndicators',\n defaultProps: defaultIndicatorsProps,\n setup() {\n const carousel = useCarouselContext();\n\n return { carousel };\n },\n render(instance) {\n const { props, ptmi, carousel } = instance;\n\n const contentProps = mergeProps(\n {\n className: carousel?.cx('indicators')\n },\n carousel?.ptm('indicators'),\n ptmi('root')\n );\n\n return (\n <Component\n instance={instance}\n attrs={contentProps}\n children={\n props.children ?? (\n <>\n {carousel?.state?.snapPoints.map((snap, i) => (\n <CarouselIndicator key={i} snap={snap} index={i} />\n ))}\n </>\n )\n }\n />\n );\n }\n});\n","import type { CarouselIndicatorsProps } from '@primereact/types/shared/carousel';\n\nexport const defaultIndicatorsProps: CarouselIndicatorsProps = {\n as: 'div'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useCarouselContext } from '../Carousel.context';\nimport { defaultItemProps } from './CarouselItem.props';\n\nexport const CarouselItem = withComponent({\n name: 'CarouselItem',\n defaultProps: defaultItemProps,\n setup() {\n const carousel = useCarouselContext();\n\n return { carousel };\n },\n render(instance) {\n const { props, ptmi, carousel } = instance;\n\n const rootProps = mergeProps(\n {\n className: carousel?.cx('item'),\n style: {\n '--p-slide-size': `${props.size}%`\n }\n },\n carousel?.ptm('item'),\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} ref={carousel?.addSlideRef} />;\n }\n});\n","import type { CarouselItemProps } from '@primereact/types/shared/carousel';\n\nexport const defaultItemProps: CarouselItemProps = {\n as: 'div',\n size: 100\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useCarouselContext } from '../Carousel.context';\nimport { defaultNextProps } from './CarouselNext.props';\n\nexport const CarouselNext = withComponent({\n name: 'CarouselNext',\n defaultProps: defaultNextProps,\n setup() {\n const carousel = useCarouselContext();\n\n return { carousel };\n },\n render(instance) {\n const { props, ptmi, carousel } = instance;\n\n const disabled = carousel?.state.nextDisabled;\n const rootProps = mergeProps(\n {\n className: carousel?.cx('prev', { disabled }),\n onClick: carousel?.handleNext,\n disabled\n },\n carousel?.ptm('prev'),\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} />;\n }\n});\n","import type { CarouselNextProps } from '@primereact/types/shared/carousel';\n\nexport const defaultNextProps: CarouselNextProps = {\n as: 'button'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useCarouselContext } from '../Carousel.context';\nimport { defaultPrevProps } from './CarouselPrev.props';\n\nexport const CarouselPrev = withComponent({\n name: 'CarouselPrev',\n defaultProps: defaultPrevProps,\n setup() {\n const carousel = useCarouselContext();\n\n return { carousel };\n },\n render(instance) {\n const { props, ptmi, carousel } = instance;\n\n const disabled = carousel?.state.prevDisabled;\n const rootProps = mergeProps(\n {\n className: carousel?.cx('prev', { disabled }),\n onClick: carousel?.handlePrev,\n disabled\n },\n carousel?.ptm('prev'),\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} />;\n }\n});\n","import type { CarouselPrevProps } from '@primereact/types/shared/carousel';\n\nexport const defaultPrevProps: CarouselPrevProps = {\n as: 'button'\n};\n","import { GalleryThumbnailProps } from '@primereact/types/shared/gallery';\n\nexport const defaultThumbnailProps: GalleryThumbnailProps = {\n as: 'div'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport { Carousel } from 'primereact/carousel';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { defaultThumbnailContentProps } from './GalleryThumbnailContent.props';\n\nexport const GalleryThumbnailContent = withComponent({\n name: 'GalleryThumbnailContent',\n defaultProps: defaultThumbnailContentProps,\n setup() {\n const gallery = useGalleryContext();\n\n return { gallery };\n },\n render(instance) {\n const { props, ptmi, gallery } = instance;\n\n const rootProps = mergeProps(\n {\n className: gallery?.cx('thumbnailContent')\n },\n ptmi('root')\n );\n\n return <Component as={Carousel.Content} instance={instance} attrs={rootProps} children={props.children} />;\n }\n});\n","import { GalleryThumbnailContentProps } from '@primereact/types/shared/gallery';\n\nexport const defaultThumbnailContentProps: GalleryThumbnailContentProps = {};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport { Carousel } from 'primereact/carousel';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { defaultThumbnailItemProps } from './GalleryThumbnailItem.props';\n\nexport const GalleryThumbnailItem = withComponent({\n name: 'GalleryThumbnailItem',\n defaultProps: defaultThumbnailItemProps,\n setup() {\n const gallery = useGalleryContext();\n\n return { gallery };\n },\n render(instance) {\n const { props, ptmi, gallery } = instance;\n\n const rootProps = mergeProps(\n {\n className: gallery?.cx('thumbnailItem')\n },\n ptmi('root')\n );\n\n return <Component as={Carousel.Item} instance={instance} attrs={rootProps} children={props.children} />;\n }\n});\n","import { GalleryThumbnailItemProps } from '@primereact/types/shared/gallery';\n\nexport const defaultThumbnailItemProps: GalleryThumbnailItemProps = {};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { defaultToolbarProps } from './GalleryToolbar.props';\n\nexport const GalleryToolbar = withComponent({\n name: 'GalleryToolbar',\n defaultProps: defaultToolbarProps,\n setup() {\n const gallery = useGalleryContext();\n\n return { gallery };\n },\n render(instance) {\n const { props, ptmi, gallery } = instance;\n\n const rootProps = mergeProps(\n {\n className: gallery?.cx('toolbar')\n },\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} ref={gallery?.toolbarRef} />;\n }\n});\n","import { GalleryToolbarProps } from '@primereact/types/shared/gallery';\n\nexport const defaultToolbarProps: GalleryToolbarProps = {\n as: 'div'\n};\n","'use client';\nimport { Component } from '@primereact/core/component';\nimport { mergeProps } from '@primeuix/utils';\nimport { withComponent } from 'primereact/base';\nimport * as React from 'react';\nimport { useGalleryContext } from '../Gallery.context';\nimport { defaultToolbarItemProps } from './GalleryToolbarItem.props';\n\nexport const GalleryToolbarItem = withComponent({\n name: 'GalleryToolbarItem',\n defaultProps: defaultToolbarItemProps,\n setup() {\n const gallery = useGalleryContext();\n\n return { gallery };\n },\n render(instance) {\n const { props, ptmi, gallery } = instance;\n\n const rootProps = mergeProps(\n {\n className: gallery?.cx('toolbarItem'),\n onClick: () => {\n gallery?.handleClickAction(props?.action);\n props?.onClick?.();\n }\n },\n ptmi('root')\n );\n\n return <Component instance={instance} attrs={rootProps} children={props.children} />;\n }\n});\n","import { GalleryToolbarItemProps } from '@primereact/types/shared/gallery';\n\nexport const defaultToolbarItemProps: GalleryToolbarItemProps = {\n as: 'div',\n action: undefined,\n onClick: undefined\n};\n","import type { useGalleryItemProps } from '@primereact/types/shared/gallery';\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B,EACA,kBAAAV,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","Component","useGallery","styles","mergeProps","withComponentInCore","baseStyles","withComponent","name","defaultProps","styles","__spreadProps","__spreadValues","baseStyles","components","setup","render","withComponentInCore","React","createOptionalContext","GalleryProvider","useGalleryContext","HeadlessGallery","defaultProps","__spreadProps","__spreadValues","Component","mergeProps","React","defaultCloseProps","GalleryBackdrop","withComponent","defaultCloseProps","useGalleryContext","instance","props","ptmi","gallery","rootProps","mergeProps","Component","Component","mergeProps","React","defaultContentProps","GalleryContent","withComponent","defaultContentProps","useGalleryContext","instance","props","ptmi","gallery","rootProps","mergeProps","Component","Component","useGalleryItem","mergeProps","React","createOptionalContext","GalleryItemProvider","useGalleryItemContext","HeadlessGallery","defaultProps","__spreadProps","__spreadValues","GalleryItem","withComponent","defaultProps","instance","gallery","useGalleryContext","galleryItem","useGalleryItem","__spreadProps","__spreadValues","id","props","ptmi","handleClick","handlePointerDown","handlePointerMove","handlePointerUp","handleDragStart","CSSVariables","attributes","rootProps","mergeProps","GalleryItemProvider","Component","Component","mergeProps","React","defaultNextProps","GalleryNext","withComponent","defaultNextProps","useGalleryContext","instance","_a","props","ptmi","gallery","rootProps","mergeProps","Component","Component","mergeProps","React","defaultPrevProps","GalleryPrev","withComponent","defaultPrevProps","useGalleryContext","instance","_a","props","ptmi","gallery","rootProps","mergeProps","Component","Component","mergeProps","Component","useCarousel","styles","mergeProps","React","createOptionalContext","CarouselProvider","useCarouselContext","HeadlessCarousel","defaultProps","__spreadProps","__spreadValues","Component","mergeProps","React","defaultContentProps","CarouselContent","withComponent","defaultContentProps","useCarouselContext","instance","props","ptmi","carousel","contentProps","mergeProps","viewportProps","__spreadValues","Component","Component","mergeProps","React","defaultIndicatorProps","CarouselIndicator","withComponent","defaultIndicatorProps","useCarouselContext","instance","_a","props","ptmi","carousel","contentProps","mergeProps","Component","Component","mergeProps","React","defaultIndicatorsProps","CarouselIndicators","withComponent","defaultIndicatorsProps","useCarouselContext","instance","_a","_b","props","ptmi","carousel","contentProps","mergeProps","Component","snap","i","CarouselIndicator","Component","mergeProps","React","defaultItemProps","CarouselItem","withComponent","defaultItemProps","useCarouselContext","instance","props","ptmi","carousel","rootProps","mergeProps","Component","Component","mergeProps","React","defaultNextProps","CarouselNext","withComponent","defaultNextProps","useCarouselContext","instance","props","ptmi","carousel","disabled","rootProps","mergeProps","Component","Component","mergeProps","React","defaultPrevProps","CarouselPrev","withComponent","defaultPrevProps","useCarouselContext","instance","props","ptmi","carousel","disabled","rootProps","mergeProps","Component","Carousel","withComponent","defaultProps","styles","instance","useCarousel","id","props","ptmi","cx","rootProps","mergeProps","CarouselProvider","Component","CarouselContent","CarouselItem","CarouselNext","CarouselPrev","CarouselIndicators","CarouselIndicator","React","defaultThumbnailProps","GalleryThumbnail","withComponent","defaultThumbnailProps","useGalleryContext","instance","props","ptmi","gallery","rootProps","mergeProps","Component","Carousel","Component","mergeProps","React","defaultThumbnailContentProps","GalleryThumbnailContent","withComponent","defaultThumbnailContentProps","useGalleryContext","instance","props","ptmi","gallery","rootProps","mergeProps","Component","Carousel","Component","mergeProps","React","defaultThumbnailItemProps","GalleryThumbnailItem","withComponent","defaultThumbnailItemProps","useGalleryContext","instance","props","ptmi","gallery","rootProps","mergeProps","Component","Carousel","Component","mergeProps","React","defaultToolbarProps","GalleryToolbar","withComponent","defaultToolbarProps","useGalleryContext","instance","props","ptmi","gallery","rootProps","mergeProps","Component","Component","mergeProps","React","defaultToolbarItemProps","GalleryToolbarItem","withComponent","defaultToolbarItemProps","useGalleryContext","instance","props","ptmi","gallery","rootProps","mergeProps","_a","Component","Gallery","withComponent","defaultProps","styles","instance","useGallery","id","props","ptmi","cx","rootProps","mergeProps","GalleryProvider","Component","GalleryBackdrop","GalleryContent","GalleryItem","GalleryNext","GalleryPrev","GalleryToolbar","GalleryToolbarItem","GalleryThumbnail","GalleryThumbnailContent","GalleryThumbnailItem","React","defaultItemProps","useGalleryItem","withHeadless","defaultItemProps","props","elementRef","normalScale","zoomedScale","gallery","useGalleryContext","index","setIndex","isActive","setIsActive","position","setPosition","scale","setScale","rotation","setRotation","flip","setFlip","isDragging","setIsDragging","dragStart","setDragStart","hasDragged","setHasDragged","pointerDataRef","lastDistanceRef","calculateItemSize","contentRect","imageElement","naturalWidth","naturalHeight","isRotated","naturalAspectRatio","contentAspectRatio","targetWidth","targetHeight","calculateConstraints","targetScale","scaleToUse","itemElement","originalWidth","originalHeight","scaledWidth","scaledHeight","contentCenterX","contentCenterY","halfScaledWidth","halfScaledHeight","maxX","minX","maxY","minY","zoomIn","hiddenStyles","zoomOut","resetStyles","rotateLeft","prev","rotateRight","flipX","__spreadProps","__spreadValues","flipY","download","link","urlParts","filename","handleClick","e","itemRect","itemCenterX","itemCenterY","clickX","clickY","offsetX","offsetY","zoomOffsetX","zoomOffsetY","constraints","constrainedX","constrainedY","handleDragStart","handlePointerDown","handlePointerMove","pointers","p1","p2","distance","delta","newScale","pointer","newX","newY","computedX","computedY","handlePointerUp","handleResize","handleCustomEvent","_a","_b","_c","_d","_e","_f","_g","attributes","CSSVariables"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const useGalleryItem: (inProps?: unknown) => import("@primereact/types/core").HeadlessInstance<import("@primereact/types/shared/gallery").useGalleryItemProps, unknown, {
|
|
3
|
+
state: {
|
|
4
|
+
index: number;
|
|
5
|
+
position: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
scale: number;
|
|
10
|
+
rotation: number;
|
|
11
|
+
flip: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
isActive: boolean;
|
|
16
|
+
dragStart: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
hasDragged: boolean;
|
|
21
|
+
};
|
|
22
|
+
attributes: {
|
|
23
|
+
'data-active': boolean;
|
|
24
|
+
};
|
|
25
|
+
CSSVariables: React.CSSProperties;
|
|
26
|
+
handlePointerUp: (e: React.PointerEvent) => void;
|
|
27
|
+
handlePointerMove: (e: React.PointerEvent) => void;
|
|
28
|
+
handlePointerDown: (e: React.PointerEvent) => void;
|
|
29
|
+
handleClick: (e: React.MouseEvent) => void;
|
|
30
|
+
handleDragStart: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
31
|
+
zoomIn: () => void;
|
|
32
|
+
zoomOut: () => void;
|
|
33
|
+
rotateLeft: () => void;
|
|
34
|
+
rotateRight: () => void;
|
|
35
|
+
flipX: () => void;
|
|
36
|
+
flipY: () => void;
|
|
37
|
+
download: () => void;
|
|
38
|
+
calculateConstraints: (targetScale?: number) => {
|
|
39
|
+
minX: number;
|
|
40
|
+
maxX: number;
|
|
41
|
+
minY: number;
|
|
42
|
+
maxY: number;
|
|
43
|
+
};
|
|
44
|
+
calculateItemSize: () => void;
|
|
45
|
+
}>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CarouselInstance } from '@primereact/types/shared/carousel';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export declare const useGallery: (inProps?: unknown) => import("@primereact/types/core").HeadlessInstance<import("@primereact/types/shared/gallery").useGalleryProps, unknown, {
|
|
4
|
+
state: {
|
|
5
|
+
isFullscreen: boolean;
|
|
6
|
+
activeIndex: number;
|
|
7
|
+
};
|
|
8
|
+
registerItem: (ref: HTMLDivElement | null) => number;
|
|
9
|
+
handleNext: () => void;
|
|
10
|
+
handlePrev: () => void;
|
|
11
|
+
createCustomEvent: (action: string) => () => void;
|
|
12
|
+
toggleFullScreen: () => void;
|
|
13
|
+
handleClickAction: (action?: string) => void;
|
|
14
|
+
actions: {
|
|
15
|
+
zoomIn: () => void;
|
|
16
|
+
zoomOut: () => void;
|
|
17
|
+
rotateLeft: () => void;
|
|
18
|
+
rotateRight: () => void;
|
|
19
|
+
flipX: () => void;
|
|
20
|
+
flipY: () => void;
|
|
21
|
+
download: () => void;
|
|
22
|
+
next: () => void;
|
|
23
|
+
prev: () => void;
|
|
24
|
+
toggleFullScreen: () => void;
|
|
25
|
+
};
|
|
26
|
+
contentRef: React.RefObject<HTMLDivElement | null>;
|
|
27
|
+
toolbarRef: React.RefObject<HTMLDivElement | null>;
|
|
28
|
+
thumbnailRef: React.RefObject<CarouselInstance | null>;
|
|
29
|
+
prevRef: React.RefObject<HTMLButtonElement | null>;
|
|
30
|
+
nextRef: React.RefObject<HTMLButtonElement | null>;
|
|
31
|
+
}>;
|
|
File without changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{withHeadless as Be}from"@primereact/core/headless";import{useControlledState as ze}from"@primereact/hooks/use-controlled-state";import{equals as Je,findLastIndex as C,findSingle as We,focus as U,getFirstFocusableElement as se,isElement as _e,isNotEmpty as q,isPrintableCharacter as je,isString as ie,resolveFieldData as x}from"@primeuix/utils";import*as s from"react";var ue={value:void 0,defaultValue:void 0,options:[],optionKey:void 0,optionLabel:void 0,optionValue:void 0,optionDisabled:void 0,optionGroupLabel:void 0,optionGroupChildren:void 0,disabled:!1,locale:void 0,multiple:!1,metaKeySelection:!1,autoOptionFocus:!0,selectOnFocus:!1,focusOnHover:!0,onValueChange:void 0};var nn=Be({name:"useListbox",defaultProps:ue,setup({id:le,props:o,elementRef:p}){var ae;let[P,$]=s.useState(!1),[a,d]=s.useState(-1),[i,de]=ze({value:o.value,defaultValue:(ae=o.defaultValue)!=null?ae:null,onChange:o.onValueChange}),fe={value:i,focused:P,focusedOptionIndex:a},L=s.useRef(null),b=s.useRef(null),k=s.useRef(null),F=s.useRef(!1),y=s.useRef(-1),K=s.useRef(null),O=s.useRef(""),c=()=>$e||[],v=e=>`${le}_${e}`,B=e=>o.optionLabel?x(e,o.optionLabel):ie(e)?e:null,l=e=>o.optionValue?x(e,o.optionValue):e,G=e=>o.optionDisabled?x(e,o.optionDisabled):!1,M=e=>!!(o.optionGroupLabel&&(e!=null&&e.optionGroup)&&(e!=null&&e.group)),me=e=>o.optionGroupLabel?x(e,o.optionGroupLabel):ie(e)?e:null,z=e=>o.optionGroupChildren?x(e,o.optionGroupChildren):null,J=()=>a!==-1?v(a):null,be=()=>c().filter(e=>!M(e)).length,ye=e=>(o.optionGroupLabel?e-(c().slice(0,e).filter(t=>M(t)).length||0):e)+1,he=()=>{U(L.current);let e=se(p.current,':not([data-p-hidden-focusable="true"])');k.current&&(k.current.tabIndex=_e(e)?0:-1),b.current&&(b.current.tabIndex=-1)},we=e=>{if(e.relatedTarget===L.current){let n=se(p.current,':not([data-p-hidden-focusable="true"])');n instanceof HTMLElement&&U(n),b.current&&(b.current.tabIndex=0)}else U(b.current);k.current&&(k.current.tabIndex=-1)},ke=e=>{!(p.current instanceof HTMLElement&&p.current.contains(e.relatedTarget))&&k.current&&b.current&&(k.current.tabIndex=0,b.current.tabIndex=0)},Ke=()=>{let e=a!==-1?a:o.autoOptionFocus?H():Ce();$(!0),d(e),N(),g(e)},Re=()=>{$(!1),d(-1),y.current=-1,O.current=""},Oe=e=>{let t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":W(e);break;case"ArrowUp":_(e);break;case"Home":j(e);break;case"End":Q(e);break;case"PageDown":De(e);break;case"PageUp":Ae(e);break;case"Enter":case"NumpadEnter":case"Space":Te(e);break;case"Tab":break;case"ShiftLeft":case"ShiftRight":Y();break;default:if(o.multiple&&e.code==="KeyA"&&t){let n=c().filter(r=>f(r)).map(r=>l(r));E(e,n),e.preventDefault();break}!t&&je(e.key)&&(Ne(e,e.key),e.preventDefault());break}},A=(e,t,n=-1)=>{o.disabled||G(t)||(o.multiple?xe(e,t):Se(e,t),F.current=!1,n!==-1&&d(n))},Ie=(e,t)=>{h(e,t)},ge=(e,t)=>{o.focusOnHover&&P&&h(e,t)},Ee=()=>{o.disabled||(F.current=!0)},Se=(e,t)=>{let n=V(t),r=F.current?!1:o.metaKeySelection,u=!1,m=null;if(r){let S=e&&(e.metaKey||e.ctrlKey);n?S&&(m=null,u=!0):(m=l(t),u=!0)}else m=n?null:l(t),u=!0;u&&E(e,m)},xe=(e,t)=>{let n=V(t),r=F.current?!1:o.metaKeySelection,u=null;if(r){let m=e.metaKey||e.ctrlKey;n?u=m?re(t):[l(t)]:(u=m?Array.isArray(i)?i:[]:[],u=[...u,l(t)])}else u=n?re(t):[...Array.isArray(i)?i:[],l(t)];E(e,u)},I=(e,t=-1,n=-1)=>{if(t=t===-1?oe(n,!0):t,n=n===-1?oe(t):n,t!==-1&&n!==-1){let r=Math.min(t,n),u=Math.max(t,n),m=c().slice(r,u+1).filter(S=>f(S)).map(S=>l(S));E(e,m)}},pe=()=>{d(-1),y.current=-1},Le=()=>{d(-1),y.current=-1},Fe=e=>{switch(e.code){case"ArrowDown":W(e);break;case"ArrowUp":_(e);break;case"ArrowLeft":case"ArrowRight":Me(e,!0);break;case"Home":j(e,!0);break;case"End":Q(e,!0);break;case"Enter":case"NumpadEnter":X(e);break;case"ShiftLeft":case"ShiftRight":Y();break;default:break}},W=e=>{let t=a!==-1?Ve(a):H();o.multiple&&e.shiftKey&&I(e,y.current,t),h(e,t),e.preventDefault()},_=e=>{let t=a!==-1?He(a):Ge();o.multiple&&e.shiftKey&&I(e,t,y.current),h(e,t),e.preventDefault()},Me=(e,t=!1)=>{t&&d(-1)},j=(e,t=!1)=>{if(t){let n=e.currentTarget;e.shiftKey?n==null||n.setSelectionRange(0,n.selectionStart):(n==null||n.setSelectionRange(0,0),d(-1))}else{let n=e.metaKey||e.ctrlKey,r=Z();o.multiple&&e.shiftKey&&n&&I(e,r,y.current),h(e,r)}e.preventDefault()},Q=(e,t=!1)=>{if(t){let n=e.currentTarget,r=n.value.length;e.shiftKey?n.setSelectionRange(n.selectionStart,r):(n.setSelectionRange(r,r),d(-1))}else{let n=e.metaKey||e.ctrlKey,r=ee();o.multiple&&e.shiftKey&&n&&I(e,y.current,r),h(e,r)}e.preventDefault()},Ae=e=>{g(0),e.preventDefault()},De=e=>{g(c().length-1),e.preventDefault()},X=e=>{a!==-1&&(o.multiple&&e.shiftKey?I(e,a):A(e,c()[a]))},Te=e=>{e.preventDefault(),X(e)},Y=()=>{y.current=a},D=e=>{var t,n;return f(e)&&((n=B(e))==null?void 0:n.toLocaleLowerCase(o.locale).startsWith((t=O.current)==null?void 0:t.toLocaleLowerCase(o.locale)))},f=e=>q(e)&&!G(e)&&!M(e),R=e=>f(e)&&V(e),T=(e,t)=>Je(e,t,ce),V=e=>{let t=l(e);return o.multiple?Array.isArray(i)&&i.some(n=>T(n,t)):T(i,t)},Z=()=>c().findIndex(e=>f(e)),ee=()=>C(c(),e=>f(e)),Ve=e=>{let t=e<c().length-1?c().slice(e+1).findIndex(n=>f(n)):-1;return t>-1?t+e+1:e},He=e=>{let t=e>0?C(c().slice(0,e),n=>f(n)):-1;return t>-1?t:e},Ce=()=>{if(w())if(o.multiple&&Array.isArray(i))for(let e=i.length-1;e>=0;e--){let t=i[e],n=c().findIndex(r=>R(r)&&T(t,l(r)));if(n>-1)return n}else return c().findIndex(e=>R(e));return-1},Pe=()=>w()?c().findIndex(e=>R(e)):-1,ve=()=>w()?C(c(),e=>R(e)):-1,ne=e=>{let t=w()&&e<c().length-1?c().slice(e+1).findIndex(n=>R(n)):-1;return t>-1?t+e+1:-1},te=e=>{let t=w()&&e>0?C(c().slice(0,e),n=>R(n)):-1;return t>-1?t:-1},oe=(e,t=!1)=>{let n=-1;return w()&&(t?(n=te(e),n=n===-1?ne(e):n):(n=ne(e),n=n===-1?te(e):n)),n>-1?n:e},H=()=>{let e=Pe();return e<0?Z():e},Ge=()=>{let e=ve();return e<0?ee():e},Ne=(e,t)=>{var r;O.current=(O.current||"")+t;let n=-1;q(O.current)&&(a!==-1?(n=c().slice(a).findIndex(u=>D(u)),n=n===-1?c().slice(0,a).findIndex(u=>D(u)):n+a):n=c().findIndex(u=>D(u)),n===-1&&a===-1&&(n=(r=H())!=null?r:-1),n!==-1&&h(e,n)),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{O.current="",K.current=null},500)},re=e=>Array.isArray(i)?i.filter(t=>!T(t,l(e))):[],h=(e,t=-1)=>{a!==t&&(d(t),g(),o.selectOnFocus&&!o.multiple&&A(e,c()[t]))},Ue=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(e)})}),g=(e=-1)=>{Ue().then(()=>{var r;let t=e!==-1?v(e):J(),n=We(L.current,`[id="${t}"]`);(r=n==null?void 0:n.scrollIntoView)==null||r.call(n,{block:"nearest",inline:"nearest",behavior:"smooth"})})},N=()=>{if(o.selectOnFocus&&o.autoOptionFocus&&!w()&&!o.multiple&&P){let e=H();d(e),A(null,c()[e])}},E=(e,t)=>{de([t,{originalEvent:e,value:t}])},w=()=>q(i);s.useEffect(()=>(N(),()=>{K.current&&(clearTimeout(K.current),K.current=null)}),[]);let qe=s.useMemo(()=>{let e=[];return(o.options||[]).forEach(t=>{let n=z(t)||[];n!=null&&n.length&&e.push({optionGroup:t,group:!0},...n)}),e},[o.options]),$e=o.optionGroupLabel?qe:o.options,ce=o.optionValue?void 0:o.optionKey;return{state:fe,listRef:L,firstHiddenFocusableRef:b,lastHiddenFocusableRef:k,getOptions:c,getOptionId:v,getOptionLabel:B,getOptionValue:l,isOptionDisabled:G,isOptionGroup:M,getOptionGroupLabel:me,getOptionGroupChildren:z,getFocusedOptionId:J,getAriaSetSize:be,getAriaPosInset:ye,onFirstHiddenFocus:he,onLastHiddenFocus:we,onFocusOut:ke,onListFocus:Ke,onListBlur:Re,onListKeyDown:Oe,onOptionSelect:A,onOptionMouseDown:Ie,onOptionMouseMove:ge,onOptionTouchEnd:Ee,onFilterChange:pe,onFilterBlur:Le,onFilterKeyDown:Fe,isOptionMatched:D,isValidOption:f,isValidSelectedOption:R,isSelected:V,changeFocusedOptionIndex:h,scrollInView:g,updateModel:E,autoUpdateModel:N,equalityKey:ce,hasValue:w}}});export{ue as defaultProps,nn as useListbox};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/listbox/useListbox.ts","../../src/listbox/useListbox.props.ts"],"sourcesContent":["import { withHeadless } from '@primereact/core/headless';\nimport { useControlledState } from '@primereact/hooks/use-controlled-state';\nimport { equals, findLastIndex, findSingle, focus, getFirstFocusableElement, isElement, isNotEmpty, isPrintableCharacter, isString, resolveFieldData } from '@primeuix/utils';\nimport * as React from 'react';\nimport { defaultProps } from './useListbox.props';\n\nexport const useListbox = withHeadless({\n name: 'useListbox',\n defaultProps,\n setup({ id, props, elementRef }) {\n const [focusedState, setFocusedState] = React.useState<boolean>(false);\n const [focusedOptionIndexState, setFocusedOptionIndexState] = React.useState<number>(-1);\n const [valueState, setValueState] = useControlledState({\n value: props.value,\n defaultValue: props.defaultValue ?? null,\n onChange: props.onValueChange\n });\n\n const state = {\n value: valueState,\n focused: focusedState,\n focusedOptionIndex: focusedOptionIndexState\n };\n\n // element refs\n const listRef = React.useRef<HTMLElement>(null);\n const firstHiddenFocusableRef = React.useRef<HTMLElement>(null);\n const lastHiddenFocusableRef = React.useRef<HTMLElement>(null);\n\n // refs\n const optionTouched = React.useRef<boolean>(false);\n const startRangeIndex = React.useRef<number>(-1);\n const searchTimeout = React.useRef<NodeJS.Timeout | null>(null);\n const searchValue = React.useRef<string>('');\n\n const getOptions = () => {\n return visibleOptions || [];\n };\n\n const getOptionId = (index: number) => {\n return `${id}_${index}`;\n };\n\n const getOptionLabel = (option: unknown) => {\n return props.optionLabel ? resolveFieldData(option, props.optionLabel) : isString(option) ? option : null;\n };\n\n const getOptionValue = (option: unknown) => {\n return props.optionValue ? resolveFieldData(option, props.optionValue) : option;\n };\n\n const isOptionDisabled = (option: unknown) => {\n return props.optionDisabled ? resolveFieldData(option, props.optionDisabled) : false;\n };\n\n const isOptionGroup = (option: unknown) => {\n return !!(props.optionGroupLabel && (option as Record<string, unknown>)?.optionGroup && (option as Record<string, unknown>)?.group);\n };\n\n const getOptionGroupLabel = (optionGroup: unknown) => {\n return props.optionGroupLabel ? resolveFieldData(optionGroup, props.optionGroupLabel) : isString(optionGroup) ? optionGroup : null;\n };\n\n const getOptionGroupChildren = (optionGroup: unknown) => {\n return props.optionGroupChildren ? resolveFieldData(optionGroup, props.optionGroupChildren) : null;\n };\n\n const getFocusedOptionId = () => {\n return focusedOptionIndexState !== -1 ? getOptionId(focusedOptionIndexState!) : null;\n };\n\n const getAriaSetSize = () => {\n return getOptions().filter((option: unknown) => !isOptionGroup(option)).length;\n };\n\n const getAriaPosInset = (index: number) => {\n return (\n (props.optionGroupLabel\n ? index -\n (getOptions()\n .slice(0, index)\n .filter((option: unknown) => isOptionGroup(option)).length || 0)\n : index) + 1\n );\n };\n\n const onFirstHiddenFocus = () => {\n focus(listRef.current!);\n\n const firstFocusableEl = getFirstFocusableElement(elementRef.current!, ':not([data-p-hidden-focusable=\"true\"])');\n\n if (lastHiddenFocusableRef.current) {\n lastHiddenFocusableRef.current.tabIndex = isElement(firstFocusableEl) ? 0 : -1;\n }\n\n if (firstHiddenFocusableRef.current) {\n firstHiddenFocusableRef.current.tabIndex = -1;\n }\n };\n\n const onLastHiddenFocus = (event: React.FocusEvent) => {\n const relatedTarget = event.relatedTarget;\n\n if (relatedTarget === listRef.current) {\n const firstFocusableEl = getFirstFocusableElement(elementRef.current!, ':not([data-p-hidden-focusable=\"true\"])');\n\n if (firstFocusableEl instanceof HTMLElement) {\n focus(firstFocusableEl);\n }\n\n if (firstHiddenFocusableRef.current) {\n firstHiddenFocusableRef.current.tabIndex = 0;\n }\n } else {\n focus(firstHiddenFocusableRef.current!);\n }\n\n if (lastHiddenFocusableRef.current) {\n lastHiddenFocusableRef.current.tabIndex = -1;\n }\n };\n\n const onFocusOut = (event: React.FocusEvent) => {\n const elementContains = elementRef.current instanceof HTMLElement && elementRef.current.contains(event.relatedTarget as Node);\n\n if (!elementContains && lastHiddenFocusableRef.current && firstHiddenFocusableRef.current) {\n lastHiddenFocusableRef.current.tabIndex = 0;\n firstHiddenFocusableRef.current.tabIndex = 0;\n }\n };\n\n const onListFocus = () => {\n const focusedOptionIndex = focusedOptionIndexState !== -1 ? focusedOptionIndexState : props.autoOptionFocus ? findFirstFocusedOptionIndex() : findSelectedOptionIndex();\n\n setFocusedState(true);\n setFocusedOptionIndexState(focusedOptionIndex);\n\n autoUpdateModel();\n scrollInView(focusedOptionIndex);\n };\n\n const onListBlur = () => {\n setFocusedState(false);\n setFocusedOptionIndexState(-1);\n\n startRangeIndex.current = -1;\n searchValue.current = '';\n };\n\n const onListKeyDown = (event: React.KeyboardEvent) => {\n const metaKey = event.metaKey || event.ctrlKey;\n\n switch (event.code) {\n case 'ArrowDown':\n onArrowDownKey(event);\n break;\n\n case 'ArrowUp':\n onArrowUpKey(event);\n break;\n\n case 'Home':\n onHomeKey(event);\n break;\n\n case 'End':\n onEndKey(event);\n break;\n\n case 'PageDown':\n onPageDownKey(event);\n break;\n\n case 'PageUp':\n onPageUpKey(event);\n break;\n\n case 'Enter':\n case 'NumpadEnter':\n case 'Space':\n onSpaceKey(event);\n break;\n\n case 'Tab':\n //NOOP\n break;\n\n case 'ShiftLeft':\n case 'ShiftRight':\n onShiftKey();\n break;\n\n default:\n if (props.multiple && event.code === 'KeyA' && metaKey) {\n const value = getOptions()\n .filter((option: unknown) => isValidOption(option))\n .map((option: unknown) => getOptionValue(option));\n\n updateModel(event, value);\n\n event.preventDefault();\n break;\n }\n\n if (!metaKey && isPrintableCharacter(event.key)) {\n searchOptions(event, event.key);\n event.preventDefault();\n }\n\n break;\n }\n };\n\n const onOptionSelect = (event: React.MouseEvent | React.KeyboardEvent, option: unknown, index = -1) => {\n if (props.disabled || isOptionDisabled(option)) {\n return;\n }\n\n if (props.multiple) {\n onOptionSelectMultiple(event, option);\n } else {\n onOptionSelectSingle(event, option);\n }\n\n optionTouched.current = false;\n\n if (index !== -1) {\n setFocusedOptionIndexState(index);\n }\n };\n\n const onOptionMouseDown = (event: React.MouseEvent, index: number) => {\n changeFocusedOptionIndex(event, index);\n };\n\n const onOptionMouseMove = (event: React.MouseEvent, index: number) => {\n if (props.focusOnHover && focusedState) {\n changeFocusedOptionIndex(event, index);\n }\n };\n\n const onOptionTouchEnd = () => {\n if (props.disabled) {\n return;\n }\n\n optionTouched.current = true;\n };\n\n const onOptionSelectSingle = (event: React.MouseEvent | React.KeyboardEvent, option: unknown) => {\n const selected = isSelected(option);\n const metaSelection = optionTouched.current ? false : props.metaKeySelection;\n let valueChanged = false;\n let value = null;\n\n if (metaSelection) {\n const metaKey = event && (event.metaKey || event.ctrlKey);\n\n if (selected) {\n if (metaKey) {\n value = null;\n valueChanged = true;\n }\n } else {\n value = getOptionValue(option);\n valueChanged = true;\n }\n } else {\n value = selected ? null : getOptionValue(option);\n valueChanged = true;\n }\n\n if (valueChanged) {\n updateModel(event, value);\n }\n };\n\n const onOptionSelectMultiple = (event: React.MouseEvent | React.KeyboardEvent, option: unknown) => {\n const selected = isSelected(option);\n const metaSelection = optionTouched.current ? false : props.metaKeySelection;\n let value = null;\n\n if (metaSelection) {\n const metaKey = event.metaKey || event.ctrlKey;\n\n if (selected) {\n value = metaKey ? removeOption(option) : [getOptionValue(option)];\n } else {\n value = metaKey ? (Array.isArray(valueState) ? valueState : []) : [];\n value = [...value, getOptionValue(option)];\n }\n } else {\n value = selected ? removeOption(option) : [...(Array.isArray(valueState) ? valueState : []), getOptionValue(option)];\n }\n\n updateModel(event, value);\n };\n\n const onOptionSelectRange = (event: React.MouseEvent | React.KeyboardEvent, start = -1, end = -1) => {\n start = start === -1 ? findNearestSelectedOptionIndex(end, true) : start;\n end = end === -1 ? findNearestSelectedOptionIndex(start) : end;\n\n if (start !== -1 && end !== -1) {\n const rangeStart = Math.min(start, end);\n const rangeEnd = Math.max(start, end);\n const value = getOptions()\n .slice(rangeStart, rangeEnd + 1)\n .filter((option: unknown) => isValidOption(option))\n .map((option: unknown) => getOptionValue(option));\n\n updateModel(event, value);\n }\n };\n\n const onFilterChange = () => {\n setFocusedOptionIndexState(-1);\n startRangeIndex.current = -1;\n };\n\n const onFilterBlur = () => {\n setFocusedOptionIndexState(-1);\n startRangeIndex.current = -1;\n };\n\n const onFilterKeyDown = (event: React.KeyboardEvent) => {\n switch (event.code) {\n case 'ArrowDown':\n onArrowDownKey(event);\n break;\n\n case 'ArrowUp':\n onArrowUpKey(event);\n break;\n\n case 'ArrowLeft':\n case 'ArrowRight':\n onArrowLeftKey(event, true);\n break;\n\n case 'Home':\n onHomeKey(event, true);\n break;\n\n case 'End':\n onEndKey(event, true);\n break;\n\n case 'Enter':\n case 'NumpadEnter':\n onEnterKey(event);\n break;\n\n case 'ShiftLeft':\n case 'ShiftRight':\n onShiftKey();\n break;\n\n default:\n break;\n }\n };\n\n const onArrowDownKey = (event: React.KeyboardEvent) => {\n const optionIndex = focusedOptionIndexState !== -1 ? findNextOptionIndex(focusedOptionIndexState) : findFirstFocusedOptionIndex();\n\n if (props.multiple && event.shiftKey) {\n onOptionSelectRange(event, startRangeIndex.current, optionIndex);\n }\n\n changeFocusedOptionIndex(event, optionIndex);\n event.preventDefault();\n };\n\n const onArrowUpKey = (event: React.KeyboardEvent) => {\n const optionIndex = focusedOptionIndexState !== -1 ? findPrevOptionIndex(focusedOptionIndexState) : findLastFocusedOptionIndex();\n\n if (props.multiple && event.shiftKey) {\n onOptionSelectRange(event, optionIndex, startRangeIndex.current);\n }\n\n changeFocusedOptionIndex(event, optionIndex);\n event.preventDefault();\n };\n\n const onArrowLeftKey = (event: React.KeyboardEvent, pressedInInputText = false) => {\n if (pressedInInputText) {\n setFocusedOptionIndexState(-1);\n }\n };\n\n const onHomeKey = (event: React.KeyboardEvent, pressedInInputText = false) => {\n if (pressedInInputText) {\n const target = event.currentTarget as HTMLInputElement;\n\n if (event.shiftKey) {\n target?.setSelectionRange(0, target.selectionStart);\n } else {\n target?.setSelectionRange(0, 0);\n setFocusedOptionIndexState(-1);\n }\n } else {\n const metaKey = event.metaKey || event.ctrlKey;\n const optionIndex = findFirstOptionIndex();\n\n if (props.multiple && event.shiftKey && metaKey) {\n onOptionSelectRange(event, optionIndex, startRangeIndex.current);\n }\n\n changeFocusedOptionIndex(event, optionIndex);\n }\n\n event.preventDefault();\n };\n\n const onEndKey = (event: React.KeyboardEvent, pressedInInputText = false) => {\n if (pressedInInputText) {\n const target = event.currentTarget as HTMLInputElement;\n const length = target.value.length;\n\n if (event.shiftKey) {\n target.setSelectionRange(target.selectionStart, length);\n } else {\n target.setSelectionRange(length, length);\n setFocusedOptionIndexState(-1);\n }\n } else {\n const metaKey = event.metaKey || event.ctrlKey;\n const optionIndex = findLastOptionIndex();\n\n if (props.multiple && event.shiftKey && metaKey) {\n onOptionSelectRange(event, startRangeIndex.current, optionIndex);\n }\n\n changeFocusedOptionIndex(event, optionIndex);\n }\n\n event.preventDefault();\n };\n\n const onPageUpKey = (event: React.KeyboardEvent) => {\n scrollInView(0);\n event.preventDefault();\n };\n\n const onPageDownKey = (event: React.KeyboardEvent) => {\n scrollInView(getOptions().length - 1);\n event.preventDefault();\n };\n\n const onEnterKey = (event: React.KeyboardEvent) => {\n if (focusedOptionIndexState !== -1) {\n if (props.multiple && event.shiftKey) onOptionSelectRange(event, focusedOptionIndexState);\n else onOptionSelect(event, getOptions()[focusedOptionIndexState!]);\n }\n };\n\n const onSpaceKey = (event: React.KeyboardEvent) => {\n event.preventDefault();\n onEnterKey(event);\n };\n\n const onShiftKey = () => {\n startRangeIndex.current = focusedOptionIndexState!;\n };\n\n const isOptionMatched = (option: unknown) => {\n return isValidOption(option) && getOptionLabel(option)?.toLocaleLowerCase(props.locale).startsWith(searchValue.current?.toLocaleLowerCase(props.locale));\n };\n\n const isValidOption = (option: unknown) => {\n return isNotEmpty(option) && !isOptionDisabled(option) && !isOptionGroup(option);\n };\n\n const isValidSelectedOption = (option: unknown) => {\n return isValidOption(option) && isSelected(option);\n };\n\n const isEquals = (value1: unknown, value2: unknown) => {\n return equals(value1, value2, equalityKey);\n };\n\n const isSelected = (option: unknown) => {\n const optionValue = getOptionValue(option);\n\n if (props.multiple) {\n return Array.isArray(valueState) && valueState.some((value: unknown) => isEquals(value, optionValue));\n } else {\n return isEquals(valueState, optionValue);\n }\n };\n\n const findFirstOptionIndex = () => {\n return getOptions().findIndex((option: unknown) => isValidOption(option));\n };\n\n const findLastOptionIndex = () => {\n return findLastIndex(getOptions(), (option: unknown) => isValidOption(option));\n };\n\n const findNextOptionIndex = (index: number) => {\n const matchedOptionIndex =\n index < getOptions().length - 1\n ? getOptions()\n .slice(index + 1)\n .findIndex((option: unknown) => isValidOption(option))\n : -1;\n\n return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;\n };\n\n const findPrevOptionIndex = (index: number) => {\n const matchedOptionIndex = index > 0 ? findLastIndex(getOptions().slice(0, index), (option) => isValidOption(option)) : -1;\n\n return matchedOptionIndex > -1 ? matchedOptionIndex : index;\n };\n\n const findSelectedOptionIndex = () => {\n if (hasValue()) {\n if (props.multiple && Array.isArray(valueState)) {\n for (let index = valueState.length - 1; index >= 0; index--) {\n const value = valueState[index];\n const matchedOptionIndex = getOptions().findIndex((option: unknown) => isValidSelectedOption(option) && isEquals(value, getOptionValue(option)));\n\n if (matchedOptionIndex > -1) return matchedOptionIndex;\n }\n } else {\n return getOptions().findIndex((option: unknown) => isValidSelectedOption(option));\n }\n }\n\n return -1;\n };\n\n const findFirstSelectedOptionIndex = () => {\n return hasValue() ? getOptions().findIndex((option) => isValidSelectedOption(option)) : -1;\n };\n\n const findLastSelectedOptionIndex = () => {\n return hasValue() ? findLastIndex(getOptions(), (option) => isValidSelectedOption(option)) : -1;\n };\n\n const findNextSelectedOptionIndex = (index: number) => {\n const matchedOptionIndex =\n hasValue() && index < getOptions().length - 1\n ? getOptions()\n .slice(index + 1)\n .findIndex((option) => isValidSelectedOption(option))\n : -1;\n\n return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : -1;\n };\n\n const findPrevSelectedOptionIndex = (index: number) => {\n const matchedOptionIndex = hasValue() && index > 0 ? findLastIndex(getOptions().slice(0, index), (option) => isValidSelectedOption(option)) : -1;\n\n return matchedOptionIndex > -1 ? matchedOptionIndex : -1;\n };\n\n const findNearestSelectedOptionIndex = (index: number, firstCheckUp = false) => {\n let matchedOptionIndex = -1;\n\n if (hasValue()) {\n if (firstCheckUp) {\n matchedOptionIndex = findPrevSelectedOptionIndex(index);\n matchedOptionIndex = matchedOptionIndex === -1 ? findNextSelectedOptionIndex(index) : matchedOptionIndex;\n } else {\n matchedOptionIndex = findNextSelectedOptionIndex(index);\n matchedOptionIndex = matchedOptionIndex === -1 ? findPrevSelectedOptionIndex(index) : matchedOptionIndex;\n }\n }\n\n return matchedOptionIndex > -1 ? matchedOptionIndex : index;\n };\n\n const findFirstFocusedOptionIndex = () => {\n const selectedIndex = findFirstSelectedOptionIndex();\n\n return selectedIndex < 0 ? findFirstOptionIndex() : selectedIndex;\n };\n\n const findLastFocusedOptionIndex = () => {\n const selectedIndex = findLastSelectedOptionIndex();\n\n return selectedIndex < 0 ? findLastOptionIndex() : selectedIndex;\n };\n\n const searchOptions = (event: React.KeyboardEvent, char: string) => {\n searchValue.current = (searchValue.current || '') + char;\n\n let optionIndex = -1;\n\n if (isNotEmpty(searchValue.current)) {\n if (focusedOptionIndexState !== -1) {\n optionIndex = getOptions()\n .slice(focusedOptionIndexState)\n .findIndex((option: unknown) => isOptionMatched(option));\n optionIndex =\n optionIndex === -1\n ? getOptions()\n .slice(0, focusedOptionIndexState)\n .findIndex((option: unknown) => isOptionMatched(option))\n : optionIndex + focusedOptionIndexState;\n } else {\n optionIndex = getOptions().findIndex((option: unknown) => isOptionMatched(option));\n }\n\n if (optionIndex === -1 && focusedOptionIndexState === -1) {\n optionIndex = findFirstFocusedOptionIndex() ?? -1;\n }\n\n if (optionIndex !== -1) {\n changeFocusedOptionIndex(event, optionIndex);\n }\n }\n\n if (searchTimeout.current) {\n clearTimeout(searchTimeout.current);\n }\n\n searchTimeout.current = setTimeout(() => {\n searchValue.current = '';\n searchTimeout.current = null;\n }, 500);\n };\n\n const removeOption = (option: unknown) => {\n return Array.isArray(valueState) ? valueState.filter((val: unknown) => !isEquals(val, getOptionValue(option))) : [];\n };\n\n const changeFocusedOptionIndex = (event: React.MouseEvent | React.KeyboardEvent, index: number = -1) => {\n if (focusedOptionIndexState !== index) {\n setFocusedOptionIndexState(index);\n\n scrollInView();\n\n if (props.selectOnFocus && !props.multiple) {\n onOptionSelect(event, getOptions()[index]);\n }\n }\n };\n\n const nextFrame = (): Promise<void> => {\n return new Promise((resolve) => {\n requestAnimationFrame(() => {\n requestAnimationFrame(resolve as () => void);\n });\n });\n };\n\n const scrollInView = (index = -1) => {\n nextFrame().then(() => {\n const id = index !== -1 ? getOptionId(index) : getFocusedOptionId();\n const element = findSingle(listRef.current!, `[id=\"${id}\"]`);\n\n element?.scrollIntoView?.({ block: 'nearest', inline: 'nearest', behavior: 'smooth' });\n });\n };\n\n const autoUpdateModel = () => {\n if (props.selectOnFocus && props.autoOptionFocus && !hasValue() && !props.multiple && focusedState) {\n const focusedOptionIndex = findFirstFocusedOptionIndex();\n\n setFocusedOptionIndexState(focusedOptionIndex);\n onOptionSelect(null as unknown as React.MouseEvent, getOptions()[focusedOptionIndex!]);\n }\n };\n\n const updateModel = (event: React.SyntheticEvent, value: unknown) => {\n setValueState([\n value,\n {\n originalEvent: event,\n value: value\n }\n ]);\n };\n\n const hasValue = () => {\n return isNotEmpty(valueState);\n };\n\n // effects\n React.useEffect(() => {\n autoUpdateModel();\n\n return () => {\n if (searchTimeout.current) {\n clearTimeout(searchTimeout.current);\n searchTimeout.current = null;\n }\n };\n }, []);\n\n // computed\n const optionsListGroup = React.useMemo(() => {\n const flattenOptions: unknown[] = [];\n\n (props.options || []).forEach((optionGroup) => {\n const optionGroupChildren = getOptionGroupChildren(optionGroup) || [];\n\n if (optionGroupChildren?.length) {\n flattenOptions.push({ optionGroup, group: true }, ...optionGroupChildren);\n }\n });\n\n return flattenOptions;\n }, [props.options]);\n\n const visibleOptions = props.optionGroupLabel ? optionsListGroup : props.options;\n const equalityKey = props.optionValue ? undefined : props.optionKey;\n\n return {\n state,\n // element refs\n listRef,\n firstHiddenFocusableRef,\n lastHiddenFocusableRef,\n // methods\n getOptions,\n getOptionId,\n getOptionLabel,\n getOptionValue,\n isOptionDisabled,\n isOptionGroup,\n getOptionGroupLabel,\n getOptionGroupChildren,\n getFocusedOptionId,\n getAriaSetSize,\n getAriaPosInset,\n onFirstHiddenFocus,\n onLastHiddenFocus,\n onFocusOut,\n onListFocus,\n onListBlur,\n onListKeyDown,\n onOptionSelect,\n onOptionMouseDown,\n onOptionMouseMove,\n onOptionTouchEnd,\n onFilterChange,\n onFilterBlur,\n onFilterKeyDown,\n isOptionMatched,\n isValidOption,\n isValidSelectedOption,\n isSelected,\n changeFocusedOptionIndex,\n scrollInView,\n updateModel,\n autoUpdateModel,\n equalityKey,\n hasValue\n };\n }\n});\n","import type { useListboxProps } from '@primereact/types/shared/listbox';\n\nexport const defaultProps: useListboxProps = {\n value: undefined,\n defaultValue: undefined,\n options: [],\n optionKey: undefined,\n optionLabel: undefined,\n optionValue: undefined,\n optionDisabled: undefined,\n optionGroupLabel: undefined,\n optionGroupChildren: undefined,\n disabled: false,\n locale: undefined,\n multiple: false,\n metaKeySelection: false,\n autoOptionFocus: true,\n selectOnFocus: false,\n focusOnHover: true,\n onValueChange: undefined\n};\n"],"mappings":"AAAA,OAAS,gBAAAA,OAAoB,4BAC7B,OAAS,sBAAAC,OAA0B,yCACnC,OAAS,UAAAC,GAAQ,iBAAAC,EAAe,cAAAC,GAAY,SAAAC,EAAO,4BAAAC,GAA0B,aAAAC,GAAW,cAAAC,EAAY,wBAAAC,GAAsB,YAAAC,GAAU,oBAAAC,MAAwB,kBAC5J,UAAYC,MAAW,QCDhB,IAAMC,GAAgC,CACzC,MAAO,OACP,aAAc,OACd,QAAS,CAAC,EACV,UAAW,OACX,YAAa,OACb,YAAa,OACb,eAAgB,OAChB,iBAAkB,OAClB,oBAAqB,OACrB,SAAU,GACV,OAAQ,OACR,SAAU,GACV,iBAAkB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,EACf,MAAOmB,CACX,CACJ,CAAC,CACL,EAEMiD,EAAW,IACNV,EAAW5F,CAAU,EAI1B,YAAU,KACZwC,EAAgB,EAET,IAAM,CACL/B,EAAc,UACd,aAAaA,EAAc,OAAO,EAClCA,EAAc,QAAU,KAEhC,GACD,CAAC,CAAC,EAGL,IAAM0G,GAAyB,UAAQ,IAAM,CACzC,IAAMC,EAA4B,CAAC,EAEnC,OAAC3H,EAAM,SAAW,CAAC,GAAG,QAAS8B,GAAgB,CAC3C,IAAM8F,EAAsB7F,EAAuBD,CAAW,GAAK,CAAC,EAEhE8F,GAAA,MAAAA,EAAqB,QACrBD,EAAe,KAAK,CAAE,YAAA7F,EAAa,MAAO,EAAK,EAAG,GAAG8F,CAAmB,CAEhF,CAAC,EAEMD,CACX,EAAG,CAAC3H,EAAM,OAAO,CAAC,EAEZmB,GAAiBnB,EAAM,iBAAmB0H,GAAmB1H,EAAM,QACnEyG,GAAczG,EAAM,YAAc,OAAYA,EAAM,UAE1D,MAAO,CACH,MAAAU,GAEA,QAAAC,EACA,wBAAAC,EACA,uBAAAC,EAEA,WAAAK,EACA,YAAAE,EACA,eAAAE,EACA,eAAAI,EACA,iBAAAC,EACA,cAAAC,EACA,oBAAAC,GACA,uBAAAE,EACA,mBAAAC,EACA,eAAAC,GACA,gBAAAC,GACA,mBAAAC,GACA,kBAAAK,GACA,WAAAE,GACA,YAAAC,GACA,WAAAM,GACA,cAAAC,GACA,eAAAe,EACA,kBAAAG,GACA,kBAAAE,GACA,iBAAAC,GACA,eAAAY,GACA,aAAAC,GACA,gBAAAC,GACA,gBAAAY,EACA,cAAApC,EACA,sBAAAuC,EACA,WAAA3B,EACA,yBAAAJ,EACA,aAAArB,EACA,YAAAc,EACA,gBAAAf,EACA,YAAA0D,GACA,SAAAI,CACJ,CACJ,CACJ,CAAC","names":["withHeadless","useControlledState","equals","findLastIndex","findSingle","focus","getFirstFocusableElement","isElement","isNotEmpty","isPrintableCharacter","isString","resolveFieldData","React","defaultProps","useListbox","withHeadless","defaultProps","id","props","elementRef","_a","focusedState","setFocusedState","focusedOptionIndexState","setFocusedOptionIndexState","valueState","setValueState","useControlledState","state","listRef","firstHiddenFocusableRef","lastHiddenFocusableRef","optionTouched","startRangeIndex","searchTimeout","searchValue","getOptions","visibleOptions","getOptionId","index","getOptionLabel","option","resolveFieldData","isString","getOptionValue","isOptionDisabled","isOptionGroup","getOptionGroupLabel","optionGroup","getOptionGroupChildren","getFocusedOptionId","getAriaSetSize","getAriaPosInset","onFirstHiddenFocus","focus","firstFocusableEl","getFirstFocusableElement","isElement","onLastHiddenFocus","event","onFocusOut","onListFocus","focusedOptionIndex","findFirstFocusedOptionIndex","findSelectedOptionIndex","autoUpdateModel","scrollInView","onListBlur","onListKeyDown","metaKey","onArrowDownKey","onArrowUpKey","onHomeKey","onEndKey","onPageDownKey","onPageUpKey","onSpaceKey","onShiftKey","value","isValidOption","updateModel","isPrintableCharacter","searchOptions","onOptionSelect","onOptionSelectMultiple","onOptionSelectSingle","onOptionMouseDown","changeFocusedOptionIndex","onOptionMouseMove","onOptionTouchEnd","selected","isSelected","metaSelection","valueChanged","removeOption","onOptionSelectRange","start","end","findNearestSelectedOptionIndex","rangeStart","rangeEnd","onFilterChange","onFilterBlur","onFilterKeyDown","onArrowLeftKey","onEnterKey","optionIndex","findNextOptionIndex","findPrevOptionIndex","findLastFocusedOptionIndex","pressedInInputText","target","findFirstOptionIndex","length","findLastOptionIndex","isOptionMatched","_b","isNotEmpty","isValidSelectedOption","isEquals","value1","value2","equals","equalityKey","optionValue","findLastIndex","matchedOptionIndex","hasValue","findFirstSelectedOptionIndex","findLastSelectedOptionIndex","findNextSelectedOptionIndex","findPrevSelectedOptionIndex","firstCheckUp","selectedIndex","char","val","nextFrame","resolve","element","findSingle","optionsListGroup","flattenOptions","optionGroupChildren"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const useListbox: (inProps?: unknown) => import("@primereact/types/core").HeadlessInstance<import("@primereact/types/shared/listbox").useListboxProps, unknown, {
|
|
3
|
+
state: {
|
|
4
|
+
value: unknown;
|
|
5
|
+
focused: boolean;
|
|
6
|
+
focusedOptionIndex: number;
|
|
7
|
+
};
|
|
8
|
+
listRef: React.RefObject<HTMLElement | null>;
|
|
9
|
+
firstHiddenFocusableRef: React.RefObject<HTMLElement | null>;
|
|
10
|
+
lastHiddenFocusableRef: React.RefObject<HTMLElement | null>;
|
|
11
|
+
getOptions: () => unknown[];
|
|
12
|
+
getOptionId: (index: number) => string;
|
|
13
|
+
getOptionLabel: (option: unknown) => any;
|
|
14
|
+
getOptionValue: (option: unknown) => any;
|
|
15
|
+
isOptionDisabled: (option: unknown) => any;
|
|
16
|
+
isOptionGroup: (option: unknown) => boolean;
|
|
17
|
+
getOptionGroupLabel: (optionGroup: unknown) => any;
|
|
18
|
+
getOptionGroupChildren: (optionGroup: unknown) => any;
|
|
19
|
+
getFocusedOptionId: () => string | null;
|
|
20
|
+
getAriaSetSize: () => number;
|
|
21
|
+
getAriaPosInset: (index: number) => number;
|
|
22
|
+
onFirstHiddenFocus: () => void;
|
|
23
|
+
onLastHiddenFocus: (event: React.FocusEvent) => void;
|
|
24
|
+
onFocusOut: (event: React.FocusEvent) => void;
|
|
25
|
+
onListFocus: () => void;
|
|
26
|
+
onListBlur: () => void;
|
|
27
|
+
onListKeyDown: (event: React.KeyboardEvent) => void;
|
|
28
|
+
onOptionSelect: (event: React.MouseEvent | React.KeyboardEvent, option: unknown, index?: number) => void;
|
|
29
|
+
onOptionMouseDown: (event: React.MouseEvent, index: number) => void;
|
|
30
|
+
onOptionMouseMove: (event: React.MouseEvent, index: number) => void;
|
|
31
|
+
onOptionTouchEnd: () => void;
|
|
32
|
+
onFilterChange: () => void;
|
|
33
|
+
onFilterBlur: () => void;
|
|
34
|
+
onFilterKeyDown: (event: React.KeyboardEvent) => void;
|
|
35
|
+
isOptionMatched: (option: unknown) => any;
|
|
36
|
+
isValidOption: (option: unknown) => boolean;
|
|
37
|
+
isValidSelectedOption: (option: unknown) => boolean;
|
|
38
|
+
isSelected: (option: unknown) => boolean;
|
|
39
|
+
changeFocusedOptionIndex: (event: React.MouseEvent | React.KeyboardEvent, index?: number) => void;
|
|
40
|
+
scrollInView: (index?: number) => void;
|
|
41
|
+
updateModel: (event: React.SyntheticEvent, value: unknown) => void;
|
|
42
|
+
autoUpdateModel: () => void;
|
|
43
|
+
equalityKey: string | undefined;
|
|
44
|
+
hasValue: () => boolean;
|
|
45
|
+
}>;
|