@viasat/beam-react 2.9.0 → 2.10.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 (208) hide show
  1. package/assets/ActionList.css +1 -1
  2. package/assets/{Search.Results.css → Search.css} +1 -1
  3. package/chunks/{ActionList.Group.C2R56u2A.js → ActionList.Group.Bw5vZpeb.js} +1 -1
  4. package/chunks/{ActionList.Group.B4PX5SKS.js → ActionList.Group.CUHMD8Oo.js} +3 -3
  5. package/chunks/ActionList.Item.CxvNhTRB.js +188 -0
  6. package/chunks/ActionList.Item.YxZyttjT.js +1 -0
  7. package/chunks/{Avatar.C9tpC3sT.js → Avatar.C-4xc2_q.js} +3 -3
  8. package/chunks/{BreadcrumbsItem.CPJ-ECZa.js → BreadcrumbsItem.fDLMzx4K.js} +3 -3
  9. package/chunks/{CSSLookup.Cjf6o2Gz.js → CSSLookup.DOOy1rxJ.js} +1 -1
  10. package/chunks/Search.Results.DBQWuhZu.js +1 -0
  11. package/chunks/Search.Results.DR20Rl2x.js +66 -0
  12. package/chunks/{SpinnerWrap.DI2J26ka.js → SpinnerWrap.DWZk-Vfo.js} +4 -4
  13. package/chunks/{ToastContext.DzKCvrgk.js → ToastContext.CYGy7l7R.js} +1 -1
  14. package/chunks/{classNames.DNsS4J__.js → classNames.BTJmrO_L.js} +2 -2
  15. package/chunks/{constants.BBi77pmH.js → constants.CKKGf1-i.js} +5 -5
  16. package/chunks/{form.context.CfsTSQpm.js → form.context.BhylRiG2.js} +2 -2
  17. package/chunks/{helpers.Wv7n4ip7.js → helpers.CPNYYxrE.js} +1 -1
  18. package/index.es.js +3 -3
  19. package/lib/Accordion/Accordion.es.js +1 -1
  20. package/lib/Accordion/AccordionGroup.es.js +1 -1
  21. package/lib/ActionList/ActionList.Group.cjs.js +1 -1
  22. package/lib/ActionList/ActionList.Group.es.js +4 -4
  23. package/lib/ActionList/ActionList.IconButton.cjs.js +1 -1
  24. package/lib/ActionList/ActionList.IconButton.es.js +3 -3
  25. package/lib/ActionList/ActionList.Item.cjs.js +1 -1
  26. package/lib/ActionList/ActionList.Item.d.ts +18 -7
  27. package/lib/ActionList/ActionList.Item.es.js +4 -4
  28. package/lib/ActionList/ActionList.cjs.js +1 -1
  29. package/lib/ActionList/ActionList.d.ts +1 -1
  30. package/lib/ActionList/ActionList.es.js +5 -5
  31. package/lib/ActionList/useActionListChildren.cjs.js +1 -1
  32. package/lib/ActionList/useActionListChildren.es.js +2 -2
  33. package/lib/Alert/Alert.es.js +4 -4
  34. package/lib/Autocomplete/Autocomplete.cjs.js +1 -1
  35. package/lib/Autocomplete/Autocomplete.es.js +6 -6
  36. package/lib/Autocomplete/AutocompleteDropdown.es.js +3 -3
  37. package/lib/Autocomplete/AutocompleteField.es.js +2 -2
  38. package/lib/Autocomplete/useAutocompleteA11y.es.js +1 -1
  39. package/lib/Autocomplete/useAutocompleteDropdown.es.js +1 -1
  40. package/lib/Avatar/Avatar.es.js +1 -1
  41. package/lib/Avatar/AvatarGroup.es.js +3 -3
  42. package/lib/Avatar/index.es.js +1 -1
  43. package/lib/Badge/Badge.es.js +2 -2
  44. package/lib/BadgeDot/BadgeDot.es.js +2 -2
  45. package/lib/Box/Box.es.js +4 -4
  46. package/lib/Breadcrumbs/Breadcrumbs.es.js +3 -3
  47. package/lib/Breadcrumbs/BreadcrumbsItem.es.js +2 -2
  48. package/lib/Breadcrumbs/index.es.js +1 -1
  49. package/lib/Button/Button.es.js +3 -3
  50. package/lib/Card/AspectRatio.es.js +2 -2
  51. package/lib/Card/Card.Body.es.js +2 -2
  52. package/lib/Card/Card.Content.es.js +2 -2
  53. package/lib/Card/Card.Footer.es.js +2 -2
  54. package/lib/Card/Card.Header.es.js +2 -2
  55. package/lib/Card/Card.Media.es.js +2 -2
  56. package/lib/Card/Card.es.js +3 -3
  57. package/lib/Card/CardGroup.es.js +3 -3
  58. package/lib/Checkbox/Checkbox.es.js +3 -3
  59. package/lib/Chips/Chip.es.js +2 -2
  60. package/lib/Chips/ChipGroup.es.js +2 -2
  61. package/lib/CloseButton/CloseButton.es.js +2 -2
  62. package/lib/Dialog/Dialog.Body.es.js +2 -2
  63. package/lib/Dialog/Dialog.Content.es.js +2 -2
  64. package/lib/Dialog/Dialog.Footer.es.js +1 -1
  65. package/lib/Dialog/Dialog.Header.es.js +2 -2
  66. package/lib/Divider/Divider.es.js +2 -2
  67. package/lib/EmptyState/EmptyState.es.js +3 -3
  68. package/lib/FileUpload/FileUpload.Button.es.js +2 -2
  69. package/lib/FileUpload/FileUpload.Dropzone.es.js +2 -2
  70. package/lib/FileUpload/FileUpload.List.Item.es.js +3 -3
  71. package/lib/FileUpload/FileUpload.List.es.js +2 -2
  72. package/lib/FileUpload/FileUpload.es.js +3 -3
  73. package/lib/FileUpload/useFileManagement.es.js +1 -1
  74. package/lib/Flag/Flag.es.js +2 -2
  75. package/lib/FloatingUI/FloatingUI.arrow.es.js +2 -2
  76. package/lib/FloatingUI/FloatingUI.content.es.js +2 -2
  77. package/lib/FloatingUI/index.cjs.js +1 -1
  78. package/lib/FloatingUI/index.es.js +6 -6
  79. package/lib/Form/Form.es.js +2 -2
  80. package/lib/Form/contexts/form.context.es.js +2 -2
  81. package/lib/Form/contexts/index.es.js +1 -1
  82. package/lib/Form/hooks/index.es.js +1 -1
  83. package/lib/Form/hooks/useAccessibleId.hook.es.js +1 -1
  84. package/lib/Form/hooks/useFieldValidator.hook.es.js +1 -1
  85. package/lib/Header/Header.es.js +2 -2
  86. package/lib/Header/HeaderActionGroup.es.js +2 -2
  87. package/lib/Header/HeaderMasthead.es.js +2 -2
  88. package/lib/Header/HeaderSideNavTrigger.es.js +2 -2
  89. package/lib/HelperText/HelperText.es.js +3 -3
  90. package/lib/HelperText/index.es.js +1 -1
  91. package/lib/Icon/Icon.es.js +2 -2
  92. package/lib/InputChoiceGroup/InputChoiceGroup.es.js +3 -3
  93. package/lib/Label/Label.es.js +3 -3
  94. package/lib/Link/Link.es.js +2 -2
  95. package/lib/List/List.Item.es.js +2 -2
  96. package/lib/List/List.es.js +2 -2
  97. package/lib/Logo/Logo.es.js +2 -2
  98. package/lib/Menu/Menu.PopoverContent.es.js +2 -2
  99. package/lib/NativeSelect/NativeSelect.es.js +4 -4
  100. package/lib/PageHeader/PageHeader.es.js +2 -2
  101. package/lib/PageLayout/PageLayout.es.js +2 -2
  102. package/lib/PageLayout/PageLayoutAside.es.js +2 -2
  103. package/lib/PageLayout/PageLayoutHeader.es.js +2 -2
  104. package/lib/PageLayout/PageLayoutMain.es.js +2 -2
  105. package/lib/Pagination/PageButton.es.js +2 -2
  106. package/lib/Pagination/Pagination.es.js +2 -2
  107. package/lib/Pagination/PaginationControls.es.js +1 -1
  108. package/lib/Pagination/Truncation.es.js +2 -2
  109. package/lib/Popover/Popover.content.es.js +2 -2
  110. package/lib/Popover/Popover.es.js +3 -3
  111. package/lib/Popover/Popover.utils.es.js +2 -2
  112. package/lib/ProgressBar/ProgressBar.es.js +3 -3
  113. package/lib/RadioButton/RadioButton.es.js +3 -3
  114. package/lib/SegmentedControl/SegmentedControl.Item.es.js +2 -2
  115. package/lib/SegmentedControl/SegmentedControl.List.es.js +2 -2
  116. package/lib/SegmentedControl/SegmentedControl.Panel.es.js +2 -2
  117. package/lib/SegmentedControl/SegmentedControl.es.js +2 -2
  118. package/lib/Select/Select.cjs.js +1 -1
  119. package/lib/Select/Select.es.js +5 -5
  120. package/lib/Select/SelectDropdown.es.js +3 -3
  121. package/lib/Select/SelectField.es.js +2 -2
  122. package/lib/Select/useSelectA11y.es.js +1 -1
  123. package/lib/SideNav/SideNav.es.js +2 -2
  124. package/lib/SideNav/SideNavActionListGroup.cjs.js +1 -1
  125. package/lib/SideNav/SideNavActionListGroup.es.js +3 -3
  126. package/lib/SideNav/SideNavActionListGroupHeading.es.js +2 -2
  127. package/lib/SideNav/SideNavActionListItem.cjs.js +1 -1
  128. package/lib/SideNav/SideNavActionListItem.es.js +3 -3
  129. package/lib/SideNav/SideNavActionListItemExpandable.cjs.js +1 -1
  130. package/lib/SideNav/SideNavActionListItemExpandable.es.js +3 -3
  131. package/lib/SideNav/SideNavActionListItemFlyout.cjs.js +1 -1
  132. package/lib/SideNav/SideNavActionListItemFlyout.es.js +1 -1
  133. package/lib/SideNav/SideNavBody.es.js +3 -3
  134. package/lib/SideNav/SideNavContext.es.js +2 -2
  135. package/lib/SideNav/SideNavFooter.es.js +2 -2
  136. package/lib/SideNav/SideNavHeader.es.js +2 -2
  137. package/lib/Slider/DualSlider.es.js +3 -3
  138. package/lib/Slider/SingleSlider.es.js +6 -6
  139. package/lib/Slider/Slider.Error.es.js +3 -3
  140. package/lib/Slider/Slider.TextField.es.js +2 -2
  141. package/lib/Slider/Slider.Thumb.es.js +4 -4
  142. package/lib/Slider/Slider.TickMarks.es.js +2 -2
  143. package/lib/Slider/Slider.ValueAxisLabels.es.js +2 -2
  144. package/lib/Slider/hooks/useSliderBase.es.js +2 -2
  145. package/lib/Spinner/Spinner.es.js +7 -7
  146. package/lib/Spinner/SpinnerWrap.es.js +1 -1
  147. package/lib/StateLayer/StateLayer.es.js +2 -2
  148. package/lib/Stepper/Stepper.Body.es.js +2 -2
  149. package/lib/Stepper/Stepper.Heading.es.js +2 -2
  150. package/lib/Stepper/Stepper.Marker.es.js +2 -2
  151. package/lib/Stepper/Stepper.Step.es.js +2 -2
  152. package/lib/Stepper/Stepper.es.js +2 -2
  153. package/lib/Switch/Switch.es.js +3 -3
  154. package/lib/Tabs/Tabs.Group.es.js +3 -3
  155. package/lib/Tabs/Tabs.Item.es.js +2 -2
  156. package/lib/Tabs/Tabs.Panel.es.js +2 -2
  157. package/lib/Tabs/Tabs.es.js +2 -2
  158. package/lib/Text/Text.es.js +2 -2
  159. package/lib/TextArea/TextArea.es.js +3 -3
  160. package/lib/TextField/TextField.es.js +3 -3
  161. package/lib/Toasts/Toast.es.js +4 -4
  162. package/lib/Toasts/ToastContainer.es.js +4 -4
  163. package/lib/Toasts/ToastContext.es.js +1 -1
  164. package/lib/Toasts/index.es.js +1 -1
  165. package/lib/Tooltip/Tooltip.es.js +3 -3
  166. package/lib/_Navigation/classes.es.js +2 -2
  167. package/lib/_Options/OptionChips.es.js +2 -2
  168. package/lib/_Options/useSelectValue.es.js +2 -2
  169. package/lib/index.es.js +3 -3
  170. package/lib/wip/Panel/Panel.Body.es.js +2 -2
  171. package/lib/wip/Panel/Panel.Footer.Actions.es.js +2 -2
  172. package/lib/wip/Panel/Panel.Footer.es.js +2 -2
  173. package/lib/wip/Panel/Panel.Header.ContentAfter.es.js +2 -2
  174. package/lib/wip/Panel/Panel.Header.ContentBefore.es.js +2 -2
  175. package/lib/wip/Panel/Panel.Header.Description.es.js +2 -2
  176. package/lib/wip/Panel/Panel.Header.Heading.es.js +2 -2
  177. package/lib/wip/Panel/Panel.Header.Row.es.js +2 -2
  178. package/lib/wip/Panel/Panel.Header.Subheader.es.js +2 -2
  179. package/lib/wip/Panel/Panel.Header.es.js +2 -2
  180. package/lib/wip/Panel/Panel.es.js +7 -7
  181. package/lib/wip/Search/Search.Results.Item.cjs.js +1 -1
  182. package/lib/wip/Search/Search.Results.Item.d.ts +8 -5
  183. package/lib/wip/Search/Search.Results.Item.es.js +8 -10
  184. package/lib/wip/Search/Search.Results.ViewAll.cjs.js +1 -0
  185. package/lib/wip/Search/Search.Results.ViewAll.d.ts +22 -0
  186. package/lib/wip/Search/Search.Results.ViewAll.es.js +11 -0
  187. package/lib/wip/Search/Search.Results.cjs.js +1 -1
  188. package/lib/wip/Search/Search.Results.d.ts +5 -2
  189. package/lib/wip/Search/Search.Results.es.js +12 -17
  190. package/lib/wip/Search/Search.cjs.js +1 -1
  191. package/lib/wip/Search/Search.es.js +114 -110
  192. package/lib/wip/Search/SearchDropdown.cjs.js +1 -1
  193. package/lib/wip/Search/SearchDropdown.d.ts +2 -3
  194. package/lib/wip/Search/SearchDropdown.es.js +45 -59
  195. package/lib/wip/Search/useSearchDropdown.cjs.js +1 -1
  196. package/lib/wip/Search/useSearchDropdown.d.ts +0 -18
  197. package/lib/wip/Search/useSearchDropdown.es.js +25 -25
  198. package/package.json +6 -6
  199. package/utils/hooks/index.es.js +3 -3
  200. package/utils/hooks/useElementResize.es.js +2 -2
  201. package/utils/hooks/useId.es.js +1 -1
  202. package/utils/hooks/useLocalStorage.es.js +2 -2
  203. package/utils/spacing.es.js +1 -1
  204. package/utils/theming/useBeamTheme.es.js +5 -5
  205. package/chunks/ActionList.Item.5Y-SwzjK.js +0 -1
  206. package/chunks/ActionList.Item.BFcT86lS.js +0 -187
  207. package/chunks/Search.Results.Item.CLmMBPz1.js +0 -41
  208. package/chunks/Search.Results.Item.Dkh2yo4p.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),le=require("../../../chunks/classNames.DAeKwerT.js"),oe=require("../../../chunks/constants.hwjHOsvT.js"),b=require("react"),r=require("../../../chunks/Search.Results.Item.Dkh2yo4p.js"),A=require("clsx"),ae=require("../../../chunks/form.context.B26th8Od.js"),ue=require("../../Form/contexts/label.context.cjs.js"),de=require("../../Form/contexts/helperText.context.cjs.js"),_e=require("../../Form/hooks/useUniversalRef.hook.cjs.js"),q=require("../../Form/hooks/useAccessibleId.hook.cjs.js"),pe=require("../../Icon/Icon.cjs.js"),fe=require("./Search.Results.cjs.js"),be=require("./useSearchDropdown.cjs.js"),he=require("./SearchDropdown.cjs.js"),me=require("../../ActionList/ActionList.cjs.js"),xe=require("../../../utils/hooks/useDebounced.cjs.js"),Se=require("../../../utils/hooks/useEffectAfterMount.cjs.js"),qe=require("../../Spinner/Spinner.cjs.js"),ye=require("../../CloseButton/CloseButton.cjs.js");function je(i){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const c in i)if(c!=="default"){const t=Object.getOwnPropertyDescriptor(i,c);Object.defineProperty(a,c,t.get?t:{enumerable:!0,get:()=>i[c]})}}return a.default=i,Object.freeze(a)}const T=je(b),Ie=i=>T.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},T.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.5 14H14.71L14.43 13.73C15.41 12.59 16 11.11 16 9.5C16 5.91 13.09 3 9.5 3C5.91 3 3 5.91 3 9.5C3 13.09 5.91 16 9.5 16C11.11 16 12.59 15.41 13.73 14.43L14 14.71V15.5L19 20.49L20.49 19L15.5 14ZM9.5 14C7.01 14 5 11.99 5 9.5C5 7.01 7.01 5 9.5 5C11.99 5 14 7.01 14 9.5C14 11.99 11.99 14 9.5 14Z",fill:"currentColor"})),{baseClassNamePrefix:ve,subElementClassPrefix:o,classModifierPrefix:f}=le.getBEMClassNames("search"),we=b.forwardRef(({id:i,defaultValue:a="",value:c,onChange:t,onSearch:F,loading:y=!1,debounce:H=200,onKeyDown:m,label:B,contentAfter:j,contentBefore:I,helperText:v,fluid:O,width:z,theme:w,disabled:n,hideIcon:V,icon:U=Ie,error:l,readOnly:d,clearable:P=!0,noResults:g,clearButtonAriaLabel:Z="Clear search",className:W,children:D,"aria-describedby":G,...x},J)=>{const{refFn:Q,ref:X}=_e.useUniversalRef(J),[Y,C]=b.useState(String(a)),_=c!==void 0,u=_?String(c):Y,K=e=>{_||C(e.target.value),t==null||t(e)},{immediate:S,debounced:N}=xe.useDebounced(F,H),ee=e=>{m==null||m(e),e.key==="Enter"&&!e.isDefaultPrevented()&&!e.isPropagationStopped()&&S(u),e.key==="Escape"&&(!P||$.open)&&e.preventDefault()},{id:p}=q.useAccessibleId(),{id:R}=q.useAccessibleId(),{id:k}=q.useAccessibleId(),M=!!(l!=null&&l.length),L=!!D||!!g,se=A(v&&k,M&&R,G),{dropdownProps:$,getFieldProps:te,getInputProps:re}=be.useSearchDropdown({enabled:L,disabled:!!n,readOnly:!!d});Se.useEffectAfterMount(()=>{N(u)},[u,N]);const ie=A(r.styles[ve],w&&oe.themeClassName(w),O&&r.styles[`${f}fluid`],n&&r.styles[`${f}disabled`],d&&r.styles[`${f}read-only`],l&&r.styles[`${f}error`],W),ce=e=>{var E;n||e.target instanceof HTMLInputElement||e.target.closest('button,[role="button"],a,[role="link"]')||(e.preventDefault(),e.stopPropagation(),(E=X.current)==null||E.focus())},ne=b.useCallback(()=>{_?t==null||t({target:{value:"",name:x.name,id:p,type:"search"}}):C(""),S("")},[p,_,t,S,x.name]);return s.jsxs("div",{id:i,className:ie,role:"search",style:{maxWidth:z},"aria-busy":y,children:[s.jsx(ue.LabelProvider,{ctxDisabled:!!n,ctxRequired:!1,ctxHtmlFor:p,children:B}),s.jsxs("div",{className:r.styles[`${o}field`],...te({onPointerDown:ce}),children:[!V&&s.jsx(pe.Icon,{icon:U,"aria-hidden":!0}),I&&s.jsx("div",{className:r.styles[`${o}content`],children:I}),s.jsx("input",{id:p,type:"search",className:r.styles[`${o}field__input`],value:u,disabled:n,readOnly:d,"aria-invalid":!!l,"aria-describedby":se,...re({...x,onChange:K,onKeyDown:ee}),ref:Q}),y&&s.jsx("div",{className:r.styles[`${o}field__spinner`],children:s.jsx(qe.Spinner,{size:"xxs"})}),P&&u&&!n&&!d&&s.jsx(ye.CloseButton,{onClick:ne,className:`${o}field__clear-button`,size:"sm","aria-label":Z}),j&&s.jsx("div",{className:r.styles[`${o}content`],children:j})]}),s.jsxs(de.HelperTextProvider,{ctxId:k,ctxDisabled:!!n,children:[v,M&&s.jsx(ae.HelperText,{id:R,appearance:"negative",children:l})]}),L&&s.jsx(he.SearchDropdown,{...$,children:s.jsx(me.ActionList,{role:"listbox",noResults:g,children:D})})]})}),h=we;h.Results=fe.SearchResults;h.displayName="Search";exports.Search=h;exports.default=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),oe=require("../../../chunks/classNames.DAeKwerT.js"),ae=require("../../../chunks/constants.hwjHOsvT.js"),S=require("react"),t=require("../../../chunks/Search.Results.DBQWuhZu.js"),F=require("clsx"),ue=require("../../../chunks/form.context.B26th8Od.js"),de=require("../../Form/contexts/label.context.cjs.js"),_e=require("../../Form/contexts/helperText.context.cjs.js"),pe=require("../../Form/hooks/useUniversalRef.hook.cjs.js"),q=require("../../Form/hooks/useAccessibleId.hook.cjs.js"),fe=require("../../Icon/Icon.cjs.js"),be=require("./useSearchDropdown.cjs.js"),xe=require("./SearchDropdown.cjs.js"),he=require("../../ActionList/ActionList.cjs.js"),me=require("../../../utils/hooks/useDebounced.cjs.js"),Se=require("../../../utils/hooks/useEffectAfterMount.cjs.js"),qe=require("../../Spinner/Spinner.cjs.js"),ye=require("../../CloseButton/CloseButton.cjs.js"),{baseClassNamePrefix:Ie,subElementClassPrefix:n,classModifierPrefix:_}=oe.getBEMClassNames("search"),je=S.forwardRef(({id:T,defaultValue:H="",value:y,onChange:r,onSearch:C,loading:I=!1,debounce:L=200,onKeyDown:f,label:B,contentAfter:j,contentBefore:D,helperText:P,fluid:V,width:z,theme:v,disabled:i,hideIcon:U,icon:W=t.SvgSearch,error:c,readOnly:a,clearable:N=!0,noResults:k,clearButtonAriaLabel:G="Clear search",className:J,children:w,"aria-describedby":Q,...b},X)=>{const{refFn:Y,ref:Z}=pe.useUniversalRef(X),[O,R]=S.useState(String(H)),u=y!==void 0,o=u?String(y):O,K=e=>{u||R(e.target.value),r==null||r(e)},{immediate:x,debounced:A}=me.useDebounced(C,L),ee=e=>{if(f==null||f(e),e.key==="Enter"){if(e.isDefaultPrevented()||e.isPropagationStopped())return;const{activeIndex:l,elementsRef:ne}=h,m=l!==null?ne.current[l]:null;m&&m.getAttribute("aria-disabled")!=="true"?(e.preventDefault(),m.click()):l===null&&x(o)}e.key==="Escape"&&(!N||h.open)&&e.preventDefault()},{id:d}=q.useAccessibleId(),{id:$}=q.useAccessibleId(),{id:g}=q.useAccessibleId(),E=!!(c!=null&&c.length),M=!!w||!!k,se=F(P&&g,E&&$,Q),{dropdownProps:h,getFieldProps:te,getInputProps:re}=be.useSearchDropdown({enabled:M,disabled:!!i,readOnly:!!a});Se.useEffectAfterMount(()=>{A(o)},[o,A]);const ie=F(t.styles[Ie],v&&ae.themeClassName(v),V&&t.styles[`${_}fluid`],i&&t.styles[`${_}disabled`],a&&t.styles[`${_}read-only`],c&&t.styles[`${_}error`],J),ce=e=>{var l;i||e.target instanceof HTMLInputElement||e.target.closest('button,[role="button"],a,[role="link"]')||(e.preventDefault(),e.stopPropagation(),(l=Z.current)==null||l.focus())},le=S.useCallback(()=>{u?r==null||r({target:{value:"",name:b.name,id:d,type:"search"}}):R(""),x("")},[d,u,r,x,b.name]);return s.jsxs("div",{id:T,className:ie,role:"search",style:{maxWidth:z},"aria-busy":I,children:[s.jsx(de.LabelProvider,{ctxDisabled:!!i,ctxRequired:!1,ctxHtmlFor:d,children:B}),s.jsxs("div",{className:t.styles[`${n}field`],...te({onPointerDown:ce}),children:[!U&&s.jsx(fe.Icon,{icon:W,"aria-hidden":!0}),D&&s.jsx("div",{className:t.styles[`${n}content`],children:D}),s.jsx("input",{id:d,type:"search",className:t.styles[`${n}field__input`],value:o,disabled:i,readOnly:a,"aria-invalid":!!c,"aria-describedby":se,...re({...b,onChange:K,onKeyDown:ee}),ref:Y}),I&&s.jsx("div",{className:t.styles[`${n}field__spinner`],children:s.jsx(qe.Spinner,{size:"xxs"})}),N&&o&&!i&&!a&&s.jsx(ye.CloseButton,{onClick:le,className:`${n}field__clear-button`,size:"sm","aria-label":G}),j&&s.jsx("div",{className:t.styles[`${n}content`],children:j})]}),s.jsxs(_e.HelperTextProvider,{ctxId:g,ctxDisabled:!!i,children:[P,E&&s.jsx(ue.HelperText,{id:$,appearance:"negative",children:c})]}),M&&s.jsx(xe.SearchDropdown,{...h,children:s.jsx(he.ActionList,{role:"listbox",noResults:k,children:w})})]})}),p=je;p.Results=t.SearchResults;p.displayName="Search";exports.Search=p;exports.default=p;
@@ -1,157 +1,161 @@
1
- import { jsxs as x, jsx as t } from "react/jsx-runtime";
2
- import { g as ce } from "../../../chunks/classNames.DNsS4J__.js";
3
- import { t as ne } from "../../../chunks/constants.BBi77pmH.js";
4
- import * as k from "react";
5
- import B, { useCallback as me } from "react";
6
- import { s as r } from "../../../chunks/Search.Results.Item.CLmMBPz1.js";
1
+ import { jsxs as S, jsx as t } from "react/jsx-runtime";
2
+ import { g as ne } from "../../../chunks/classNames.BTJmrO_L.js";
3
+ import { t as me } from "../../../chunks/constants.CKKGf1-i.js";
4
+ import C, { useCallback as de } from "react";
5
+ import { s as r, S as fe, a as ue } from "../../../chunks/Search.Results.DR20Rl2x.js";
7
6
  import F from "clsx";
8
- import { H as de } from "../../../chunks/form.context.CfsTSQpm.js";
9
- import { LabelProvider as fe } from "../../Form/contexts/label.context.es.js";
10
- import { HelperTextProvider as pe } from "../../Form/contexts/helperText.context.es.js";
11
- import { useUniversalRef as ue } from "../../Form/hooks/useUniversalRef.hook.es.js";
12
- import { useAccessibleId as b } from "../../Form/hooks/useAccessibleId.hook.es.js";
13
- import { Icon as he } from "../../Icon/Icon.es.js";
14
- import { SearchResults as xe } from "./Search.Results.es.js";
15
- import { useSearchDropdown as be } from "./useSearchDropdown.es.js";
16
- import { SearchDropdown as Se } from "./SearchDropdown.es.js";
17
- import { ActionList as ve } from "../../ActionList/ActionList.es.js";
18
- import { useDebounced as Pe } from "../../../utils/hooks/useDebounced.es.js";
19
- import { useEffectAfterMount as Ce } from "../../../utils/hooks/useEffectAfterMount.es.js";
20
- import { Spinner as Ie } from "../../Spinner/Spinner.es.js";
21
- import { CloseButton as Ne } from "../../CloseButton/CloseButton.es.js";
22
- const De = (f) => /* @__PURE__ */ k.createElement("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...f }, /* @__PURE__ */ k.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.5 14H14.71L14.43 13.73C15.41 12.59 16 11.11 16 9.5C16 5.91 13.09 3 9.5 3C5.91 3 3 5.91 3 9.5C3 13.09 5.91 16 9.5 16C11.11 16 12.59 15.41 13.73 14.43L14 14.71V15.5L19 20.49L20.49 19L15.5 14ZM9.5 14C7.01 14 5 11.99 5 9.5C5 7.01 7.01 5 9.5 5C11.99 5 14 7.01 14 9.5C14 11.99 11.99 14 9.5 14Z", fill: "currentColor" })), { baseClassNamePrefix: ge, subElementClassPrefix: a, classModifierPrefix: d } = ce("search"), we = B.forwardRef(({
23
- id: f,
24
- defaultValue: V = "",
25
- value: S,
7
+ import { H as pe } from "../../../chunks/form.context.BhylRiG2.js";
8
+ import { LabelProvider as he } from "../../Form/contexts/label.context.es.js";
9
+ import { HelperTextProvider as be } from "../../Form/contexts/helperText.context.es.js";
10
+ import { useUniversalRef as xe } from "../../Form/hooks/useUniversalRef.hook.es.js";
11
+ import { useAccessibleId as I } from "../../Form/hooks/useAccessibleId.hook.es.js";
12
+ import { Icon as Se } from "../../Icon/Icon.es.js";
13
+ import { useSearchDropdown as Ie } from "./useSearchDropdown.es.js";
14
+ import { SearchDropdown as Pe } from "./SearchDropdown.es.js";
15
+ import { ActionList as De } from "../../ActionList/ActionList.es.js";
16
+ import { useDebounced as Ne } from "../../../utils/hooks/useDebounced.es.js";
17
+ import { useEffectAfterMount as ve } from "../../../utils/hooks/useEffectAfterMount.es.js";
18
+ import { Spinner as $e } from "../../Spinner/Spinner.es.js";
19
+ import { CloseButton as ye } from "../../CloseButton/CloseButton.es.js";
20
+ const { baseClassNamePrefix: ge, subElementClassPrefix: l, classModifierPrefix: f } = ne("search"), Re = C.forwardRef(({
21
+ id: T,
22
+ defaultValue: j = "",
23
+ value: P,
26
24
  onChange: s,
27
- onSearch: j,
28
- loading: v = !1,
29
- debounce: q = 200,
30
- onKeyDown: p,
31
- label: z,
32
- contentAfter: P,
33
- contentBefore: C,
34
- helperText: I,
35
- fluid: A,
36
- width: Z,
37
- theme: N,
25
+ onSearch: q,
26
+ loading: D = !1,
27
+ debounce: z = 200,
28
+ onKeyDown: u,
29
+ label: B,
30
+ contentAfter: N,
31
+ contentBefore: v,
32
+ helperText: $,
33
+ fluid: V,
34
+ width: U,
35
+ theme: y,
38
36
  disabled: i,
39
- hideIcon: U,
40
- icon: W = De,
41
- error: o,
42
- readOnly: c,
43
- clearable: D = !0,
44
- noResults: g,
45
- clearButtonAriaLabel: G = "Clear search",
46
- className: J,
47
- children: w,
48
- "aria-describedby": Q,
49
- ...u
50
- }, X) => {
51
- const { refFn: Y, ref: K } = ue(X), [O, R] = B.useState(String(V)), n = S !== void 0, l = n ? String(S) : O, ee = (e) => {
52
- n || R(e.target.value), s == null || s(e);
53
- }, { immediate: h, debounced: $ } = Pe(j, q), te = (e) => {
54
- p == null || p(e), e.key === "Enter" && !e.isDefaultPrevented() && !e.isPropagationStopped() && h(l), e.key === "Escape" && (!D || M.open) && e.preventDefault();
55
- }, { id: m } = b(), { id: y } = b(), { id: E } = b(), L = !!(o != null && o.length), _ = !!w || !!g, re = F(
56
- I && E,
57
- L && y,
58
- Q
37
+ hideIcon: W,
38
+ icon: G = fe,
39
+ error: a,
40
+ readOnly: n,
41
+ clearable: g = !0,
42
+ noResults: R,
43
+ clearButtonAriaLabel: J = "Clear search",
44
+ className: Q,
45
+ children: _,
46
+ "aria-describedby": X,
47
+ ...p
48
+ }, Y) => {
49
+ const { refFn: Z, ref: K } = xe(Y), [O, E] = C.useState(String(j)), m = P !== void 0, c = m ? String(P) : O, ee = (e) => {
50
+ m || E(e.target.value), s == null || s(e);
51
+ }, { immediate: h, debounced: k } = Ne(q, z), te = (e) => {
52
+ if (u == null || u(e), e.key === "Enter") {
53
+ if (e.isDefaultPrevented() || e.isPropagationStopped())
54
+ return;
55
+ const { activeIndex: o, elementsRef: ce } = b, x = o !== null ? ce.current[o] : null;
56
+ x && x.getAttribute("aria-disabled") !== "true" ? (e.preventDefault(), x.click()) : o === null && h(c);
57
+ }
58
+ e.key === "Escape" && (!g || b.open) && e.preventDefault();
59
+ }, { id: d } = I(), { id: w } = I(), { id: H } = I(), M = !!(a != null && a.length), A = !!_ || !!R, re = F(
60
+ $ && H,
61
+ M && w,
62
+ X
59
63
  ), {
60
- dropdownProps: M,
64
+ dropdownProps: b,
61
65
  getFieldProps: se,
62
66
  getInputProps: ie
63
- } = be({
64
- enabled: _,
67
+ } = Ie({
68
+ enabled: A,
65
69
  disabled: !!i,
66
- readOnly: !!c
70
+ readOnly: !!n
67
71
  });
68
- Ce(() => {
69
- $(l);
70
- }, [l, $]);
71
- const oe = F(
72
+ ve(() => {
73
+ k(c);
74
+ }, [c, k]);
75
+ const ae = F(
72
76
  r[ge],
73
- N && ne(N),
74
- A && r[`${d}fluid`],
75
- i && r[`${d}disabled`],
76
- c && r[`${d}read-only`],
77
- o && r[`${d}error`],
78
- J
79
- ), ae = (e) => {
80
- var H;
81
- i || e.target instanceof HTMLInputElement || e.target.closest('button,[role="button"],a,[role="link"]') || (e.preventDefault(), e.stopPropagation(), (H = K.current) == null || H.focus());
82
- }, le = me(() => {
83
- n ? s == null || s({
77
+ y && me(y),
78
+ V && r[`${f}fluid`],
79
+ i && r[`${f}disabled`],
80
+ n && r[`${f}read-only`],
81
+ a && r[`${f}error`],
82
+ Q
83
+ ), oe = (e) => {
84
+ var o;
85
+ i || e.target instanceof HTMLInputElement || e.target.closest('button,[role="button"],a,[role="link"]') || (e.preventDefault(), e.stopPropagation(), (o = K.current) == null || o.focus());
86
+ }, le = de(() => {
87
+ m ? s == null || s({
84
88
  target: {
85
89
  value: "",
86
- name: u.name,
87
- id: m,
90
+ name: p.name,
91
+ id: d,
88
92
  type: "search"
89
93
  }
90
- }) : R(""), h("");
91
- }, [m, n, s, h, u.name]);
92
- return /* @__PURE__ */ x(
94
+ }) : E(""), h("");
95
+ }, [d, m, s, h, p.name]);
96
+ return /* @__PURE__ */ S(
93
97
  "div",
94
98
  {
95
- id: f,
96
- className: oe,
99
+ id: T,
100
+ className: ae,
97
101
  role: "search",
98
- style: { maxWidth: Z },
99
- "aria-busy": v,
102
+ style: { maxWidth: U },
103
+ "aria-busy": D,
100
104
  children: [
101
105
  /* @__PURE__ */ t(
102
- fe,
106
+ he,
103
107
  {
104
108
  ctxDisabled: !!i,
105
109
  ctxRequired: !1,
106
- ctxHtmlFor: m,
107
- children: z
110
+ ctxHtmlFor: d,
111
+ children: B
108
112
  }
109
113
  ),
110
- /* @__PURE__ */ x(
114
+ /* @__PURE__ */ S(
111
115
  "div",
112
116
  {
113
- className: r[`${a}field`],
114
- ...se({ onPointerDown: ae }),
117
+ className: r[`${l}field`],
118
+ ...se({ onPointerDown: oe }),
115
119
  children: [
116
- !U && /* @__PURE__ */ t(he, { icon: W, "aria-hidden": !0 }),
117
- C && /* @__PURE__ */ t("div", { className: r[`${a}content`], children: C }),
120
+ !W && /* @__PURE__ */ t(Se, { icon: G, "aria-hidden": !0 }),
121
+ v && /* @__PURE__ */ t("div", { className: r[`${l}content`], children: v }),
118
122
  /* @__PURE__ */ t(
119
123
  "input",
120
124
  {
121
- id: m,
125
+ id: d,
122
126
  type: "search",
123
- className: r[`${a}field__input`],
124
- value: l,
127
+ className: r[`${l}field__input`],
128
+ value: c,
125
129
  disabled: i,
126
- readOnly: c,
127
- "aria-invalid": !!o,
130
+ readOnly: n,
131
+ "aria-invalid": !!a,
128
132
  "aria-describedby": re,
129
133
  ...ie({
130
- ...u,
134
+ ...p,
131
135
  onChange: ee,
132
136
  onKeyDown: te
133
137
  }),
134
- ref: Y
138
+ ref: Z
135
139
  }
136
140
  ),
137
- v && /* @__PURE__ */ t("div", { className: r[`${a}field__spinner`], children: /* @__PURE__ */ t(Ie, { size: "xxs" }) }),
138
- D && l && !i && !c && /* @__PURE__ */ t(Ne, { onClick: le, className: `${a}field__clear-button`, size: "sm", "aria-label": G }),
139
- P && /* @__PURE__ */ t("div", { className: r[`${a}content`], children: P })
141
+ D && /* @__PURE__ */ t("div", { className: r[`${l}field__spinner`], children: /* @__PURE__ */ t($e, { size: "xxs" }) }),
142
+ g && c && !i && !n && /* @__PURE__ */ t(ye, { onClick: le, className: `${l}field__clear-button`, size: "sm", "aria-label": J }),
143
+ N && /* @__PURE__ */ t("div", { className: r[`${l}content`], children: N })
140
144
  ]
141
145
  }
142
146
  ),
143
- /* @__PURE__ */ x(pe, { ctxId: E, ctxDisabled: !!i, children: [
144
- I,
145
- L && /* @__PURE__ */ t(de, { id: y, appearance: "negative", children: o })
147
+ /* @__PURE__ */ S(be, { ctxId: H, ctxDisabled: !!i, children: [
148
+ $,
149
+ M && /* @__PURE__ */ t(pe, { id: w, appearance: "negative", children: a })
146
150
  ] }),
147
- _ && /* @__PURE__ */ t(Se, { ...M, children: /* @__PURE__ */ t(ve, { role: "listbox", noResults: g, children: w }) })
151
+ A && /* @__PURE__ */ t(Pe, { ...b, children: /* @__PURE__ */ t(De, { role: "listbox", noResults: R, children: _ }) })
148
152
  ]
149
153
  }
150
154
  );
151
- }), T = we;
152
- T.Results = xe;
153
- T.displayName = "Search";
155
+ }), L = Re;
156
+ L.Results = ue;
157
+ L.displayName = "Search";
154
158
  export {
155
- T as Search,
156
- T as default
159
+ L as Search,
160
+ L as default
157
161
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("@floating-ui/react"),C=require("../../Box/Box.cjs.js"),q=require("clsx"),l=require("../../../chunks/classNames.DAeKwerT.js"),N=require("../../../chunks/constants.hwjHOsvT.js"),_=require("../../ActionList/ActionList.context.cjs.js"),b=require("react"),S=require("../../../chunks/floatingui.module.D3Aw_aYe.js"),F=require("../../../chunks/popover.module.Dum8SaSU.js"),a=require("./Search.Results.cjs.js"),{baseClassNamePrefix:j}=l.getBEMClassNames("floatingui"),{baseClassNamePrefix:B}=l.getBEMClassNames("popover"),P=[a.SearchResults,a.SearchResults.Item],v=({setOpen:r,isMounted:i,getFloatingProps:n,floatingStyles:c,labelsRef:u,elementsRef:d,getItemProps:m,setFloating:f,theme:t,className:x,children:g,context:o,activeIndex:h})=>{const p=b.useCallback(()=>r(!1),[r]);return i?e.jsx(s.FloatingTree,{children:e.jsx(s.FloatingNode,{id:o.floatingId,children:e.jsx(s.FloatingPortal,{children:e.jsx(s.FloatingFocusManager,{context:o,modal:!1,returnFocus:!0,closeOnFocusOut:!0,guards:!0,disabled:!1,restoreFocus:!0,order:["reference","content"],children:e.jsx(C.Box,{className:q(t&&N.themeClassName(t),S.floatinguiStyles[j],F.popoverStyles[B],x),...n(),style:c,ref:f,children:e.jsx(_.ActionListContextProvider,{allowChildrenTypes:P,getItemProps:m,itemsFocusable:!0,onItemClick:p,labelsRef:u,elementsRef:d,activeIndex:h,children:g})})})})})}):null};exports.SearchDropdown=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),_=require("@floating-ui/react"),d=require("../../Box/Box.cjs.js"),h=require("clsx"),o=require("../../../chunks/classNames.DAeKwerT.js"),q=require("../../../chunks/constants.hwjHOsvT.js"),S=require("../../ActionList/ActionList.context.cjs.js"),N=require("react"),b=require("../../../chunks/floatingui.module.D3Aw_aYe.js"),g=require("../../../chunks/popover.module.Dum8SaSU.js"),s=require("../../../chunks/Search.Results.DBQWuhZu.js"),{baseClassNamePrefix:B}=o.getBEMClassNames("floatingui"),{baseClassNamePrefix:P}=o.getBEMClassNames("popover"),v=[s.SearchResults,s.SearchResults.Item,s.SearchResults.ViewAll],w=({setOpen:t,isMounted:l,getFloatingProps:a,floatingStyles:i,labelsRef:c,elementsRef:n,getItemProps:u,setFloating:m,theme:r,className:x,children:f,activeIndex:p})=>{const C=N.useCallback(()=>t(!1),[t]);return l?e.jsx(_.FloatingPortal,{children:e.jsx(d.Box,{className:h(r&&q.themeClassName(r),b.floatinguiStyles[B],g.popoverStyles[P],x),...a(),style:i,ref:m,children:e.jsx(S.ActionListContextProvider,{allowChildrenTypes:v,getItemProps:u,itemsFocusable:!1,onItemClick:C,labelsRef:c,elementsRef:n,activeIndex:p,children:f})})}):null};exports.SearchDropdown=w;
@@ -1,8 +1,7 @@
1
- import { FloatingContext, UseInteractionsReturn } from '@floating-ui/react';
1
+ import { UseInteractionsReturn } from '@floating-ui/react';
2
2
  import { ThemeTypes } from '@viasat/beam-shared/utils';
3
3
  import { CSSProperties, MutableRefObject } from 'react';
4
4
  export interface SearchDropdownProps {
5
- context: FloatingContext;
6
5
  isMounted: boolean;
7
6
  getFloatingProps: UseInteractionsReturn['getFloatingProps'];
8
7
  floatingStyles: CSSProperties;
@@ -16,4 +15,4 @@ export interface SearchDropdownProps {
16
15
  className?: string;
17
16
  children?: React.ReactNode;
18
17
  }
19
- export declare const SearchDropdown: ({ setOpen, isMounted, getFloatingProps, floatingStyles, labelsRef, elementsRef, getItemProps, setFloating, theme, className: _className, children, context, activeIndex, }: SearchDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
18
+ export declare const SearchDropdown: ({ setOpen, isMounted, getFloatingProps, floatingStyles, labelsRef, elementsRef, getItemProps, setFloating, theme, className: _className, children, activeIndex, }: SearchDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,71 +1,57 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { FloatingTree as h, FloatingNode as F, FloatingPortal as N, FloatingFocusManager as x } from "@floating-ui/react";
3
- import { Box as P } from "../../Box/Box.es.js";
4
- import b from "clsx";
5
- import { g as a } from "../../../chunks/classNames.DNsS4J__.js";
6
- import { t as v } from "../../../chunks/constants.BBi77pmH.js";
7
- import { ActionListContextProvider as y } from "../../ActionList/ActionList.context.es.js";
8
- import { useCallback as B } from "react";
9
- import { f as I } from "../../../chunks/floatingui.module.BcBFebz0.js";
10
- import { p as S } from "../../../chunks/popover.module.C6KFea25.js";
11
- import { SearchResults as t } from "./Search.Results.es.js";
12
- const { baseClassNamePrefix: k } = a("floatingui"), { baseClassNamePrefix: w } = a("popover"), M = [t, t.Item], H = ({
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { FloatingPortal as N } from "@floating-ui/react";
3
+ import { Box as d } from "../../Box/Box.es.js";
4
+ import g from "clsx";
5
+ import { g as a } from "../../../chunks/classNames.BTJmrO_L.js";
6
+ import { t as h } from "../../../chunks/constants.CKKGf1-i.js";
7
+ import { ActionListContextProvider as P } from "../../ActionList/ActionList.context.es.js";
8
+ import { useCallback as b } from "react";
9
+ import { f as v } from "../../../chunks/floatingui.module.BcBFebz0.js";
10
+ import { p as y } from "../../../chunks/popover.module.C6KFea25.js";
11
+ import { a as e } from "../../../chunks/Search.Results.DR20Rl2x.js";
12
+ const { baseClassNamePrefix: B } = a("floatingui"), { baseClassNamePrefix: S } = a("popover"), k = [e, e.Item, e.ViewAll], V = ({
13
13
  setOpen: r,
14
- isMounted: l,
15
- getFloatingProps: i,
14
+ isMounted: t,
15
+ getFloatingProps: l,
16
16
  floatingStyles: m,
17
- labelsRef: n,
18
- elementsRef: c,
19
- getItemProps: f,
20
- setFloating: u,
21
- theme: o,
22
- className: p,
23
- children: d,
24
- context: s,
25
- activeIndex: g
17
+ labelsRef: i,
18
+ elementsRef: f,
19
+ getItemProps: p,
20
+ setFloating: n,
21
+ theme: s,
22
+ className: c,
23
+ children: C,
24
+ activeIndex: u
26
25
  }) => {
27
- const C = B(() => r(!1), [r]);
28
- return l ? /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(F, { id: s.floatingId, children: /* @__PURE__ */ e(N, { children: /* @__PURE__ */ e(
29
- x,
26
+ const x = b(() => r(!1), [r]);
27
+ return t ? /* @__PURE__ */ o(N, { children: /* @__PURE__ */ o(
28
+ d,
30
29
  {
31
- context: s,
32
- modal: !1,
33
- returnFocus: !0,
34
- closeOnFocusOut: !0,
35
- guards: !0,
36
- disabled: !1,
37
- restoreFocus: !0,
38
- order: ["reference", "content"],
39
- children: /* @__PURE__ */ e(
30
+ className: g(
31
+ s && h(s),
32
+ v[B],
33
+ y[S],
34
+ c
35
+ ),
36
+ ...l(),
37
+ style: m,
38
+ ref: n,
39
+ children: /* @__PURE__ */ o(
40
40
  P,
41
41
  {
42
- className: b(
43
- o && v(o),
44
- I[k],
45
- S[w],
46
- p
47
- ),
48
- ...i(),
49
- style: m,
50
- ref: u,
51
- children: /* @__PURE__ */ e(
52
- y,
53
- {
54
- allowChildrenTypes: M,
55
- getItemProps: f,
56
- itemsFocusable: !0,
57
- onItemClick: C,
58
- labelsRef: n,
59
- elementsRef: c,
60
- activeIndex: g,
61
- children: d
62
- }
63
- )
42
+ allowChildrenTypes: k,
43
+ getItemProps: p,
44
+ itemsFocusable: !1,
45
+ onItemClick: x,
46
+ labelsRef: i,
47
+ elementsRef: f,
48
+ activeIndex: u,
49
+ children: C
64
50
  }
65
51
  )
66
52
  }
67
- ) }) }) }) : null;
53
+ ) }) : null;
68
54
  };
69
55
  export {
70
- H as SearchDropdown
56
+ V as SearchDropdown
71
57
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@floating-ui/react"),n=require("react"),T=require("../../FloatingUI/useTyping.cjs.js"),q=S=>{const{disabled:c,readOnly:a,enabled:e=!0}=S,[s,i]=n.useState(!1),d=n.useRef(s);d.current=s;const[f,g]=n.useState(null);n.useEffect(()=>s?void 0:g(null),[s]);const{context:r,refs:l,floatingStyles:p}=t.useFloating({placement:"bottom-start",middleware:[t.flip(),t.size({apply({elements:o,rects:u}){Object.assign(o.floating.style,{width:`${u.reference.width}px`})}})],whileElementsMounted:t.autoUpdate,open:s,onOpenChange:i}),b=n.useRef([]),k=n.useRef([]),h=t.useClick(r,{enabled:!s&&e&&!c&&!a,toggle:!1,stickIfOpen:!1,keyboardHandlers:!1}),x=t.useRole(r,{enabled:e,role:"listbox"}),E=T.useTyping(r,{enabled:!s&&e&&!c&&!a,event:"keyboard"}),M=t.useFocus(r,{enabled:!s&&e&&!c&&!a,visibleOnly:!0}),C=t.useDismiss(r,{enabled:s&&e&&!c&&!a,escapeKey:!0,outsidePress:!0,referencePress:!1}),D=t.useListNavigation(r,{enabled:e&&!c&&!a,listRef:b,activeIndex:f,onNavigate:g,focusItemOnHover:!1,focusItemOnOpen:"auto",openOnArrowKeyDown:!0,nested:!1,loop:!0,virtual:!1,scrollItemIntoView:!0}),{getReferenceProps:m,getFloatingProps:y,getItemProps:R}=t.useInteractions([x,E,D]),{getReferenceProps:v}=t.useInteractions([h,M,C]),{isMounted:I,styles:P}=t.useTransitionStyles(r,{duration:50});n.useEffect(()=>{if(!e||c||a||d.current)return;const o=l.domReference.current,u=document.activeElement;o&&u&&o.contains(u)&&i(!0)},[e,c,a,i,l.domReference]);const O=n.useCallback((o={})=>e?m(o):o,[m,e]),w=n.useCallback((o={})=>e?{ref:l.setReference,...v(o)}:o,[e,l.setReference,v]),F=n.useMemo(()=>({isMounted:I,getFloatingProps:y,getItemProps:R,floatingStyles:{...p,...P},setOpen:i,labelsRef:k,elementsRef:b,setFloating:l.setFloating,activeIndex:f,context:r,open:s}),[I,y,R,p,P,l.setFloating,f,r,s]);return n.useMemo(()=>({getFieldProps:w,getInputProps:O,dropdownProps:F,refs:l}),[F,w,O,l])};exports.useSearchDropdown=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@floating-ui/react"),n=require("react"),_=require("../../FloatingUI/useTyping.cjs.js"),N=require("../../FloatingUI/useBlur.cjs.js"),T=S=>{const{disabled:r,readOnly:l,enabled:e=!0}=S,[s,i]=n.useState(!1),d=n.useRef(s);d.current=s;const[f,g]=n.useState(null);n.useEffect(()=>s?void 0:g(null),[s]);const{context:c,refs:a,floatingStyles:p}=t.useFloating({placement:"bottom-start",middleware:[t.flip(),t.size({apply({elements:o,rects:u}){Object.assign(o.floating.style,{width:`${u.reference.width}px`})}})],whileElementsMounted:t.autoUpdate,open:s,onOpenChange:i}),b=n.useRef([]),k=n.useRef([]),h=t.useClick(c,{enabled:!s&&e&&!r&&!l,toggle:!1,stickIfOpen:!1,keyboardHandlers:!1}),x=t.useRole(c,{enabled:e,role:"listbox"}),E=_.default(c,{enabled:!s&&e&&!r&&!l,event:"keyboard"}),M=t.useFocus(c,{enabled:!s&&e&&!r&&!l,visibleOnly:!0}),q=t.useDismiss(c,{enabled:s&&e&&!r&&!l,escapeKey:!0,outsidePress:!0,referencePress:!1}),C=N.useBlur(c,{enabled:e&&!r&&!l}),D=t.useListNavigation(c,{enabled:e&&!r&&!l,listRef:b,activeIndex:f,onNavigate:g,focusItemOnHover:!1,focusItemOnOpen:"auto",openOnArrowKeyDown:!0,nested:!1,loop:!0,virtual:!0,scrollItemIntoView:!0}),{getReferenceProps:m,getFloatingProps:R,getItemProps:y}=t.useInteractions([x,E,D]),{getReferenceProps:I}=t.useInteractions([h,M,q,C]),{isMounted:v,styles:P}=t.useTransitionStyles(c,{duration:50});n.useEffect(()=>{if(!e||r||l||d.current)return;const o=a.domReference.current,u=document.activeElement;o&&u&&o.contains(u)&&i(!0)},[e,r,l,i,a.domReference]);const O=n.useCallback((o={})=>e?m(o):o,[m,e]),w=n.useCallback((o={})=>e?{ref:a.setReference,...I(o)}:o,[e,a.setReference,I]),F=n.useMemo(()=>({isMounted:v,getFloatingProps:R,getItemProps:y,floatingStyles:{...p,...P},setOpen:i,labelsRef:k,elementsRef:b,setFloating:a.setFloating,activeIndex:f,open:s}),[v,R,y,p,P,a.setFloating,f,s]);return n.useMemo(()=>({getFieldProps:w,getInputProps:O,dropdownProps:F,refs:a}),[F,w,O,a])};exports.useSearchDropdown=T;
@@ -846,24 +846,6 @@ export declare const useSearchDropdown: (options: UseSearchDropdownOptions) => {
846
846
  elementsRef: import('react').MutableRefObject<HTMLElement[]>;
847
847
  setFloating: ((node: HTMLElement | null) => void) & ((node: HTMLElement | null) => void);
848
848
  activeIndex: number | null;
849
- context: {
850
- x: number;
851
- y: number;
852
- placement: import('@floating-ui/utils').Placement;
853
- strategy: import('@floating-ui/utils').Strategy;
854
- middlewareData: import('@floating-ui/core').MiddlewareData;
855
- isPositioned: boolean;
856
- update: () => void;
857
- floatingStyles: React.CSSProperties;
858
- open: boolean;
859
- onOpenChange: (open: boolean, event?: Event, reason?: import('@floating-ui/react').OpenChangeReason) => void;
860
- events: import('@floating-ui/react').FloatingEvents;
861
- dataRef: React.MutableRefObject<import('@floating-ui/react').ContextData>;
862
- nodeId: string | undefined;
863
- floatingId: string;
864
- refs: import('@floating-ui/react').ExtendedRefs<HTMLInputElement>;
865
- elements: import('@floating-ui/react').ExtendedElements<HTMLInputElement>;
866
- };
867
849
  open: boolean;
868
850
  };
869
851
  refs: {
@@ -1,15 +1,16 @@
1
- import { useFloating as T, autoUpdate as j, flip as z, size as L, useClick as U, useRole as V, useFocus as $, useDismiss as q, useListNavigation as B, useInteractions as F, useTransitionStyles as G } from "@floating-ui/react";
1
+ import { useFloating as j, autoUpdate as z, flip as B, size as L, useClick as U, useRole as V, useFocus as $, useDismiss as q, useListNavigation as G, useInteractions as F, useTransitionStyles as J } from "@floating-ui/react";
2
2
  import { useState as k, useRef as u, useEffect as x, useCallback as h, useMemo as S } from "react";
3
- import { useTyping as J } from "../../FloatingUI/useTyping.es.js";
4
- const Y = (E) => {
5
- const { disabled: r, readOnly: l, enabled: e = !0 } = E, [t, c] = k(!1), f = u(t);
3
+ import Q from "../../FloatingUI/useTyping.es.js";
4
+ import { useBlur as W } from "../../FloatingUI/useBlur.es.js";
5
+ const ee = (E) => {
6
+ const { disabled: n, readOnly: o, enabled: e = !0 } = E, [t, c] = k(!1), f = u(t);
6
7
  f.current = t;
7
8
  const [a, d] = k(null);
8
9
  x(() => t ? void 0 : d(null), [t]);
9
- const { context: n, refs: o, floatingStyles: p } = T({
10
+ const { context: r, refs: l, floatingStyles: p } = j({
10
11
  placement: "bottom-start",
11
12
  middleware: [
12
- z(),
13
+ B(),
13
14
  L({
14
15
  apply({ elements: s, rects: i }) {
15
16
  Object.assign(s.floating.style, {
@@ -18,16 +19,16 @@ const Y = (E) => {
18
19
  }
19
20
  })
20
21
  ],
21
- whileElementsMounted: j,
22
+ whileElementsMounted: z,
22
23
  open: t,
23
24
  onOpenChange: c
24
- }), g = u([]), C = u([]), D = U(n, {
25
- enabled: !t && e && !r && !l,
25
+ }), g = u([]), C = u([]), D = U(r, {
26
+ enabled: !t && e && !n && !o,
26
27
  toggle: !1,
27
28
  stickIfOpen: !1,
28
29
  keyboardHandlers: !1
29
- }), M = V(n, { enabled: e, role: "listbox" }), N = J(n, { enabled: !t && e && !r && !l, event: "keyboard" }), A = $(n, { enabled: !t && e && !r && !l, visibleOnly: !0 }), H = q(n, { enabled: t && e && !r && !l, escapeKey: !0, outsidePress: !0, referencePress: !1 }), K = B(n, {
30
- enabled: e && !r && !l,
30
+ }), M = V(r, { enabled: e, role: "listbox" }), N = Q(r, { enabled: !t && e && !n && !o, event: "keyboard" }), A = $(r, { enabled: !t && e && !n && !o, visibleOnly: !0 }), H = q(r, { enabled: t && e && !n && !o, escapeKey: !0, outsidePress: !0, referencePress: !1 }), K = W(r, { enabled: e && !n && !o }), T = G(r, {
31
+ enabled: e && !n && !o,
31
32
  listRef: g,
32
33
  activeIndex: a,
33
34
  onNavigate: d,
@@ -36,28 +37,28 @@ const Y = (E) => {
36
37
  openOnArrowKeyDown: !0,
37
38
  nested: !1,
38
39
  loop: !0,
39
- virtual: !1,
40
+ virtual: !0,
40
41
  scrollItemIntoView: !0
41
42
  }), { getReferenceProps: m, getFloatingProps: b, getItemProps: y } = F([
42
43
  M,
43
44
  N,
44
- K
45
- ]), { getReferenceProps: R } = F([D, A, H]), { isMounted: v, styles: I } = G(n, { duration: 50 });
45
+ T
46
+ ]), { getReferenceProps: R } = F([D, A, H, K]), { isMounted: v, styles: I } = J(r, { duration: 50 });
46
47
  x(() => {
47
- if (!e || r || l || f.current)
48
+ if (!e || n || o || f.current)
48
49
  return;
49
- const s = o.domReference.current, i = document.activeElement;
50
+ const s = l.domReference.current, i = document.activeElement;
50
51
  s && i && s.contains(i) && c(!0);
51
- }, [e, r, l, c, o.domReference]);
52
+ }, [e, n, o, c, l.domReference]);
52
53
  const P = h(
53
54
  (s = {}) => e ? m(s) : s,
54
55
  [m, e]
55
56
  ), O = h(
56
57
  (s = {}) => e ? {
57
- ref: o.setReference,
58
+ ref: l.setReference,
58
59
  ...R(s)
59
60
  } : s,
60
- [e, o.setReference, R]
61
+ [e, l.setReference, R]
61
62
  ), w = S(
62
63
  () => ({
63
64
  isMounted: v,
@@ -70,23 +71,22 @@ const Y = (E) => {
70
71
  setOpen: c,
71
72
  labelsRef: C,
72
73
  elementsRef: g,
73
- setFloating: o.setFloating,
74
+ setFloating: l.setFloating,
74
75
  activeIndex: a,
75
- context: n,
76
76
  open: t
77
77
  }),
78
- [v, b, y, p, I, o.setFloating, a, n, t]
78
+ [v, b, y, p, I, l.setFloating, a, t]
79
79
  );
80
80
  return S(
81
81
  () => ({
82
82
  getFieldProps: O,
83
83
  getInputProps: P,
84
84
  dropdownProps: w,
85
- refs: o
85
+ refs: l
86
86
  }),
87
- [w, O, P, o]
87
+ [w, O, P, l]
88
88
  );
89
89
  };
90
90
  export {
91
- Y as useSearchDropdown
91
+ ee as useSearchDropdown
92
92
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-react",
3
- "version": "2.9.0",
3
+ "version": "2.10.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.9.0",
63
- "@viasat/beam-shared": "2.9.0",
64
- "@viasat/beam-styles": "2.9.0",
65
- "@viasat/beam-tokens": "2.9.0",
66
- "@viasat/beam-icons": "2.9.0",
62
+ "@viasat/beam-fonts": "2.10.0",
63
+ "@viasat/beam-shared": "2.10.0",
64
+ "@viasat/beam-styles": "2.10.0",
65
+ "@viasat/beam-tokens": "2.10.0",
66
+ "@viasat/beam-icons": "2.10.0",
67
67
  "clsx": "^1.2.1",
68
68
  "@floating-ui/react": "^0.26.18",
69
69
  "@stepperize/react": "^5.1.5",