igloo-d2c-components 1.0.12 → 1.0.14
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 +1153 -341
- package/dist/cjs/index.js +256 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +256 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/BenefitsSummary/BenefitsSummary.d.ts +22 -0
- package/dist/types/components/BenefitsSummary/index.d.ts +2 -0
- package/dist/types/components/BenefitsSummary/styled.d.ts +29 -0
- package/dist/types/components/BenefitsSummary/types.d.ts +58 -0
- package/dist/types/components/FAQAccordion/FAQAccordion.d.ts +22 -0
- package/dist/types/components/FAQAccordion/index.d.ts +2 -0
- package/dist/types/components/FAQAccordion/styled.d.ts +37 -0
- package/dist/types/components/FAQAccordion/types.d.ts +57 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/storybook-components/BenefitsSummary.stories.d.ts +37 -0
- package/dist/types/storybook-components/FAQAccordion.stories.d.ts +37 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var ArrowBackIcon = require('@mui/icons-material/ArrowBack');
|
|
|
14
14
|
var InfoIcon = require('@mui/icons-material/Info');
|
|
15
15
|
var AddIcon = require('@mui/icons-material/Add');
|
|
16
16
|
var RemoveIcon = require('@mui/icons-material/Remove');
|
|
17
|
+
var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
|
|
17
18
|
|
|
18
19
|
function _interopNamespaceDefault(e) {
|
|
19
20
|
var n = Object.create(null);
|
|
@@ -1104,7 +1105,7 @@ function Header$1({ logo, alternateLogo, showAlternateLogo = false, navigationLi
|
|
|
1104
1105
|
handleOpenNavMenu(e);
|
|
1105
1106
|
}
|
|
1106
1107
|
}, color: "inherit", sx: Object.assign({}, (isPartnershipPageMobileView &&
|
|
1107
|
-
scrolled && { padding: '0px !important' })) }, { children:
|
|
1108
|
+
scrolled && { padding: '0px !important' })) }, { children: anchorElNav ? (jsxRuntime.jsx(StyledCloseIcon, {})) : isPartnershipPageMobileView && scrolled ? (jsxRuntime.jsx(StyledButton$1, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsxRuntime.jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsxRuntime.jsx(StyledButtonBanner, Object.assign({ style: {
|
|
1108
1109
|
background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor,
|
|
1109
1110
|
}, variant: "contained", onClick: onGetQuoteClick }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ style: {
|
|
1110
1111
|
color: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaTextColor,
|
|
@@ -2637,7 +2638,7 @@ const HeaderContainer = styles.styled(material.Box)(({ sticky }) => (Object.assi
|
|
|
2637
2638
|
const SectionHeader = styles.styled(material.Box)({
|
|
2638
2639
|
padding: '0 16px 24px',
|
|
2639
2640
|
});
|
|
2640
|
-
const SectionTitle = styles.styled(material.Typography)({
|
|
2641
|
+
const SectionTitle$1 = styles.styled(material.Typography)({
|
|
2641
2642
|
fontFamily: 'Montserrat',
|
|
2642
2643
|
fontSize: '20px',
|
|
2643
2644
|
fontWeight: 700,
|
|
@@ -2654,7 +2655,7 @@ const SectionDescription = styles.styled(material.Typography)({
|
|
|
2654
2655
|
});
|
|
2655
2656
|
|
|
2656
2657
|
const CheckoutHeader = ({ progress, product, sectionTitle, sectionDescription, sticky = true, progressBarTheme, sx, }) => {
|
|
2657
|
-
return (jsxRuntime.jsxs(HeaderContainer, Object.assign({ sticky: sticky, sx: sx }, { children: [jsxRuntime.jsx(CheckoutProgress, Object.assign({}, progress, { progressBarTheme: progressBarTheme })), product && (jsxRuntime.jsx(material.Box, Object.assign({ sx: { padding: '0 16px 24px' } }, { children: jsxRuntime.jsx(ProductCard, Object.assign({}, product)) }))), jsxRuntime.jsxs(SectionHeader, { children: [jsxRuntime.jsx(SectionTitle, { children: sectionTitle }), jsxRuntime.jsx(SectionDescription, { children: sectionDescription })] })] })));
|
|
2658
|
+
return (jsxRuntime.jsxs(HeaderContainer, Object.assign({ sticky: sticky, sx: sx }, { children: [jsxRuntime.jsx(CheckoutProgress, Object.assign({}, progress, { progressBarTheme: progressBarTheme })), product && (jsxRuntime.jsx(material.Box, Object.assign({ sx: { padding: '0 16px 24px' } }, { children: jsxRuntime.jsx(ProductCard, Object.assign({}, product)) }))), jsxRuntime.jsxs(SectionHeader, { children: [jsxRuntime.jsx(SectionTitle$1, { children: sectionTitle }), jsxRuntime.jsx(SectionDescription, { children: sectionDescription })] })] })));
|
|
2658
2659
|
};
|
|
2659
2660
|
|
|
2660
2661
|
const ButtonContainer = styles.styled(material.Box)(({ isFixed }) => ({
|
|
@@ -2842,6 +2843,256 @@ const ChildInformationForm = ({ renderField, fields, onSubmit, formRef, sx, }) =
|
|
|
2842
2843
|
} }, { children: fields.full_name.helperText })))] }), renderField(fields.nric), renderField(fields.date_of_birth), renderField(fields.gender), renderField(fields.nationality)] })) })));
|
|
2843
2844
|
};
|
|
2844
2845
|
|
|
2846
|
+
/**
|
|
2847
|
+
* FAQ Accordion Styled Components
|
|
2848
|
+
* MUI styled components for the FAQ Accordion
|
|
2849
|
+
*/
|
|
2850
|
+
const FAQContainer = material.styled(material.Box)(({ theme }) => ({
|
|
2851
|
+
padding: '50px 16px',
|
|
2852
|
+
display: 'flex',
|
|
2853
|
+
flexDirection: 'column',
|
|
2854
|
+
gap: '24px',
|
|
2855
|
+
alignItems: 'center',
|
|
2856
|
+
justifyContent: 'center',
|
|
2857
|
+
width: '100%',
|
|
2858
|
+
backgroundColor: '#ffffff',
|
|
2859
|
+
[theme.breakpoints.up('md')]: {
|
|
2860
|
+
padding: '64px 32px',
|
|
2861
|
+
gap: '32px',
|
|
2862
|
+
},
|
|
2863
|
+
}));
|
|
2864
|
+
const FAQTitle = material.styled(material.Typography)(({ theme }) => ({
|
|
2865
|
+
fontWeight: 700,
|
|
2866
|
+
fontSize: '20px',
|
|
2867
|
+
lineHeight: '28px',
|
|
2868
|
+
textAlign: 'center',
|
|
2869
|
+
width: '100%',
|
|
2870
|
+
margin: 0,
|
|
2871
|
+
[theme.breakpoints.up('md')]: {
|
|
2872
|
+
fontSize: '28px',
|
|
2873
|
+
lineHeight: '36px',
|
|
2874
|
+
},
|
|
2875
|
+
}));
|
|
2876
|
+
const StyledAccordion = material.styled(material.Accordion)(({ theme }) => ({
|
|
2877
|
+
backgroundColor: 'transparent',
|
|
2878
|
+
boxShadow: 'none',
|
|
2879
|
+
borderRadius: 0,
|
|
2880
|
+
'&:before': {
|
|
2881
|
+
display: 'none',
|
|
2882
|
+
},
|
|
2883
|
+
'&:not(:last-child)': {
|
|
2884
|
+
borderBottom: '1px solid rgba(0, 0, 0, 0.1)',
|
|
2885
|
+
},
|
|
2886
|
+
'&.Mui-expanded': {
|
|
2887
|
+
margin: 0,
|
|
2888
|
+
},
|
|
2889
|
+
}));
|
|
2890
|
+
const StyledAccordionSummary = material.styled(material.AccordionSummary)(({ theme }) => ({
|
|
2891
|
+
minHeight: '48px',
|
|
2892
|
+
padding: '12px 0',
|
|
2893
|
+
gap: '6px',
|
|
2894
|
+
'&.Mui-expanded': {
|
|
2895
|
+
minHeight: '48px',
|
|
2896
|
+
},
|
|
2897
|
+
'& .MuiAccordionSummary-content': {
|
|
2898
|
+
margin: 0,
|
|
2899
|
+
'&.Mui-expanded': {
|
|
2900
|
+
margin: 0,
|
|
2901
|
+
},
|
|
2902
|
+
},
|
|
2903
|
+
'& .MuiAccordionSummary-expandIconWrapper': {
|
|
2904
|
+
transition: 'transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
|
2905
|
+
},
|
|
2906
|
+
}));
|
|
2907
|
+
const FAQQuestion = material.styled(material.Typography)(({ theme }) => ({
|
|
2908
|
+
fontWeight: 600,
|
|
2909
|
+
fontSize: '14px',
|
|
2910
|
+
lineHeight: '20px',
|
|
2911
|
+
flex: 1,
|
|
2912
|
+
[theme.breakpoints.up('md')]: {
|
|
2913
|
+
fontSize: '15px',
|
|
2914
|
+
lineHeight: '22px',
|
|
2915
|
+
},
|
|
2916
|
+
}));
|
|
2917
|
+
const StyledAccordionDetails = material.styled(material.AccordionDetails)(({ theme }) => ({
|
|
2918
|
+
fontWeight: 400,
|
|
2919
|
+
fontSize: '14px',
|
|
2920
|
+
lineHeight: '20px',
|
|
2921
|
+
padding: '0 0 16px 0',
|
|
2922
|
+
[theme.breakpoints.up('md')]: {
|
|
2923
|
+
fontSize: '15px',
|
|
2924
|
+
lineHeight: '22px',
|
|
2925
|
+
padding: '0 0 20px 0',
|
|
2926
|
+
},
|
|
2927
|
+
}));
|
|
2928
|
+
const FAQContentWrapper = material.styled(material.Box)({
|
|
2929
|
+
width: '100%',
|
|
2930
|
+
});
|
|
2931
|
+
|
|
2932
|
+
/**
|
|
2933
|
+
* FAQAccordion - Displays a list of frequently asked questions in an accordion format
|
|
2934
|
+
*
|
|
2935
|
+
* @example
|
|
2936
|
+
* ```tsx
|
|
2937
|
+
* const faqs = [
|
|
2938
|
+
* { id: 'faq-1', question: 'What is this product?', answer: 'This is a great product.' },
|
|
2939
|
+
* { id: 'faq-2', question: 'How does it work?', answer: 'It works seamlessly.' },
|
|
2940
|
+
* ]
|
|
2941
|
+
*
|
|
2942
|
+
* <FAQAccordion
|
|
2943
|
+
* faqs={faqs}
|
|
2944
|
+
* title="Frequently Asked Questions"
|
|
2945
|
+
* />
|
|
2946
|
+
* ```
|
|
2947
|
+
*/
|
|
2948
|
+
function FAQAccordion({ faqs, title = 'Frequently Asked Questions', formatMessage = (descriptor) => descriptor.defaultMessage || descriptor.id, backgroundColor, maxWidth = '1128px', className, defaultExpanded, onAccordionChange, }) {
|
|
2949
|
+
const [expanded, setExpanded] = React.useState(defaultExpanded || false);
|
|
2950
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
2951
|
+
const tenantTheme = useTenantTheme();
|
|
2952
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2953
|
+
// Get theme colors with SSR-safe fallbacks
|
|
2954
|
+
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
2955
|
+
const subtitleColor = getThemeColor(theme, 'natural.dark', '#5f5e62');
|
|
2956
|
+
const bgColor = backgroundColor || getThemeColor(theme, 'natural.light', '#ffffff');
|
|
2957
|
+
const handleChange = (panel) => (event, isExpanded) => {
|
|
2958
|
+
setExpanded(isExpanded ? panel : false);
|
|
2959
|
+
onAccordionChange === null || onAccordionChange === void 0 ? void 0 : onAccordionChange(panel, isExpanded);
|
|
2960
|
+
};
|
|
2961
|
+
const displayTitle = formatMessage({
|
|
2962
|
+
id: title,
|
|
2963
|
+
defaultMessage: title,
|
|
2964
|
+
});
|
|
2965
|
+
return (jsxRuntime.jsxs(FAQContainer, Object.assign({ className: className, sx: { backgroundColor: bgColor } }, { children: [jsxRuntime.jsx(FAQTitle, Object.assign({ sx: { color: textColor, maxWidth } }, { children: displayTitle })), jsxRuntime.jsx(FAQContentWrapper, Object.assign({ sx: { maxWidth } }, { children: faqs.map((faq) => (jsxRuntime.jsxs(StyledAccordion, Object.assign({ expanded: expanded === faq.id, onChange: handleChange(faq.id), disableGutters: true, elevation: 0 }, { children: [jsxRuntime.jsx(StyledAccordionSummary, Object.assign({ expandIcon: jsxRuntime.jsx(ExpandMoreIcon, { sx: { color: textColor } }), "aria-controls": `${faq.id}-content`, id: `${faq.id}-header` }, { children: jsxRuntime.jsx(FAQQuestion, Object.assign({ sx: { color: textColor } }, { children: faq.question })) })), jsxRuntime.jsx(StyledAccordionDetails, Object.assign({ sx: { color: subtitleColor } }, { children: faq.answer }))] }), faq.id))) }))] })));
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
/**
|
|
2969
|
+
* Benefits Summary Styled Components
|
|
2970
|
+
* MUI styled components for the Benefits Summary
|
|
2971
|
+
*/
|
|
2972
|
+
const SectionContainer = material.styled(material.Box)(({ theme }) => ({
|
|
2973
|
+
padding: '50px 16px',
|
|
2974
|
+
display: 'flex',
|
|
2975
|
+
flexDirection: 'column',
|
|
2976
|
+
gap: '32px',
|
|
2977
|
+
alignItems: 'center',
|
|
2978
|
+
width: '100%',
|
|
2979
|
+
backgroundColor: '#ffffff',
|
|
2980
|
+
[theme.breakpoints.up('md')]: {
|
|
2981
|
+
padding: '64px 32px',
|
|
2982
|
+
gap: '40px',
|
|
2983
|
+
},
|
|
2984
|
+
}));
|
|
2985
|
+
const SectionTitle = material.styled(material.Typography)(({ theme }) => ({
|
|
2986
|
+
fontWeight: 700,
|
|
2987
|
+
fontSize: '20px',
|
|
2988
|
+
lineHeight: '28px',
|
|
2989
|
+
textAlign: 'center',
|
|
2990
|
+
width: '100%',
|
|
2991
|
+
margin: 0,
|
|
2992
|
+
[theme.breakpoints.up('md')]: {
|
|
2993
|
+
fontSize: '28px',
|
|
2994
|
+
lineHeight: '36px',
|
|
2995
|
+
},
|
|
2996
|
+
}));
|
|
2997
|
+
const BenefitsList = material.styled(material.Box)(({ theme }) => ({
|
|
2998
|
+
display: 'flex',
|
|
2999
|
+
flexDirection: 'column',
|
|
3000
|
+
gap: '16px',
|
|
3001
|
+
width: '100%',
|
|
3002
|
+
[theme.breakpoints.up('md')]: {
|
|
3003
|
+
gap: '24px',
|
|
3004
|
+
},
|
|
3005
|
+
}));
|
|
3006
|
+
const BenefitItemContainer = material.styled(material.Box)(({ theme }) => ({
|
|
3007
|
+
display: 'flex',
|
|
3008
|
+
gap: '12px',
|
|
3009
|
+
alignItems: 'flex-start',
|
|
3010
|
+
width: '100%',
|
|
3011
|
+
[theme.breakpoints.up('md')]: {
|
|
3012
|
+
gap: '16px',
|
|
3013
|
+
},
|
|
3014
|
+
}));
|
|
3015
|
+
const BenefitIcon = material.styled(material.Box)({
|
|
3016
|
+
flexShrink: 0,
|
|
3017
|
+
display: 'flex',
|
|
3018
|
+
alignItems: 'center',
|
|
3019
|
+
justifyContent: 'center',
|
|
3020
|
+
});
|
|
3021
|
+
const BenefitContent = material.styled(material.Box)({
|
|
3022
|
+
flex: 1,
|
|
3023
|
+
display: 'flex',
|
|
3024
|
+
flexDirection: 'column',
|
|
3025
|
+
gap: '6px',
|
|
3026
|
+
});
|
|
3027
|
+
const BenefitTitle = material.styled(material.Typography)(({ theme }) => ({
|
|
3028
|
+
fontWeight: 600,
|
|
3029
|
+
fontSize: '14px',
|
|
3030
|
+
lineHeight: '20px',
|
|
3031
|
+
margin: 0,
|
|
3032
|
+
[theme.breakpoints.up('md')]: {
|
|
3033
|
+
fontSize: '16px',
|
|
3034
|
+
lineHeight: '22px',
|
|
3035
|
+
},
|
|
3036
|
+
}));
|
|
3037
|
+
const BenefitDescription = material.styled(material.Typography)(({ theme }) => ({
|
|
3038
|
+
fontWeight: 400,
|
|
3039
|
+
fontSize: '14px',
|
|
3040
|
+
lineHeight: '18px',
|
|
3041
|
+
margin: 0,
|
|
3042
|
+
[theme.breakpoints.up('md')]: {
|
|
3043
|
+
fontSize: '15px',
|
|
3044
|
+
lineHeight: '20px',
|
|
3045
|
+
},
|
|
3046
|
+
}));
|
|
3047
|
+
|
|
3048
|
+
/**
|
|
3049
|
+
* BenefitsSummary - Displays a list of product benefits
|
|
3050
|
+
*
|
|
3051
|
+
* @example
|
|
3052
|
+
* ```tsx
|
|
3053
|
+
* const benefits = [
|
|
3054
|
+
* { id: 'benefit-1', icon: '/icons/health.svg', title: 'Death Benefit', description: '100% of Sum Assured' },
|
|
3055
|
+
* { id: 'benefit-2', icon: <HealthIcon />, title: 'TPD Coverage', description: 'Total & Permanent Disability' },
|
|
3056
|
+
* ]
|
|
3057
|
+
*
|
|
3058
|
+
* <BenefitsSummary
|
|
3059
|
+
* benefits={benefits}
|
|
3060
|
+
* title="Benefits Summary"
|
|
3061
|
+
* />
|
|
3062
|
+
* ```
|
|
3063
|
+
*/
|
|
3064
|
+
function BenefitsSummary({ benefits, title = 'Benefits Summary', formatMessage = (descriptor) => descriptor.defaultMessage || descriptor.id, backgroundColor, maxWidth = '1128px', className, iconSize = 24, }) {
|
|
3065
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
3066
|
+
const tenantTheme = useTenantTheme();
|
|
3067
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
3068
|
+
// Get theme colors with SSR-safe fallbacks
|
|
3069
|
+
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
3070
|
+
const subtitleColor = getThemeColor(theme, 'natural.dark', '#5f5e62');
|
|
3071
|
+
const bgColor = backgroundColor || getThemeColor(theme, 'natural.bright', '#ffffff');
|
|
3072
|
+
const displayTitle = formatMessage({
|
|
3073
|
+
id: title,
|
|
3074
|
+
defaultMessage: title,
|
|
3075
|
+
});
|
|
3076
|
+
const renderIcon = (icon) => {
|
|
3077
|
+
if (typeof icon === 'string') {
|
|
3078
|
+
return (jsxRuntime.jsx("img", { src: icon, alt: "", style: {
|
|
3079
|
+
width: iconSize,
|
|
3080
|
+
height: iconSize,
|
|
3081
|
+
objectFit: 'contain',
|
|
3082
|
+
} }));
|
|
3083
|
+
}
|
|
3084
|
+
return icon;
|
|
3085
|
+
};
|
|
3086
|
+
const renderDescription = (description) => {
|
|
3087
|
+
const lines = description.split('\n');
|
|
3088
|
+
return lines.map((line, index) => (jsxRuntime.jsxs(React__namespace.Fragment, { children: [line, index < lines.length - 1 && jsxRuntime.jsx("br", {})] }, index)));
|
|
3089
|
+
};
|
|
3090
|
+
return (jsxRuntime.jsxs(SectionContainer, Object.assign({ className: className, sx: { backgroundColor: bgColor } }, { children: [jsxRuntime.jsx(SectionTitle, Object.assign({ sx: { color: textColor, maxWidth } }, { children: displayTitle })), jsxRuntime.jsx(BenefitsList, Object.assign({ sx: { maxWidth } }, { children: benefits.map((benefit) => (jsxRuntime.jsxs(BenefitItemContainer, { children: [jsxRuntime.jsx(BenefitIcon, Object.assign({ sx: {
|
|
3091
|
+
width: iconSize,
|
|
3092
|
+
height: iconSize,
|
|
3093
|
+
} }, { children: renderIcon(benefit.icon) })), jsxRuntime.jsxs(BenefitContent, { children: [jsxRuntime.jsx(BenefitTitle, Object.assign({ sx: { color: textColor } }, { children: benefit.title })), jsxRuntime.jsx(BenefitDescription, Object.assign({ sx: { color: subtitleColor } }, { children: renderDescription(benefit.description) }))] })] }, benefit.id))) }))] })));
|
|
3094
|
+
}
|
|
3095
|
+
|
|
2845
3096
|
/**
|
|
2846
3097
|
* Asset Management Utilities
|
|
2847
3098
|
* Helper functions for managing tenant-specific assets
|
|
@@ -2957,6 +3208,7 @@ function getIconPath(iconName) {
|
|
|
2957
3208
|
}
|
|
2958
3209
|
|
|
2959
3210
|
exports.Banner = Banner;
|
|
3211
|
+
exports.BenefitsSummary = BenefitsSummary;
|
|
2960
3212
|
exports.BillingToggle = BillingToggle;
|
|
2961
3213
|
exports.Button = Button;
|
|
2962
3214
|
exports.Card = Card;
|
|
@@ -2966,6 +3218,7 @@ exports.CheckoutProgress = CheckoutProgress;
|
|
|
2966
3218
|
exports.ChildInformationForm = ChildInformationForm;
|
|
2967
3219
|
exports.ContactDetailsForm = ContactDetailsForm;
|
|
2968
3220
|
exports.CoverageAmountSlider = CoverageAmountSlider;
|
|
3221
|
+
exports.FAQAccordion = FAQAccordion;
|
|
2969
3222
|
exports.Footer = Footer;
|
|
2970
3223
|
exports.Header = Header$1;
|
|
2971
3224
|
exports.HealthInformationForm = HealthInformationForm;
|