@viasat/beam-react 2.11.0 → 2.13.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.
Files changed (44) hide show
  1. package/assets/panel.css +1 -1
  2. package/chunks/FloatingUI.context.B15Tz_4h.js +1 -0
  3. package/chunks/{FloatingUI.context.DtJA57si.js → FloatingUI.context.Dl4Y1y1z.js} +105 -103
  4. package/lib/Dialog/Dialog.Header.cjs.js +1 -1
  5. package/lib/Dialog/Dialog.Header.es.js +1 -1
  6. package/lib/Dialog/Dialog.Trigger.cjs.js +1 -1
  7. package/lib/Dialog/Dialog.Trigger.es.js +1 -1
  8. package/lib/FloatingUI/FloatingUI.content.cjs.js +1 -1
  9. package/lib/FloatingUI/FloatingUI.content.es.js +1 -1
  10. package/lib/FloatingUI/FloatingUI.context.cjs.js +1 -1
  11. package/lib/FloatingUI/FloatingUI.context.d.ts +6 -2
  12. package/lib/FloatingUI/FloatingUI.context.es.js +1 -1
  13. package/lib/FloatingUI/FloatingUI.interactions.cjs.js +1 -1
  14. package/lib/FloatingUI/FloatingUI.interactions.d.ts +3 -2
  15. package/lib/FloatingUI/FloatingUI.interactions.es.js +16 -15
  16. package/lib/FloatingUI/FloatingUI.root.cjs.js +1 -1
  17. package/lib/FloatingUI/FloatingUI.root.es.js +1 -1
  18. package/lib/FloatingUI/FloatingUI.trigger.cjs.js +1 -1
  19. package/lib/FloatingUI/FloatingUI.trigger.close.cjs.js +1 -1
  20. package/lib/FloatingUI/FloatingUI.trigger.close.es.js +1 -1
  21. package/lib/FloatingUI/FloatingUI.trigger.es.js +1 -1
  22. package/lib/Menu/ActionListContextWrapper.cjs.js +1 -1
  23. package/lib/Menu/ActionListContextWrapper.es.js +1 -1
  24. package/lib/Popover/Popover.content.cjs.js +1 -1
  25. package/lib/Popover/Popover.content.es.js +1 -1
  26. package/lib/Popover/Popover.trigger.cjs.js +1 -1
  27. package/lib/Popover/Popover.trigger.es.js +1 -1
  28. package/lib/Tooltip/Tooltip.cjs.js +1 -1
  29. package/lib/Tooltip/Tooltip.es.js +1 -1
  30. package/lib/wip/Panel/Panel.Inline.cjs.js +1 -0
  31. package/lib/wip/Panel/Panel.Inline.d.ts +21 -0
  32. package/lib/wip/Panel/Panel.Inline.es.js +93 -0
  33. package/lib/wip/Panel/Panel.Overlay.cjs.js +1 -0
  34. package/lib/wip/Panel/Panel.Overlay.d.ts +17 -0
  35. package/lib/wip/Panel/Panel.Overlay.es.js +54 -0
  36. package/lib/wip/Panel/Panel.cjs.js +1 -1
  37. package/lib/wip/Panel/Panel.d.ts +1 -1
  38. package/lib/wip/Panel/Panel.es.js +81 -109
  39. package/lib/wip/Panel/Panel.helpers.cjs.js +1 -1
  40. package/lib/wip/Panel/Panel.helpers.d.ts +1 -5
  41. package/lib/wip/Panel/Panel.helpers.es.js +27 -50
  42. package/lib/wip/Panel/Panel.types.d.ts +9 -2
  43. package/package.json +6 -6
  44. package/chunks/FloatingUI.context.Du9g2lSg.js +0 -1
@@ -19,7 +19,8 @@ interface BasePanelProps extends ComponentPropsWithoutRef<'aside'> {
19
19
  */
20
20
  children: React.ReactNode;
21
21
  /**
22
- * Specify if the Panel is open (controlled)
22
+ * Controls the Panel's visibility. For inline panels, omitting this prop
23
+ * renders the panel as always-visible (uncontrolled).
23
24
  */
24
25
  open?: boolean;
25
26
  /**
@@ -72,6 +73,9 @@ interface BasePanelProps extends ComponentPropsWithoutRef<'aside'> {
72
73
  * by the parent; it only fires for UI-triggered close events (close button, Escape
73
74
  * key, or outside press).
74
75
  *
76
+ * When `modalType="alert"`, `'escapeKey'` and `'outsidePress'` reasons are
77
+ * suppressed entirely — this callback will not be invoked for those reasons.
78
+ *
75
79
  * @example
76
80
  * ```tsx
77
81
  * // Use a stateful confirmation dialog — avoid window.confirm (blocking, breaks iframes).
@@ -94,6 +98,7 @@ export interface InlinePanelProps extends BasePanelProps {
94
98
  * Specify the Panel as inline
95
99
  */
96
100
  kind?: 'inline';
101
+ modalType?: never;
97
102
  }
98
103
  export interface OverlayPanelProps extends BasePanelProps {
99
104
  /**
@@ -101,7 +106,9 @@ export interface OverlayPanelProps extends BasePanelProps {
101
106
  */
102
107
  kind: 'overlay';
103
108
  /**
104
- * Specify the modal type (overlay only)
109
+ * Specify the modal type (overlay only).
110
+ * When set to `'alert'`, the close button is always hidden regardless of the
111
+ * `dismissible` prop, and ESC / backdrop clicks are suppressed.
105
112
  * @default 'nonModal'
106
113
  */
107
114
  modalType?: PanelModalType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-react",
3
- "version": "2.11.0",
3
+ "version": "2.13.0",
4
4
  "description": "React component library for the Beam design system",
5
5
  "license": "MIT",
6
6
  "author": "Viasat",
@@ -59,11 +59,11 @@
59
59
  "access": "public"
60
60
  },
61
61
  "dependencies": {
62
- "@viasat/beam-fonts": "2.11.0",
63
- "@viasat/beam-shared": "2.11.0",
64
- "@viasat/beam-styles": "2.11.0",
65
- "@viasat/beam-tokens": "2.11.0",
66
- "@viasat/beam-icons": "2.11.0",
62
+ "@viasat/beam-fonts": "2.13.0",
63
+ "@viasat/beam-shared": "2.13.0",
64
+ "@viasat/beam-styles": "2.13.0",
65
+ "@viasat/beam-tokens": "2.13.0",
66
+ "@viasat/beam-icons": "2.13.0",
67
67
  "clsx": "^1.2.1",
68
68
  "@floating-ui/react": "^0.26.18",
69
69
  "@stepperize/react": "^5.1.5",
@@ -1 +0,0 @@
1
- "use strict";const h=require("react"),F=require("@floating-ui/dom"),X=require("@floating-ui/react"),J=require("../lib/FloatingUI/FloatingUI.interactions.cjs.js"),G=Math.min,K=Math.max,Q={left:"right",right:"left",bottom:"top",top:"bottom"};function Z(t,e,i){return K(t,G(e,i))}function w(t,e){return typeof t=="function"?t(e):t}function T(t){return t.split("-")[0]}function tt(t){return t.split("-")[1]}function Y(t){return t==="x"?"y":"x"}function et(t){return t==="y"?"height":"width"}function nt(t){return["top","bottom"].includes(T(t))?"y":"x"}function ot(t){return Y(nt(t))}function st(t){return t.replace(/left|right|bottom|top/g,e=>Q[e])}function it(t){return{top:0,right:0,bottom:0,left:0,...t}}function ct(t){return typeof t!="number"?it(t):{top:t,right:t,bottom:t,left:t}}const lt=16,rt=t=>{var e;return{visibility:(e=t.hide)!=null&&e.referenceHidden?"hidden":"visible"}},ut=t=>({name:"arrowStyles",options:t,async fn(e){var V,W;const{x:i,y:c,placement:r,rects:s,platform:n,elements:g,middlewareData:p}=e,{element:f,padding:a=0}=w(t,e)||{};if(f==null)return{};const y=ct(a),m={x:i,y:c},l=ot(r),U=Y(l),x=et(l),d=await n.getDimensions(f),A=l==="y",o=A?"top":"left",j=A?"bottom":"right",C=A?"clientHeight":"clientWidth",_=s.reference[x]+s.reference[l]-m[l]-s.floating[x],B=m[l]-s.reference[l],$=await((V=n.getOffsetParent)==null?void 0:V.call(n,f));let b=$?$[C]:0;(!b||!await((W=n.isElement)==null?void 0:W.call(n,$)))&&(b=g.floating[C]||s.floating[x]);const M=_/2-B/2,v=b/2-d.width/2-1,D=G(y[o],v),E=G(y[j],v),O=D,z=b-d.width-E,u=b/2-d.width/2+M,P=Z(O,u,z),I=!p.arrow&&tt(r)!=null&&u!==P&&s.reference[x]/2-(u<O?D:E)-d.width/2<0,H=I?u<O?u-O:u-z:0,S=T(r),L=["top","left"].includes(S)?-1:1,q=d.height*L,N=at({placement:S,arrowHeight:d.height,arrowWidth:d.width,[l]:P});return{[l]:m[l]+H,[U]:m[U]+q,data:N,reset:I}}}),R=(t,e,i,c)=>{if(c){const r=c===!0?i():i(c);t[e](r)}},ft=({baseConfig:t,middleware:e,offset:i,arrow:c,placement:r="top"})=>{const s={...t,placement:r};let n=[];if(typeof e.overrides!="object"){n.push(F.offset(i));let g=e.flip??!0;if(e.autoPlacement&&(g=!1),R(n,"unshift",F.autoPlacement,e.autoPlacement),R(n,"unshift",F.flip,g),e.size){const p=e.size===!0?{padding:lt,apply({availableHeight:f,elements:a}){Object.assign(a.floating.style,{maxHeight:`${f}px`})}}:e.size;n.push(F.size(p))}R(n,"push",F.shift,e.shift??!0),R(n,"push",F.hide,e.hide??!0)}else n.push(...e.overrides);return c.hide||n.push(ut(c.options)),typeof e.overrides=="function"&&(n=e.overrides(n)),s.middleware=n,s},at=({placement:t,arrowHeight:e,arrowWidth:i,x:c,y:r})=>{const s=T(t),n=i/2-e,g={top:"rotate(0deg)",bottom:"rotate(180deg)",left:`rotate(-90deg) translateX(${-n}px)`,right:`rotate(90deg) translateX(${n}px)`}[s],p=-i/2-e,f={top:`${-e}px`,bottom:`${-e*2}px`,left:`${p}px`,right:`${p}px`}[s],a={transform:g};a.left=c!=null?`${c}px`:"",a.top=r!=null?`${r}px`:"";const y=st(s);return a[y]=f,a},dt=({defaultOpen:t=!1,open:e,placement:i="top",offset:c,onOpenChange:r,openOnClick:s,openOnHover:n,openOnFocus:g,openOnSelected:p,focusConfiguration:f,listNavigation:a,typeahead:y,middleware:m,autoPlacement:l,flip:U=!0,shift:x=!0,autoHiding:d,size:A,arrow:o,transitionConfig:j,portalled:C,role:_,rootContext:B})=>{const[$,b]=h.useState(t),[M,v]=h.useState(),[D,E]=h.useState(),[O,z]=h.useState(null),u=e??$,P=r??b,I=X.useFloatingNodeId(),H=h.useMemo(()=>{const N={open:u,onOpenChange:P,whileElementsMounted:X.autoUpdate,nodeId:I,rootContext:B};return{...ft({baseConfig:N,middleware:{overrides:m,autoPlacement:l,flip:U,shift:x,hide:d,size:A},arrow:{hide:(o==null?void 0:o.hide)??!1,options:{element:O||null,padding:o==null?void 0:o.edgePadding}},placement:i,offset:c??0})}},[I,u,P,m,l,U,x,d,A,o==null?void 0:o.hide,o==null?void 0:o.edgePadding,O,i,c,B]),S=X.useFloating(H),L=S.context,q=J.useConfigurableInteractions({context:L,openOnClick:s,openOnHover:n,openOnFocus:g,openOnSelected:p,role:_,listNavigation:a,typeahead:y});return h.useMemo(()=>({open:u,setOpen:P,...q,...S,portalled:C,focusConfiguration:f,transitionConfig:j,labelId:M,descriptionId:D,arrow:o,setLabelId:v,setDescriptionId:E,setArrowEl:z,nodeId:I}),[u,P,q,S,C,f,j,M,D,o,I])},k=h.createContext(null),gt=()=>{const t=h.useContext(k);if(t==null)throw new Error("FloatingUI components must be wrapped in <FloatingUI />");return t};exports.BmFloatingUIContext=k;exports.useBmFloatingUI=dt;exports.useBmFloatingUIContext=gt;exports.visibilityHandler=rt;