UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 11.1 kB
{"ast":null,"code":"import color from 'color';\nconst getBorderColor = ({\n theme,\n disabled\n}) => {\n if (theme.isV3) {\n if (disabled) {\n return theme.colors.surfaceDisabled;\n }\n return theme.colors.outline;\n }\n return undefined;\n};\nconst getBackgroundColor = ({\n theme,\n isMode,\n disabled,\n selected,\n customContainerColor\n}) => {\n if (theme.isV3) {\n if (disabled) {\n if (isMode('contained') || isMode('contained-tonal')) {\n return theme.colors.surfaceDisabled;\n }\n }\n if (typeof customContainerColor !== 'undefined') {\n return customContainerColor;\n }\n if (isMode('contained')) {\n if (selected) {\n return theme.colors.primary;\n }\n return theme.colors.surfaceVariant;\n }\n if (isMode('contained-tonal')) {\n if (selected) {\n return theme.colors.secondaryContainer;\n }\n return theme.colors.surfaceVariant;\n }\n if (isMode('outlined')) {\n if (selected) {\n return theme.colors.inverseSurface;\n }\n }\n }\n if (typeof customContainerColor !== 'undefined') {\n return customContainerColor;\n }\n return undefined;\n};\nconst getIconColor = ({\n theme,\n isMode,\n disabled,\n selected,\n customIconColor\n}) => {\n if (theme.isV3) {\n if (disabled) {\n return theme.colors.onSurfaceDisabled;\n }\n if (typeof customIconColor !== 'undefined') {\n return customIconColor;\n }\n if (isMode('contained')) {\n if (selected) {\n return theme.colors.onPrimary;\n }\n return theme.colors.primary;\n }\n if (isMode('contained-tonal')) {\n if (selected) {\n return theme.colors.onSecondaryContainer;\n }\n return theme.colors.onSurfaceVariant;\n }\n if (isMode('outlined')) {\n if (selected) {\n return theme.colors.inverseOnSurface;\n }\n return theme.colors.onSurfaceVariant;\n }\n if (selected) {\n return theme.colors.primary;\n }\n return theme.colors.onSurfaceVariant;\n }\n if (typeof customIconColor !== 'undefined') {\n return customIconColor;\n }\n return theme.colors.text;\n};\nconst getRippleColor = ({\n theme,\n iconColor,\n customRippleColor\n}) => {\n if (customRippleColor) {\n return customRippleColor;\n }\n if (theme.isV3) {\n return color(iconColor).alpha(0.12).rgb().string();\n }\n return color(iconColor).alpha(0.32).rgb().string();\n};\nexport const getIconButtonColor = ({\n theme,\n disabled,\n mode,\n selected,\n customIconColor,\n customContainerColor,\n customRippleColor\n}) => {\n const isMode = modeToCompare => {\n return mode === modeToCompare;\n };\n const baseIconColorProps = {\n theme,\n isMode,\n disabled,\n selected\n };\n const iconColor = getIconColor(Object.assign({}, baseIconColorProps, {\n customIconColor\n }));\n return {\n iconColor,\n backgroundColor: getBackgroundColor(Object.assign({}, baseIconColorProps, {\n customContainerColor\n })),\n rippleColor: getRippleColor({\n theme,\n iconColor,\n customRippleColor\n }),\n borderColor: getBorderColor({\n theme,\n disabled\n })\n };\n};","map":{"version":3,"names":["color","getBorderColor","theme","disabled","isV3","colors","surfaceDisabled","outline","undefined","getBackgroundColor","isMode","selected","customContainerColor","primary","surfaceVariant","secondaryContainer","inverseSurface","getIconColor","customIconColor","onSurfaceDisabled","onPrimary","onSecondaryContainer","onSurfaceVariant","inverseOnSurface","text","getRippleColor","iconColor","customRippleColor","alpha","rgb","string","getIconButtonColor","mode","modeToCompare","baseIconColorProps","Object","assign","backgroundColor","rippleColor","borderColor"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/IconButton/utils.ts"],"sourcesContent":["import type { ColorValue } from 'react-native';\n\nimport color from 'color';\n\nimport type { InternalTheme } from '../../types';\n\ntype IconButtonMode = 'outlined' | 'contained' | 'contained-tonal';\n\ntype BaseProps = {\n theme: InternalTheme;\n isMode: (mode: IconButtonMode) => boolean;\n disabled?: boolean;\n selected?: boolean;\n};\n\nconst getBorderColor = ({\n theme,\n disabled,\n}: {\n theme: InternalTheme;\n disabled?: boolean;\n}) => {\n if (theme.isV3) {\n if (disabled) {\n return theme.colors.surfaceDisabled;\n }\n\n return theme.colors.outline;\n }\n\n return undefined;\n};\n\nconst getBackgroundColor = ({\n theme,\n isMode,\n disabled,\n selected,\n customContainerColor,\n}: BaseProps & { customContainerColor?: string }) => {\n if (theme.isV3) {\n if (disabled) {\n if (isMode('contained') || isMode('contained-tonal')) {\n return theme.colors.surfaceDisabled;\n }\n }\n\n if (typeof customContainerColor !== 'undefined') {\n return customContainerColor;\n }\n\n if (isMode('contained')) {\n if (selected) {\n return theme.colors.primary;\n }\n return theme.colors.surfaceVariant;\n }\n\n if (isMode('contained-tonal')) {\n if (selected) {\n return theme.colors.secondaryContainer;\n }\n return theme.colors.surfaceVariant;\n }\n\n if (isMode('outlined')) {\n if (selected) {\n return theme.colors.inverseSurface;\n }\n }\n }\n\n if (typeof customContainerColor !== 'undefined') {\n return customContainerColor;\n }\n\n return undefined;\n};\n\nconst getIconColor = ({\n theme,\n isMode,\n disabled,\n selected,\n customIconColor,\n}: BaseProps & { customIconColor?: string }) => {\n if (theme.isV3) {\n if (disabled) {\n return theme.colors.onSurfaceDisabled;\n }\n\n if (typeof customIconColor !== 'undefined') {\n return customIconColor;\n }\n\n if (isMode('contained')) {\n if (selected) {\n return theme.colors.onPrimary;\n }\n return theme.colors.primary;\n }\n\n if (isMode('contained-tonal')) {\n if (selected) {\n return theme.colors.onSecondaryContainer;\n }\n return theme.colors.onSurfaceVariant;\n }\n\n if (isMode('outlined')) {\n if (selected) {\n return theme.colors.inverseOnSurface;\n }\n return theme.colors.onSurfaceVariant;\n }\n\n if (selected) {\n return theme.colors.primary;\n }\n return theme.colors.onSurfaceVariant;\n }\n\n if (typeof customIconColor !== 'undefined') {\n return customIconColor;\n }\n\n return theme.colors.text;\n};\n\nconst getRippleColor = ({\n theme,\n iconColor,\n customRippleColor,\n}: {\n theme: InternalTheme;\n iconColor: string;\n customRippleColor?: ColorValue;\n}) => {\n if (customRippleColor) {\n return customRippleColor;\n }\n if (theme.isV3) {\n return color(iconColor).alpha(0.12).rgb().string();\n }\n return color(iconColor).alpha(0.32).rgb().string();\n};\n\nexport const getIconButtonColor = ({\n theme,\n disabled,\n mode,\n selected,\n customIconColor,\n customContainerColor,\n customRippleColor,\n}: {\n theme: InternalTheme;\n disabled?: boolean;\n selected?: boolean;\n mode?: IconButtonMode;\n customIconColor?: string;\n customContainerColor?: string;\n customRippleColor?: ColorValue;\n}) => {\n const isMode = (modeToCompare: IconButtonMode) => {\n return mode === modeToCompare;\n };\n\n const baseIconColorProps = {\n theme,\n isMode,\n disabled,\n selected,\n };\n\n const iconColor = getIconColor({\n ...baseIconColorProps,\n customIconColor,\n });\n\n return {\n iconColor,\n backgroundColor: getBackgroundColor({\n ...baseIconColorProps,\n customContainerColor,\n }),\n rippleColor: getRippleColor({ theme, iconColor, customRippleColor }),\n borderColor: getBorderColor({ theme, disabled }),\n };\n};\n"],"mappings":"AAEA,OAAOA,KAAK,MAAM,OAAO;AAazB,MAAMC,cAAc,GAAGA,CAAC;EACtBC,KAAK;EACLC;AAIF,CAAC,KAAK;EACJ,IAAID,KAAK,CAACE,IAAI,EAAE;IACd,IAAID,QAAQ,EAAE;MACZ,OAAOD,KAAK,CAACG,MAAM,CAACC,eAAe;IACrC;IAEA,OAAOJ,KAAK,CAACG,MAAM,CAACE,OAAO;EAC7B;EAEA,OAAOC,SAAS;AAClB,CAAC;AAED,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BP,KAAK;EACLQ,MAAM;EACNP,QAAQ;EACRQ,QAAQ;EACRC;AAC6C,CAAC,KAAK;EACnD,IAAIV,KAAK,CAACE,IAAI,EAAE;IACd,IAAID,QAAQ,EAAE;MACZ,IAAIO,MAAM,CAAC,WAAW,CAAC,IAAIA,MAAM,CAAC,iBAAiB,CAAC,EAAE;QACpD,OAAOR,KAAK,CAACG,MAAM,CAACC,eAAe;MACrC;IACF;IAEA,IAAI,OAAOM,oBAAoB,KAAK,WAAW,EAAE;MAC/C,OAAOA,oBAAoB;IAC7B;IAEA,IAAIF,MAAM,CAAC,WAAW,CAAC,EAAE;MACvB,IAAIC,QAAQ,EAAE;QACZ,OAAOT,KAAK,CAACG,MAAM,CAACQ,OAAO;MAC7B;MACA,OAAO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