@app-studio/web 0.9.12 → 0.9.13
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/dist/components/Title/Title/Title.props.d.ts +16 -0
- package/dist/components/Title/Title/Title.style.d.ts +27 -0
- package/dist/components/Title/examples/animationLoop.d.ts +5 -0
- package/dist/components/Title/examples/index.d.ts +1 -0
- package/dist/components/Title/examples/responsive.d.ts +1 -1
- package/dist/pages/responsive-title-demo.page.d.ts +6 -0
- package/dist/web.cjs.development.js +140 -16
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +140 -16
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +140 -16
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -61,11 +61,27 @@ export interface TitleProps extends ViewProps {
|
|
|
61
61
|
* This should be an animation object with properties like from, to, duration, etc.
|
|
62
62
|
*/
|
|
63
63
|
animate?: AnimationProps | AnimationProps[];
|
|
64
|
+
/**
|
|
65
|
+
* Controls the animation loop behavior for the title animation
|
|
66
|
+
* @default '1' (play once)
|
|
67
|
+
*/
|
|
68
|
+
animationLoop?: number | 'infinite';
|
|
69
|
+
/**
|
|
70
|
+
* Controls the animation loop behavior for the highlight animation
|
|
71
|
+
* @default '1' (play once)
|
|
72
|
+
*/
|
|
73
|
+
highlightAnimationLoop?: number | 'infinite';
|
|
64
74
|
/**
|
|
65
75
|
* Size of the title
|
|
66
76
|
* @default 'xl'
|
|
67
77
|
*/
|
|
68
78
|
size?: TitleSize;
|
|
79
|
+
/**
|
|
80
|
+
* Whether to enable responsive sizing based on breakpoints
|
|
81
|
+
* When true, the title will automatically adapt its size across mobile/tablet/desktop
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
responsive?: boolean;
|
|
69
85
|
/**
|
|
70
86
|
* Whether to center the title
|
|
71
87
|
* @default false
|
|
@@ -14,6 +14,33 @@ export declare const TitleSizes: {
|
|
|
14
14
|
* Line heights for different title sizes
|
|
15
15
|
*/
|
|
16
16
|
export declare const LineHeights: Record<TitleSize, number>;
|
|
17
|
+
/**
|
|
18
|
+
* Responsive typography system that maps title sizes to responsive breakpoints
|
|
19
|
+
* Based on the Typography system with dynamic breakpoint sizing
|
|
20
|
+
*/
|
|
21
|
+
export declare const ResponsiveTypography: Record<TitleSize, {
|
|
22
|
+
lineHeight: string;
|
|
23
|
+
fontWeight: number;
|
|
24
|
+
marginBottom?: number;
|
|
25
|
+
letterSpacing?: number;
|
|
26
|
+
media: {
|
|
27
|
+
mobile: {
|
|
28
|
+
fontSize: number;
|
|
29
|
+
width?: string;
|
|
30
|
+
minWidth?: string;
|
|
31
|
+
};
|
|
32
|
+
tablet: {
|
|
33
|
+
fontSize: number;
|
|
34
|
+
width?: string;
|
|
35
|
+
minWidth?: string;
|
|
36
|
+
};
|
|
37
|
+
desktop: {
|
|
38
|
+
fontSize: number;
|
|
39
|
+
width?: string;
|
|
40
|
+
minWidth?: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
17
44
|
/**
|
|
18
45
|
* Default styles for different highlight types
|
|
19
46
|
*/
|
|
@@ -16604,6 +16604,99 @@ var LineHeights$1 = {
|
|
|
16604
16604
|
lg: 72,
|
|
16605
16605
|
xl: 80
|
|
16606
16606
|
};
|
|
16607
|
+
/**
|
|
16608
|
+
* Responsive typography system that maps title sizes to responsive breakpoints
|
|
16609
|
+
* Based on the Typography system with dynamic breakpoint sizing
|
|
16610
|
+
*/
|
|
16611
|
+
var ResponsiveTypography = {
|
|
16612
|
+
// xl maps to H1 - Largest heading
|
|
16613
|
+
xl: {
|
|
16614
|
+
lineHeight: '120%',
|
|
16615
|
+
fontWeight: 500,
|
|
16616
|
+
marginBottom: 20,
|
|
16617
|
+
letterSpacing: 1.25,
|
|
16618
|
+
media: {
|
|
16619
|
+
mobile: {
|
|
16620
|
+
fontSize: 42,
|
|
16621
|
+
width: '100%'
|
|
16622
|
+
},
|
|
16623
|
+
tablet: {
|
|
16624
|
+
fontSize: 50,
|
|
16625
|
+
width: '100%'
|
|
16626
|
+
},
|
|
16627
|
+
desktop: {
|
|
16628
|
+
fontSize: 58,
|
|
16629
|
+
minWidth: '60%'
|
|
16630
|
+
}
|
|
16631
|
+
}
|
|
16632
|
+
},
|
|
16633
|
+
// lg maps to H2 - Large heading
|
|
16634
|
+
lg: {
|
|
16635
|
+
lineHeight: '100%',
|
|
16636
|
+
fontWeight: 500,
|
|
16637
|
+
media: {
|
|
16638
|
+
mobile: {
|
|
16639
|
+
fontSize: 32
|
|
16640
|
+
},
|
|
16641
|
+
tablet: {
|
|
16642
|
+
fontSize: 40
|
|
16643
|
+
},
|
|
16644
|
+
desktop: {
|
|
16645
|
+
fontSize: 48
|
|
16646
|
+
}
|
|
16647
|
+
}
|
|
16648
|
+
},
|
|
16649
|
+
// md maps to H3 - Medium heading
|
|
16650
|
+
md: {
|
|
16651
|
+
lineHeight: '100%',
|
|
16652
|
+
fontWeight: 500,
|
|
16653
|
+
media: {
|
|
16654
|
+
mobile: {
|
|
16655
|
+
fontSize: 20
|
|
16656
|
+
},
|
|
16657
|
+
tablet: {
|
|
16658
|
+
fontSize: 30
|
|
16659
|
+
},
|
|
16660
|
+
desktop: {
|
|
16661
|
+
fontSize: 40
|
|
16662
|
+
}
|
|
16663
|
+
}
|
|
16664
|
+
},
|
|
16665
|
+
// sm maps to T1 - Title text
|
|
16666
|
+
sm: {
|
|
16667
|
+
lineHeight: '100%',
|
|
16668
|
+
fontWeight: 400,
|
|
16669
|
+
letterSpacing: -0.2,
|
|
16670
|
+
media: {
|
|
16671
|
+
mobile: {
|
|
16672
|
+
fontSize: 16
|
|
16673
|
+
},
|
|
16674
|
+
tablet: {
|
|
16675
|
+
fontSize: 28
|
|
16676
|
+
},
|
|
16677
|
+
desktop: {
|
|
16678
|
+
fontSize: 32
|
|
16679
|
+
}
|
|
16680
|
+
}
|
|
16681
|
+
},
|
|
16682
|
+
// xs maps to S1 - Subtitle text
|
|
16683
|
+
xs: {
|
|
16684
|
+
lineHeight: '120%',
|
|
16685
|
+
fontWeight: 400,
|
|
16686
|
+
letterSpacing: -0.2,
|
|
16687
|
+
media: {
|
|
16688
|
+
mobile: {
|
|
16689
|
+
fontSize: 12
|
|
16690
|
+
},
|
|
16691
|
+
tablet: {
|
|
16692
|
+
fontSize: 18
|
|
16693
|
+
},
|
|
16694
|
+
desktop: {
|
|
16695
|
+
fontSize: 24
|
|
16696
|
+
}
|
|
16697
|
+
}
|
|
16698
|
+
}
|
|
16699
|
+
};
|
|
16607
16700
|
/**
|
|
16608
16701
|
* Default styles for different highlight types
|
|
16609
16702
|
*/
|
|
@@ -16722,7 +16815,7 @@ var TypewriterEffect = _ref => {
|
|
|
16722
16815
|
}))))));
|
|
16723
16816
|
};
|
|
16724
16817
|
|
|
16725
|
-
var _excluded$S = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "centered", "views", "highlightAnimate", "animate", "highlightTypewriter", "highlightTypewriterDuration"];
|
|
16818
|
+
var _excluded$S = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "responsive", "centered", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration"];
|
|
16726
16819
|
function escapeRegExp(string) {
|
|
16727
16820
|
return string.replace(/[.*+?^${}()|[\\]\\/g, '\\$&');
|
|
16728
16821
|
}
|
|
@@ -16733,11 +16826,14 @@ var TitleView = _ref => {
|
|
|
16733
16826
|
highlightStyle = 'background',
|
|
16734
16827
|
highlightColor = 'theme.primary',
|
|
16735
16828
|
highlightSecondaryColor,
|
|
16736
|
-
size = '
|
|
16829
|
+
size = 'lg',
|
|
16830
|
+
responsive = true,
|
|
16737
16831
|
centered = false,
|
|
16738
16832
|
views,
|
|
16739
16833
|
highlightAnimate,
|
|
16740
16834
|
animate,
|
|
16835
|
+
animationLoop = 1,
|
|
16836
|
+
highlightAnimationLoop = 1,
|
|
16741
16837
|
highlightTypewriter: propHighlightTypewriter = false,
|
|
16742
16838
|
highlightTypewriterDuration = 3000
|
|
16743
16839
|
} = _ref,
|
|
@@ -16775,8 +16871,27 @@ var TitleView = _ref => {
|
|
|
16775
16871
|
highlightTypewriter: propHighlightTypewriter,
|
|
16776
16872
|
highlightTypewriterDuration
|
|
16777
16873
|
}, props));
|
|
16874
|
+
// Determine if we should use responsive sizing or static sizing
|
|
16875
|
+
var useResponsive = responsive && !props.media; // Don't override if media prop is already provided
|
|
16778
16876
|
var fontSize = TitleSizes[size];
|
|
16779
16877
|
var lineHeight = LineHeights$1[size];
|
|
16878
|
+
// Get responsive styles if responsive prop is true
|
|
16879
|
+
var responsiveStyles = useResponsive ? ResponsiveTypography[size] : null;
|
|
16880
|
+
// Helper function to apply loop control to animations
|
|
16881
|
+
var applyAnimationLoop = (animation, loopControl) => {
|
|
16882
|
+
if (!animation) return animation;
|
|
16883
|
+
if (Array.isArray(animation)) {
|
|
16884
|
+
return animation.map(anim => Object.assign({}, anim, {
|
|
16885
|
+
iterationCount: loopControl.toString()
|
|
16886
|
+
}));
|
|
16887
|
+
}
|
|
16888
|
+
return Object.assign({}, animation, {
|
|
16889
|
+
iterationCount: loopControl.toString()
|
|
16890
|
+
});
|
|
16891
|
+
};
|
|
16892
|
+
// Apply loop control to animations
|
|
16893
|
+
var controlledAnimate = applyAnimationLoop(animate, animationLoop);
|
|
16894
|
+
var controlledHighlightAnimate = applyAnimationLoop(highlightAnimate, highlightAnimationLoop);
|
|
16780
16895
|
// Get the text to display
|
|
16781
16896
|
var text = typeof finalDisplayedText === 'string' ? finalDisplayedText : typeof children === 'string' ? children : '';
|
|
16782
16897
|
if (typeof text === 'string' && activeHighlightTarget) {
|
|
@@ -16800,16 +16915,19 @@ var TitleView = _ref => {
|
|
|
16800
16915
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
16801
16916
|
ref: ref,
|
|
16802
16917
|
as: "h1",
|
|
16803
|
-
fontSize: fontSize,
|
|
16804
|
-
lineHeight: lineHeight + "px",
|
|
16805
|
-
fontWeight:
|
|
16918
|
+
fontSize: useResponsive ? undefined : fontSize,
|
|
16919
|
+
lineHeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.lineHeight : lineHeight + "px",
|
|
16920
|
+
fontWeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.fontWeight : 'bold',
|
|
16921
|
+
letterSpacing: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.letterSpacing : undefined,
|
|
16922
|
+
marginBottom: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.marginBottom : undefined,
|
|
16806
16923
|
textAlign: centered ? 'center' : 'left',
|
|
16807
|
-
animate: inView ?
|
|
16924
|
+
animate: inView ? controlledAnimate : undefined,
|
|
16925
|
+
media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
|
|
16808
16926
|
}, views == null ? void 0 : views.container, props), parts.map((part, idx) => typeof part === 'string' ? part : (/*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
|
|
16809
16927
|
key: part.text + "-" + idx,
|
|
16810
16928
|
as: "span",
|
|
16811
16929
|
display: "inline",
|
|
16812
|
-
animate: inView ?
|
|
16930
|
+
animate: inView ? controlledHighlightAnimate : undefined
|
|
16813
16931
|
}, HighlightStyles[highlightStyle](resolvedColor, resolvedSecondary), views == null ? void 0 : views.highlight), highlightTypewriter ? (/*#__PURE__*/React__default.createElement(TypewriterEffect, {
|
|
16814
16932
|
text: part.text,
|
|
16815
16933
|
typingSpeed: Math.max(30, highlightTypewriterDuration / (part.text.length * 10)),
|
|
@@ -16822,15 +16940,18 @@ var TitleView = _ref => {
|
|
|
16822
16940
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
16823
16941
|
ref: ref,
|
|
16824
16942
|
as: "h1",
|
|
16825
|
-
fontSize: fontSize,
|
|
16826
|
-
lineHeight: lineHeight + "px",
|
|
16827
|
-
fontWeight:
|
|
16943
|
+
fontSize: useResponsive ? undefined : fontSize,
|
|
16944
|
+
lineHeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.lineHeight : lineHeight + "px",
|
|
16945
|
+
fontWeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.fontWeight : 'bold',
|
|
16946
|
+
letterSpacing: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.letterSpacing : undefined,
|
|
16947
|
+
marginBottom: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.marginBottom : undefined,
|
|
16828
16948
|
textAlign: centered ? 'center' : 'left',
|
|
16829
|
-
animate: inView ?
|
|
16949
|
+
animate: inView ? controlledAnimate : undefined,
|
|
16950
|
+
media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
|
|
16830
16951
|
}, views == null ? void 0 : views.container, props), /*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
|
|
16831
16952
|
as: "span",
|
|
16832
16953
|
display: "inline",
|
|
16833
|
-
animate: inView ?
|
|
16954
|
+
animate: inView ? controlledHighlightAnimate : undefined
|
|
16834
16955
|
}, HighlightStyles[highlightStyle](resolvedColor, resolvedSecondary), views == null ? void 0 : views.highlight), highlightTypewriter ? (/*#__PURE__*/React__default.createElement(TypewriterEffect, {
|
|
16835
16956
|
text: text,
|
|
16836
16957
|
typingSpeed: Math.max(30, highlightTypewriterDuration / (text.length * 10)),
|
|
@@ -16842,11 +16963,14 @@ var TitleView = _ref => {
|
|
|
16842
16963
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
16843
16964
|
ref: ref,
|
|
16844
16965
|
as: "h1",
|
|
16845
|
-
fontSize: fontSize,
|
|
16846
|
-
lineHeight: lineHeight + "px",
|
|
16847
|
-
fontWeight:
|
|
16966
|
+
fontSize: useResponsive ? undefined : fontSize,
|
|
16967
|
+
lineHeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.lineHeight : lineHeight + "px",
|
|
16968
|
+
fontWeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.fontWeight : 'bold',
|
|
16969
|
+
letterSpacing: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.letterSpacing : undefined,
|
|
16970
|
+
marginBottom: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.marginBottom : undefined,
|
|
16848
16971
|
textAlign: centered ? 'center' : 'left',
|
|
16849
|
-
animate: inView ?
|
|
16972
|
+
animate: inView ? controlledAnimate : undefined,
|
|
16973
|
+
media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
|
|
16850
16974
|
}, views == null ? void 0 : views.container, props), text);
|
|
16851
16975
|
};
|
|
16852
16976
|
|