@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
|
@@ -16573,6 +16573,99 @@
|
|
|
16573
16573
|
lg: 72,
|
|
16574
16574
|
xl: 80
|
|
16575
16575
|
};
|
|
16576
|
+
/**
|
|
16577
|
+
* Responsive typography system that maps title sizes to responsive breakpoints
|
|
16578
|
+
* Based on the Typography system with dynamic breakpoint sizing
|
|
16579
|
+
*/
|
|
16580
|
+
var ResponsiveTypography = {
|
|
16581
|
+
// xl maps to H1 - Largest heading
|
|
16582
|
+
xl: {
|
|
16583
|
+
lineHeight: '120%',
|
|
16584
|
+
fontWeight: 500,
|
|
16585
|
+
marginBottom: 20,
|
|
16586
|
+
letterSpacing: 1.25,
|
|
16587
|
+
media: {
|
|
16588
|
+
mobile: {
|
|
16589
|
+
fontSize: 42,
|
|
16590
|
+
width: '100%'
|
|
16591
|
+
},
|
|
16592
|
+
tablet: {
|
|
16593
|
+
fontSize: 50,
|
|
16594
|
+
width: '100%'
|
|
16595
|
+
},
|
|
16596
|
+
desktop: {
|
|
16597
|
+
fontSize: 58,
|
|
16598
|
+
minWidth: '60%'
|
|
16599
|
+
}
|
|
16600
|
+
}
|
|
16601
|
+
},
|
|
16602
|
+
// lg maps to H2 - Large heading
|
|
16603
|
+
lg: {
|
|
16604
|
+
lineHeight: '100%',
|
|
16605
|
+
fontWeight: 500,
|
|
16606
|
+
media: {
|
|
16607
|
+
mobile: {
|
|
16608
|
+
fontSize: 32
|
|
16609
|
+
},
|
|
16610
|
+
tablet: {
|
|
16611
|
+
fontSize: 40
|
|
16612
|
+
},
|
|
16613
|
+
desktop: {
|
|
16614
|
+
fontSize: 48
|
|
16615
|
+
}
|
|
16616
|
+
}
|
|
16617
|
+
},
|
|
16618
|
+
// md maps to H3 - Medium heading
|
|
16619
|
+
md: {
|
|
16620
|
+
lineHeight: '100%',
|
|
16621
|
+
fontWeight: 500,
|
|
16622
|
+
media: {
|
|
16623
|
+
mobile: {
|
|
16624
|
+
fontSize: 20
|
|
16625
|
+
},
|
|
16626
|
+
tablet: {
|
|
16627
|
+
fontSize: 30
|
|
16628
|
+
},
|
|
16629
|
+
desktop: {
|
|
16630
|
+
fontSize: 40
|
|
16631
|
+
}
|
|
16632
|
+
}
|
|
16633
|
+
},
|
|
16634
|
+
// sm maps to T1 - Title text
|
|
16635
|
+
sm: {
|
|
16636
|
+
lineHeight: '100%',
|
|
16637
|
+
fontWeight: 400,
|
|
16638
|
+
letterSpacing: -0.2,
|
|
16639
|
+
media: {
|
|
16640
|
+
mobile: {
|
|
16641
|
+
fontSize: 16
|
|
16642
|
+
},
|
|
16643
|
+
tablet: {
|
|
16644
|
+
fontSize: 28
|
|
16645
|
+
},
|
|
16646
|
+
desktop: {
|
|
16647
|
+
fontSize: 32
|
|
16648
|
+
}
|
|
16649
|
+
}
|
|
16650
|
+
},
|
|
16651
|
+
// xs maps to S1 - Subtitle text
|
|
16652
|
+
xs: {
|
|
16653
|
+
lineHeight: '120%',
|
|
16654
|
+
fontWeight: 400,
|
|
16655
|
+
letterSpacing: -0.2,
|
|
16656
|
+
media: {
|
|
16657
|
+
mobile: {
|
|
16658
|
+
fontSize: 12
|
|
16659
|
+
},
|
|
16660
|
+
tablet: {
|
|
16661
|
+
fontSize: 18
|
|
16662
|
+
},
|
|
16663
|
+
desktop: {
|
|
16664
|
+
fontSize: 24
|
|
16665
|
+
}
|
|
16666
|
+
}
|
|
16667
|
+
}
|
|
16668
|
+
};
|
|
16576
16669
|
/**
|
|
16577
16670
|
* Default styles for different highlight types
|
|
16578
16671
|
*/
|
|
@@ -16691,7 +16784,7 @@
|
|
|
16691
16784
|
}))))));
|
|
16692
16785
|
};
|
|
16693
16786
|
|
|
16694
|
-
var _excluded$S = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "centered", "views", "highlightAnimate", "animate", "highlightTypewriter", "highlightTypewriterDuration"];
|
|
16787
|
+
var _excluded$S = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "responsive", "centered", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration"];
|
|
16695
16788
|
function escapeRegExp(string) {
|
|
16696
16789
|
return string.replace(/[.*+?^${}()|[\\]\\/g, '\\$&');
|
|
16697
16790
|
}
|
|
@@ -16702,11 +16795,14 @@
|
|
|
16702
16795
|
highlightStyle = 'background',
|
|
16703
16796
|
highlightColor = 'theme.primary',
|
|
16704
16797
|
highlightSecondaryColor,
|
|
16705
|
-
size = '
|
|
16798
|
+
size = 'lg',
|
|
16799
|
+
responsive = true,
|
|
16706
16800
|
centered = false,
|
|
16707
16801
|
views,
|
|
16708
16802
|
highlightAnimate,
|
|
16709
16803
|
animate,
|
|
16804
|
+
animationLoop = 1,
|
|
16805
|
+
highlightAnimationLoop = 1,
|
|
16710
16806
|
highlightTypewriter: propHighlightTypewriter = false,
|
|
16711
16807
|
highlightTypewriterDuration = 3000
|
|
16712
16808
|
} = _ref,
|
|
@@ -16744,8 +16840,27 @@
|
|
|
16744
16840
|
highlightTypewriter: propHighlightTypewriter,
|
|
16745
16841
|
highlightTypewriterDuration
|
|
16746
16842
|
}, props));
|
|
16843
|
+
// Determine if we should use responsive sizing or static sizing
|
|
16844
|
+
var useResponsive = responsive && !props.media; // Don't override if media prop is already provided
|
|
16747
16845
|
var fontSize = TitleSizes[size];
|
|
16748
16846
|
var lineHeight = LineHeights$1[size];
|
|
16847
|
+
// Get responsive styles if responsive prop is true
|
|
16848
|
+
var responsiveStyles = useResponsive ? ResponsiveTypography[size] : null;
|
|
16849
|
+
// Helper function to apply loop control to animations
|
|
16850
|
+
var applyAnimationLoop = (animation, loopControl) => {
|
|
16851
|
+
if (!animation) return animation;
|
|
16852
|
+
if (Array.isArray(animation)) {
|
|
16853
|
+
return animation.map(anim => Object.assign({}, anim, {
|
|
16854
|
+
iterationCount: loopControl.toString()
|
|
16855
|
+
}));
|
|
16856
|
+
}
|
|
16857
|
+
return Object.assign({}, animation, {
|
|
16858
|
+
iterationCount: loopControl.toString()
|
|
16859
|
+
});
|
|
16860
|
+
};
|
|
16861
|
+
// Apply loop control to animations
|
|
16862
|
+
var controlledAnimate = applyAnimationLoop(animate, animationLoop);
|
|
16863
|
+
var controlledHighlightAnimate = applyAnimationLoop(highlightAnimate, highlightAnimationLoop);
|
|
16749
16864
|
// Get the text to display
|
|
16750
16865
|
var text = typeof finalDisplayedText === 'string' ? finalDisplayedText : typeof children === 'string' ? children : '';
|
|
16751
16866
|
if (typeof text === 'string' && activeHighlightTarget) {
|
|
@@ -16769,16 +16884,19 @@
|
|
|
16769
16884
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
16770
16885
|
ref: ref,
|
|
16771
16886
|
as: "h1",
|
|
16772
|
-
fontSize: fontSize,
|
|
16773
|
-
lineHeight: lineHeight + "px",
|
|
16774
|
-
fontWeight:
|
|
16887
|
+
fontSize: useResponsive ? undefined : fontSize,
|
|
16888
|
+
lineHeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.lineHeight : lineHeight + "px",
|
|
16889
|
+
fontWeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.fontWeight : 'bold',
|
|
16890
|
+
letterSpacing: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.letterSpacing : undefined,
|
|
16891
|
+
marginBottom: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.marginBottom : undefined,
|
|
16775
16892
|
textAlign: centered ? 'center' : 'left',
|
|
16776
|
-
animate: inView ?
|
|
16893
|
+
animate: inView ? controlledAnimate : undefined,
|
|
16894
|
+
media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
|
|
16777
16895
|
}, views == null ? void 0 : views.container, props), parts.map((part, idx) => typeof part === 'string' ? part : (/*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
|
|
16778
16896
|
key: part.text + "-" + idx,
|
|
16779
16897
|
as: "span",
|
|
16780
16898
|
display: "inline",
|
|
16781
|
-
animate: inView ?
|
|
16899
|
+
animate: inView ? controlledHighlightAnimate : undefined
|
|
16782
16900
|
}, HighlightStyles[highlightStyle](resolvedColor, resolvedSecondary), views == null ? void 0 : views.highlight), highlightTypewriter ? (/*#__PURE__*/React__default.createElement(TypewriterEffect, {
|
|
16783
16901
|
text: part.text,
|
|
16784
16902
|
typingSpeed: Math.max(30, highlightTypewriterDuration / (part.text.length * 10)),
|
|
@@ -16791,15 +16909,18 @@
|
|
|
16791
16909
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
16792
16910
|
ref: ref,
|
|
16793
16911
|
as: "h1",
|
|
16794
|
-
fontSize: fontSize,
|
|
16795
|
-
lineHeight: lineHeight + "px",
|
|
16796
|
-
fontWeight:
|
|
16912
|
+
fontSize: useResponsive ? undefined : fontSize,
|
|
16913
|
+
lineHeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.lineHeight : lineHeight + "px",
|
|
16914
|
+
fontWeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.fontWeight : 'bold',
|
|
16915
|
+
letterSpacing: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.letterSpacing : undefined,
|
|
16916
|
+
marginBottom: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.marginBottom : undefined,
|
|
16797
16917
|
textAlign: centered ? 'center' : 'left',
|
|
16798
|
-
animate: inView ?
|
|
16918
|
+
animate: inView ? controlledAnimate : undefined,
|
|
16919
|
+
media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
|
|
16799
16920
|
}, views == null ? void 0 : views.container, props), /*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
|
|
16800
16921
|
as: "span",
|
|
16801
16922
|
display: "inline",
|
|
16802
|
-
animate: inView ?
|
|
16923
|
+
animate: inView ? controlledHighlightAnimate : undefined
|
|
16803
16924
|
}, HighlightStyles[highlightStyle](resolvedColor, resolvedSecondary), views == null ? void 0 : views.highlight), highlightTypewriter ? (/*#__PURE__*/React__default.createElement(TypewriterEffect, {
|
|
16804
16925
|
text: text,
|
|
16805
16926
|
typingSpeed: Math.max(30, highlightTypewriterDuration / (text.length * 10)),
|
|
@@ -16811,11 +16932,14 @@
|
|
|
16811
16932
|
return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
|
|
16812
16933
|
ref: ref,
|
|
16813
16934
|
as: "h1",
|
|
16814
|
-
fontSize: fontSize,
|
|
16815
|
-
lineHeight: lineHeight + "px",
|
|
16816
|
-
fontWeight:
|
|
16935
|
+
fontSize: useResponsive ? undefined : fontSize,
|
|
16936
|
+
lineHeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.lineHeight : lineHeight + "px",
|
|
16937
|
+
fontWeight: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.fontWeight : 'bold',
|
|
16938
|
+
letterSpacing: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.letterSpacing : undefined,
|
|
16939
|
+
marginBottom: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.marginBottom : undefined,
|
|
16817
16940
|
textAlign: centered ? 'center' : 'left',
|
|
16818
|
-
animate: inView ?
|
|
16941
|
+
animate: inView ? controlledAnimate : undefined,
|
|
16942
|
+
media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
|
|
16819
16943
|
}, views == null ? void 0 : views.container, props), text);
|
|
16820
16944
|
};
|
|
16821
16945
|
|
|
@@ -16881,8 +17005,78 @@
|
|
|
16881
17005
|
};
|
|
16882
17006
|
};
|
|
16883
17007
|
|
|
16884
|
-
var
|
|
17008
|
+
var ToggleShapes = {
|
|
17009
|
+
sharp: 0,
|
|
17010
|
+
rounded: 4,
|
|
17011
|
+
pillShaped: 24
|
|
17012
|
+
};
|
|
17013
|
+
/**
|
|
17014
|
+
* Generate toggle variants with proper color combinations based on main color and contrast
|
|
17015
|
+
* Similar to Button's getButtonVariants function
|
|
17016
|
+
*/
|
|
17017
|
+
var getToggleVariants = (color, isLight) => ({
|
|
17018
|
+
outline: {
|
|
17019
|
+
backgroundColor: 'transparent',
|
|
17020
|
+
color: color,
|
|
17021
|
+
borderWidth: 1,
|
|
17022
|
+
borderStyle: 'solid',
|
|
17023
|
+
borderColor: color,
|
|
17024
|
+
_hover: {
|
|
17025
|
+
backgroundColor: color,
|
|
17026
|
+
color: isLight ? 'color.black' : 'color.white',
|
|
17027
|
+
transform: 'translateY(-1px)'
|
|
17028
|
+
},
|
|
17029
|
+
_active: {
|
|
17030
|
+
backgroundColor: color,
|
|
17031
|
+
color: isLight ? 'color.black' : 'color.white',
|
|
17032
|
+
transform: 'translateY(0)'
|
|
17033
|
+
},
|
|
17034
|
+
transition: 'all 0.2s ease'
|
|
17035
|
+
},
|
|
17036
|
+
ghost: {
|
|
17037
|
+
backgroundColor: 'transparent',
|
|
17038
|
+
color: color,
|
|
17039
|
+
borderWidth: 0,
|
|
17040
|
+
borderStyle: 'none',
|
|
17041
|
+
borderColor: 'transparent',
|
|
17042
|
+
_hover: {
|
|
17043
|
+
backgroundColor: color,
|
|
17044
|
+
color: isLight ? 'color.black' : 'color.white',
|
|
17045
|
+
transform: 'translateY(-1px)'
|
|
17046
|
+
},
|
|
17047
|
+
_active: {
|
|
17048
|
+
backgroundColor: color,
|
|
17049
|
+
color: isLight ? 'color.black' : 'color.white',
|
|
17050
|
+
transform: 'translateY(0)'
|
|
17051
|
+
},
|
|
17052
|
+
transition: 'all 0.2s ease'
|
|
17053
|
+
},
|
|
17054
|
+
link: {
|
|
17055
|
+
backgroundColor: 'transparent',
|
|
17056
|
+
color: color,
|
|
17057
|
+
borderWidth: 1,
|
|
17058
|
+
borderStyle: 'solid',
|
|
17059
|
+
borderColor: 'transparent',
|
|
17060
|
+
textDecoration: 'underline',
|
|
17061
|
+
textUnderlineOffset: '1px',
|
|
17062
|
+
textDecorationThickness: '1px',
|
|
17063
|
+
_hover: {
|
|
17064
|
+
borderColor: color,
|
|
17065
|
+
textDecorationThickness: '2px',
|
|
17066
|
+
transform: 'translateY(-1px)'
|
|
17067
|
+
},
|
|
17068
|
+
_active: {
|
|
17069
|
+
borderColor: color,
|
|
17070
|
+
textDecorationThickness: '2px',
|
|
17071
|
+
transform: 'translateY(0)'
|
|
17072
|
+
},
|
|
17073
|
+
transition: 'all 0.2s ease'
|
|
17074
|
+
}
|
|
17075
|
+
});
|
|
17076
|
+
|
|
17077
|
+
var _excluded$T = ["children", "shape", "variant", "isHovered", "setIsHovered", "isDisabled", "isToggle", "setIsToggled", "onToggle", "views", "backgroundColor", "color", "themeMode"];
|
|
16885
17078
|
var ToggleView = _ref => {
|
|
17079
|
+
var _ref2;
|
|
16886
17080
|
var {
|
|
16887
17081
|
children,
|
|
16888
17082
|
shape = 'rounded',
|
|
@@ -16893,25 +17087,30 @@
|
|
|
16893
17087
|
isToggle,
|
|
16894
17088
|
setIsToggled,
|
|
16895
17089
|
onToggle,
|
|
16896
|
-
views
|
|
17090
|
+
views,
|
|
17091
|
+
backgroundColor,
|
|
17092
|
+
// primary candidate for main color
|
|
17093
|
+
color,
|
|
17094
|
+
// 2nd candidate for main color
|
|
17095
|
+
themeMode: elementMode
|
|
16897
17096
|
} = _ref,
|
|
16898
17097
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$T);
|
|
16899
|
-
|
|
17098
|
+
/* theme helpers */
|
|
17099
|
+
var {
|
|
17100
|
+
getColor,
|
|
17101
|
+
themeMode
|
|
17102
|
+
} = appStudio.useTheme();
|
|
17103
|
+
var mode = elementMode != null ? elementMode : themeMode;
|
|
17104
|
+
/* MAIN COLOR – determines the entire palette */
|
|
17105
|
+
var mainColorKey = (_ref2 = backgroundColor != null ? backgroundColor : color) != null ? _ref2 : 'theme.primary';
|
|
17106
|
+
var mainTone = getColor(isDisabled ? 'theme.disabled' : mainColorKey, {
|
|
17107
|
+
themeMode: mode
|
|
17108
|
+
});
|
|
17109
|
+
var tone = contrast(mainTone);
|
|
17110
|
+
/* variant palette */
|
|
17111
|
+
var palette = React.useMemo(() => getToggleVariants(mainTone, tone === 'light'), [mainTone, tone]);
|
|
17112
|
+
var base = palette[variant];
|
|
16900
17113
|
var isActive = !!(isToggle || isHovered);
|
|
16901
|
-
var toggleVariants = {
|
|
16902
|
-
outline: {
|
|
16903
|
-
borderWidth: 1,
|
|
16904
|
-
borderStyle: 'solid',
|
|
16905
|
-
borderColor: 'color.trueGray.400'
|
|
16906
|
-
},
|
|
16907
|
-
link: {
|
|
16908
|
-
borderWidth: 1,
|
|
16909
|
-
borderStyle: 'solid',
|
|
16910
|
-
borderColor: isActive ? toggleColor : 'transparent',
|
|
16911
|
-
textDecoration: 'underline'
|
|
16912
|
-
},
|
|
16913
|
-
ghost: {}
|
|
16914
|
-
};
|
|
16915
17114
|
var handleHover = () => setIsHovered(!isHovered);
|
|
16916
17115
|
var handleToggle = () => {
|
|
16917
17116
|
if (!isDisabled) {
|
|
@@ -16928,14 +17127,15 @@
|
|
|
16928
17127
|
role: "Toggle",
|
|
16929
17128
|
padding: shape === 'pillShaped' ? '10px 12px' : '8px',
|
|
16930
17129
|
width: "fit-content",
|
|
16931
|
-
color: isActive ? 'color.white' : toggleColor,
|
|
16932
|
-
backgroundColor: isActive ? toggleColor : 'transparent',
|
|
16933
|
-
onMouseEnter: handleHover,
|
|
16934
|
-
onMouseLeave: () => setIsHovered(false),
|
|
16935
17130
|
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
|
16936
|
-
borderRadius: shape
|
|
16937
|
-
onClick: handleToggle
|
|
16938
|
-
|
|
17131
|
+
borderRadius: ToggleShapes[shape],
|
|
17132
|
+
onClick: handleToggle,
|
|
17133
|
+
onMouseEnter: handleHover,
|
|
17134
|
+
onMouseLeave: () => setIsHovered(false)
|
|
17135
|
+
}, base, isActive && {
|
|
17136
|
+
backgroundColor: mainTone,
|
|
17137
|
+
color: tone === 'light' ? 'color.black' : 'color.white'
|
|
17138
|
+
}, props, views == null ? void 0 : views.container), children);
|
|
16939
17139
|
};
|
|
16940
17140
|
|
|
16941
17141
|
var _excluded$U = ["children", "shape", "variant", "isDisabled", "isToggled", "onToggle"];
|