repoweaver
Version:
A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies
1 lines • 6.29 kB
JSON
{"ast":null,"code":"import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nconst _excluded = [\"value\", \"disabled\", \"onValueChange\", \"color\", \"theme\"];\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nimport * as React from 'react';\nimport NativeModules from \"react-native-web/dist/exports/NativeModules\";\nimport Platform from \"react-native-web/dist/exports/Platform\";\nimport NativeSwitch from \"react-native-web/dist/exports/Switch\";\nimport { getSwitchColor } from \"./utils\";\nimport { useInternalTheme } from \"../../core/theming\";\nconst version = NativeModules.PlatformConstants ? NativeModules.PlatformConstants.reactNativeVersion : undefined;\nconst Switch = _ref => {\n let {\n value,\n disabled,\n onValueChange,\n color,\n theme: themeOverrides\n } = _ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n const theme = useInternalTheme(themeOverrides);\n const {\n checkedColor,\n onTintColor,\n thumbTintColor\n } = getSwitchColor({\n theme,\n disabled,\n value,\n color\n });\n const props = version && version.major === 0 && version.minor <= 56 ? {\n onTintColor,\n thumbTintColor\n } : Platform.OS === 'web' ? {\n activeTrackColor: onTintColor,\n thumbColor: thumbTintColor,\n activeThumbColor: checkedColor\n } : {\n thumbColor: thumbTintColor,\n trackColor: {\n true: onTintColor,\n false: onTintColor\n }\n };\n return React.createElement(NativeSwitch, _extends({\n value: value,\n disabled: disabled,\n onValueChange: disabled ? undefined : onValueChange\n }, props, rest));\n};\nexport default Switch;","map":{"version":3,"names":["React","NativeModules","Platform","NativeSwitch","getSwitchColor","useInternalTheme","version","PlatformConstants","reactNativeVersion","undefined","Switch","_ref","value","disabled","onValueChange","color","theme","themeOverrides","rest","_objectWithoutPropertiesLoose","_excluded","checkedColor","onTintColor","thumbTintColor","props","major","minor","OS","activeTrackColor","thumbColor","activeThumbColor","trackColor","true","false","createElement","_extends"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n NativeModules,\n Platform,\n StyleProp,\n Switch as NativeSwitch,\n ViewStyle,\n} from 'react-native';\n\nimport { getSwitchColor } from './utils';\nimport { useInternalTheme } from '../../core/theming';\nimport type { ThemeProp } from '../../types';\n\nconst version = NativeModules.PlatformConstants\n ? NativeModules.PlatformConstants.reactNativeVersion\n : undefined;\n\nexport type Props = React.ComponentPropsWithRef<typeof NativeSwitch> & {\n /**\n * Disable toggling the switch.\n */\n disabled?: boolean;\n /**\n * Value of the switch, true means 'on', false means 'off'.\n */\n value?: boolean;\n /**\n * Custom color for switch.\n */\n color?: string;\n /**\n * Callback called with the new value when it changes.\n */\n onValueChange?: Function;\n style?: StyleProp<ViewStyle>;\n /**\n * @optional\n */\n theme?: ThemeProp;\n};\n\n/**\n * Switch is a visual toggle between two mutually exclusive states — on and off.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { Switch } from 'react-native-paper';\n *\n * const MyComponent = () => {\n * const [isSwitchOn, setIsSwitchOn] = React.useState(false);\n *\n * const onToggleSwitch = () => setIsSwitchOn(!isSwitchOn);\n *\n * return <Switch value={isSwitchOn} onValueChange={onToggleSwitch} />;\n * };\n *\n * export default MyComponent;\n * ```\n */\nconst Switch = ({\n value,\n disabled,\n onValueChange,\n color,\n theme: themeOverrides,\n ...rest\n}: Props) => {\n const theme = useInternalTheme(themeOverrides);\n const { checkedColor, onTintColor, thumbTintColor } = getSwitchColor({\n theme,\n disabled,\n value,\n color,\n });\n\n const props =\n version && version.major === 0 && version.minor <= 56\n ? {\n onTintColor,\n thumbTintColor,\n }\n : Platform.OS === 'web'\n ? {\n activeTrackColor: onTintColor,\n thumbColor: thumbTintColor,\n activeThumbColor: checkedColor,\n }\n : {\n thumbColor: thumbTintColor,\n trackColor: {\n true: onTintColor,\n false: onTintColor,\n },\n };\n\n return (\n <NativeSwitch\n value={value}\n disabled={disabled}\n onValueChange={disabled ? undefined : onValueChange}\n {...props}\n {...rest}\n />\n );\n};\n\nexport default Switch;\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,aAAA;AAAA,OAAAC,QAAA;AAAA,OAAAC,YAAA;AAS9B,SAASC,cAAc;AACvB,SAASC,gBAAgB;AAGzB,MAAMC,OAAO,GAAGL,aAAa,CAACM,iBAAiB,GAC3CN,aAAa,CAACM,iBAAiB,CAACC,kBAAkB,GAClDC,SAAS;AA6Cb,MAAMC,MAAM,GAAGC,IAAA,IAOF;EAAA,IAPG;MACdC,KAAK;MACLC,QAAQ;MACRC,aAAa;MACbC,KAAK;MACLC,KAAK,EAAEC;IAEF,CAAC,GAAAN,IAAA;IADHO,IAAA,GAAAC,6BAAA,CAAAR,IAAA,EAAAS,SAAA;EAEH,MAAMJ,KAAK,GAAGX,gBAAgB,CAACY,cAAc,CAAC;EAC9C,MAAM;IAAEI,YAAY;IAAEC,WAAW;IAAEC;EAAe,CAAC,GAAGnB,cAAc,CAAC;IACnEY,KAAK;IACLH,QAAQ;IACRD,KAAK;IACLG;EACF,CAAC,CAAC;EAEF,MAAMS,KAAK,GACTlB,OAAO,IAAIA,OAAO,CAACmB,KAAK,KAAK,CAAC,IAAInB,OAAO,CAACoB,KAAK,IAAI,EAAE,GACjD;IACEJ,WAAW;IACXC;EACF,CAAC,GACDrB,QAAQ,CAACyB,EAAE,KAAK,KAAK,GACrB;IACEC,gBAAgB,EAAEN,WAAW;IAC7BO,UAAU,EAAEN,cAAc;IAC1BO,gBAAgB,EAAET;EACpB,CAAC,GACD;IACEQ,UAAU,EAAEN,cAAc;IAC1BQ,UAAU,EAAE;MACVC,IAAI,EAAEV,WAAW;MACjBW,KAAK,EAAEX;IACT;EACF,CAAC;EAEP,OACEtB,KAAA,CAAAkC,aAAA,CAAC/B,YAAY,EAAAgC,QAAA;IACXvB,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEA,QAAS;IACnBC,aAAa,EAAED,QAAQ,GAAGJ,SAAS,GAAGK;EAAc,GAChDU,KAAK,EACLN,IAAI,CACT,CAAC;AAEN,CAAC;AAED,eAAeR,MAAM","ignoreList":[]},"metadata":{"hasCjsExports":false},"sourceType":"module","externalDependencies":[]}