@vavt/react-ui 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Anchor-QZROepM_.js → Anchor-CAZPkv56.js} +1 -1
- package/dist/{Anchor-iriRYxEs.cjs → Anchor-CmuV1Ump.cjs} +1 -1
- package/dist/{Announcement-XjJyJ28N.cjs → Announcement-D0hZE2sM.cjs} +1 -1
- package/dist/{Announcement-D_NccvTm.js → Announcement-DzzaTvcO.js} +1 -1
- package/dist/Checkbox-CBMmX-R-.js +86 -0
- package/dist/Checkbox-CzNGP2tH.cjs +1 -0
- package/dist/Checkbox-GJlGNzlH.cjs +1 -0
- package/dist/Checkbox-bHOjYdMp.js +61 -0
- package/dist/{Cron-Go4yIqrd.js → Cron-DIB4GG4y.js} +7 -7
- package/dist/{Cron-3D9GmlYf.cjs → Cron-MhbYMEeJ.cjs} +1 -1
- package/dist/{DatePicker-D75NqBYX.js → DatePicker--13tW0cw.js} +1 -1
- package/dist/{DatePicker-D3tdU7GY.cjs → DatePicker-Bj709smn.cjs} +1 -1
- package/dist/{DateTimePicker-CG-yv54X.js → DateTimePicker-Blqs2Bcv.js} +1 -1
- package/dist/{DateTimePicker-CCe5NUkC.cjs → DateTimePicker-ZSScsk-j.cjs} +1 -1
- package/dist/{Drawer-CeBlbSjY.cjs → Drawer-DcbgMkub.cjs} +1 -1
- package/dist/{Drawer-CgaSQfT_.js → Drawer-yM_r1M0H.js} +1 -1
- package/dist/{Dropdown-BsXYVdt6.cjs → Dropdown-PHqXNiAZ.cjs} +1 -1
- package/dist/{Dropdown-DljKFnvO.js → Dropdown-mYCY-LcF.js} +2 -2
- package/dist/Form-BkyDHPEI.cjs +1 -0
- package/dist/Form-D_Uv-8HG.js +449 -0
- package/dist/{Input-CIB_TY2n.js → Input-BRy5Xuwy.js} +28 -37
- package/dist/Input-C9ESmbJ7.cjs +1 -0
- package/dist/{MessageBox-nHLRzRJS.cjs → MessageBox-BSMYQenX.cjs} +1 -1
- package/dist/{MessageBox-DlAv_jQm.js → MessageBox-DipOfKXI.js} +2 -2
- package/dist/{Modal-CAZ8vap0.cjs → Modal-BOI8r4y1.cjs} +1 -1
- package/dist/{Modal-DnLKpKvW.js → Modal-De9igZ5e.js} +1 -1
- package/dist/{NumberInput-C_vLULbX.js → NumberInput-CB-nKZgs.js} +1 -1
- package/dist/{NumberInput-CYVj89_s.cjs → NumberInput-Dp1vTDkW.cjs} +1 -1
- package/dist/{Pagination-CSI5IzQB.js → Pagination-CpbboRbF.js} +2 -2
- package/dist/{Pagination-ODU-i3gn.cjs → Pagination-DatEegaF.cjs} +1 -1
- package/dist/RadioGroup-DTodR0VJ.cjs +1 -0
- package/dist/RadioGroup-DYjQMXdB.js +136 -0
- package/dist/Select-BHWa_6Q2.js +466 -0
- package/dist/Select-C6O0tmM_.cjs +1 -0
- package/dist/{Slider-BzlZc0p4.js → Slider-CKU03SsT.js} +1 -1
- package/dist/{Slider-DCIUxcBa.cjs → Slider-CU9OS2HB.cjs} +1 -1
- package/dist/{Switch-7yJ-Q_o_.cjs → Switch-CpXDMcPW.cjs} +1 -1
- package/dist/{Switch-DOO2tiYR.js → Switch-CqTFvp-k.js} +1 -1
- package/dist/Table-BNGO_7Rx.cjs +1 -0
- package/dist/Table-Cfs3XJgN.js +531 -0
- package/dist/{Tabs-BhjvKN84.cjs → Tabs-BZ0Zc0bL.cjs} +1 -1
- package/dist/{Tabs-VT6nQ63W.js → Tabs-HWLkyrQR.js} +1 -1
- package/dist/{Textarea-BEd7ToXv.js → Textarea-CA6Vzu7t.js} +1 -1
- package/dist/{Textarea-C2dNYM0F.cjs → Textarea-CEhAvE10.cjs} +1 -1
- package/dist/{TimePicker-CHZsr_jj.js → TimePicker-CYlcUTTM.js} +2 -2
- package/dist/{TimePicker-Cpmvn8tx.cjs → TimePicker-DoGbwfkU.cjs} +1 -1
- package/dist/{Tooltip-Buk5F9f_.js → Tooltip-BKPreZML.js} +2 -2
- package/dist/{Tooltip-CP8rpNYG.cjs → Tooltip-DDjGLjoV.cjs} +1 -1
- package/dist/{Upload-CVIzg2Px.js → Upload-DZ6VaM7r.js} +1 -1
- package/dist/{Upload-CIOunhpr.cjs → Upload-wHEEoe1c.cjs} +1 -1
- package/dist/cjs/Anchor.cjs +1 -1
- package/dist/cjs/Announcement.cjs +1 -1
- package/dist/cjs/Checkbox.cjs +1 -1
- package/dist/cjs/Cron.cjs +1 -1
- package/dist/cjs/DatePicker.cjs +1 -1
- package/dist/cjs/DateTimePicker.cjs +1 -1
- package/dist/cjs/Drawer.cjs +1 -1
- package/dist/cjs/Dropdown.cjs +1 -1
- package/dist/cjs/Form.cjs +1 -1
- package/dist/cjs/Input.cjs +1 -1
- package/dist/cjs/MessageBox.cjs +1 -1
- package/dist/cjs/Modal.cjs +1 -1
- package/dist/cjs/NumberInput.cjs +1 -1
- package/dist/cjs/Pagination.cjs +1 -1
- package/dist/cjs/Radio.cjs +1 -1
- package/dist/cjs/Select.cjs +1 -1
- package/dist/cjs/Slider.cjs +1 -1
- package/dist/cjs/Switch.cjs +1 -1
- package/dist/cjs/Table.cjs +1 -1
- package/dist/cjs/Tabs.cjs +1 -1
- package/dist/cjs/Textarea.cjs +1 -1
- package/dist/cjs/TimePicker.cjs +1 -1
- package/dist/cjs/Tooltip.cjs +1 -1
- package/dist/cjs/Upload.cjs +1 -1
- package/dist/cjs/global.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/register.cjs +1 -1
- package/dist/css/Checkbox.css +1 -1
- package/dist/css/Form.css +1 -1
- package/dist/css/Input.css +1 -1
- package/dist/css/Radio.css +1 -1
- package/dist/css/Select.css +1 -1
- package/dist/{date-picker-pwA2wCag.cjs → date-picker-Be_1wA3S.cjs} +1 -1
- package/dist/{date-picker-BH--Nh7g.js → date-picker-CHP0eBuL.js} +4 -4
- package/dist/es/Anchor.mjs +1 -1
- package/dist/es/Announcement.mjs +1 -1
- package/dist/es/Checkbox.mjs +1 -1
- package/dist/es/Cron.mjs +1 -1
- package/dist/es/DatePicker.mjs +1 -1
- package/dist/es/DateTimePicker.mjs +1 -1
- package/dist/es/Drawer.mjs +1 -1
- package/dist/es/Dropdown.mjs +1 -1
- package/dist/es/Form.mjs +1 -1
- package/dist/es/Input.mjs +1 -1
- package/dist/es/MessageBox.mjs +1 -1
- package/dist/es/Modal.mjs +1 -1
- package/dist/es/NumberInput.mjs +1 -1
- package/dist/es/Pagination.mjs +1 -1
- package/dist/es/Radio.mjs +1 -1
- package/dist/es/Select.mjs +1 -1
- package/dist/es/Slider.mjs +1 -1
- package/dist/es/Switch.mjs +1 -1
- package/dist/es/Table.mjs +1 -1
- package/dist/es/Tabs.mjs +1 -1
- package/dist/es/Textarea.mjs +1 -1
- package/dist/es/TimePicker.mjs +1 -1
- package/dist/es/Tooltip.mjs +1 -1
- package/dist/es/Upload.mjs +1 -1
- package/dist/es/global.mjs +1 -1
- package/dist/es/index.mjs +24 -24
- package/dist/es/register.mjs +1 -1
- package/dist/floating-5PRFyI8D.cjs +1 -0
- package/dist/floating-CqdcJWk2.js +181 -0
- package/dist/index.css +1 -1
- package/dist/{registry-macDoSyW.js → registry-BLaletUC.js} +23 -23
- package/dist/registry-hU7S5myb.cjs +1 -0
- package/dist/state-BSDh-Ob2.js +22 -0
- package/dist/state-BuUx1onZ.cjs +1 -0
- package/dist/types/Checkbox/context.d.cts +12 -2
- package/dist/types/Checkbox/context.d.ts +12 -2
- package/dist/types/Checkbox/type.d.cts +33 -3
- package/dist/types/Checkbox/type.d.ts +33 -3
- package/dist/types/Form/FormItem.d.cts +1 -1
- package/dist/types/Form/FormItem.d.ts +1 -1
- package/dist/types/Form/context.d.cts +31 -0
- package/dist/types/Form/context.d.ts +31 -0
- package/dist/types/Form/index.d.cts +2 -2
- package/dist/types/Form/index.d.ts +2 -2
- package/dist/types/Form/type.d.cts +0 -2
- package/dist/types/Form/type.d.ts +0 -2
- package/dist/types/Radio/context.d.cts +12 -2
- package/dist/types/Radio/context.d.ts +12 -2
- package/dist/types/Radio/type.d.cts +33 -3
- package/dist/types/Radio/type.d.ts +33 -3
- package/dist/types/_shared/state.d.cts +3 -0
- package/dist/types/_shared/state.d.ts +3 -0
- package/dist/types/registry.d.cts +1 -1
- package/dist/types/registry.d.ts +1 -1
- package/package.json +1 -1
- package/dist/Checkbox-BCXbK1-8.cjs +0 -1
- package/dist/Checkbox-CQZSg9Xu.cjs +0 -1
- package/dist/Checkbox-CQeqLO0S.js +0 -46
- package/dist/Checkbox-cnXHW9Oz.js +0 -61
- package/dist/Form-BfXRwX6y.js +0 -353
- package/dist/Form-QpWOfQpR.cjs +0 -1
- package/dist/Input-CoDZggqc.cjs +0 -1
- package/dist/RadioGroup-BRcNi5Oc.js +0 -98
- package/dist/RadioGroup-q2Aa50NV.cjs +0 -1
- package/dist/Select-BRKxpX-_.cjs +0 -1
- package/dist/Select-QedbJ4pD.js +0 -468
- package/dist/Table-BFqTvxt1.js +0 -440
- package/dist/Table-D4csqW47.cjs +0 -1
- package/dist/floating-DBAmeQIq.js +0 -157
- package/dist/floating-DXRnx48N.cjs +0 -1
- package/dist/registry-BO2ao8Jc.cjs +0 -1
- package/dist/state-ZBA75xZ_.cjs +0 -1
- package/dist/state-oH-YwB7_.js +0 -15
package/dist/es/NumberInput.mjs
CHANGED
package/dist/es/Pagination.mjs
CHANGED
package/dist/es/Radio.mjs
CHANGED
package/dist/es/Select.mjs
CHANGED
package/dist/es/Slider.mjs
CHANGED
package/dist/es/Switch.mjs
CHANGED
package/dist/es/Table.mjs
CHANGED
package/dist/es/Tabs.mjs
CHANGED
package/dist/es/Textarea.mjs
CHANGED
package/dist/es/TimePicker.mjs
CHANGED
package/dist/es/Tooltip.mjs
CHANGED
package/dist/es/Upload.mjs
CHANGED
package/dist/es/global.mjs
CHANGED
package/dist/es/index.mjs
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { n as e } from "../Alert-BGyLKuv0.js";
|
|
3
|
-
import { n as t } from "../Anchor-
|
|
4
|
-
import { n } from "../Announcement-
|
|
3
|
+
import { n as t } from "../Anchor-CAZPkv56.js";
|
|
4
|
+
import { n } from "../Announcement-DzzaTvcO.js";
|
|
5
5
|
import { n as r, r as i } from "../Button-CwkWSWau.js";
|
|
6
6
|
import { n as a } from "../Card-DCLfLn1x.js";
|
|
7
|
-
import { n as o, r as s } from "../Checkbox-
|
|
7
|
+
import { n as o, r as s } from "../Checkbox-bHOjYdMp.js";
|
|
8
8
|
import { n as c } from "../Col-CZjR94ac.js";
|
|
9
9
|
import { n as l } from "../Transition-DiO4GsP3.js";
|
|
10
|
-
import { n as u } from "../Input-
|
|
11
|
-
import { n as d } from "../Tabs-
|
|
12
|
-
import { n as f } from "../NumberInput-
|
|
13
|
-
import { n as p } from "../Cron-
|
|
14
|
-
import { n as m } from "../Dropdown-
|
|
15
|
-
import { n as h } from "../DatePicker
|
|
16
|
-
import { n as g } from "../DateTimePicker-
|
|
10
|
+
import { n as u } from "../Input-BRy5Xuwy.js";
|
|
11
|
+
import { n as d } from "../Tabs-HWLkyrQR.js";
|
|
12
|
+
import { n as f } from "../NumberInput-CB-nKZgs.js";
|
|
13
|
+
import { n as p } from "../Cron-DIB4GG4y.js";
|
|
14
|
+
import { n as m } from "../Dropdown-mYCY-LcF.js";
|
|
15
|
+
import { n as h } from "../DatePicker--13tW0cw.js";
|
|
16
|
+
import { n as g } from "../DateTimePicker-Blqs2Bcv.js";
|
|
17
17
|
import { n as _ } from "../Divider-BXNZyvHY.js";
|
|
18
|
-
import { n as v } from "../Drawer-
|
|
18
|
+
import { n as v } from "../Drawer-yM_r1M0H.js";
|
|
19
19
|
import { n as y } from "../Empty-MmxZitR8.js";
|
|
20
|
-
import { n as b, t as x } from "../Form-
|
|
21
|
-
import { n as S } from "../Tooltip-
|
|
20
|
+
import { n as b, t as x } from "../Form-D_Uv-8HG.js";
|
|
21
|
+
import { n as S } from "../Tooltip-BKPreZML.js";
|
|
22
22
|
import { n as C } from "../Loading-CL0wUgYK.js";
|
|
23
23
|
import { n as w } from "../Scrollbar-BdMGZrYi.js";
|
|
24
|
-
import { n as T } from "../Modal-
|
|
25
|
-
import { t as E } from "../MessageBox-
|
|
26
|
-
import { n as D } from "../Select-
|
|
27
|
-
import { n as O } from "../Pagination-
|
|
24
|
+
import { n as T } from "../Modal-De9igZ5e.js";
|
|
25
|
+
import { t as E } from "../MessageBox-DipOfKXI.js";
|
|
26
|
+
import { n as D } from "../Select-BHWa_6Q2.js";
|
|
27
|
+
import { n as O } from "../Pagination-CpbboRbF.js";
|
|
28
28
|
import { n as k } from "../Progress-D2C6LCml.js";
|
|
29
29
|
import { VlRadio as A, VlRadioGroup as j } from "./Radio.mjs";
|
|
30
30
|
import { VlRow as M } from "./Row.mjs";
|
|
31
31
|
import { n as N } from "../Sidebar-u980T-QB.js";
|
|
32
|
-
import { n as P } from "../Slider-
|
|
32
|
+
import { n as P } from "../Slider-CKU03SsT.js";
|
|
33
33
|
import { n as F } from "../Space-gnVH7rEt.js";
|
|
34
|
-
import { n as I } from "../Switch-
|
|
35
|
-
import { n as L } from "../Table-
|
|
34
|
+
import { n as I } from "../Switch-CqTFvp-k.js";
|
|
35
|
+
import { n as L } from "../Table-Cfs3XJgN.js";
|
|
36
36
|
import { n as R } from "../Tag-CkfqoSwA.js";
|
|
37
|
-
import { n as z } from "../Textarea-
|
|
37
|
+
import { n as z } from "../Textarea-CA6Vzu7t.js";
|
|
38
38
|
import { n as B } from "../Timeline-euWvUS4e.js";
|
|
39
|
-
import { n as V } from "../TimePicker-
|
|
40
|
-
import { n as H } from "../Upload-
|
|
41
|
-
import { n as U, t as W } from "../registry-
|
|
39
|
+
import { n as V } from "../TimePicker-CYlcUTTM.js";
|
|
40
|
+
import { n as H } from "../Upload-DZ6VaM7r.js";
|
|
41
|
+
import { n as U, t as W } from "../registry-BLaletUC.js";
|
|
42
42
|
export { e as VlAlert, t as VlAnchor, n as VlAnnouncement, r as VlButton, i as VlButtonGroup, a as VlCard, o as VlCheckbox, s as VlCheckboxGroup, c as VlCol, p as VlCron, h as VlDatePicker, g as VlDateTimePicker, _ as VlDivider, v as VlDrawer, m as VlDropdown, y as VlEmpty, x as VlForm, b as VlFormItem, u as VlInput, C as VlLoading, E as VlMessageBox, T as VlModal, f as VlNumberInput, O as VlPagination, k as VlProgress, A as VlRadio, j as VlRadioGroup, M as VlRow, w as VlScrollbar, D as VlSelect, N as VlSidebar, P as VlSlider, F as VlSpace, I as VlSwitch, L as VlTable, d as VlTabs, R as VlTag, z as VlTextarea, V as VlTimePicker, B as VlTimeline, S as VlTooltip, l as VlTransition, H as VlUpload, W as globalComponents, U as registerGlobalComponents };
|
package/dist/es/register.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./effect-BpNxm_06.cjs"),t=require("./number-B7qJF_ZY.cjs");let n=require("react");var r=({active:t,rootRef:r,floatingRef:i,closeOnOutsideClick:a=!0,ignoreEscapeInsideFloating:o=!1,isOwnedPopup:s,onOutsideClick:c,onEscape:l,onViewportChange:u})=>{let d=(0,n.useRef)({rootRef:r,floatingRef:i,closeOnOutsideClick:a,ignoreEscapeInsideFloating:o,isOwnedPopup:s,onOutsideClick:c,onEscape:l,onViewportChange:u});e.t(()=>{d.current={rootRef:r,floatingRef:i,closeOnOutsideClick:a,ignoreEscapeInsideFloating:o,isOwnedPopup:s,onOutsideClick:c,onEscape:l,onViewportChange:u}});let f=!!l,p=!!u;(0,n.useEffect)(()=>{if(!t)return;let e=null,n=e=>{let{closeOnOutsideClick:t,rootRef:n,floatingRef:r,isOwnedPopup:i,onOutsideClick:a}=d.current;if(!t)return;let o=e.composedPath(),s=n.current,c=r.current;!s||o.includes(s)||c&&o.includes(c)||i?.(o)||a?.()},r=e=>{let{ignoreEscapeInsideFloating:t,floatingRef:n,onEscape:r}=d.current;r&&(e.key!==`Escape`||t&&n.current?.contains(e.target)||(e.preventDefault(),r()))},i=()=>{d.current.onViewportChange&&e===null&&(e=(typeof window<`u`&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame:e=>setTimeout(e,16))(()=>{e=null,d.current.onViewportChange?.()}))};return document.addEventListener(`pointerdown`,n,!0),f&&document.addEventListener(`keydown`,r),p&&(window.addEventListener(`resize`,i,{passive:!0}),window.addEventListener(`scroll`,i,{passive:!0,capture:!0})),()=>{e!==null&&(typeof window<`u`&&typeof window.cancelAnimationFrame==`function`?window.cancelAnimationFrame(e):clearTimeout(e),e=null),document.removeEventListener(`pointerdown`,n,!0),f&&document.removeEventListener(`keydown`,r),p&&(window.removeEventListener(`resize`,i),window.removeEventListener(`scroll`,i,!0))}},[t,f,p])},i=e=>({"bottom-start":[`bottom-start`,`bottom-end`,`top-start`,`top-end`],"bottom-end":[`bottom-end`,`bottom-start`,`top-end`,`top-start`],"top-start":[`top-start`,`top-end`,`bottom-start`,`bottom-end`],"top-end":[`top-end`,`top-start`,`bottom-end`,`bottom-start`]})[e],a=({anchorRect:e,floatingRect:n,placement:r,offset:i,edgePadding:a=8,getCandidates:s=o,fallbackFits:c})=>{let l=t=>{let r=t.split(`-`)[0],a=!t.endsWith(`-start`)&&!t.endsWith(`-end`),o=t.endsWith(`-end`);if(r===`top`||r===`bottom`)return{x:a?e.left+(e.width-n.width)/2:o?e.right-n.width:e.left,y:r===`top`?e.top-i-n.height:e.bottom+i};let s=a?e.top+(e.height-n.height)/2:o?e.bottom-n.height:e.top;return{x:r===`left`?e.left-i-n.width:e.right+i,y:s}},u=({x:e,y:t})=>e>=a&&e+n.width<=window.innerWidth-a&&t>=a&&t+n.height<=window.innerHeight-a,d=s(r),f=d.find(e=>u(l(e)))??(c?d.find(e=>c(l(e))):void 0)??r,p=l(f),m=Math.max(a,window.innerWidth-n.width-a),h=Math.max(a,window.innerHeight-n.height-a);return{placement:f,x:t.t(p.x,a,m),y:t.t(p.y,a,h)}},o=e=>({top:[`top`,`bottom`,`left`,`right`],"top-start":[`top-start`,`bottom-start`,`top-end`,`bottom-end`],"top-end":[`top-end`,`bottom-end`,`top-start`,`bottom-start`],bottom:[`bottom`,`top`,`left`,`right`],"bottom-start":[`bottom-start`,`top-start`,`bottom-end`,`top-end`],"bottom-end":[`bottom-end`,`top-end`,`bottom-start`,`top-start`],left:[`left`,`right`,`top`,`bottom`],"left-start":[`left-start`,`right-start`,`left-end`,`right-end`],"left-end":[`left-end`,`right-end`,`left-start`,`right-start`],right:[`right`,`left`,`top`,`bottom`],"right-start":[`right-start`,`left-start`,`right-end`,`left-end`],"right-end":[`right-end`,`left-end`,`right-start`,`left-start`]})[e],s=e=>{let{edgePadding:t=8,...n}=e;return a({...n,edgePadding:t,getCandidates:i,fallbackFits:({y:n})=>n>=t&&n+e.floatingRect.height<=window.innerHeight-t})};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { t as e } from "./effect-nifYL_rH.js";
|
|
2
|
+
import { t } from "./number-BN2jHM6Z.js";
|
|
3
|
+
import { useEffect as n, useRef as r } from "react";
|
|
4
|
+
//#region components/_shared/floating.ts
|
|
5
|
+
var i = ({ active: t, rootRef: i, floatingRef: a, closeOnOutsideClick: o = !0, ignoreEscapeInsideFloating: s = !1, isOwnedPopup: c, onOutsideClick: l, onEscape: u, onViewportChange: d }) => {
|
|
6
|
+
let f = r({
|
|
7
|
+
rootRef: i,
|
|
8
|
+
floatingRef: a,
|
|
9
|
+
closeOnOutsideClick: o,
|
|
10
|
+
ignoreEscapeInsideFloating: s,
|
|
11
|
+
isOwnedPopup: c,
|
|
12
|
+
onOutsideClick: l,
|
|
13
|
+
onEscape: u,
|
|
14
|
+
onViewportChange: d
|
|
15
|
+
});
|
|
16
|
+
e(() => {
|
|
17
|
+
f.current = {
|
|
18
|
+
rootRef: i,
|
|
19
|
+
floatingRef: a,
|
|
20
|
+
closeOnOutsideClick: o,
|
|
21
|
+
ignoreEscapeInsideFloating: s,
|
|
22
|
+
isOwnedPopup: c,
|
|
23
|
+
onOutsideClick: l,
|
|
24
|
+
onEscape: u,
|
|
25
|
+
onViewportChange: d
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
let p = !!u, m = !!d;
|
|
29
|
+
n(() => {
|
|
30
|
+
if (!t) return;
|
|
31
|
+
let e = null, n = (e) => {
|
|
32
|
+
let { closeOnOutsideClick: t, rootRef: n, floatingRef: r, isOwnedPopup: i, onOutsideClick: a } = f.current;
|
|
33
|
+
if (!t) return;
|
|
34
|
+
let o = e.composedPath(), s = n.current, c = r.current;
|
|
35
|
+
!s || o.includes(s) || c && o.includes(c) || i?.(o) || a?.();
|
|
36
|
+
}, r = (e) => {
|
|
37
|
+
let { ignoreEscapeInsideFloating: t, floatingRef: n, onEscape: r } = f.current;
|
|
38
|
+
r && (e.key !== "Escape" || t && n.current?.contains(e.target) || (e.preventDefault(), r()));
|
|
39
|
+
}, i = () => {
|
|
40
|
+
f.current.onViewportChange && e === null && (e = (typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame : (e) => setTimeout(e, 16))(() => {
|
|
41
|
+
e = null, f.current.onViewportChange?.();
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
return document.addEventListener("pointerdown", n, !0), p && document.addEventListener("keydown", r), m && (window.addEventListener("resize", i, { passive: !0 }), window.addEventListener("scroll", i, {
|
|
45
|
+
passive: !0,
|
|
46
|
+
capture: !0
|
|
47
|
+
})), () => {
|
|
48
|
+
e !== null && (typeof window < "u" && typeof window.cancelAnimationFrame == "function" ? window.cancelAnimationFrame(e) : clearTimeout(e), e = null), document.removeEventListener("pointerdown", n, !0), p && document.removeEventListener("keydown", r), m && (window.removeEventListener("resize", i), window.removeEventListener("scroll", i, !0));
|
|
49
|
+
};
|
|
50
|
+
}, [
|
|
51
|
+
t,
|
|
52
|
+
p,
|
|
53
|
+
m
|
|
54
|
+
]);
|
|
55
|
+
}, a = (e) => ({
|
|
56
|
+
"bottom-start": [
|
|
57
|
+
"bottom-start",
|
|
58
|
+
"bottom-end",
|
|
59
|
+
"top-start",
|
|
60
|
+
"top-end"
|
|
61
|
+
],
|
|
62
|
+
"bottom-end": [
|
|
63
|
+
"bottom-end",
|
|
64
|
+
"bottom-start",
|
|
65
|
+
"top-end",
|
|
66
|
+
"top-start"
|
|
67
|
+
],
|
|
68
|
+
"top-start": [
|
|
69
|
+
"top-start",
|
|
70
|
+
"top-end",
|
|
71
|
+
"bottom-start",
|
|
72
|
+
"bottom-end"
|
|
73
|
+
],
|
|
74
|
+
"top-end": [
|
|
75
|
+
"top-end",
|
|
76
|
+
"top-start",
|
|
77
|
+
"bottom-end",
|
|
78
|
+
"bottom-start"
|
|
79
|
+
]
|
|
80
|
+
})[e], o = ({ anchorRect: e, floatingRect: n, placement: r, offset: i, edgePadding: a = 8, getCandidates: o = s, fallbackFits: c }) => {
|
|
81
|
+
let l = (t) => {
|
|
82
|
+
let r = t.split("-")[0], a = !t.endsWith("-start") && !t.endsWith("-end"), o = t.endsWith("-end");
|
|
83
|
+
if (r === "top" || r === "bottom") return {
|
|
84
|
+
x: a ? e.left + (e.width - n.width) / 2 : o ? e.right - n.width : e.left,
|
|
85
|
+
y: r === "top" ? e.top - i - n.height : e.bottom + i
|
|
86
|
+
};
|
|
87
|
+
let s = a ? e.top + (e.height - n.height) / 2 : o ? e.bottom - n.height : e.top;
|
|
88
|
+
return {
|
|
89
|
+
x: r === "left" ? e.left - i - n.width : e.right + i,
|
|
90
|
+
y: s
|
|
91
|
+
};
|
|
92
|
+
}, u = ({ x: e, y: t }) => e >= a && e + n.width <= window.innerWidth - a && t >= a && t + n.height <= window.innerHeight - a, d = o(r), f = d.find((e) => u(l(e))) ?? (c ? d.find((e) => c(l(e))) : void 0) ?? r, p = l(f), m = Math.max(a, window.innerWidth - n.width - a), h = Math.max(a, window.innerHeight - n.height - a);
|
|
93
|
+
return {
|
|
94
|
+
placement: f,
|
|
95
|
+
x: t(p.x, a, m),
|
|
96
|
+
y: t(p.y, a, h)
|
|
97
|
+
};
|
|
98
|
+
}, s = (e) => ({
|
|
99
|
+
top: [
|
|
100
|
+
"top",
|
|
101
|
+
"bottom",
|
|
102
|
+
"left",
|
|
103
|
+
"right"
|
|
104
|
+
],
|
|
105
|
+
"top-start": [
|
|
106
|
+
"top-start",
|
|
107
|
+
"bottom-start",
|
|
108
|
+
"top-end",
|
|
109
|
+
"bottom-end"
|
|
110
|
+
],
|
|
111
|
+
"top-end": [
|
|
112
|
+
"top-end",
|
|
113
|
+
"bottom-end",
|
|
114
|
+
"top-start",
|
|
115
|
+
"bottom-start"
|
|
116
|
+
],
|
|
117
|
+
bottom: [
|
|
118
|
+
"bottom",
|
|
119
|
+
"top",
|
|
120
|
+
"left",
|
|
121
|
+
"right"
|
|
122
|
+
],
|
|
123
|
+
"bottom-start": [
|
|
124
|
+
"bottom-start",
|
|
125
|
+
"top-start",
|
|
126
|
+
"bottom-end",
|
|
127
|
+
"top-end"
|
|
128
|
+
],
|
|
129
|
+
"bottom-end": [
|
|
130
|
+
"bottom-end",
|
|
131
|
+
"top-end",
|
|
132
|
+
"bottom-start",
|
|
133
|
+
"top-start"
|
|
134
|
+
],
|
|
135
|
+
left: [
|
|
136
|
+
"left",
|
|
137
|
+
"right",
|
|
138
|
+
"top",
|
|
139
|
+
"bottom"
|
|
140
|
+
],
|
|
141
|
+
"left-start": [
|
|
142
|
+
"left-start",
|
|
143
|
+
"right-start",
|
|
144
|
+
"left-end",
|
|
145
|
+
"right-end"
|
|
146
|
+
],
|
|
147
|
+
"left-end": [
|
|
148
|
+
"left-end",
|
|
149
|
+
"right-end",
|
|
150
|
+
"left-start",
|
|
151
|
+
"right-start"
|
|
152
|
+
],
|
|
153
|
+
right: [
|
|
154
|
+
"right",
|
|
155
|
+
"left",
|
|
156
|
+
"top",
|
|
157
|
+
"bottom"
|
|
158
|
+
],
|
|
159
|
+
"right-start": [
|
|
160
|
+
"right-start",
|
|
161
|
+
"left-start",
|
|
162
|
+
"right-end",
|
|
163
|
+
"left-end"
|
|
164
|
+
],
|
|
165
|
+
"right-end": [
|
|
166
|
+
"right-end",
|
|
167
|
+
"left-end",
|
|
168
|
+
"right-start",
|
|
169
|
+
"left-start"
|
|
170
|
+
]
|
|
171
|
+
})[e], c = (e) => {
|
|
172
|
+
let { edgePadding: t = 8, ...n } = e;
|
|
173
|
+
return o({
|
|
174
|
+
...n,
|
|
175
|
+
edgePadding: t,
|
|
176
|
+
getCandidates: a,
|
|
177
|
+
fallbackFits: ({ y: n }) => n >= t && n + e.floatingRect.height <= window.innerHeight - t
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
//#endregion
|
|
181
|
+
export { o as n, i as r, c as t };
|