@webority/mobile-ui 0.131.0 → 0.133.0
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/dist/canvas-kit/kit.js +6126 -5992
- package/dist/canvas-kit/manifest.json +48 -3
- package/dist/canvas-kit/release.json +6 -6
- package/lib/commonjs/components/AppBar/AppBar.js +1 -1
- package/lib/commonjs/components/AuthedImage/authedImageCache.js +1 -1
- package/lib/commonjs/components/AuthedImage/imageStore.js +1 -0
- package/lib/commonjs/components/AuthedImage/imageStore.web.js +1 -0
- package/lib/commonjs/components/BarChart/BarChart.js +1 -1
- package/lib/commonjs/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/commonjs/components/Composer/Composer.js +1 -1
- package/lib/commonjs/components/FileViewer/FileViewer.js +1 -1
- package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
- package/lib/commonjs/components/ScannerOverlay/ScannerOverlay.js +1 -1
- package/lib/commonjs/components/Screen/Screen.js +1 -1
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/commonjs/components/Switch/Switch.js +1 -1
- package/lib/commonjs/components/WheelPicker/Wheel.js +1 -1
- package/lib/commonjs/navigation/NavigationScreen.js +1 -1
- package/lib/commonjs/network/NetworkStatusBanner.js +1 -1
- package/lib/commonjs/theme/merge.js +1 -1
- package/lib/commonjs/theme/tokens.generated.js +1 -1
- package/lib/module/components/AppBar/AppBar.js +1 -1
- package/lib/module/components/AuthedImage/authedImageCache.js +1 -1
- package/lib/module/components/AuthedImage/imageStore.js +1 -0
- package/lib/module/components/AuthedImage/imageStore.web.js +1 -0
- package/lib/module/components/BarChart/BarChart.js +1 -1
- package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/module/components/Composer/Composer.js +1 -1
- package/lib/module/components/FileViewer/FileViewer.js +1 -1
- package/lib/module/components/OTPInput/OTPInput.js +1 -1
- package/lib/module/components/ScannerOverlay/ScannerOverlay.js +1 -1
- package/lib/module/components/Screen/Screen.js +1 -1
- package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/module/components/Switch/Switch.js +1 -1
- package/lib/module/components/WheelPicker/Wheel.js +1 -1
- package/lib/module/navigation/NavigationScreen.js +1 -1
- package/lib/module/network/NetworkStatusBanner.js +1 -1
- package/lib/module/theme/merge.js +1 -1
- package/lib/module/theme/tokens.generated.js +1 -1
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +3 -1
- package/lib/typescript/commonjs/components/AuthedImage/imageStore.d.ts +7 -0
- package/lib/typescript/commonjs/components/AuthedImage/imageStore.web.d.ts +7 -0
- package/lib/typescript/commonjs/components/ChoiceGroup/ChoiceGroup.d.ts +3 -3
- package/lib/typescript/commonjs/components/Composer/Composer.d.ts +3 -0
- package/lib/typescript/commonjs/components/Screen/Screen.d.ts +4 -0
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +2 -1
- package/lib/typescript/commonjs/navigation/NavigationScreen.d.ts +2 -2
- package/lib/typescript/commonjs/network/NetworkStatusBanner.d.ts +7 -2
- package/lib/typescript/commonjs/theme/tokens.generated.d.ts +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +5 -1
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +3 -1
- package/lib/typescript/module/components/AuthedImage/imageStore.d.ts +7 -0
- package/lib/typescript/module/components/AuthedImage/imageStore.web.d.ts +7 -0
- package/lib/typescript/module/components/ChoiceGroup/ChoiceGroup.d.ts +3 -3
- package/lib/typescript/module/components/Composer/Composer.d.ts +3 -0
- package/lib/typescript/module/components/Screen/Screen.d.ts +4 -0
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +2 -1
- package/lib/typescript/module/navigation/NavigationScreen.d.ts +2 -2
- package/lib/typescript/module/network/NetworkStatusBanner.d.ts +7 -2
- package/lib/typescript/module/theme/tokens.generated.d.ts +1 -1
- package/lib/typescript/module/theme/types.d.ts +5 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,Platform,StyleSheet,TextInput,View}from"react-native";import{KeyboardStickyView}from"react-native-keyboard-controller";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useControllableState}from"../../hooks/useControllableState.js";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveFieldTextStyle}from"../FieldBase/FieldBase.js";import{IconButton}from"../IconButton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_COMPOSER_LABELS=Object.freeze({send:"Send",message:"Message"});const MIN_BOX=44,RING_MS=900,RING_WIDTH=1.5;export const Composer=forwardRef(({onSend:e,value:t,onChangeText:o,placeholder:a,accessibilityLabel:s,hint:i,labels:r,loading:n=!1,onStop:l,stopLabel:d="Stop",disabled:c=!1,canSend:u,ring:m=!1,sendReveal:p="always",
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,Platform,StyleSheet,TextInput,View}from"react-native";import{KeyboardStickyView}from"react-native-keyboard-controller";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useControllableState}from"../../hooks/useControllableState.js";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveFieldTextStyle}from"../FieldBase/FieldBase.js";import{IconButton}from"../IconButton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_COMPOSER_LABELS=Object.freeze({send:"Send",message:"Message"});const MIN_BOX=44,RING_MS=900,RING_WIDTH=1.5;export const Composer=forwardRef(({onSend:e,value:t,onChangeText:o,placeholder:a,accessibilityLabel:s,hint:i,labels:r,loading:n=!1,onStop:l,stopLabel:d="Stop",disabled:c=!1,canSend:u,ring:m=!1,sendReveal:p="always",sendIcon:b="send",maxLength:g,maxLines:f=5,leading:h,trailing:x,above:S,below:y,keyboardAware:C=!0,keyboardOffset:v,safeArea:j=!0,autoFocus:w,haptic:A,style:I,testID:E},_)=>{const L=useTheme(),R=useSafeAreaInsets(),T=useMemo(()=>buildStyles(L),[L]),D=r?{...DEFAULT_COMPOSER_LABELS,...r}:DEFAULT_COMPOSER_LABELS,[M,k]=useControllableState({value:t,defaultValue:"",onChange:o}),O=M.trim(),V=n&&void 0!==l,B=n||c||!(u??""!==O),F=j?R.bottom:0,z=v??F,H=resolveFieldTextStyle(L,{disabled:c}),P=L.text.base.size,N=Math.round(P*L.leading.body),W=(44-N)/2,U=N*f+2*W,[$,G]=useState(void 0),K=useCallback(e=>{const t=e.nativeEvent.contentSize.height+2*W;G(Math.min(Math.max(t,44),U))},[W,U]),q=useReducedMotion(),X=useRef(new Animated.Value(0)).current;useEffect(()=>{if(!m||q)return void X.setValue(m?1:0);const e=Animated.loop(Animated.sequence([Animated.timing(X,{toValue:1,duration:900,easing:Easing.inOut(Easing.ease),useNativeDriver:!1}),Animated.timing(X,{toValue:0,duration:900,easing:Easing.inOut(Easing.ease),useNativeDriver:!1})]));return e.start(),()=>e.stop()},[m,q,X]);const J=m?{borderWidth:1.5,borderColor:X.interpolate({inputRange:[0,1],outputRange:[L.colors["border-subtle"],L.colors.primary]})}:null,Q="always"===p||n||""!==M||!0===u,Y=useCallback(()=>{V?l?.():B||(k(""),e(O))},[V,l,B,k,e,O]),Z=_jsxs(View,{style:[T.bar,{paddingBottom:L.space.sm+F},I],testID:E,children:[S,_jsxs(View,{style:T.row,children:[h,_jsx(Animated.View,{style:[T.box,c?T.boxDisabled:null,J],testID:E?`${E}-box`:void 0,children:_jsx(TextInput,{ref:_,value:M,onChangeText:k,multiline:!0,maxLength:g,editable:!c,autoFocus:w,placeholder:a??D.message,placeholderTextColor:H.placeholderColor,selectionColor:L.colors["field-caret"],accessibilityLabel:s??a??D.message,accessibilityHint:i,accessibilityState:{disabled:c},"aria-disabled":c,onContentSizeChange:"web"===Platform.OS?K:void 0,style:[T.input,{color:H.color,...H.weightStyle,fontSize:P,lineHeight:N,paddingVertical:W,maxHeight:U,height:"web"===Platform.OS?$:void 0}],testID:E?`${E}-input`:void 0})}),x,Q?_jsx(IconButton,{icon:V?"stop":b,accessibilityLabel:V?d:D.send,variant:"solid",tone:"primary",disabled:V?c:B,loading:n&&!V,haptic:A,onPress:Y,testID:E?`${E}-send`:void 0}):null]}),y]});return C?_jsx(KeyboardStickyView,{offset:{closed:0,opened:z},children:Z}):Z});Composer.displayName="Composer";const buildStyles=e=>StyleSheet.create({bar:{gap:e.space.xs,paddingHorizontal:e.space.md,paddingTop:e.space.sm,backgroundColor:e.colors.bg,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:e.colors["border-subtle"]},row:{flexDirection:"row",alignItems:"flex-end",gap:e.space.sm},box:{flex:1,minHeight:44,justifyContent:"center",backgroundColor:e.colors["field-bg"],borderRadius:e.radius.pill,...smoothCorners,paddingHorizontal:e.space.md},boxDisabled:{backgroundColor:e.colors["field-bg-disabled"]},input:{margin:e.space.none,paddingHorizontal:e.space.none,includeFontPadding:!1,textAlignVertical:"top"}});export default Composer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Logger}from"@webority/mobile-core";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{PixelRatio,ScrollView,StyleSheet,useWindowDimensions,View}from"react-native";import{GestureDetector,GestureHandlerRootView}from"react-native-gesture-handler";import Animated from"react-native-reanimated";import PdfRasterizer from"../../specs/NativePdfRasterizer.js";import{useTheme}from"../../theme/index.js";import{Spinner}from"../Spinner/index.js";import{FileViewerImage}from"./FileViewerImage.js";import{FileViewerPage}from"./FileViewerPage.js";import{localPathFromSource,resolveKind}from"./fileSource.js";import{useFileViewerZoom,ZOOM_REST}from"./useFileViewerZoom.js";import{jsx as _jsx}from"react/jsx-runtime";const MAX_RENDER_SCALE=5,RENDER_OVERSCALE=1.25,RENDER_AHEAD=3,MOUNT_AROUND=2,DEFAULT_MAX_ZOOM=4,toError=e=>e instanceof Error?e:new Error(String(e)),scaleForWidth=(e,t,r)=>{if(t<=0)return 1;const i=e/t*PixelRatio.get()*1.25*r;return Math.round(100*Math.min(Math.max(i,1),5))/100},AnimatedScrollView=Animated.createAnimatedComponent(ScrollView),FileViewerPdf=({source:e,onLoadComplete:t,onPageChanged:r,onError:i,loadingIndicator:o,zoomEnabled:s=!0,maxZoom:
|
|
1
|
+
"use strict";import{Logger}from"@webority/mobile-core";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{PixelRatio,ScrollView,StyleSheet,useWindowDimensions,View}from"react-native";import{GestureDetector,GestureHandlerRootView}from"react-native-gesture-handler";import Animated from"react-native-reanimated";import PdfRasterizer from"../../specs/NativePdfRasterizer.js";import{useTheme}from"../../theme/index.js";import{Spinner}from"../Spinner/index.js";import{FileViewerImage}from"./FileViewerImage.js";import{FileViewerPage}from"./FileViewerPage.js";import{localPathFromSource,resolveKind}from"./fileSource.js";import{useFileViewerZoom,ZOOM_REST}from"./useFileViewerZoom.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const MAX_RENDER_SCALE=5,RENDER_OVERSCALE=1.25,RENDER_AHEAD=3,MOUNT_AROUND=2,DEFAULT_MAX_ZOOM=4,toError=e=>e instanceof Error?e:new Error(String(e)),scaleForWidth=(e,t,r)=>{if(t<=0)return 1;const i=e/t*PixelRatio.get()*1.25*r;return Math.round(100*Math.min(Math.max(i,1),5))/100},AnimatedScrollView=Animated.createAnimatedComponent(ScrollView),FileViewerPdf=({source:e,onLoadComplete:t,onPageChanged:r,onError:i,loadingIndicator:o,zoomEnabled:s=!0,maxZoom:n=4,style:a,testID:l,accessibilityLabel:c})=>{const u=useTheme().space.sm,{width:d,height:h}=useWindowDimensions(),[m,f]=useState({width:0,height:0}),w=m.width>0?m.width:d,[g,p]=useState(0),[R,S]=useState({width:612,height:792}),y=R.height/R.width,[E,x]=useState({}),[b,V]=useState(null),[j,_]=useState(0),v=useRef(0),F=useRef(null),P=useRef(null),M=useRef(i);M.current=i;const z=useRef(t);z.current=t;const A=useRef(r);A.current=r;const C=useRef(o);C.current=o;const O=w*y,D=O+u,L=m.height>0?m.height:h,{scrollRef:Z,scrollGesture:T,zoomGesture:k,zoomStyle:I,zoomLevel:W,resetZoom:G}=useFileViewerZoom({zoomEnabled:s,maxZoom:n,viewportWidth:m.width>0?m.width:d,viewportHeight:L,maxScroll:Math.max(0,g*D-u-L)}),N=useMemo(()=>({uri:e.uri,headers:e.headers,client:e.client,cache:e.cache}),[e.uri,e.headers,e.client,e.cache]);useEffect(()=>{let e=!1;return(async()=>{if(PdfRasterizer)try{const t=await localPathFromSource(N);if(e)return;const r=await PdfRasterizer.open(t);if(e)return void await PdfRasterizer.close(r.handle).catch(()=>{});F.current=r.handle,v.current=0,p(r.pageCount),_(0),x({}),V(null),G(),r.pageWidth>0&&r.pageHeight>0&&S({width:r.pageWidth,height:r.pageHeight}),z.current?.(r.pageCount)}catch(t){if(!e){const e=toError(t);Logger.error("[@webority/mobile-ui] FileViewer failed to load.",e),M.current?.(e)}}else M.current?.(new Error("[@webority/mobile-ui] PdfRasterizer native module is not linked. Run pod install / rebuild the app after adding @webority/mobile-ui."))})(),()=>{e=!0;const t=F.current;F.current=null,t&&PdfRasterizer?.close(t).catch(()=>{})}},[N,G]);const H=scaleForWidth(w,R.width,1),U=W>ZOOM_REST?scaleForWidth(w,R.width,Math.ceil(W)):0,K=useRef(H);K.current=H;const X=useRef(U);X.current=U;const $=useRef(H);useEffect(()=>{$.current!==H&&($.current=H,x({}))},[H]);const q=useCallback(async()=>{const e=F.current;if(!e||!PdfRasterizer||0===g)return;if(P.current===e)return;let t;if(void 0===E[j])t={page:j,scale:H,sharp:!1};else if(U>H&&null!==E[j]&&(b?.page!==j||b.scale!==U))t={page:j,scale:U,sharp:!0};else for(let e=1;e<=3&&!t;e+=1)for(const r of[j+e,j-e])if(r>=0&&r<g&&void 0===E[r]){t={page:r,scale:H,sharp:!1};break}if(!t)return;const{page:r,scale:i,sharp:o}=t;P.current=e;let s=null;try{s=await PdfRasterizer.renderPage(e,r,i)}catch(t){F.current===e&&Logger.error(`[@webority/mobile-ui] FileViewer failed to render page ${r}.`,toError(t))}finally{P.current===e&&(P.current=null)}F.current===e&&(i===(o?X.current:K.current)?o?V({page:r,scale:i,uri:s}):x(e=>({...e,[r]:s})):x(e=>({...e})))},[H,j,g,E,b,U]);useEffect(()=>{q()},[q]),useEffect(()=>{W<=ZOOM_REST&&V(null)},[W]);const B=useCallback(e=>{const{width:t,height:r}=e.nativeEvent.layout;f(e=>e.width===t&&e.height===r?e:{width:t,height:r})},[]),J=useCallback(e=>{if(D<=0||0===g)return;const t=Math.min(g-1,Math.max(0,Math.round(e.nativeEvent.contentOffset.y/D)));t!==v.current&&(v.current=t,_(t),A.current?.(t+1,g))},[g,D]),Q=useCallback(()=>C.current?.()??_jsx(Spinner,{size:"lg"}),[]),Y=useMemo(()=>({gap:u}),[u]),ee=useMemo(()=>Array.from({length:g},(e,t)=>t),[g]),te=W>ZOOM_REST;return _jsxs(GestureHandlerRootView,{style:[styles.root,a],onLayout:B,testID:l,accessible:void 0!==c,accessibilityLabel:c,accessibilityRole:"none",children:[_jsx(GestureDetector,{gesture:k,children:_jsx(View,{style:styles.viewport,collapsable:!1,children:_jsx(Animated.View,{style:[styles.viewport,I],children:_jsx(GestureDetector,{gesture:T,children:_jsx(AnimatedScrollView,{ref:Z,onScroll:J,scrollEventThrottle:16,scrollEnabled:!te,showsVerticalScrollIndicator:!te,contentContainerStyle:Y,children:ee.map(e=>_jsx(FileViewerPage,{width:w,height:O,uri:te&&b?.page===e&&b.uri?b.uri:E[e],mounted:Math.abs(e-j)<=2,renderLoading:Q},e))})})})})}),0===g&&_jsx(View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,styles.pagePlaceholder],children:o?o():_jsx(Spinner,{size:"lg"})})]})};export const FileViewer=({kind:e="auto",...t})=>"image"===resolveKind(e,t.source.uri)?_jsx(FileViewerImage,{...t}):_jsx(FileViewerPdf,{...t});FileViewer.displayName="FileViewer";const styles=StyleSheet.create({root:{flex:1,overflow:"hidden"},viewport:{flex:1},pagePlaceholder:{flex:1,alignItems:"center",justifyContent:"center"}});export default FileViewer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useEffect,useImperativeHandle,useMemo,useRef,useState}from"react";import{Animated,Easing,Pressable,StyleSheet,TextInput,View}from"react-native";import{useControllableState,useReducedMotion}from"../../hooks/index.js";import{createAnimatedValue,fontFor,resolveOtpInputSize,setNativeValue,useTheme}from"../../theme/index.js";import{triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{FieldBase,FieldMessage,hasFieldText}from"../FieldBase/FieldBase.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_OTP_INPUT_LABELS=Object.freeze({field:e=>`Enter ${e}-digit code`});const sanitizeChar=(e,t)=>e?"number-pad"===t?e.replace(/\D/g,""):e:"",OTPInput=forwardRef((e,t)=>{const{value:n,defaultValue:i,onChange:s,onComplete:r,length:a=6,keyboardType:o="number-pad",autoFocus:l=!1,autoFocusDelay:u=0,disabled:c=!1,error:d,size:m="md",secure:p=!1,haptic:f,labels:g,onFocus:h,accessibilityLabel:b,style:y,cellStyle:x,textStyle:T,testID:v}=e;warnInvalidValue("OTPInput","size",e.size,["sm","md","lg"]),warnInvalidValue("OTPInput","keyboardType",e.keyboardType,["number-pad","default"]);const j=g?{...DEFAULT_OTP_INPUT_LABELS,...g}:DEFAULT_OTP_INPUT_LABELS,[I,
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useEffect,useImperativeHandle,useMemo,useRef,useState}from"react";import{Animated,Easing,Pressable,StyleSheet,TextInput,View}from"react-native";import{useControllableState,useReducedMotion}from"../../hooks/index.js";import{createAnimatedValue,fontFor,resolveOtpInputSize,setNativeValue,useTheme}from"../../theme/index.js";import{triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{FieldBase,FieldMessage,hasFieldText}from"../FieldBase/FieldBase.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_OTP_INPUT_LABELS=Object.freeze({field:e=>`Enter ${e}-digit code`});const sanitizeChar=(e,t)=>e?"number-pad"===t?e.replace(/\D/g,""):e:"",OTPInput=forwardRef((e,t)=>{const{value:n,defaultValue:i,onChange:s,onComplete:r,length:a=6,keyboardType:o="number-pad",autoFocus:l=!1,autoFocusDelay:u=0,disabled:c=!1,error:d,size:m="md",secure:p=!1,haptic:f,labels:g,onFocus:h,accessibilityLabel:b,style:y,cellStyle:x,textStyle:T,testID:v}=e;warnInvalidValue("OTPInput","size",e.size,["sm","md","lg"]),warnInvalidValue("OTPInput","keyboardType",e.keyboardType,["number-pad","default"]);const j=g?{...DEFAULT_OTP_INPUT_LABELS,...g}:DEFAULT_OTP_INPUT_LABELS,[I,C]=useControllableState({value:n,defaultValue:i??"",onChange:s}),E=useTheme(),V=useMemo(()=>buildStyles(E),[E]),w=resolveOtpInputSize(E,m),S=E.components["otp-input"][m].radius,A=useRef([]),[k,_]=useState(-1),[F,O]=useState(0),P=useRef(null),z=useRef(createAnimatedValue(0)).current,M=useRef(new Map),R=useMemo(()=>{const e=M.current,t=[];for(let n=0;n<a;n+=1){let i=e.get(n);i||(i=new Animated.Value(0),e.set(n,i)),t.push(i)}for(const t of Array.from(e.keys()))t>=a&&e.delete(t);return t},[a]),D=useRef(-1),L=E.settings.components["otp-input"]?.shakeOnError??!1,N=useReducedMotion(),B=!0===d||hasFieldText(d);useEffect(()=>{let e;return null===P.current||!B||P.current||(f&&triggerHaptic("notificationError"),L&&!N&&(setNativeValue(z,0),e=Animated.sequence([Animated.timing(z,{toValue:1,duration:E.motion.duration.instant,easing:Easing.linear,useNativeDriver:!0}),Animated.timing(z,{toValue:-1,duration:E.motion.duration.instant,easing:Easing.linear,useNativeDriver:!0}),Animated.timing(z,{toValue:1,duration:E.motion.duration.instant,easing:Easing.linear,useNativeDriver:!0}),Animated.timing(z,{toValue:0,duration:E.motion.duration.instant,easing:Easing.linear,useNativeDriver:!0})]),e.start())),P.current=B,()=>e?.stop()},[B,z,L,f,N,E.motion.duration.instant]),useEffect(()=>{const e=D.current;if(D.current=k,e===k)return;if(-1===e&&-1===k)return;const t=[];return R.forEach((n,i)=>{const s=i===k?1:0;if(i!==k&&i!==e)return;const r=Animated.timing(n,{toValue:s,duration:E.motion.duration.fast,easing:Easing.bezier(...E.motion.ease["in-out"]),useNativeDriver:!0});r.start(),t.push(r)}),()=>t.forEach(e=>{e.stop()})},[k,R,E]);const H=useCallback(e=>{const t=A.current[e];t&&t.focus()},[]);useImperativeHandle(t,()=>({focus:()=>H(0),blur:()=>{const e=A.current[k>=0?k:0];e?.blur()},clear:()=>{C(""),H(0)}}),[H,k,C]),useEffect(()=>{if(l&&!c){const e=setTimeout(()=>H(0),u);return()=>clearTimeout(e)}},[l,u,c,H]);const U=useMemo(()=>{const e=new Array(a).fill("");for(let t=0;t<Math.min(I.length,a);t+=1)e[t]=I[t]??"";return e},[I,a]),W=useCallback(e=>{const t=e.slice(0,a);t!==I&&(C(t),t.length===a&&r&&r(t))},[a,C,r,I]),$=useCallback((e,t)=>{const n=t.replace(/\u200B/g,""),i=sanitizeChar(n,o);if(!i){const t=U.slice(),n=(t[e]??"").length>0;if(t[e]="",W(t.join("").slice(0,a)),!n&&e>0){const t=U.slice();t[e-1]="",W(t.join("")),H(e-1)}return}const s=U[e]??"",r=s&&i.length>a&&i.startsWith(s)?i.slice(s.length):i;if(r.length>=a){const t=r.slice(0,a),n=I.length;return W(t),t.length!==n&&f&&triggerHaptic(f),void A.current[e]?.blur()}const l=U.slice();let u=e;for(let e=0;e<i.length&&u<a;e+=1)l[u]=i[e]??"",u+=1;const c=l.join("").slice(0,a),d=I.length;W(c),c.length!==d&&f&&triggerHaptic(f);const m=Math.min(u,a-1);u>=a?A.current[e]?.blur():H(m)},[U,H,o,a,f,W,I]),q=useCallback((e,t)=>{if("Backspace"!==t.nativeEvent.key)return;if(0===(U[e]??"").length){if(e>0){const t=U.slice();t[e-1]="",W(t.join("")),H(e-1)}}else{const t=U.slice();t[e]="",W(t.join(""))}},[U,H,W]),G=useCallback((e,t)=>{_(e),h?.(t)},[h]),K=useCallback(()=>{_(-1)},[]),X=useCallback(()=>{if(c)return;const e=U.indexOf("");H(-1===e?a-1:e)},[U,c,H,a]),J=useCallback(e=>{O(e.nativeEvent.layout.width)},[]),Q=b??j.field(a),Y=F>0?Math.max(24,Math.min(w.cell,Math.floor((F-w.gap*(a-1))/a))):w.cell,Z=z.interpolate({inputRange:[-1,1],outputRange:[-6,6]});return _jsxs(View,{style:y,onLayout:J,accessible:!0,accessibilityRole:"none",accessibilityLabel:Q,accessibilityValue:{text:n},accessibilityState:{disabled:c},"aria-disabled":c,testID:v,children:[_jsx(Pressable,{onPress:X,disabled:c,accessible:!1,children:_jsx(Animated.View,{style:[V.row,{columnGap:w.gap,transform:[{translateX:Z}]}],children:U.map((e,t)=>{const n=k===t,i=e.length>0,s=B?E.colors["danger-border"]:E.colors["focus-ring"],r=R[t];if(!r)return null;const l=p&&i?"●":e;return _jsxs(View,{style:V.cellWrapper,children:[_jsxs(FieldBase,{size:m,width:Y,height:Y,radius:S,borderWidth:1.5,focused:n,error:B,filled:i,disabled:c,paddingHorizontal:E.space.none,paddingVertical:E.space.none,gap:E.space.none,style:x,children:[_jsx(TextInput,{ref:e=>{A.current[t]=e},value:(p&&i?"":e)||"",onChangeText:e=>$(t,e),onKeyPress:e=>q(t,e),onFocus:e=>G(t,e),onBlur:K,keyboardType:o,editable:!c,selectTextOnFocus:!0,caretHidden:i,maxLength:a+1,textContentType:"oneTimeCode",autoComplete:0===t?"sms-otp":"off",importantForAutofill:0===t?"yes":"no",style:[V.input,{fontSize:w.text,color:E.colors["text-body"],...fontFor(E,"semibold")},T]}),p&&i?_jsx(View,{pointerEvents:"none",style:V.maskOverlay,children:_jsx(Text,{variant:"body",weight:"semibold",style:[{fontSize:w.text},T],children:l})}):null]}),_jsx(Animated.View,{style:[V.underline,{backgroundColor:s,opacity:r}]})]},`otp-cell-${t}`)})})}),_jsx(FieldMessage,{size:m,error:!0,text:d})]})});OTPInput.displayName="OTPInput";const buildStyles=e=>StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},cellWrapper:{alignItems:"center"},input:{width:"100%",height:"100%",textAlign:"center",padding:e.space.none},maskOverlay:{...StyleSheet.absoluteFill,alignItems:"center",justifyContent:"center"},underline:{marginTop:e.space.xs,height:2,width:"60%",borderRadius:e.radius.pill,...smoothCorners}});export{OTPInput};export default OTPInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,StyleSheet,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{AppIcon}from"../AppIcon/index.js";import{Button}from"../Button/index.js";import{EmptyState}from"../EmptyState/index.js";import{IconButton}from"../IconButton/index.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const MIN_FRAME=240,DEFAULT_FRAME=260,MARK_LENGTH=32,MARK_THICKNESS=4,
|
|
1
|
+
"use strict";import{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,StyleSheet,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{AppIcon}from"../AppIcon/index.js";import{Button}from"../Button/index.js";import{EmptyState}from"../EmptyState/index.js";import{IconButton}from"../IconButton/index.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const MIN_FRAME=240,DEFAULT_FRAME=260,MARK_LENGTH=32,MARK_THICKNESS=4,BREATHE_SCALE=1.03,SNAP_SCALE=1.08,T=4,CORNERS=[{key:"tl",style:{top:0,left:0,borderTopWidth:4,borderLeftWidth:4}},{key:"tr",style:{top:0,right:0,borderTopWidth:4,borderRightWidth:4}},{key:"bl",style:{bottom:0,left:0,borderBottomWidth:4,borderLeftWidth:4}},{key:"br",style:{bottom:0,right:0,borderBottomWidth:4,borderRightWidth:4}}];export const DEFAULT_SCANNER_OVERLAY_LABELS=Object.freeze({hint:"Point the camera at the code",found:"Code found",invalid:"This code cannot be used. Try another.",torchOn:"Turn torch on",torchOff:"Turn torch off",manualEntry:"Enter code instead",gallery:"Upload from gallery",noPermissionTitle:"Camera access is off",noPermissionMessage:"Allow camera access to scan a code.",permissionAction:"Allow camera access",noCameraTitle:"No camera found",noCameraMessage:"This device has no camera available. You can still add the code another way."});const ScannerOverlay=forwardRef((e,t)=>{warnInvalidValue("ScannerOverlay","state",e.state,["scanning","found","invalid","noPermission","noCamera"]);const{children:o,state:n="scanning",helperText:i,labels:s,torch:a=!1,onTorchChange:r,onManualEntry:l,onGallery:c,onPermissionAction:d,frameSize:m=DEFAULT_FRAME,haptic:u,style:h,testID:f}=e,p=useTheme(),g=useSafeAreaInsets(),y=useReducedMotion(),x=useMemo(()=>buildStyles(p),[p]),b=useMemo(()=>({...DEFAULT_SCANNER_OVERLAY_LABELS,...s}),[s]),j=i??b.hint,[v,S]=useState({width:0,height:0}),[w,A]=useState(0),E="scanning"===n||"found"===n||"invalid"===n,_=useRef(createAnimatedValue(1)).current,V=p.motion.duration.slower,C=p.motion.duration.default;useEffect(()=>{if(_.setValue(1),y)return;let e;return"scanning"===n&&V>0?e=Animated.loop(Animated.sequence([Animated.timing(_,{toValue:1.03,duration:2*V,useNativeDriver:!0}),Animated.timing(_,{toValue:1,duration:2*V,useNativeDriver:!0})])):"found"===n&&C>0&&(_.setValue(1.08),e=Animated.timing(_,{toValue:1,duration:C,useNativeDriver:!0})),e?.start(),()=>e?.stop()},[n,y,V,C,_]);const R=useRef(n);useEffect(()=>{R.current!==n&&(R.current=n,!1!==u&&("found"===n?triggerHaptic("notificationSuccess"):"invalid"===n&&triggerHaptic("notificationError")))},[n,u]);const{found:M,invalid:I}=b,{noPermissionTitle:L,noPermissionMessage:P}=b,{noCameraTitle:k,noCameraMessage:N}=b;useEffect(()=>{switch(n){case"scanning":announce(j);break;case"found":announce(M);break;case"invalid":announce(I,{polite:!1});break;case"noPermission":announce(`${L}. ${P}`);break;case"noCamera":announce(`${k}. ${N}`)}},[n,j,M,I,L,P,k,N]);const O=Math.max(240,Math.min(m,v.width-2*p.space.xl)),F=(v.width-O)/2,B=Math.max(p.space.md,(v.height-w-O)/2),D=v.width>0&&v.height>0,H={borderColor:"found"===n?p.colors.success:"invalid"===n?p.colors.danger:p.colors["on-scrim"],width:32,height:32},z="found"===n||"invalid"===n?_jsx(View,{style:[x.pill,{backgroundColor:"found"===n?p.colors.success:p.colors.danger}],children:_jsx(Text,{variant:"bodySmall",weight:"semibold",align:"center",style:{color:"found"===n?p.colors["on-success"]:p.colors["on-danger"]},children:"found"===n?M:I})}):_jsx(Text,{variant:"bodySmall",align:"center",style:{color:p.colors["on-scrim"]},children:j}),W=E&&null!=r,U=E?"glass":"outline";return _jsxs(View,{ref:t,testID:f,onLayout:e=>{const{width:t,height:o}=e.nativeEvent.layout;S(e=>e.width===t&&e.height===o?e:{width:t,height:o})},style:[x.root,!E&&{backgroundColor:p.colors.bg},h],children:[E?_jsx(View,{style:StyleSheet.absoluteFill,children:o}):null,E&&D?_jsx(_Fragment,{children:_jsxs(View,{pointerEvents:"none",style:StyleSheet.absoluteFill,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:[_jsx(View,{style:[x.scrim,{left:0,right:0,top:0,height:B}]}),_jsx(View,{style:[x.scrim,{left:0,right:0,top:B+O,bottom:0}]}),_jsx(View,{style:[x.scrim,{left:0,width:F,top:B,height:O}]}),_jsx(View,{style:[x.scrim,{left:F+O,right:0,top:B,height:O}]}),_jsx(Animated.View,{style:{position:"absolute",left:F,top:B,width:O,height:O,transform:[{scale:_}]},children:CORNERS.map(e=>_jsx(View,{style:[x.mark,H,e.style]},e.key))})]})}):null,E?null:_jsx(View,{style:x.panel,children:_jsx(EmptyState,{fill:!0,icon:_jsx(AppIcon,{name:"noPermission"===n?"camera":"camera-slash",size:48,color:p.colors["text-subtle"]}),title:"noPermission"===n?L:k,description:"noPermission"===n?P:N,action:"noPermission"===n&&d?{label:b.permissionAction,onPress:d}:void 0})}),_jsxs(View,{pointerEvents:"box-none",onLayout:e=>{const{height:t}=e.nativeEvent.layout;A(e=>e===t?e:t)},style:[x.bar,{paddingBottom:Math.max(g.bottom,p.space.md)}],children:[E&&D?_jsx(View,{pointerEvents:"none",style:x.message,children:z}):null,_jsxs(View,{style:x.actions,children:[W?_jsx(IconButton,{icon:a?"flash":"flash-slash",variant:"glass",size:"lg",active:a,haptic:u,accessibilityLabel:a?b.torchOff:b.torchOn,onPress:()=>r?.(!a)}):null,c?_jsx(Button,{label:b.gallery,leftIcon:"gallery",variant:U,tone:"neutral",size:"lg",haptic:u,onPress:c}):null,l?_jsx(Button,{label:b.manualEntry,leftIcon:"keyboard",variant:U,tone:"neutral",size:"lg",haptic:u,onPress:l}):null]})]})]})});ScannerOverlay.displayName="ScannerOverlay";const buildStyles=e=>StyleSheet.create({root:{flex:1,overflow:"hidden"},scrim:{position:"absolute",backgroundColor:e.colors.scrim},mark:{position:"absolute"},message:{alignItems:"center",paddingHorizontal:e.space.xl},pill:{paddingHorizontal:e.space.md,paddingVertical:e.space.xs,borderRadius:e.radius.pill,...smoothCorners},panel:{...StyleSheet.absoluteFill,justifyContent:"center"},bar:{position:"absolute",left:0,right:0,bottom:0,flexDirection:"column",alignItems:"center",justifyContent:"center",gap:e.space.sm,paddingHorizontal:e.space.md},actions:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"center",gap:e.space.sm}});export{ScannerOverlay};export default ScannerOverlay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{cloneElement,createElement,isValidElement,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,BackHandler,FlatList,StyleSheet,View}from"react-native";import{KeyboardStickyView}from"react-native-keyboard-controller";import{useSharedValue}from"react-native-reanimated";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useRefreshControl}from"../../hooks/useRefreshControl.js";import{resolveFloatingActionButtonSize,useTheme}from"../../theme/index.js";import{AppBar}from"../AppBar/index.js";import{AsyncBlock}from"../AsyncBlock/index.js";import{EmptyState}from"../EmptyState/index.js";import{KeyboardAwareScrollView}from"../KeyboardAwareScrollView/index.js";import{KeyboardToolbar}from"../KeyboardToolbar/index.js";import{PagedListFooter}from"../PagedListFooter/index.js";import{ScrollHostContext}from"./ScrollHost.js";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{};function renderFooter(e){return isValidElement(e)?e:e?createElement(e):null}const topPaddingOf=e=>{const t=StyleSheet.flatten(e),o=t?.paddingTop??t?.paddingVertical??t?.padding;return"number"==typeof o?o:0},buildStyles=e=>StyleSheet.create({flex:{flex:1},root:{flex:1,backgroundColor:e.colors.bg},overlay:{position:"absolute",top:0,left:0,right:0},footer:{backgroundColor:e.colors.bg,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:e.colors.border}});export function Screen(e){const{title:t,subtitle:o,largeTitle:
|
|
1
|
+
"use strict";import{cloneElement,createElement,isValidElement,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,BackHandler,FlatList,StyleSheet,View}from"react-native";import{KeyboardStickyView}from"react-native-keyboard-controller";import{useSharedValue}from"react-native-reanimated";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useRefreshControl}from"../../hooks/useRefreshControl.js";import{resolveFloatingActionButtonSize,useTheme}from"../../theme/index.js";import{AppBar}from"../AppBar/index.js";import{AsyncBlock}from"../AsyncBlock/index.js";import{EmptyState}from"../EmptyState/index.js";import{KeyboardAwareScrollView}from"../KeyboardAwareScrollView/index.js";import{KeyboardToolbar}from"../KeyboardToolbar/index.js";import{PagedListFooter}from"../PagedListFooter/index.js";import{ScrollHostContext}from"./ScrollHost.js";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{};function renderFooter(e){return isValidElement(e)?e:e?createElement(e):null}const topPaddingOf=e=>{const t=StyleSheet.flatten(e),o=t?.paddingTop??t?.paddingVertical??t?.padding;return"number"==typeof o?o:0},buildStyles=e=>StyleSheet.create({flex:{flex:1},root:{flex:1,backgroundColor:e.colors.bg},overlay:{position:"absolute",top:0,left:0,right:0},headerRaised:{zIndex:1},footer:{backgroundColor:e.colors.bg,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:e.colors.border}});export function Screen(e){const{title:t,subtitle:o,largeTitle:n=!0,headerShadowOnScroll:r,onBack:l,rightActions:a,leading:s,trailing:i,children:d,onRefresh:c,refreshing:u=!1,footer:f,scroll:m=!0,list:p,edges:h=DEFAULT_EDGES,keyboardToolbar:g=!0,bottomInset:y=0,gutter:S,floatingAction:v,scrollRef:b,onScroll:x,contentContainerStyle:E,testID:C}=e,T=useTheme(),j=S??void 0===p,R=T.space[T.components.screen.gutter],k=j?R:0,L=useSafeAreaInsets(),_=useMemo(()=>buildStyles(T),[T]),[A]=useState(()=>new Animated.Value(0)),[V,w]=useState(0),[F,B]=useState(0),O=void 0!==l,M=useRef(l);M.current=l;const P=Boolean(t||o||l||s||i||a?.length),z=n&&void 0!==t,H=z&&(void 0!==p||m),K=H?V:0,D=P&&!H&&(r??T.settings.components.screen?.headerShadowOnScroll??!0),[I,N]=useState(!1),W=useRef(D);W.current=D;const headerGap=e=>e>0?e:P?T.space.lg:0,G=void 0!==f,{refreshControl:U}=useRefreshControl({onRefresh:c??noop,refreshing:u}),Y=c?cloneElement(U,{progressViewOffset:K}):void 0,q=useSharedValue(0),J=useSharedValue(0),Q=useSharedValue(0),X=useSharedValue(0),Z=useRef(null),$=useRef(0),ee=useRef(0),te=useMemo(()=>({top:q,bottom:J,offset:Q,maxOffset:X,scrollTo:e=>{const t=Z.current;t instanceof FlatList?t.scrollToOffset({offset:e,animated:!1}):t?.scrollTo({y:e,animated:!1})}}),[q,J,Q,X]),oe=useCallback(e=>{Z.current=e,"function"==typeof b?b(e):b&&(b.current=e)},[b]),ne=useCallback(()=>{X.value=Math.max(0,$.current-ee.current)},[X]),re=useRef(x);re.current=x;const le=useMemo(()=>Animated.event([{nativeEvent:{contentOffset:{y:A}}}],{useNativeDriver:!1,listener:e=>{if(Q.value=e.nativeEvent.contentOffset.y,W.current){const t=e.nativeEvent.contentOffset.y>0;N(e=>e===t?e:t)}re.current?.(e)}}),[A,Q]),ae=useCallback(e=>{const{height:t}=e.nativeEvent.layout;w(e=>Math.max(e,t))},[]),se=useCallback(e=>{B(e.nativeEvent.layout.height)},[]);useEffect(()=>{if(!O)return;const e=BackHandler.addEventListener("hardwareBackPress",()=>(M.current?.(),!0));return()=>e.remove()},[O]);const ie=h.includes("left")?L.left:0,de=h.includes("right")?L.right:0,ce=h.includes("bottom")?L.bottom:0,ue=h.includes("top")&&!P?L.top:0,fe=T.space[T.components["floating-action-button"]["bottom-offset"]],me=v?.props.bottomOffset??fe,pe=v?resolveFloatingActionButtonSize(T,v.props.size??"md").diameter+me+T.space.lg:0,he=G?Math.max(0,F-L.bottom):y,ge=v?cloneElement(v,{bottomOffset:me+he,position:v.props.position??"bottomRight"}):null,ye=G?pe:Math.max(ce,v?pe+L.bottom:0),Se=y+ye-(G?0:ce),ve=h.filter(e=>"top"!==e&&!("bottom"===e&&G)),be=P?_jsx(View,{style:H?_.overlay:D?_.headerRaised:void 0,onLayout:H?ae:void 0,children:_jsx(AppBar,{title:t,subtitle:o,variant:z?"large":"default",scrollY:H?A:void 0,elevated:D&&I,onBack:l,rightActions:a,leading:s,trailing:i,gutter:R})}):null,xe=useCallback(()=>{const e=Z.current?.getNativeScrollRef();e&&e.measureInWindow((e,t,o,n)=>{ee.current=n,q.value=t+K,J.value=t+n,ne()})},[K,q,J,ne]);useEffect(()=>{xe()},[xe]);const Ee=useCallback((e,t)=>{$.current=t,ne()},[ne]);let Ce;if(void 0!==p){const{state:e,paging:t,...o}=p,n=topPaddingOf([o.contentContainerStyle,E]),handleEndReached=e=>{t?.hasMore&&!t.loadingMore&&null==t.errorMore&&t.loadMore(),o.onEndReached?.(e)},r=_jsx(FlatList,{keyboardShouldPersistTaps:"handled",onEndReachedThreshold:t?.5:void 0,...o,ref:oe,refreshControl:Y,onScroll:le,onLayout:e=>{xe(),o.onLayout?.(e)},onContentSizeChange:(e,t)=>{Ee(e,t),o.onContentSizeChange?.(e,t)},onEndReached:t?handleEndReached:o.onEndReached,ListEmptyComponent:e?.empty?_jsx(EmptyState,{...e.empty}):void 0,ListFooterComponent:t||o.ListFooterComponent?_jsxs(_Fragment,{children:[renderFooter(o.ListFooterComponent),t?_jsx(PagedListFooter,{paging:t}):null]}):void 0,scrollEventThrottle:16,style:_.flex,contentContainerStyle:[{paddingTop:K,paddingLeft:ie+k,paddingRight:de+k},{paddingBottom:y+ye},o.contentContainerStyle,E,{paddingTop:K+headerGap(n)}]});Ce=_jsx(ScrollHostContext.Provider,{value:te,children:e?_jsx(AsyncBlock,{loading:e.loading,error:e.error,errorTitle:e.errorTitle,onRetry:e.onRetry,skeleton:e.skeleton,style:[_.flex,{paddingTop:K+headerGap(n)}],children:r}):r})}else Ce=m?_jsx(ScrollHostContext.Provider,{value:te,children:_jsxs(KeyboardAwareScrollView,{ref:oe,refreshControl:Y,onScroll:le,scrollEventThrottle:16,onLayout:xe,onContentSizeChange:Ee,safeAreaEdges:ve,style:_.flex,contentContainerStyle:[{paddingHorizontal:k},E,{paddingTop:K+headerGap(topPaddingOf(E))}],children:[d,Se>0?_jsx(View,{style:{height:Se}}):null]})}):_jsx(View,{style:[_.flex,{paddingLeft:ie+k,paddingRight:de+k,paddingBottom:y+ye},E],children:d});const Te=G?_jsx(KeyboardStickyView,{onLayout:se,style:[_.footer,{paddingLeft:ie+R,paddingRight:de+R,paddingBottom:ce+y}],children:f}):null;return _jsxs(View,{testID:C,style:[_.root,{paddingTop:ue}],children:[H?null:be,Ce,Te,ge,void 0!==p?d:null,H?be:null,g?_jsx(KeyboardToolbar,{}):null]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,resolveSegmentedControlSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{FieldLabel,FieldMessage,hasFieldText}from"../FieldBase/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const LABEL_LINE_HEIGHT_RATIO=1.25,activeInkFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"neutral":return e.colors["text-body"];case"success":return e.colors["success-text"];case"warning":return e.colors["warning-text"];case"danger":return e.colors["danger-text"];default:return e.colors["info-text"]}},SegmentedControl=forwardRef((e,t)=>{const{segments:r,label:i,helperText:s,error:l,value:n,defaultValue:o,onChange:a,size:d="md",fullWidth:c=!0,disabled:u=!1,tone:m="primary",variant:
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,resolveSegmentedControlSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{FieldLabel,FieldMessage,hasFieldText}from"../FieldBase/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const LABEL_LINE_HEIGHT_RATIO=1.25,activeInkFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"neutral":return e.colors["text-body"];case"success":return e.colors["success-text"];case"warning":return e.colors["warning-text"];case"danger":return e.colors["danger-text"];default:return e.colors["info-text"]}},SegmentedControl=forwardRef((e,t)=>{const{segments:r,label:i,helperText:s,error:l,value:n,defaultValue:o,onChange:a,size:d="md",fullWidth:c=!0,disabled:u=!1,tone:m="primary",variant:h="segmented",radius:g,labelLines:p=1,haptic:f,accessibilityLabel:b,style:x,containerStyle:S,segmentStyle:y,selectedIndicatorStyle:v,textStyle:w,labelStyle:C,testID:j}=e;warnInvalidValue("SegmentedControl","size",e.size,["sm","md","lg"]),warnInvalidValue("SegmentedControl","tone",e.tone,["primary","success","warning","danger","info","neutral"]),warnInvalidValue("SegmentedControl","variant",e.variant,["underline","pills","segmented"]);const[I,V]=useControllableState({value:n,defaultValue:o??r[0]?.value,onChange:a}),k=useTheme(),F=k.components["segmented-control"],L=useMemo(()=>buildStyles(k),[k]),_=useMemo(()=>resolveSegmentedControlSize(k,d),[k,d]),z=p>=2?2:1,M=z>1,R="segmented"===h,T="underline"===h,A="pills"===h,E=R?k.space[F["track-padding"]]:0,H=Math.ceil(1.25*_.text)*(z-1),q=F["underline-height"],D=k.space[F["pill-inset"]],B="number"==typeof g?g:g?k.radius[g]:void 0,W=B??k.radius.md,P=void 0===B?k.radius.sm:Math.max(B-E,0),N=B??k.radius.pill,G=B??k.radius.none,[O,X]=useState([]),J=useRef(createAnimatedValue(0)).current,K=Math.max(0,r.findIndex(e=>e.value===I)),Q=O[K],U=Q?.x,Y=useCallback(e=>{const t=k.motion.spring.snappy,r=Animated.spring(J,{toValue:e,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:!0});return r.start(),r},[k.motion.spring.snappy,J]);useEffect(()=>{X(e=>e.length===r.length||0===e.length?e:[])},[r.length]);const Z=useRef(null);useEffect(()=>{if(void 0===U)return;const e=null!==Z.current&&Z.current!==K;if(Z.current=K,!e)return void J.setValue(U);const t=Y(U);return()=>t.stop()},[K,U,Y,J]);const $=useCallback((e,t)=>{const{x:r,width:i}=t.nativeEvent.layout;X(t=>{const s=t[e];if(s&&s.x===r&&s.width===i)return t;const l=t.slice();return l[e]={x:r,width:i},l})},[]),ee=useCallback(e=>{if(u)return;if(e.value===I)return;const t=resolveHaptic(f,"selection");t&&triggerHaptic(t),V(e.value)},[u,V,I,f]),te=R?k.colors.thumb:A?k.colors["primary-soft"]:k.colors.primary,re=R?P:A?N:G,ie=activeInkFor(k,m),se=k.colors["bg-muted"],le=useSquircle(R,W),ne=!0===l||hasFieldText(l),oe=ne&&!u,ae=k.colors["field-border-error"],de=k.size.border,ce=hasFieldText(i),ue=ne?l:s,me=hasFieldText(ue),he=_jsxs(View,{ref:t,accessibilityRole:"radiogroup",accessibilityLabel:b??("string"==typeof i?i:void 0),testID:j,style:[L.track,{...M?{minHeight:_.height+H}:{height:_.height},opacity:u?.55:1,alignSelf:c?"stretch":"flex-start"},R?{borderRadius:W,...smoothCorners,backgroundColor:le.active?"transparent":se,padding:E}:T?{borderBottomColor:oe?ae:k.colors["border-subtle"],borderBottomWidth:StyleSheet.hairlineWidth}:null,S,x],onLayout:le.onLayout,children:[le.active&&le.size?_jsx(SquircleFill,{width:le.size.width,height:le.size.height,radius:W,fill:se,stroke:oe?ae:void 0,strokeWidth:de}):null,_jsxs(View,{style:L.row,children:[Q?_jsx(Animated.View,{pointerEvents:"none",style:[L.thumb,R?M?{top:0,bottom:0}:{top:0,height:_.height-2*E}:A?{top:D,bottom:D,left:D}:{bottom:0,height:q},{width:A?Math.max(Q.width-2*D,0):Q.width,borderRadius:re,...smoothCorners,backgroundColor:te,transform:[{translateX:J}]},v]}):null,r.map((e,t)=>{const r=e.value===I,i=r?ie:k.colors["text-subtle"],s=renderSlotIcon(e.icon,{color:i,size:_.icon,selected:r,disabled:u});return _jsxs(Pressable,{onPress:()=>ee(e),onLayout:e=>$(t,e),disabled:u,accessibilityRole:"radio",accessibilityLabel:e.label,accessibilityState:{checked:r,selected:r,disabled:u},"aria-checked":r,"aria-disabled":u,style:({pressed:e})=>[L.segment,M?L.segmentMultiline:null,{paddingHorizontal:_["padding-x"],opacity:e&&!r?.7:1},y],children:[s?_jsx(View,{style:L.segmentIcon,children:s}):null,_jsx(Text,{variant:"label",weight:r?"semibold":"medium",style:[L.segmentLabel,M?L.segmentLabelMultiline:null,{color:i,fontSize:_.text},w,C],numberOfLines:z,children:e.label})]},String(e.value))})]}),!oe||T||le.active?null:_jsx(View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{borderWidth:de,borderColor:ae,borderRadius:R?W:N,...smoothCorners}]})]});return ce||me?_jsxs(View,{style:{alignSelf:c?"stretch":"flex-start"},children:[ce?_jsx(FieldLabel,{size:d,children:i}):null,he,me?_jsx(FieldMessage,{size:d,text:ue,error:ne}):null]}):he});SegmentedControl.displayName="SegmentedControl";const buildStyles=e=>StyleSheet.create({track:{flexDirection:"row",alignItems:"stretch",position:"relative"},row:{flex:1,flexDirection:"row",alignItems:"stretch",position:"relative",overflow:"hidden"},thumb:{position:"absolute",left:0},segment:{flexGrow:1,flexShrink:1,flexBasis:"auto",flexDirection:"row",alignItems:"center",justifyContent:"center"},segmentIcon:{marginRight:e.space.xs},segmentMultiline:{paddingVertical:e.space.xs},segmentLabel:{includeFontPadding:!1},segmentLabelMultiline:{flexShrink:1,textAlign:"center"}});export{SegmentedControl};export default SegmentedControl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Easing,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,resolveSwitchSize,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{hitSlopMarker}from"../../utils/hitSlop.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{ChoiceText,hasChoiceDetail}from"../FieldBase/ChoiceText.js";import{fieldTextAsString,hasFieldText}from"../FieldBase/FieldBase.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;default:return e.colors.primary}},Switch=forwardRef((e,t)=>{const{value:i,defaultValue:s,onChange:r,disabled:a=!1,size:o="md",tone:n="primary",label:l,description:c,helperText:d,error:u,layout:p="inline",accessibilityLabel:m,haptic:h="selection",bounce:f=!1,style:b,containerStyle:g,trackStyle:w,thumbStyle:y,testID:x,hitSlop:S,...j}=e,T=useTheme(),v=Object.keys(T.components.switch);warnInvalidValue("Switch","size",e.size,v),warnInvalidValue("Switch","tone",e.tone,["primary","success","warning","danger","info","neutral"]),warnInvalidValue("Switch","layout",e.layout,["inline","row"]);const[C,R]=useControllableState({value:i,defaultValue:s??!1,onChange:r}),V=v.includes(o)?o:"md",k=useMemo(()=>resolveSwitchSize(T,V),[T,V]),A=T.colors
|
|
1
|
+
"use strict";import{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Easing,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,resolveSwitchSize,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{hitSlopMarker}from"../../utils/hitSlop.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{ChoiceText,hasChoiceDetail}from"../FieldBase/ChoiceText.js";import{fieldTextAsString,hasFieldText}from"../FieldBase/FieldBase.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;default:return e.colors.primary}},Switch=forwardRef((e,t)=>{const{value:i,defaultValue:s,onChange:r,disabled:a=!1,size:o="md",tone:n="primary",label:l,description:c,helperText:d,error:u,layout:p="inline",accessibilityLabel:m,haptic:h="selection",bounce:f=!1,style:b,containerStyle:g,trackStyle:w,thumbStyle:y,testID:x,hitSlop:S,...j}=e,T=useTheme(),v=Object.keys(T.components.switch);warnInvalidValue("Switch","size",e.size,v),warnInvalidValue("Switch","tone",e.tone,["primary","success","warning","danger","info","neutral"]),warnInvalidValue("Switch","layout",e.layout,["inline","row"]);const[C,R]=useControllableState({value:i,defaultValue:s??!1,onChange:r}),V=v.includes(o)?o:"md",k=useMemo(()=>resolveSwitchSize(T,V),[T,V]),A=T.colors["switch-thumb"],_=useMemo(()=>buildStyles(T),[T]),D="dark"===T.mode?T.colors.neutral:T.colors["surface-disabled"],I=toneColor(T,n),z=S??8,E=useRef(createAnimatedValue(C?1:0)).current;useEffect(()=>{const e=Animated.spring(E,{toValue:C?1:0,damping:T.motion.spring.snappy.damping,stiffness:T.motion.spring.snappy.stiffness,mass:T.motion.spring.snappy.mass,useNativeDriver:!0});return e.start(),()=>e.stop()},[C,E,T.motion.spring.snappy]);const F=useRef(createAnimatedValue(C?1:0)).current;useEffect(()=>{const e=Animated.timing(F,{toValue:C?1:0,duration:T.motion.duration.fast,easing:Easing.out(Easing.ease),useNativeDriver:!1});return e.start(),()=>e.stop()},[C,F,T.motion.duration.fast]);const H=k.padding,M=k["track-width"]-k["thumb-size"]-k.padding,P=E.interpolate({inputRange:[0,1],outputRange:[H,M]}),N=F.interpolate({inputRange:[0,1],outputRange:[D,I]}),L=useRef(createAnimatedValue(1)).current,B=useRef(!0);useEffect(()=>{if(!f)return;if(B.current)return void(B.current=!1);const e=Animated.sequence([Animated.spring(L,{toValue:1.15,damping:10,stiffness:220,mass:1,useNativeDriver:!0}),Animated.spring(L,{toValue:1,damping:14,stiffness:240,mass:1,useNativeDriver:!0})]);return e.start(),()=>e.stop()},[C,f,L]);const handlePress=e=>{a||(!1!==h&&triggerHaptic(h),R(!C),j.onPressOut?.(e))},O=m??fieldTextAsString(l),q="string"==typeof u?u:void 0,U=hasChoiceDetail({description:c,error:q,helperText:d}),W=hasFieldText(l)||U,X=(!0===u||hasFieldText(u))&&!C&&!a,G="row"===p&&W,J=_jsxs(Animated.View,{style:[_.track,{width:k["track-width"],height:k["track-height"],borderRadius:T.radius.pill,...smoothCorners,backgroundColor:N},w],children:[X?_jsx(View,{pointerEvents:"none",style:[_.errorRing,{borderRadius:T.radius.pill,...smoothCorners,borderWidth:T.size.border,borderColor:T.colors["field-border-error"]}]}):null,_jsx(Animated.View,{style:[_.thumb,T.shadow.card,{backgroundColor:A,width:k["thumb-size"],height:k["thumb-size"],borderRadius:T.radius.pill,...smoothCorners,transform:[{translateX:P},{scale:L}]},y]})]});if(G)return _jsxs(Pressable,{ref:t,onPress:handlePress,disabled:a,accessibilityRole:"switch",accessibilityLabel:O,accessibilityHint:j.accessibilityHint??fieldTextAsString(c),accessibilityState:{checked:C,disabled:a},"aria-checked":C,"aria-disabled":a,testID:x,hitSlop:S,...null==S?{}:hitSlopMarker(S),...j,style:({pressed:e})=>[_.row,_.spreadRow,U?_.rowTop:null,{opacity:a?.55:e?.9:1},g,b],children:[_jsx(ChoiceText,{label:l,description:c,helperText:d,error:q,disabled:a,style:_.spreadText}),J]});const K=_jsx(Pressable,{ref:t,onPress:handlePress,disabled:a,accessibilityRole:"switch",accessibilityLabel:O,accessibilityHint:j.accessibilityHint??fieldTextAsString(c),accessibilityState:{checked:C,disabled:a},"aria-checked":C,"aria-disabled":a,testID:x,hitSlop:z,...hitSlopMarker(z),...j,style:({pressed:e})=>[{opacity:a?.55:e?.9:1},W?null:b],children:J});return W?_jsxs(View,{style:[_.row,U?_.rowTop:null,g,b],children:[K,_jsx(ChoiceText,{label:l,description:c,helperText:d,error:q,disabled:a,style:_.text})]}):g?_jsx(View,{style:g,children:K}):K});Switch.displayName="Switch";const buildStyles=e=>StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},track:{justifyContent:"center"},thumb:{position:"absolute",top:2},errorRing:{...StyleSheet.absoluteFill},rowTop:{alignItems:"flex-start"},text:{marginLeft:e.space.sm},spreadRow:{minHeight:44,justifyContent:"space-between"},spreadText:{flex:1,marginRight:e.space.md}});export{Switch};export default Switch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{memo,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Platform,Pressable,StyleSheet,TextInput,View}from"react-native";import{createAnimatedValue,setNativeValue}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const WHEEL_VISIBLE_ITEMS=5;export const WHEEL_CENTER_OFFSET=Math.floor(2.5);const HAPTIC_DEBOUNCE_MS=35,WEB_SETTLE_MS=120,SCALE_STOPS=[-2,-1,0,1,2],WheelRow=memo(({label:e,index:t,scrollY:n,itemHeight:a,selected:r,theme:
|
|
1
|
+
"use strict";import{Fragment,memo,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Platform,Pressable,StyleSheet,TextInput,View}from"react-native";import{createAnimatedValue,setNativeValue}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const WHEEL_VISIBLE_ITEMS=5;export const WHEEL_CENTER_OFFSET=Math.floor(2.5);const HAPTIC_DEBOUNCE_MS=35,WEB_SETTLE_MS=120,SCALE_STOPS=[-2,-1,0,1,2],WheelRow=memo(({label:e,index:t,scrollY:n,itemHeight:a,selected:r,theme:i,reducedMotion:s,onPress:l,editor:c})=>{const{opacity:o,scale:u}=useMemo(()=>{const e=Animated.subtract(Animated.divide(n,a),t);return{opacity:e.interpolate({inputRange:SCALE_STOPS,outputRange:[.3,.6,1,.6,.3],extrapolate:"clamp"}),scale:e.interpolate({inputRange:SCALE_STOPS,outputRange:[.85,.95,1.05,.95,.85],extrapolate:"clamp"})}},[n,a,t]),m=_jsx(Text,{variant:"h3",weight:r?"semibold":"medium",color:r?"primary":"secondary",numberOfLines:1,maxFontSizeMultiplier:1.5,style:{letterSpacing:i["letter-spacing"].normal},children:e});return _jsx(Animated.View,{style:[styles.row,{height:a},s?{opacity:o}:{opacity:o,transform:[{scale:u}]}],accessible:!1,importantForAccessibility:"no",children:c??(l?_jsx(Pressable,{focusable:!1,accessible:!1,onPress:()=>l(t),style:styles.rowPress,children:m}):m)})});export const Wheel=({label:e,items:t,selectedIndex:n,onIndexChange:a,itemHeight:r,width:i,theme:s,haptic:l,disabled:c,reducedMotion:o,typeable:u,testID:m})=>{const d="web"===Platform.OS,[b,y]=useState(null),f=useRef(!1),h=useRef(null),p=useRef(createAnimatedValue(n*r)).current,x=useRef(n*r),g=useRef(n*r),S=useRef(n),v=useRef(0),E=useRef(null),T=useRef(()=>{}),w=t.length-1;useEffect(()=>{S.current=n;const e=n*r;if(g.current===e)return;if(g.current=e,Math.abs(x.current-e)<1)return;x.current=e,d||setNativeValue(p,e);const t=requestAnimationFrame(()=>{h.current?.scrollTo({y:e,animated:!1})});return()=>cancelAnimationFrame(t)},[n,r,p,d]),useEffect(()=>{const e=x.current,t=requestAnimationFrame(()=>{h.current?.scrollTo({y:e,animated:!1})});return()=>cancelAnimationFrame(t)},[]),useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]);const M=useCallback((e,r)=>{if(!(e===n||e<0||e>w)){if("accessibility"===r){const e=resolveHaptic(l,"denseTick");e&&triggerHaptic(e)}if("keyboard"!==r){const n=t[e];n&&announce(n.accessibilityLabel??n.label)}a(e)}},[n,w,t,l,a]),A=useCallback(()=>{!c&&u&&(f.current=!0,y(String(t[n]?.value??"")))},[c,u,t,n]),_=useCallback(e=>{if(!f.current)return;f.current=!1,y(null);const n=e.trim();if(!/^\d+$/.test(n))return;const a=Number(n),r=t.findIndex(e=>e.value===a);r>=0&&M(r,"keyboard")},[t,M]);T.current=()=>{E.current=null;const e=Math.max(0,Math.min(w,Math.round(x.current/r))),t=e*r;Math.abs(x.current-t)>=1&&h.current?.scrollTo({y:t,animated:!o}),M(e,"scroll")};const j=useMemo(()=>Animated.event([{nativeEvent:{contentOffset:{y:p}}}],{useNativeDriver:!d,listener:e=>{const t=e.nativeEvent.contentOffset.y;x.current=t;const n=Math.round(t/r);if(n!==S.current&&n>=0&&n<=w){const e=Date.now();if(e-v.current>=35){const t=resolveHaptic(l,"denseTick");t&&triggerHaptic(t),v.current=e}S.current=n}d&&(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>T.current(),120))}}),[p,r,w,l,d]),C=useCallback(e=>{const t=e.nativeEvent.contentOffset.y;M(Math.max(0,Math.min(w,Math.round(t/r))),"scroll")},[M,w,r]),R=useCallback(e=>{if(c)return;const t=e.nativeEvent.actionName;"increment"===t?M(Math.min(w,n+1),"accessibility"):"decrement"===t&&M(Math.max(0,n-1),"accessibility")},[c,M,w,n]),F=useCallback(e=>{c||h.current?.scrollTo({y:e*r,animated:!o})},[c,r,o]),k=useCallback(({item:t,index:a})=>{const i=a===n,l=i&&null!==b;return _jsx(WheelRow,{label:t.label,index:a,scrollY:p,itemHeight:r,selected:i,theme:s,reducedMotion:o,onPress:i&&u?A:d?F:void 0,editor:l?_jsx(TextInput,{autoFocus:!0,selectTextOnFocus:!0,keyboardType:"number-pad",returnKeyType:"done",accessibilityLabel:e,value:b,onChangeText:y,onSubmitEditing:()=>_(b),onBlur:()=>_(b),style:{width:"100%",padding:s.space.none,textAlign:"center",fontSize:s.text.xl.size,color:s.colors["text-body"],fontWeight:s.weight.semibold,letterSpacing:s["letter-spacing"].normal}}):void 0})},[p,r,n,s,o,d,F,u,A,b,_,e]),I=useCallback((e,t)=>`${String(e.value)}-${t}`,[]),L=t[n]?t[n].accessibilityLabel??t[n].label:"",P=d?{focusable:!0,role:"spinbutton","aria-label":e,"aria-valuetext":L,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":w,"aria-disabled":c,onKeyDown:e=>{if(c)return;const t={ArrowDown:Math.min(w,n+1),PageDown:Math.min(w,n+1),ArrowUp:Math.max(0,n-1),PageUp:Math.max(0,n-1),Home:0,End:w}[e.key];void 0!==t&&(e.preventDefault?.(),M(t,"keyboard"))}}:void 0;return _jsxs(View,{style:[void 0===i?styles.columnFlex:{width:i},{height:5*r},styles.column,c?styles.disabled:null],testID:m,...P,children:[d?null:_jsx(View,{pointerEvents:"none",style:styles.a11yLayer,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:e,accessibilityValue:{text:L},accessibilityState:{disabled:Boolean(c)},"aria-disabled":Boolean(c),accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:R}),_jsx(Animated.ScrollView,{ref:h,showsVerticalScrollIndicator:!1,snapToInterval:r,snapToAlignment:"start",decelerationRate:"fast",bounces:!1,scrollEnabled:!c,nestedScrollEnabled:!0,scrollEventThrottle:16,onScroll:j,onMomentumScrollEnd:C,contentOffset:{x:0,y:n*r},contentContainerStyle:{paddingVertical:r*WHEEL_CENTER_OFFSET},style:[styles.list,{height:5*r}],importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:t.map((e,t)=>_jsx(Fragment,{children:k({item:e,index:t})},I(e,t)))})]})};const styles=StyleSheet.create({column:{overflow:"hidden"},columnFlex:{flex:1},disabled:{opacity:.5},list:{flexGrow:0},row:{alignItems:"center",justifyContent:"center"},rowPress:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",flex:1},a11yLayer:{...StyleSheet.absoluteFill,zIndex:2}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{BottomTabBarHeightContext}from"@react-navigation/bottom-tabs";import{useNavigation}from"@react-navigation/native";import{useContext}from"react";import{Screen}from"../components/Screen/index.js";import{useTheme}from"../theme/index.js";import{jsx as _jsx}from"react/jsx-runtime";const TAB_EDGES=["top"];export function NavigationScreen({kind:t="pushed",appBar:e=!0,onBack:o,...i}){const n=useNavigation(),r=useContext(BottomTabBarHeightContext),a=!0===useTheme().settings.components.screen?.tabBarFloats,s=e?i:{...i,title:void 0,subtitle:void 0,leading:void 0,rightActions:void 0};return _jsx(Screen,"tab"===t?{...s,largeTitle:!
|
|
1
|
+
"use strict";import{BottomTabBarHeightContext}from"@react-navigation/bottom-tabs";import{useNavigation}from"@react-navigation/native";import{useContext}from"react";import{Screen}from"../components/Screen/index.js";import{useTheme}from"../theme/index.js";import{jsx as _jsx}from"react/jsx-runtime";const TAB_EDGES=["top"];export function NavigationScreen({kind:t="pushed",appBar:e=!0,onBack:o,...i}){const n=useNavigation(),r=useContext(BottomTabBarHeightContext),a=!0===useTheme().settings.components.screen?.tabBarFloats,s=e?i:{...i,title:void 0,subtitle:void 0,leading:void 0,trailing:void 0,rightActions:void 0};return _jsx(Screen,"tab"===t?{...s,largeTitle:!1,edges:TAB_EDGES,bottomInset:a?r??0:0}:{...s,largeTitle:!1,onBack:"root"!==t&&e?o??n.goBack:void 0})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useNetworkStatus}from"@webority/mobile-core";import{useEffect,useMemo,useRef,useState}from"react";import{Animated,StyleSheet,Text}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePresenceMotion}from"../hooks/usePresenceMotion.js";import{fontFor,useTheme}from"../theme/index.js";import{jsx as _jsx}from"react/jsx-runtime";export const NetworkStatusBanner=({message:e="You are offline. Some features may be unavailable.",
|
|
1
|
+
"use strict";import{useNetworkStatus}from"@webority/mobile-core";import{useEffect,useMemo,useRef,useState}from"react";import{Animated,StyleSheet,Text}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePresenceMotion}from"../hooks/usePresenceMotion.js";import{fontFor,useTheme}from"../theme/index.js";import{jsx as _jsx}from"react/jsx-runtime";export const NetworkStatusBanner=({message:e="You are offline. Some features may be unavailable.",restoredMessage:t="You are back online.",restoredDuration:o=2e3,position:n="top",style:s,disabled:r=!1,safeArea:i=!0})=>{const a=useTheme(),u=usePresenceMotion(),l=useSafeAreaInsets(),d=i?"top"===n?l.top:l.bottom:0,[c,m]=useState(0),f=c>0?c:56+d,{isConnected:p,isInternetReachable:b}=useNetworkStatus(),g=!(r||p&&!1!==b),[h,S]=useState("hidden"),[x,y]=useState("offline");useEffect(()=>{"hidden"!==h&&y(h)},[h]),useEffect(()=>{S(g?"offline":r?"hidden":e=>"offline"===e?"restored":e)},[g,r]),useEffect(()=>{if("restored"!==h)return;const e=setTimeout(()=>S("hidden"),o);return()=>clearTimeout(e)},[h,o]);const v="hidden"!==h,A="restored"===h||"hidden"===h&&"restored"===x,w=useRef(new Animated.Value(0)).current,R=useRef(new Animated.Value(0)).current,j=u.duration("default");useEffect(()=>{Animated.parallel([Animated.timing(w,{toValue:v?1:0,duration:a.motion.duration.default,useNativeDriver:!0}),Animated.timing(R,{toValue:v?1:0,duration:j,useNativeDriver:!0})]).start()},[v,w,R,a.motion.duration.default,j]);const k=useMemo(()=>buildStyles(a),[a]),E=w.interpolate({inputRange:[0,1],outputRange:u.range("top"===n?-f:f,0)});return _jsx(Animated.View,{pointerEvents:v?"auto":"none",accessibilityRole:"alert",accessibilityLiveRegion:v?"polite":"none",onLayout:e=>m(e.nativeEvent.layout.height),style:[k.container,"top"===n?k.top:k.bottom,"top"===n?{paddingTop:a.space.sm+d}:{paddingBottom:a.space.sm+d},{backgroundColor:A?a.colors["online-fill"]:a.colors["offline-fill"],opacity:R,transform:[{translateY:E}]},s],children:_jsx(Text,{style:{color:A?a.colors["on-success"]:a.colors["on-danger"],fontSize:a.text.sm.size,...fontFor(a,"semibold"),textAlign:"center"},numberOfLines:2,children:A?t:e})})};const buildStyles=e=>StyleSheet.create({container:{position:"absolute",left:0,right:0,paddingVertical:e.space.sm,paddingHorizontal:e.space.lg,zIndex:1e3,elevation:8},top:{top:0},bottom:{bottom:0}});export default NetworkStatusBanner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{validateComponentTokens}from"./componentSizes.js";import{COLOR_NAMES,FONT_NAMES,RADIUS_NAMES,WEIGHT_NAMES}from"./tokens.generated.js";import{deriveSolidFill,deriveStateFills,deriveToneInk}from"./toneInk.js";const HINT="Run webority upgrade to rename old names.",BRAND_KEYS=["colors","radius","font"],COLOR_MODES=["light","dark"],FIXED_RADII=["none","pill"],RADIUS_ALLOWED="sm, md, lg, xl",SETTINGS_KEYS=["icons","gradients","textVariants","maxFontSizeMultiplier","components"],COMPONENT_SETTING_KEYS={field:{defaultVariant:!0,requiredMarker:!0},input:{defaultVariant:!0,defaultLabelMode:!0,tintLabelOnFocus:!0,shakeOnError:!0},"search-bar":{defaultVariant:!0},select:{defaultVariant:!0},"otp-input":{shakeOnError:!0},"option-sheet":{selectedMarker:!0},"profile-picker":{defaultTone:!0,defaultVariant:!0,defaultAvatarTone:!0},slider:{thumbPressAnimation:!0},rating:{pulseOnPress:!0},stepper:{pulseAnimation:!0},tooltip:{enableScaleAnimation:!0},toast:{enableSwipeDismiss:!0,defaultDurationMs:!0},button:{defaultVariant:!0,defaultSize:!0,defaultPressAnimation:!0},card:{defaultVariant:!0,defaultPadding:!0,defaultRadius:!0,defaultTitleFont:!0},"section-header":{defaultVariant:!0,defaultFlush:!0},"empty-state":{defaultSize:!0,defaultVariant:!0},screen:{tabBarFloats:!0}},isPlainObject=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),validateBrand=t=>{if(void 0===t)return;if(!isPlainObject(t))throw new Error(`A brand is an object of colors, radius and font; got ${typeof t}. ${HINT}`);for(const e of Object.keys(t))if(!BRAND_KEYS.includes(e))throw new Error(`A brand sets colors, radius and font only; ${e} is not allowed (allowed: colors, radius, font). ${HINT}`);const e=t.colors;if(void 0!==e&&!isPlainObject(e))throw new Error(`A brand's colors is an object of light and dark; got ${typeof e}. ${HINT}`);for(const t of Object.keys(e??{})){if(!COLOR_MODES.includes(t))throw new Error(`A brand sets colours under light and dark only; ${t} is not allowed (allowed: light, dark). ${HINT}`);const o=e[t];for(const t of Object.keys(o)){if(!COLOR_NAMES.includes(t))throw new Error(`unknown colour ${t}; allowed: ${COLOR_NAMES.join(", ")}. ${HINT}`);if(void 0!==o[t]&&"string"!=typeof o[t])throw new Error(`colour ${t} must be a string; got ${typeof o[t]}.`)}}const o=t.radius;if(void 0!==o&&!isPlainObject(o))throw new Error(`A brand's radius is an object of radius names; got ${typeof o}. ${HINT}`);for(const t of Object.keys(o??{})){const e=o[t];if(!RADIUS_NAMES.includes(t))throw new Error(`unknown radius ${t}; allowed: ${RADIUS_ALLOWED}. ${HINT}`);if(FIXED_RADII.includes(t))throw new Error(`radius ${t} is fixed by the library; allowed: ${RADIUS_ALLOWED}.`);if("number"!=typeof e||!Number.isFinite(e))throw new Error(`radius ${t} must be a number; got ${typeof e}.`)}const n=t.font;if(void 0!==n&&!isPlainObject(n))throw new Error(`A brand's font is an object of font names; got ${typeof n}. ${HINT}`);for(const t of Object.keys(n??{})){if(!FONT_NAMES.includes(t))throw new Error(`unknown font ${t}; allowed: ${FONT_NAMES.join(", ")}. ${HINT}`);const e=n[t];if(!isPlainObject(e))throw new Error(`font ${t} must be an object of weights; got ${typeof e}. ${HINT}`);for(const o of Object.keys(e)){if(!WEIGHT_NAMES.includes(o))throw new Error(`unknown font weight ${o} in font ${t}; allowed: ${WEIGHT_NAMES.join(", ")}. ${HINT}`);const n=e[o];if("string"!=typeof n||0===n.length)throw new Error(`font ${t} weight ${o} must be a non-empty string.`)}}},validateSettings=t=>{if(void 0===t)return;if(!isPlainObject(t))throw new Error(`Theme settings is an object; got ${typeof t}. ${HINT}`);for(const e of Object.keys(t))if(!SETTINGS_KEYS.includes(e))throw new Error(`Theme settings take ${SETTINGS_KEYS.join(", ")} only; ${e} is not allowed. ${HINT}`);const e=t.components;if(void 0===e)return;if(!isPlainObject(e))throw new Error(`Theme settings components is an object of component names; got ${typeof e}. ${HINT}`);const o=COMPONENT_SETTING_KEYS;for(const t of Object.keys(e)){if(!Object.keys(o).includes(t))throw new Error(`unknown component ${t} in theme settings; allowed: ${Object.keys(COMPONENT_SETTING_KEYS).join(", ")}. ${HINT}`);const n=e[t];if(void 0===n)continue;if(!isPlainObject(n))throw new Error(`theme settings for ${t} is an object; got ${typeof n}. ${HINT}`);const r=o[t];for(const e of Object.keys(n))if(!(e in r))throw new Error(`unknown setting ${e} for ${t}; allowed: ${Object.keys(r).join(", ")}. ${HINT}`)}},TONES=["primary","success","warning","danger","info"];export const mergeBrand=(t,e,o)=>{validateBrand(e),validateSettings(o);const n=Object.fromEntries(Object.entries(e?.colors?.[t.mode]??{}).filter(([,t])=>void 0!==t)),r={...t.colors,...n},i={...t.radius,...e?.radius},s={...t.font};for(const o of Object.keys(e?.font??{}))s[o]={...t.font[o],...e?.font?.[o]};const a=[r.bg,r["bg-subtle"],r["bg-muted"]],l={};for(const e of TONES){const o="string"==typeof n[e];let i=r[e];if(o||"string"==typeof n[`on-${e}`]){const t=deriveSolidFill(i,r[`on-${e}`]);t!==i&&(l[e]=t,i=t)}if(o&&"string"!=typeof n[`${e}-text`]&&(l[`${e}-text`]=deriveToneInk(i,a,t.mode)),"primary"===e&&(o||void 0!==l.primary)){const e=deriveStateFills(i,r["on-primary"],{fill:t.colors.primary,hover:t.colors["primary-hover"],pressed:t.colors["primary-pressed"]});"string"!=typeof n["primary-hover"]&&(l["primary-hover"]=e.hover),"string"!=typeof n["primary-pressed"]&&(l["primary-pressed"]=e.pressed)}}const d={},f=new Set([...Object.keys(t.settings.components),...Object.keys(o?.components??{})]);for(const e of f)d[e]={...t.settings.components[e],...o?.components?.[e]};const c=o?.maxFontSizeMultiplier??t.settings.maxFontSizeMultiplier,u={icons:{...t.settings.icons,...o?.icons},gradients:{...t.settings.gradients,...o?.gradients},textVariants:{...t.settings.textVariants,...o?.textVariants},components:d,...void 0===c?{}:{maxFontSizeMultiplier:c}},p={...t,colors:{...r,...l},radius:i,font:s,settings:u};return validateComponentTokens(p),p};
|
|
1
|
+
"use strict";import{validateComponentTokens}from"./componentSizes.js";import{COLOR_NAMES,FONT_NAMES,RADIUS_NAMES,WEIGHT_NAMES}from"./tokens.generated.js";import{deriveSolidFill,deriveStateFills,deriveToneInk}from"./toneInk.js";const HINT="Run webority upgrade to rename old names.",BRAND_KEYS=["colors","radius","font"],COLOR_MODES=["light","dark"],FIXED_RADII=["none","pill"],RADIUS_ALLOWED="sm, md, lg, xl",SETTINGS_KEYS=["icons","gradients","textVariants","maxFontSizeMultiplier","components"],COMPONENT_SETTING_KEYS={field:{defaultVariant:!0,requiredMarker:!0},input:{defaultVariant:!0,defaultLabelMode:!0,tintLabelOnFocus:!0,shakeOnError:!0},"search-bar":{defaultVariant:!0},select:{defaultVariant:!0},"otp-input":{shakeOnError:!0},"option-sheet":{selectedMarker:!0},"profile-picker":{defaultTone:!0,defaultVariant:!0,defaultAvatarTone:!0},slider:{thumbPressAnimation:!0},rating:{pulseOnPress:!0},stepper:{pulseAnimation:!0},tooltip:{enableScaleAnimation:!0},toast:{enableSwipeDismiss:!0,defaultDurationMs:!0},button:{defaultVariant:!0,defaultSize:!0,defaultPressAnimation:!0},card:{defaultVariant:!0,defaultPadding:!0,defaultRadius:!0,defaultTitleFont:!0},"section-header":{defaultVariant:!0,defaultFlush:!0},"empty-state":{defaultSize:!0,defaultVariant:!0},screen:{tabBarFloats:!0,headerShadowOnScroll:!0}},isPlainObject=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),validateBrand=t=>{if(void 0===t)return;if(!isPlainObject(t))throw new Error(`A brand is an object of colors, radius and font; got ${typeof t}. ${HINT}`);for(const e of Object.keys(t))if(!BRAND_KEYS.includes(e))throw new Error(`A brand sets colors, radius and font only; ${e} is not allowed (allowed: colors, radius, font). ${HINT}`);const e=t.colors;if(void 0!==e&&!isPlainObject(e))throw new Error(`A brand's colors is an object of light and dark; got ${typeof e}. ${HINT}`);for(const t of Object.keys(e??{})){if(!COLOR_MODES.includes(t))throw new Error(`A brand sets colours under light and dark only; ${t} is not allowed (allowed: light, dark). ${HINT}`);const o=e[t];for(const t of Object.keys(o)){if(!COLOR_NAMES.includes(t))throw new Error(`unknown colour ${t}; allowed: ${COLOR_NAMES.join(", ")}. ${HINT}`);if(void 0!==o[t]&&"string"!=typeof o[t])throw new Error(`colour ${t} must be a string; got ${typeof o[t]}.`)}}const o=t.radius;if(void 0!==o&&!isPlainObject(o))throw new Error(`A brand's radius is an object of radius names; got ${typeof o}. ${HINT}`);for(const t of Object.keys(o??{})){const e=o[t];if(!RADIUS_NAMES.includes(t))throw new Error(`unknown radius ${t}; allowed: ${RADIUS_ALLOWED}. ${HINT}`);if(FIXED_RADII.includes(t))throw new Error(`radius ${t} is fixed by the library; allowed: ${RADIUS_ALLOWED}.`);if("number"!=typeof e||!Number.isFinite(e))throw new Error(`radius ${t} must be a number; got ${typeof e}.`)}const n=t.font;if(void 0!==n&&!isPlainObject(n))throw new Error(`A brand's font is an object of font names; got ${typeof n}. ${HINT}`);for(const t of Object.keys(n??{})){if(!FONT_NAMES.includes(t))throw new Error(`unknown font ${t}; allowed: ${FONT_NAMES.join(", ")}. ${HINT}`);const e=n[t];if(!isPlainObject(e))throw new Error(`font ${t} must be an object of weights; got ${typeof e}. ${HINT}`);for(const o of Object.keys(e)){if(!WEIGHT_NAMES.includes(o))throw new Error(`unknown font weight ${o} in font ${t}; allowed: ${WEIGHT_NAMES.join(", ")}. ${HINT}`);const n=e[o];if("string"!=typeof n||0===n.length)throw new Error(`font ${t} weight ${o} must be a non-empty string.`)}}},validateSettings=t=>{if(void 0===t)return;if(!isPlainObject(t))throw new Error(`Theme settings is an object; got ${typeof t}. ${HINT}`);for(const e of Object.keys(t))if(!SETTINGS_KEYS.includes(e))throw new Error(`Theme settings take ${SETTINGS_KEYS.join(", ")} only; ${e} is not allowed. ${HINT}`);const e=t.components;if(void 0===e)return;if(!isPlainObject(e))throw new Error(`Theme settings components is an object of component names; got ${typeof e}. ${HINT}`);const o=COMPONENT_SETTING_KEYS;for(const t of Object.keys(e)){if(!Object.keys(o).includes(t))throw new Error(`unknown component ${t} in theme settings; allowed: ${Object.keys(COMPONENT_SETTING_KEYS).join(", ")}. ${HINT}`);const n=e[t];if(void 0===n)continue;if(!isPlainObject(n))throw new Error(`theme settings for ${t} is an object; got ${typeof n}. ${HINT}`);const r=o[t];for(const e of Object.keys(n))if(!(e in r))throw new Error(`unknown setting ${e} for ${t}; allowed: ${Object.keys(r).join(", ")}. ${HINT}`)}},TONES=["primary","success","warning","danger","info"];export const mergeBrand=(t,e,o)=>{validateBrand(e),validateSettings(o);const n=Object.fromEntries(Object.entries(e?.colors?.[t.mode]??{}).filter(([,t])=>void 0!==t)),r={...t.colors,...n},i={...t.radius,...e?.radius},s={...t.font};for(const o of Object.keys(e?.font??{}))s[o]={...t.font[o],...e?.font?.[o]};const a=[r.bg,r["bg-subtle"],r["bg-muted"]],l={};for(const e of TONES){const o="string"==typeof n[e];let i=r[e];if(o||"string"==typeof n[`on-${e}`]){const t=deriveSolidFill(i,r[`on-${e}`]);t!==i&&(l[e]=t,i=t)}if(o&&"string"!=typeof n[`${e}-text`]&&(l[`${e}-text`]=deriveToneInk(i,a,t.mode)),"primary"===e&&(o||void 0!==l.primary)){const e=deriveStateFills(i,r["on-primary"],{fill:t.colors.primary,hover:t.colors["primary-hover"],pressed:t.colors["primary-pressed"]});"string"!=typeof n["primary-hover"]&&(l["primary-hover"]=e.hover),"string"!=typeof n["primary-pressed"]&&(l["primary-pressed"]=e.pressed)}}const d={},f=new Set([...Object.keys(t.settings.components),...Object.keys(o?.components??{})]);for(const e of f)d[e]={...t.settings.components[e],...o?.components?.[e]};const c=o?.maxFontSizeMultiplier??t.settings.maxFontSizeMultiplier,u={icons:{...t.settings.icons,...o?.icons},gradients:{...t.settings.gradients,...o?.gradients},textVariants:{...t.settings.textVariants,...o?.textVariants},components:d,...void 0===c?{}:{maxFontSizeMultiplier:c}},p={...t,colors:{...r,...l},radius:i,font:s,settings:u};return validateComponentTokens(p),p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export const COLOR_NAMES=["bg","bg-subtle","bg-muted","surface","surface-inverse","surface-dark","surface-dark-border","on-surface-dark","on-surface-dark-muted","text","text-body","text-muted","text-subtle","text-inverse","link","border","border-subtle","field-bg","field-border","field-border-focus","focus-ring","scrim","on-scrim","thumb","primary","primary-hover","primary-soft","primary-text","on-primary","primary-wash","primary-wash-strong","neutral","neutral-hover","neutral-text","on-neutral","success","success-soft","success-text","on-success","warning","warning-soft","warning-text","on-warning","danger","danger-soft","danger-border","danger-text","on-danger","info","info-soft","info-text","on-info","primary-pressed","on-neutral-strong","text-disabled","surface-pressed","surface-hover","surface-selected","surface-disabled","skeleton","skeleton-highlight","glass-fill","glass-border","on-glass","glass-badge","field-bg-focus","field-bg-disabled","field-border-error","field-label","field-text","field-text-disabled","field-placeholder","field-placeholder-disabled","field-icon","field-icon-focus","field-icon-disabled","field-caret","field-message","avatar-1","avatar-2","avatar-3","avatar-4","avatar-5","avatar-6","avatar-7","avatar-8"];export const SPACE_NAMES=["none","xxs","xs","sm","md","lg","xl","2xl","3xl","4xl"];export const RADIUS_NAMES=["none","sm","md","lg","xl","pill"];export const TEXT_NAMES=["xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl"];export const WEIGHT_NAMES=["normal","medium","semibold","bold"];export const LEADING_NAMES=["heading","body","display"];export const LETTER_SPACING_NAMES=["tight","normal","wide"];export const FONT_NAMES=["ui","display","mono"];export const SHADOW_NAMES=["card","elevated","popover","modal","drawer"];export const DURATION_NAMES=["instant","fast","default","slow","slower"];export const EASE_NAMES=["in-out","accelerate","decelerate","sharp"];export const SIZE_NAMES=["border"];export const COMPONENT_KINDS={field:{radius:"radius","padding-x":"space","padding-y":"space","min-height":"px",text:"text",icon:"px","label-text":"text","label-gap":"space","message-text":"text","message-gap":"space"},press:{opacity:"number"},disabled:{opacity:"number"},button:{"padding-x":"space","padding-y":"space","min-height":"px",text:"text",radius:"radius",icon:"px","badge-icon":"px"},input:{"multiline-min-height":"px"},"search-bar":{radius:"radius"},"empty-state":{icon:"px","illustration-size":"px","title-text":"text","description-text":"text","padding-y":"space","title-gap":"space","description-gap":"space"},"list-item":{"padding-y":"space","title-text":"text","subtitle-text":"text","min-height":"px"},badge:{text:"text","min-width":"px",height:"px","padding-x":"space","dot-size":"px","border-width":"px","anchor-offset":"px"},chip:{"padding-x":"space","padding-y":"space",text:"text","min-height":"px","close-size":"px","close-text":"text",gap:"space",icon:"px"},checkbox:{"box-size":"px","label-gap":"space"},radio:{outer:"px",inner:"px","label-gap":"space"},switch:{"track-width":"px","track-height":"px","thumb-size":"px",padding:"space"},"otp-input":{cell:"px",text:"text",radius:"radius",gap:"space"},"segmented-control":{height:"px",text:"text","padding-x":"space",icon:"px","track-padding":"space","underline-height":"px","pill-inset":"space"},tabs:{text:"text","padding-y":"space","padding-x":"space","scrollable-padding-x":"space",icon:"px","icon-gap":"space","track-padding":"space","underline-height":"px","pill-inset":"space","disabled-opacity":"number","badge-gap":"space"},slider:{"track-height":"px","thumb-diameter":"px"},"floating-action-button":{diameter:"px",icon:"px",text:"text","label-padding-x":"space","edge-offset":"space","bottom-offset":"space","secondary-gap":"space","stagger-ms":"ms"},dialog:{"icon-wrapper-size":"px","action-button-min-height":"px"},toast:{"icon-circle-size":"px","icon-glyph-text":"text","tint-bar-width":"px","action-min-height":"px"},banner:{"tint-bar-width":"px"},screen:{gutter:"space"}};export const lightTokens={mode:"light",colors:{bg:"#ffffff","bg-subtle":"#f8f8fb","bg-muted":"#f1f1f5",surface:"#ffffff","surface-inverse":"#0f0f1a","surface-dark":"#071437","surface-dark-border":"#2a3553","on-surface-dark":"#ffffff","on-surface-dark-muted":"#babdc7",text:"#252f4a","text-body":"#0f0f1a","text-muted":"#52525b","text-subtle":"#62626b","text-inverse":"#ffffff",link:"#5b5bd6",border:"#e5e5ec","border-subtle":"#efeff3","field-bg":"#f9fbfc","field-border":"#ebedf3","field-border-focus":"#bed2f9","focus-ring":"#5b5bd6",scrim:"#0f0f1a80","on-scrim":"#ffffff",thumb:"#ffffff",primary:"#5b5bd6","primary-hover":"#4f4fbf","primary-soft":"#eeeefc","primary-text":"#4f4fd3","on-primary":"#ffffff","primary-wash":"#5b5bd614","primary-wash-strong":"#5b5bd633",neutral:"#f4f4f8","neutral-hover":"#e9e9f0","neutral-text":"#52525b","on-neutral":"#0f0f1a",success:"#18864f","success-soft":"#e8faee","success-text":"#147042","on-success":"#ffffff",warning:"#f59e0b","warning-soft":"#fff8e6","warning-text":"#8f5c06","on-warning":"#0f0f1a",danger:"#e12c32","danger-soft":"#ffeaef","danger-border":"#e5484d","danger-text":"#bc1b20","on-danger":"#ffffff",info:"#1b6ef5","info-soft":"#e9f3ff","info-text":"#0958d9","on-info":"#ffffff","primary-pressed":"#4040a8","on-neutral-strong":"#ffffff","text-disabled":"#b4b4bb","surface-pressed":"#0f0f1a0f","surface-hover":"#0f0f1a0a","surface-selected":"#5b5bd61a","surface-disabled":"#f1f1f5",skeleton:"#ebedf3","skeleton-highlight":"#f5f6fa","glass-fill":"#ffffff47","glass-border":"#ffffff73","on-glass":"#0f0f1a","glass-badge":"#ffffff","field-bg-focus":"#ffffff","field-bg-disabled":"#f5f6fa","field-border-error":"#fdbfce","field-label":"#242f4a","field-text":"#252f4a","field-text-disabled":"#7a8197","field-placeholder":"#626d8b","field-placeholder-disabled":"#7a8197","field-icon":"#7a849f","field-icon-focus":"#4b5675","field-icon-disabled":"#c4cada","field-caret":"#5b8dee","field-message":"#d81736","avatar-1":"#5b5bd6","avatar-2":"#0a7979","avatar-3":"#a45a05","avatar-4":"#cd226e","avatar-5":"#2462eb","avatar-6":"#7c3aed","avatar-7":"#047c57","avatar-8":"#d42222"},space:{none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius:{none:0,sm:6,md:10,lg:14,xl:20,pill:9999},text:{xs:{size:11},sm:{size:13},base:{size:15},lg:{size:17},xl:{size:20},"2xl":{size:24},"3xl":{size:30},"4xl":{size:36},"5xl":{size:45},"6xl":{size:57},"7xl":{size:64},"8xl":{size:72}},weight:{normal:"400",medium:"500",semibold:"600",bold:"700"},leading:{heading:1.2,body:1.4,display:1.2},"letter-spacing":{tight:-.2,normal:0,wide:.4},font:{ui:{},display:{},mono:{}},shadow:{card:{shadowColor:"#000000",shadowOffset:{width:0,height:2},shadowOpacity:.059,shadowRadius:4,elevation:2},elevated:{shadowColor:"#000000",shadowOffset:{width:0,height:4},shadowOpacity:.078,shadowRadius:8,elevation:4},popover:{shadowColor:"#000000",shadowOffset:{width:0,height:8},shadowOpacity:.102,shadowRadius:16,elevation:8},modal:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.141,shadowRadius:24,elevation:12},drawer:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.141,shadowRadius:24,elevation:12}},motion:{duration:{instant:80,fast:160,default:240,slow:360,slower:500},ease:{"in-out":[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]}},size:{border:1},components:{field:{sm:{radius:"md","padding-x":"sm","padding-y":"sm","min-height":38,text:"sm",icon:14,"label-text":"xs","label-gap":"xs","message-text":"xs","message-gap":"xxs"},md:{radius:"md","padding-x":"md","padding-y":"md","min-height":44,text:"base",icon:16,"label-text":"sm","label-gap":"xs","message-text":"sm","message-gap":"xxs"},lg:{radius:"md","padding-x":"lg","padding-y":"lg","min-height":52,text:"lg",icon:18,"label-text":"base","label-gap":"xs","message-text":"base","message-gap":"xxs"}},press:{opacity:.85},disabled:{opacity:.55},button:{xs:{"padding-x":"sm","padding-y":"xs","min-height":28,text:"xs",radius:"md",icon:14,"badge-icon":11},sm:{"padding-x":"md","padding-y":"xs","min-height":34,text:"sm",radius:"md",icon:16,"badge-icon":16},md:{"padding-x":"lg","padding-y":"sm","min-height":44,text:"base",radius:"md",icon:18,"badge-icon":18},lg:{"padding-x":"xl","padding-y":"md","min-height":50,text:"lg",radius:"lg",icon:20,"badge-icon":20},xl:{"padding-x":"2xl","padding-y":"md","min-height":58,text:"xl",radius:"lg",icon:22,"badge-icon":22}},input:{sm:{"multiline-min-height":72},md:{"multiline-min-height":92},lg:{"multiline-min-height":110}},"search-bar":{sm:{radius:"pill"},md:{radius:"pill"},lg:{radius:"pill"}},"empty-state":{sm:{icon:48,"illustration-size":96,"title-text":"lg","description-text":"sm","padding-y":"lg","title-gap":"md","description-gap":"xs"},md:{icon:64,"illustration-size":160,"title-text":"xl","description-text":"base","padding-y":"xl","title-gap":"md","description-gap":"xs"},lg:{icon:80,"illustration-size":240,"title-text":"2xl","description-text":"lg","padding-y":"2xl","title-gap":"md","description-gap":"xs"}},"list-item":{sm:{"padding-y":"sm","title-text":"sm","subtitle-text":"xs","min-height":44},md:{"padding-y":"md","title-text":"base","subtitle-text":"sm","min-height":56},lg:{"padding-y":"lg","title-text":"lg","subtitle-text":"base","min-height":72}},badge:{sm:{text:"xs","min-width":16,height:16,"padding-x":"xs","dot-size":8},md:{text:"sm","min-width":20,height:20,"padding-x":"sm","dot-size":10},"border-width":1.5,"anchor-offset":4},chip:{sm:{"padding-x":"sm","padding-y":"xs",text:"xs","min-height":26,"close-size":16,"close-text":"xs",gap:"xs",icon:14},md:{"padding-x":"md","padding-y":"xs",text:"sm","min-height":32,"close-size":18,"close-text":"sm",gap:"sm",icon:16}},checkbox:{sm:{"box-size":16},md:{"box-size":20},lg:{"box-size":24},"label-gap":"sm"},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},"label-gap":"sm"},switch:{sm:{"track-width":42,"track-height":26,"thumb-size":22,padding:"xxs"},md:{"track-width":51,"track-height":31,"thumb-size":27,padding:"xxs"},lg:{"track-width":60,"track-height":36,"thumb-size":32,padding:"xxs"}},"otp-input":{sm:{cell:36,text:"base",radius:"sm",gap:"sm"},md:{cell:48,text:"xl",radius:"md",gap:"sm"},lg:{cell:56,text:"2xl",radius:"lg",gap:"md"}},"segmented-control":{sm:{height:32,text:"sm","padding-x":"sm",icon:14},md:{height:40,text:"base","padding-x":"md",icon:16},lg:{height:48,text:"lg","padding-x":"lg",icon:18},"track-padding":"xs","underline-height":2,"pill-inset":"xs"},tabs:{sm:{text:"sm","padding-y":"sm","padding-x":"xs","scrollable-padding-x":"md",icon:16},md:{text:"base","padding-y":"md","padding-x":"sm","scrollable-padding-x":"lg",icon:18},lg:{text:"lg","padding-y":"lg","padding-x":"md","scrollable-padding-x":"xl",icon:20},"icon-gap":"xs","track-padding":"xs","underline-height":2,"pill-inset":"xs","disabled-opacity":.45,"badge-gap":"xs"},slider:{sm:{"track-height":4,"thumb-diameter":24},md:{"track-height":6,"thumb-diameter":28},lg:{"track-height":8,"thumb-diameter":32}},"floating-action-button":{sm:{diameter:40,icon:18,text:"sm","label-padding-x":"md"},md:{diameter:56,icon:22,text:"base","label-padding-x":"lg"},lg:{diameter:72,icon:28,text:"lg","label-padding-x":"xl"},"edge-offset":"xl","bottom-offset":"xl","secondary-gap":"lg","stagger-ms":50},dialog:{"icon-wrapper-size":48,"action-button-min-height":44},toast:{"icon-circle-size":28,"icon-glyph-text":"lg","tint-bar-width":0,"action-min-height":30},banner:{"tint-bar-width":0},screen:{gutter:"lg"}}};export const darkTokens={mode:"dark",colors:{bg:"#0b0b12","bg-subtle":"#13131c","bg-muted":"#1c1c26",surface:"#1c1c26","surface-inverse":"#fafafa","surface-dark":"#071437","surface-dark-border":"#2a3553","on-surface-dark":"#ffffff","on-surface-dark-muted":"#babdc7",text:"#e2e2e2","text-body":"#fafafa","text-muted":"#b4b4bb","text-subtle":"#919199","text-inverse":"#0f0f1a",link:"#9292ee",border:"#27272f","border-subtle":"#1c1c26","field-bg":"#13131c","field-border":"#27272f","field-border-focus":"#3d5fb0","focus-ring":"#7c7ce8",scrim:"#000000a6","on-scrim":"#ffffff",thumb:"#ffffff",primary:"#7c7ce8","primary-hover":"#9292ee","primary-soft":"#1f1f3d","primary-text":"#8989ea","on-primary":"#0f0f1a","primary-wash":"#7c7ce814","primary-wash-strong":"#7c7ce833",neutral:"#1f1f26","neutral-hover":"#2a2a33","neutral-text":"#b4b4bb","on-neutral":"#fafafa",success:"#30c780","success-soft":"#04b4402e","success-text":"#30c780","on-success":"#0f0f1a",warning:"#fbbf24","warning-soft":"#dfa0002e","warning-text":"#fbbf24","on-warning":"#0f0f1a",danger:"#f87171","danger-soft":"#e826462e","danger-border":"#f87171","danger-text":"#f87171","on-danger":"#0f0f1a",info:"#60a5fa","info-soft":"#056ee92e","info-text":"#60a5fa","on-info":"#0f0f1a","primary-pressed":"#a8a8f2","on-neutral-strong":"#0f0f1a","text-disabled":"#52525b","surface-pressed":"#ffffff14","surface-hover":"#ffffff0d","surface-selected":"#7c7ce82e","surface-disabled":"#1c1c26",skeleton:"#1c1c26","skeleton-highlight":"#27272f","glass-fill":"#ffffff47","glass-border":"#ffffff73","on-glass":"#0f0f1a","glass-badge":"#ffffff","field-bg-focus":"#0b0b12","field-bg-disabled":"#1c1c26","field-border-error":"#8a2f42","field-label":"#e4e6ee","field-text":"#fafafa","field-text-disabled":"#71717a","field-placeholder":"#84848d","field-placeholder-disabled":"#71717a","field-icon":"#8b8b95","field-icon-focus":"#d4d4db","field-icon-disabled":"#52525b","field-caret":"#7c9ef0","field-message":"#f87171","avatar-1":"#8b8bee","avatar-2":"#2dd4bf","avatar-3":"#fcd34d","avatar-4":"#f472b6","avatar-5":"#60a5fa","avatar-6":"#a78bfa","avatar-7":"#34d399","avatar-8":"#f87171"},space:{none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius:{none:0,sm:6,md:10,lg:14,xl:20,pill:9999},text:{xs:{size:11},sm:{size:13},base:{size:15},lg:{size:17},xl:{size:20},"2xl":{size:24},"3xl":{size:30},"4xl":{size:36},"5xl":{size:45},"6xl":{size:57},"7xl":{size:64},"8xl":{size:72}},weight:{normal:"400",medium:"500",semibold:"600",bold:"700"},leading:{heading:1.2,body:1.4,display:1.2},"letter-spacing":{tight:-.2,normal:0,wide:.4},font:{ui:{},display:{},mono:{}},shadow:{card:{shadowColor:"#000000",shadowOffset:{width:0,height:2},shadowOpacity:.4,shadowRadius:4,elevation:2},elevated:{shadowColor:"#000000",shadowOffset:{width:0,height:4},shadowOpacity:.502,shadowRadius:8,elevation:4},popover:{shadowColor:"#000000",shadowOffset:{width:0,height:8},shadowOpacity:.549,shadowRadius:16,elevation:8},modal:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12},drawer:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12}},motion:{duration:{instant:80,fast:160,default:240,slow:360,slower:500},ease:{"in-out":[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]}},size:{border:1},components:{field:{sm:{radius:"md","padding-x":"sm","padding-y":"sm","min-height":38,text:"sm",icon:14,"label-text":"xs","label-gap":"xs","message-text":"xs","message-gap":"xxs"},md:{radius:"md","padding-x":"md","padding-y":"md","min-height":44,text:"base",icon:16,"label-text":"sm","label-gap":"xs","message-text":"sm","message-gap":"xxs"},lg:{radius:"md","padding-x":"lg","padding-y":"lg","min-height":52,text:"lg",icon:18,"label-text":"base","label-gap":"xs","message-text":"base","message-gap":"xxs"}},press:{opacity:.85},disabled:{opacity:.55},button:{xs:{"padding-x":"sm","padding-y":"xs","min-height":28,text:"xs",radius:"md",icon:14,"badge-icon":11},sm:{"padding-x":"md","padding-y":"xs","min-height":34,text:"sm",radius:"md",icon:16,"badge-icon":16},md:{"padding-x":"lg","padding-y":"sm","min-height":44,text:"base",radius:"md",icon:18,"badge-icon":18},lg:{"padding-x":"xl","padding-y":"md","min-height":50,text:"lg",radius:"lg",icon:20,"badge-icon":20},xl:{"padding-x":"2xl","padding-y":"md","min-height":58,text:"xl",radius:"lg",icon:22,"badge-icon":22}},input:{sm:{"multiline-min-height":72},md:{"multiline-min-height":92},lg:{"multiline-min-height":110}},"search-bar":{sm:{radius:"pill"},md:{radius:"pill"},lg:{radius:"pill"}},"empty-state":{sm:{icon:48,"illustration-size":96,"title-text":"lg","description-text":"sm","padding-y":"lg","title-gap":"md","description-gap":"xs"},md:{icon:64,"illustration-size":160,"title-text":"xl","description-text":"base","padding-y":"xl","title-gap":"md","description-gap":"xs"},lg:{icon:80,"illustration-size":240,"title-text":"2xl","description-text":"lg","padding-y":"2xl","title-gap":"md","description-gap":"xs"}},"list-item":{sm:{"padding-y":"sm","title-text":"sm","subtitle-text":"xs","min-height":44},md:{"padding-y":"md","title-text":"base","subtitle-text":"sm","min-height":56},lg:{"padding-y":"lg","title-text":"lg","subtitle-text":"base","min-height":72}},badge:{sm:{text:"xs","min-width":16,height:16,"padding-x":"xs","dot-size":8},md:{text:"sm","min-width":20,height:20,"padding-x":"sm","dot-size":10},"border-width":1.5,"anchor-offset":4},chip:{sm:{"padding-x":"sm","padding-y":"xs",text:"xs","min-height":26,"close-size":16,"close-text":"xs",gap:"xs",icon:14},md:{"padding-x":"md","padding-y":"xs",text:"sm","min-height":32,"close-size":18,"close-text":"sm",gap:"sm",icon:16}},checkbox:{sm:{"box-size":16},md:{"box-size":20},lg:{"box-size":24},"label-gap":"sm"},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},"label-gap":"sm"},switch:{sm:{"track-width":42,"track-height":26,"thumb-size":22,padding:"xxs"},md:{"track-width":51,"track-height":31,"thumb-size":27,padding:"xxs"},lg:{"track-width":60,"track-height":36,"thumb-size":32,padding:"xxs"}},"otp-input":{sm:{cell:36,text:"base",radius:"sm",gap:"sm"},md:{cell:48,text:"xl",radius:"md",gap:"sm"},lg:{cell:56,text:"2xl",radius:"lg",gap:"md"}},"segmented-control":{sm:{height:32,text:"sm","padding-x":"sm",icon:14},md:{height:40,text:"base","padding-x":"md",icon:16},lg:{height:48,text:"lg","padding-x":"lg",icon:18},"track-padding":"xs","underline-height":2,"pill-inset":"xs"},tabs:{sm:{text:"sm","padding-y":"sm","padding-x":"xs","scrollable-padding-x":"md",icon:16},md:{text:"base","padding-y":"md","padding-x":"sm","scrollable-padding-x":"lg",icon:18},lg:{text:"lg","padding-y":"lg","padding-x":"md","scrollable-padding-x":"xl",icon:20},"icon-gap":"xs","track-padding":"xs","underline-height":2,"pill-inset":"xs","disabled-opacity":.45,"badge-gap":"xs"},slider:{sm:{"track-height":4,"thumb-diameter":24},md:{"track-height":6,"thumb-diameter":28},lg:{"track-height":8,"thumb-diameter":32}},"floating-action-button":{sm:{diameter:40,icon:18,text:"sm","label-padding-x":"md"},md:{diameter:56,icon:22,text:"base","label-padding-x":"lg"},lg:{diameter:72,icon:28,text:"lg","label-padding-x":"xl"},"edge-offset":"xl","bottom-offset":"xl","secondary-gap":"lg","stagger-ms":50},dialog:{"icon-wrapper-size":48,"action-button-min-height":44},toast:{"icon-circle-size":28,"icon-glyph-text":"lg","tint-bar-width":0,"action-min-height":30},banner:{"tint-bar-width":0},screen:{gutter:"lg"}}};
|
|
1
|
+
"use strict";export const COLOR_NAMES=["bg","bg-subtle","bg-muted","surface","surface-inverse","surface-dark","surface-dark-border","on-surface-dark","on-surface-dark-muted","text","text-body","text-muted","text-subtle","text-inverse","link","border","border-subtle","field-bg","field-border","field-border-focus","focus-ring","scrim","on-scrim","thumb","primary","primary-hover","primary-soft","primary-text","on-primary","primary-wash","primary-wash-strong","neutral","neutral-hover","neutral-text","on-neutral","success","success-soft","success-text","on-success","warning","warning-soft","warning-text","on-warning","danger","danger-soft","danger-border","danger-text","offline-fill","online-fill","on-danger","info","info-soft","info-text","on-info","primary-pressed","switch-thumb","on-neutral-strong","text-disabled","surface-pressed","surface-hover","surface-selected","surface-disabled","skeleton","skeleton-highlight","glass-fill","glass-border","on-glass","glass-badge","field-bg-focus","field-bg-disabled","field-border-error","field-label","field-text","field-text-disabled","field-placeholder","field-placeholder-disabled","field-icon","field-icon-focus","field-icon-disabled","field-caret","field-message","avatar-1","avatar-2","avatar-3","avatar-4","avatar-5","avatar-6","avatar-7","avatar-8"];export const SPACE_NAMES=["none","xxs","xs","sm","md","lg","xl","2xl","3xl","4xl"];export const RADIUS_NAMES=["none","sm","md","lg","xl","pill"];export const TEXT_NAMES=["xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl"];export const WEIGHT_NAMES=["normal","medium","semibold","bold"];export const LEADING_NAMES=["heading","body","display"];export const LETTER_SPACING_NAMES=["tight","normal","wide"];export const FONT_NAMES=["ui","display","mono"];export const SHADOW_NAMES=["card","elevated","popover","modal","drawer"];export const DURATION_NAMES=["instant","fast","default","slow","slower"];export const EASE_NAMES=["in-out","accelerate","decelerate","sharp"];export const SIZE_NAMES=["border"];export const COMPONENT_KINDS={field:{radius:"radius","padding-x":"space","padding-y":"space","min-height":"px",text:"text",icon:"px","label-text":"text","label-gap":"space","message-text":"text","message-gap":"space"},press:{opacity:"number"},disabled:{opacity:"number"},button:{"padding-x":"space","padding-y":"space","min-height":"px",text:"text",radius:"radius",icon:"px","badge-icon":"px"},input:{"multiline-min-height":"px"},"search-bar":{radius:"radius"},"empty-state":{icon:"px","illustration-size":"px","title-text":"text","description-text":"text","padding-y":"space","title-gap":"space","description-gap":"space"},"list-item":{"padding-y":"space","title-text":"text","subtitle-text":"text","min-height":"px"},badge:{text:"text","min-width":"px",height:"px","padding-x":"space","dot-size":"px","border-width":"px","anchor-offset":"px"},chip:{"padding-x":"space","padding-y":"space",text:"text","min-height":"px","close-size":"px","close-text":"text",gap:"space",icon:"px"},checkbox:{"box-size":"px","label-gap":"space"},radio:{outer:"px",inner:"px","label-gap":"space"},switch:{"track-width":"px","track-height":"px","thumb-size":"px",padding:"space"},"otp-input":{cell:"px",text:"text",radius:"radius",gap:"space"},"segmented-control":{height:"px",text:"text","padding-x":"space",icon:"px","track-padding":"space","underline-height":"px","pill-inset":"space"},tabs:{text:"text","padding-y":"space","padding-x":"space","scrollable-padding-x":"space",icon:"px","icon-gap":"space","track-padding":"space","underline-height":"px","pill-inset":"space","disabled-opacity":"number","badge-gap":"space"},slider:{"track-height":"px","thumb-diameter":"px"},"floating-action-button":{diameter:"px",icon:"px",text:"text","label-padding-x":"space","edge-offset":"space","bottom-offset":"space","secondary-gap":"space","stagger-ms":"ms"},dialog:{"icon-wrapper-size":"px","action-button-min-height":"px"},toast:{"icon-circle-size":"px","icon-glyph-text":"text","tint-bar-width":"px","action-min-height":"px"},banner:{"tint-bar-width":"px"},screen:{gutter:"space"}};export const lightTokens={mode:"light",colors:{bg:"#ffffff","bg-subtle":"#f8f8fb","bg-muted":"#f1f1f5",surface:"#ffffff","surface-inverse":"#0f0f1a","surface-dark":"#071437","surface-dark-border":"#2a3553","on-surface-dark":"#ffffff","on-surface-dark-muted":"#babdc7",text:"#252f4a","text-body":"#0f0f1a","text-muted":"#52525b","text-subtle":"#62626b","text-inverse":"#ffffff",link:"#5b5bd6",border:"#e5e5ec","border-subtle":"#efeff3","field-bg":"#f9fbfc","field-border":"#ebedf3","field-border-focus":"#bed2f9","focus-ring":"#5b5bd6",scrim:"#0f0f1a80","on-scrim":"#ffffff",thumb:"#ffffff",primary:"#5b5bd6","primary-hover":"#4f4fbf","primary-soft":"#eeeefc","primary-text":"#4f4fd3","on-primary":"#ffffff","primary-wash":"#5b5bd614","primary-wash-strong":"#5b5bd633",neutral:"#f4f4f8","neutral-hover":"#e9e9f0","neutral-text":"#52525b","on-neutral":"#0f0f1a",success:"#18864f","success-soft":"#e8faee","success-text":"#147042","on-success":"#ffffff",warning:"#f59e0b","warning-soft":"#fff8e6","warning-text":"#8f5c06","on-warning":"#0f0f1a",danger:"#e12c32","danger-soft":"#ffeaef","danger-border":"#e5484d","danger-text":"#bc1b20","offline-fill":"#e82646","online-fill":"#04b440","on-danger":"#ffffff",info:"#1b6ef5","info-soft":"#e9f3ff","info-text":"#0958d9","on-info":"#ffffff","primary-pressed":"#4040a8","switch-thumb":"#ffffff","on-neutral-strong":"#ffffff","text-disabled":"#b4b4bb","surface-pressed":"#0f0f1a0f","surface-hover":"#0f0f1a0a","surface-selected":"#5b5bd61a","surface-disabled":"#f1f1f5",skeleton:"#ebedf3","skeleton-highlight":"#f5f6fa","glass-fill":"#ffffff47","glass-border":"#ffffff73","on-glass":"#0f0f1a","glass-badge":"#ffffff","field-bg-focus":"#ffffff","field-bg-disabled":"#f5f6fa","field-border-error":"#fdbfce","field-label":"#242f4a","field-text":"#252f4a","field-text-disabled":"#7a8197","field-placeholder":"#626d8b","field-placeholder-disabled":"#7a8197","field-icon":"#7a849f","field-icon-focus":"#4b5675","field-icon-disabled":"#c4cada","field-caret":"#5b8dee","field-message":"#d81736","avatar-1":"#5b5bd6","avatar-2":"#0a7979","avatar-3":"#a45a05","avatar-4":"#cd226e","avatar-5":"#2462eb","avatar-6":"#7c3aed","avatar-7":"#047c57","avatar-8":"#d42222"},space:{none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius:{none:0,sm:6,md:10,lg:14,xl:20,pill:9999},text:{xs:{size:11},sm:{size:13},base:{size:15},lg:{size:17},xl:{size:20},"2xl":{size:24},"3xl":{size:30},"4xl":{size:36},"5xl":{size:45},"6xl":{size:57},"7xl":{size:64},"8xl":{size:72}},weight:{normal:"400",medium:"500",semibold:"600",bold:"700"},leading:{heading:1.2,body:1.4,display:1.2},"letter-spacing":{tight:-.2,normal:0,wide:.4},font:{ui:{},display:{},mono:{}},shadow:{card:{shadowColor:"#000000",shadowOffset:{width:0,height:2},shadowOpacity:.059,shadowRadius:4,elevation:2},elevated:{shadowColor:"#000000",shadowOffset:{width:0,height:4},shadowOpacity:.078,shadowRadius:8,elevation:4},popover:{shadowColor:"#000000",shadowOffset:{width:0,height:8},shadowOpacity:.102,shadowRadius:16,elevation:8},modal:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.141,shadowRadius:24,elevation:12},drawer:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.141,shadowRadius:24,elevation:12}},motion:{duration:{instant:80,fast:160,default:240,slow:360,slower:500},ease:{"in-out":[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]}},size:{border:1},components:{field:{sm:{radius:"md","padding-x":"sm","padding-y":"sm","min-height":38,text:"sm",icon:14,"label-text":"xs","label-gap":"xs","message-text":"xs","message-gap":"xxs"},md:{radius:"md","padding-x":"md","padding-y":"md","min-height":44,text:"base",icon:16,"label-text":"sm","label-gap":"xs","message-text":"sm","message-gap":"xxs"},lg:{radius:"md","padding-x":"lg","padding-y":"lg","min-height":52,text:"lg",icon:18,"label-text":"base","label-gap":"xs","message-text":"base","message-gap":"xxs"}},press:{opacity:.85},disabled:{opacity:.55},button:{xs:{"padding-x":"sm","padding-y":"xs","min-height":28,text:"xs",radius:"md",icon:14,"badge-icon":11},sm:{"padding-x":"md","padding-y":"xs","min-height":34,text:"sm",radius:"md",icon:16,"badge-icon":16},md:{"padding-x":"lg","padding-y":"sm","min-height":44,text:"base",radius:"md",icon:18,"badge-icon":18},lg:{"padding-x":"xl","padding-y":"md","min-height":50,text:"lg",radius:"lg",icon:20,"badge-icon":20},xl:{"padding-x":"2xl","padding-y":"md","min-height":58,text:"xl",radius:"lg",icon:22,"badge-icon":22}},input:{sm:{"multiline-min-height":72},md:{"multiline-min-height":92},lg:{"multiline-min-height":110}},"search-bar":{sm:{radius:"pill"},md:{radius:"pill"},lg:{radius:"pill"}},"empty-state":{sm:{icon:48,"illustration-size":96,"title-text":"lg","description-text":"sm","padding-y":"lg","title-gap":"md","description-gap":"xs"},md:{icon:64,"illustration-size":160,"title-text":"xl","description-text":"base","padding-y":"xl","title-gap":"md","description-gap":"xs"},lg:{icon:80,"illustration-size":240,"title-text":"2xl","description-text":"lg","padding-y":"2xl","title-gap":"md","description-gap":"xs"}},"list-item":{sm:{"padding-y":"sm","title-text":"sm","subtitle-text":"xs","min-height":44},md:{"padding-y":"md","title-text":"base","subtitle-text":"sm","min-height":56},lg:{"padding-y":"lg","title-text":"lg","subtitle-text":"base","min-height":72}},badge:{sm:{text:"xs","min-width":16,height:16,"padding-x":"xs","dot-size":8},md:{text:"sm","min-width":20,height:20,"padding-x":"sm","dot-size":10},"border-width":1.5,"anchor-offset":4},chip:{sm:{"padding-x":"sm","padding-y":"xs",text:"xs","min-height":26,"close-size":16,"close-text":"xs",gap:"xs",icon:14},md:{"padding-x":"md","padding-y":"xs",text:"sm","min-height":32,"close-size":18,"close-text":"sm",gap:"sm",icon:16}},checkbox:{sm:{"box-size":16},md:{"box-size":20},lg:{"box-size":24},"label-gap":"sm"},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},"label-gap":"sm"},switch:{sm:{"track-width":42,"track-height":26,"thumb-size":22,padding:"xxs"},md:{"track-width":51,"track-height":31,"thumb-size":27,padding:"xxs"},lg:{"track-width":60,"track-height":36,"thumb-size":32,padding:"xxs"}},"otp-input":{sm:{cell:36,text:"base",radius:"sm",gap:"sm"},md:{cell:48,text:"xl",radius:"md",gap:"sm"},lg:{cell:56,text:"2xl",radius:"lg",gap:"md"}},"segmented-control":{sm:{height:32,text:"sm","padding-x":"sm",icon:14},md:{height:40,text:"base","padding-x":"md",icon:16},lg:{height:48,text:"lg","padding-x":"lg",icon:18},"track-padding":"xs","underline-height":2,"pill-inset":"xs"},tabs:{sm:{text:"sm","padding-y":"sm","padding-x":"xs","scrollable-padding-x":"md",icon:16},md:{text:"base","padding-y":"md","padding-x":"sm","scrollable-padding-x":"lg",icon:18},lg:{text:"lg","padding-y":"lg","padding-x":"md","scrollable-padding-x":"xl",icon:20},"icon-gap":"xs","track-padding":"xs","underline-height":2,"pill-inset":"xs","disabled-opacity":.45,"badge-gap":"xs"},slider:{sm:{"track-height":4,"thumb-diameter":24},md:{"track-height":6,"thumb-diameter":28},lg:{"track-height":8,"thumb-diameter":32}},"floating-action-button":{sm:{diameter:40,icon:18,text:"sm","label-padding-x":"md"},md:{diameter:56,icon:22,text:"base","label-padding-x":"lg"},lg:{diameter:72,icon:28,text:"lg","label-padding-x":"xl"},"edge-offset":"xl","bottom-offset":"xl","secondary-gap":"lg","stagger-ms":50},dialog:{"icon-wrapper-size":48,"action-button-min-height":44},toast:{"icon-circle-size":28,"icon-glyph-text":"lg","tint-bar-width":0,"action-min-height":30},banner:{"tint-bar-width":0},screen:{gutter:"lg"}}};export const darkTokens={mode:"dark",colors:{bg:"#0b0b12","bg-subtle":"#13131c","bg-muted":"#1c1c26",surface:"#1c1c26","surface-inverse":"#fafafa","surface-dark":"#071437","surface-dark-border":"#2a3553","on-surface-dark":"#ffffff","on-surface-dark-muted":"#babdc7",text:"#e2e2e2","text-body":"#fafafa","text-muted":"#b4b4bb","text-subtle":"#919199","text-inverse":"#0f0f1a",link:"#9292ee",border:"#27272f","border-subtle":"#1c1c26","field-bg":"#13131c","field-border":"#27272f","field-border-focus":"#3d5fb0","focus-ring":"#7c7ce8",scrim:"#000000a6","on-scrim":"#ffffff",thumb:"#3a3e49",primary:"#7c7ce8","primary-hover":"#9292ee","primary-soft":"#1f1f3d","primary-text":"#8989ea","on-primary":"#0f0f1a","primary-wash":"#7c7ce814","primary-wash-strong":"#7c7ce833",neutral:"#1f1f26","neutral-hover":"#2a2a33","neutral-text":"#b4b4bb","on-neutral":"#fafafa",success:"#30c780","success-soft":"#04b4402e","success-text":"#30c780","on-success":"#0f0f1a",warning:"#fbbf24","warning-soft":"#dfa0002e","warning-text":"#fbbf24","on-warning":"#0f0f1a",danger:"#f87171","danger-soft":"#e826462e","danger-border":"#f87171","danger-text":"#f87171","offline-fill":"#e82646","online-fill":"#04b440","on-danger":"#0f0f1a",info:"#60a5fa","info-soft":"#056ee92e","info-text":"#60a5fa","on-info":"#0f0f1a","primary-pressed":"#a8a8f2","switch-thumb":"#ffffff","on-neutral-strong":"#0f0f1a","text-disabled":"#52525b","surface-pressed":"#ffffff14","surface-hover":"#ffffff0d","surface-selected":"#7c7ce82e","surface-disabled":"#1c1c26",skeleton:"#1c1c26","skeleton-highlight":"#27272f","glass-fill":"#ffffff47","glass-border":"#ffffff73","on-glass":"#0f0f1a","glass-badge":"#ffffff","field-bg-focus":"#0b0b12","field-bg-disabled":"#1c1c26","field-border-error":"#8a2f42","field-label":"#e4e6ee","field-text":"#fafafa","field-text-disabled":"#71717a","field-placeholder":"#84848d","field-placeholder-disabled":"#71717a","field-icon":"#8b8b95","field-icon-focus":"#d4d4db","field-icon-disabled":"#52525b","field-caret":"#7c9ef0","field-message":"#f87171","avatar-1":"#8b8bee","avatar-2":"#2dd4bf","avatar-3":"#fcd34d","avatar-4":"#f472b6","avatar-5":"#60a5fa","avatar-6":"#a78bfa","avatar-7":"#34d399","avatar-8":"#f87171"},space:{none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius:{none:0,sm:6,md:10,lg:14,xl:20,pill:9999},text:{xs:{size:11},sm:{size:13},base:{size:15},lg:{size:17},xl:{size:20},"2xl":{size:24},"3xl":{size:30},"4xl":{size:36},"5xl":{size:45},"6xl":{size:57},"7xl":{size:64},"8xl":{size:72}},weight:{normal:"400",medium:"500",semibold:"600",bold:"700"},leading:{heading:1.2,body:1.4,display:1.2},"letter-spacing":{tight:-.2,normal:0,wide:.4},font:{ui:{},display:{},mono:{}},shadow:{card:{shadowColor:"#000000",shadowOffset:{width:0,height:2},shadowOpacity:.4,shadowRadius:4,elevation:2},elevated:{shadowColor:"#000000",shadowOffset:{width:0,height:4},shadowOpacity:.502,shadowRadius:8,elevation:4},popover:{shadowColor:"#000000",shadowOffset:{width:0,height:8},shadowOpacity:.549,shadowRadius:16,elevation:8},modal:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12},drawer:{shadowColor:"#000000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12}},motion:{duration:{instant:80,fast:160,default:240,slow:360,slower:500},ease:{"in-out":[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]}},size:{border:1},components:{field:{sm:{radius:"md","padding-x":"sm","padding-y":"sm","min-height":38,text:"sm",icon:14,"label-text":"xs","label-gap":"xs","message-text":"xs","message-gap":"xxs"},md:{radius:"md","padding-x":"md","padding-y":"md","min-height":44,text:"base",icon:16,"label-text":"sm","label-gap":"xs","message-text":"sm","message-gap":"xxs"},lg:{radius:"md","padding-x":"lg","padding-y":"lg","min-height":52,text:"lg",icon:18,"label-text":"base","label-gap":"xs","message-text":"base","message-gap":"xxs"}},press:{opacity:.85},disabled:{opacity:.55},button:{xs:{"padding-x":"sm","padding-y":"xs","min-height":28,text:"xs",radius:"md",icon:14,"badge-icon":11},sm:{"padding-x":"md","padding-y":"xs","min-height":34,text:"sm",radius:"md",icon:16,"badge-icon":16},md:{"padding-x":"lg","padding-y":"sm","min-height":44,text:"base",radius:"md",icon:18,"badge-icon":18},lg:{"padding-x":"xl","padding-y":"md","min-height":50,text:"lg",radius:"lg",icon:20,"badge-icon":20},xl:{"padding-x":"2xl","padding-y":"md","min-height":58,text:"xl",radius:"lg",icon:22,"badge-icon":22}},input:{sm:{"multiline-min-height":72},md:{"multiline-min-height":92},lg:{"multiline-min-height":110}},"search-bar":{sm:{radius:"pill"},md:{radius:"pill"},lg:{radius:"pill"}},"empty-state":{sm:{icon:48,"illustration-size":96,"title-text":"lg","description-text":"sm","padding-y":"lg","title-gap":"md","description-gap":"xs"},md:{icon:64,"illustration-size":160,"title-text":"xl","description-text":"base","padding-y":"xl","title-gap":"md","description-gap":"xs"},lg:{icon:80,"illustration-size":240,"title-text":"2xl","description-text":"lg","padding-y":"2xl","title-gap":"md","description-gap":"xs"}},"list-item":{sm:{"padding-y":"sm","title-text":"sm","subtitle-text":"xs","min-height":44},md:{"padding-y":"md","title-text":"base","subtitle-text":"sm","min-height":56},lg:{"padding-y":"lg","title-text":"lg","subtitle-text":"base","min-height":72}},badge:{sm:{text:"xs","min-width":16,height:16,"padding-x":"xs","dot-size":8},md:{text:"sm","min-width":20,height:20,"padding-x":"sm","dot-size":10},"border-width":1.5,"anchor-offset":4},chip:{sm:{"padding-x":"sm","padding-y":"xs",text:"xs","min-height":26,"close-size":16,"close-text":"xs",gap:"xs",icon:14},md:{"padding-x":"md","padding-y":"xs",text:"sm","min-height":32,"close-size":18,"close-text":"sm",gap:"sm",icon:16}},checkbox:{sm:{"box-size":16},md:{"box-size":20},lg:{"box-size":24},"label-gap":"sm"},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},"label-gap":"sm"},switch:{sm:{"track-width":42,"track-height":26,"thumb-size":22,padding:"xxs"},md:{"track-width":51,"track-height":31,"thumb-size":27,padding:"xxs"},lg:{"track-width":60,"track-height":36,"thumb-size":32,padding:"xxs"}},"otp-input":{sm:{cell:36,text:"base",radius:"sm",gap:"sm"},md:{cell:48,text:"xl",radius:"md",gap:"sm"},lg:{cell:56,text:"2xl",radius:"lg",gap:"md"}},"segmented-control":{sm:{height:32,text:"sm","padding-x":"sm",icon:14},md:{height:40,text:"base","padding-x":"md",icon:16},lg:{height:48,text:"lg","padding-x":"lg",icon:18},"track-padding":"xs","underline-height":2,"pill-inset":"xs"},tabs:{sm:{text:"sm","padding-y":"sm","padding-x":"xs","scrollable-padding-x":"md",icon:16},md:{text:"base","padding-y":"md","padding-x":"sm","scrollable-padding-x":"lg",icon:18},lg:{text:"lg","padding-y":"lg","padding-x":"md","scrollable-padding-x":"xl",icon:20},"icon-gap":"xs","track-padding":"xs","underline-height":2,"pill-inset":"xs","disabled-opacity":.45,"badge-gap":"xs"},slider:{sm:{"track-height":4,"thumb-diameter":24},md:{"track-height":6,"thumb-diameter":28},lg:{"track-height":8,"thumb-diameter":32}},"floating-action-button":{sm:{diameter:40,icon:18,text:"sm","label-padding-x":"md"},md:{diameter:56,icon:22,text:"base","label-padding-x":"lg"},lg:{diameter:72,icon:28,text:"lg","label-padding-x":"xl"},"edge-offset":"xl","bottom-offset":"xl","secondary-gap":"lg","stagger-ms":50},dialog:{"icon-wrapper-size":48,"action-button-min-height":44},toast:{"icon-circle-size":28,"icon-glyph-text":"lg","tint-bar-width":0,"action-min-height":30},banner:{"tint-bar-width":0},screen:{gutter:"lg"}}};
|
|
@@ -98,8 +98,10 @@ export interface AppBarProps {
|
|
|
98
98
|
titleOffset?: number;
|
|
99
99
|
/** Bar height in pt, excluding the safe-area top. Overrides the variant's height; ignored while collapsing. */
|
|
100
100
|
height?: number;
|
|
101
|
-
/** Hairline under the bar.
|
|
101
|
+
/** Hairline under the bar. Off by default; pass `true` to draw it. */
|
|
102
102
|
divider?: boolean;
|
|
103
|
+
/** Draws the theme's light `card` shadow under the bar, for content scrolled beneath it. Ignored when `transparent`. */
|
|
104
|
+
elevated?: boolean;
|
|
103
105
|
variant?: AppBarVariant;
|
|
104
106
|
transparent?: boolean;
|
|
105
107
|
/**
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const writeImage: (fileName: string, bytes: Uint8Array<ArrayBuffer>, _contentType: string) => string;
|
|
2
|
+
export declare const imageUri: (fileName: string) => string;
|
|
3
|
+
export declare const imageExists: (fileName: string) => boolean;
|
|
4
|
+
export declare const deleteImage: (fileName: string) => void;
|
|
5
|
+
export declare const listImageNames: () => string[];
|
|
6
|
+
export declare const clearImages: () => void;
|
|
7
|
+
//# sourceMappingURL=imageStore.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const writeImage: (fileName: string, bytes: Uint8Array<ArrayBuffer>, contentType: string) => string;
|
|
2
|
+
export declare const imageUri: (fileName: string) => string;
|
|
3
|
+
export declare const imageExists: (fileName: string) => boolean;
|
|
4
|
+
export declare const deleteImage: (fileName: string) => void;
|
|
5
|
+
export declare const listImageNames: () => string[];
|
|
6
|
+
export declare const clearImages: () => void;
|
|
7
|
+
//# sourceMappingURL=imageStore.web.d.ts.map
|
|
@@ -97,9 +97,9 @@ interface BaseChoiceGroupProps<T = ChoiceOption> {
|
|
|
97
97
|
/** Allow options to wrap onto multiple lines (swatch grids). Default `false`. */
|
|
98
98
|
wrap?: boolean;
|
|
99
99
|
/**
|
|
100
|
-
* Stretch options
|
|
101
|
-
*
|
|
102
|
-
* chip hugs its content.
|
|
100
|
+
* Stretch options to fill the main axis. A stretched row moves an option to
|
|
101
|
+
* the next line when it does not fit. Default: `true` for an unwrapped row of
|
|
102
|
+
* cards (the status-picker look), `false` otherwise; a chip hugs its content.
|
|
103
103
|
*/
|
|
104
104
|
fullWidth?: boolean;
|
|
105
105
|
/** Disables the whole group. Per-option `disabled` still applies on top. */
|