@viasat/beam-shared 2.0.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/README.md +108 -0
- package/chunks/SegmentedControl.B9dLCFSF.js +9 -0
- package/chunks/SegmentedControl.D0l_8a7O.js +1 -0
- package/chunks/accordion.C1LkPYXv.js +1 -0
- package/chunks/accordion.CCM7ddD5.js +11 -0
- package/chunks/actionList.LFHBSlrg.js +1 -0
- package/chunks/actionList.X99uHmXK.js +26 -0
- package/chunks/alert.B4q5-o6H.js +1 -0
- package/chunks/alert.BZ4L-6bC.js +32 -0
- package/chunks/avatar.BbM_sNXk.js +63 -0
- package/chunks/avatar.VNzxbOMa.js +1 -0
- package/chunks/badge.B_k2GBe6.js +1 -0
- package/chunks/badge.DZN0yrZh.js +44 -0
- package/chunks/badgeDot.ClhZtqzd.js +25 -0
- package/chunks/badgeDot.Dkqfk3zg.js +1 -0
- package/chunks/box.CsO__7hu.js +1 -0
- package/chunks/box._mFtvgTp.js +82 -0
- package/chunks/button.Bbz_mfWv.js +1 -0
- package/chunks/button.Dz8Zhr7J.js +51 -0
- package/chunks/card.CG-SDcm1.js +27 -0
- package/chunks/card.CLwQAceo.js +1 -0
- package/chunks/chips.DKEagIsp.js +1 -0
- package/chunks/chips.GU9UVEOU.js +13 -0
- package/chunks/closeButton.C1A3p88y.js +1 -0
- package/chunks/closeButton.g8_iRoUg.js +15 -0
- package/chunks/dialog.BTq-pLBf.js +28 -0
- package/chunks/dialog.DnkeApRr.js +1 -0
- package/chunks/divider.BYMLu6Wp.js +1 -0
- package/chunks/divider.DgP7kpLb.js +35 -0
- package/chunks/fileUpload.BbSIsjJv.js +240 -0
- package/chunks/fileUpload.C-l2YXzO.js +1 -0
- package/chunks/form.BRWIo59c.js +154 -0
- package/chunks/form.CIzlawbr.js +1 -0
- package/chunks/helperText.C-apoW8Z.js +1 -0
- package/chunks/helperText.CS5sun4r.js +16 -0
- package/chunks/icon.SiHuIfL8.js +1 -0
- package/chunks/icon.tCAxaKQh.js +28 -0
- package/chunks/inputChoiceGroup.BSousduj.js +1 -0
- package/chunks/inputChoiceGroup.DkDdA57f.js +10 -0
- package/chunks/link.DxTb3yhm.js +16 -0
- package/chunks/link.VyBRMFxS.js +1 -0
- package/chunks/list.CCq0lIzm.js +29 -0
- package/chunks/list.D6NIx1OS.js +1 -0
- package/chunks/logo.CLQZSaVN.js +1 -0
- package/chunks/logo.Cl29Chxj.js +11 -0
- package/chunks/nativeSelect.D9HZm9uJ.js +28 -0
- package/chunks/nativeSelect.Lz45VyQX.js +1 -0
- package/chunks/pageHeader.CbDGb6ot.js +1 -0
- package/chunks/pageHeader.fsTiHDRc.js +12 -0
- package/chunks/pagination.Br7vTt5b.js +1 -0
- package/chunks/pagination.DinViL55.js +38 -0
- package/chunks/progressBar.84w2qF8R.js +42 -0
- package/chunks/progressBar.DcG-X-RY.js +1 -0
- package/chunks/spinner.B6R6yphw.js +1 -0
- package/chunks/spinner.oNNLX64f.js +105 -0
- package/chunks/stepper.ByKqsxhz.js +1 -0
- package/chunks/stepper.FT6nDHjL.js +18 -0
- package/chunks/switch.Dalf8ccu.js +1 -0
- package/chunks/switch.hUukrKTd.js +11 -0
- package/chunks/tabs.C7SBQq_R.js +1 -0
- package/chunks/tabs.CIfcdjPn.js +13 -0
- package/chunks/text.CW-ftgoP.js +1 -0
- package/chunks/text.DpbJhMDB.js +152 -0
- package/chunks/textArea.CmtmGm_y.js +22 -0
- package/chunks/textArea.DF76BVU5.js +1 -0
- package/chunks/toast.Bs1t4Urq.js +36 -0
- package/chunks/toast.C-h1RUq_.js +1 -0
- package/chunks/tooltip.D1fCHa9d.js +16 -0
- package/chunks/tooltip.DZTJP5dS.js +1 -0
- package/index.cjs.js +1 -0
- package/index.d.ts +3 -0
- package/index.es.js +164 -0
- package/lib/components/SegmentedControl.cjs.js +1 -0
- package/lib/components/SegmentedControl.d.ts +2 -0
- package/lib/components/SegmentedControl.es.js +5 -0
- package/lib/components/accordion.cjs.js +1 -0
- package/lib/components/accordion.d.ts +3 -0
- package/lib/components/accordion.es.js +6 -0
- package/lib/components/actionList.cjs.js +1 -0
- package/lib/components/actionList.d.ts +15 -0
- package/lib/components/actionList.es.js +13 -0
- package/lib/components/alert.cjs.js +1 -0
- package/lib/components/alert.d.ts +17 -0
- package/lib/components/alert.es.js +11 -0
- package/lib/components/aspectRatio.cjs.js +1 -0
- package/lib/components/aspectRatio.d.ts +16 -0
- package/lib/components/aspectRatio.es.js +14 -0
- package/lib/components/avatar.cjs.js +1 -0
- package/lib/components/avatar.d.ts +17 -0
- package/lib/components/avatar.es.js +23 -0
- package/lib/components/badge.cjs.js +1 -0
- package/lib/components/badge.d.ts +17 -0
- package/lib/components/badge.es.js +15 -0
- package/lib/components/badgeDot.cjs.js +1 -0
- package/lib/components/badgeDot.d.ts +6 -0
- package/lib/components/badgeDot.es.js +7 -0
- package/lib/components/box.cjs.js +1 -0
- package/lib/components/box.d.ts +82 -0
- package/lib/components/box.es.js +8 -0
- package/lib/components/button.cjs.js +1 -0
- package/lib/components/button.d.ts +36 -0
- package/lib/components/button.es.js +16 -0
- package/lib/components/card.cjs.js +1 -0
- package/lib/components/card.d.ts +22 -0
- package/lib/components/card.es.js +7 -0
- package/lib/components/chips.cjs.js +1 -0
- package/lib/components/chips.d.ts +5 -0
- package/lib/components/chips.es.js +7 -0
- package/lib/components/closeButton.cjs.js +1 -0
- package/lib/components/closeButton.d.ts +2 -0
- package/lib/components/closeButton.es.js +5 -0
- package/lib/components/dialog.cjs.js +1 -0
- package/lib/components/dialog.d.ts +5 -0
- package/lib/components/dialog.es.js +7 -0
- package/lib/components/divider.cjs.js +1 -0
- package/lib/components/divider.d.ts +30 -0
- package/lib/components/divider.es.js +9 -0
- package/lib/components/fileUpload.cjs.js +1 -0
- package/lib/components/fileUpload.d.ts +90 -0
- package/lib/components/fileUpload.es.js +22 -0
- package/lib/components/floatingui.cjs.js +1 -0
- package/lib/components/floatingui.d.ts +71 -0
- package/lib/components/floatingui.es.js +608 -0
- package/lib/components/form.cjs.js +1 -0
- package/lib/components/form.d.ts +69 -0
- package/lib/components/form.es.js +9 -0
- package/lib/components/helperText.cjs.js +1 -0
- package/lib/components/helperText.d.ts +4 -0
- package/lib/components/helperText.es.js +6 -0
- package/lib/components/icon.cjs.js +1 -0
- package/lib/components/icon.d.ts +6 -0
- package/lib/components/icon.es.js +7 -0
- package/lib/components/index.cjs.js +1 -0
- package/lib/components/index.d.ts +34 -0
- package/lib/components/index.es.js +70 -0
- package/lib/components/inputChoiceGroup.cjs.js +1 -0
- package/lib/components/inputChoiceGroup.d.ts +10 -0
- package/lib/components/inputChoiceGroup.es.js +5 -0
- package/lib/components/link.cjs.js +1 -0
- package/lib/components/link.d.ts +4 -0
- package/lib/components/link.es.js +6 -0
- package/lib/components/list.cjs.js +1 -0
- package/lib/components/list.d.ts +14 -0
- package/lib/components/list.es.js +10 -0
- package/lib/components/logo.cjs.js +1 -0
- package/lib/components/logo.d.ts +5 -0
- package/lib/components/logo.es.js +6 -0
- package/lib/components/nativeSelect.cjs.js +1 -0
- package/lib/components/nativeSelect.d.ts +5 -0
- package/lib/components/nativeSelect.es.js +7 -0
- package/lib/components/pageHeader.cjs.js +1 -0
- package/lib/components/pageHeader.d.ts +5 -0
- package/lib/components/pageHeader.es.js +5 -0
- package/lib/components/pagination.cjs.js +1 -0
- package/lib/components/pagination.d.ts +69 -0
- package/lib/components/pagination.es.js +13 -0
- package/lib/components/progressBar.cjs.js +1 -0
- package/lib/components/progressBar.d.ts +14 -0
- package/lib/components/progressBar.es.js +11 -0
- package/lib/components/spinner.cjs.js +1 -0
- package/lib/components/spinner.d.ts +82 -0
- package/lib/components/spinner.es.js +19 -0
- package/lib/components/stepper.cjs.js +1 -0
- package/lib/components/stepper.d.ts +12 -0
- package/lib/components/stepper.es.js +5 -0
- package/lib/components/switch.cjs.js +1 -0
- package/lib/components/switch.d.ts +3 -0
- package/lib/components/switch.es.js +6 -0
- package/lib/components/tabs.cjs.js +1 -0
- package/lib/components/tabs.d.ts +6 -0
- package/lib/components/tabs.es.js +7 -0
- package/lib/components/text.cjs.js +1 -0
- package/lib/components/text.d.ts +15 -0
- package/lib/components/text.es.js +13 -0
- package/lib/components/textArea.cjs.js +1 -0
- package/lib/components/textArea.d.ts +2 -0
- package/lib/components/textArea.es.js +4 -0
- package/lib/components/toast.cjs.js +1 -0
- package/lib/components/toast.d.ts +14 -0
- package/lib/components/toast.es.js +9 -0
- package/lib/components/tooltip.cjs.js +1 -0
- package/lib/components/tooltip.d.ts +2 -0
- package/lib/components/tooltip.es.js +5 -0
- package/lib/shared.cjs.js +1 -0
- package/lib/shared.d.ts +4 -0
- package/lib/shared.es.js +6 -0
- package/lib/utils/CSSLookup.cjs.js +1 -0
- package/lib/utils/CSSLookup.d.ts +84 -0
- package/lib/utils/CSSLookup.es.js +110 -0
- package/lib/utils/classNames.cjs.js +1 -0
- package/lib/utils/classNames.d.ts +9 -0
- package/lib/utils/classNames.es.js +18 -0
- package/lib/utils/constants.cjs.js +1 -0
- package/lib/utils/constants.d.ts +174 -0
- package/lib/utils/constants.es.js +151 -0
- package/lib/utils/dom.cjs.js +1 -0
- package/lib/utils/dom.d.ts +18 -0
- package/lib/utils/dom.es.js +34 -0
- package/lib/utils/helpers.cjs.js +1 -0
- package/lib/utils/helpers.d.ts +66 -0
- package/lib/utils/helpers.es.js +154 -0
- package/lib/utils/index.cjs.js +1 -0
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/index.es.js +94 -0
- package/lib/utils/overflow.cjs.js +1 -0
- package/lib/utils/overflow.d.ts +34 -0
- package/lib/utils/overflow.es.js +34 -0
- package/lib/utils/raf.cjs.js +1 -0
- package/lib/utils/raf.d.ts +8 -0
- package/lib/utils/raf.es.js +14 -0
- package/lib/utils/styles.cjs.js +1 -0
- package/lib/utils/styles.d.ts +1 -0
- package/lib/utils/styles.es.js +5 -0
- package/lib/utils/types.cjs.js +1 -0
- package/lib/utils/types.d.ts +6 -0
- package/lib/utils/types.es.js +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "../utils/constants.es.js";
|
|
2
|
+
import { a as i, o as t, h as l, j as o, n as r, d, e as n, p as m, m as c, g as p, i as u, k as F, c as g, l as v, s as S, b, u as f, v as h } from "../../chunks/fileUpload.BbSIsjJv.js";
|
|
3
|
+
export {
|
|
4
|
+
i as action,
|
|
5
|
+
t as addFiles,
|
|
6
|
+
l as convertBytesToFriendly,
|
|
7
|
+
o as createFileItem,
|
|
8
|
+
r as dismissFile,
|
|
9
|
+
d as dropzone,
|
|
10
|
+
n as error,
|
|
11
|
+
m as filesReducer,
|
|
12
|
+
c as generateThumbnail,
|
|
13
|
+
p as getFormData,
|
|
14
|
+
u as initialState,
|
|
15
|
+
F as kinds,
|
|
16
|
+
g as listItemStates,
|
|
17
|
+
v as listSizes,
|
|
18
|
+
S as success,
|
|
19
|
+
b as uploaded,
|
|
20
|
+
f as uploading,
|
|
21
|
+
h as validateFile
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const et=["top","right","bottom","left"],K=["start","end"],N=et.reduce((t,e)=>t.concat(e,e+"-"+K[0],e+"-"+K[1]),[]),W=Math.min,ft=Math.max,ut={left:"right",right:"left",bottom:"top",top:"bottom"},dt={start:"end",end:"start"};function Y(t,e,s){return ft(t,W(e,s))}function H(t,e){return typeof t=="function"?t(e):t}function C(t){return t.split("-")[0]}function M(t){return t.split("-")[1]}function q(t){return t==="x"?"y":"x"}function nt(t){return t==="y"?"height":"width"}function V(t){return["top","bottom"].includes(C(t))?"y":"x"}function ot(t){return q(V(t))}function it(t,e,s){s===void 0&&(s=!1);const r=M(t),i=ot(t),n=nt(i);let o=i==="x"?r===(s?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(o=_(o)),[o,_(o)]}function mt(t){const e=_(t);return[X(t),e,X(e)]}function X(t){return t.replace(/start|end/g,e=>dt[e])}function gt(t,e,s){const r=["left","right"],i=["right","left"],n=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return s?e?i:r:e?r:i;case"left":case"right":return e?n:o;default:return[]}}function pt(t,e,s,r){const i=M(t);let n=gt(C(t),s==="start",r);return i&&(n=n.map(o=>o+"-"+i),e&&(n=n.concat(n.map(X)))),n}function _(t){return t.replace(/left|right|bottom|top/g,e=>ut[e])}function xt(t){return{top:0,right:0,bottom:0,left:0,...t}}function st(t){return typeof t!="number"?xt(t):{top:t,right:t,bottom:t,left:t}}function Q(t){const{x:e,y:s,width:r,height:i}=t;return{width:r,height:i,top:s,left:e,right:e+r,bottom:s+i,x:e,y:s}}async function I(t,e){var s;e===void 0&&(e={});const{x:r,y:i,platform:n,rects:o,elements:c,strategy:u}=t,{boundary:w="clippingAncestors",rootBoundary:p="viewport",elementContext:l="floating",altBoundary:d=!1,padding:a=0}=H(e,t),m=st(a),f=c[d?l==="floating"?"reference":"floating":l],g=Q(await n.getClippingRect({element:(s=await(n.isElement==null?void 0:n.isElement(f)))==null||s?f:f.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(c.floating)),boundary:w,rootBoundary:p,strategy:u})),h=l==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,y=await(n.getOffsetParent==null?void 0:n.getOffsetParent(c.floating)),A=await(n.isElement==null?void 0:n.isElement(y))?await(n.getScale==null?void 0:n.getScale(y))||{x:1,y:1}:{x:1,y:1},b=Q(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:h,offsetParent:y,strategy:u}):h);return{top:(g.top-b.top+m.top)/A.y,bottom:(b.bottom-g.bottom+m.bottom)/A.y,left:(g.left-b.left+m.left)/A.x,right:(b.right-g.right+m.right)/A.x}}function ht(t,e,s){return(t?[...s.filter(i=>M(i)===t),...s.filter(i=>M(i)!==t)]:s.filter(i=>C(i)===i)).filter(i=>t?M(i)===t||(e?X(i)!==i:!1):!0)}const wt=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var s,r,i;const{rects:n,middlewareData:o,placement:c,platform:u,elements:w}=e,{crossAxis:p=!1,alignment:l,allowedPlacements:d=N,autoAlignment:a=!0,...m}=H(t,e),v=l!==void 0||d===N?ht(l||null,a,d):d,f=await I(e,m),g=((s=o.autoPlacement)==null?void 0:s.index)||0,h=v[g];if(h==null)return{};const y=it(h,n,await(u.isRTL==null?void 0:u.isRTL(w.floating)));if(c!==h)return{reset:{placement:v[0]}};const A=[f[C(h)],f[y[0]],f[y[1]]],b=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:h,overflows:A}],j=v[g+1];if(j)return{data:{index:g+1,overflows:b},reset:{placement:j}};const F=b.map(x=>{const P=M(x.placement);return[x.placement,P&&p?x.overflows.slice(0,2).reduce((B,T)=>B+T,0):x.overflows[0],x.overflows]}).sort((x,P)=>x[1]-P[1]),D=((i=F.filter(x=>x[2].slice(0,M(x[0])?2:3).every(P=>P<=0))[0])==null?void 0:i[0])||F[0][0];return D!==c?{data:{index:g+1,overflows:b},reset:{placement:D}}:{}}}},vt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var s,r;const{placement:i,middlewareData:n,rects:o,initialPlacement:c,platform:u,elements:w}=e,{mainAxis:p=!0,crossAxis:l=!0,fallbackPlacements:d,fallbackStrategy:a="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...f}=H(t,e);if((s=n.arrow)!=null&&s.alignmentOffset)return{};const g=C(i),h=V(c),y=C(c)===c,A=await(u.isRTL==null?void 0:u.isRTL(w.floating)),b=d||(y||!v?[_(c)]:mt(c)),j=m!=="none";!d&&j&&b.push(...pt(c,v,m,A));const F=[c,...b],S=await I(e,f),D=[];let x=((r=n.flip)==null?void 0:r.overflows)||[];if(p&&D.push(S[g]),l){const R=it(i,o,A);D.push(S[R[0]],S[R[1]])}if(x=[...x,{placement:i,overflows:D}],!D.every(R=>R<=0)){var P,B;const R=(((P=n.flip)==null?void 0:P.index)||0)+1,E=F[R];if(E)return{data:{index:R,overflows:x},reset:{placement:E}};let L=(B=x.filter(k=>k.overflows[0]<=0).sort((k,$)=>k.overflows[1]-$.overflows[1])[0])==null?void 0:B.placement;if(!L)switch(a){case"bestFit":{var T;const k=(T=x.filter($=>{if(j){const O=V($.placement);return O===h||O==="y"}return!0}).map($=>[$.placement,$.overflows.filter(O=>O>0).reduce((O,z)=>O+z,0)]).sort(($,O)=>$[1]-O[1])[0])==null?void 0:T[0];k&&(L=k);break}case"initialPlacement":L=c;break}if(i!==L)return{reset:{placement:L}}}return{}}}};function Z(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function tt(t){return et.some(e=>t[e]>=0)}const yt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:s}=e,{strategy:r="referenceHidden",...i}=H(t,e);switch(r){case"referenceHidden":{const n=await I(e,{...i,elementContext:"reference"}),o=Z(n,s.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:tt(o)}}}case"escaped":{const n=await I(e,{...i,altBoundary:!0}),o=Z(n,s.floating);return{data:{escapedOffsets:o,escaped:tt(o)}}}default:return{}}}}};async function bt(t,e){const{placement:s,platform:r,elements:i}=t,n=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=C(s),c=M(s),u=V(s)==="y",w=["left","top"].includes(o)?-1:1,p=n&&u?-1:1,l=H(e,t);let{mainAxis:d,crossAxis:a,alignmentAxis:m}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return c&&typeof m=="number"&&(a=c==="end"?m*-1:m),u?{x:a*p,y:d*w}:{x:d*w,y:a*p}}const At=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var s,r;const{x:i,y:n,placement:o,middlewareData:c}=e,u=await bt(e,t);return o===((s=c.offset)==null?void 0:s.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:n+u.y,data:{...u,placement:o}}}}},Pt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:s,y:r,placement:i}=e,{mainAxis:n=!0,crossAxis:o=!1,limiter:c={fn:f=>{let{x:g,y:h}=f;return{x:g,y:h}}},...u}=H(t,e),w={x:s,y:r},p=await I(e,u),l=V(C(i)),d=q(l);let a=w[d],m=w[l];if(n){const f=d==="y"?"top":"left",g=d==="y"?"bottom":"right",h=a+p[f],y=a-p[g];a=Y(h,a,y)}if(o){const f=l==="y"?"top":"left",g=l==="y"?"bottom":"right",h=m+p[f],y=m-p[g];m=Y(h,m,y)}const v=c.fn({...e,[d]:a,[l]:m});return{...v,data:{x:v.x-s,y:v.y-r,enabled:{[d]:n,[l]:o}}}}}},Ot=At,St=wt,Rt=Pt,$t=vt,Ct=yt,Dt=t=>{var e;return{visibility:(e=t.hide)!=null&&e.referenceHidden?"hidden":"visible"}},rt=t=>({name:"arrowStyles",options:t,async fn(e){var G,J;const{x:s,y:r,placement:i,rects:n,platform:o,elements:c,middlewareData:u}=e,{element:w,padding:p=0}=H(t,e)||{};if(w==null)return{};const l=st(p),d={x:s,y:r},a=ot(i),m=q(a),v=nt(a),f=await o.getDimensions(w),g=a==="y",h=g?"top":"left",y=g?"bottom":"right",A=g?"clientHeight":"clientWidth",b=n.reference[v]+n.reference[a]-d[a]-n.floating[v],j=d[a]-n.reference[a],F=await((G=o.getOffsetParent)==null?void 0:G.call(o,w));let S=F?F[A]:0;(!S||!await((J=o.isElement)==null?void 0:J.call(o,F)))&&(S=c.floating[A]||n.floating[v]);const D=b/2-j/2,x=S/2-f.width/2-1,P=W(l[h],x),B=W(l[y],x),T=P,R=S-f.width-B,E=S/2-f.width/2+D,L=Y(T,E,R),k=!u.arrow&&M(i)!=null&&E!==L&&n.reference[v]/2-(E<T?P:B)-f.width/2<0,$=k?E<T?E-T:E-R:0,O=C(i),z=["top","left"].includes(O)?-1:1,lt=f.height*z,at=ct({placement:O,arrowHeight:f.height,arrowWidth:f.width,[a]:L});return{[a]:d[a]+$,[m]:d[m]+lt,data:at,reset:k}}}),U=(t,e,s,r)=>{if(r){const i=r===!0?s():s(r);t[e](i)}},Tt=({baseConfig:t,middleware:e,offset:s,arrow:r,placement:i="top"})=>{const n={...t,placement:i};let o=[];if(typeof e.overrides!="object"){o.push(Ot(s));let c=e.flip??!0;e.autoPlacement&&(c=!1),U(o,"unshift",St,e.autoPlacement),U(o,"push",Rt,e.shift??!0),U(o,"unshift",$t,c),U(o,"push",Ct,e.hide??!0)}else o.push(...e.overrides);return r.hide||o.push(rt(r.options)),typeof e.overrides=="function"&&(o=e.overrides(o)),n.middleware=o,n},ct=({placement:t,arrowHeight:e,arrowWidth:s,x:r,y:i})=>{const n=C(t),o=s/2-e,c={top:"rotate(0deg)",bottom:"rotate(180deg)",left:`rotate(-90deg) translateX(${-o}px)`,right:`rotate(90deg) translateX(${o}px)`}[n],u=-s/2-e,w={top:`${-e}px`,bottom:`${-e*2}px`,left:`${u}px`,right:`${u}px`}[n],p={transform:c};p.left=r!=null?`${r}px`:"",p.top=i!=null?`${i}px`:"";const l=_(n);return p[l]=w,p};exports.arrowMiddleware=rt;exports.arrowStyles=ct;exports.buildFloatingUIConfig=Tt;exports.visibilityHandler=Dt;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { MiddlewareData, ArrowOptions, AutoPlacementOptions, ComputePositionConfig, FlipOptions, HideOptions, Middleware, MiddlewareState, OffsetOptions, Placement, ShiftOptions } from '@floating-ui/dom';
|
|
2
|
+
import { CSSObject } from '../utils/types';
|
|
3
|
+
/**
|
|
4
|
+
* Function option to derive middleware options from state.
|
|
5
|
+
*/
|
|
6
|
+
type Derivable<T> = (state: MiddlewareState) => T;
|
|
7
|
+
/**
|
|
8
|
+
* Returns a styling object to set the visibility of the floating element based
|
|
9
|
+
* on middleware data
|
|
10
|
+
*
|
|
11
|
+
* @param middleware
|
|
12
|
+
*/
|
|
13
|
+
export declare const visibilityHandler: (middleware: MiddlewareData) => CSSObject;
|
|
14
|
+
/**
|
|
15
|
+
* Provides data to position an inner element of the floating element so that it
|
|
16
|
+
* appears centered to the reference element.
|
|
17
|
+
* @see https://floating-ui.com/docs/arrow
|
|
18
|
+
*/
|
|
19
|
+
export declare const arrowMiddleware: (options: ArrowOptions | Derivable<ArrowOptions>) => Middleware;
|
|
20
|
+
export type MiddlewareModifier = Middleware[] | ((middleware: Middleware[]) => Middleware[]);
|
|
21
|
+
export interface FloatingUIConfigArgs {
|
|
22
|
+
baseConfig: Partial<ComputePositionConfig>;
|
|
23
|
+
middleware: {
|
|
24
|
+
overrides?: MiddlewareModifier;
|
|
25
|
+
autoPlacement?: boolean | AutoPlacementOptions;
|
|
26
|
+
flip?: boolean | FlipOptions;
|
|
27
|
+
hide?: boolean | HideOptions;
|
|
28
|
+
shift?: boolean | ShiftOptions;
|
|
29
|
+
};
|
|
30
|
+
arrow: {
|
|
31
|
+
options: ArrowOptions;
|
|
32
|
+
hide: boolean;
|
|
33
|
+
};
|
|
34
|
+
placement?: Placement;
|
|
35
|
+
offset: OffsetOptions;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Build a configuration to pass to floating-ui's computePosition or useFloating hook.
|
|
39
|
+
*
|
|
40
|
+
* If autoPlacement is specified, flip is automatically disabled.
|
|
41
|
+
* Default behavior such as `placement=top` is assigned here.
|
|
42
|
+
*
|
|
43
|
+
* @param baseConfig
|
|
44
|
+
* @param middleware
|
|
45
|
+
* @param offsetOptions
|
|
46
|
+
* @param arrow
|
|
47
|
+
* @param placement
|
|
48
|
+
*/
|
|
49
|
+
export declare const buildFloatingUIConfig: ({ baseConfig, middleware, offset: offsetOptions, arrow, placement, }: FloatingUIConfigArgs) => {
|
|
50
|
+
placement?: Placement | undefined;
|
|
51
|
+
strategy?: import('@floating-ui/utils').Strategy | undefined;
|
|
52
|
+
middleware?: Array<Middleware | null | undefined | false> | undefined;
|
|
53
|
+
platform?: import('@floating-ui/dom').Platform | undefined;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Generate styles for an arrow based on the tooltip placement and arrow dimensions.
|
|
57
|
+
*
|
|
58
|
+
* @param placement - the placement of the tooltip relative to the anchor
|
|
59
|
+
* @param arrowHeight - the height of the arrow
|
|
60
|
+
* @param arrowWidth - the width of the arrow
|
|
61
|
+
* @param x - optional x position, calculated from arrow middleware
|
|
62
|
+
* @param y - optional y position, calculated from arrow middleware
|
|
63
|
+
*/
|
|
64
|
+
export declare const arrowStyles: ({ placement, arrowHeight, arrowWidth, x, y, }: {
|
|
65
|
+
x?: number;
|
|
66
|
+
y?: number;
|
|
67
|
+
placement: Placement;
|
|
68
|
+
arrowHeight: number;
|
|
69
|
+
arrowWidth: number;
|
|
70
|
+
}) => Partial<CSSStyleDeclaration>;
|
|
71
|
+
export {};
|