@fountain-ui/core 3.0.0-alpha.6 → 3.0.0-alpha.7
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/Button/Button.js +4 -0
- package/build/commonjs/Button/Button.js.map +1 -1
- package/build/commonjs/Button/ButtonProps.js.map +1 -1
- package/build/commonjs/Checkbox/Checkbox.js +4 -1
- package/build/commonjs/Checkbox/Checkbox.js.map +1 -1
- package/build/commonjs/Checkbox/useVariantStyleMap.js +4 -1
- package/build/commonjs/Checkbox/useVariantStyleMap.js.map +1 -1
- package/build/commonjs/Pagination/NumberPagination.js +1 -1
- package/build/commonjs/Pagination/NumberPagination.js.map +1 -1
- package/build/commonjs/hooks/useContentContainerStyle.js +9 -8
- package/build/commonjs/hooks/useContentContainerStyle.js.map +1 -1
- package/build/module/Button/Button.js +4 -0
- package/build/module/Button/Button.js.map +1 -1
- package/build/module/Button/ButtonProps.js.map +1 -1
- package/build/module/Checkbox/Checkbox.js +4 -1
- package/build/module/Checkbox/Checkbox.js.map +1 -1
- package/build/module/Checkbox/useVariantStyleMap.js +4 -1
- package/build/module/Checkbox/useVariantStyleMap.js.map +1 -1
- package/build/module/Pagination/NumberPagination.js +1 -1
- package/build/module/Pagination/NumberPagination.js.map +1 -1
- package/build/module/hooks/useContentContainerStyle.js +9 -8
- package/build/module/hooks/useContentContainerStyle.js.map +1 -1
- package/build/typescript/Button/ButtonProps.d.ts +5 -0
- package/build/typescript/Checkbox/useVariantStyleMap.d.ts +1 -0
- package/package.json +2 -2
- package/src/Button/Button.tsx +2 -0
- package/src/Button/ButtonProps.ts +6 -0
- package/src/Checkbox/Checkbox.tsx +11 -8
- package/src/Checkbox/useVariantStyleMap.ts +5 -1
- package/src/Pagination/NumberPagination.tsx +1 -1
- package/src/hooks/useContentContainerStyle.ts +12 -9
|
@@ -95,6 +95,7 @@ function Button(props) {
|
|
|
95
95
|
color: colorProp = 'primary',
|
|
96
96
|
disabled: disabledProp = false,
|
|
97
97
|
disableMinWidth = false,
|
|
98
|
+
disablePadding = false,
|
|
98
99
|
endIcon: endIconProp,
|
|
99
100
|
fullWidth = false,
|
|
100
101
|
href,
|
|
@@ -124,6 +125,9 @@ function Button(props) {
|
|
|
124
125
|
const endIcon = (0, _utils.cloneElementSafely)(endIconProp, iconProps);
|
|
125
126
|
const buttonBaseStyle = (0, _styles2.css)([styles.root, containerStyle, styles[size], fullWidth ? styles.fullWidth : undefined, disableMinWidth ? {
|
|
126
127
|
minWidth: 0
|
|
128
|
+
} : undefined, disablePadding ? {
|
|
129
|
+
paddingHorizontal: 0,
|
|
130
|
+
paddingVertical: 0
|
|
127
131
|
} : undefined, styleProp]);
|
|
128
132
|
const fontStyle = (0, _styles2.createFontStyle)(theme, {
|
|
129
133
|
selector: _ => fontStyleMap[size],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","theme","useTheme","root","alignItems","borderRadius","shape","radius","sm","flexDirection","justifyContent","fullWidth","width","large","gap","spacing","minWidth","paddingHorizontal","paddingVertical","medium","small","loadingSpinner","position","fontStyleMap","typographyOf","fontSize","lineHeight","fontFamily","letterSpacing","getLoadingSpinnerColor","variant","color","Button","props","children","colorProp","disabled","disabledProp","disableMinWidth","endIcon","endIconProp","href","isLoading","onPress","pressEffect","size","startIcon","startIconProp","style","styleProp","otherProps","styles","container","containerStyle","iconColor","labelColor","useVariantStyleMap","iconProps","fill","opacity","cloneElementSafely","buttonBaseStyle","css","undefined","fontStyle","createFontStyle","selector","_","textStyle","textAlign","modifiedPressEffect","handlePress","Linking","canOpenURL","openURL","loadingSpinnerColor"],"sources":["Button.tsx"],"sourcesContent":["import React from 'react';\nimport { Linking, Text } from 'react-native';\nimport type { FontStyle, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { typographyOf } from '@fountain-ui/styles';\nimport ButtonBase from '../ButtonBase/ButtonBase';\nimport { LoadingSpinner } from '../internal/icons';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport type ButtonProps from './ButtonProps';\nimport type { ButtonColor, ButtonSize, ButtonVariant } from './ButtonProps';\nimport useVariantStyleMap from './useVariantStyleMap';\n\ntype ButtonStyles = NamedStylesStringUnion<'root' | 'fullWidth' | 'large' | 'medium' | 'small' | 'loadingSpinner'>;\n\nconst useStyles: UseStyles<ButtonStyles> = function (): ButtonStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n borderRadius: theme.shape.radius.sm,\n flexDirection: 'row',\n justifyContent: 'center',\n },\n fullWidth: {\n width: '100%',\n },\n large: {\n gap: theme.spacing(2),\n minWidth: 104,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(3.5),\n },\n medium: {\n gap: theme.spacing(1.5),\n minWidth: 88,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(2.75),\n },\n small: {\n minWidth: 64,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(2),\n },\n loadingSpinner: {\n position: 'absolute',\n },\n };\n};\n\nconst fontStyleMap: Record<ButtonSize, FontStyle> = {\n large: typographyOf({\n fontSize: 16,\n lineHeight: 20,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.32,\n }),\n medium: typographyOf({\n fontSize: 15,\n lineHeight: 19.5,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.3,\n }),\n small: typographyOf({\n fontSize: 13,\n lineHeight: 16.9,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.26,\n }),\n};\n\nfunction getLoadingSpinnerColor(variant: ButtonVariant, color: ButtonColor) {\n if (variant === 'solid' || (variant === 'capsuleSolid' && color !== 'secondary')) {\n return 'white';\n }\n return 'gray';\n}\n\nexport default function Button(props: ButtonProps) {\n const {\n children,\n color: colorProp = 'primary' as ButtonColor,\n disabled: disabledProp = false,\n disableMinWidth = false,\n endIcon: endIconProp,\n fullWidth = false,\n href,\n isLoading = false,\n onPress,\n pressEffect,\n size = 'medium' as ButtonSize,\n startIcon: startIconProp,\n style: styleProp,\n variant = 'solid' as ButtonVariant,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const disabled = disabledProp || isLoading;\n\n const color = disabledProp ? 'disabled' : colorProp;\n const {\n container: containerStyle,\n iconColor,\n labelColor,\n } = useVariantStyleMap(variant, color);\n\n const iconProps = {\n fill: iconColor,\n opacity: isLoading ? 0 : 1,\n };\n\n const startIcon = cloneElementSafely(startIconProp, iconProps);\n const endIcon = cloneElementSafely(endIconProp, iconProps);\n\n const buttonBaseStyle = css([\n styles.root,\n containerStyle,\n styles[size],\n fullWidth ? styles.fullWidth : undefined,\n disableMinWidth ? { minWidth: 0 } : undefined,\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (_) => fontStyleMap[size],\n color: labelColor,\n });\n\n const textStyle = css([\n fontStyle,\n {\n opacity: isLoading ? 0 : 1,\n textAlign: 'center',\n },\n ]);\n\n const modifiedPressEffect = variant !== 'text' && !pressEffect\n ? 'scale'\n : pressEffect;\n\n const handlePress = async () => {\n if (disabled) {\n return;\n }\n if (onPress) {\n onPress();\n return;\n }\n if (href) {\n if (await Linking.canOpenURL(href)) {\n await Linking.openURL(href);\n }\n }\n };\n\n const loadingSpinnerColor = getLoadingSpinnerColor(variant, color);\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={buttonBaseStyle}\n pressEffect={modifiedPressEffect}\n {...otherProps}\n >\n {startIcon}\n\n <Text style={textStyle}>\n {children}\n </Text>\n\n {endIcon}\n\n {isLoading ? (\n <LoadingSpinner\n color={loadingSpinnerColor}\n size={size}\n style={styles.loadingSpinner}\n />\n ) : null}\n </ButtonBase>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAGA;;;;;;AAIA,MAAMA,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAG,IAAAC,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;EAeA,MAAMkC,mBAAmB,GAAG9C,sBAAsB,CAACC,OAAD,EAAUC,KAAV,CAAlD;EAEA,oBACI,6BAAC,mBAAD;IACI,QAAQ,EAAEK,QADd;IAEI,OAAO,EAAEmC,WAFb;IAGI,KAAK,EAAEV,eAHX;IAII,WAAW,EAAES;EAJjB,GAKQpB,UALR,GAOKJ,SAPL,eASI,6BAAC,iBAAD;IAAM,KAAK,EAAEsB;EAAb,GACKlC,QADL,CATJ,EAaKK,OAbL,EAeKG,SAAS,gBACN,6BAAC,qBAAD;IACI,KAAK,EAAEiC,mBADX;IAEI,IAAI,EAAE9B,IAFV;IAGI,KAAK,EAAEM,MAAM,CAAC9B;EAHlB,EADM,GAMN,IArBR,CADJ;AAyBH;;AAAA"}
|
|
1
|
+
{"version":3,"names":["useStyles","theme","useTheme","root","alignItems","borderRadius","shape","radius","sm","flexDirection","justifyContent","fullWidth","width","large","gap","spacing","minWidth","paddingHorizontal","paddingVertical","medium","small","loadingSpinner","position","fontStyleMap","typographyOf","fontSize","lineHeight","fontFamily","letterSpacing","getLoadingSpinnerColor","variant","color","Button","props","children","colorProp","disabled","disabledProp","disableMinWidth","disablePadding","endIcon","endIconProp","href","isLoading","onPress","pressEffect","size","startIcon","startIconProp","style","styleProp","otherProps","styles","container","containerStyle","iconColor","labelColor","useVariantStyleMap","iconProps","fill","opacity","cloneElementSafely","buttonBaseStyle","css","undefined","fontStyle","createFontStyle","selector","_","textStyle","textAlign","modifiedPressEffect","handlePress","Linking","canOpenURL","openURL","loadingSpinnerColor"],"sources":["Button.tsx"],"sourcesContent":["import React from 'react';\nimport { Linking, Text } from 'react-native';\nimport type { FontStyle, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { typographyOf } from '@fountain-ui/styles';\nimport ButtonBase from '../ButtonBase/ButtonBase';\nimport { LoadingSpinner } from '../internal/icons';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport type ButtonProps from './ButtonProps';\nimport type { ButtonColor, ButtonSize, ButtonVariant } from './ButtonProps';\nimport useVariantStyleMap from './useVariantStyleMap';\n\ntype ButtonStyles = NamedStylesStringUnion<'root' | 'fullWidth' | 'large' | 'medium' | 'small' | 'loadingSpinner'>;\n\nconst useStyles: UseStyles<ButtonStyles> = function (): ButtonStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n borderRadius: theme.shape.radius.sm,\n flexDirection: 'row',\n justifyContent: 'center',\n },\n fullWidth: {\n width: '100%',\n },\n large: {\n gap: theme.spacing(2),\n minWidth: 104,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(3.5),\n },\n medium: {\n gap: theme.spacing(1.5),\n minWidth: 88,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(2.75),\n },\n small: {\n minWidth: 64,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(2),\n },\n loadingSpinner: {\n position: 'absolute',\n },\n };\n};\n\nconst fontStyleMap: Record<ButtonSize, FontStyle> = {\n large: typographyOf({\n fontSize: 16,\n lineHeight: 20,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.32,\n }),\n medium: typographyOf({\n fontSize: 15,\n lineHeight: 19.5,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.3,\n }),\n small: typographyOf({\n fontSize: 13,\n lineHeight: 16.9,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.26,\n }),\n};\n\nfunction getLoadingSpinnerColor(variant: ButtonVariant, color: ButtonColor) {\n if (variant === 'solid' || (variant === 'capsuleSolid' && color !== 'secondary')) {\n return 'white';\n }\n return 'gray';\n}\n\nexport default function Button(props: ButtonProps) {\n const {\n children,\n color: colorProp = 'primary' as ButtonColor,\n disabled: disabledProp = false,\n disableMinWidth = false,\n disablePadding = false,\n endIcon: endIconProp,\n fullWidth = false,\n href,\n isLoading = false,\n onPress,\n pressEffect,\n size = 'medium' as ButtonSize,\n startIcon: startIconProp,\n style: styleProp,\n variant = 'solid' as ButtonVariant,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const disabled = disabledProp || isLoading;\n\n const color = disabledProp ? 'disabled' : colorProp;\n const {\n container: containerStyle,\n iconColor,\n labelColor,\n } = useVariantStyleMap(variant, color);\n\n const iconProps = {\n fill: iconColor,\n opacity: isLoading ? 0 : 1,\n };\n\n const startIcon = cloneElementSafely(startIconProp, iconProps);\n const endIcon = cloneElementSafely(endIconProp, iconProps);\n\n const buttonBaseStyle = css([\n styles.root,\n containerStyle,\n styles[size],\n fullWidth ? styles.fullWidth : undefined,\n disableMinWidth ? { minWidth: 0 } : undefined,\n disablePadding ? { paddingHorizontal: 0, paddingVertical: 0 } : undefined,\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (_) => fontStyleMap[size],\n color: labelColor,\n });\n\n const textStyle = css([\n fontStyle,\n {\n opacity: isLoading ? 0 : 1,\n textAlign: 'center',\n },\n ]);\n\n const modifiedPressEffect = variant !== 'text' && !pressEffect\n ? 'scale'\n : pressEffect;\n\n const handlePress = async () => {\n if (disabled) {\n return;\n }\n if (onPress) {\n onPress();\n return;\n }\n if (href) {\n if (await Linking.canOpenURL(href)) {\n await Linking.openURL(href);\n }\n }\n };\n\n const loadingSpinnerColor = getLoadingSpinnerColor(variant, color);\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={buttonBaseStyle}\n pressEffect={modifiedPressEffect}\n {...otherProps}\n >\n {startIcon}\n\n <Text style={textStyle}>\n {children}\n </Text>\n\n {endIcon}\n\n {isLoading ? (\n <LoadingSpinner\n color={loadingSpinnerColor}\n size={size}\n style={styles.loadingSpinner}\n />\n ) : null}\n </ButtonBase>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAGA;;;;;;AAIA,MAAMA,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAG,IAAAC,iB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oBAAA,CAAQC,UAAR,CAAmBhC,IAAnB,CAAV,EAAoC;QAChC,MAAM+B,oBAAA,CAAQE,OAAR,CAAgBjC,IAAhB,CAAN;MACH;IACJ;EACJ,CAbD;;EAeA,MAAMkC,mBAAmB,GAAG/C,sBAAsB,CAACC,OAAD,EAAUC,KAAV,CAAlD;EAEA,oBACI,6BAAC,mBAAD;IACI,QAAQ,EAAEK,QADd;IAEI,OAAO,EAAEoC,WAFb;IAGI,KAAK,EAAEV,eAHX;IAII,WAAW,EAAES;EAJjB,GAKQpB,UALR,GAOKJ,SAPL,eASI,6BAAC,iBAAD;IAAM,KAAK,EAAEsB;EAAb,GACKnC,QADL,CATJ,EAaKM,OAbL,EAeKG,SAAS,gBACN,6BAAC,qBAAD;IACI,KAAK,EAAEiC,mBADX;IAEI,IAAI,EAAE9B,IAFV;IAGI,KAAK,EAAEM,MAAM,CAAC/B;EAHlB,EADM,GAMN,IArBR,CADJ;AAyBH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["buttonColors","buttonSizes","buttonVariants"],"sources":["ButtonProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ButtonBaseProps } from '../ButtonBase';\nimport type { OverridableComponentProps } from '../types';\n\nexport const buttonColors = [\n 'accent',\n 'primary',\n 'danger',\n 'disabled',\n 'secondary',\n 'accentAlt',\n] as const;\nexport type ButtonColor = typeof buttonColors[number];\n\nexport const buttonSizes = [\n 'small',\n 'medium',\n 'large',\n] as const;\nexport type ButtonSize = typeof buttonSizes[number];\n\nexport const buttonVariants = [\n 'solid',\n 'outlined',\n 'text',\n 'capsuleSolid',\n 'capsuleOutlined',\n] as const;\nexport type ButtonVariant = typeof buttonVariants[number];\n\nexport default interface ButtonProps extends OverridableComponentProps<ButtonBaseProps, {\n /**\n * The content of the button.\n */\n children: string;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'primary'\n */\n color?: ButtonColor;\n\n /**\n * Determines whether minWidth should be applied.\n * @default false\n */\n disableMinWidth?: boolean;\n\n /**\n * Element placed after the children.\n */\n endIcon?: React.ReactElement;\n\n /**\n * If `true`, the button will take up the full width of its container.\n * @default false\n */\n fullWidth?: boolean;\n\n /**\n * The URL to link to when the button is clicked.\n */\n href?: string;\n\n /**\n * Determines whether to show the loading status or not.\n * @default false\n */\n isLoading?: boolean;\n\n /**\n * The size of the button.\n * @default 'medium'\n */\n size?: ButtonSize;\n\n /**\n * Element placed before the children.\n */\n startIcon?: React.ReactElement;\n\n /**\n * The variant to use.\n * @default 'solid'\n */\n variant?: ButtonVariant;\n}> {}\n"],"mappings":";;;;;;AAIO,MAAMA,YAAY,GAAG,CACxB,QADwB,EAExB,SAFwB,EAGxB,QAHwB,EAIxB,UAJwB,EAKxB,WALwB,EAMxB,WANwB,CAArB;;AAUA,MAAMC,WAAW,GAAG,CACvB,OADuB,EAEvB,QAFuB,EAGvB,OAHuB,CAApB;;AAOA,MAAMC,cAAc,GAAG,CAC1B,OAD0B,EAE1B,UAF0B,EAG1B,MAH0B,EAI1B,cAJ0B,EAK1B,iBAL0B,CAAvB"}
|
|
1
|
+
{"version":3,"names":["buttonColors","buttonSizes","buttonVariants"],"sources":["ButtonProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ButtonBaseProps } from '../ButtonBase';\nimport type { OverridableComponentProps } from '../types';\n\nexport const buttonColors = [\n 'accent',\n 'primary',\n 'danger',\n 'disabled',\n 'secondary',\n 'accentAlt',\n] as const;\nexport type ButtonColor = typeof buttonColors[number];\n\nexport const buttonSizes = [\n 'small',\n 'medium',\n 'large',\n] as const;\nexport type ButtonSize = typeof buttonSizes[number];\n\nexport const buttonVariants = [\n 'solid',\n 'outlined',\n 'text',\n 'capsuleSolid',\n 'capsuleOutlined',\n] as const;\nexport type ButtonVariant = typeof buttonVariants[number];\n\nexport default interface ButtonProps extends OverridableComponentProps<ButtonBaseProps, {\n /**\n * The content of the button.\n */\n children: string;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'primary'\n */\n color?: ButtonColor;\n\n /**\n * Determines whether minWidth should be applied.\n * @default false\n */\n disableMinWidth?: boolean;\n\n /**\n * Determines whether padding should be applied.\n * @default false\n */\n disablePadding?: boolean;\n\n /**\n * Element placed after the children.\n */\n endIcon?: React.ReactElement;\n\n /**\n * If `true`, the button will take up the full width of its container.\n * @default false\n */\n fullWidth?: boolean;\n\n /**\n * The URL to link to when the button is clicked.\n */\n href?: string;\n\n /**\n * Determines whether to show the loading status or not.\n * @default false\n */\n isLoading?: boolean;\n\n /**\n * The size of the button.\n * @default 'medium'\n */\n size?: ButtonSize;\n\n /**\n * Element placed before the children.\n */\n startIcon?: React.ReactElement;\n\n /**\n * The variant to use.\n * @default 'solid'\n */\n variant?: ButtonVariant;\n}> {}\n"],"mappings":";;;;;;AAIO,MAAMA,YAAY,GAAG,CACxB,QADwB,EAExB,SAFwB,EAGxB,QAHwB,EAIxB,UAJwB,EAKxB,WALwB,EAMxB,WANwB,CAArB;;AAUA,MAAMC,WAAW,GAAG,CACvB,OADuB,EAEvB,QAFuB,EAGvB,OAHuB,CAApB;;AAOA,MAAMC,cAAc,GAAG,CAC1B,OAD0B,EAE1B,UAF0B,EAG1B,MAH0B,EAI1B,cAJ0B,EAK1B,iBAL0B,CAAvB"}
|
|
@@ -35,6 +35,7 @@ function Checkbox(props) {
|
|
|
35
35
|
} = props;
|
|
36
36
|
const theme = (0, _styles.useTheme)();
|
|
37
37
|
const {
|
|
38
|
+
checkboxContainerStyle,
|
|
38
39
|
checkboxStyle,
|
|
39
40
|
containerStyle,
|
|
40
41
|
iconColor
|
|
@@ -56,12 +57,14 @@ function Checkbox(props) {
|
|
|
56
57
|
onPress: handlePress,
|
|
57
58
|
style: rootStyle
|
|
58
59
|
}, otherProps), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
60
|
+
style: checkboxContainerStyle
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
59
62
|
style: checkboxStyle
|
|
60
63
|
}, checked ? /*#__PURE__*/_react.default.createElement(_icons.CheckboxOn, {
|
|
61
64
|
fill: iconColor,
|
|
62
65
|
height: 7.5,
|
|
63
66
|
width: 11
|
|
64
|
-
}) : null), children ? /*#__PURE__*/_react.default.createElement(_Row.default, {
|
|
67
|
+
}) : null)), children ? /*#__PURE__*/_react.default.createElement(_Row.default, {
|
|
65
68
|
flexGrow: 1,
|
|
66
69
|
flexShrink: 1
|
|
67
70
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Checkbox","props","checked","children","disabled","onChange","style","styleProp","variant","otherProps","theme","useTheme","checkboxStyle","containerStyle","iconColor","useVariantStyleMap","rootStyle","css","undefined","fontStyle","createFontStyle","selector","typography","body2","regular","color","palette","text","strong","handlePress"],"sources":["Checkbox.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport ButtonBase from '../ButtonBase';\nimport { CheckboxOn as CheckboxOnIcon } from '../internal/icons';\nimport Row from '../Row';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport type CheckboxProps from './CheckboxProps';\nimport type { CheckboxVariant } from './CheckboxProps';\nimport useVariantStyleMap from './useVariantStyleMap';\n\nexport default function Checkbox(props: CheckboxProps) {\n const {\n checked = false,\n children,\n disabled = false,\n onChange,\n style: styleProp,\n variant = 'square' as CheckboxVariant,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const {\n checkboxStyle,\n containerStyle,\n iconColor,\n } = useVariantStyleMap(variant, checked);\n\n const rootStyle = css([\n children ? containerStyle : undefined,\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography.body2.regular,\n color: theme.palette.text.strong,\n });\n\n const handlePress = () => {\n if (onChange) {\n onChange(!checked);\n }\n };\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={rootStyle}\n {...otherProps}\n >\n <View style={
|
|
1
|
+
{"version":3,"names":["Checkbox","props","checked","children","disabled","onChange","style","styleProp","variant","otherProps","theme","useTheme","checkboxContainerStyle","checkboxStyle","containerStyle","iconColor","useVariantStyleMap","rootStyle","css","undefined","fontStyle","createFontStyle","selector","typography","body2","regular","color","palette","text","strong","handlePress"],"sources":["Checkbox.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport ButtonBase from '../ButtonBase';\nimport { CheckboxOn as CheckboxOnIcon } from '../internal/icons';\nimport Row from '../Row';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport type CheckboxProps from './CheckboxProps';\nimport type { CheckboxVariant } from './CheckboxProps';\nimport useVariantStyleMap from './useVariantStyleMap';\n\nexport default function Checkbox(props: CheckboxProps) {\n const {\n checked = false,\n children,\n disabled = false,\n onChange,\n style: styleProp,\n variant = 'square' as CheckboxVariant,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const {\n checkboxContainerStyle,\n checkboxStyle,\n containerStyle,\n iconColor,\n } = useVariantStyleMap(variant, checked);\n\n const rootStyle = css([\n children ? containerStyle : undefined,\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography.body2.regular,\n color: theme.palette.text.strong,\n });\n\n const handlePress = () => {\n if (onChange) {\n onChange(!checked);\n }\n };\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={rootStyle}\n {...otherProps}\n >\n <View style={checkboxContainerStyle}>\n <View style={checkboxStyle}>\n {checked ? (\n <CheckboxOnIcon\n fill={iconColor}\n height={7.5}\n width={11}\n />\n ) : null}\n </View>\n </View>\n\n {children ? (\n <Row\n flexGrow={1}\n flexShrink={1}\n >\n <Text\n children={children}\n style={fontStyle}\n />\n </Row>\n ) : null}\n </ButtonBase>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;;;;;AAEe,SAASA,QAAT,CAAkBC,KAAlB,EAAwC;EACnD,MAAM;IACFC,OAAO,G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I,KAAK,EAAEiB;EAFX,EAJJ,CADK,GAUL,IA5BR,CADJ;AAgCH;;AAAA"}
|
|
@@ -25,6 +25,10 @@ function useVariantStyleMap(variant, checked) {
|
|
|
25
25
|
switch (variant) {
|
|
26
26
|
case 'square':
|
|
27
27
|
return {
|
|
28
|
+
checkboxContainerStyle: {
|
|
29
|
+
alignSelf: 'flex-start',
|
|
30
|
+
paddingTop: 3
|
|
31
|
+
},
|
|
28
32
|
checkboxStyle: (0, _styles2.css)([styles.checkbox, {
|
|
29
33
|
borderColor: theme.palette.border.base,
|
|
30
34
|
borderRadius: theme.shape.radius.xs,
|
|
@@ -36,7 +40,6 @@ function useVariantStyleMap(variant, checked) {
|
|
|
36
40
|
} : {})
|
|
37
41
|
}]),
|
|
38
42
|
containerStyle: {
|
|
39
|
-
alignItems: 'center',
|
|
40
43
|
flexDirection: 'row',
|
|
41
44
|
gap: theme.spacing(3),
|
|
42
45
|
paddingVertical: theme.spacing(2)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["styles","StyleSheet","create","checkbox","alignItems","borderWidth","justifyContent","useVariantStyleMap","variant","checked","theme","useTheme","checkboxStyle","css","borderColor","palette","border","base","borderRadius","shape","radius","xs","height","width","backgroundColor","fill","containerStyle","flexDirection","gap","spacing","paddingVertical","iconColor","baseAlt","full","accent","borderBottomColor","weak","borderBottomWidth","commonColors","static","strongInverse"],"sources":["useVariantStyleMap.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\nimport { commonColors, FountainUiStyle } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport type { CheckboxVariant } from './CheckboxProps';\n\nconst styles = StyleSheet.create({\n checkbox: {\n alignItems: 'center',\n borderWidth: 1,\n justifyContent: 'center',\n },\n});\n\ntype useVariantStyleMapReturns = {\n checkboxStyle?: FountainUiStyle;\n containerStyle?: FountainUiStyle;\n iconColor?: string;\n};\n\nexport default function useVariantStyleMap(variant: CheckboxVariant, checked: boolean): useVariantStyleMapReturns {\n const theme = useTheme();\n\n switch (variant) {\n case 'square':\n return {\n checkboxStyle: css([\n styles.checkbox,\n {\n borderColor: theme.palette.border.base,\n borderRadius: theme.shape.radius.xs,\n height: 18,\n width: 18,\n ...(checked ? {\n backgroundColor: theme.palette.fill.base,\n borderColor: theme.palette.fill.base,\n } : {}),\n },\n ]),\n containerStyle: {\n
|
|
1
|
+
{"version":3,"names":["styles","StyleSheet","create","checkbox","alignItems","borderWidth","justifyContent","useVariantStyleMap","variant","checked","theme","useTheme","checkboxContainerStyle","alignSelf","paddingTop","checkboxStyle","css","borderColor","palette","border","base","borderRadius","shape","radius","xs","height","width","backgroundColor","fill","containerStyle","flexDirection","gap","spacing","paddingVertical","iconColor","baseAlt","full","accent","borderBottomColor","weak","borderBottomWidth","commonColors","static","strongInverse"],"sources":["useVariantStyleMap.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\nimport { commonColors, FountainUiStyle } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport type { CheckboxVariant } from './CheckboxProps';\n\nconst styles = StyleSheet.create({\n checkbox: {\n alignItems: 'center',\n borderWidth: 1,\n justifyContent: 'center',\n },\n});\n\ntype useVariantStyleMapReturns = {\n checkboxContainerStyle?: FountainUiStyle;\n checkboxStyle?: FountainUiStyle;\n containerStyle?: FountainUiStyle;\n iconColor?: string;\n};\n\nexport default function useVariantStyleMap(variant: CheckboxVariant, checked: boolean): useVariantStyleMapReturns {\n const theme = useTheme();\n\n switch (variant) {\n case 'square':\n return {\n checkboxContainerStyle: {\n alignSelf: 'flex-start',\n paddingTop: 3,\n },\n checkboxStyle: css([\n styles.checkbox,\n {\n borderColor: theme.palette.border.base,\n borderRadius: theme.shape.radius.xs,\n height: 18,\n width: 18,\n ...(checked ? {\n backgroundColor: theme.palette.fill.base,\n borderColor: theme.palette.fill.base,\n } : {}),\n },\n ]),\n containerStyle: {\n flexDirection: 'row',\n gap: theme.spacing(3),\n paddingVertical: theme.spacing(2),\n },\n iconColor: theme.palette.fill.baseAlt,\n };\n case 'round':\n return {\n checkboxStyle: css([\n styles.checkbox,\n {\n borderColor: theme.palette.border.base,\n borderRadius: theme.shape.radius.full,\n height: 20,\n width: 20,\n ...(checked ? {\n backgroundColor: theme.palette.fill.accent,\n borderColor: theme.palette.fill.accent,\n } : {}),\n },\n ]),\n containerStyle: {\n alignItems: 'center',\n borderBottomColor: theme.palette.border.weak,\n borderBottomWidth: 0.5,\n flexDirection: 'row-reverse',\n gap: theme.spacing(8),\n paddingVertical: theme.spacing(3.5),\n },\n iconColor: commonColors.static.strongInverse,\n };\n default:\n return {};\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAGA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC7BC,QAAQ,EAAE;IACNC,UAAU,EAAE,QADN;IAENC,WAAW,EAAE,CAFP;IAGNC,cAAc,EAAE;EAHV;AADmB,CAAlB,CAAf;;AAee,SAASC,kBAAT,CAA4BC,OAA5B,EAAsDC,OAAtD,EAAmG;EAC9G,MAAMC,KAAK,GAAG,IAAAC,iBAAA,GAAd;;EAEA,QAAQH,OAAR;IACI,KAAK,QAAL;MACI,OAAO;QACHI,sBAAsB,EAAE;UACpBC,SAAS,EAAE,YADS;UAEpBC,UAAU,EAAE;QAFQ,CADrB;QAKHC,aAAa,EAAE,IAAAC,YAAA,EAAI,CACfhB,MAAM,CAACG,QADQ,EAEf;UACIc,WAAW,EAAEP,KAAK,CAACQ,OAAN,CAAcC,MAAd,CAAqBC,IADtC;UAEIC,YAAY,EAAEX,KAAK,CAACY,KAAN,CAAYC,MAAZ,CAAmBC,EAFrC;UAGIC,MAAM,EAAE,EAHZ;UAIIC,KAAK,EAAE,EAJX;UAKI,IAAIjB,OAAO,GAAG;YACVkB,eAAe,EAAEjB,KAAK,CAACQ,OAAN,CAAcU,IAAd,CAAmBR,IAD1B;YAEVH,WAAW,EAAEP,KAAK,CAACQ,OAAN,CAAcU,IAAd,CAAmBR;UA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|
|
46
46
|
const typography = (0, _styles.typographyOf)({
|
|
47
47
|
fontSize: 9.5,
|
|
48
48
|
lineHeight: 11.4,
|
|
49
|
-
fontFamily: '
|
|
49
|
+
fontFamily: 'PretendardStd-SemiBold',
|
|
50
50
|
letterSpacing: -0.19
|
|
51
51
|
});
|
|
52
52
|
const currentFontStyle = (0, _styles2.createFontStyle)(theme, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","theme","useTheme","root","backgroundColor","commonColors","static","weakOpacity","borderRadius","shape","radius","full","paddingHorizontal","spacing","paddingVertical","divider","alignSelf","borderColor","weakOpacityInverse","height","NumberPagination","props","currentPage","maxPage","styles","typography","typographyOf","fontSize","lineHeight","fontFamily","letterSpacing","currentFontStyle","createFontStyle","selector","_","color","strongInverse","countFontStyle","baseOpacityInverse"],"sources":["NumberPagination.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { commonColors, typographyOf } from '@fountain-ui/styles';\nimport Divider from '../Divider';\nimport Row from '../Row';\nimport { createFontStyle, useTheme } from '../styles';\nimport type PaginationProps from './PaginationProps';\n\ntype NumberPaginationStyles = NamedStylesStringUnion<'root' | 'divider'>;\n\nconst useStyles: UseStyles<NumberPaginationStyles> = function (): NumberPaginationStyles {\n const theme = useTheme();\n\n return {\n root: {\n backgroundColor: commonColors.static.weakOpacity,\n borderRadius: theme.shape.radius.full,\n paddingHorizontal: theme.spacing(1.25),\n paddingVertical: theme.spacing(0.5),\n },\n divider: {\n alignSelf: 'center',\n borderColor: commonColors.static.weakOpacityInverse,\n height: 6,\n },\n };\n};\n\ninterface NumberPaginationProps {\n currentPage: PaginationProps['page'];\n maxPage: PaginationProps['count'];\n}\n\nexport default function NumberPagination(props: NumberPaginationProps) {\n const {\n currentPage,\n maxPage,\n } = props;\n\n const styles = useStyles();\n\n const theme = useTheme();\n\n const typography = typographyOf({\n fontSize: 9.5,\n lineHeight: 11.4,\n fontFamily: '
|
|
1
|
+
{"version":3,"names":["useStyles","theme","useTheme","root","backgroundColor","commonColors","static","weakOpacity","borderRadius","shape","radius","full","paddingHorizontal","spacing","paddingVertical","divider","alignSelf","borderColor","weakOpacityInverse","height","NumberPagination","props","currentPage","maxPage","styles","typography","typographyOf","fontSize","lineHeight","fontFamily","letterSpacing","currentFontStyle","createFontStyle","selector","_","color","strongInverse","countFontStyle","baseOpacityInverse"],"sources":["NumberPagination.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { commonColors, typographyOf } from '@fountain-ui/styles';\nimport Divider from '../Divider';\nimport Row from '../Row';\nimport { createFontStyle, useTheme } from '../styles';\nimport type PaginationProps from './PaginationProps';\n\ntype NumberPaginationStyles = NamedStylesStringUnion<'root' | 'divider'>;\n\nconst useStyles: UseStyles<NumberPaginationStyles> = function (): NumberPaginationStyles {\n const theme = useTheme();\n\n return {\n root: {\n backgroundColor: commonColors.static.weakOpacity,\n borderRadius: theme.shape.radius.full,\n paddingHorizontal: theme.spacing(1.25),\n paddingVertical: theme.spacing(0.5),\n },\n divider: {\n alignSelf: 'center',\n borderColor: commonColors.static.weakOpacityInverse,\n height: 6,\n },\n };\n};\n\ninterface NumberPaginationProps {\n currentPage: PaginationProps['page'];\n maxPage: PaginationProps['count'];\n}\n\nexport default function NumberPagination(props: NumberPaginationProps) {\n const {\n currentPage,\n maxPage,\n } = props;\n\n const styles = useStyles();\n\n const theme = useTheme();\n\n const typography = typographyOf({\n fontSize: 9.5,\n lineHeight: 11.4,\n fontFamily: 'PretendardStd-SemiBold',\n letterSpacing: -0.19,\n });\n\n const currentFontStyle = createFontStyle(theme, {\n selector: (_) => typography,\n color: commonColors.static.strongInverse,\n });\n\n const countFontStyle = createFontStyle(theme, {\n selector: (_) => typography,\n color: commonColors.static.baseOpacityInverse,\n });\n\n return (\n <Row style={styles.root}>\n <Text style={currentFontStyle}>\n {currentPage + 1}\n </Text>\n\n <Divider\n style={styles.divider}\n vertical={true}\n />\n\n <Text style={countFontStyle}>\n {maxPage}\n </Text>\n </Row>\n );\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;AAKA,MAAMA,SAA4C,GAAG,YAAoC;EACrF,MAAMC,KAAK,GAAG,IAAAC,iBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,eAAe,EAAEC,oBAAA,CAAaC,MAAb,CAAoBC,WADnC;MAEFC,YAAY,EAAEP,KAAK,CAACQ,KAAN,CAAYC,MAAZ,CAAmBC,IAF/B;MAGFC,iBAAiB,EAAEX,KAAK,CAACY,OAAN,CAAc,IAAd,CAHjB;MAIFC,eAAe,EAAEb,KAAK,CAACY,OAAN,CAAc,GAAd;IAJf,CADH;IAOHE,OAAO,EAAE;MACLC,SAAS,EAAE,QADN;MAELC,WAAW,EAAEZ,oBAAA,CAAaC,MAAb,CAAoBY,kBAF5B;MAGLC,MAAM,EAAE;IAHH;EAPN,CAAP;AAaH,CAhBD;;AAuBe,SAASC,gBAAT,CAA0BC,KAA1B,EAAwD;EACnE,MAAM;IACFC,WADE;IAEFC;EAFE,IAGFF,KAHJ;EAKA,MAAMG,MAAM,GAAGxB,SAAS,EAAxB;EAEA,MAAMC,KAAK,GAAG,IAAAC,iBAAA,GAAd;EAEA,MAAMuB,UAAU,GAAG,IAAAC,oBAAA,EAAa;IAC5BC,QAAQ,EAAE,GADkB;IAE5BC,UAAU,EAAE,IAFgB;IAG5BC,UAAU,EAAE,wBAHgB;IAI5BC,aAAa,EAAE,CAAC;EAJY,CAAb,CAAnB;EAOA,MAAMC,gBAAgB,GAAG,IAAAC,wBAAA,EAAgB/B,KAAhB,EAAuB;IAC5CgC,QAAQ,EAAGC,CAAD,IAAOT,UAD2B;IAE5CU,KAAK,EAAE9B,oBAAA,CAAaC,MAAb,CAAoB8B;EAFiB,CAAvB,CAAzB;EAKA,MAAMC,cAAc,GAAG,IAAAL,wBAAA,EAAgB/B,KAAhB,EAAuB;IAC1CgC,QAAQ,EAAGC,CAAD,IAAOT,UADyB;IAE1CU,KAAK,EAAE9B,oBAAA,CAAaC,MAAb,CAAoBgC;EAFe,CAAvB,CAAvB;EAKA,oBACI,6BAAC,YAAD;IAAK,KAAK,EAAEd,MAAM,CAACrB;EAAnB,gBACI,6BAAC,iBAAD;IAAM,KAAK,EAAE4B;EAAb,GACKT,WAAW,GAAG,CADnB,CADJ,eAKI,6BAAC,gBAAD;IACI,KAAK,EAAEE,MAAM,CAACT,OADlB;IAEI,QAAQ,EAAE;EAFd,EALJ,eAUI,6BAAC,iBAAD;IAAM,KAAK,EAAEsB;EAAb,GACKd,OADL,CAVJ,CADJ;AAgBH"}
|
|
@@ -9,16 +9,14 @@ var _styles = require("@fountain-ui/styles");
|
|
|
9
9
|
|
|
10
10
|
var _styles2 = require("../styles");
|
|
11
11
|
|
|
12
|
-
function getMaxWidth(theme, breakpoint) {
|
|
12
|
+
function getMaxWidth(theme, breakpoint, customMaxWidth) {
|
|
13
13
|
switch (breakpoint) {
|
|
14
14
|
case 'lg':
|
|
15
|
-
return theme.breakpoints.values['lg'];
|
|
16
|
-
|
|
17
15
|
case 'md':
|
|
18
|
-
return theme.breakpoints.values[
|
|
16
|
+
return customMaxWidth ?? theme.breakpoints.values[breakpoint];
|
|
19
17
|
|
|
20
18
|
default:
|
|
21
|
-
return
|
|
19
|
+
return undefined;
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
|
|
@@ -34,16 +32,19 @@ function getPaddingHorizontal(theme, breakpoint) {
|
|
|
34
32
|
|
|
35
33
|
function useContentContainerStyle(config) {
|
|
36
34
|
const {
|
|
37
|
-
maxWidth,
|
|
35
|
+
maxWidth: customMaxWidth,
|
|
38
36
|
styleProvider
|
|
39
37
|
} = config;
|
|
40
38
|
const theme = (0, _styles2.useTheme)();
|
|
41
39
|
const currentBreakpoint = (0, _styles.useBreakpointByWidth)();
|
|
42
40
|
const additionalStyle = styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider(theme);
|
|
41
|
+
const maxWidth = getMaxWidth(theme, currentBreakpoint, customMaxWidth);
|
|
42
|
+
const paddingHorizontal = getPaddingHorizontal(theme, currentBreakpoint);
|
|
43
|
+
const resolvedMaxWidth = typeof maxWidth === 'number' ? maxWidth + paddingHorizontal * 2 : undefined;
|
|
43
44
|
return (0, _styles2.css)([{
|
|
44
45
|
alignSelf: 'center',
|
|
45
|
-
maxWidth:
|
|
46
|
-
paddingHorizontal
|
|
46
|
+
maxWidth: resolvedMaxWidth,
|
|
47
|
+
paddingHorizontal,
|
|
47
48
|
width: '100%'
|
|
48
49
|
}, additionalStyle]);
|
|
49
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getMaxWidth","theme","breakpoint","breakpoints","values","getPaddingHorizontal","spacing","useContentContainerStyle","config","maxWidth","styleProvider","useTheme","currentBreakpoint","useBreakpointByWidth","additionalStyle","
|
|
1
|
+
{"version":3,"names":["getMaxWidth","theme","breakpoint","customMaxWidth","breakpoints","values","undefined","getPaddingHorizontal","spacing","useContentContainerStyle","config","maxWidth","styleProvider","useTheme","currentBreakpoint","useBreakpointByWidth","additionalStyle","paddingHorizontal","resolvedMaxWidth","css","alignSelf","width"],"sources":["useContentContainerStyle.ts"],"sourcesContent":["import type { FountainUiStyle } from '@fountain-ui/styles';\nimport { useBreakpointByWidth } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport type { Theme } from '../types';\n\ntype Breakpoint = keyof Theme['breakpoints']['values'];\n\nexport interface Config {\n maxWidth?: number;\n styleProvider?: (theme: Theme) => FountainUiStyle;\n}\n\nfunction getMaxWidth(theme: Theme, breakpoint: Breakpoint, customMaxWidth?: number): number | undefined {\n switch (breakpoint) {\n case 'lg':\n case 'md':\n return customMaxWidth ?? theme.breakpoints.values[breakpoint];\n default:\n return undefined;\n }\n}\n\nfunction getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint): number {\n switch (breakpoint) {\n case 'sm':\n return theme.spacing(6);\n default:\n return theme.spacing(4);\n }\n}\n\nexport default function useContentContainerStyle(config: Config): FountainUiStyle {\n const {\n maxWidth: customMaxWidth,\n styleProvider,\n } = config;\n\n const theme = useTheme();\n\n const currentBreakpoint = useBreakpointByWidth();\n\n const additionalStyle = styleProvider?.(theme);\n\n const maxWidth = getMaxWidth(theme, currentBreakpoint, customMaxWidth);\n const paddingHorizontal = getPaddingHorizontal(theme, currentBreakpoint);\n\n const resolvedMaxWidth = typeof maxWidth === 'number' ? maxWidth + paddingHorizontal * 2 : undefined;\n\n return css([\n {\n alignSelf: 'center',\n maxWidth: resolvedMaxWidth,\n paddingHorizontal,\n width: '100%',\n },\n additionalStyle,\n ]);\n};\n"],"mappings":";;;;;;;AACA;;AACA;;AAUA,SAASA,WAAT,CAAqBC,KAArB,EAAmCC,UAAnC,EAA2DC,cAA3D,EAAwG;EACpG,QAAQD,UAAR;IACI,KAAK,IAAL;IACA,KAAK,IAAL;MACI,OAAOC,cAAc,IAAIF,KAAK,CAACG,WAAN,CAAkBC,MAAlB,CAAyBH,UAAzB,CAAzB;;IACJ;MACI,OAAOI,SAAP;EALR;AAOH;;AAED,SAASC,oBAAT,CAA8BN,KAA9B,EAA4CC,UAA5C,EAA4E;EACxE,QAAQA,UAAR;IACI,KAAK,IAAL;MACI,OAAOD,KAAK,CAACO,OAAN,CAAc,CAAd,CAAP;;IACJ;MACI,OAAOP,KAAK,CAACO,OAAN,CAAc,CAAd,CAAP;EAJR;AAMH;;AAEc,SAASC,wBAAT,CAAkCC,MAAlC,EAAmE;EAC9E,MAAM;IACFC,QAAQ,EAAER,cADR;IAEFS;EAFE,IAGFF,MAHJ;EAKA,MAAMT,KAAK,GAAG,IAAAY,iBAAA,GAAd;EAEA,MAAMC,iBAAiB,GAAG,IAAAC,4BAAA,GAA1B;EAEA,MAAMC,eAAe,GAAGJ,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAGX,KAAH,CAArC;EAEA,MAAMU,QAAQ,GAAGX,WAAW,CAACC,KAAD,EAAQa,iBAAR,EAA2BX,cAA3B,CAA5B;EACA,MAAMc,iBAAiB,GAAGV,oBAAoB,CAACN,KAAD,EAAQa,iBAAR,CAA9C;EAEA,MAAMI,gBAAgB,GAAG,OAAOP,QAAP,KAAoB,QAApB,GAA+BA,QAAQ,GAAGM,iBAAiB,GAAG,CAA9D,GAAkEX,SAA3F;EAEA,OAAO,IAAAa,YAAA,EAAI,CACP;IACIC,SAAS,EAAE,QADf;IAEIT,QAAQ,EAAEO,gBAFd;IAGID,iBAHJ;IAIII,KAAK,EAAE;EAJX,CADO,EAOPL,eAPO,CAAJ,CAAP;AASH;;AAAA"}
|
|
@@ -79,6 +79,7 @@ export default function Button(props) {
|
|
|
79
79
|
color: colorProp = 'primary',
|
|
80
80
|
disabled: disabledProp = false,
|
|
81
81
|
disableMinWidth = false,
|
|
82
|
+
disablePadding = false,
|
|
82
83
|
endIcon: endIconProp,
|
|
83
84
|
fullWidth = false,
|
|
84
85
|
href,
|
|
@@ -108,6 +109,9 @@ export default function Button(props) {
|
|
|
108
109
|
const endIcon = cloneElementSafely(endIconProp, iconProps);
|
|
109
110
|
const buttonBaseStyle = css([styles.root, containerStyle, styles[size], fullWidth ? styles.fullWidth : undefined, disableMinWidth ? {
|
|
110
111
|
minWidth: 0
|
|
112
|
+
} : undefined, disablePadding ? {
|
|
113
|
+
paddingHorizontal: 0,
|
|
114
|
+
paddingVertical: 0
|
|
111
115
|
} : undefined, styleProp]);
|
|
112
116
|
const fontStyle = createFontStyle(theme, {
|
|
113
117
|
selector: _ => fontStyleMap[size],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Linking","Text","typographyOf","ButtonBase","LoadingSpinner","createFontStyle","css","useTheme","cloneElementSafely","useVariantStyleMap","useStyles","theme","root","alignItems","borderRadius","shape","radius","sm","flexDirection","justifyContent","fullWidth","width","large","gap","spacing","minWidth","paddingHorizontal","paddingVertical","medium","small","loadingSpinner","position","fontStyleMap","fontSize","lineHeight","fontFamily","letterSpacing","getLoadingSpinnerColor","variant","color","Button","props","children","colorProp","disabled","disabledProp","disableMinWidth","endIcon","endIconProp","href","isLoading","onPress","pressEffect","size","startIcon","startIconProp","style","styleProp","otherProps","styles","container","containerStyle","iconColor","labelColor","iconProps","fill","opacity","buttonBaseStyle","undefined","fontStyle","selector","_","textStyle","textAlign","modifiedPressEffect","handlePress","canOpenURL","openURL","loadingSpinnerColor"],"sources":["Button.tsx"],"sourcesContent":["import React from 'react';\nimport { Linking, Text } from 'react-native';\nimport type { FontStyle, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { typographyOf } from '@fountain-ui/styles';\nimport ButtonBase from '../ButtonBase/ButtonBase';\nimport { LoadingSpinner } from '../internal/icons';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport type ButtonProps from './ButtonProps';\nimport type { ButtonColor, ButtonSize, ButtonVariant } from './ButtonProps';\nimport useVariantStyleMap from './useVariantStyleMap';\n\ntype ButtonStyles = NamedStylesStringUnion<'root' | 'fullWidth' | 'large' | 'medium' | 'small' | 'loadingSpinner'>;\n\nconst useStyles: UseStyles<ButtonStyles> = function (): ButtonStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n borderRadius: theme.shape.radius.sm,\n flexDirection: 'row',\n justifyContent: 'center',\n },\n fullWidth: {\n width: '100%',\n },\n large: {\n gap: theme.spacing(2),\n minWidth: 104,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(3.5),\n },\n medium: {\n gap: theme.spacing(1.5),\n minWidth: 88,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(2.75),\n },\n small: {\n minWidth: 64,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(2),\n },\n loadingSpinner: {\n position: 'absolute',\n },\n };\n};\n\nconst fontStyleMap: Record<ButtonSize, FontStyle> = {\n large: typographyOf({\n fontSize: 16,\n lineHeight: 20,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.32,\n }),\n medium: typographyOf({\n fontSize: 15,\n lineHeight: 19.5,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.3,\n }),\n small: typographyOf({\n fontSize: 13,\n lineHeight: 16.9,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.26,\n }),\n};\n\nfunction getLoadingSpinnerColor(variant: ButtonVariant, color: ButtonColor) {\n if (variant === 'solid' || (variant === 'capsuleSolid' && color !== 'secondary')) {\n return 'white';\n }\n return 'gray';\n}\n\nexport default function Button(props: ButtonProps) {\n const {\n children,\n color: colorProp = 'primary' as ButtonColor,\n disabled: disabledProp = false,\n disableMinWidth = false,\n endIcon: endIconProp,\n fullWidth = false,\n href,\n isLoading = false,\n onPress,\n pressEffect,\n size = 'medium' as ButtonSize,\n startIcon: startIconProp,\n style: styleProp,\n variant = 'solid' as ButtonVariant,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const disabled = disabledProp || isLoading;\n\n const color = disabledProp ? 'disabled' : colorProp;\n const {\n container: containerStyle,\n iconColor,\n labelColor,\n } = useVariantStyleMap(variant, color);\n\n const iconProps = {\n fill: iconColor,\n opacity: isLoading ? 0 : 1,\n };\n\n const startIcon = cloneElementSafely(startIconProp, iconProps);\n const endIcon = cloneElementSafely(endIconProp, iconProps);\n\n const buttonBaseStyle = css([\n styles.root,\n containerStyle,\n styles[size],\n fullWidth ? styles.fullWidth : undefined,\n disableMinWidth ? { minWidth: 0 } : undefined,\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (_) => fontStyleMap[size],\n color: labelColor,\n });\n\n const textStyle = css([\n fontStyle,\n {\n opacity: isLoading ? 0 : 1,\n textAlign: 'center',\n },\n ]);\n\n const modifiedPressEffect = variant !== 'text' && !pressEffect\n ? 'scale'\n : pressEffect;\n\n const handlePress = async () => {\n if (disabled) {\n return;\n }\n if (onPress) {\n onPress();\n return;\n }\n if (href) {\n if (await Linking.canOpenURL(href)) {\n await Linking.openURL(href);\n }\n }\n };\n\n const loadingSpinnerColor = getLoadingSpinnerColor(variant, color);\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={buttonBaseStyle}\n pressEffect={modifiedPressEffect}\n {...otherProps}\n >\n {startIcon}\n\n <Text style={textStyle}>\n {children}\n </Text>\n\n {endIcon}\n\n {isLoading ? (\n <LoadingSpinner\n color={loadingSpinnerColor}\n size={size}\n style={styles.loadingSpinner}\n />\n ) : null}\n </ButtonBase>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,OAAT,EAAkBC,IAAlB,QAA8B,cAA9B;AAEA,SAASC,YAAT,QAA6B,qBAA7B;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AACA,SAASC,kBAAT,QAAmC,UAAnC;AAGA,OAAOC,kBAAP,MAA+B,sBAA/B;;AAIA,MAAMC,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAGJ,QAAQ,EAAtB;EAEA,OAAO;IACHK,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,YAAY,EAAEH,KAAK,CAACI,KAAN,CAAYC,MAAZ,CAAmBC,EAF/B;MAGFC,aAAa,EAAE,KAHb;MAIFC,cAAc,EAAE;IAJd,CADH;IAOHC,SAAS,EAAE;MACPC,KAAK,EAAE;IADA,CAPR;IAUHC,KAAK,EAAE;MACHC,GAAG,EAAEZ,KAAK,CAACa,OAAN,CAAc,CAAd,CADF;MAEHC,QAAQ,EAAE,GAFP;MAGHC,iBAAiB,EAAEf,KAAK,CAACa,OAAN,CAAc,CAAd,CAHhB;MAIHG,eAAe,EAAEhB,KAAK,CAACa,OAA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","typographyOf","ButtonBase","LoadingSpinner","createFontStyle","css","useTheme","cloneElementSafely","useVariantStyleMap","useStyles","theme","root","alignItems","borderRadius","shape","radius","sm","flexDirection","justifyContent","fullWidth","width","large","gap","spacing","minWidth","paddingHorizontal","paddingVertical","medium","small","loadingSpinner","position","fontStyleMap","fontSize","lineHeight","fontFamily","letterSpacing","getLoadingSpinnerColor","variant","color","Button","props","children","colorProp","disabled","disabledProp","disableMinWidth","disablePadding","endIcon","endIconProp","href","isLoading","onPress","pressEffect","size","startIcon","startIconProp","style","styleProp","otherProps","styles","container","containerStyle","iconColor","labelColor","iconProps","fill","opacity","buttonBaseStyle","undefined","fontStyle","selector","_","textStyle","textAlign","modifiedPressEffect","handlePress","canOpenURL","openURL","loadingSpinnerColor"],"sources":["Button.tsx"],"sourcesContent":["import React from 'react';\nimport { Linking, Text } from 'react-native';\nimport type { FontStyle, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { typographyOf } from '@fountain-ui/styles';\nimport ButtonBase from '../ButtonBase/ButtonBase';\nimport { LoadingSpinner } from '../internal/icons';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport type ButtonProps from './ButtonProps';\nimport type { ButtonColor, ButtonSize, ButtonVariant } from './ButtonProps';\nimport useVariantStyleMap from './useVariantStyleMap';\n\ntype ButtonStyles = NamedStylesStringUnion<'root' | 'fullWidth' | 'large' | 'medium' | 'small' | 'loadingSpinner'>;\n\nconst useStyles: UseStyles<ButtonStyles> = function (): ButtonStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n borderRadius: theme.shape.radius.sm,\n flexDirection: 'row',\n justifyContent: 'center',\n },\n fullWidth: {\n width: '100%',\n },\n large: {\n gap: theme.spacing(2),\n minWidth: 104,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(3.5),\n },\n medium: {\n gap: theme.spacing(1.5),\n minWidth: 88,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(2.75),\n },\n small: {\n minWidth: 64,\n paddingHorizontal: theme.spacing(6),\n paddingVertical: theme.spacing(2),\n },\n loadingSpinner: {\n position: 'absolute',\n },\n };\n};\n\nconst fontStyleMap: Record<ButtonSize, FontStyle> = {\n large: typographyOf({\n fontSize: 16,\n lineHeight: 20,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.32,\n }),\n medium: typographyOf({\n fontSize: 15,\n lineHeight: 19.5,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.3,\n }),\n small: typographyOf({\n fontSize: 13,\n lineHeight: 16.9,\n fontFamily: 'LexendDeca-SemiBold',\n letterSpacing: -0.26,\n }),\n};\n\nfunction getLoadingSpinnerColor(variant: ButtonVariant, color: ButtonColor) {\n if (variant === 'solid' || (variant === 'capsuleSolid' && color !== 'secondary')) {\n return 'white';\n }\n return 'gray';\n}\n\nexport default function Button(props: ButtonProps) {\n const {\n children,\n color: colorProp = 'primary' as ButtonColor,\n disabled: disabledProp = false,\n disableMinWidth = false,\n disablePadding = false,\n endIcon: endIconProp,\n fullWidth = false,\n href,\n isLoading = false,\n onPress,\n pressEffect,\n size = 'medium' as ButtonSize,\n startIcon: startIconProp,\n style: styleProp,\n variant = 'solid' as ButtonVariant,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const disabled = disabledProp || isLoading;\n\n const color = disabledProp ? 'disabled' : colorProp;\n const {\n container: containerStyle,\n iconColor,\n labelColor,\n } = useVariantStyleMap(variant, color);\n\n const iconProps = {\n fill: iconColor,\n opacity: isLoading ? 0 : 1,\n };\n\n const startIcon = cloneElementSafely(startIconProp, iconProps);\n const endIcon = cloneElementSafely(endIconProp, iconProps);\n\n const buttonBaseStyle = css([\n styles.root,\n containerStyle,\n styles[size],\n fullWidth ? styles.fullWidth : undefined,\n disableMinWidth ? { minWidth: 0 } : undefined,\n disablePadding ? { paddingHorizontal: 0, paddingVertical: 0 } : undefined,\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (_) => fontStyleMap[size],\n color: labelColor,\n });\n\n const textStyle = css([\n fontStyle,\n {\n opacity: isLoading ? 0 : 1,\n textAlign: 'center',\n },\n ]);\n\n const modifiedPressEffect = variant !== 'text' && !pressEffect\n ? 'scale'\n : pressEffect;\n\n const handlePress = async () => {\n if (disabled) {\n return;\n }\n if (onPress) {\n onPress();\n return;\n }\n if (href) {\n if (await Linking.canOpenURL(href)) {\n await Linking.openURL(href);\n }\n }\n };\n\n const loadingSpinnerColor = getLoadingSpinnerColor(variant, color);\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={buttonBaseStyle}\n pressEffect={modifiedPressEffect}\n {...otherProps}\n >\n {startIcon}\n\n <Text style={textStyle}>\n {children}\n </Text>\n\n {endIcon}\n\n {isLoading ? (\n <LoadingSpinner\n color={loadingSpinnerColor}\n size={size}\n style={styles.loadingSpinner}\n />\n ) : null}\n </ButtonBase>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,OAAT,EAAkBC,IAAlB,QAA8B,cAA9B;AAEA,SAASC,YAAT,QAA6B,qBAA7B;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AACA,SAASC,kBAAT,QAAmC,UAAnC;AAGA,OAAOC,kBAAP,MAA+B,sBAA/B;;AAIA,MAAMC,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAGJ,QAAQ,EAAtB;EAEA,OAAO;IACHK,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,YAAY,EAAEH,KAAK,CAACI,KAAN,CAAYC,MAAZ,CAAmBC,EAF/B;MAGFC,aAAa,EAAE,KAHb;MAIFC,cAAc,EAAE;IAJd,CADH;IAOHC,SAAS,EAAE;MACPC,KAAK,EAAE;IADA,CA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AHX;IAII,WAAW,EAAEO;EAJjB,GAKQhB,UALR,GAOKJ,SAPL,eASI,oBAAC,IAAD;IAAM,KAAK,EAAEkB;EAAb,GACK/B,QADL,CATJ,EAaKM,OAbL,EAeKG,SAAS,gBACN,oBAAC,cAAD;IACI,KAAK,EAAE4B,mBADX;IAEI,IAAI,EAAEzB,IAFV;IAGI,KAAK,EAAEM,MAAM,CAAC9B;EAHlB,EADM,GAMN,IArBR,CADJ;AAyBH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["buttonColors","buttonSizes","buttonVariants"],"sources":["ButtonProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ButtonBaseProps } from '../ButtonBase';\nimport type { OverridableComponentProps } from '../types';\n\nexport const buttonColors = [\n 'accent',\n 'primary',\n 'danger',\n 'disabled',\n 'secondary',\n 'accentAlt',\n] as const;\nexport type ButtonColor = typeof buttonColors[number];\n\nexport const buttonSizes = [\n 'small',\n 'medium',\n 'large',\n] as const;\nexport type ButtonSize = typeof buttonSizes[number];\n\nexport const buttonVariants = [\n 'solid',\n 'outlined',\n 'text',\n 'capsuleSolid',\n 'capsuleOutlined',\n] as const;\nexport type ButtonVariant = typeof buttonVariants[number];\n\nexport default interface ButtonProps extends OverridableComponentProps<ButtonBaseProps, {\n /**\n * The content of the button.\n */\n children: string;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'primary'\n */\n color?: ButtonColor;\n\n /**\n * Determines whether minWidth should be applied.\n * @default false\n */\n disableMinWidth?: boolean;\n\n /**\n * Element placed after the children.\n */\n endIcon?: React.ReactElement;\n\n /**\n * If `true`, the button will take up the full width of its container.\n * @default false\n */\n fullWidth?: boolean;\n\n /**\n * The URL to link to when the button is clicked.\n */\n href?: string;\n\n /**\n * Determines whether to show the loading status or not.\n * @default false\n */\n isLoading?: boolean;\n\n /**\n * The size of the button.\n * @default 'medium'\n */\n size?: ButtonSize;\n\n /**\n * Element placed before the children.\n */\n startIcon?: React.ReactElement;\n\n /**\n * The variant to use.\n * @default 'solid'\n */\n variant?: ButtonVariant;\n}> {}\n"],"mappings":"AAIA,OAAO,MAAMA,YAAY,GAAG,CACxB,QADwB,EAExB,SAFwB,EAGxB,QAHwB,EAIxB,UAJwB,EAKxB,WALwB,EAMxB,WANwB,CAArB;AAUP,OAAO,MAAMC,WAAW,GAAG,CACvB,OADuB,EAEvB,QAFuB,EAGvB,OAHuB,CAApB;AAOP,OAAO,MAAMC,cAAc,GAAG,CAC1B,OAD0B,EAE1B,UAF0B,EAG1B,MAH0B,EAI1B,cAJ0B,EAK1B,iBAL0B,CAAvB"}
|
|
1
|
+
{"version":3,"names":["buttonColors","buttonSizes","buttonVariants"],"sources":["ButtonProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ButtonBaseProps } from '../ButtonBase';\nimport type { OverridableComponentProps } from '../types';\n\nexport const buttonColors = [\n 'accent',\n 'primary',\n 'danger',\n 'disabled',\n 'secondary',\n 'accentAlt',\n] as const;\nexport type ButtonColor = typeof buttonColors[number];\n\nexport const buttonSizes = [\n 'small',\n 'medium',\n 'large',\n] as const;\nexport type ButtonSize = typeof buttonSizes[number];\n\nexport const buttonVariants = [\n 'solid',\n 'outlined',\n 'text',\n 'capsuleSolid',\n 'capsuleOutlined',\n] as const;\nexport type ButtonVariant = typeof buttonVariants[number];\n\nexport default interface ButtonProps extends OverridableComponentProps<ButtonBaseProps, {\n /**\n * The content of the button.\n */\n children: string;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'primary'\n */\n color?: ButtonColor;\n\n /**\n * Determines whether minWidth should be applied.\n * @default false\n */\n disableMinWidth?: boolean;\n\n /**\n * Determines whether padding should be applied.\n * @default false\n */\n disablePadding?: boolean;\n\n /**\n * Element placed after the children.\n */\n endIcon?: React.ReactElement;\n\n /**\n * If `true`, the button will take up the full width of its container.\n * @default false\n */\n fullWidth?: boolean;\n\n /**\n * The URL to link to when the button is clicked.\n */\n href?: string;\n\n /**\n * Determines whether to show the loading status or not.\n * @default false\n */\n isLoading?: boolean;\n\n /**\n * The size of the button.\n * @default 'medium'\n */\n size?: ButtonSize;\n\n /**\n * Element placed before the children.\n */\n startIcon?: React.ReactElement;\n\n /**\n * The variant to use.\n * @default 'solid'\n */\n variant?: ButtonVariant;\n}> {}\n"],"mappings":"AAIA,OAAO,MAAMA,YAAY,GAAG,CACxB,QADwB,EAExB,SAFwB,EAGxB,QAHwB,EAIxB,UAJwB,EAKxB,WALwB,EAMxB,WANwB,CAArB;AAUP,OAAO,MAAMC,WAAW,GAAG,CACvB,OADuB,EAEvB,QAFuB,EAGvB,OAHuB,CAApB;AAOP,OAAO,MAAMC,cAAc,GAAG,CAC1B,OAD0B,EAE1B,UAF0B,EAG1B,MAH0B,EAI1B,cAJ0B,EAK1B,iBAL0B,CAAvB"}
|
|
@@ -19,6 +19,7 @@ export default function Checkbox(props) {
|
|
|
19
19
|
} = props;
|
|
20
20
|
const theme = useTheme();
|
|
21
21
|
const {
|
|
22
|
+
checkboxContainerStyle,
|
|
22
23
|
checkboxStyle,
|
|
23
24
|
containerStyle,
|
|
24
25
|
iconColor
|
|
@@ -40,12 +41,14 @@ export default function Checkbox(props) {
|
|
|
40
41
|
onPress: handlePress,
|
|
41
42
|
style: rootStyle
|
|
42
43
|
}, otherProps), /*#__PURE__*/React.createElement(View, {
|
|
44
|
+
style: checkboxContainerStyle
|
|
45
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
43
46
|
style: checkboxStyle
|
|
44
47
|
}, checked ? /*#__PURE__*/React.createElement(CheckboxOnIcon, {
|
|
45
48
|
fill: iconColor,
|
|
46
49
|
height: 7.5,
|
|
47
50
|
width: 11
|
|
48
|
-
}) : null), children ? /*#__PURE__*/React.createElement(Row, {
|
|
51
|
+
}) : null)), children ? /*#__PURE__*/React.createElement(Row, {
|
|
49
52
|
flexGrow: 1,
|
|
50
53
|
flexShrink: 1
|
|
51
54
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","View","ButtonBase","CheckboxOn","CheckboxOnIcon","Row","createFontStyle","css","useTheme","useVariantStyleMap","Checkbox","props","checked","children","disabled","onChange","style","styleProp","variant","otherProps","theme","checkboxStyle","containerStyle","iconColor","rootStyle","undefined","fontStyle","selector","typography","body2","regular","color","palette","text","strong","handlePress"],"sources":["Checkbox.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport ButtonBase from '../ButtonBase';\nimport { CheckboxOn as CheckboxOnIcon } from '../internal/icons';\nimport Row from '../Row';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport type CheckboxProps from './CheckboxProps';\nimport type { CheckboxVariant } from './CheckboxProps';\nimport useVariantStyleMap from './useVariantStyleMap';\n\nexport default function Checkbox(props: CheckboxProps) {\n const {\n checked = false,\n children,\n disabled = false,\n onChange,\n style: styleProp,\n variant = 'square' as CheckboxVariant,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const {\n checkboxStyle,\n containerStyle,\n iconColor,\n } = useVariantStyleMap(variant, checked);\n\n const rootStyle = css([\n children ? containerStyle : undefined,\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography.body2.regular,\n color: theme.palette.text.strong,\n });\n\n const handlePress = () => {\n if (onChange) {\n onChange(!checked);\n }\n };\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={rootStyle}\n {...otherProps}\n >\n <View style={
|
|
1
|
+
{"version":3,"names":["React","Text","View","ButtonBase","CheckboxOn","CheckboxOnIcon","Row","createFontStyle","css","useTheme","useVariantStyleMap","Checkbox","props","checked","children","disabled","onChange","style","styleProp","variant","otherProps","theme","checkboxContainerStyle","checkboxStyle","containerStyle","iconColor","rootStyle","undefined","fontStyle","selector","typography","body2","regular","color","palette","text","strong","handlePress"],"sources":["Checkbox.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, View } from 'react-native';\nimport ButtonBase from '../ButtonBase';\nimport { CheckboxOn as CheckboxOnIcon } from '../internal/icons';\nimport Row from '../Row';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport type CheckboxProps from './CheckboxProps';\nimport type { CheckboxVariant } from './CheckboxProps';\nimport useVariantStyleMap from './useVariantStyleMap';\n\nexport default function Checkbox(props: CheckboxProps) {\n const {\n checked = false,\n children,\n disabled = false,\n onChange,\n style: styleProp,\n variant = 'square' as CheckboxVariant,\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const {\n checkboxContainerStyle,\n checkboxStyle,\n containerStyle,\n iconColor,\n } = useVariantStyleMap(variant, checked);\n\n const rootStyle = css([\n children ? containerStyle : undefined,\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography.body2.regular,\n color: theme.palette.text.strong,\n });\n\n const handlePress = () => {\n if (onChange) {\n onChange(!checked);\n }\n };\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={rootStyle}\n {...otherProps}\n >\n <View style={checkboxContainerStyle}>\n <View style={checkboxStyle}>\n {checked ? (\n <CheckboxOnIcon\n fill={iconColor}\n height={7.5}\n width={11}\n />\n ) : null}\n </View>\n </View>\n\n {children ? (\n <Row\n flexGrow={1}\n flexShrink={1}\n >\n <Text\n children={children}\n style={fontStyle}\n />\n </Row>\n ) : null}\n </ButtonBase>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,cAA3B;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,SAASC,UAAU,IAAIC,cAAvB,QAA6C,mBAA7C;AACA,OAAOC,GAAP,MAAgB,QAAhB;AACA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AAGA,OAAOC,kBAAP,MAA+B,sBAA/B;AAEA,eAAe,SAASC,QAAT,CAAkBC,KAAlB,EAAwC;EACnD,MAAM;IACFC,OAAO,GAAG,KADR;IAEFC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CH;AAAA"}
|
|
@@ -14,6 +14,10 @@ export default function useVariantStyleMap(variant, checked) {
|
|
|
14
14
|
switch (variant) {
|
|
15
15
|
case 'square':
|
|
16
16
|
return {
|
|
17
|
+
checkboxContainerStyle: {
|
|
18
|
+
alignSelf: 'flex-start',
|
|
19
|
+
paddingTop: 3
|
|
20
|
+
},
|
|
17
21
|
checkboxStyle: css([styles.checkbox, {
|
|
18
22
|
borderColor: theme.palette.border.base,
|
|
19
23
|
borderRadius: theme.shape.radius.xs,
|
|
@@ -25,7 +29,6 @@ export default function useVariantStyleMap(variant, checked) {
|
|
|
25
29
|
} : {})
|
|
26
30
|
}]),
|
|
27
31
|
containerStyle: {
|
|
28
|
-
alignItems: 'center',
|
|
29
32
|
flexDirection: 'row',
|
|
30
33
|
gap: theme.spacing(3),
|
|
31
34
|
paddingVertical: theme.spacing(2)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","commonColors","css","useTheme","styles","create","checkbox","alignItems","borderWidth","justifyContent","useVariantStyleMap","variant","checked","theme","checkboxStyle","borderColor","palette","border","base","borderRadius","shape","radius","xs","height","width","backgroundColor","fill","containerStyle","flexDirection","gap","spacing","paddingVertical","iconColor","baseAlt","full","accent","borderBottomColor","weak","borderBottomWidth","static","strongInverse"],"sources":["useVariantStyleMap.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\nimport { commonColors, FountainUiStyle } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport type { CheckboxVariant } from './CheckboxProps';\n\nconst styles = StyleSheet.create({\n checkbox: {\n alignItems: 'center',\n borderWidth: 1,\n justifyContent: 'center',\n },\n});\n\ntype useVariantStyleMapReturns = {\n checkboxStyle?: FountainUiStyle;\n containerStyle?: FountainUiStyle;\n iconColor?: string;\n};\n\nexport default function useVariantStyleMap(variant: CheckboxVariant, checked: boolean): useVariantStyleMapReturns {\n const theme = useTheme();\n\n switch (variant) {\n case 'square':\n return {\n checkboxStyle: css([\n styles.checkbox,\n {\n borderColor: theme.palette.border.base,\n borderRadius: theme.shape.radius.xs,\n height: 18,\n width: 18,\n ...(checked ? {\n backgroundColor: theme.palette.fill.base,\n borderColor: theme.palette.fill.base,\n } : {}),\n },\n ]),\n containerStyle: {\n
|
|
1
|
+
{"version":3,"names":["StyleSheet","commonColors","css","useTheme","styles","create","checkbox","alignItems","borderWidth","justifyContent","useVariantStyleMap","variant","checked","theme","checkboxContainerStyle","alignSelf","paddingTop","checkboxStyle","borderColor","palette","border","base","borderRadius","shape","radius","xs","height","width","backgroundColor","fill","containerStyle","flexDirection","gap","spacing","paddingVertical","iconColor","baseAlt","full","accent","borderBottomColor","weak","borderBottomWidth","static","strongInverse"],"sources":["useVariantStyleMap.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\nimport { commonColors, FountainUiStyle } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport type { CheckboxVariant } from './CheckboxProps';\n\nconst styles = StyleSheet.create({\n checkbox: {\n alignItems: 'center',\n borderWidth: 1,\n justifyContent: 'center',\n },\n});\n\ntype useVariantStyleMapReturns = {\n checkboxContainerStyle?: FountainUiStyle;\n checkboxStyle?: FountainUiStyle;\n containerStyle?: FountainUiStyle;\n iconColor?: string;\n};\n\nexport default function useVariantStyleMap(variant: CheckboxVariant, checked: boolean): useVariantStyleMapReturns {\n const theme = useTheme();\n\n switch (variant) {\n case 'square':\n return {\n checkboxContainerStyle: {\n alignSelf: 'flex-start',\n paddingTop: 3,\n },\n checkboxStyle: css([\n styles.checkbox,\n {\n borderColor: theme.palette.border.base,\n borderRadius: theme.shape.radius.xs,\n height: 18,\n width: 18,\n ...(checked ? {\n backgroundColor: theme.palette.fill.base,\n borderColor: theme.palette.fill.base,\n } : {}),\n },\n ]),\n containerStyle: {\n flexDirection: 'row',\n gap: theme.spacing(3),\n paddingVertical: theme.spacing(2),\n },\n iconColor: theme.palette.fill.baseAlt,\n };\n case 'round':\n return {\n checkboxStyle: css([\n styles.checkbox,\n {\n borderColor: theme.palette.border.base,\n borderRadius: theme.shape.radius.full,\n height: 20,\n width: 20,\n ...(checked ? {\n backgroundColor: theme.palette.fill.accent,\n borderColor: theme.palette.fill.accent,\n } : {}),\n },\n ]),\n containerStyle: {\n alignItems: 'center',\n borderBottomColor: theme.palette.border.weak,\n borderBottomWidth: 0.5,\n flexDirection: 'row-reverse',\n gap: theme.spacing(8),\n paddingVertical: theme.spacing(3.5),\n },\n iconColor: commonColors.static.strongInverse,\n };\n default:\n return {};\n }\n}\n"],"mappings":"AAAA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA8C,qBAA9C;AACA,SAASC,GAAT,EAAcC,QAAd,QAA8B,WAA9B;AAGA,MAAMC,MAAM,GAAGJ,UAAU,CAACK,MAAX,CAAkB;EAC7BC,QAAQ,EAAE;IACNC,UAAU,EAAE,QADN;IAENC,WAAW,EAAE,CAFP;IAGNC,cAAc,EAAE;EAHV;AADmB,CAAlB,CAAf;AAeA,eAAe,SAASC,kBAAT,CAA4BC,OAA5B,EAAsDC,OAAtD,EAAmG;EAC9G,MAAMC,KAAK,GAAGV,QAAQ,EAAtB;;EAEA,QAAQQ,OAAR;IACI,KAAK,QAAL;MACI,OAAO;QACHG,sBAAsB,EAAE;UACpBC,SAAS,EAAE,YADS;UAEpBC,UAAU,EAAE;QAFQ,CADrB;QAKHC,aAAa,EAAEf,GAAG,CAAC,CACfE,MAAM,CAACE,QADQ,EAEf;UACIY,WAAW,EAAEL,KAAK,CAACM,OAAN,CAAcC,MAAd,CAAqBC,IADtC;UAEIC,YAAY,EAAET,KAAK,CAACU,KAAN,CAAYC,MAAZ,CAAmBC,EAFrC;UAGIC,MAAM,EAAE,EAHZ;UAIIC,KAAK,EAAE,EAJX;UAKI,IAAIf,OAAO,GAAG;YACVgB,eAAe,EAAEf,KAAK,CAACM,OAAN,CAAcU,IAAd,CAAmBR,IAD1B;YAEVH,WAAW,EAAEL,KAAK,CAACM,OAAN,CAAcU,IAAd,CAAmB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ography = typographyOf({
|
|
33
33
|
fontSize: 9.5,
|
|
34
34
|
lineHeight: 11.4,
|
|
35
|
-
fontFamily: '
|
|
35
|
+
fontFamily: 'PretendardStd-SemiBold',
|
|
36
36
|
letterSpacing: -0.19
|
|
37
37
|
});
|
|
38
38
|
const currentFontStyle = createFontStyle(theme, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Text","commonColors","typographyOf","Divider","Row","createFontStyle","useTheme","useStyles","theme","root","backgroundColor","static","weakOpacity","borderRadius","shape","radius","full","paddingHorizontal","spacing","paddingVertical","divider","alignSelf","borderColor","weakOpacityInverse","height","NumberPagination","props","currentPage","maxPage","styles","typography","fontSize","lineHeight","fontFamily","letterSpacing","currentFontStyle","selector","_","color","strongInverse","countFontStyle","baseOpacityInverse"],"sources":["NumberPagination.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { commonColors, typographyOf } from '@fountain-ui/styles';\nimport Divider from '../Divider';\nimport Row from '../Row';\nimport { createFontStyle, useTheme } from '../styles';\nimport type PaginationProps from './PaginationProps';\n\ntype NumberPaginationStyles = NamedStylesStringUnion<'root' | 'divider'>;\n\nconst useStyles: UseStyles<NumberPaginationStyles> = function (): NumberPaginationStyles {\n const theme = useTheme();\n\n return {\n root: {\n backgroundColor: commonColors.static.weakOpacity,\n borderRadius: theme.shape.radius.full,\n paddingHorizontal: theme.spacing(1.25),\n paddingVertical: theme.spacing(0.5),\n },\n divider: {\n alignSelf: 'center',\n borderColor: commonColors.static.weakOpacityInverse,\n height: 6,\n },\n };\n};\n\ninterface NumberPaginationProps {\n currentPage: PaginationProps['page'];\n maxPage: PaginationProps['count'];\n}\n\nexport default function NumberPagination(props: NumberPaginationProps) {\n const {\n currentPage,\n maxPage,\n } = props;\n\n const styles = useStyles();\n\n const theme = useTheme();\n\n const typography = typographyOf({\n fontSize: 9.5,\n lineHeight: 11.4,\n fontFamily: '
|
|
1
|
+
{"version":3,"names":["React","Text","commonColors","typographyOf","Divider","Row","createFontStyle","useTheme","useStyles","theme","root","backgroundColor","static","weakOpacity","borderRadius","shape","radius","full","paddingHorizontal","spacing","paddingVertical","divider","alignSelf","borderColor","weakOpacityInverse","height","NumberPagination","props","currentPage","maxPage","styles","typography","fontSize","lineHeight","fontFamily","letterSpacing","currentFontStyle","selector","_","color","strongInverse","countFontStyle","baseOpacityInverse"],"sources":["NumberPagination.tsx"],"sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { commonColors, typographyOf } from '@fountain-ui/styles';\nimport Divider from '../Divider';\nimport Row from '../Row';\nimport { createFontStyle, useTheme } from '../styles';\nimport type PaginationProps from './PaginationProps';\n\ntype NumberPaginationStyles = NamedStylesStringUnion<'root' | 'divider'>;\n\nconst useStyles: UseStyles<NumberPaginationStyles> = function (): NumberPaginationStyles {\n const theme = useTheme();\n\n return {\n root: {\n backgroundColor: commonColors.static.weakOpacity,\n borderRadius: theme.shape.radius.full,\n paddingHorizontal: theme.spacing(1.25),\n paddingVertical: theme.spacing(0.5),\n },\n divider: {\n alignSelf: 'center',\n borderColor: commonColors.static.weakOpacityInverse,\n height: 6,\n },\n };\n};\n\ninterface NumberPaginationProps {\n currentPage: PaginationProps['page'];\n maxPage: PaginationProps['count'];\n}\n\nexport default function NumberPagination(props: NumberPaginationProps) {\n const {\n currentPage,\n maxPage,\n } = props;\n\n const styles = useStyles();\n\n const theme = useTheme();\n\n const typography = typographyOf({\n fontSize: 9.5,\n lineHeight: 11.4,\n fontFamily: 'PretendardStd-SemiBold',\n letterSpacing: -0.19,\n });\n\n const currentFontStyle = createFontStyle(theme, {\n selector: (_) => typography,\n color: commonColors.static.strongInverse,\n });\n\n const countFontStyle = createFontStyle(theme, {\n selector: (_) => typography,\n color: commonColors.static.baseOpacityInverse,\n });\n\n return (\n <Row style={styles.root}>\n <Text style={currentFontStyle}>\n {currentPage + 1}\n </Text>\n\n <Divider\n style={styles.divider}\n vertical={true}\n />\n\n <Text style={countFontStyle}>\n {maxPage}\n </Text>\n </Row>\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,YAAT,EAAuBC,YAAvB,QAA2C,qBAA3C;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,GAAP,MAAgB,QAAhB;AACA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,WAA1C;;AAKA,MAAMC,SAA4C,GAAG,YAAoC;EACrF,MAAMC,KAAK,GAAGF,QAAQ,EAAtB;EAEA,OAAO;IACHG,IAAI,EAAE;MACFC,eAAe,EAAET,YAAY,CAACU,MAAb,CAAoBC,WADnC;MAEFC,YAAY,EAAEL,KAAK,CAACM,KAAN,CAAYC,MAAZ,CAAmBC,IAF/B;MAGFC,iBAAiB,EAAET,KAAK,CAACU,OAAN,CAAc,IAAd,CAHjB;MAIFC,eAAe,EAAEX,KAAK,CAACU,OAAN,CAAc,GAAd;IAJf,CADH;IAOHE,OAAO,EAAE;MACLC,SAAS,EAAE,QADN;MAELC,WAAW,EAAErB,YAAY,CAACU,MAAb,CAAoBY,kBAF5B;MAGLC,MAAM,EAAE;IAHH;EAPN,CAAP;AAaH,CAhBD;;AAuBA,eAAe,SAASC,gBAAT,CAA0BC,KAA1B,EAAwD;EACnE,MAAM;IACFC,WADE;IAEFC;EAFE,IAGFF,KAHJ;EAKA,MAAMG,MAAM,GAAGtB,SAAS,EAAxB;EAEA,MAAMC,KAAK,GAAGF,QAAQ,EAAtB;EAEA,MAAMwB,UAAU,GAAG5B,YAAY,CAAC;IAC5B6B,QAAQ,EAAE,GADkB;IAE5BC,UAAU,EAAE,IAFgB;IAG5BC,UAAU,EAAE,wBAHgB;IAI5BC,aAAa,EAAE,CAAC;EAJY,CAAD,CAA/B;EAOA,MAAMC,gBAAgB,GAAG9B,eAAe,CAACG,KAAD,EAAQ;IAC5C4B,QAAQ,EAAGC,CAAD,IAAOP,UAD2B;IAE5CQ,KAAK,EAAErC,YAAY,CAACU,MAAb,CAAoB4B;EAFiB,CAAR,CAAxC;EAKA,MAAMC,cAAc,GAAGnC,eAAe,CAACG,KAAD,EAAQ;IAC1C4B,QAAQ,EAAGC,CAAD,IAAOP,UADyB;IAE1CQ,KAAK,EAAErC,YAAY,CAACU,MAAb,CAAoB8B;EAFe,CAAR,CAAtC;EAKA,oBACI,oBAAC,GAAD;IAAK,KAAK,EAAEZ,MAAM,CAACpB;EAAnB,gBACI,oBAAC,IAAD;IAAM,KAAK,EAAE0B;EAAb,GACKR,WAAW,GAAG,CADnB,CADJ,eAKI,oBAAC,OAAD;IACI,KAAK,EAAEE,MAAM,CAACT,OADlB;IAEI,QAAQ,EAAE;EAFd,EALJ,eAUI,oBAAC,IAAD;IAAM,KAAK,EAAEoB;EAAb,GACKZ,OADL,CAVJ,CADJ;AAgBH"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { useBreakpointByWidth } from '@fountain-ui/styles';
|
|
2
2
|
import { css, useTheme } from '../styles';
|
|
3
3
|
|
|
4
|
-
function getMaxWidth(theme, breakpoint) {
|
|
4
|
+
function getMaxWidth(theme, breakpoint, customMaxWidth) {
|
|
5
5
|
switch (breakpoint) {
|
|
6
6
|
case 'lg':
|
|
7
|
-
return theme.breakpoints.values['lg'];
|
|
8
|
-
|
|
9
7
|
case 'md':
|
|
10
|
-
return theme.breakpoints.values[
|
|
8
|
+
return customMaxWidth ?? theme.breakpoints.values[breakpoint];
|
|
11
9
|
|
|
12
10
|
default:
|
|
13
|
-
return
|
|
11
|
+
return undefined;
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
|
|
@@ -26,16 +24,19 @@ function getPaddingHorizontal(theme, breakpoint) {
|
|
|
26
24
|
|
|
27
25
|
export default function useContentContainerStyle(config) {
|
|
28
26
|
const {
|
|
29
|
-
maxWidth,
|
|
27
|
+
maxWidth: customMaxWidth,
|
|
30
28
|
styleProvider
|
|
31
29
|
} = config;
|
|
32
30
|
const theme = useTheme();
|
|
33
31
|
const currentBreakpoint = useBreakpointByWidth();
|
|
34
32
|
const additionalStyle = styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider(theme);
|
|
33
|
+
const maxWidth = getMaxWidth(theme, currentBreakpoint, customMaxWidth);
|
|
34
|
+
const paddingHorizontal = getPaddingHorizontal(theme, currentBreakpoint);
|
|
35
|
+
const resolvedMaxWidth = typeof maxWidth === 'number' ? maxWidth + paddingHorizontal * 2 : undefined;
|
|
35
36
|
return css([{
|
|
36
37
|
alignSelf: 'center',
|
|
37
|
-
maxWidth:
|
|
38
|
-
paddingHorizontal
|
|
38
|
+
maxWidth: resolvedMaxWidth,
|
|
39
|
+
paddingHorizontal,
|
|
39
40
|
width: '100%'
|
|
40
41
|
}, additionalStyle]);
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useBreakpointByWidth","css","useTheme","getMaxWidth","theme","breakpoint","breakpoints","values","getPaddingHorizontal","spacing","useContentContainerStyle","config","maxWidth","styleProvider","currentBreakpoint","additionalStyle","
|
|
1
|
+
{"version":3,"names":["useBreakpointByWidth","css","useTheme","getMaxWidth","theme","breakpoint","customMaxWidth","breakpoints","values","undefined","getPaddingHorizontal","spacing","useContentContainerStyle","config","maxWidth","styleProvider","currentBreakpoint","additionalStyle","paddingHorizontal","resolvedMaxWidth","alignSelf","width"],"sources":["useContentContainerStyle.ts"],"sourcesContent":["import type { FountainUiStyle } from '@fountain-ui/styles';\nimport { useBreakpointByWidth } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport type { Theme } from '../types';\n\ntype Breakpoint = keyof Theme['breakpoints']['values'];\n\nexport interface Config {\n maxWidth?: number;\n styleProvider?: (theme: Theme) => FountainUiStyle;\n}\n\nfunction getMaxWidth(theme: Theme, breakpoint: Breakpoint, customMaxWidth?: number): number | undefined {\n switch (breakpoint) {\n case 'lg':\n case 'md':\n return customMaxWidth ?? theme.breakpoints.values[breakpoint];\n default:\n return undefined;\n }\n}\n\nfunction getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint): number {\n switch (breakpoint) {\n case 'sm':\n return theme.spacing(6);\n default:\n return theme.spacing(4);\n }\n}\n\nexport default function useContentContainerStyle(config: Config): FountainUiStyle {\n const {\n maxWidth: customMaxWidth,\n styleProvider,\n } = config;\n\n const theme = useTheme();\n\n const currentBreakpoint = useBreakpointByWidth();\n\n const additionalStyle = styleProvider?.(theme);\n\n const maxWidth = getMaxWidth(theme, currentBreakpoint, customMaxWidth);\n const paddingHorizontal = getPaddingHorizontal(theme, currentBreakpoint);\n\n const resolvedMaxWidth = typeof maxWidth === 'number' ? maxWidth + paddingHorizontal * 2 : undefined;\n\n return css([\n {\n alignSelf: 'center',\n maxWidth: resolvedMaxWidth,\n paddingHorizontal,\n width: '100%',\n },\n additionalStyle,\n ]);\n};\n"],"mappings":"AACA,SAASA,oBAAT,QAAqC,qBAArC;AACA,SAASC,GAAT,EAAcC,QAAd,QAA8B,WAA9B;;AAUA,SAASC,WAAT,CAAqBC,KAArB,EAAmCC,UAAnC,EAA2DC,cAA3D,EAAwG;EACpG,QAAQD,UAAR;IACI,KAAK,IAAL;IACA,KAAK,IAAL;MACI,OAAOC,cAAc,IAAIF,KAAK,CAACG,WAAN,CAAkBC,MAAlB,CAAyBH,UAAzB,CAAzB;;IACJ;MACI,OAAOI,SAAP;EALR;AAOH;;AAED,SAASC,oBAAT,CAA8BN,KAA9B,EAA4CC,UAA5C,EAA4E;EACxE,QAAQA,UAAR;IACI,KAAK,IAAL;MACI,OAAOD,KAAK,CAACO,OAAN,CAAc,CAAd,CAAP;;IACJ;MACI,OAAOP,KAAK,CAACO,OAAN,CAAc,CAAd,CAAP;EAJR;AAMH;;AAED,eAAe,SAASC,wBAAT,CAAkCC,MAAlC,EAAmE;EAC9E,MAAM;IACFC,QAAQ,EAAER,cADR;IAEFS;EAFE,IAGFF,MAHJ;EAKA,MAAMT,KAAK,GAAGF,QAAQ,EAAtB;EAEA,MAAMc,iBAAiB,GAAGhB,oBAAoB,EAA9C;EAEA,MAAMiB,eAAe,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAGX,KAAH,CAArC;EAEA,MAAMU,QAAQ,GAAGX,WAAW,CAACC,KAAD,EAAQY,iBAAR,EAA2BV,cAA3B,CAA5B;EACA,MAAMY,iBAAiB,GAAGR,oBAAoB,CAACN,KAAD,EAAQY,iBAAR,CAA9C;EAEA,MAAMG,gBAAgB,GAAG,OAAOL,QAAP,KAAoB,QAApB,GAA+BA,QAAQ,GAAGI,iBAAiB,GAAG,CAA9D,GAAkET,SAA3F;EAEA,OAAOR,GAAG,CAAC,CACP;IACImB,SAAS,EAAE,QADf;IAEIN,QAAQ,EAAEK,gBAFd;IAGID,iBAHJ;IAIIG,KAAK,EAAE;EAJX,CADO,EAOPJ,eAPO,CAAD,CAAV;AASH;AAAA"}
|
|
@@ -22,6 +22,11 @@ export default interface ButtonProps extends OverridableComponentProps<ButtonBas
|
|
|
22
22
|
* @default false
|
|
23
23
|
*/
|
|
24
24
|
disableMinWidth?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Determines whether padding should be applied.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
disablePadding?: boolean;
|
|
25
30
|
/**
|
|
26
31
|
* Element placed after the children.
|
|
27
32
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FountainUiStyle } from '@fountain-ui/styles';
|
|
2
2
|
import type { CheckboxVariant } from './CheckboxProps';
|
|
3
3
|
declare type useVariantStyleMapReturns = {
|
|
4
|
+
checkboxContainerStyle?: FountainUiStyle;
|
|
4
5
|
checkboxStyle?: FountainUiStyle;
|
|
5
6
|
containerStyle?: FountainUiStyle;
|
|
6
7
|
iconColor?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fountain-ui/core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.7",
|
|
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": "5c2c59a7fa856f9be83761deb52fc0cbe233f57a"
|
|
71
71
|
}
|
package/src/Button/Button.tsx
CHANGED
|
@@ -82,6 +82,7 @@ export default function Button(props: ButtonProps) {
|
|
|
82
82
|
color: colorProp = 'primary' as ButtonColor,
|
|
83
83
|
disabled: disabledProp = false,
|
|
84
84
|
disableMinWidth = false,
|
|
85
|
+
disablePadding = false,
|
|
85
86
|
endIcon: endIconProp,
|
|
86
87
|
fullWidth = false,
|
|
87
88
|
href,
|
|
@@ -122,6 +123,7 @@ export default function Button(props: ButtonProps) {
|
|
|
122
123
|
styles[size],
|
|
123
124
|
fullWidth ? styles.fullWidth : undefined,
|
|
124
125
|
disableMinWidth ? { minWidth: 0 } : undefined,
|
|
126
|
+
disablePadding ? { paddingHorizontal: 0, paddingVertical: 0 } : undefined,
|
|
125
127
|
styleProp,
|
|
126
128
|
]);
|
|
127
129
|
|
|
@@ -46,6 +46,12 @@ export default interface ButtonProps extends OverridableComponentProps<ButtonBas
|
|
|
46
46
|
*/
|
|
47
47
|
disableMinWidth?: boolean;
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Determines whether padding should be applied.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
disablePadding?: boolean;
|
|
54
|
+
|
|
49
55
|
/**
|
|
50
56
|
* Element placed after the children.
|
|
51
57
|
*/
|
|
@@ -22,6 +22,7 @@ export default function Checkbox(props: CheckboxProps) {
|
|
|
22
22
|
const theme = useTheme();
|
|
23
23
|
|
|
24
24
|
const {
|
|
25
|
+
checkboxContainerStyle,
|
|
25
26
|
checkboxStyle,
|
|
26
27
|
containerStyle,
|
|
27
28
|
iconColor,
|
|
@@ -50,14 +51,16 @@ export default function Checkbox(props: CheckboxProps) {
|
|
|
50
51
|
style={rootStyle}
|
|
51
52
|
{...otherProps}
|
|
52
53
|
>
|
|
53
|
-
<View style={
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
<View style={checkboxContainerStyle}>
|
|
55
|
+
<View style={checkboxStyle}>
|
|
56
|
+
{checked ? (
|
|
57
|
+
<CheckboxOnIcon
|
|
58
|
+
fill={iconColor}
|
|
59
|
+
height={7.5}
|
|
60
|
+
width={11}
|
|
61
|
+
/>
|
|
62
|
+
) : null}
|
|
63
|
+
</View>
|
|
61
64
|
</View>
|
|
62
65
|
|
|
63
66
|
{children ? (
|
|
@@ -12,6 +12,7 @@ const styles = StyleSheet.create({
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
type useVariantStyleMapReturns = {
|
|
15
|
+
checkboxContainerStyle?: FountainUiStyle;
|
|
15
16
|
checkboxStyle?: FountainUiStyle;
|
|
16
17
|
containerStyle?: FountainUiStyle;
|
|
17
18
|
iconColor?: string;
|
|
@@ -23,6 +24,10 @@ export default function useVariantStyleMap(variant: CheckboxVariant, checked: bo
|
|
|
23
24
|
switch (variant) {
|
|
24
25
|
case 'square':
|
|
25
26
|
return {
|
|
27
|
+
checkboxContainerStyle: {
|
|
28
|
+
alignSelf: 'flex-start',
|
|
29
|
+
paddingTop: 3,
|
|
30
|
+
},
|
|
26
31
|
checkboxStyle: css([
|
|
27
32
|
styles.checkbox,
|
|
28
33
|
{
|
|
@@ -37,7 +42,6 @@ export default function useVariantStyleMap(variant: CheckboxVariant, checked: bo
|
|
|
37
42
|
},
|
|
38
43
|
]),
|
|
39
44
|
containerStyle: {
|
|
40
|
-
alignItems: 'center',
|
|
41
45
|
flexDirection: 'row',
|
|
42
46
|
gap: theme.spacing(3),
|
|
43
47
|
paddingVertical: theme.spacing(2),
|
|
@@ -45,7 +45,7 @@ export default function NumberPagination(props: NumberPaginationProps) {
|
|
|
45
45
|
const typography = typographyOf({
|
|
46
46
|
fontSize: 9.5,
|
|
47
47
|
lineHeight: 11.4,
|
|
48
|
-
fontFamily: '
|
|
48
|
+
fontFamily: 'PretendardStd-SemiBold',
|
|
49
49
|
letterSpacing: -0.19,
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ViewStyle } from 'react-native';
|
|
2
1
|
import type { FountainUiStyle } from '@fountain-ui/styles';
|
|
3
2
|
import { useBreakpointByWidth } from '@fountain-ui/styles';
|
|
4
3
|
import { css, useTheme } from '../styles';
|
|
@@ -11,18 +10,17 @@ export interface Config {
|
|
|
11
10
|
styleProvider?: (theme: Theme) => FountainUiStyle;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
function getMaxWidth(theme: Theme, breakpoint: Breakpoint):
|
|
13
|
+
function getMaxWidth(theme: Theme, breakpoint: Breakpoint, customMaxWidth?: number): number | undefined {
|
|
15
14
|
switch (breakpoint) {
|
|
16
15
|
case 'lg':
|
|
17
|
-
return theme.breakpoints.values['lg'];
|
|
18
16
|
case 'md':
|
|
19
|
-
return theme.breakpoints.values[
|
|
17
|
+
return customMaxWidth ?? theme.breakpoints.values[breakpoint];
|
|
20
18
|
default:
|
|
21
|
-
return
|
|
19
|
+
return undefined;
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
function getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint):
|
|
23
|
+
function getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint): number {
|
|
26
24
|
switch (breakpoint) {
|
|
27
25
|
case 'sm':
|
|
28
26
|
return theme.spacing(6);
|
|
@@ -33,7 +31,7 @@ function getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint): ViewStyle['
|
|
|
33
31
|
|
|
34
32
|
export default function useContentContainerStyle(config: Config): FountainUiStyle {
|
|
35
33
|
const {
|
|
36
|
-
maxWidth,
|
|
34
|
+
maxWidth: customMaxWidth,
|
|
37
35
|
styleProvider,
|
|
38
36
|
} = config;
|
|
39
37
|
|
|
@@ -43,11 +41,16 @@ export default function useContentContainerStyle(config: Config): FountainUiStyl
|
|
|
43
41
|
|
|
44
42
|
const additionalStyle = styleProvider?.(theme);
|
|
45
43
|
|
|
44
|
+
const maxWidth = getMaxWidth(theme, currentBreakpoint, customMaxWidth);
|
|
45
|
+
const paddingHorizontal = getPaddingHorizontal(theme, currentBreakpoint);
|
|
46
|
+
|
|
47
|
+
const resolvedMaxWidth = typeof maxWidth === 'number' ? maxWidth + paddingHorizontal * 2 : undefined;
|
|
48
|
+
|
|
46
49
|
return css([
|
|
47
50
|
{
|
|
48
51
|
alignSelf: 'center',
|
|
49
|
-
maxWidth:
|
|
50
|
-
paddingHorizontal
|
|
52
|
+
maxWidth: resolvedMaxWidth,
|
|
53
|
+
paddingHorizontal,
|
|
51
54
|
width: '100%',
|
|
52
55
|
},
|
|
53
56
|
additionalStyle,
|