UNPKG

@nayan-ui/react-native

Version:

React Native Component Library for smooth and faster mobile application development.

93 lines (92 loc) 4.11 kB
"use strict"; import * as React from 'react'; import { Platform, View } from 'react-native'; import Animated, { Extrapolation, interpolate, useAnimatedStyle, useDerivedValue, withSpring } from 'react-native-reanimated'; import * as ProgressPrimitive from '@rn-primitives/progress'; import { cn } from "../../lib/utils.js"; import { jsx as _jsx } from "react-native-css-interop/jsx-runtime"; const Progress = /*#__PURE__*/React.forwardRef(({ className, value, indicatorClassName, ...props }, ref) => { return _jsx(ProgressPrimitive.Root, { ref: ref, className: cn('relative h-4 w-full overflow-hidden rounded-full bg-secondary', className), ...props, children: _jsx(Indicator, { value: value, className: indicatorClassName }) }); }); Progress.displayName = ProgressPrimitive.Root.displayName; export { Progress }; const _worklet_12942368909940_init_data = { code: "function progressTsx1(){const{value}=this.__closure;var _value;return(_value=value)!==null&&_value!==void 0?_value:0;}", location: "/home/runner/work/nayan-ui/nayan-ui/packages/react-native/src/components/ui/progress.tsx", sourceMap: "{\"version\":3,\"names\":[\"progressTsx1\",\"value\",\"__closure\",\"_value\"],\"sources\":[\"/home/runner/work/nayan-ui/nayan-ui/packages/react-native/src/components/ui/progress.tsx\"],\"mappings\":\"AAuBmC,SAAAA,aAAA,QAAAC,KAAA,OAAAC,SAAA,KAAAC,MAAA,QAAAA,MAAA,CAAMF,KAAK,UAAAE,MAAA,UAAAA,MAAA,CAAI\",\"ignoreList\":[]}", version: "3.19.1" }; const _worklet_15477788370438_init_data = { code: "function progressTsx2(){const{withSpring,interpolate,progress,Extrapolation}=this.__closure;return{width:withSpring(interpolate(progress.value,[0,100],[1,100],Extrapolation.CLAMP)+\"%\",{overshootClamping:true})};}", location: "/home/runner/work/nayan-ui/nayan-ui/packages/react-native/src/components/ui/progress.tsx", sourceMap: "{\"version\":3,\"names\":[\"progressTsx2\",\"withSpring\",\"interpolate\",\"progress\",\"Extrapolation\",\"__closure\",\"width\",\"value\",\"CLAMP\",\"overshootClamping\"],\"sources\":[\"/home/runner/work/nayan-ui/nayan-ui/packages/react-native/src/components/ui/progress.tsx\"],\"mappings\":\"AAyBqC,SAAAA,YAAMA,CAAA,QAAAC,UAAA,CAAAC,WAAA,CAAAC,QAAA,CAAAC,aAAA,OAAAC,SAAA,CACvC,MAAO,CACLC,KAAK,CAAEL,UAAU,CAAIC,WAAW,CAACC,QAAQ,CAACI,KAAK,CAAE,CAAC,CAAC,CAAE,GAAG,CAAC,CAAE,CAAC,CAAC,CAAE,GAAG,CAAC,CAAEH,aAAa,CAACI,KAAK,CAAC,KAAK,CAAEC,iBAAiB,CAAE,IAAK,CAAC,CAC3H,CAAC,CACH\",\"ignoreList\":[]}", version: "3.19.1" }; function Indicator({ value, className }) { const progress = useDerivedValue(function () { const _e = [new global.Error(), -2, -27]; const progressTsx1 = () => value ?? 0; progressTsx1.__closure = { value }; progressTsx1.__workletHash = 12942368909940; progressTsx1.__initData = _worklet_12942368909940_init_data; progressTsx1.__stackDetails = _e; return progressTsx1; }()); const indicator = useAnimatedStyle(function () { const _e = [new global.Error(), -5, -27]; const progressTsx2 = function () { return { width: withSpring(`${interpolate(progress.value, [0, 100], [1, 100], Extrapolation.CLAMP)}%`, { overshootClamping: true }) }; }; progressTsx2.__closure = { withSpring, interpolate, progress, Extrapolation }; progressTsx2.__workletHash = 15477788370438; progressTsx2.__initData = _worklet_15477788370438_init_data; progressTsx2.__stackDetails = _e; return progressTsx2; }()); if (Platform.OS === 'web') { return _jsx(View, { className: cn('h-full w-full flex-1 bg-primary web:transition-all', className), style: { transform: `translateX(-${100 - (value ?? 0)}%)` }, children: _jsx(ProgressPrimitive.Indicator, { className: cn('h-full w-full', className) }) }); } return _jsx(ProgressPrimitive.Indicator, { asChild: true, children: _jsx(Animated.View, { style: indicator, className: cn('h-full bg-foreground', className) }) }); } //# sourceMappingURL=progress.js.map