twenty-ui 2.48.0 → 2.49.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 +27 -2
- package/dist/Avatar-C6WxBgjS.cjs +1 -0
- package/dist/{Avatar-D-QA0RE5.js → Avatar-ifVlxbx_.js} +18 -17
- package/dist/{Button-D5enZ0Qz.js → Button-DIw804CX.js} +1 -1
- package/dist/{Button-Dbi5P05r.cjs → Button-DTm1WDzp.cjs} +1 -1
- package/dist/Dropdown-1OAJvS1f.js +1000 -0
- package/dist/Dropdown-Bl4OXCf9.cjs +1 -0
- package/dist/{ListItem-CjnrSbka.js → ListItem-DizNUBT8.js} +1 -1
- package/dist/{ListItem-CHTR-GLd.cjs → ListItem-DwBb-I1D.cjs} +1 -1
- package/dist/{ProgressBar-BvT1dyFo.js → ProgressBar-B3xACTV2.js} +1 -1
- package/dist/{ProgressBar-DfFz0fFB.cjs → ProgressBar-OpSMnDBz.cjs} +1 -1
- package/dist/{Radio-DMI1B7o5.js → Radio-BEAztmPu.js} +1 -1
- package/dist/{Radio-xmHgGHQO.cjs → Radio-Dx6b4SYZ.cjs} +1 -1
- package/dist/ResizeHandle-B1MuHTNA.cjs +1 -0
- package/dist/{ResizeHandle-C1kQ3MYR.js → ResizeHandle-B30OYZxS.js} +56 -55
- package/dist/Shortcut-Bp9iDdQg.js +73 -0
- package/dist/Shortcut-N8TELGPI.cjs +1 -0
- package/dist/{TintedIconTile-4BGa8g8n.js → TintedIconTile-B1XDtGrF.js} +1 -1
- package/dist/{TintedIconTile-CU2hCerq.cjs → TintedIconTile-DO1XJXCQ.cjs} +1 -1
- package/dist/components/__stories__/reading-direction/DirectionalLayoutExample.d.ts +3 -1
- package/dist/components/code-editor.cjs +1 -1
- package/dist/components/code-editor.mjs +52 -51
- package/dist/components/data-display.cjs +1 -1
- package/dist/components/data-display.mjs +2 -2
- package/dist/components/feedback.cjs +1 -1
- package/dist/components/feedback.mjs +1 -1
- package/dist/components/input/CountrySelect/CountrySelect.d.ts +5 -2
- package/dist/components/input/CountrySelect/__stories__/CountrySelectPartsExample.d.ts +11 -0
- package/dist/components/input/CountrySelect/internal/CountrySelectComponent.d.ts +2 -0
- package/dist/components/input/CountrySelect/internal/CountrySelectContext.d.ts +2 -0
- package/dist/components/input/CountrySelect/internal/CountrySelectContextValue.d.ts +11 -0
- package/dist/components/input/CountrySelect/internal/CountrySelectDropdown.d.ts +4 -0
- package/dist/components/input/CountrySelect/internal/CountrySelectOptions.d.ts +2 -11
- package/dist/components/input/CountrySelect/internal/CountrySelectOptionsContent.d.ts +2 -0
- package/dist/components/input/CountrySelect/internal/CountrySelectRoot.d.ts +2 -0
- package/dist/components/input/CountrySelect/internal/CountrySelectTrigger.d.ts +2 -0
- package/dist/components/input/CountrySelect/internal/NO_COUNTRY_SELECTION_VALUE.d.ts +1 -0
- package/dist/components/input/CountrySelect/internal/PreparedCountryChoice.d.ts +5 -0
- package/dist/components/input/CountrySelect/internal/getCountrySelectionValue.d.ts +1 -0
- package/dist/components/input/CountrySelect/internal/useCountrySelectContextOrThrow.d.ts +1 -0
- package/dist/components/input/CountrySelect/types/CountryChoice.d.ts +1 -0
- package/dist/components/input/CountrySelect/types/CountrySelectOptionsProps.d.ts +10 -0
- package/dist/components/input/CountrySelect/types/CountrySelectOptionsState.d.ts +4 -0
- package/dist/components/input/CountrySelect/types/CountrySelectProps.d.ts +7 -13
- package/dist/components/input/CountrySelect/types/CountrySelectRootProps.d.ts +12 -0
- package/dist/components/input/CountrySelect/types/CountrySelectTriggerProps.d.ts +6 -0
- package/dist/components/input/CurrencyPicker/CurrencyPicker.d.ts +4 -3
- package/dist/components/input/CurrencyPicker/__stories__/CurrencyPickerChangingDefaultExample.d.ts +5 -0
- package/dist/components/input/CurrencyPicker/__stories__/CurrencyPickerControlledExample.d.ts +5 -0
- package/dist/components/input/CurrencyPicker/__stories__/CurrencyPickerControlledSearchExample.d.ts +5 -0
- package/dist/components/input/CurrencyPicker/__stories__/CurrencyPickerExample.d.ts +3 -4
- package/dist/components/input/CurrencyPicker/__stories__/CurrencyPickerListLabelExample.d.ts +1 -0
- package/dist/components/input/CurrencyPicker/__stories__/CurrencyPickerRootStateExample.d.ts +1 -0
- package/dist/components/input/CurrencyPicker/internal/CurrencyPickerContext.d.ts +11 -0
- package/dist/components/input/CurrencyPicker/internal/CurrencyPickerOptions.d.ts +1 -1
- package/dist/components/input/CurrencyPicker/internal/CurrencyPickerRoot.d.ts +2 -0
- package/dist/components/input/CurrencyPicker/internal/CurrencyPickerShorthand.d.ts +2 -0
- package/dist/components/input/CurrencyPicker/internal/CurrencyPickerTrigger.d.ts +1 -1
- package/dist/components/input/CurrencyPicker/internal/PreparedCurrencyPickerOption.d.ts +7 -0
- package/dist/components/input/CurrencyPicker/internal/getCurrencyPickerSearchText.d.ts +2 -0
- package/dist/components/input/CurrencyPicker/internal/useCurrencyPickerContextOrThrow.d.ts +7 -0
- package/dist/components/input/CurrencyPicker/types/CurrencyPickerChangeEventDetails.d.ts +2 -0
- package/dist/components/input/CurrencyPicker/types/CurrencyPickerOption.d.ts +1 -0
- package/dist/components/input/CurrencyPicker/types/CurrencyPickerOptionsProps.d.ts +6 -5
- package/dist/components/input/CurrencyPicker/types/CurrencyPickerProps.d.ts +10 -0
- package/dist/components/input/CurrencyPicker/types/CurrencyPickerRootProps.d.ts +17 -0
- package/dist/components/input/CurrencyPicker/types/CurrencyPickerState.d.ts +6 -0
- package/dist/components/input/CurrencyPicker/types/CurrencyPickerTriggerProps.d.ts +3 -2
- package/dist/components/input/IconButton/__stories__/IconButtonExample.d.ts +7 -0
- package/dist/components/input/PhoneCountryPicker/PhoneCountryPicker.d.ts +5 -3
- package/dist/components/input/PhoneCountryPicker/__stories__/PhoneCountryPickerExample.d.ts +7 -3
- package/dist/components/input/PhoneCountryPicker/__stories__/testDisabledPhoneCountryPicker.d.ts +5 -0
- package/dist/components/input/PhoneCountryPicker/__stories__/testPhoneCountryCallingCodeDirection.d.ts +3 -0
- package/dist/components/input/PhoneCountryPicker/__stories__/testPhoneCountryNullSelection.d.ts +5 -0
- package/dist/components/input/PhoneCountryPicker/__stories__/testPhoneCountrySelection.d.ts +5 -0
- package/dist/components/input/PhoneCountryPicker/internal/PhoneCountryPickerContext.d.ts +9 -0
- package/dist/components/input/PhoneCountryPicker/internal/PhoneCountryPickerOptions.d.ts +1 -1
- package/dist/components/input/PhoneCountryPicker/internal/PhoneCountryPickerRoot.d.ts +2 -0
- package/dist/components/input/PhoneCountryPicker/internal/PhoneCountryPickerTrigger.d.ts +1 -1
- package/dist/components/input/PhoneCountryPicker/internal/PreparedPhoneCountryOption.d.ts +5 -0
- package/dist/components/input/PhoneCountryPicker/internal/getPhoneCountryOptionTooltipLabel.d.ts +2 -0
- package/dist/components/input/PhoneCountryPicker/internal/matchesPhoneCountrySearch.d.ts +6 -0
- package/dist/components/input/PhoneCountryPicker/internal/usePhoneCountryPickerContextOrThrow.d.ts +7 -0
- package/dist/components/input/PhoneCountryPicker/types/PhoneCountryOption.d.ts +1 -0
- package/dist/components/input/PhoneCountryPicker/types/PhoneCountryPickerOptionsProps.d.ts +4 -5
- package/dist/components/input/PhoneCountryPicker/types/PhoneCountryPickerProps.d.ts +10 -0
- package/dist/components/input/PhoneCountryPicker/types/PhoneCountryPickerRootProps.d.ts +12 -0
- package/dist/components/input/PhoneCountryPicker/types/PhoneCountryPickerTriggerProps.d.ts +1 -3
- package/dist/components/input/index.d.ts +10 -0
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.mjs +13 -13
- package/dist/components/layout/OverflowingList/internal/measureItemWidths.d.ts +1 -2
- package/dist/components/layout/OverflowingList/internal/measureOverflowingListLayout.d.ts +1 -2
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.mjs +1 -1
- package/dist/components/navigation/Dropdown/Dropdown.d.ts +2 -1
- package/dist/components/navigation/Dropdown/__stories__/DropdownIconGridExample.d.ts +3 -0
- package/dist/components/navigation/Dropdown/__stories__/DropdownSelectionGroupsExample.d.ts +1 -0
- package/dist/components/navigation/Dropdown/internal/DropdownContextValue.d.ts +6 -1
- package/dist/components/navigation/Dropdown/internal/DropdownOptionItem.d.ts +1 -1
- package/dist/components/navigation/Dropdown/internal/DropdownOptionItemOwner.d.ts +7 -0
- package/dist/components/navigation/Dropdown/internal/DropdownSelectionContext.d.ts +2 -0
- package/dist/components/navigation/Dropdown/internal/DropdownSelectionContextValue.d.ts +9 -0
- package/dist/components/navigation/Dropdown/internal/DropdownSelectionGroup.d.ts +2 -0
- package/dist/components/navigation/Dropdown/internal/DropdownSelectionGroupEffect.d.ts +11 -0
- package/dist/components/navigation/Dropdown/internal/createDropdownSelectionEventDetails.d.ts +5 -0
- package/dist/components/navigation/Dropdown/internal/dropdownItemActivation.d.ts +11 -0
- package/dist/components/navigation/Dropdown/internal/getDropdownItemExplicitId.d.ts +2 -2
- package/dist/components/navigation/Dropdown/internal/getDropdownOptionItemRole.d.ts +9 -0
- package/dist/components/navigation/Dropdown/internal/getDropdownSelectionGroupState.d.ts +6 -0
- package/dist/components/navigation/Dropdown/internal/getTrailingFocusGuard.d.ts +1 -0
- package/dist/components/navigation/Dropdown/internal/isDropdownOptionItemSelected.d.ts +6 -0
- package/dist/components/navigation/Dropdown/internal/useDropdownSelections.d.ts +12 -0
- package/dist/components/navigation/Dropdown/types/DropdownOptionItemProps.d.ts +7 -2
- package/dist/components/navigation/Dropdown/types/DropdownOptionItemSelectEventDetails.d.ts +2 -0
- package/dist/components/navigation/Dropdown/types/DropdownOptionItemState.d.ts +5 -0
- package/dist/components/navigation/Dropdown/types/DropdownSelectionGroupChangeEventDetails.d.ts +7 -0
- package/dist/components/navigation/Dropdown/types/DropdownSelectionGroupProps.d.ts +21 -0
- package/dist/components/navigation/Dropdown/types/DropdownSelectionGroupState.d.ts +7 -0
- package/dist/components/navigation/index.d.ts +5 -0
- package/dist/components/navigation.cjs +1 -1
- package/dist/components/navigation.mjs +2 -2
- package/dist/components/settings.cjs +1 -1
- package/dist/components/settings.mjs +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.mjs +22 -22
- package/dist/data-display-BSKGlijb.cjs +1 -0
- package/dist/{data-display-KyZbLLy-.js → data-display-BtXCGOGw.js} +81 -80
- package/dist/{data-display-0QO_WDSs.js → data-display-DtXIhJ4B.js} +45 -44
- package/dist/data-display-XV3ht1rC.cjs +2 -0
- package/dist/doNotTranslate-BSVT8Xyd.js +4 -0
- package/dist/doNotTranslate-CHE7WmRS.cjs +1 -0
- package/dist/feedback-Cs-38OH4.cjs +1 -0
- package/dist/{feedback-CM6fatE8.js → feedback-DTyVVcTb.js} +198 -197
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +42 -42
- package/dist/{input-CJDYNwoO.cjs → input-B_rBplmn.cjs} +1 -1
- package/dist/input-BrjD91wv.js +785 -0
- package/dist/input-ChlFcqIS.cjs +1 -0
- package/dist/{input-DRpDiMRi.js → input-D1oyk0tD.js} +2 -2
- package/dist/layout-CthYckvl.cjs +1 -0
- package/dist/layout-DQcjBu08.js +439 -0
- package/dist/{navigation-B1SRvzKK.js → navigation-B6nka3bW.js} +125 -128
- package/dist/navigation-CIVYqPc5.js +132 -0
- package/dist/navigation-CflGBYv-.cjs +1 -0
- package/dist/navigation-DoInK0Sp.cjs +1 -0
- package/dist/preventDismissingClickActivation-AaqHBLnW.js +45 -0
- package/dist/preventDismissingClickActivation-CIhWvKCu.cjs +1 -0
- package/dist/primitives/data-display.cjs +1 -1
- package/dist/primitives/data-display.mjs +2 -2
- package/dist/primitives/feedback.cjs +1 -1
- package/dist/primitives/feedback.mjs +1 -1
- package/dist/primitives/input/Radio/__stories__/RadioCardContent.d.ts +8 -0
- package/dist/primitives/input.cjs +1 -1
- package/dist/primitives/input.mjs +3 -3
- package/dist/primitives/layout/ResizeHandle/__stories__/ResizableNotesExample.d.ts +2 -0
- package/dist/primitives/layout.cjs +1 -1
- package/dist/primitives/layout.mjs +1 -1
- package/dist/primitives/navigation.cjs +1 -1
- package/dist/primitives/navigation.mjs +2 -2
- package/dist/primitives/typography.cjs +1 -1
- package/dist/primitives/typography.mjs +2 -2
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.mjs +11 -11
- package/dist/{settings-BjEZiHXE.js → settings-BgVuLpg9.js} +1 -1
- package/dist/{settings-BAYsnlZJ.cjs → settings-CPXhrmbK.cjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/testing/GroupedCatalog.d.ts +14 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.mjs +96 -66
- package/dist/{typography-fOTFr0jS.js → typography-DT2eKLvd.js} +1 -1
- package/dist/{typography-B5QEuPaL.cjs → typography-bKeSMuJd.cjs} +1 -1
- package/dist/useIsMobile-Byp9AIq-.cjs +1 -0
- package/dist/useIsMobile-D1ImfQnE.js +38 -0
- package/dist/utilities/internal/doNotTranslate.d.ts +1 -0
- package/dist/utilities-BKCMZyqZ.js +53 -0
- package/dist/utilities-xZh8D2gd.cjs +1 -0
- package/dist/utilities.cjs +1 -1
- package/dist/utilities.mjs +3 -3
- package/package.json +3 -3
- package/dist/Avatar-CQhIEazb.cjs +0 -1
- package/dist/Dropdown-BKjAaZS0.cjs +0 -1
- package/dist/Dropdown-C2hXrjvD.js +0 -820
- package/dist/ResizeHandle-DI4LHIQm.cjs +0 -1
- package/dist/Shortcut-BvWUZ3pb.js +0 -72
- package/dist/Shortcut-CgrdLv_L.cjs +0 -1
- package/dist/data-display-CPmTJAWJ.cjs +0 -1
- package/dist/data-display-DjhAHvj1.cjs +0 -2
- package/dist/feedback-ybO4n69s.cjs +0 -1
- package/dist/input-3D2lXywH.cjs +0 -1
- package/dist/input-TM3nUdu6.js +0 -554
- package/dist/layout-BszCDxAO.js +0 -441
- package/dist/layout-VaIq7Sjr.cjs +0 -1
- package/dist/navigation-CYAs2LnR.js +0 -131
- package/dist/navigation-CthkGHJ8.cjs +0 -1
- package/dist/navigation-DrOV5E67.cjs +0 -1
- package/dist/preventDismissingClickActivation-CzWqpjiX.js +0 -44
- package/dist/preventDismissingClickActivation-DZxTSLV3.cjs +0 -1
- package/dist/useIsMobile-DxOPI2_E.cjs +0 -1
- package/dist/useIsMobile-nrufFzMb.js +0 -37
- package/dist/utilities-BeLfNQ0Q.cjs +0 -1
- package/dist/utilities-CEi9I09B.js +0 -52
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const F=require("./theme-1XkFz8Qu.cjs"),d=require("./isDefined-DS2Q42p5.cjs"),E=require("./doNotTranslate-CHE7WmRS.cjs"),fe=require("./mergeClassNames-D4lshrT6.cjs"),q=require("./Button-DTm1WDzp.cjs"),O=require("./ProgressBar-OpSMnDBz.cjs"),y=require("./isRenderableSlot-Guryb6Nf.cjs"),ve=require("./useProvidedTextDirection-PVaoQCLH.cjs"),me=require("./OverflowingTextWithTooltip-Z2daM0_x.cjs"),_e=require("./Separator-UJVlrTzw.cjs");let M=require("@base-ui/react/use-render"),R=require("@sniptt/guards"),A=require("clsx"),p=require("react"),r=require("react/jsx-runtime"),Q=require("@base-ui/utils/store"),pe=require("react-dom"),j=require("@tabler/icons-react");var Te="_action_3r2bm_1",xe={action:Te},he=({className:e,...t})=>(0,r.jsx)(q.Button,{...t,size:"sm",variant:"ghost",className:fe.mergeClassNames(xe.action,e)}),ge="_container_1ix4w_1",be="_containerFullWidth_1ix4w_40",Ce="_header_1ix4w_44",je="_iconContainer_1ix4w_53",we="_title_1ix4w_63",ye="_descriptionWrapper_1ix4w_75",De="_descriptionWrapperWithIcon_1ix4w_82",Ne="_descriptionWrapperWithAction_1ix4w_86",Pe="_description_1ix4w_75",Ee="_footer_1ix4w_99",Re="_closeButton_1ix4w_106",h={container:ge,containerFullWidth:be,header:Ce,iconContainer:je,title:we,descriptionWrapper:ye,descriptionWrapperWithIcon:De,descriptionWrapperWithAction:Ne,description:Pe,footer:Ee,closeButton:Re},Ae=({status:e="info",variant:t="soft",color:s=O.FEEDBACK_STATUS_COLORS[e],title:n,description:o,fullWidth:c=!1,icon:i=(0,r.jsx)(j.IconHelp,{size:F.themeCssVariables.icon.size.md,"aria-hidden":"true"}),action:f,closeLabel:v=E.doNotTranslate("Close"),onDismiss:m,className:T,render:x,ref:l,...u})=>{const a=y.isRenderableSlot(i),_=y.isRenderableSlot(f);return(0,M.useRender)({render:x,ref:l,state:{status:e,variant:t,color:s},props:{...u,className:(0,A.clsx)(h.container,c&&h.containerFullWidth,T),children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:h.header,children:[a&&(0,r.jsx)("div",{className:h.iconContainer,children:i}),(0,r.jsx)("div",{className:h.title,children:n}),d.isDefined(m)&&(0,r.jsx)(q.Button,{type:"button",startIcon:(0,r.jsx)(j.IconX,{"aria-hidden":"true"}),className:h.closeButton,variant:"ghost",size:"sm","aria-label":v,onClick:()=>m()})]}),y.isRenderableSlot(o)&&(0,r.jsx)("div",{className:(0,A.clsx)(h.descriptionWrapper,a&&h.descriptionWrapperWithIcon,_&&h.descriptionWrapperWithAction),children:(0,r.jsx)("div",{className:h.description,children:o})}),_&&(0,r.jsx)("div",{className:h.footer,children:f})]})}})},Se=Object.assign(Ae,{Action:he}),Ie="_banner_17vm4_1",qe="_embedded_17vm4_6",Oe="_bannerContent_17vm4_10",ke="_icon_17vm4_18",Be="_bannerText_17vm4_28",We="_compact_17vm4_33",P={banner:Ie,embedded:qe,bannerContent:Oe,icon:ke,bannerText:Be,compact:We},Fe=({children:e,layout:t="standard",variant:s="soft",embedded:n=!1,icon:o=(0,r.jsx)(j.IconInfoCircle,{"aria-hidden":"true"}),className:c,...i})=>{const f=t==="compact",v=!f&&(0,R.isString)(e);return(0,r.jsx)(O.Banner,{...i,className:(0,A.clsx)(P.banner,f&&P.compact,n&&P.embedded,c),variant:s,"data-layout":t,children:(0,r.jsxs)("div",{className:P.bannerContent,children:[y.isRenderableSlot(o)&&(0,r.jsx)("span",{className:P.icon,children:o}),(0,r.jsx)("div",{className:P.bannerText,children:v?(0,r.jsx)(me.OverflowingTextWithTooltip,{isFocusable:!0,text:(0,r.jsx)(r.Fragment,{children:e}),tooltipContent:e}):e})]})})},Me=Object.assign(Fe,{Action:O.Banner.Action}),D=e=>e.status==="visible",k=({store:e,toastsToClose:t,nextToasts:s=e.state.toasts})=>{const n=t.filter(i=>D(i)&&e.state.toasts.includes(i)),o=s.map(i=>n.includes(i)?{...i,status:"closing"}:i),c=e.state.mountedToasterCount>0;e.set("toasts",c?o:o.filter(D));for(const i of n)i.notification.onClose?.()},Y=(0,p.createContext)(void 0),N=()=>{const e=(0,p.useContext)(Y);if(!d.isDefined(e))throw new Error(E.doNotTranslate("Toast components must be used within a ToastProvider."));return e},Z=()=>{const e=N();return{closeToast:s=>{if(!e.lifecycle.isActive())return;const n=e.state.toasts.filter(o=>D(o)&&(!d.isDefined(s)||o.notification.id===s));(0,R.isNonEmptyArray)(n)&&k({store:e,toastsToClose:n})}}},G=0,J=()=>(G+=1,`toast-${G}`),Le=()=>{const e=N();return{enqueueToast:(0,p.useMemo)(()=>{function t(s){if(!d.isDefined(s))return;if(!e.lifecycle.isActive())return J();const{dedupeKey:n,...o}=s,{toasts:c,limit:i}=e.state,f=c.filter(D),v=d.isDefined(n)?f.find(x=>x.dedupeKey===n):void 0;if(d.isDefined(v))return v.notification.id;const m=J(),T=Math.max(0,f.length-i+1);return k({store:e,toastsToClose:f.slice(0,T),nextToasts:[...c,{notification:{...o,id:m},dedupeKey:n,status:"visible"}]}),m}return t},[e])}},ze=({store:e,id:t,...s})=>{if(!e.lifecycle.isActive())return;const n=e.state.toasts.find(i=>i.notification.id===t&&D(i)),o=Object.keys(s);if(!d.isDefined(n)||!(0,R.isNonEmptyArray)(o))return;const c=o.includes("duration")||d.isDefined(n.notification.progress)&&o.includes("progress")&&!d.isDefined(s.progress);e.set("toasts",e.state.toasts.map(i=>i===n?{...i,notification:{...i.notification,...s,id:t},...c?{durationRevision:(i.durationRevision??0)+1}:{}}:i))},$e=()=>{const e=N();return{updateToast:(0,p.useCallback)(t=>ze({store:e,...t}),[e])}},Ue=()=>{const{closeToast:e}=Z(),{enqueueToast:t}=Le(),{updateToast:s}=$e();return{enqueueToast:t,closeToast:e,updateToast:s}},Ke="_root_181ka_1",He="_progress_181ka_19",Ve="_header_181ka_30",Xe="_message_181ka_40",Ge="_icon_181ka_45",Je="_actions_181ka_50",Qe="_description_181ka_56",Ye="_footer_181ka_65",Ze="_footerAction_181ka_69",et="_closeButton_181ka_76",b={root:Ke,progress:He,header:Ve,message:Xe,icon:Ge,actions:Je,description:Qe,footer:Ye,footerAction:Ze,closeButton:et},L=(0,p.createContext)({durationRevision:0,isActive:!0}),tt=({clock:e,onClockChange:t,duration:s,progress:n,isPaused:o,onClose:c})=>{const{durationRevision:i,isActive:f,lifecycle:v,id:m,rendererKey:T,timingOverrides:x}=(0,p.useContext)(L),l=d.isDefined(v)&&d.isDefined(m)&&d.isDefined(T),u=l?void 0:e,a=d.isDefined(n),_=d.isDefined(x)&&Object.prototype.propertyIsEnumerable.call(x,"duration"),w=d.isDefined(x)&&Object.prototype.propertyIsEnumerable.call(x,"progress");return(0,p.useLayoutEffect)(()=>{if(l){t(v.updateRenderer({id:m,key:T,configuration:{duration:_?s:void 0,isProgress:w?a:void 0,isPaused:o}}));return}u?.update({duration:s,durationRevision:i,isPaused:o,isProgress:a,isActive:f,onClose:c})},[u,t,l,s,i,o,a,f,c,v,m,T,_,w]),(0,p.useLayoutEffect)(()=>()=>{if(l){v.removeRenderer({id:m,key:T});return}u?.stop()},[u,v,m,T,l]),null},st=({element:e,isFocused:t,onFocusChange:s})=>((0,p.useLayoutEffect)(()=>{if(!t||!d.isDefined(e))return;const n=()=>{e.contains(e.ownerDocument.activeElement)||s(!1)};n();const o=new MutationObserver(n);return o.observe(e,{childList:!0,subtree:!0}),()=>o.disconnect()},[e,t,s]),null),ee=6e3,te=e=>Number.isFinite(e)&&e>0,nt="_countdown_1vuo8_1",rt="_toastCountdown_1vuo8_1",ot={countdown:nt,toastCountdown:rt},it=({progress:e,duration:t,remainingDuration:s,revision:n,isPaused:o,barColor:c})=>d.isDefined(e)?(0,r.jsx)(O.ProgressBar,{value:e,barColor:c}):te(t)?(0,r.jsx)("div",{className:ot.countdown,"data-paused":o||void 0,style:{"--toast-countdown-color":c,"--toast-countdown-width":`${s/t*100}%`,"--toast-countdown-duration":`${s}ms`}},n):null,at=2**31-1,ct=({onChange:e})=>{let t,s=0,n,o,c=0,i=0,f=!1;const v=()=>{i+=1,d.isDefined(n)&&(s=Math.max(0,s-(performance.now()-n)),n=void 0),clearTimeout(o),o=void 0},m=()=>{d.isDefined(t)&&(c+=1,e({duration:t.duration,remainingDuration:s,revision:c,isPaused:t.isPaused||!t.isActive}))},T=()=>{f||(v(),f=!0,s=0,m(),t?.onClose?.())},x=()=>d.isDefined(t)&&t.isActive&&!t.isPaused&&!t.isProgress&&te(t.duration)&&!f,l=()=>{if(!x())return;n=performance.now();const a=i;o=setTimeout(()=>{if(a===i){if(v(),s>0){l();return}T()}},Math.min(s,at))};return{update:a=>{const _=!d.isDefined(t)||a.duration!==t.duration||a.durationRevision!==t.durationRevision||t.isProgress&&!a.isProgress,w=_||a.isProgress!==t?.isProgress||a.isPaused!==t?.isPaused||a.isActive!==t?.isActive,g=!d.isDefined(n)&&x();if(!w&&!g){t=a;return}v(),t=a,!f&&(_&&(s=Math.max(0,a.duration)),m(),l())},close:T,stop:v}},se=({duration:e,isPaused:t})=>{let s={duration:e,remainingDuration:e,revision:0,isPaused:t};const n=new Set;return{...ct({onChange:o=>{s=o;for(const c of n)c()}}),getSnapshot:()=>s,subscribe:o=>(n.add(o),()=>{n.delete(o)})}},ut=({duration:e,isPaused:t})=>{const{lifecycle:s,id:n,rendererKey:o}=(0,p.useContext)(L),[c,i]=(0,p.useState)(()=>(d.isDefined(s)&&d.isDefined(n)&&d.isDefined(o)?s.getCountdown(n):void 0)??se({duration:e,isPaused:t}));return{countdown:(0,p.useSyncExternalStore)(c.subscribe,c.getSnapshot,c.getSnapshot),clock:c,setClock:i}},dt={neutral:j.IconAlertTriangle,error:j.IconAlertTriangle,success:j.IconSquareRoundedCheck,info:j.IconInfoCircle,warning:j.IconAlertTriangle},ne=({children:e,description:t,icon:s,iconLabel:n,action:o,progress:c,duration:i=ee,onCancel:f,onClose:v,cancelLabel:m=E.doNotTranslate("Cancel"),closeLabel:T=E.doNotTranslate("Close"),status:x="neutral",role:l="status",className:u,onMouseEnter:a,onMouseLeave:_,onFocus:w,onBlur:g,render:S,ref:oe,...ie})=>{const z=F.useTheme(),[ae,$]=(0,p.useState)(!1),[U,B]=(0,p.useState)(!1),[ce,ue]=(0,p.useState)(null),K=ae||U,{countdown:I,clock:H,setClock:de}=ut({duration:i,isPaused:K}),le=dt[x],V=z.snackBar[x==="neutral"?"default":x],X=(0,R.isUndefined)(s)?(0,r.jsx)(le,{"aria-label":n,"aria-hidden":!d.isDefined(n),color:V.color,size:z.icon.size.md}):s;return(0,r.jsxs)(r.Fragment,{children:[(0,M.useRender)({render:S,ref:[oe??null,ue],props:{role:l,"aria-live":l==="alert"?"assertive":"polite",...ie,className:(0,A.clsx)(b.root,u),onMouseEnter:C=>{$(!0),a?.(C)},onMouseLeave:C=>{$(!1),_?.(C)},onFocus:C=>{B(!0),w?.(C)},onBlur:C=>{C.currentTarget.contains(C.relatedTarget)||B(!1),g?.(C)},children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:b.progress,"aria-hidden":!0,children:(0,r.jsx)(it,{barColor:V.backgroundColor,progress:c,duration:I.duration,remainingDuration:I.remainingDuration,revision:I.revision,isPaused:I.isPaused})}),(0,r.jsxs)("div",{className:b.header,children:[y.isRenderableSlot(X)&&(0,r.jsx)("div",{className:b.icon,children:X}),(0,r.jsx)("div",{className:b.message,children:e}),(0,r.jsxs)("div",{className:b.actions,children:[d.isDefined(f)&&y.isRenderableSlot(m)&&(0,r.jsx)(q.Button,{onClick:f,size:"sm",variant:"ghost",style:{fontWeight:"var(--t-font-weight-regular)"},children:m}),d.isDefined(v)&&(0,r.jsx)(q.Button,{title:T,"aria-label":T,startIcon:(0,r.jsx)(j.IconX,{}),className:b.closeButton,variant:"ghost",size:"sm",onClick:H.close})]})]}),y.isRenderableSlot(t)&&(0,r.jsx)("div",{className:b.description,children:t}),y.isRenderableSlot(o)&&(0,r.jsxs)("div",{className:b.footer,children:[(0,r.jsx)(_e.Separator,{}),(0,r.jsx)("div",{className:b.footerAction,children:o})]})]})}}),(0,r.jsx)(st,{element:ce,isFocused:U,onFocusChange:B}),(0,r.jsx)(tt,{clock:H,onClockChange:de,duration:i,progress:c,isPaused:K,onClose:v})]})},re=e=>{if(!(0,R.isPositiveInteger)(e))throw new Error(E.doNotTranslate("Toast limit must be a positive integer."))},lt=({store:e,limit:t})=>{if(re(t),e.state.limit===t)return;e.set("limit",t);const s=e.state.toasts.filter(D),n=Math.max(0,s.length-t);n!==0&&k({store:e,toastsToClose:s.slice(0,n)})},ft=({limit:e})=>{const t=N();return(0,p.useEffect)(()=>t.lifecycle.mount(),[t]),(0,p.useLayoutEffect)(()=>lt({store:t,limit:e}),[t,e]),null},vt=({store:e,toast:t})=>{const{toasts:s}=e.state;t.status==="closing"&&s.includes(t)&&e.set("toasts",s.filter(n=>n!==t))},mt=e=>{const t=new Map;let s=!1,n=!1,o=0;const c=l=>{const u=t.get(l);if(d.isDefined(u))return u;const a={countdown:se({duration:ee,isPaused:!0}),renderers:new Map};return t.set(l,a),a},i=l=>{if(!s)return;const u=t.get(l);if(!d.isDefined(u?.pendingExits)||u.pendingExits.size>0)return;const a=e.state.toasts.find(_=>_.notification.id===l);d.isDefined(a)&&vt({store:e,toast:a})},f=()=>{for(const[l,u]of t){const a=e.state.toasts.find(g=>g.notification.id===l);if(!d.isDefined(a)){u.countdown.stop(),t.delete(l);continue}const _=u.renderers.values().next().value??u.lastRenderer;u.lastRenderer=_;const w=!s||u.renderers.size===0||[...u.renderers.values()].some(g=>g.isPaused);u.countdown.update({duration:_?.duration??a.notification.duration??6e3,durationRevision:a.durationRevision??0,isProgress:_?.isProgress??d.isDefined(a.notification.progress),isPaused:w,isActive:a.status==="visible",onClose:()=>{const g=e.state.toasts.find(S=>S.notification.id===l&&D(S));!s||!d.isDefined(g)||k({store:e,toastsToClose:[g]})}}),a.status!=="visible"&&(u.pendingExits??=new Set(u.renderers.keys()),i(l))}};return{mount:()=>{s=!0,n=!1,o+=1;const l=e.subscribe(f);return f(),()=>{s=!1,l();for(const a of t.values())a.countdown.stop();const u=++o;queueMicrotask(()=>{s||o!==u||(n=!0,t.clear(),e.set("toasts",[]))})}},isActive:()=>!n,getCountdown:l=>t.get(l)?.countdown,updateRenderer:({id:l,key:u,configuration:a})=>{const _=c(l);return _.renderers.has(u)||(_.countdown.stop(),_.pendingExits?.add(u)),_.renderers.set(u,a),f(),_.countdown},removeRenderer:({id:l,key:u})=>{const a=t.get(l);d.isDefined(a)&&(a.renderers.delete(u),a.pendingExits?.delete(u),f())},finishExit:({id:l,key:u})=>{t.get(l)?.pendingExits?.delete(u),i(l)}}},_t=(e=3)=>{re(e);const t=new Q.Store({toasts:[],limit:e,mountedToasterCount:0});return Object.assign(t,{lifecycle:mt(t)})},pt=({children:e,limit:t=3})=>{const[s]=(0,p.useState)(()=>_t(t));return(0,r.jsxs)(Y.Provider,{value:s,children:[e,(0,r.jsx)(ft,{limit:t})]})},Tt="_root_1q2cc_1",xt="_item_1q2cc_20",ht="_itemContent_1q2cc_47",W={root:Tt,item:xt,itemContent:ht},gt=()=>(0,Q.useStore)(N(),e=>e.toasts),bt=({elementRef:e,toastEntry:t,rendererKey:s})=>{const n=N();return(0,p.useLayoutEffect)(()=>{if(t.status==="visible")return;const o=()=>n.lifecycle.finishExit({id:t.notification.id,key:s}),c=e.current?.getAnimations?.()??[];if(!(0,R.isNonEmptyArray)(c)){o();return}let i=!1;return Promise.allSettled(c.map(f=>f.finished)).then(()=>{i||o()}),()=>{i=!0}},[e,t,n,s]),null},Ct=({toastEntry:e,getToastProps:t,onClose:s})=>{const{notification:n,status:o,durationRevision:c=0}=e,{id:i,...f}=n,v=N(),m=t?.(n),[T]=(0,p.useState)(()=>Symbol()),x=(0,p.useRef)(null);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{ref:x,className:W.item,"data-exiting":o==="closing"||void 0,inert:o==="closing",children:(0,r.jsx)("div",{className:W.itemContent,children:(0,r.jsx)(L.Provider,{value:{durationRevision:c,isActive:o==="visible",lifecycle:v.lifecycle,id:i,rendererKey:T,timingOverrides:m},children:(0,r.jsx)(ne,{...f,...m,id:i,onClose:()=>s(i)})})})}),(0,r.jsx)(bt,{elementRef:x,toastEntry:e,rendererKey:T})]})},jt=({getToastProps:e})=>{const t=gt(),{closeToast:s}=Z();return t.map(n=>(0,r.jsx)(Ct,{toastEntry:n,getToastProps:e,onClose:s},n.notification.id))},wt=()=>{const e=N();return(0,p.useLayoutEffect)(()=>(e.set("mountedToasterCount",e.state.mountedToasterCount+1),()=>{e.set("mountedToasterCount",e.state.mountedToasterCount-1),!(e.state.mountedToasterCount>0)&&e.set("toasts",e.state.toasts.filter(D))}),[e]),null},yt=({container:e,getToastProps:t,className:s,render:n,ref:o,...c})=>{const i=F.useThemeContainer(),f=ve.useProvidedTextDirection(),v=e===void 0?i??(typeof document>"u"?null:document.body):e,m=(0,M.useRender)({render:n,ref:o,props:{role:"region",dir:f,"aria-label":E.doNotTranslate("Notifications"),...c,className:(0,A.clsx)(W.root,s),children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(wt,{}),(0,r.jsx)(jt,{getToastProps:t})]})}});return d.isDefined(v)?(0,pe.createPortal)(m,v):null};Object.defineProperty(exports,"Callout",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"InlineBanner",{enumerable:!0,get:function(){return Me}});Object.defineProperty(exports,"Toast",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"ToastProvider",{enumerable:!0,get:function(){return pt}});Object.defineProperty(exports,"Toaster",{enumerable:!0,get:function(){return yt}});Object.defineProperty(exports,"useToast",{enumerable:!0,get:function(){return Ue}});
|