repoweaver
Version:
A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies
1 lines • 7.92 kB
JSON
{"ast":null,"code":"import color from 'color';\nimport { black, white } from \"../../styles/themes/v2/colors\";\nexport var MIN_WIDTH = 112;\nexport var MAX_WIDTH = 280;\nvar getDisabledColor = function getDisabledColor(theme) {\n if (theme.isV3) {\n return theme.colors.onSurfaceDisabled;\n }\n return color(theme.dark ? white : black).alpha(0.32).rgb().string();\n};\nvar getTitleColor = function getTitleColor(_ref) {\n var theme = _ref.theme,\n disabled = _ref.disabled;\n if (disabled) {\n return getDisabledColor(theme);\n }\n if (theme.isV3) {\n return theme.colors.onSurface;\n }\n return color(theme.colors.text).alpha(0.87).rgb().string();\n};\nvar getIconColor = function getIconColor(_ref2) {\n var theme = _ref2.theme,\n disabled = _ref2.disabled;\n if (disabled) {\n return getDisabledColor(theme);\n }\n if (theme.isV3) {\n return theme.colors.onSurfaceVariant;\n }\n return color(theme.colors.text).alpha(0.54).rgb().string();\n};\nvar getRippleColor = function getRippleColor(_ref3) {\n var theme = _ref3.theme,\n customRippleColor = _ref3.customRippleColor;\n if (customRippleColor) {\n return customRippleColor;\n }\n if (theme.isV3) {\n return color(theme.colors.onSurfaceVariant).alpha(0.12).rgb().string();\n }\n return undefined;\n};\nexport var getMenuItemColor = function getMenuItemColor(_ref4) {\n var theme = _ref4.theme,\n disabled = _ref4.disabled,\n customRippleColor = _ref4.customRippleColor;\n return {\n titleColor: getTitleColor({\n theme: theme,\n disabled: disabled\n }),\n iconColor: getIconColor({\n theme: theme,\n disabled: disabled\n }),\n rippleColor: getRippleColor({\n theme: theme,\n customRippleColor: customRippleColor\n })\n };\n};\nexport var getContentMaxWidth = function getContentMaxWidth(_ref5) {\n var isV3 = _ref5.isV3,\n iconWidth = _ref5.iconWidth,\n leadingIcon = _ref5.leadingIcon,\n trailingIcon = _ref5.trailingIcon;\n if (isV3) {\n if (leadingIcon && trailingIcon) {\n return MAX_WIDTH - (2 * iconWidth + 24);\n }\n if (leadingIcon || trailingIcon) {\n return MAX_WIDTH - (iconWidth + 24);\n }\n return MAX_WIDTH - 12;\n }\n if (leadingIcon) {\n return MAX_WIDTH - (iconWidth + 48);\n }\n return MAX_WIDTH - 16;\n};","map":{"version":3,"names":["color","black","white","MIN_WIDTH","MAX_WIDTH","getDisabledColor","theme","isV3","colors","onSurfaceDisabled","dark","alpha","rgb","string","getTitleColor","_ref","disabled","onSurface","text","getIconColor","_ref2","onSurfaceVariant","getRippleColor","_ref3","customRippleColor","undefined","getMenuItemColor","_ref4","titleColor","iconColor","rippleColor","getContentMaxWidth","_ref5","iconWidth","leadingIcon","trailingIcon"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/Menu/utils.ts"],"sourcesContent":["import type { ColorValue } from 'react-native';\n\nimport color from 'color';\n\nimport { black, white } from '../../styles/themes/v2/colors';\nimport type { InternalTheme } from '../../types';\nimport type { IconSource } from '../Icon';\n\nexport const MIN_WIDTH = 112;\nexport const MAX_WIDTH = 280;\n\ntype ContentProps = {\n isV3: boolean;\n iconWidth: number;\n leadingIcon?: IconSource;\n trailingIcon?: IconSource;\n};\n\ntype ColorProps = {\n theme: InternalTheme;\n disabled?: boolean;\n customRippleColor?: ColorValue;\n};\n\nconst getDisabledColor = (theme: InternalTheme) => {\n if (theme.isV3) {\n return theme.colors.onSurfaceDisabled;\n }\n\n return color(theme.dark ? white : black)\n .alpha(0.32)\n .rgb()\n .string();\n};\n\nconst getTitleColor = ({ theme, disabled }: ColorProps) => {\n if (disabled) {\n return getDisabledColor(theme);\n }\n\n if (theme.isV3) {\n return theme.colors.onSurface;\n }\n\n return color(theme.colors.text).alpha(0.87).rgb().string();\n};\n\nconst getIconColor = ({ theme, disabled }: ColorProps) => {\n if (disabled) {\n return getDisabledColor(theme);\n }\n\n if (theme.isV3) {\n return theme.colors.onSurfaceVariant;\n }\n\n return color(theme.colors.text).alpha(0.54).rgb().string();\n};\n\nconst getRippleColor = ({\n theme,\n customRippleColor,\n}: Omit<ColorProps, 'disabled'>) => {\n if (customRippleColor) {\n return customRippleColor;\n }\n\n if (theme.isV3) {\n return color(theme.colors.onSurfaceVariant).alpha(0.12).rgb().string();\n }\n\n return undefined;\n};\n\nexport const getMenuItemColor = ({\n theme,\n disabled,\n customRippleColor,\n}: ColorProps) => {\n return {\n titleColor: getTitleColor({ theme, disabled }),\n iconColor: getIconColor({ theme, disabled }),\n rippleColor: getRippleColor({ theme, customRippleColor }),\n };\n};\n\nexport const getContentMaxWidth = ({\n isV3,\n iconWidth,\n leadingIcon,\n trailingIcon,\n}: ContentProps) => {\n if (isV3) {\n if (leadingIcon && trailingIcon) {\n return MAX_WIDTH - (2 * iconWidth + 24);\n }\n\n if (leadingIcon || trailingIcon) {\n return MAX_WIDTH - (iconWidth + 24);\n }\n\n return MAX_WIDTH - 12;\n }\n\n if (leadingIcon) {\n return MAX_WIDTH - (iconWidth + 48);\n }\n\n return MAX_WIDTH - 16;\n};\n"],"mappings":"AAEA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,KAAK,EAAEC,KAAK;AAIrB,OAAO,IAAMC,SAAS,GAAG,GAAG;AAC5B,OAAO,IAAMC,SAAS,GAAG,GAAG;AAe5B,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAIC,KAAoB,EAAK;EACjD,IAAIA,KAAK,CAACC,IAAI,EAAE;IACd,OAAOD,KAAK,CAACE,MAAM,CAACC,iBAAiB;EACvC;EAEA,OAAOT,KAAK,CAACM,KAAK,CAACI,IAAI,GAAGR,KAAK,GAAGD,KAAK,CAAC,CACrCU,KAAK,CAAC,IAAI,CAAC,CACXC,GAAG,CAAC,CAAC,CACLC,MAAM,CAAC,CAAC;AACb,CAAC;AAED,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAAwC;EAAA,IAAlCT,KAAK,GAAAS,IAAA,CAALT,KAAK;IAAEU,QAAA,GAAAD,IAAA,CAAAC,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