UNPKG

@useloops/design-system

Version:

The official React based Loops design system

2 lines (1 loc) 6.09 kB
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useTheme as o}from"@mui/material";import{useRef as t,useEffect as i,startTransition as a}from"react";import{useBreakpoint as n}from"../../../utils/breakpoint.hook.js";import{useScreenSize as s}from"../../../utils/screen.hook.js";import"../../BrandCore/colorRamps.js";import{base as l}from"../../BrandCore/primitiveVariables.js";import"../../BrandCore/semanticColor.js";import"../../BrandCore/types.js";import"../../BrandCore/typography.js";import"../../BrandCore/Icon/Icon.js";import"../../../utils/formValidation/misc.js";import{typographyVariantMap as p}from"../../WebCore/utils/typography.util.js";import"../../WebCore/AnnualController/AnnualController.js";import"../../WebCore/Accordion/Accordion.js";import m from"../../WebCore/Typography/Typography.js";import"merge-sx";import"../../WebCore/Badge/Badge.js";import"../../WebCore/Breadcrumb/Breadcrumb.js";import d from"../../WebCore/Button/Button.js";import"../../WebCore/ButtonBase/ButtonBase.js";import"../../WebCore/Checkbox/StyledCheckbox.js";import"../../WebCore/InputFieldBase/InputFieldBase.js";import"../../WebCore/CreatableAutocomplete/CreatableAutocomplete.js";import"@mui/icons-material";import"../../WebCore/InputLabelBase/StyledInputLabelBase.js";import"../../WebCore/Differential/DifferentialContainer.js";import"../../WebCore/Differential/DifferentialRadio.js";import"../../WebCore/DropdownMenu/StyledMenu.js";import"../../WebCore/ExpandableTypographyClamp/ExpandableTypographyClamp.js";import"../../WebCore/FormGenerator/FormGenerator.js";import"../../WebCore/GridOverlay/GridOverlay.js";import"html-react-parser";import"../../WebCore/IconButton/IconButton.js";import"../../WebCore/IconButtonBase/IconButtonBase.js";import"../../WebCore/IconButtonGroup/IconButtonGroup.js";import"../../WebCore/Image/Image.js";import b from"../../WebCore/Label/Label.js";import"../../WebCore/Likert/LikertContainer.js";import"../../WebCore/Likert/LikertLabel.js";import"../../WebCore/Likert/LikertRadio.js";import c from"../../WebCore/Link/Link.js";import"@lottiefiles/dotlottie-react";import"../../WebCore/LoopsAiButton/LoopsAiButton.js";import"markdown-to-jsx";import"material-ui-popup-state/hooks";import"../../WebCore/Surface/Surface.js";import"../../WebCore/Menu/MenuItem.js";import"../../WebCore/ModalLayout/_partials/ModalActionsWrapper.js";import"../../WebCore/ModalLayout/_partials/ModalContentWrapper.js";import"../../WebCore/NavigationButton/NavigationButton.js";import"../../WebCore/Nudge/NudgeButton.js";import"../../WebCore/NumberField/NumberField.js";import"../../WebCore/Progress/Progress.js";import"../../WebCore/Pill/StyledPill.js";import"../../WebCore/ProgressBar/ProgressBar.js";import"../../WebCore/Radio/StyledRadio.js";import"../../WebCore/utils/autocomplete.styles.js";import"../../WebCore/Select/AutocompleteListbox.js";import"../../WebCore/Select/StyledAutocomplete.js";import"../../WebCore/Select/SelectItem.js";import"../../WebCore/Select/StyledSelect.js";import"../../WebCore/RankItem/RankItemContainer.js";import"../../WebCore/RankItem/RankItemLabel.js";import"../../WebCore/SortableList/SortableList.js";import"../../WebCore/SortableList/components/SortableItem/SortableItem.js";import"../../WebCore/SortableList/components/SortableOverlay/SortableOverlay.js";import"@tiptap/extension-placeholder";import"@tiptap/starter-kit";import"mui-tiptap";import"../../WebCore/RichTextField/StyledRichTextEditor.js";import"../../WebCore/Skeleton/Skeleton.js";import"../../WebCore/Slider/StyledSlider.js";import"../../WebCore/StarRating/StarRating.js";import"../../WebCore/Switch/StyledSwitch.js";import"../../WebCore/Textarea/Textarea.js";import"../../WebCore/TrialCard/TrialCardContainers.js";import"../../WebCore/TrialCard/TrialPill.js";import"../../WebCore/UserMenu/UserMenuButton.js";import"../../WebCore/VideoModal/VideoModal.js";import C from"./FeatureListItem.js";import u from"./PlanTierCardContainers.js";import h from"./PlanTierCardSkeleton.js";import j from"./RespondentPricingCard.js";import W from"./SavingsPill.js";const g=({amount:g,billingType:f,body:y,bordered:B,ctaEvent:S=()=>{},ctaLink:k="#",ctaTarget:I="_self",ctaText:L,ctaVariation:x="primary",currencySymbol:T,currentPlan:v,featuresHeading:H,features:P=[],featuresIcon:R,heading:M,label:F,loading:A,respondentsTitle:w,respondentsFeatures:E,respondentsFeaturesIcon:G,saving:N,sectionHeights:D,updateSectionHeight:O,syncHeightsOnBreakpoints:V})=>{const $=o(),_=n(),{width:z}=s(),U=t(null),q=t(null),J=t(null),K=t(null);return A?e(h,{}):(i(()=>{a(()=>{if(D&&O){const e=[{ref:U,key:"headerHeight"},{ref:q,key:"bodyHeight"},{ref:J,key:"respondentCardHeight"},{ref:K,key:"bottomHeight"}];V?.includes(_)?e.forEach(({ref:e,key:r})=>{e.current?.offsetHeight&&e.current.offsetHeight>D[r]&&O(r,e.current.offsetHeight)}):e.forEach(({key:e})=>{0!==D[e]&&O(e,0)})}})},[_,V,z,O]),r(u.PlanTierCard,{bordered:B,children:[r(u.Top,{children:[r(u.Head,{ref:U,height:D?.headerHeight,children:[r(u.PlanTitle,{children:[e(m,{variation:"lg",component:"h1",weight:"bold",children:M}),F&&e(b,{body:F,weight:"heavy",sx:{height:3*l,backgroundColor:e=>e.custom.palette.icon.primary,color:e=>e.custom.palette.text.primaryInverted,"& .MuiChip-label":{fontSize:`${p.lg.body.xxs}`}}})]}),r(u.Billing,{children:[e(u.Price,{children:r(m,{variation:"xxl",component:"p",weight:"bold",children:[T,g]})}),f&&e(m,{variation:"sm",component:"p",sx:{color:$.custom.palette.text.secondary},children:f})]}),N&&e(W,{body:N,weight:"heavy"})]}),e(u.Body,{ref:q,height:D?.bodyHeight,children:y}),w&&e(j,{ref:J,height:D?.respondentCardHeight,respondentsTitle:w,respondentsFeatures:E,featuresIcon:G})]}),r(u.Bottom,{ref:K,height:D?.bottomHeight,children:[P?.length&&r(u.FeatureList,{children:[H&&e(m,{component:"p",variation:"sm",weight:"bold",mr:"auto",children:H}),P.map((r,o)=>e(C,{feature:r,featuresIcon:R},`${M}-feature-${o}`))]}),!v&&e(c,{href:k,title:L,target:I,onClick:()=>{M&&S(M)},sx:{"&:hover":{cursor:"pointer"}},children:e(d,{fullWidth:!0,variation:x,sizing:"lg",disabled:v,children:L})})]})]}))};export{g as default};