@app-studio/web 0.9.12 → 0.9.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/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/components/Toggle/Toggle/Toggle.style.d.ts +7 -1
- package/dist/components/Toggle/Toggle/Toggle.view.d.ts +3 -0
- package/dist/pages/responsive-title-demo.page.d.ts +6 -0
- package/dist/web.cjs.development.js +240 -40
- 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 +240 -40
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +240 -40
- 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
package/dist/web.esm.js
CHANGED
|
@@ -16597,6 +16597,99 @@ var LineHeights$1 = {
|
|
|
16597
16597
|
lg: 72,
|
|
16598
16598
|
xl: 80
|
|
16599
16599
|
};
|
|
16600
|
+
/**
|
|
16601
|
+
* Responsive typography system that maps title sizes to responsive breakpoints
|
|
16602
|
+
* Based on the Typography system with dynamic breakpoint sizing
|
|
16603
|
+
*/
|
|
16604
|
+
var ResponsiveTypography = {
|
|
16605
|
+
// xl maps to H1 - Largest heading
|
|
16606
|
+
xl: {
|
|
16607
|
+
lineHeight: '120%',
|
|
16608
|
+
fontWeight: 500,
|
|
16609
|
+
marginBottom: 20,
|
|
16610
|
+
letterSpacing: 1.25,
|
|
16611
|
+
media: {
|
|
16612
|
+
mobile: {
|
|
16613
|
+
fontSize: 42,
|
|
16614
|
+
width: '100%'
|
|
16615
|
+
},
|
|
16616
|
+
tablet: {
|
|
16617
|
+
fontSize: 50,
|
|
16618
|
+
width: '100%'
|
|
16619
|
+
},
|
|
16620
|
+
desktop: {
|
|
16621
|
+
fontSize: 58,
|
|
16622
|
+
minWidth: '60%'
|
|
16623
|
+
}
|
|
16624
|
+
}
|
|
16625
|
+
},
|
|
16626
|
+
// lg maps to H2 - Large heading
|
|
16627
|
+
lg: {
|
|
16628
|
+
lineHeight: '100%',
|
|
16629
|
+
fontWeight: 500,
|
|
16630
|
+
media: {
|
|
16631
|
+
mobile: {
|
|
16632
|
+
fontSize: 32
|
|
16633
|
+
},
|
|
16634
|
+
tablet: {
|
|
16635
|
+
fontSize: 40
|
|
16636
|
+
},
|
|
16637
|
+
desktop: {
|
|
16638
|
+
fontSize: 48
|
|
16639
|
+
}
|
|
16640
|
+
}
|
|
16641
|
+
},
|
|
16642
|
+
// md maps to H3 - Medium heading
|
|
16643
|
+
md: {
|
|
16644
|
+
lineHeight: '100%',
|
|
16645
|
+
fontWeight: 500,
|
|
16646
|
+
media: {
|
|
16647
|
+
mobile: {
|
|
16648
|
+
fontSize: 20
|
|
16649
|
+
},
|
|
16650
|
+
tablet: {
|
|
16651
|
+
fontSize: 30
|
|
16652
|
+
},
|
|
16653
|
+
desktop: {
|
|
16654
|
+
fontSize: 40
|
|
16655
|
+
}
|
|
16656
|
+
}
|
|
16657
|
+
},
|
|
16658
|
+
// sm maps to T1 - Title text
|
|
16659
|
+
sm: {
|
|
16660
|
+
lineHeight: '100%',
|
|
16661
|
+
fontWeight: 400,
|
|
16662
|
+
letterSpacing: -0.2,
|
|
16663
|
+
media: {
|
|
16664
|
+
mobile: {
|
|
16665
|
+
fontSize: 16
|
|
16666
|
+
},
|
|
16667
|
+
tablet: {
|
|
16668
|
+
fontSize: 28
|
|
16669
|
+
},
|
|
16670
|
+
desktop: {
|
|
16671
|
+
fontSize: 32
|
|
16672
|
+
}
|
|
16673
|
+
}
|
|
16674
|
+
},
|
|
16675
|
+
// xs maps to S1 - Subtitle text
|
|
16676
|
+
xs: {
|
|
16677
|
+
lineHeight: '120%',
|
|
16678
|
+
fontWeight: 400,
|
|
16679
|
+
letterSpacing: -0.2,
|
|
16680
|
+
media: {
|
|
16681
|
+
mobile: {
|
|
16682
|
+
fontSize: 12
|
|
16683
|
+
},
|
|
16684
|
+
tablet: {
|
|
16685
|
+
fontSize: 18
|
|
16686
|
+
},
|
|
16687
|
+
desktop: {
|
|
16688
|
+
fontSize: 24
|
|
16689
|
+
}
|
|
16690
|
+
}
|
|
16691
|
+
}
|
|
16692
|
+
};
|
|
16600
16693
|
/**
|
|
16601
16694
|
* Default styles for different highlight types
|
|
16602
16695
|
*/
|
|
@@ -16715,7 +16808,7 @@ var TypewriterEffect = _ref => {
|
|
|
16715
16808
|
}))))));
|
|
16716
16809
|
};
|
|
16717
16810
|
|
|
16718
|
-
var _excluded$S = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "centered", "views", "highlightAnimate", "animate", "highlightTypewriter", "highlightTypewriterDuration"];
|
|
16811
|
+
var _excluded$S = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "responsive", "centered", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration"];
|
|
16719
16812
|
function escapeRegExp(string) {
|
|
16720
16813
|
return string.replace(/[.*+?^${}()|[\\]\\/g, '\\$&');
|
|
16721
16814
|
}
|
|
@@ -16726,11 +16819,14 @@ var TitleView = _ref => {
|
|
|
16726
16819
|
highlightStyle = 'background',
|
|
16727
16820
|
highlightColor = 'theme.primary',
|
|
16728
16821
|
highlightSecondaryColor,
|
|
16729
|
-
size = '
|
|
16822
|
+
size = 'lg',
|
|
16823
|
+
responsive = true,
|
|
16730
16824
|
centered = false,
|
|
16731
16825
|
views,
|
|
16732
16826
|
highlightAnimate,
|
|
16733
16827
|
animate,
|
|
16828
|
+
animationLoop = 1,
|
|
16829
|
+
highlightAnimationLoop = 1,
|
|
16734
16830
|
highlightTypewriter: propHighlightTypewriter = false,
|
|
16735
16831
|
highlightTypewriterDuration = 3000
|
|
16736
16832
|
} = _ref,
|
|
@@ -16768,8 +16864,27 @@ var TitleView = _ref => {
|
|
|
16768
16864
|
highlightTypewriter: propHighlightTypewriter,
|
|
16769
16865
|
highlightTypewriterDuration
|
|
16770
16866
|
}, props));
|
|
16867
|
+
// Determine if we should use responsive sizing or static sizing
|
|
16868
|
+
var useResponsive = responsive && !props.media; // Don't override if media prop is already provided
|
|
16771
16869
|
var fontSize = TitleSizes[size];
|
|
16772
16870
|
var lineHeight = LineHeights$1[size];
|
|
16871
|
+
// Get responsive styles if responsive prop is true
|
|
16872
|
+
var responsiveStyles = useResponsive ? ResponsiveTypography[size] : null;
|
|
16873
|
+
// Helper function to apply loop control to animations
|
|
16874
|
+
var applyAnimationLoop = (animation, loopControl) => {
|
|
16875
|
+
if (!animation) return animation;
|
|
16876
|
+
if (Array.isArray(animation)) {
|
|
16877
|
+
return animation.map(anim => Object.assign({}, anim, {
|
|
16878
|
+
iterationCount: loopControl.toString()
|
|
16879
|
+
}));
|
|
16880
|
+
}
|
|
16881
|
+
return Object.assign({}, animation, {
|
|
16882
|
+
iterationCount: loopControl.toString()
|
|
16883
|
+
});
|
|
16884
|
+
};
|
|
16885
|
+
// Apply loop control to animations
|
|
16886
|
+
var controlledAnimate = applyAnimationLoop(animate, animationLoop);
|
|
16887
|
+
var controlledHighlightAnimate = applyAnimationLoop(highlightAnimate, highlightAnimationLoop);
|
|
16773
16888
|
// Get the text to display
|
|
16774
16889
|
var text = typeof finalDisplayedText === 'string' ? finalDisplayedText : typeof children === 'string' ? children : '';
|
|
16775
16890
|
if (typeof text === 'string' && activeHighlightTarget) {
|
|
@@ -16793,16 +16908,19 @@ var TitleView = _ref => {
|
|
|
16793
16908
|
return /*#__PURE__*/React.createElement(Element, Object.assign({
|
|
16794
16909
|
ref: ref,
|
|
16795
16910
|
as: "h1",
|
|
16796
|
-
fontSize: fontSize,
|
|
16797
|
-
lineHeight: lineHeight + "px",
|
|
16798
|
-
fontWeight:
|
|
16911
|
+
fontSize: useResponsive ? undefined : fontSize,
|
|
16912
|
+
lineHeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.lineHeight : lineHeight + "px",
|
|
16913
|
+
fontWeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.fontWeight : 'bold',
|
|
16914
|
+
letterSpacing: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.letterSpacing : undefined,
|
|
16915
|
+
marginBottom: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.marginBottom : undefined,
|
|
16799
16916
|
textAlign: centered ? 'center' : 'left',
|
|
16800
|
-
animate: inView ?
|
|
16917
|
+
animate: inView ? controlledAnimate : undefined,
|
|
16918
|
+
media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
|
|
16801
16919
|
}, views == null ? void 0 : views.container, props), parts.map((part, idx) => typeof part === 'string' ? part : (/*#__PURE__*/React.createElement(Text$1, Object.assign({
|
|
16802
16920
|
key: part.text + "-" + idx,
|
|
16803
16921
|
as: "span",
|
|
16804
16922
|
display: "inline",
|
|
16805
|
-
animate: inView ?
|
|
16923
|
+
animate: inView ? controlledHighlightAnimate : undefined
|
|
16806
16924
|
}, HighlightStyles[highlightStyle](resolvedColor, resolvedSecondary), views == null ? void 0 : views.highlight), highlightTypewriter ? (/*#__PURE__*/React.createElement(TypewriterEffect, {
|
|
16807
16925
|
text: part.text,
|
|
16808
16926
|
typingSpeed: Math.max(30, highlightTypewriterDuration / (part.text.length * 10)),
|
|
@@ -16815,15 +16933,18 @@ var TitleView = _ref => {
|
|
|
16815
16933
|
return /*#__PURE__*/React.createElement(Element, Object.assign({
|
|
16816
16934
|
ref: ref,
|
|
16817
16935
|
as: "h1",
|
|
16818
|
-
fontSize: fontSize,
|
|
16819
|
-
lineHeight: lineHeight + "px",
|
|
16820
|
-
fontWeight:
|
|
16936
|
+
fontSize: useResponsive ? undefined : fontSize,
|
|
16937
|
+
lineHeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.lineHeight : lineHeight + "px",
|
|
16938
|
+
fontWeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.fontWeight : 'bold',
|
|
16939
|
+
letterSpacing: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.letterSpacing : undefined,
|
|
16940
|
+
marginBottom: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.marginBottom : undefined,
|
|
16821
16941
|
textAlign: centered ? 'center' : 'left',
|
|
16822
|
-
animate: inView ?
|
|
16942
|
+
animate: inView ? controlledAnimate : undefined,
|
|
16943
|
+
media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
|
|
16823
16944
|
}, views == null ? void 0 : views.container, props), /*#__PURE__*/React.createElement(Text$1, Object.assign({
|
|
16824
16945
|
as: "span",
|
|
16825
16946
|
display: "inline",
|
|
16826
|
-
animate: inView ?
|
|
16947
|
+
animate: inView ? controlledHighlightAnimate : undefined
|
|
16827
16948
|
}, HighlightStyles[highlightStyle](resolvedColor, resolvedSecondary), views == null ? void 0 : views.highlight), highlightTypewriter ? (/*#__PURE__*/React.createElement(TypewriterEffect, {
|
|
16828
16949
|
text: text,
|
|
16829
16950
|
typingSpeed: Math.max(30, highlightTypewriterDuration / (text.length * 10)),
|
|
@@ -16835,11 +16956,14 @@ var TitleView = _ref => {
|
|
|
16835
16956
|
return /*#__PURE__*/React.createElement(Element, Object.assign({
|
|
16836
16957
|
ref: ref,
|
|
16837
16958
|
as: "h1",
|
|
16838
|
-
fontSize: fontSize,
|
|
16839
|
-
lineHeight: lineHeight + "px",
|
|
16840
|
-
fontWeight:
|
|
16959
|
+
fontSize: useResponsive ? undefined : fontSize,
|
|
16960
|
+
lineHeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.lineHeight : lineHeight + "px",
|
|
16961
|
+
fontWeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.fontWeight : 'bold',
|
|
16962
|
+
letterSpacing: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.letterSpacing : undefined,
|
|
16963
|
+
marginBottom: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.marginBottom : undefined,
|
|
16841
16964
|
textAlign: centered ? 'center' : 'left',
|
|
16842
|
-
animate: inView ?
|
|
16965
|
+
animate: inView ? controlledAnimate : undefined,
|
|
16966
|
+
media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
|
|
16843
16967
|
}, views == null ? void 0 : views.container, props), text);
|
|
16844
16968
|
};
|
|
16845
16969
|
|
|
@@ -16905,8 +17029,78 @@ var useToggleState = defaultToggled => {
|
|
|
16905
17029
|
};
|
|
16906
17030
|
};
|
|
16907
17031
|
|
|
16908
|
-
var
|
|
17032
|
+
var ToggleShapes = {
|
|
17033
|
+
sharp: 0,
|
|
17034
|
+
rounded: 4,
|
|
17035
|
+
pillShaped: 24
|
|
17036
|
+
};
|
|
17037
|
+
/**
|
|
17038
|
+
* Generate toggle variants with proper color combinations based on main color and contrast
|
|
17039
|
+
* Similar to Button's getButtonVariants function
|
|
17040
|
+
*/
|
|
17041
|
+
var getToggleVariants = (color, isLight) => ({
|
|
17042
|
+
outline: {
|
|
17043
|
+
backgroundColor: 'transparent',
|
|
17044
|
+
color: color,
|
|
17045
|
+
borderWidth: 1,
|
|
17046
|
+
borderStyle: 'solid',
|
|
17047
|
+
borderColor: color,
|
|
17048
|
+
_hover: {
|
|
17049
|
+
backgroundColor: color,
|
|
17050
|
+
color: isLight ? 'color.black' : 'color.white',
|
|
17051
|
+
transform: 'translateY(-1px)'
|
|
17052
|
+
},
|
|
17053
|
+
_active: {
|
|
17054
|
+
backgroundColor: color,
|
|
17055
|
+
color: isLight ? 'color.black' : 'color.white',
|
|
17056
|
+
transform: 'translateY(0)'
|
|
17057
|
+
},
|
|
17058
|
+
transition: 'all 0.2s ease'
|
|
17059
|
+
},
|
|
17060
|
+
ghost: {
|
|
17061
|
+
backgroundColor: 'transparent',
|
|
17062
|
+
color: color,
|
|
17063
|
+
borderWidth: 0,
|
|
17064
|
+
borderStyle: 'none',
|
|
17065
|
+
borderColor: 'transparent',
|
|
17066
|
+
_hover: {
|
|
17067
|
+
backgroundColor: color,
|
|
17068
|
+
color: isLight ? 'color.black' : 'color.white',
|
|
17069
|
+
transform: 'translateY(-1px)'
|
|
17070
|
+
},
|
|
17071
|
+
_active: {
|
|
17072
|
+
backgroundColor: color,
|
|
17073
|
+
color: isLight ? 'color.black' : 'color.white',
|
|
17074
|
+
transform: 'translateY(0)'
|
|
17075
|
+
},
|
|
17076
|
+
transition: 'all 0.2s ease'
|
|
17077
|
+
},
|
|
17078
|
+
link: {
|
|
17079
|
+
backgroundColor: 'transparent',
|
|
17080
|
+
color: color,
|
|
17081
|
+
borderWidth: 1,
|
|
17082
|
+
borderStyle: 'solid',
|
|
17083
|
+
borderColor: 'transparent',
|
|
17084
|
+
textDecoration: 'underline',
|
|
17085
|
+
textUnderlineOffset: '1px',
|
|
17086
|
+
textDecorationThickness: '1px',
|
|
17087
|
+
_hover: {
|
|
17088
|
+
borderColor: color,
|
|
17089
|
+
textDecorationThickness: '2px',
|
|
17090
|
+
transform: 'translateY(-1px)'
|
|
17091
|
+
},
|
|
17092
|
+
_active: {
|
|
17093
|
+
borderColor: color,
|
|
17094
|
+
textDecorationThickness: '2px',
|
|
17095
|
+
transform: 'translateY(0)'
|
|
17096
|
+
},
|
|
17097
|
+
transition: 'all 0.2s ease'
|
|
17098
|
+
}
|
|
17099
|
+
});
|
|
17100
|
+
|
|
17101
|
+
var _excluded$T = ["children", "shape", "variant", "isHovered", "setIsHovered", "isDisabled", "isToggle", "setIsToggled", "onToggle", "views", "backgroundColor", "color", "themeMode"];
|
|
16909
17102
|
var ToggleView = _ref => {
|
|
17103
|
+
var _ref2;
|
|
16910
17104
|
var {
|
|
16911
17105
|
children,
|
|
16912
17106
|
shape = 'rounded',
|
|
@@ -16917,25 +17111,30 @@ var ToggleView = _ref => {
|
|
|
16917
17111
|
isToggle,
|
|
16918
17112
|
setIsToggled,
|
|
16919
17113
|
onToggle,
|
|
16920
|
-
views
|
|
17114
|
+
views,
|
|
17115
|
+
backgroundColor,
|
|
17116
|
+
// primary candidate for main color
|
|
17117
|
+
color,
|
|
17118
|
+
// 2nd candidate for main color
|
|
17119
|
+
themeMode: elementMode
|
|
16921
17120
|
} = _ref,
|
|
16922
17121
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$T);
|
|
16923
|
-
|
|
17122
|
+
/* theme helpers */
|
|
17123
|
+
var {
|
|
17124
|
+
getColor,
|
|
17125
|
+
themeMode
|
|
17126
|
+
} = useTheme();
|
|
17127
|
+
var mode = elementMode != null ? elementMode : themeMode;
|
|
17128
|
+
/* MAIN COLOR – determines the entire palette */
|
|
17129
|
+
var mainColorKey = (_ref2 = backgroundColor != null ? backgroundColor : color) != null ? _ref2 : 'theme.primary';
|
|
17130
|
+
var mainTone = getColor(isDisabled ? 'theme.disabled' : mainColorKey, {
|
|
17131
|
+
themeMode: mode
|
|
17132
|
+
});
|
|
17133
|
+
var tone = contrast(mainTone);
|
|
17134
|
+
/* variant palette */
|
|
17135
|
+
var palette = useMemo(() => getToggleVariants(mainTone, tone === 'light'), [mainTone, tone]);
|
|
17136
|
+
var base = palette[variant];
|
|
16924
17137
|
var isActive = !!(isToggle || isHovered);
|
|
16925
|
-
var toggleVariants = {
|
|
16926
|
-
outline: {
|
|
16927
|
-
borderWidth: 1,
|
|
16928
|
-
borderStyle: 'solid',
|
|
16929
|
-
borderColor: 'color.trueGray.400'
|
|
16930
|
-
},
|
|
16931
|
-
link: {
|
|
16932
|
-
borderWidth: 1,
|
|
16933
|
-
borderStyle: 'solid',
|
|
16934
|
-
borderColor: isActive ? toggleColor : 'transparent',
|
|
16935
|
-
textDecoration: 'underline'
|
|
16936
|
-
},
|
|
16937
|
-
ghost: {}
|
|
16938
|
-
};
|
|
16939
17138
|
var handleHover = () => setIsHovered(!isHovered);
|
|
16940
17139
|
var handleToggle = () => {
|
|
16941
17140
|
if (!isDisabled) {
|
|
@@ -16952,14 +17151,15 @@ var ToggleView = _ref => {
|
|
|
16952
17151
|
role: "Toggle",
|
|
16953
17152
|
padding: shape === 'pillShaped' ? '10px 12px' : '8px',
|
|
16954
17153
|
width: "fit-content",
|
|
16955
|
-
color: isActive ? 'color.white' : toggleColor,
|
|
16956
|
-
backgroundColor: isActive ? toggleColor : 'transparent',
|
|
16957
|
-
onMouseEnter: handleHover,
|
|
16958
|
-
onMouseLeave: () => setIsHovered(false),
|
|
16959
17154
|
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
|
16960
|
-
borderRadius: shape
|
|
16961
|
-
onClick: handleToggle
|
|
16962
|
-
|
|
17155
|
+
borderRadius: ToggleShapes[shape],
|
|
17156
|
+
onClick: handleToggle,
|
|
17157
|
+
onMouseEnter: handleHover,
|
|
17158
|
+
onMouseLeave: () => setIsHovered(false)
|
|
17159
|
+
}, base, isActive && {
|
|
17160
|
+
backgroundColor: mainTone,
|
|
17161
|
+
color: tone === 'light' ? 'color.black' : 'color.white'
|
|
17162
|
+
}, props, views == null ? void 0 : views.container), children);
|
|
16963
17163
|
};
|
|
16964
17164
|
|
|
16965
17165
|
var _excluded$U = ["children", "shape", "variant", "isDisabled", "isToggled", "onToggle"];
|