@fountain-ui/core 2.0.0-beta.50 → 2.0.0-beta.52
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/build/commonjs/Divider/Divider.js +5 -3
- package/build/commonjs/Divider/Divider.js.map +1 -1
- package/build/commonjs/Divider/DividerProps.js.map +1 -1
- package/build/commonjs/TextField/InputLabel.js +3 -4
- package/build/commonjs/TextField/InputLabel.js.map +1 -1
- package/build/commonjs/TextField/OutlinedTextField.js +1 -1
- package/build/commonjs/TextField/OutlinedTextField.js.map +1 -1
- package/build/module/Divider/Divider.js +5 -3
- package/build/module/Divider/Divider.js.map +1 -1
- package/build/module/Divider/DividerProps.js.map +1 -1
- package/build/module/TextField/InputLabel.js +3 -4
- package/build/module/TextField/InputLabel.js.map +1 -1
- package/build/module/TextField/OutlinedTextField.js +1 -1
- package/build/module/TextField/OutlinedTextField.js.map +1 -1
- package/build/typescript/Divider/DividerProps.d.ts +12 -1
- package/package.json +2 -2
- package/src/Divider/Divider.tsx +7 -3
- package/src/Divider/DividerProps.ts +15 -1
- package/src/TextField/InputLabel.tsx +3 -1
- package/src/TextField/OutlinedTextField.tsx +1 -1
|
@@ -40,14 +40,16 @@ const styles = _styles.StyleSheet.create({
|
|
|
40
40
|
function Divider(props) {
|
|
41
41
|
const {
|
|
42
42
|
children: childrenProp,
|
|
43
|
+
color = 'divider',
|
|
43
44
|
inset = 0,
|
|
44
|
-
|
|
45
|
+
marginBetweenChildren = 2,
|
|
45
46
|
style,
|
|
47
|
+
vertical = false,
|
|
46
48
|
...otherProps
|
|
47
49
|
} = props;
|
|
48
50
|
const theme = (0, _styles.useTheme)();
|
|
49
51
|
const fontColor = theme.palette.text.secondary;
|
|
50
|
-
const borderColor = theme.palette.divider;
|
|
52
|
+
const borderColor = color === 'divider' ? theme.palette.divider : theme.palette[color].main;
|
|
51
53
|
const marginSize = theme.spacing(1);
|
|
52
54
|
const insetSize = theme.spacing(inset);
|
|
53
55
|
const marginLeft = marginSize;
|
|
@@ -74,7 +76,7 @@ function Divider(props) {
|
|
|
74
76
|
const borderWidthStyle = vertical ? styles.borderRight : styles.borderBottom;
|
|
75
77
|
const containerStyle = (0, _styles.css)([insetStyle, marginStyle, styles.container, vertical ? styles.column : styles.row, childrenProp ? undefined : borderColorStyle, childrenProp ? undefined : borderWidthStyle, style]);
|
|
76
78
|
const dividerStyle = (0, _styles.css)([borderColorStyle, borderWidthStyle, styles.divider]);
|
|
77
|
-
const dividerMarginSize = theme.spacing(
|
|
79
|
+
const dividerMarginSize = theme.spacing(marginBetweenChildren);
|
|
78
80
|
const startDividerStyle = vertical ? {
|
|
79
81
|
marginBottom: dividerMarginSize
|
|
80
82
|
} : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["styles","StyleSheet","create","container","alignSelf","alignItems","row","flexDirection","column","divider","flexGrow","borderBottom","borderBottomWidth","borderRight","borderRightWidth","Divider","props","children","childrenProp","inset","
|
|
1
|
+
{"version":3,"names":["styles","StyleSheet","create","container","alignSelf","alignItems","row","flexDirection","column","divider","flexGrow","borderBottom","borderBottomWidth","borderRight","borderRightWidth","Divider","props","children","childrenProp","color","inset","marginBetweenChildren","style","vertical","otherProps","theme","useTheme","fontColor","palette","text","secondary","borderColor","main","marginSize","spacing","insetSize","marginLeft","marginRight","marginTop","marginBottom","marginStyle","insetStyle","borderColorStyle","borderWidthStyle","containerStyle","css","undefined","dividerStyle","dividerMarginSize","startDividerStyle","endDividerStyle","fontStyle","createFontStyle","selector","typo","caption2","element"],"sources":["Divider.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport type DividerProps from './DividerProps';\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: 'stretch',\n alignItems: 'center',\n },\n row: {\n flexDirection: 'row',\n },\n column: {\n flexDirection: 'column',\n },\n divider: {\n flexGrow: 1,\n },\n borderBottom: {\n borderBottomWidth: 1,\n },\n borderRight: {\n borderRightWidth: 1,\n },\n});\n\nexport default function Divider(props: DividerProps) {\n const {\n children: childrenProp,\n color = 'divider',\n inset = 0,\n marginBetweenChildren = 2,\n style,\n vertical = false,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const fontColor = theme.palette.text.secondary;\n const borderColor = color === 'divider'\n ? theme.palette.divider\n : theme.palette[color].main;\n const marginSize = theme.spacing(1);\n const insetSize = theme.spacing(inset);\n\n const marginLeft = marginSize;\n const marginRight = marginSize;\n const marginTop = marginSize;\n const marginBottom = marginSize;\n\n const marginStyle = vertical\n ? { marginLeft, marginRight }\n : { marginTop, marginBottom };\n\n const insetStyle = vertical\n ? { marginTop: insetSize, marginBottom: insetSize }\n : { marginLeft: insetSize, marginRight: insetSize };\n\n const borderColorStyle = { borderColor };\n const borderWidthStyle = (vertical ? styles.borderRight : styles.borderBottom);\n\n const containerStyle = css([\n insetStyle,\n marginStyle,\n styles.container,\n vertical ? styles.column : styles.row,\n childrenProp ? undefined : borderColorStyle,\n childrenProp ? undefined : borderWidthStyle,\n style,\n ]);\n\n const dividerStyle = css([\n borderColorStyle,\n borderWidthStyle,\n styles.divider,\n ]);\n\n const dividerMarginSize = theme.spacing(marginBetweenChildren);\n const startDividerStyle = vertical ? { marginBottom: dividerMarginSize } : { marginRight: dividerMarginSize };\n const endDividerStyle = vertical ? { marginTop: dividerMarginSize } : { marginLeft: dividerMarginSize };\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => typo.caption2,\n color: fontColor,\n });\n\n const element = typeof childrenProp === 'string'\n ? <Text style={css(fontStyle)}>{childrenProp}</Text>\n : childrenProp;\n\n const children = childrenProp ? (\n <>\n <View style={css([dividerStyle, startDividerStyle])}/>\n {element}\n <View style={css([dividerStyle, endDividerStyle])}/>\n </>\n ) : null;\n\n return (\n <View\n style={containerStyle}\n {...otherProps}\n >\n {children}\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAG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AAOtC,YAAP,KAAwB,QAAxB,gBACV,6BAAC,iBAAD;IAAM,KAAK,EAAE,IAAA2B,WAAA,EAAIM,SAAJ;EAAb,GAA8BjC,YAA9B,CADU,GAEVA,YAFN;EAIA,MAAMD,QAAQ,GAAGC,YAAY,gBACzB,yEACI,6BAAC,iBAAD;IAAM,KAAK,EAAE,IAAA2B,WAAA,EAAI,CAACE,YAAD,EAAeE,iBAAf,CAAJ;EAAb,EADJ,EAEKO,OAFL,eAGI,6BAAC,iBAAD;IAAM,KAAK,EAAE,IAAAX,WAAA,EAAI,CAACE,YAAD,EAAeG,eAAf,CAAJ;EAAb,EAHJ,CADyB,GAMzB,IANJ;EAQA,oBACI,6BAAC,iBAAD;IACI,KAAK,EAAEN;EADX,GAEQpB,UAFR,GAIKP,QAJL,CADJ;AAQH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["DividerProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport default interface DividerProps extends OverridableComponentProps<ViewProps, {\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The size of the inset. It works as a multiplier factor based on spacing system.\n * @default 0\n */\n inset?: number;\n\n /**\n * If `true`, the divider orientation is set to vertical.\n * @default false\n */\n vertical?: boolean;\n}> {}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["DividerProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { CommonComponentColor, OverridableComponentProps } from '../types';\n\nexport type DividerColor = 'divider' | CommonComponentColor;\n\nexport default interface DividerProps extends OverridableComponentProps<ViewProps, {\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The size of the inset. It works as a multiplier factor based on spacing system.\n * @default 0\n */\n inset?: number;\n\n /**\n * If `true`, the divider orientation is set to vertical.\n * @default false\n */\n vertical?: boolean;\n\n /**\n * The color of divider. It supports default divider color and those theme colors that make sense for this component.\n * @default 'divider'\n */\n color?: DividerColor;\n\n /**\n * The size of margin between child element and the divider. It works as a multiplier factor based on spacing system.\n * @default 2\n */\n marginBetweenChildren?: number;\n}> {}\n"],"mappings":""}
|
|
@@ -87,7 +87,6 @@ const InputLabel = props => {
|
|
|
87
87
|
selector: typo => typo.caption2
|
|
88
88
|
});
|
|
89
89
|
const labelStyle = {
|
|
90
|
-
labelTextFontStyle,
|
|
91
90
|
fontSize,
|
|
92
91
|
transform: [{
|
|
93
92
|
translateX: animatedError.interpolate({
|
|
@@ -125,7 +124,7 @@ const InputLabel = props => {
|
|
|
125
124
|
}]
|
|
126
125
|
}), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.Text, {
|
|
127
126
|
key: 'labelBackground-text',
|
|
128
|
-
style: [styles.placeholder, styles.backgroundText, backgroundStyle, labelStyle, {
|
|
127
|
+
style: [labelTextFontStyle, styles.placeholder, styles.backgroundText, backgroundStyle, labelStyle, {
|
|
129
128
|
top: topPosition + 1,
|
|
130
129
|
opacity,
|
|
131
130
|
transform: [...labelStyle.transform, {
|
|
@@ -138,7 +137,7 @@ const InputLabel = props => {
|
|
|
138
137
|
numberOfLines: 1
|
|
139
138
|
}, label)], /*#__PURE__*/_react.default.createElement(_reactNative.Animated.Text, {
|
|
140
139
|
onLayout: onLayoutAnimatedText,
|
|
141
|
-
style: [styles.placeholder, labelStyle, paddingOffset, {
|
|
140
|
+
style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
|
|
142
141
|
textAlign: 'left',
|
|
143
142
|
top: topPosition,
|
|
144
143
|
color: error && errorColor ? errorColor : activeColor,
|
|
@@ -149,7 +148,7 @@ const InputLabel = props => {
|
|
|
149
148
|
}],
|
|
150
149
|
numberOfLines: 1
|
|
151
150
|
}, label), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.Text, {
|
|
152
|
-
style: [styles.placeholder, labelStyle, paddingOffset, {
|
|
151
|
+
style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
|
|
153
152
|
textAlign: 'left',
|
|
154
153
|
top: topPosition,
|
|
155
154
|
color: error && errorColor ? errorColor : placeholderColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","background","position","top","left","bottom","right","width","height","backgroundText","paddingHorizontal","color","placeholder","inputPaddingHorizontal","InputLabel","props","activeColor","animatedError","animatedLabel","error","errorColor","focused","fontSize","hasActiveOutline","label","labelLayout","labelScale","labelTranslateX","labelTranslateY","onLayoutAnimatedText","paddingOffset","placeholderColor","placeholderOpacity","topPosition","value","theme","useTheme","styles","paperStyles","usePaperStyles","backgroundStyle","backgroundColor","palette","default","hasFocus","opacity","interpolate","inputRange","outputRange","labelTranslationX","transform","translateX","labelTextFontStyle","createFontStyle","selector","typo","caption2","labelStyle","translateY","scale","StyleSheet","absoluteFill","measured","scaleY","textAlign"],"sources":["InputLabel.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, StyleSheet } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, useTheme } from '../styles';\nimport usePaperStyles from '../Paper/usePaperStyles';\nimport { inputPaddingHorizontal } from './utils';\n\ninterface LabelProps {\n activeColor: string;\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n error?: boolean;\n errorColor?: string;\n focused?: boolean;\n fontSize?: number;\n hasActiveOutline?: boolean;\n label?: string;\n labelLayout: { measured: boolean; width: number; height: number };\n labelScale: number;\n labelTranslateX: number;\n labelTranslateY: number;\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n paddingOffset?: { paddingLeft: number; paddingRight: number };\n placeholder?: string;\n placeholderColor?: string;\n placeholderOpacity: number | Animated.AnimatedInterpolation;\n topPosition: number;\n value?: string;\n}\n\ntype InputLabelStyles = NamedStylesStringUnion<'background' | 'backgroundText' | 'placeholder'>;\n\nconst useStyles: UseStyles<InputLabelStyles> = function (): InputLabelStyles {\n return {\n background: {\n position: 'absolute',\n top: 6,\n left: 10,\n bottom: 0,\n right: 0,\n width: 8,\n height: 4,\n },\n backgroundText: {\n position: 'absolute',\n left: 18,\n paddingHorizontal: 0,\n color: 'transparent',\n },\n placeholder: {\n position: 'absolute',\n left: 0,\n paddingHorizontal: inputPaddingHorizontal,\n },\n };\n};\n\nconst InputLabel = (props: LabelProps) => {\n const {\n activeColor,\n animatedError,\n animatedLabel,\n error = false,\n errorColor,\n focused,\n fontSize,\n hasActiveOutline,\n label,\n labelLayout,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n paddingOffset,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const paperStyles = usePaperStyles();\n\n const backgroundStyle = {\n backgroundColor: paperStyles?.backgroundColor ?? theme.palette.background.default,\n };\n\n const hasFocus = hasActiveOutline || value;\n const opacity = animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasFocus ? 1 : 0, 0],\n });\n\n const labelTranslationX = {\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateX, 0 || 0],\n }),\n },\n ],\n };\n\n const labelTextFontStyle = createFontStyle(theme, { selector: (typo) => typo.caption2 });\n\n const labelStyle = {\n labelTextFontStyle,\n fontSize,\n transform: [\n {\n translateX: animatedError.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [0, value && error ? 4 : 0, 0],\n }),\n },\n {\n translateY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateY, 0],\n }),\n },\n {\n scale: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelScale, 1],\n }),\n },\n ],\n };\n\n return (label ? (\n <Animated.View\n pointerEvents={'none'}\n style={[\n StyleSheet.absoluteFill,\n {\n opacity: value || focused ? (labelLayout.measured ? 1 : 0) : 1,\n },\n labelTranslationX,\n ]}\n >\n {[\n <Animated.View\n key={'labelBackground-view'}\n pointerEvents={'none'}\n style={[\n styles.background,\n backgroundStyle,\n {\n opacity,\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [-labelTranslateX, 0],\n }),\n },\n ],\n },\n ]}\n />,\n <Animated.Text\n key={'labelBackground-text'}\n style={[\n styles.placeholder,\n styles.backgroundText,\n backgroundStyle,\n labelStyle,\n {\n top: topPosition + 1,\n opacity,\n transform: [\n ...labelStyle.transform,\n {\n scaleY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [0.2, 1],\n }),\n },\n ],\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>,\n ]}\n <Animated.Text\n onLayout={onLayoutAnimatedText}\n style={[\n styles.placeholder,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : activeColor,\n opacity: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 1 : 0, 0],\n }),\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n <Animated.Text\n style={[\n styles.placeholder,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : placeholderColor,\n opacity: placeholderOpacity,\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n </Animated.View>\n ) : null);\n};\n\nexport default InputLabel;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;AA2BA,MAAMA,SAAsC,GAAG,YAA8B;EACzE,OAAO;IACHC,UAAU,EAAE;MACRC,QAAQ,EAAE,UADF;MAERC,GAAG,EAAE,CAFG;MAGRC,IAAI,EAAE,EAHE;MAIRC,MAAM,EAAE,CAJA;MAKRC,KAAK,EAAE,CALC;MAMRC,KAAK,EAAE,CANC;MAORC,MAAM,EAAE;IAPA,CADT;IAUHC,cAAc,EAAE;MACZP,QAAQ,EAAE,UADE;MAEZE,IAAI,EAAE,EA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,CAACzB,gBAAgB,GAAG,CAAH,GAAO,CAAxB,EAA2B,CAA3B;MAFkB,CAA1B;IAJb,CAJG,CAFX;IAgBI,aAAa,EAAE;EAhBnB,GAkBKC,KAlBL,CAxDJ,eA4EI,6BAAC,qBAAD,CAAU,IAAV;IACI,KAAK,EAAE,CACHa,MAAM,CAACzB,WADJ,EAEH6C,UAFG,EAGH3B,aAHG,EAIH;MACIkC,SAAS,EAAE,MADf;MAEI7D,GAAG,EAAE8B,WAFT;MAGItB,KAAK,EAAEQ,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCW,gBAH9C;MAIIc,OAAO,EAAEb;IAJb,CAJG,CADX;IAYI,aAAa,EAAE;EAZnB,GAcKR,KAdL,CA5EJ,CADS,GA8FT,IA9FJ;AA+FH,CA5KD;;eA8KeV,U"}
|
|
1
|
+
{"version":3,"names":["useStyles","background","position","top","left","bottom","right","width","height","backgroundText","paddingHorizontal","color","placeholder","inputPaddingHorizontal","InputLabel","props","activeColor","animatedError","animatedLabel","error","errorColor","focused","fontSize","hasActiveOutline","label","labelLayout","labelScale","labelTranslateX","labelTranslateY","onLayoutAnimatedText","paddingOffset","placeholderColor","placeholderOpacity","topPosition","value","theme","useTheme","styles","paperStyles","usePaperStyles","backgroundStyle","backgroundColor","palette","default","hasFocus","opacity","interpolate","inputRange","outputRange","labelTranslationX","transform","translateX","labelTextFontStyle","createFontStyle","selector","typo","caption2","labelStyle","translateY","scale","StyleSheet","absoluteFill","measured","scaleY","textAlign"],"sources":["InputLabel.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, StyleSheet } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, useTheme } from '../styles';\nimport usePaperStyles from '../Paper/usePaperStyles';\nimport { inputPaddingHorizontal } from './utils';\n\ninterface LabelProps {\n activeColor: string;\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n error?: boolean;\n errorColor?: string;\n focused?: boolean;\n fontSize?: number;\n hasActiveOutline?: boolean;\n label?: string;\n labelLayout: { measured: boolean; width: number; height: number };\n labelScale: number;\n labelTranslateX: number;\n labelTranslateY: number;\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n paddingOffset?: { paddingLeft: number; paddingRight: number };\n placeholder?: string;\n placeholderColor?: string;\n placeholderOpacity: number | Animated.AnimatedInterpolation;\n topPosition: number;\n value?: string;\n}\n\ntype InputLabelStyles = NamedStylesStringUnion<'background' | 'backgroundText' | 'placeholder'>;\n\nconst useStyles: UseStyles<InputLabelStyles> = function (): InputLabelStyles {\n return {\n background: {\n position: 'absolute',\n top: 6,\n left: 10,\n bottom: 0,\n right: 0,\n width: 8,\n height: 4,\n },\n backgroundText: {\n position: 'absolute',\n left: 18,\n paddingHorizontal: 0,\n color: 'transparent',\n },\n placeholder: {\n position: 'absolute',\n left: 0,\n paddingHorizontal: inputPaddingHorizontal,\n },\n };\n};\n\nconst InputLabel = (props: LabelProps) => {\n const {\n activeColor,\n animatedError,\n animatedLabel,\n error = false,\n errorColor,\n focused,\n fontSize,\n hasActiveOutline,\n label,\n labelLayout,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n paddingOffset,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const paperStyles = usePaperStyles();\n\n const backgroundStyle = {\n backgroundColor: paperStyles?.backgroundColor ?? theme.palette.background.default,\n };\n\n const hasFocus = hasActiveOutline || value;\n const opacity = animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasFocus ? 1 : 0, 0],\n });\n\n const labelTranslationX = {\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateX, 0 || 0],\n }),\n },\n ],\n };\n\n const labelTextFontStyle = createFontStyle(theme, { selector: (typo) => typo.caption2 });\n\n const labelStyle = {\n fontSize,\n transform: [\n {\n translateX: animatedError.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [0, value && error ? 4 : 0, 0],\n }),\n },\n {\n translateY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateY, 0],\n }),\n },\n {\n scale: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelScale, 1],\n }),\n },\n ],\n };\n\n return (label ? (\n <Animated.View\n pointerEvents={'none'}\n style={[\n StyleSheet.absoluteFill,\n {\n opacity: value || focused ? (labelLayout.measured ? 1 : 0) : 1,\n },\n labelTranslationX,\n ]}\n >\n {[\n <Animated.View\n key={'labelBackground-view'}\n pointerEvents={'none'}\n style={[\n styles.background,\n backgroundStyle,\n {\n opacity,\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [-labelTranslateX, 0],\n }),\n },\n ],\n },\n ]}\n />,\n <Animated.Text\n key={'labelBackground-text'}\n style={[\n labelTextFontStyle,\n styles.placeholder,\n styles.backgroundText,\n backgroundStyle,\n labelStyle,\n {\n top: topPosition + 1,\n opacity,\n transform: [\n ...labelStyle.transform,\n {\n scaleY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [0.2, 1],\n }),\n },\n ],\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>,\n ]}\n <Animated.Text\n onLayout={onLayoutAnimatedText}\n style={[\n styles.placeholder,\n labelTextFontStyle,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : activeColor,\n opacity: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 1 : 0, 0],\n }),\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n <Animated.Text\n style={[\n styles.placeholder,\n labelTextFontStyle,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : placeholderColor,\n opacity: placeholderOpacity,\n },\n ]}\n numberOfLines={1}\n >\n {label}\n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KxB,KAxBL,CApBH,CAVL,eAyDI,6BAAC,qBAAD,CAAU,IAAV;IACI,QAAQ,EAAEK,oBADd;IAEI,KAAK,EAAE,CACHQ,MAAM,CAACzB,WADJ,EAEHwC,kBAFG,EAGHK,UAHG,EAIH3B,aAJG,EAKH;MACIkC,SAAS,EAAE,MADf;MAEI7D,GAAG,EAAE8B,WAFT;MAGItB,KAAK,EAAEQ,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCJ,WAH9C;MAII6B,OAAO,EAAE3B,aAAa,CAAC4B,WAAd,CAA0B;QAC/BC,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADmB;QAE/BC,WAAW,EAAE,CAACzB,gBAAgB,GAAG,CAAH,GAAO,CAAxB,EAA2B,CAA3B;MAFkB,CAA1B;IAJb,CALG,CAFX;IAiBI,aAAa,EAAE;EAjBnB,GAmBKC,KAnBL,CAzDJ,eA8EI,6BAAC,qBAAD,CAAU,IAAV;IACI,KAAK,EAAE,CACHa,MAAM,CAACzB,WADJ,EAEHwC,kBAFG,EAGHK,UAHG,EAIH3B,aAJG,EAKH;MACIkC,SAAS,EAAE,MADf;MAEI7D,GAAG,EAAE8B,WAFT;MAGItB,KAAK,EAAEQ,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCW,gBAH9C;MAIIc,OAAO,EAAEb;IAJb,CALG,CADX;IAaI,aAAa,EAAE;EAbnB,GAeKR,KAfL,CA9EJ,CADS,GAiGT,IAjGJ;AAkGH,CA9KD;;eAgLeV,U"}
|
|
@@ -113,7 +113,7 @@ const OutlinedTextField = /*#__PURE__*/_react.default.forwardRef(function Outlin
|
|
|
113
113
|
topPosition
|
|
114
114
|
};
|
|
115
115
|
const inputTextFontStyle = (0, _styles.createFontStyle)(theme, {
|
|
116
|
-
selector: typo => typo.
|
|
116
|
+
selector: typo => typo.caption2,
|
|
117
117
|
color: inputTextColor
|
|
118
118
|
});
|
|
119
119
|
const outlineStyle = (0, _styles.css)([styles.outline, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","theme","useTheme","outline","position","left","right","bottom","borderRadius","shape","roundness","input","flexGrow","paddingHorizontal","inputPaddingHorizontal","textAlignVertical","textAlign","zIndex","textField","iconContainer","width","height","justifyContent","alignItems","OutlinedTextField","React","forwardRef","props","ref","animatedError","animatedLabel","disabled","error","focused","forceFocus","icon","keyboardType","label","labelLayout","onBlur","onChangeText","onFocus","onIconPress","onLayoutAnimatedText","onSubmitEditing","placeholder","secureTextEntry","style","value","styles","hasActiveOutline","inputTextColor","palette","tertiary","main","primary","activeColor","warning","accent","placeholderColor","text","hint","outlineColor","border","errorColor","typography","body2","fontSize","unitless","labelScale","labelFontSize","labelWidth","labelHeight","labelHalfWidth","labelHalfHeight","labelTranslateX","minInputHeight","defaultHeight","labelPaddingTop","inputHeight","topPosition","Math","floor","iconTopPosition","iconSize","labelYOffset","labelTranslateY","placeholderOpacity","interpolate","inputRange","outputRange","measured","labelProps","inputTextFontStyle","createFontStyle","selector","typo","body1","color","outlineStyle","css","borderWidth","borderColor","top","textInputStyle","marginRight","paddingRight","Platform","OS","outlineWidth","containerStyle","paddingTop","minHeight","iconContainerStyle","onIconButtonPress"],"sources":["OutlinedTextField.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, Platform, TextInput, View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport IconButton from '../IconButton';\nimport TextFieldProps from './TextFieldProps';\nimport InputLabel from './InputLabel';\nimport {\n defaultHeight,\n iconSize,\n inputPaddingHorizontal,\n labelFontSize,\n labelPaddingTop,\n labelYOffset,\n} from './utils';\n\ninterface OutlinedTextFieldProps extends TextFieldProps {\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n focused: boolean;\n forceFocus: () => void;\n labelLayout: { measured: boolean; width: number; height: number };\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n}\n\ntype OutlinedTextFieldStyles = NamedStylesStringUnion<'outline' | 'input' | 'iconContainer'>;\n\nconst useStyles: UseStyles<OutlinedTextFieldStyles> = function (): OutlinedTextFieldStyles {\n const theme = useTheme();\n\n return {\n outline: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: theme.shape.roundness,\n },\n input: {\n flexGrow: 1,\n paddingHorizontal: inputPaddingHorizontal,\n textAlignVertical: 'center',\n textAlign: 'left',\n zIndex: theme.zIndex.textField,\n },\n iconContainer: {\n position: 'absolute',\n width: 24,\n height: 24,\n justifyContent: 'center',\n alignItems: 'center',\n right: 12,\n },\n };\n};\n\nconst OutlinedTextField = React.forwardRef<TextInput, OutlinedTextFieldProps>(function OutlinedTextField(props, ref) {\n const {\n animatedError,\n animatedLabel,\n disabled,\n error,\n focused,\n forceFocus,\n icon,\n keyboardType,\n label,\n labelLayout,\n onBlur,\n onChangeText,\n onFocus,\n onIconPress,\n onLayoutAnimatedText,\n onSubmitEditing,\n placeholder,\n secureTextEntry,\n style,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const hasActiveOutline = focused || error;\n const inputTextColor = disabled ? theme.palette.tertiary.main : theme.palette.primary.main;\n const activeColor = error\n ? theme.palette.warning.main\n : disabled\n ? theme.palette.tertiary.main\n : theme.palette.accent.main;\n const placeholderColor = disabled ? theme.palette.tertiary.main : theme.palette.text.hint;\n const outlineColor = disabled ? theme.palette.border : theme.palette.border;\n const errorColor = disabled ? theme.palette.tertiary.main : theme.palette.warning.main;\n\n const typography = theme.typography.body2;\n const fontSize = typography.fontSize.unitless;\n\n const labelScale = labelFontSize / fontSize;\n const labelWidth = labelLayout.width;\n const labelHeight = labelLayout.height;\n const labelHalfWidth = labelWidth / 2;\n const labelHalfHeight = labelHeight / 2;\n\n const labelTranslateX = -1 * (labelHalfWidth - (labelScale * labelWidth) / 2 - (fontSize - labelFontSize) * labelScale);\n const minInputHeight = defaultHeight - labelPaddingTop;\n const inputHeight = labelHeight < minInputHeight ? minInputHeight : labelHeight;\n const topPosition = Math.floor(((inputHeight > 0 ? inputHeight : 0) - labelHeight) / 2 + labelPaddingTop);\n const iconTopPosition = (defaultHeight - (label ? 0 : labelPaddingTop) - iconSize - (label ? labelYOffset : 0)) / 2;\n const labelTranslateY = -labelHalfHeight - (topPosition + labelYOffset);\n\n const placeholderOpacity = hasActiveOutline\n ? animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 0 : 1, 1],\n })\n : labelLayout.measured ? 1 : 0;\n\n const labelProps = {\n activeColor,\n error,\n errorColor,\n fontSize,\n hasActiveOutline,\n label,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n };\n\n const inputTextFontStyle = createFontStyle(theme, {\n selector: (typo) => typo.body1,\n color: inputTextColor,\n });\n\n const outlineStyle = css([\n styles.outline,\n {\n borderWidth: hasActiveOutline ? 2 : 1,\n borderColor: error ? errorColor : (hasActiveOutline ? activeColor : outlineColor),\n top: label ? 6 : 0,\n },\n ]);\n\n const textInputStyle = css([\n inputTextFontStyle,\n styles.input,\n {\n fontSize,\n color: inputTextColor,\n height: inputHeight,\n },\n icon && {\n marginRight: iconSize + 20,\n paddingRight: 0,\n },\n Platform.OS === 'web' && {\n //@ts-ignore\n outlineWidth: 0,\n },\n ]);\n\n const containerStyle = css([\n {\n paddingTop: label ? labelPaddingTop : 0,\n minHeight: label ? defaultHeight : defaultHeight + labelYOffset,\n },\n ]);\n\n const iconContainerStyle = css([\n styles.iconContainer,\n { top: iconTopPosition },\n ]);\n\n const onIconButtonPress = () => {\n forceFocus();\n onIconPress?.();\n };\n\n return (\n <View style={style}>\n <View\n pointerEvents={'none'}\n style={outlineStyle}\n />\n <View style={containerStyle}>\n {label ? (\n <InputLabel\n animatedLabel={animatedLabel}\n animatedError={animatedError}\n focused={focused}\n labelLayout={labelLayout}\n placeholder={placeholder}\n value={value}\n {...labelProps}\n />\n ) : null}\n <TextInput\n autoCapitalize={'none'}\n autoCorrect={false}\n disableFullscreenUI={true}\n ref={ref}\n onChangeText={onChangeText}\n placeholder={placeholder}\n placeholderTextColor={placeholderColor}\n editable={!disabled}\n selectionColor={activeColor}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmitEditing={onSubmitEditing}\n keyboardType={keyboardType}\n secureTextEntry={secureTextEntry}\n underlineColorAndroid={'transparent'}\n style={textInputStyle}\n value={value}\n />\n </View>\n {icon ? (\n <View style={iconContainerStyle}>\n <IconButton\n children={icon}\n onPress={onIconButtonPress}\n />\n </View>\n ) : null}\n </View>\n );\n});\n\nexport default OutlinedTextField;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;AAoBA,MAAMA,SAA6C,GAAG,YAAqC;EACvF,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,OAAO,EAAE;MACLC,QAAQ,EAAE,UADL;MAELC,IAAI,EAAE,CAFD;MAGLC,KAAK,EAAE,CAHF;MAILC,MAAM,EAAE,CAJH;MAKLC,YAAY,EAAEP,KAAK,CAACQ,KAAN,CAAYC;IALrB,CADN;IAQHC,KAAK,EAAE;MACHC,QAAQ,EAAE,CADP;MAEHC,iBAAiB,EAAEC,6BAFhB;MAGHC,iBAAiB,EAAE,QAHhB;MAIHC,SAAS,EAAE,MAJR;MAKHC,MAAM,EAAEhB,KAAK,CAACgB,MAAN,CAAaC;IALlB,CARJ;IAeHC,aAAa,EAAE;MACXf,QAAQ,EAAE,UADC;MAEXgB,KAAK,EAAE,EAFI;MAGXC,MAAM,EAAE,EAHG;MAIXC,cAAc,EAAE,QAJL;MAKXC,UAAU,EAAE,QALD;MAMXjB,KAAK,EAAE;IANI;EAfZ,CAAP;AAwBH,CA3BD;;AA6BA,MAAMkB,iBAAiB,gBAAGC,cAAA,CAAMC,UAAN,CAAoD,SAASF,iBAAT,CAA2BG,KAA3B,EAA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AI,gBACD,6BAAC,iBAAD;IAAM,KAAK,EAAE8E;EAAb,gBACI,6BAAC,mBAAD;IACI,QAAQ,EAAE9E,IADd;IAEI,OAAO,EAAE+E;EAFb,EADJ,CADC,GAOD,IA5CR,CADJ;AAgDH,CA/KyB,CAA1B;;eAiLe1F,iB"}
|
|
1
|
+
{"version":3,"names":["useStyles","theme","useTheme","outline","position","left","right","bottom","borderRadius","shape","roundness","input","flexGrow","paddingHorizontal","inputPaddingHorizontal","textAlignVertical","textAlign","zIndex","textField","iconContainer","width","height","justifyContent","alignItems","OutlinedTextField","React","forwardRef","props","ref","animatedError","animatedLabel","disabled","error","focused","forceFocus","icon","keyboardType","label","labelLayout","onBlur","onChangeText","onFocus","onIconPress","onLayoutAnimatedText","onSubmitEditing","placeholder","secureTextEntry","style","value","styles","hasActiveOutline","inputTextColor","palette","tertiary","main","primary","activeColor","warning","accent","placeholderColor","text","hint","outlineColor","border","errorColor","typography","body2","fontSize","unitless","labelScale","labelFontSize","labelWidth","labelHeight","labelHalfWidth","labelHalfHeight","labelTranslateX","minInputHeight","defaultHeight","labelPaddingTop","inputHeight","topPosition","Math","floor","iconTopPosition","iconSize","labelYOffset","labelTranslateY","placeholderOpacity","interpolate","inputRange","outputRange","measured","labelProps","inputTextFontStyle","createFontStyle","selector","typo","caption2","color","outlineStyle","css","borderWidth","borderColor","top","textInputStyle","marginRight","paddingRight","Platform","OS","outlineWidth","containerStyle","paddingTop","minHeight","iconContainerStyle","onIconButtonPress"],"sources":["OutlinedTextField.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, Platform, TextInput, View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport IconButton from '../IconButton';\nimport TextFieldProps from './TextFieldProps';\nimport InputLabel from './InputLabel';\nimport {\n defaultHeight,\n iconSize,\n inputPaddingHorizontal,\n labelFontSize,\n labelPaddingTop,\n labelYOffset,\n} from './utils';\n\ninterface OutlinedTextFieldProps extends TextFieldProps {\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n focused: boolean;\n forceFocus: () => void;\n labelLayout: { measured: boolean; width: number; height: number };\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n}\n\ntype OutlinedTextFieldStyles = NamedStylesStringUnion<'outline' | 'input' | 'iconContainer'>;\n\nconst useStyles: UseStyles<OutlinedTextFieldStyles> = function (): OutlinedTextFieldStyles {\n const theme = useTheme();\n\n return {\n outline: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: theme.shape.roundness,\n },\n input: {\n flexGrow: 1,\n paddingHorizontal: inputPaddingHorizontal,\n textAlignVertical: 'center',\n textAlign: 'left',\n zIndex: theme.zIndex.textField,\n },\n iconContainer: {\n position: 'absolute',\n width: 24,\n height: 24,\n justifyContent: 'center',\n alignItems: 'center',\n right: 12,\n },\n };\n};\n\nconst OutlinedTextField = React.forwardRef<TextInput, OutlinedTextFieldProps>(function OutlinedTextField(props, ref) {\n const {\n animatedError,\n animatedLabel,\n disabled,\n error,\n focused,\n forceFocus,\n icon,\n keyboardType,\n label,\n labelLayout,\n onBlur,\n onChangeText,\n onFocus,\n onIconPress,\n onLayoutAnimatedText,\n onSubmitEditing,\n placeholder,\n secureTextEntry,\n style,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const hasActiveOutline = focused || error;\n const inputTextColor = disabled ? theme.palette.tertiary.main : theme.palette.primary.main;\n const activeColor = error\n ? theme.palette.warning.main\n : disabled\n ? theme.palette.tertiary.main\n : theme.palette.accent.main;\n const placeholderColor = disabled ? theme.palette.tertiary.main : theme.palette.text.hint;\n const outlineColor = disabled ? theme.palette.border : theme.palette.border;\n const errorColor = disabled ? theme.palette.tertiary.main : theme.palette.warning.main;\n\n const typography = theme.typography.body2;\n const fontSize = typography.fontSize.unitless;\n\n const labelScale = labelFontSize / fontSize;\n const labelWidth = labelLayout.width;\n const labelHeight = labelLayout.height;\n const labelHalfWidth = labelWidth / 2;\n const labelHalfHeight = labelHeight / 2;\n\n const labelTranslateX = -1 * (labelHalfWidth - (labelScale * labelWidth) / 2 - (fontSize - labelFontSize) * labelScale);\n const minInputHeight = defaultHeight - labelPaddingTop;\n const inputHeight = labelHeight < minInputHeight ? minInputHeight : labelHeight;\n const topPosition = Math.floor(((inputHeight > 0 ? inputHeight : 0) - labelHeight) / 2 + labelPaddingTop);\n const iconTopPosition = (defaultHeight - (label ? 0 : labelPaddingTop) - iconSize - (label ? labelYOffset : 0)) / 2;\n const labelTranslateY = -labelHalfHeight - (topPosition + labelYOffset);\n\n const placeholderOpacity = hasActiveOutline\n ? animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 0 : 1, 1],\n })\n : labelLayout.measured ? 1 : 0;\n\n const labelProps = {\n activeColor,\n error,\n errorColor,\n fontSize,\n hasActiveOutline,\n label,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n };\n\n const inputTextFontStyle = createFontStyle(theme, {\n selector: (typo) => typo.caption2,\n color: inputTextColor,\n });\n\n const outlineStyle = css([\n styles.outline,\n {\n borderWidth: hasActiveOutline ? 2 : 1,\n borderColor: error ? errorColor : (hasActiveOutline ? activeColor : outlineColor),\n top: label ? 6 : 0,\n },\n ]);\n\n const textInputStyle = css([\n inputTextFontStyle,\n styles.input,\n {\n fontSize,\n color: inputTextColor,\n height: inputHeight,\n },\n icon && {\n marginRight: iconSize + 20,\n paddingRight: 0,\n },\n Platform.OS === 'web' && {\n //@ts-ignore\n outlineWidth: 0,\n },\n ]);\n\n const containerStyle = css([\n {\n paddingTop: label ? labelPaddingTop : 0,\n minHeight: label ? defaultHeight : defaultHeight + labelYOffset,\n },\n ]);\n\n const iconContainerStyle = css([\n styles.iconContainer,\n { top: iconTopPosition },\n ]);\n\n const onIconButtonPress = () => {\n forceFocus();\n onIconPress?.();\n };\n\n return (\n <View style={style}>\n <View\n pointerEvents={'none'}\n style={outlineStyle}\n />\n <View style={containerStyle}>\n {label ? (\n <InputLabel\n animatedLabel={animatedLabel}\n animatedError={animatedError}\n focused={focused}\n labelLayout={labelLayout}\n placeholder={placeholder}\n value={value}\n {...labelProps}\n />\n ) : null}\n <TextInput\n autoCapitalize={'none'}\n autoCorrect={false}\n disableFullscreenUI={true}\n ref={ref}\n onChangeText={onChangeText}\n placeholder={placeholder}\n placeholderTextColor={placeholderColor}\n editable={!disabled}\n selectionColor={activeColor}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmitEditing={onSubmitEditing}\n keyboardType={keyboardType}\n secureTextEntry={secureTextEntry}\n underlineColorAndroid={'transparent'}\n style={textInputStyle}\n value={value}\n />\n </View>\n {icon ? (\n <View style={iconContainerStyle}>\n <IconButton\n children={icon}\n onPress={onIconButtonPress}\n />\n </View>\n ) : null}\n </View>\n );\n});\n\nexport default OutlinedTextField;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;AAoBA,MAAMA,SAA6C,GAAG,YAAqC;EACvF,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,OAAO,EAAE;MACLC,QAAQ,EAAE,UADL;MAELC,IAAI,EAAE,CAFD;MAGLC,KAAK,EAAE,CAHF;MAILC,MAAM,EAAE,CAJH;MAKLC,YAAY,EAAEP,KAAK,CAACQ,KAAN,CAAYC;IALrB,CADN;IAQHC,KAAK,EAAE;MACHC,QAAQ,EAAE,CADP;MAEHC,iBAAiB,EAAEC,6BAFhB;MAGHC,iBAAiB,EAAE,QAHhB;MAIHC,SAAS,EAAE,MAJR;MAKHC,MAAM,EAAEhB,KAAK,CAACgB,MAAN,CAAaC;IALlB,CARJ;IAeHC,aAAa,EAAE;MACXf,QAAQ,EAAE,UADC;MAEXgB,KAAK,EAAE,EAFI;MAGXC,MAAM,EAAE,EAHG;MAIXC,cAAc,EAAE,QAJ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AAEK,eAZrB;IAaI,YAAY,EAAER,YAblB;IAcI,eAAe,EAAEU,eAdrB;IAeI,qBAAqB,EAAE,aAf3B;IAgBI,KAAK,EAAE0D,cAhBX;IAiBI,KAAK,EAAExD;EAjBX,EAZJ,CALJ,EAqCKb,IAAI,gBACD,6BAAC,iBAAD;IAAM,KAAK,EAAE8E;EAAb,gBACI,6BAAC,mBAAD;IACI,QAAQ,EAAE9E,IADd;IAEI,OAAO,EAAE+E;EAFb,EADJ,CADC,GAOD,IA5CR,CADJ;AAgDH,CA/KyB,CAA1B;;eAiLe1F,iB"}
|
|
@@ -27,14 +27,16 @@ const styles = StyleSheet.create({
|
|
|
27
27
|
export default function Divider(props) {
|
|
28
28
|
const {
|
|
29
29
|
children: childrenProp,
|
|
30
|
+
color = 'divider',
|
|
30
31
|
inset = 0,
|
|
31
|
-
|
|
32
|
+
marginBetweenChildren = 2,
|
|
32
33
|
style,
|
|
34
|
+
vertical = false,
|
|
33
35
|
...otherProps
|
|
34
36
|
} = props;
|
|
35
37
|
const theme = useTheme();
|
|
36
38
|
const fontColor = theme.palette.text.secondary;
|
|
37
|
-
const borderColor = theme.palette.divider;
|
|
39
|
+
const borderColor = color === 'divider' ? theme.palette.divider : theme.palette[color].main;
|
|
38
40
|
const marginSize = theme.spacing(1);
|
|
39
41
|
const insetSize = theme.spacing(inset);
|
|
40
42
|
const marginLeft = marginSize;
|
|
@@ -61,7 +63,7 @@ export default function Divider(props) {
|
|
|
61
63
|
const borderWidthStyle = vertical ? styles.borderRight : styles.borderBottom;
|
|
62
64
|
const containerStyle = css([insetStyle, marginStyle, styles.container, vertical ? styles.column : styles.row, childrenProp ? undefined : borderColorStyle, childrenProp ? undefined : borderWidthStyle, style]);
|
|
63
65
|
const dividerStyle = css([borderColorStyle, borderWidthStyle, styles.divider]);
|
|
64
|
-
const dividerMarginSize = theme.spacing(
|
|
66
|
+
const dividerMarginSize = theme.spacing(marginBetweenChildren);
|
|
65
67
|
const startDividerStyle = vertical ? {
|
|
66
68
|
marginBottom: dividerMarginSize
|
|
67
69
|
} : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","View","createFontStyle","css","StyleSheet","useTheme","styles","create","container","alignSelf","alignItems","row","flexDirection","column","divider","flexGrow","borderBottom","borderBottomWidth","borderRight","borderRightWidth","Divider","props","children","childrenProp","inset","
|
|
1
|
+
{"version":3,"names":["React","Text","View","createFontStyle","css","StyleSheet","useTheme","styles","create","container","alignSelf","alignItems","row","flexDirection","column","divider","flexGrow","borderBottom","borderBottomWidth","borderRight","borderRightWidth","Divider","props","children","childrenProp","color","inset","marginBetweenChildren","style","vertical","otherProps","theme","fontColor","palette","text","secondary","borderColor","main","marginSize","spacing","insetSize","marginLeft","marginRight","marginTop","marginBottom","marginStyle","insetStyle","borderColorStyle","borderWidthStyle","containerStyle","undefined","dividerStyle","dividerMarginSize","startDividerStyle","endDividerStyle","fontStyle","selector","typo","caption2","element"],"sources":["Divider.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport type DividerProps from './DividerProps';\n\nconst styles = StyleSheet.create({\n container: {\n alignSelf: 'stretch',\n alignItems: 'center',\n },\n row: {\n flexDirection: 'row',\n },\n column: {\n flexDirection: 'column',\n },\n divider: {\n flexGrow: 1,\n },\n borderBottom: {\n borderBottomWidth: 1,\n },\n borderRight: {\n borderRightWidth: 1,\n },\n});\n\nexport default function Divider(props: DividerProps) {\n const {\n children: childrenProp,\n color = 'divider',\n inset = 0,\n marginBetweenChildren = 2,\n style,\n vertical = false,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const fontColor = theme.palette.text.secondary;\n const borderColor = color === 'divider'\n ? theme.palette.divider\n : theme.palette[color].main;\n const marginSize = theme.spacing(1);\n const insetSize = theme.spacing(inset);\n\n const marginLeft = marginSize;\n const marginRight = marginSize;\n const marginTop = marginSize;\n const marginBottom = marginSize;\n\n const marginStyle = vertical\n ? { marginLeft, marginRight }\n : { marginTop, marginBottom };\n\n const insetStyle = vertical\n ? { marginTop: insetSize, marginBottom: insetSize }\n : { marginLeft: insetSize, marginRight: insetSize };\n\n const borderColorStyle = { borderColor };\n const borderWidthStyle = (vertical ? styles.borderRight : styles.borderBottom);\n\n const containerStyle = css([\n insetStyle,\n marginStyle,\n styles.container,\n vertical ? styles.column : styles.row,\n childrenProp ? undefined : borderColorStyle,\n childrenProp ? undefined : borderWidthStyle,\n style,\n ]);\n\n const dividerStyle = css([\n borderColorStyle,\n borderWidthStyle,\n styles.divider,\n ]);\n\n const dividerMarginSize = theme.spacing(marginBetweenChildren);\n const startDividerStyle = vertical ? { marginBottom: dividerMarginSize } : { marginRight: dividerMarginSize };\n const endDividerStyle = vertical ? { marginTop: dividerMarginSize } : { marginLeft: dividerMarginSize };\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => typo.caption2,\n color: fontColor,\n });\n\n const element = typeof childrenProp === 'string'\n ? <Text style={css(fontStyle)}>{childrenProp}</Text>\n : childrenProp;\n\n const children = childrenProp ? (\n <>\n <View style={css([dividerStyle, startDividerStyle])}/>\n {element}\n <View style={css([dividerStyle, endDividerStyle])}/>\n </>\n ) : null;\n\n return (\n <View\n style={containerStyle}\n {...otherProps}\n >\n {children}\n </View>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,cAA3B;AACA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,UAA/B,EAA2CC,QAA3C,QAA2D,WAA3D;AAGA,MAAMC,MAAM,GAAGF,UAAU,CAACG,MAAX,CAAkB;EAC7BC,SAAS,EAAE;IACPC,SAAS,EAAE,SADJ;IAEPC,UAAU,EAAE;EAFL,CADkB;EAK7BC,GAAG,EAAE;IACDC,aAAa,EAAE;EADd,CALwB;EAQ7BC,MAAM,EAAE;IACJD,aAAa,EAAE;EADX,CARqB;EAW7BE,OAAO,EAAE;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J,EAEKM,OAFL,eAGI,oBAAC,IAAD;IAAM,KAAK,EAAEvD,GAAG,CAAC,CAAC+C,YAAD,EAAeG,eAAf,CAAD;EAAhB,EAHJ,CADyB,GAMzB,IANJ;EAQA,oBACI,oBAAC,IAAD;IACI,KAAK,EAAEL;EADX,GAEQnB,UAFR,GAIKP,QAJL,CADJ;AAQH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["DividerProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport default interface DividerProps extends OverridableComponentProps<ViewProps, {\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The size of the inset. It works as a multiplier factor based on spacing system.\n * @default 0\n */\n inset?: number;\n\n /**\n * If `true`, the divider orientation is set to vertical.\n * @default false\n */\n vertical?: boolean;\n}> {}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["DividerProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { CommonComponentColor, OverridableComponentProps } from '../types';\n\nexport type DividerColor = 'divider' | CommonComponentColor;\n\nexport default interface DividerProps extends OverridableComponentProps<ViewProps, {\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The size of the inset. It works as a multiplier factor based on spacing system.\n * @default 0\n */\n inset?: number;\n\n /**\n * If `true`, the divider orientation is set to vertical.\n * @default false\n */\n vertical?: boolean;\n\n /**\n * The color of divider. It supports default divider color and those theme colors that make sense for this component.\n * @default 'divider'\n */\n color?: DividerColor;\n\n /**\n * The size of margin between child element and the divider. It works as a multiplier factor based on spacing system.\n * @default 2\n */\n marginBetweenChildren?: number;\n}> {}\n"],"mappings":""}
|
|
@@ -74,7 +74,6 @@ const InputLabel = props => {
|
|
|
74
74
|
selector: typo => typo.caption2
|
|
75
75
|
});
|
|
76
76
|
const labelStyle = {
|
|
77
|
-
labelTextFontStyle,
|
|
78
77
|
fontSize,
|
|
79
78
|
transform: [{
|
|
80
79
|
translateX: animatedError.interpolate({
|
|
@@ -112,7 +111,7 @@ const InputLabel = props => {
|
|
|
112
111
|
}]
|
|
113
112
|
}), /*#__PURE__*/React.createElement(Animated.Text, {
|
|
114
113
|
key: 'labelBackground-text',
|
|
115
|
-
style: [styles.placeholder, styles.backgroundText, backgroundStyle, labelStyle, {
|
|
114
|
+
style: [labelTextFontStyle, styles.placeholder, styles.backgroundText, backgroundStyle, labelStyle, {
|
|
116
115
|
top: topPosition + 1,
|
|
117
116
|
opacity,
|
|
118
117
|
transform: [...labelStyle.transform, {
|
|
@@ -125,7 +124,7 @@ const InputLabel = props => {
|
|
|
125
124
|
numberOfLines: 1
|
|
126
125
|
}, label)], /*#__PURE__*/React.createElement(Animated.Text, {
|
|
127
126
|
onLayout: onLayoutAnimatedText,
|
|
128
|
-
style: [styles.placeholder, labelStyle, paddingOffset, {
|
|
127
|
+
style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
|
|
129
128
|
textAlign: 'left',
|
|
130
129
|
top: topPosition,
|
|
131
130
|
color: error && errorColor ? errorColor : activeColor,
|
|
@@ -136,7 +135,7 @@ const InputLabel = props => {
|
|
|
136
135
|
}],
|
|
137
136
|
numberOfLines: 1
|
|
138
137
|
}, label), /*#__PURE__*/React.createElement(Animated.Text, {
|
|
139
|
-
style: [styles.placeholder, labelStyle, paddingOffset, {
|
|
138
|
+
style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
|
|
140
139
|
textAlign: 'left',
|
|
141
140
|
top: topPosition,
|
|
142
141
|
color: error && errorColor ? errorColor : placeholderColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Animated","StyleSheet","createFontStyle","useTheme","usePaperStyles","inputPaddingHorizontal","useStyles","background","position","top","left","bottom","right","width","height","backgroundText","paddingHorizontal","color","placeholder","InputLabel","props","activeColor","animatedError","animatedLabel","error","errorColor","focused","fontSize","hasActiveOutline","label","labelLayout","labelScale","labelTranslateX","labelTranslateY","onLayoutAnimatedText","paddingOffset","placeholderColor","placeholderOpacity","topPosition","value","theme","styles","paperStyles","backgroundStyle","backgroundColor","palette","default","hasFocus","opacity","interpolate","inputRange","outputRange","labelTranslationX","transform","translateX","labelTextFontStyle","selector","typo","caption2","labelStyle","translateY","scale","absoluteFill","measured","scaleY","textAlign"],"sources":["InputLabel.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, StyleSheet } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, useTheme } from '../styles';\nimport usePaperStyles from '../Paper/usePaperStyles';\nimport { inputPaddingHorizontal } from './utils';\n\ninterface LabelProps {\n activeColor: string;\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n error?: boolean;\n errorColor?: string;\n focused?: boolean;\n fontSize?: number;\n hasActiveOutline?: boolean;\n label?: string;\n labelLayout: { measured: boolean; width: number; height: number };\n labelScale: number;\n labelTranslateX: number;\n labelTranslateY: number;\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n paddingOffset?: { paddingLeft: number; paddingRight: number };\n placeholder?: string;\n placeholderColor?: string;\n placeholderOpacity: number | Animated.AnimatedInterpolation;\n topPosition: number;\n value?: string;\n}\n\ntype InputLabelStyles = NamedStylesStringUnion<'background' | 'backgroundText' | 'placeholder'>;\n\nconst useStyles: UseStyles<InputLabelStyles> = function (): InputLabelStyles {\n return {\n background: {\n position: 'absolute',\n top: 6,\n left: 10,\n bottom: 0,\n right: 0,\n width: 8,\n height: 4,\n },\n backgroundText: {\n position: 'absolute',\n left: 18,\n paddingHorizontal: 0,\n color: 'transparent',\n },\n placeholder: {\n position: 'absolute',\n left: 0,\n paddingHorizontal: inputPaddingHorizontal,\n },\n };\n};\n\nconst InputLabel = (props: LabelProps) => {\n const {\n activeColor,\n animatedError,\n animatedLabel,\n error = false,\n errorColor,\n focused,\n fontSize,\n hasActiveOutline,\n label,\n labelLayout,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n paddingOffset,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const paperStyles = usePaperStyles();\n\n const backgroundStyle = {\n backgroundColor: paperStyles?.backgroundColor ?? theme.palette.background.default,\n };\n\n const hasFocus = hasActiveOutline || value;\n const opacity = animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasFocus ? 1 : 0, 0],\n });\n\n const labelTranslationX = {\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateX, 0 || 0],\n }),\n },\n ],\n };\n\n const labelTextFontStyle = createFontStyle(theme, { selector: (typo) => typo.caption2 });\n\n const labelStyle = {\n labelTextFontStyle,\n fontSize,\n transform: [\n {\n translateX: animatedError.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [0, value && error ? 4 : 0, 0],\n }),\n },\n {\n translateY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateY, 0],\n }),\n },\n {\n scale: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelScale, 1],\n }),\n },\n ],\n };\n\n return (label ? (\n <Animated.View\n pointerEvents={'none'}\n style={[\n StyleSheet.absoluteFill,\n {\n opacity: value || focused ? (labelLayout.measured ? 1 : 0) : 1,\n },\n labelTranslationX,\n ]}\n >\n {[\n <Animated.View\n key={'labelBackground-view'}\n pointerEvents={'none'}\n style={[\n styles.background,\n backgroundStyle,\n {\n opacity,\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [-labelTranslateX, 0],\n }),\n },\n ],\n },\n ]}\n />,\n <Animated.Text\n key={'labelBackground-text'}\n style={[\n styles.placeholder,\n styles.backgroundText,\n backgroundStyle,\n labelStyle,\n {\n top: topPosition + 1,\n opacity,\n transform: [\n ...labelStyle.transform,\n {\n scaleY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [0.2, 1],\n }),\n },\n ],\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>,\n ]}\n <Animated.Text\n onLayout={onLayoutAnimatedText}\n style={[\n styles.placeholder,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : activeColor,\n opacity: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 1 : 0, 0],\n }),\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n <Animated.Text\n style={[\n styles.placeholder,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : placeholderColor,\n opacity: placeholderOpacity,\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n </Animated.View>\n ) : null);\n};\n\nexport default InputLabel;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,EAAsCC,UAAtC,QAAwD,cAAxD;AAEA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,WAA1C;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AACA,SAASC,sBAAT,QAAuC,SAAvC;;AA2BA,MAAMC,SAAsC,GAAG,YAA8B;EACzE,OAAO;IACHC,UAAU,EAAE;MACRC,QAAQ,EAAE,UADF;MAERC,GAAG,EAAE,CAFG;MAGRC,IAAI,EAAE,EAHE;MAIRC,MAAM,EAAE,CAJA;MAKRC,KAAK,EAAE,CALC;MAMRC,KAAK,EAAE,CANC;MAORC,MAAM,EAAE;IAPA,CADT;IAUHC,cAAc,EAAE;MACZP,QAAQ,EAAE,UADE;MAEZE,IAAI,EAAE,EAFM;MAGZM,iBAAiB,EAAE,CAHP;MAIZC,KAAK,EAAE;IAJK,CAVb;IAgBHC,WAAW,EAAE;MACTV,QAAQ,EAAE,UADD;MAETE,IAAI,EAAE,CAFG;MAGTM,iBAAiB,EAAEX;I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,KAAK,EAAE,CACHY,MAAM,CAACvB,WADJ,EAEHyC,UAFG,EAGHxB,aAHG,EAIH;MACI8B,SAAS,EAAE,MADf;MAEIxD,GAAG,EAAE6B,WAFT;MAGIrB,KAAK,EAAEO,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCW,gBAH9C;MAIIY,OAAO,EAAEX;IAJb,CAJG,CADX;IAYI,aAAa,EAAE;EAZnB,GAcKR,KAdL,CA5EJ,CADS,GA8FT,IA9FJ;AA+FH,CA5KD;;AA8KA,eAAeV,UAAf"}
|
|
1
|
+
{"version":3,"names":["React","Animated","StyleSheet","createFontStyle","useTheme","usePaperStyles","inputPaddingHorizontal","useStyles","background","position","top","left","bottom","right","width","height","backgroundText","paddingHorizontal","color","placeholder","InputLabel","props","activeColor","animatedError","animatedLabel","error","errorColor","focused","fontSize","hasActiveOutline","label","labelLayout","labelScale","labelTranslateX","labelTranslateY","onLayoutAnimatedText","paddingOffset","placeholderColor","placeholderOpacity","topPosition","value","theme","styles","paperStyles","backgroundStyle","backgroundColor","palette","default","hasFocus","opacity","interpolate","inputRange","outputRange","labelTranslationX","transform","translateX","labelTextFontStyle","selector","typo","caption2","labelStyle","translateY","scale","absoluteFill","measured","scaleY","textAlign"],"sources":["InputLabel.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, StyleSheet } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, useTheme } from '../styles';\nimport usePaperStyles from '../Paper/usePaperStyles';\nimport { inputPaddingHorizontal } from './utils';\n\ninterface LabelProps {\n activeColor: string;\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n error?: boolean;\n errorColor?: string;\n focused?: boolean;\n fontSize?: number;\n hasActiveOutline?: boolean;\n label?: string;\n labelLayout: { measured: boolean; width: number; height: number };\n labelScale: number;\n labelTranslateX: number;\n labelTranslateY: number;\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n paddingOffset?: { paddingLeft: number; paddingRight: number };\n placeholder?: string;\n placeholderColor?: string;\n placeholderOpacity: number | Animated.AnimatedInterpolation;\n topPosition: number;\n value?: string;\n}\n\ntype InputLabelStyles = NamedStylesStringUnion<'background' | 'backgroundText' | 'placeholder'>;\n\nconst useStyles: UseStyles<InputLabelStyles> = function (): InputLabelStyles {\n return {\n background: {\n position: 'absolute',\n top: 6,\n left: 10,\n bottom: 0,\n right: 0,\n width: 8,\n height: 4,\n },\n backgroundText: {\n position: 'absolute',\n left: 18,\n paddingHorizontal: 0,\n color: 'transparent',\n },\n placeholder: {\n position: 'absolute',\n left: 0,\n paddingHorizontal: inputPaddingHorizontal,\n },\n };\n};\n\nconst InputLabel = (props: LabelProps) => {\n const {\n activeColor,\n animatedError,\n animatedLabel,\n error = false,\n errorColor,\n focused,\n fontSize,\n hasActiveOutline,\n label,\n labelLayout,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n paddingOffset,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const paperStyles = usePaperStyles();\n\n const backgroundStyle = {\n backgroundColor: paperStyles?.backgroundColor ?? theme.palette.background.default,\n };\n\n const hasFocus = hasActiveOutline || value;\n const opacity = animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasFocus ? 1 : 0, 0],\n });\n\n const labelTranslationX = {\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateX, 0 || 0],\n }),\n },\n ],\n };\n\n const labelTextFontStyle = createFontStyle(theme, { selector: (typo) => typo.caption2 });\n\n const labelStyle = {\n fontSize,\n transform: [\n {\n translateX: animatedError.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [0, value && error ? 4 : 0, 0],\n }),\n },\n {\n translateY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateY, 0],\n }),\n },\n {\n scale: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelScale, 1],\n }),\n },\n ],\n };\n\n return (label ? (\n <Animated.View\n pointerEvents={'none'}\n style={[\n StyleSheet.absoluteFill,\n {\n opacity: value || focused ? (labelLayout.measured ? 1 : 0) : 1,\n },\n labelTranslationX,\n ]}\n >\n {[\n <Animated.View\n key={'labelBackground-view'}\n pointerEvents={'none'}\n style={[\n styles.background,\n backgroundStyle,\n {\n opacity,\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [-labelTranslateX, 0],\n }),\n },\n ],\n },\n ]}\n />,\n <Animated.Text\n key={'labelBackground-text'}\n style={[\n labelTextFontStyle,\n styles.placeholder,\n styles.backgroundText,\n backgroundStyle,\n labelStyle,\n {\n top: topPosition + 1,\n opacity,\n transform: [\n ...labelStyle.transform,\n {\n scaleY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [0.2, 1],\n }),\n },\n ],\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>,\n ]}\n <Animated.Text\n onLayout={onLayoutAnimatedText}\n style={[\n styles.placeholder,\n labelTextFontStyle,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : activeColor,\n opacity: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 1 : 0, 0],\n }),\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n <Animated.Text\n style={[\n styles.placeholder,\n labelTextFontStyle,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : placeholderColor,\n opacity: placeholderOpacity,\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n </Animated.View>\n ) : null);\n};\n\nexport default InputLabel;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,EAAsCC,UAAtC,QAAwD,cAAxD;AAEA,SAASC,eAAT,EA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DI,oBAAC,QAAD,CAAU,IAAV;IACI,QAAQ,EAAEK,oBADd;IAEI,KAAK,EAAE,CACHO,MAAM,CAACvB,WADJ,EAEHqC,kBAFG,EAGHI,UAHG,EAIHxB,aAJG,EAKH;MACI8B,SAAS,EAAE,MADf;MAEIxD,GAAG,EAAE6B,WAFT;MAGIrB,KAAK,EAAEO,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCJ,WAH9C;MAII2B,OAAO,EAAEzB,aAAa,CAAC0B,WAAd,CAA0B;QAC/BC,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADmB;QAE/BC,WAAW,EAAE,CAACvB,gBAAgB,GAAG,CAAH,GAAO,CAAxB,EAA2B,CAA3B;MAFkB,CAA1B;IAJb,CALG,CAFX;IAiBI,aAAa,EAAE;EAjBnB,GAmBKC,KAnBL,CAzDJ,eA8EI,oBAAC,QAAD,CAAU,IAAV;IACI,KAAK,EAAE,CACHY,MAAM,CAACvB,WADJ,EAEHqC,kBAFG,EAGHI,UAHG,EAIHxB,aAJG,EAKH;MACI8B,SAAS,EAAE,MADf;MAEIxD,GAAG,EAAE6B,WAFT;MAGIrB,KAAK,EAAEO,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCW,gBAH9C;MAIIY,OAAO,EAAEX;IAJb,CALG,CADX;IAaI,aAAa,EAAE;EAbnB,GAeKR,KAfL,CA9EJ,CADS,GAiGT,IAjGJ;AAkGH,CA9KD;;AAgLA,eAAeV,UAAf"}
|
|
@@ -99,7 +99,7 @@ const OutlinedTextField = /*#__PURE__*/React.forwardRef(function OutlinedTextFie
|
|
|
99
99
|
topPosition
|
|
100
100
|
};
|
|
101
101
|
const inputTextFontStyle = createFontStyle(theme, {
|
|
102
|
-
selector: typo => typo.
|
|
102
|
+
selector: typo => typo.caption2,
|
|
103
103
|
color: inputTextColor
|
|
104
104
|
});
|
|
105
105
|
const outlineStyle = css([styles.outline, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","TextInput","View","createFontStyle","css","useTheme","IconButton","InputLabel","defaultHeight","iconSize","inputPaddingHorizontal","labelFontSize","labelPaddingTop","labelYOffset","useStyles","theme","outline","position","left","right","bottom","borderRadius","shape","roundness","input","flexGrow","paddingHorizontal","textAlignVertical","textAlign","zIndex","textField","iconContainer","width","height","justifyContent","alignItems","OutlinedTextField","forwardRef","props","ref","animatedError","animatedLabel","disabled","error","focused","forceFocus","icon","keyboardType","label","labelLayout","onBlur","onChangeText","onFocus","onIconPress","onLayoutAnimatedText","onSubmitEditing","placeholder","secureTextEntry","style","value","styles","hasActiveOutline","inputTextColor","palette","tertiary","main","primary","activeColor","warning","accent","placeholderColor","text","hint","outlineColor","border","errorColor","typography","body2","fontSize","unitless","labelScale","labelWidth","labelHeight","labelHalfWidth","labelHalfHeight","labelTranslateX","minInputHeight","inputHeight","topPosition","Math","floor","iconTopPosition","labelTranslateY","placeholderOpacity","interpolate","inputRange","outputRange","measured","labelProps","inputTextFontStyle","selector","typo","body1","color","outlineStyle","borderWidth","borderColor","top","textInputStyle","marginRight","paddingRight","OS","outlineWidth","containerStyle","paddingTop","minHeight","iconContainerStyle","onIconButtonPress"],"sources":["OutlinedTextField.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, Platform, TextInput, View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport IconButton from '../IconButton';\nimport TextFieldProps from './TextFieldProps';\nimport InputLabel from './InputLabel';\nimport {\n defaultHeight,\n iconSize,\n inputPaddingHorizontal,\n labelFontSize,\n labelPaddingTop,\n labelYOffset,\n} from './utils';\n\ninterface OutlinedTextFieldProps extends TextFieldProps {\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n focused: boolean;\n forceFocus: () => void;\n labelLayout: { measured: boolean; width: number; height: number };\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n}\n\ntype OutlinedTextFieldStyles = NamedStylesStringUnion<'outline' | 'input' | 'iconContainer'>;\n\nconst useStyles: UseStyles<OutlinedTextFieldStyles> = function (): OutlinedTextFieldStyles {\n const theme = useTheme();\n\n return {\n outline: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: theme.shape.roundness,\n },\n input: {\n flexGrow: 1,\n paddingHorizontal: inputPaddingHorizontal,\n textAlignVertical: 'center',\n textAlign: 'left',\n zIndex: theme.zIndex.textField,\n },\n iconContainer: {\n position: 'absolute',\n width: 24,\n height: 24,\n justifyContent: 'center',\n alignItems: 'center',\n right: 12,\n },\n };\n};\n\nconst OutlinedTextField = React.forwardRef<TextInput, OutlinedTextFieldProps>(function OutlinedTextField(props, ref) {\n const {\n animatedError,\n animatedLabel,\n disabled,\n error,\n focused,\n forceFocus,\n icon,\n keyboardType,\n label,\n labelLayout,\n onBlur,\n onChangeText,\n onFocus,\n onIconPress,\n onLayoutAnimatedText,\n onSubmitEditing,\n placeholder,\n secureTextEntry,\n style,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const hasActiveOutline = focused || error;\n const inputTextColor = disabled ? theme.palette.tertiary.main : theme.palette.primary.main;\n const activeColor = error\n ? theme.palette.warning.main\n : disabled\n ? theme.palette.tertiary.main\n : theme.palette.accent.main;\n const placeholderColor = disabled ? theme.palette.tertiary.main : theme.palette.text.hint;\n const outlineColor = disabled ? theme.palette.border : theme.palette.border;\n const errorColor = disabled ? theme.palette.tertiary.main : theme.palette.warning.main;\n\n const typography = theme.typography.body2;\n const fontSize = typography.fontSize.unitless;\n\n const labelScale = labelFontSize / fontSize;\n const labelWidth = labelLayout.width;\n const labelHeight = labelLayout.height;\n const labelHalfWidth = labelWidth / 2;\n const labelHalfHeight = labelHeight / 2;\n\n const labelTranslateX = -1 * (labelHalfWidth - (labelScale * labelWidth) / 2 - (fontSize - labelFontSize) * labelScale);\n const minInputHeight = defaultHeight - labelPaddingTop;\n const inputHeight = labelHeight < minInputHeight ? minInputHeight : labelHeight;\n const topPosition = Math.floor(((inputHeight > 0 ? inputHeight : 0) - labelHeight) / 2 + labelPaddingTop);\n const iconTopPosition = (defaultHeight - (label ? 0 : labelPaddingTop) - iconSize - (label ? labelYOffset : 0)) / 2;\n const labelTranslateY = -labelHalfHeight - (topPosition + labelYOffset);\n\n const placeholderOpacity = hasActiveOutline\n ? animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 0 : 1, 1],\n })\n : labelLayout.measured ? 1 : 0;\n\n const labelProps = {\n activeColor,\n error,\n errorColor,\n fontSize,\n hasActiveOutline,\n label,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n };\n\n const inputTextFontStyle = createFontStyle(theme, {\n selector: (typo) => typo.body1,\n color: inputTextColor,\n });\n\n const outlineStyle = css([\n styles.outline,\n {\n borderWidth: hasActiveOutline ? 2 : 1,\n borderColor: error ? errorColor : (hasActiveOutline ? activeColor : outlineColor),\n top: label ? 6 : 0,\n },\n ]);\n\n const textInputStyle = css([\n inputTextFontStyle,\n styles.input,\n {\n fontSize,\n color: inputTextColor,\n height: inputHeight,\n },\n icon && {\n marginRight: iconSize + 20,\n paddingRight: 0,\n },\n Platform.OS === 'web' && {\n //@ts-ignore\n outlineWidth: 0,\n },\n ]);\n\n const containerStyle = css([\n {\n paddingTop: label ? labelPaddingTop : 0,\n minHeight: label ? defaultHeight : defaultHeight + labelYOffset,\n },\n ]);\n\n const iconContainerStyle = css([\n styles.iconContainer,\n { top: iconTopPosition },\n ]);\n\n const onIconButtonPress = () => {\n forceFocus();\n onIconPress?.();\n };\n\n return (\n <View style={style}>\n <View\n pointerEvents={'none'}\n style={outlineStyle}\n />\n <View style={containerStyle}>\n {label ? (\n <InputLabel\n animatedLabel={animatedLabel}\n animatedError={animatedError}\n focused={focused}\n labelLayout={labelLayout}\n placeholder={placeholder}\n value={value}\n {...labelProps}\n />\n ) : null}\n <TextInput\n autoCapitalize={'none'}\n autoCorrect={false}\n disableFullscreenUI={true}\n ref={ref}\n onChangeText={onChangeText}\n placeholder={placeholder}\n placeholderTextColor={placeholderColor}\n editable={!disabled}\n selectionColor={activeColor}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmitEditing={onSubmitEditing}\n keyboardType={keyboardType}\n secureTextEntry={secureTextEntry}\n underlineColorAndroid={'transparent'}\n style={textInputStyle}\n value={value}\n />\n </View>\n {icon ? (\n <View style={iconContainerStyle}>\n <IconButton\n children={icon}\n onPress={onIconButtonPress}\n />\n </View>\n ) : null}\n </View>\n );\n});\n\nexport default OutlinedTextField;\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAsCC,QAAtC,EAAgDC,SAAhD,EAA2DC,IAA3D,QAAuE,cAAvE;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,OAAOC,UAAP,MAAuB,cAAvB;AACA,SACIC,aADJ,EAEIC,QAFJ,EAGIC,sBAHJ,EAIIC,aAJJ,EAKIC,eALJ,EAMIC,YANJ,QAOO,SAPP;;AAoBA,MAAMC,SAA6C,GAAG,YAAqC;EACvF,MAAMC,KAAK,GAAGV,QAAQ,EAAtB;EAEA,OAAO;IACHW,OAAO,EAAE;MACLC,QAAQ,EAAE,UADL;MAELC,IAAI,EAAE,CAFD;MAGLC,KAAK,EAAE,CAHF;MAILC,MAAM,EAAE,CAJH;MAKLC,YAAY,EAAEN,KAAK,CAACO,KAAN,CAAYC;IALrB,CADN;IAQHC,KAAK,EAAE;MACHC,QAAQ,EAAE,CADP;MAEHC,iBAAiB,EAAEhB,sBAFhB;MAGHiB,iBAAiB,EAAE,QAHhB;MAIHC,SAAS,EAAE,MAJR;MAKHC,MAAM,EAAEd,KAAK,CAACc,MAAN,CAAaC;IALlB,CARJ;IAeHC,aAAa,EAAE;MACXd,QAAQ,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WI,MAAM,EAAEF,MAXZ;IAYI,eAAe,EAAEK,eAZrB;IAaI,YAAY,EAAER,YAblB;IAcI,eAAe,EAAEU,eAdrB;IAeI,qBAAqB,EAAE,aAf3B;IAgBI,KAAK,EAAEmD,cAhBX;IAiBI,KAAK,EAAEjD;EAjBX,EAZJ,CALJ,EAqCKb,IAAI,gBACD,oBAAC,IAAD;IAAM,KAAK,EAAEsE;EAAb,gBACI,oBAAC,UAAD;IACI,QAAQ,EAAEtE,IADd;IAEI,OAAO,EAAEuE;EAFb,EADJ,CADC,GAOD,IA5CR,CADJ;AAgDH,CA/KyB,CAA1B;AAiLA,eAAejF,iBAAf"}
|
|
1
|
+
{"version":3,"names":["React","Platform","TextInput","View","createFontStyle","css","useTheme","IconButton","InputLabel","defaultHeight","iconSize","inputPaddingHorizontal","labelFontSize","labelPaddingTop","labelYOffset","useStyles","theme","outline","position","left","right","bottom","borderRadius","shape","roundness","input","flexGrow","paddingHorizontal","textAlignVertical","textAlign","zIndex","textField","iconContainer","width","height","justifyContent","alignItems","OutlinedTextField","forwardRef","props","ref","animatedError","animatedLabel","disabled","error","focused","forceFocus","icon","keyboardType","label","labelLayout","onBlur","onChangeText","onFocus","onIconPress","onLayoutAnimatedText","onSubmitEditing","placeholder","secureTextEntry","style","value","styles","hasActiveOutline","inputTextColor","palette","tertiary","main","primary","activeColor","warning","accent","placeholderColor","text","hint","outlineColor","border","errorColor","typography","body2","fontSize","unitless","labelScale","labelWidth","labelHeight","labelHalfWidth","labelHalfHeight","labelTranslateX","minInputHeight","inputHeight","topPosition","Math","floor","iconTopPosition","labelTranslateY","placeholderOpacity","interpolate","inputRange","outputRange","measured","labelProps","inputTextFontStyle","selector","typo","caption2","color","outlineStyle","borderWidth","borderColor","top","textInputStyle","marginRight","paddingRight","OS","outlineWidth","containerStyle","paddingTop","minHeight","iconContainerStyle","onIconButtonPress"],"sources":["OutlinedTextField.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, Platform, TextInput, View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport IconButton from '../IconButton';\nimport TextFieldProps from './TextFieldProps';\nimport InputLabel from './InputLabel';\nimport {\n defaultHeight,\n iconSize,\n inputPaddingHorizontal,\n labelFontSize,\n labelPaddingTop,\n labelYOffset,\n} from './utils';\n\ninterface OutlinedTextFieldProps extends TextFieldProps {\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n focused: boolean;\n forceFocus: () => void;\n labelLayout: { measured: boolean; width: number; height: number };\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n}\n\ntype OutlinedTextFieldStyles = NamedStylesStringUnion<'outline' | 'input' | 'iconContainer'>;\n\nconst useStyles: UseStyles<OutlinedTextFieldStyles> = function (): OutlinedTextFieldStyles {\n const theme = useTheme();\n\n return {\n outline: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: theme.shape.roundness,\n },\n input: {\n flexGrow: 1,\n paddingHorizontal: inputPaddingHorizontal,\n textAlignVertical: 'center',\n textAlign: 'left',\n zIndex: theme.zIndex.textField,\n },\n iconContainer: {\n position: 'absolute',\n width: 24,\n height: 24,\n justifyContent: 'center',\n alignItems: 'center',\n right: 12,\n },\n };\n};\n\nconst OutlinedTextField = React.forwardRef<TextInput, OutlinedTextFieldProps>(function OutlinedTextField(props, ref) {\n const {\n animatedError,\n animatedLabel,\n disabled,\n error,\n focused,\n forceFocus,\n icon,\n keyboardType,\n label,\n labelLayout,\n onBlur,\n onChangeText,\n onFocus,\n onIconPress,\n onLayoutAnimatedText,\n onSubmitEditing,\n placeholder,\n secureTextEntry,\n style,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const hasActiveOutline = focused || error;\n const inputTextColor = disabled ? theme.palette.tertiary.main : theme.palette.primary.main;\n const activeColor = error\n ? theme.palette.warning.main\n : disabled\n ? theme.palette.tertiary.main\n : theme.palette.accent.main;\n const placeholderColor = disabled ? theme.palette.tertiary.main : theme.palette.text.hint;\n const outlineColor = disabled ? theme.palette.border : theme.palette.border;\n const errorColor = disabled ? theme.palette.tertiary.main : theme.palette.warning.main;\n\n const typography = theme.typography.body2;\n const fontSize = typography.fontSize.unitless;\n\n const labelScale = labelFontSize / fontSize;\n const labelWidth = labelLayout.width;\n const labelHeight = labelLayout.height;\n const labelHalfWidth = labelWidth / 2;\n const labelHalfHeight = labelHeight / 2;\n\n const labelTranslateX = -1 * (labelHalfWidth - (labelScale * labelWidth) / 2 - (fontSize - labelFontSize) * labelScale);\n const minInputHeight = defaultHeight - labelPaddingTop;\n const inputHeight = labelHeight < minInputHeight ? minInputHeight : labelHeight;\n const topPosition = Math.floor(((inputHeight > 0 ? inputHeight : 0) - labelHeight) / 2 + labelPaddingTop);\n const iconTopPosition = (defaultHeight - (label ? 0 : labelPaddingTop) - iconSize - (label ? labelYOffset : 0)) / 2;\n const labelTranslateY = -labelHalfHeight - (topPosition + labelYOffset);\n\n const placeholderOpacity = hasActiveOutline\n ? animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 0 : 1, 1],\n })\n : labelLayout.measured ? 1 : 0;\n\n const labelProps = {\n activeColor,\n error,\n errorColor,\n fontSize,\n hasActiveOutline,\n label,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n };\n\n const inputTextFontStyle = createFontStyle(theme, {\n selector: (typo) => typo.caption2,\n color: inputTextColor,\n });\n\n const outlineStyle = css([\n styles.outline,\n {\n borderWidth: hasActiveOutline ? 2 : 1,\n borderColor: error ? errorColor : (hasActiveOutline ? activeColor : outlineColor),\n top: label ? 6 : 0,\n },\n ]);\n\n const textInputStyle = css([\n inputTextFontStyle,\n styles.input,\n {\n fontSize,\n color: inputTextColor,\n height: inputHeight,\n },\n icon && {\n marginRight: iconSize + 20,\n paddingRight: 0,\n },\n Platform.OS === 'web' && {\n //@ts-ignore\n outlineWidth: 0,\n },\n ]);\n\n const containerStyle = css([\n {\n paddingTop: label ? labelPaddingTop : 0,\n minHeight: label ? defaultHeight : defaultHeight + labelYOffset,\n },\n ]);\n\n const iconContainerStyle = css([\n styles.iconContainer,\n { top: iconTopPosition },\n ]);\n\n const onIconButtonPress = () => {\n forceFocus();\n onIconPress?.();\n };\n\n return (\n <View style={style}>\n <View\n pointerEvents={'none'}\n style={outlineStyle}\n />\n <View style={containerStyle}>\n {label ? (\n <InputLabel\n animatedLabel={animatedLabel}\n animatedError={animatedError}\n focused={focused}\n labelLayout={labelLayout}\n placeholder={placeholder}\n value={value}\n {...labelProps}\n />\n ) : null}\n <TextInput\n autoCapitalize={'none'}\n autoCorrect={false}\n disableFullscreenUI={true}\n ref={ref}\n onChangeText={onChangeText}\n placeholder={placeholder}\n placeholderTextColor={placeholderColor}\n editable={!disabled}\n selectionColor={activeColor}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmitEditing={onSubmitEditing}\n keyboardType={keyboardType}\n secureTextEntry={secureTextEntry}\n underlineColorAndroid={'transparent'}\n style={textInputStyle}\n value={value}\n />\n </View>\n {icon ? (\n <View style={iconContainerStyle}>\n <IconButton\n children={icon}\n onPress={onIconButtonPress}\n />\n </View>\n ) : null}\n </View>\n );\n});\n\nexport default OutlinedTextField;\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAsCC,QAAtC,EAAgDC,SAAhD,EAA2DC,IAA3D,QAAuE,cAAvE;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,OAAOC,UAAP,MAAuB,cAAvB;AACA,SACIC,aADJ,EAEIC,QAFJ,EAGIC,sBAHJ,EAIIC,aAJJ,EAKIC,eALJ,EAMIC,YANJ,QAOO,SAPP;;AAoBA,MAAMC,SAA6C,GAAG,YAAqC;EACvF,MAAMC,KAAK,G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,aAFnB;IAGI,OAAO,EAAEI,OAHb;IAII,WAAW,EAAEK,WAJjB;IAKI,WAAW,EAAEO,WALjB;IAMI,KAAK,EAAEG;EANX,GAOQuC,UAPR,EADE,GAUF,IAXR,eAYI,oBAAC,SAAD;IACI,cAAc,EAAE,MADpB;IAEI,WAAW,EAAE,KAFjB;IAGI,mBAAmB,EAAE,IAHzB;IAII,GAAG,EAAE3D,GAJT;IAKI,YAAY,EAAEY,YALlB;IAMI,WAAW,EAAEK,WANjB;IAOI,oBAAoB,EAAEc,gBAP1B;IAQI,QAAQ,EAAE,CAAC5B,QARf;IASI,cAAc,EAAEyB,WATpB;IAUI,OAAO,EAAEf,OAVb;IAWI,MAAM,EAAEF,MAXZ;IAYI,eAAe,EAAEK,eAZrB;IAaI,YAAY,EAAER,YAblB;IAcI,eAAe,EAAEU,eAdrB;IAeI,qBAAqB,EAAE,aAf3B;IAgBI,KAAK,EAAEmD,cAhBX;IAiBI,KAAK,EAAEjD;EAjBX,EAZJ,CALJ,EAqCKb,IAAI,gBACD,oBAAC,IAAD;IAAM,KAAK,EAAEsE;EAAb,gBACI,oBAAC,UAAD;IACI,QAAQ,EAAEtE,IADd;IAEI,OAAO,EAAEuE;EAFb,EADJ,CADC,GAOD,IA5CR,CADJ;AAgDH,CA/KyB,CAA1B;AAiLA,eAAejF,iBAAf"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ViewProps } from 'react-native';
|
|
3
|
-
import type { OverridableComponentProps } from '../types';
|
|
3
|
+
import type { CommonComponentColor, OverridableComponentProps } from '../types';
|
|
4
|
+
export declare type DividerColor = 'divider' | CommonComponentColor;
|
|
4
5
|
export default interface DividerProps extends OverridableComponentProps<ViewProps, {
|
|
5
6
|
/**
|
|
6
7
|
* The content of the component.
|
|
@@ -16,5 +17,15 @@ export default interface DividerProps extends OverridableComponentProps<ViewProp
|
|
|
16
17
|
* @default false
|
|
17
18
|
*/
|
|
18
19
|
vertical?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The color of divider. It supports default divider color and those theme colors that make sense for this component.
|
|
22
|
+
* @default 'divider'
|
|
23
|
+
*/
|
|
24
|
+
color?: DividerColor;
|
|
25
|
+
/**
|
|
26
|
+
* The size of margin between child element and the divider. It works as a multiplier factor based on spacing system.
|
|
27
|
+
* @default 2
|
|
28
|
+
*/
|
|
29
|
+
marginBetweenChildren?: number;
|
|
19
30
|
}> {
|
|
20
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fountain-ui/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.52",
|
|
4
4
|
"author": "Fountain-UI Team",
|
|
5
5
|
"description": "React components that implement Tappytoon's Fountain Design.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "0fc9a9c4db15a8c83560130af2f76d83e91d235c"
|
|
71
71
|
}
|
package/src/Divider/Divider.tsx
CHANGED
|
@@ -28,16 +28,20 @@ const styles = StyleSheet.create({
|
|
|
28
28
|
export default function Divider(props: DividerProps) {
|
|
29
29
|
const {
|
|
30
30
|
children: childrenProp,
|
|
31
|
+
color = 'divider',
|
|
31
32
|
inset = 0,
|
|
32
|
-
|
|
33
|
+
marginBetweenChildren = 2,
|
|
33
34
|
style,
|
|
35
|
+
vertical = false,
|
|
34
36
|
...otherProps
|
|
35
37
|
} = props;
|
|
36
38
|
|
|
37
39
|
const theme = useTheme();
|
|
38
40
|
|
|
39
41
|
const fontColor = theme.palette.text.secondary;
|
|
40
|
-
const borderColor =
|
|
42
|
+
const borderColor = color === 'divider'
|
|
43
|
+
? theme.palette.divider
|
|
44
|
+
: theme.palette[color].main;
|
|
41
45
|
const marginSize = theme.spacing(1);
|
|
42
46
|
const insetSize = theme.spacing(inset);
|
|
43
47
|
|
|
@@ -73,7 +77,7 @@ export default function Divider(props: DividerProps) {
|
|
|
73
77
|
styles.divider,
|
|
74
78
|
]);
|
|
75
79
|
|
|
76
|
-
const dividerMarginSize = theme.spacing(
|
|
80
|
+
const dividerMarginSize = theme.spacing(marginBetweenChildren);
|
|
77
81
|
const startDividerStyle = vertical ? { marginBottom: dividerMarginSize } : { marginRight: dividerMarginSize };
|
|
78
82
|
const endDividerStyle = vertical ? { marginTop: dividerMarginSize } : { marginLeft: dividerMarginSize };
|
|
79
83
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ViewProps } from 'react-native';
|
|
3
|
-
import type { OverridableComponentProps } from '../types';
|
|
3
|
+
import type { CommonComponentColor, OverridableComponentProps } from '../types';
|
|
4
|
+
|
|
5
|
+
export type DividerColor = 'divider' | CommonComponentColor;
|
|
4
6
|
|
|
5
7
|
export default interface DividerProps extends OverridableComponentProps<ViewProps, {
|
|
6
8
|
/**
|
|
@@ -19,4 +21,16 @@ export default interface DividerProps extends OverridableComponentProps<ViewProp
|
|
|
19
21
|
* @default false
|
|
20
22
|
*/
|
|
21
23
|
vertical?: boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The color of divider. It supports default divider color and those theme colors that make sense for this component.
|
|
27
|
+
* @default 'divider'
|
|
28
|
+
*/
|
|
29
|
+
color?: DividerColor;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The size of margin between child element and the divider. It works as a multiplier factor based on spacing system.
|
|
33
|
+
* @default 2
|
|
34
|
+
*/
|
|
35
|
+
marginBetweenChildren?: number;
|
|
22
36
|
}> {}
|
|
@@ -108,7 +108,6 @@ const InputLabel = (props: LabelProps) => {
|
|
|
108
108
|
const labelTextFontStyle = createFontStyle(theme, { selector: (typo) => typo.caption2 });
|
|
109
109
|
|
|
110
110
|
const labelStyle = {
|
|
111
|
-
labelTextFontStyle,
|
|
112
111
|
fontSize,
|
|
113
112
|
transform: [
|
|
114
113
|
{
|
|
@@ -166,6 +165,7 @@ const InputLabel = (props: LabelProps) => {
|
|
|
166
165
|
<Animated.Text
|
|
167
166
|
key={'labelBackground-text'}
|
|
168
167
|
style={[
|
|
168
|
+
labelTextFontStyle,
|
|
169
169
|
styles.placeholder,
|
|
170
170
|
styles.backgroundText,
|
|
171
171
|
backgroundStyle,
|
|
@@ -193,6 +193,7 @@ const InputLabel = (props: LabelProps) => {
|
|
|
193
193
|
onLayout={onLayoutAnimatedText}
|
|
194
194
|
style={[
|
|
195
195
|
styles.placeholder,
|
|
196
|
+
labelTextFontStyle,
|
|
196
197
|
labelStyle,
|
|
197
198
|
paddingOffset,
|
|
198
199
|
{
|
|
@@ -212,6 +213,7 @@ const InputLabel = (props: LabelProps) => {
|
|
|
212
213
|
<Animated.Text
|
|
213
214
|
style={[
|
|
214
215
|
styles.placeholder,
|
|
216
|
+
labelTextFontStyle,
|
|
215
217
|
labelStyle,
|
|
216
218
|
paddingOffset,
|
|
217
219
|
{
|
|
@@ -133,7 +133,7 @@ const OutlinedTextField = React.forwardRef<TextInput, OutlinedTextFieldProps>(fu
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
const inputTextFontStyle = createFontStyle(theme, {
|
|
136
|
-
selector: (typo) => typo.
|
|
136
|
+
selector: (typo) => typo.caption2,
|
|
137
137
|
color: inputTextColor,
|
|
138
138
|
});
|
|
139
139
|
|