@webority/mobile-ui 0.11.1 → 0.12.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.
Files changed (59) hide show
  1. package/lib/commonjs/components/Avatar/Avatar.js +1 -1
  2. package/lib/commonjs/components/Chip/Chip.js +1 -1
  3. package/lib/commonjs/components/EmptyState/EmptyState.js +1 -1
  4. package/lib/commonjs/components/FileViewer/FileViewer.js +1 -1
  5. package/lib/commonjs/components/FileViewer/FileViewerPage.js +1 -0
  6. package/lib/commonjs/components/FileViewer/useFileViewerZoom.js +1 -0
  7. package/lib/commonjs/components/FilterChipRow/FilterChipRow.js +1 -0
  8. package/lib/commonjs/components/FilterChipRow/index.js +1 -0
  9. package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +1 -1
  10. package/lib/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +1 -1
  11. package/lib/commonjs/components/ProgressBar/ProgressBar.js +1 -1
  12. package/lib/commonjs/components/SignaturePad/SignaturePad.js +1 -1
  13. package/lib/commonjs/components/SquircleView/SquircleView.js +1 -0
  14. package/lib/commonjs/components/SquircleView/index.js +1 -0
  15. package/lib/commonjs/components/index.js +1 -1
  16. package/lib/commonjs/theme/tokens.js +1 -1
  17. package/lib/module/components/Avatar/Avatar.js +1 -1
  18. package/lib/module/components/Chip/Chip.js +1 -1
  19. package/lib/module/components/EmptyState/EmptyState.js +1 -1
  20. package/lib/module/components/FileViewer/FileViewer.js +1 -1
  21. package/lib/module/components/FileViewer/FileViewerPage.js +1 -0
  22. package/lib/module/components/FileViewer/useFileViewerZoom.js +1 -0
  23. package/lib/module/components/FilterChipRow/FilterChipRow.js +1 -0
  24. package/lib/module/components/FilterChipRow/index.js +1 -0
  25. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +1 -1
  26. package/lib/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +1 -1
  27. package/lib/module/components/ProgressBar/ProgressBar.js +1 -1
  28. package/lib/module/components/SignaturePad/SignaturePad.js +1 -1
  29. package/lib/module/components/SquircleView/SquircleView.js +1 -0
  30. package/lib/module/components/SquircleView/index.js +1 -0
  31. package/lib/module/components/index.js +1 -1
  32. package/lib/module/theme/tokens.js +1 -1
  33. package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +25 -1
  34. package/lib/typescript/commonjs/components/Chip/Chip.d.ts +15 -2
  35. package/lib/typescript/commonjs/components/FileViewer/FileViewer.d.ts +21 -10
  36. package/lib/typescript/commonjs/components/FileViewer/FileViewerPage.d.ts +12 -0
  37. package/lib/typescript/commonjs/components/FileViewer/useFileViewerZoom.d.ts +41 -0
  38. package/lib/typescript/commonjs/components/FilterChipRow/FilterChipRow.d.ts +55 -0
  39. package/lib/typescript/commonjs/components/FilterChipRow/index.d.ts +3 -0
  40. package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +8 -0
  41. package/lib/typescript/commonjs/components/SignaturePad/SignaturePad.d.ts +8 -2
  42. package/lib/typescript/commonjs/components/SquircleView/SquircleView.d.ts +22 -0
  43. package/lib/typescript/commonjs/components/SquircleView/index.d.ts +3 -0
  44. package/lib/typescript/commonjs/components/index.d.ts +4 -0
  45. package/lib/typescript/commonjs/theme/types.d.ts +4 -0
  46. package/lib/typescript/module/components/Avatar/Avatar.d.ts +25 -1
  47. package/lib/typescript/module/components/Chip/Chip.d.ts +15 -2
  48. package/lib/typescript/module/components/FileViewer/FileViewer.d.ts +21 -10
  49. package/lib/typescript/module/components/FileViewer/FileViewerPage.d.ts +12 -0
  50. package/lib/typescript/module/components/FileViewer/useFileViewerZoom.d.ts +41 -0
  51. package/lib/typescript/module/components/FilterChipRow/FilterChipRow.d.ts +55 -0
  52. package/lib/typescript/module/components/FilterChipRow/index.d.ts +3 -0
  53. package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +8 -0
  54. package/lib/typescript/module/components/SignaturePad/SignaturePad.d.ts +8 -2
  55. package/lib/typescript/module/components/SquircleView/SquircleView.d.ts +22 -0
  56. package/lib/typescript/module/components/SquircleView/index.d.ts +3 -0
  57. package/lib/typescript/module/components/index.d.ts +4 -0
  58. package/lib/typescript/module/theme/types.d.ts +4 -0
  59. package/package.json +3 -3
@@ -1 +1 @@
1
- "use strict";import{Image}from"expo-image";import{Children,cloneElement,forwardRef,isValidElement,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{AppIcon}from"../AppIcon/index.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const SOFT_FILL_OPACITY=.14;export const avatarToneColors=(e,t)=>{const soft=(e,t)=>tintOf(e,.14,t);switch(t){case"primary":return{background:soft(e.colors.primary,e.colors.primaryMuted),color:e.colors.toneText.primary};case"secondary":return{background:e.colors.secondary,color:e.colors.onSecondary};case"success":return{background:soft(e.colors.success,e.colors.background.secondary),color:e.colors.toneText.success};case"warning":return{background:soft(e.colors.warning,e.colors.background.secondary),color:e.colors.toneText.warning};case"error":return{background:soft(e.colors.error,e.colors.background.secondary),color:e.colors.toneText.error};case"info":return{background:soft(e.colors.info,e.colors.background.secondary),color:e.colors.toneText.info};default:return{background:e.colors.background.tertiary,color:e.colors.text.primary}}};const sizeMap={xs:24,sm:32,md:48,lg:64,xl:80},resolveSize=e=>"number"==typeof e?e:sizeMap[e],resolveRadius=(e,t)=>{switch(e){case"circle":return t/2;case"rounded":return Math.max(6,Math.round(.22*t));default:return 0}},initialsFromName=e=>{if(!e)return"";const t=e.trim().split(/\s+/u).filter(Boolean);return 0===t.length?"":1===t.length?t[0].charAt(0).toUpperCase():(t[0].charAt(0)+t[1].charAt(0)).toUpperCase()},hashColor=(e,t)=>{if(!e)return t[0];let r=0;for(let t=0;t<e.length;t+=1)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t[Math.abs(r)%t.length]},RING_WIDTH=1.5,isRingStatus=e=>"verified"===e||"pending"===e,statusColor=(e,t)=>{switch(t){case"online":case"verified":return e.colors.success;case"busy":return e.colors.error;case"away":case"pending":return e.colors.warning;default:return e.colors.text.tertiary}},Avatar=forwardRef((e,t)=>{const{source:r,ImageComponent:o,name:s,size:a="md",shape:i="circle",status:n=null,statusPosition:l="bottomRight",tone:c,backgroundColor:d,color:u,fontSize:h,loading:m=!1,accessibilityLabel:g,style:b,textStyle:p,testID:y}=e,f=useTheme(),v=f.components.avatar,[x,C]=useState(!1),S=useMemo(()=>resolveSize(a),[a]),A=useMemo(()=>resolveRadius(i,S),[i,S]),w=v?.borderWidth??0,R=v?.borderColor??f.colors.border.primary,j=v?.statusBorderWidth??2,k=v?.statusBorderColor??f.colors.background.elevated,I=useMemo(()=>initialsFromName(s),[s]),M=useMemo(()=>c?avatarToneColors(f,c):null,[f,c]),_=useMemo(()=>d||(M?.background??hashColor(s??"",f.colors.avatarPalette)),[d,M,s,f.colors.avatarPalette]),T=u??M?.color??f.colors.onPrimary,W=!!r&&!x,E=v?.fontSizeRatio??.4,z=h??v?.fontSize??Math.max(10,Math.round(S*E)),G=Math.max(8,Math.round(.25*S)),V=isRingStatus(n),L=v?.ringWidth??1.5,F=S-2*(V?L+(v?.ringGap??L):0),N=V?resolveRadius(i,F):A,D=V?statusColor(f,n):"transparent",$=Math.max(12,Math.round(.32*S)),O=Math.max(10,$-4),B=W?f.colors.background.tertiary:_,P=y??"avatar",U=s?`${s}'s avatar`:"Avatar",H=g??("verified"===n?`${U}, verified`:"pending"===n?`${U}, pending verification`:U),Y=_jsxs(View,{ref:t,style:[styles.root,{width:S,height:S,borderRadius:A,...smoothCorners,borderWidth:V?0:w,borderColor:R,backgroundColor:V?"transparent":B},b],accessible:!0,accessibilityRole:"image",accessibilityLabel:H,testID:y,children:[V?_jsx(View,{style:[styles.ring,{borderRadius:A,...smoothCorners,borderWidth:L,borderColor:D}],accessible:!1,pointerEvents:"none",testID:`${P}-ring`}):null,_jsx(View,{style:[styles.picture,{width:F,height:F,borderRadius:N,...smoothCorners,borderWidth:V?w:0,borderColor:R,backgroundColor:V?B:"transparent"}],children:W?(()=>{const e={width:F,height:F,borderRadius:N,...smoothCorners},onError=()=>C(!0);return o?_jsx(o,{source:r,onError:onError,style:e,contentFit:"cover",resizeMode:"cover",accessibilityIgnoresInvertColors:!0}):_jsx(Image,{source:r,onError:onError,style:e,contentFit:"cover",accessibilityIgnoresInvertColors:!0})})():_jsx(Text,{style:[styles.initials,{color:T,fontSize:z,fontWeight:f.typography.fontWeight[v?.fontWeight??"semibold"]},p],numberOfLines:1,allowFontScaling:!1,children:I??" "})}),"verified"===n?_jsx(View,{style:[styles.status,"topRight"===l?styles.badgeTopRight:styles.badgeBottomRight,{width:$,height:$,borderRadius:$/2,...smoothCorners,backgroundColor:k}],accessible:!1,pointerEvents:"none",testID:`${P}-badge`,children:_jsx(AppIcon,{name:"verify",variant:"bold",size:O,color:D})}):null,n&&!V?_jsx(View,{style:[styles.status,"topRight"===l?styles.statusTopRight:styles.statusBottomRight,{width:G,height:G,borderRadius:G/2,...smoothCorners,backgroundColor:statusColor(f,n),borderWidth:j,borderColor:k}],accessible:!1,pointerEvents:"none"}):null]});return m?_jsx(AvatarSkeleton,{...e}):Y});Avatar.displayName="Avatar";const AvatarSkeleton=({size:e="md",shape:t="circle",style:r})=>{const o=resolveSize(e);return _jsx(Skeleton,{shape:"circle"===t?"circle":"rounded"===t?"rounded":"rect",width:o,height:o,style:r})};AvatarSkeleton.displayName="AvatarSkeleton",Avatar.Skeleton=AvatarSkeleton;const styles=StyleSheet.create({root:{alignItems:"center",justifyContent:"center",overflow:"visible",position:"relative"},initials:{textAlign:"center"},ring:{position:"absolute",top:0,right:0,bottom:0,left:0},picture:{alignItems:"center",justifyContent:"center",overflow:"hidden"},status:{position:"absolute"},badgeTopRight:{top:-2,right:-2,alignItems:"center",justifyContent:"center"},badgeBottomRight:{bottom:-2,right:-2,alignItems:"center",justifyContent:"center"},statusTopRight:{top:0,right:0},statusBottomRight:{bottom:0,right:0}}),SPACING_OFFSET={tight:-16,normal:-12,loose:-8},STAGGER_MS=50,ENTRANCE_DURATION_MS=220,AvatarGroupItem=({delay:e,marginLeft:t,borderColor:r,borderWidth:o,children:s})=>{const a=useRef(createAnimatedValue(0)).current;return useEffect(()=>{const t=Animated.timing(a,{toValue:1,duration:220,delay:e,easing:Easing.out(Easing.cubic),useNativeDriver:!0});return t.start(),()=>t.stop()},[e,a]),_jsx(Animated.View,{style:[groupStyles.item,{marginLeft:t,borderColor:r,borderWidth:o,opacity:a}],children:s})},AvatarGroup=e=>{const{children:t,max:r=4,size:o="md",spacing:s="normal",overflowVariant:a="count",accessibilityLabel:i,style:n,testID:l}=e,c=useTheme(),d=useMemo(()=>Children.toArray(t).filter(e=>isValidElement(e)),[t]),u=d.length,h=d.slice(0,r),m=Math.max(0,u-r),g=m>0,b=SPACING_OFFSET[s],p=c.colors.background.elevated,y=i??`Group of ${u} ${1===u?"person":"people"}`,f=useMemo(()=>resolveSize(o),[o]),v=Math.max(10,Math.round(.34*f));return _jsxs(View,{style:[groupStyles.row,n],accessible:!0,accessibilityLabel:y,accessibilityRole:"summary",testID:l,children:[h.map((e,t)=>{const r=e.key??`avatar-${t}`;return _jsx(AvatarGroupItem,{delay:50*t,marginLeft:0===t?0:b,borderColor:p,borderWidth:1.5,children:cloneElement(e,{size:o})},r)}),g?_jsx(AvatarGroupItem,{delay:50*h.length,marginLeft:0===h.length?0:b,borderColor:p,borderWidth:1.5,children:_jsx(View,{style:[groupStyles.overflow,{width:f,height:f,borderRadius:f/2,...smoothCorners,backgroundColor:c.colors.surface.disabled}],accessible:!0,accessibilityRole:"text",accessibilityLabel:"count"===a?`${m} more`:"More avatars",children:_jsx(Text,{style:{color:c.colors.text.secondary,fontSize:v,fontWeight:c.typography.fontWeight.semibold},numberOfLines:1,allowFontScaling:!1,children:"count"===a?`+${m}`:"+"})})},"avatar-overflow"):null]})},groupStyles=StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},item:{borderRadius:9999,...smoothCorners},overflow:{alignItems:"center",justifyContent:"center"}}),AvatarWithGroup=Avatar;AvatarWithGroup.Group=AvatarGroup;export{Avatar,AvatarGroup};export default AvatarWithGroup;
1
+ "use strict";import{Image}from"expo-image";import{Children,cloneElement,forwardRef,isValidElement,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{AppIcon}from"../AppIcon/index.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const SOFT_FILL_OPACITY=.14,MIN_TOUCH_TARGET=44,PRESSED_OPACITY=.7,INITIALS_MAX_FONT_SCALE=1.2;export const avatarToneColors=(e,t)=>{const soft=(e,t)=>tintOf(e,.14,t);switch(t){case"primary":return{background:soft(e.colors.primary,e.colors.primaryMuted),color:e.colors.toneText.primary};case"secondary":return{background:e.colors.secondary,color:e.colors.onSecondary};case"success":return{background:soft(e.colors.success,e.colors.background.secondary),color:e.colors.toneText.success};case"warning":return{background:soft(e.colors.warning,e.colors.background.secondary),color:e.colors.toneText.warning};case"error":return{background:soft(e.colors.error,e.colors.background.secondary),color:e.colors.toneText.error};case"info":return{background:soft(e.colors.info,e.colors.background.secondary),color:e.colors.toneText.info};default:return{background:e.colors.background.tertiary,color:e.colors.text.primary}}};const sizeMap={xs:24,sm:32,md:48,lg:64,xl:80},resolveSize=e=>"number"==typeof e?e:sizeMap[e],resolveRadius=(e,t)=>{switch(e){case"circle":return t/2;case"rounded":return Math.max(6,Math.round(.22*t));default:return 0}},initialsFromName=e=>{if(!e)return"";const t=e.trim().split(/\s+/u).filter(Boolean);return 0===t.length?"":1===t.length?t[0].charAt(0).toUpperCase():(t[0].charAt(0)+t[1].charAt(0)).toUpperCase()},hashColor=(e,t)=>{if(!e)return t[0];let r=0;for(let t=0;t<e.length;t+=1)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t[Math.abs(r)%t.length]},RING_WIDTH=1.5,isRingStatus=e=>"verified"===e||"pending"===e,statusColor=(e,t)=>{switch(t){case"online":case"verified":return e.colors.success;case"busy":return e.colors.error;case"away":case"pending":return e.colors.warning;default:return e.colors.text.tertiary}},Avatar=forwardRef((e,t)=>{const{source:r,ImageComponent:o,name:s,size:a="md",shape:i="circle",status:n=null,statusPosition:l="bottomRight",tone:c,backgroundColor:d,color:u,fontSize:h,loading:m=!1,accessibilityLabel:g,onPress:p,onLongPress:b,haptic:y,hitSlop:f,style:v,textStyle:x,testID:C}=e,S=useTheme(),A=S.components.avatar,[R,I]=useState(!1),_=useMemo(()=>resolveSize(a),[a]),j=useMemo(()=>resolveRadius(i,_),[i,_]),w=A?.borderWidth??0,M=A?.borderColor??S.colors.border.primary,k=A?.statusBorderWidth??2,T=A?.statusBorderColor??S.colors.background.elevated,E=useMemo(()=>initialsFromName(s),[s]),W=useMemo(()=>c?avatarToneColors(S,c):null,[S,c]),z=useMemo(()=>d||(W?.background??hashColor(s??"",S.colors.avatarPalette)),[d,W,s,S.colors.avatarPalette]),G=u??W?.color??S.colors.onPrimary,L=!!r&&!R,F=A?.fontSizeRatio??.4,P=h??A?.fontSize??Math.max(10,Math.round(_*F)),V=Math.max(8,Math.round(.25*_)),N=isRingStatus(n),D=A?.ringWidth??1.5,O=_-2*(N?D+(A?.ringGap??D):0),$=N?resolveRadius(i,O):j,H=N?statusColor(S,n):"transparent",B=Math.max(12,Math.round(.32*_)),U=Math.max(10,B-4),Y=L?S.colors.background.tertiary:z,X=C??"avatar",q=s?`${s}'s avatar`:"Avatar",J="verified"===n?", verified":"pending"===n?", pending verification":"",K=g??`${q}${J}`,Q="function"==typeof p||"function"==typeof b,Z=g??`${s||q}${J}`,ee=Math.max(0,Math.ceil((44-_)/2)),te=[styles.root,{width:_,height:_,borderRadius:j,...smoothCorners,borderWidth:N?0:w,borderColor:M,backgroundColor:N?"transparent":Y},v],re=_jsxs(_Fragment,{children:[N?_jsx(View,{style:[styles.ring,{borderRadius:j,...smoothCorners,borderWidth:D,borderColor:H}],accessible:!1,pointerEvents:"none",testID:`${X}-ring`}):null,_jsx(View,{style:[styles.picture,{width:O,height:O,borderRadius:$,...smoothCorners,borderWidth:N?w:0,borderColor:M,backgroundColor:N?Y:"transparent"}],children:L?(()=>{const e={width:O,height:O,borderRadius:$,...smoothCorners},onError=()=>I(!0);return o?_jsx(o,{source:r,onError:onError,style:e,contentFit:"cover",resizeMode:"cover",accessibilityIgnoresInvertColors:!0}):_jsx(Image,{source:r,onError:onError,style:e,contentFit:"cover",accessibilityIgnoresInvertColors:!0})})():_jsx(Text,{style:[styles.initials,{color:G,fontSize:P,fontWeight:S.typography.fontWeight[A?.fontWeight??"semibold"]},x],numberOfLines:1,maxFontSizeMultiplier:1.2,children:E??" "})}),"verified"===n?_jsx(View,{style:[styles.status,"topRight"===l?styles.badgeTopRight:styles.badgeBottomRight,{width:B,height:B,borderRadius:B/2,...smoothCorners,backgroundColor:T}],accessible:!1,pointerEvents:"none",testID:`${X}-badge`,children:_jsx(AppIcon,{name:"verify",variant:"bold",size:U,color:H})}):null,n&&!N?_jsx(View,{style:[styles.status,"topRight"===l?styles.statusTopRight:styles.statusBottomRight,{width:V,height:V,borderRadius:V/2,...smoothCorners,backgroundColor:statusColor(S,n),borderWidth:k,borderColor:T}],accessible:!1,pointerEvents:"none"}):null]}),oe=Q?_jsx(Pressable,{ref:t,onPress:p?e=>{const t=resolveHaptic(y,"selection");t&&triggerHaptic(t),p?.(e)}:void 0,onLongPress:b?e=>{const t=resolveHaptic(y,"longPress");t&&triggerHaptic(t),b?.(e)}:void 0,hitSlop:f??ee,accessibilityRole:"button",accessibilityLabel:Z,testID:C,style:({pressed:e})=>[te,e?styles.pressed:null],children:re}):_jsx(View,{ref:t,style:te,accessible:!0,accessibilityRole:"image",accessibilityLabel:K,testID:C,children:re});return m?_jsx(AvatarSkeleton,{...e}):oe});Avatar.displayName="Avatar";const AvatarSkeleton=({size:e="md",shape:t="circle",style:r})=>{const o=resolveSize(e);return _jsx(Skeleton,{shape:"circle"===t?"circle":"rounded"===t?"rounded":"rect",width:o,height:o,style:r})};AvatarSkeleton.displayName="AvatarSkeleton",Avatar.Skeleton=AvatarSkeleton;const styles=StyleSheet.create({root:{alignItems:"center",justifyContent:"center",overflow:"visible",position:"relative"},pressed:{opacity:.7},initials:{textAlign:"center"},ring:{position:"absolute",top:0,right:0,bottom:0,left:0},picture:{alignItems:"center",justifyContent:"center",overflow:"hidden"},status:{position:"absolute"},badgeTopRight:{top:-2,right:-2,alignItems:"center",justifyContent:"center"},badgeBottomRight:{bottom:-2,right:-2,alignItems:"center",justifyContent:"center"},statusTopRight:{top:0,right:0},statusBottomRight:{bottom:0,right:0}}),SPACING_OFFSET={tight:-16,normal:-12,loose:-8},STAGGER_MS=50,ENTRANCE_DURATION_MS=220,AvatarGroupItem=({delay:e,marginLeft:t,borderColor:r,borderWidth:o,children:s})=>{const a=useRef(createAnimatedValue(0)).current;return useEffect(()=>{const t=Animated.timing(a,{toValue:1,duration:220,delay:e,easing:Easing.out(Easing.cubic),useNativeDriver:!0});return t.start(),()=>t.stop()},[e,a]),_jsx(Animated.View,{style:[groupStyles.item,{marginLeft:t,borderColor:r,borderWidth:o,opacity:a}],children:s})},AvatarGroup=e=>{const{children:t,max:r=4,size:o="md",spacing:s="normal",overflowVariant:a="count",accessibilityLabel:i,style:n,testID:l}=e,c=useTheme(),d=useMemo(()=>Children.toArray(t).filter(e=>isValidElement(e)),[t]),u=d.length,h=d.slice(0,r),m=Math.max(0,u-r),g=m>0,p=SPACING_OFFSET[s],b=c.colors.background.elevated,y=i??`Group of ${u} ${1===u?"person":"people"}`,f=useMemo(()=>resolveSize(o),[o]),v=Math.max(10,Math.round(.34*f));return _jsxs(View,{style:[groupStyles.row,n],accessible:!0,accessibilityLabel:y,accessibilityRole:"summary",testID:l,children:[h.map((e,t)=>{const r=e.key??`avatar-${t}`;return _jsx(AvatarGroupItem,{delay:50*t,marginLeft:0===t?0:p,borderColor:b,borderWidth:1.5,children:cloneElement(e,{size:o})},r)}),g?_jsx(AvatarGroupItem,{delay:50*h.length,marginLeft:0===h.length?0:p,borderColor:b,borderWidth:1.5,children:_jsx(View,{style:[groupStyles.overflow,{width:f,height:f,borderRadius:f/2,...smoothCorners,backgroundColor:c.colors.surface.disabled}],accessible:!0,accessibilityRole:"text",accessibilityLabel:"count"===a?`${m} more`:"More avatars",children:_jsx(Text,{style:{color:c.colors.text.secondary,fontSize:v,fontWeight:c.typography.fontWeight.semibold},numberOfLines:1,maxFontSizeMultiplier:1.2,children:"count"===a?`+${m}`:"+"})})},"avatar-overflow"):null]})},groupStyles=StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},item:{borderRadius:9999,...smoothCorners},overflow:{alignItems:"center",justifyContent:"center"}}),AvatarWithGroup=Avatar;AvatarWithGroup.Group=AvatarGroup;export{Avatar,AvatarGroup};export default AvatarWithGroup;
@@ -1 +1 @@
1
- "use strict";import{forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const toneFor=(e,r)=>{switch(r){case"primary":return{base:e.colors.primaryMuted,on:e.colors.primary,ink:e.colors.toneText.primary,border:e.colors.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};case"success":return{base:e.colors.background.tertiary,on:e.colors.success,ink:e.colors.toneText.success,border:e.colors.success,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};case"warning":return{base:e.colors.background.tertiary,on:e.colors.warning,ink:e.colors.toneText.warning,border:e.colors.warning,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};case"error":return{base:e.colors.background.tertiary,on:e.colors.error,ink:e.colors.toneText.error,border:e.colors.error,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};case"info":return{base:e.colors.background.tertiary,on:e.colors.info,ink:e.colors.toneText.info,border:e.colors.info,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};default:return{base:e.colors.background.tertiary,on:e.colors.text.primary,ink:e.colors.text.primary,border:e.colors.border.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary}}},SOFT_FILL_OPACITY=.14,SOFT_SELECTED_FILL_OPACITY=.24,sizeMap={sm:{paddingH:10,paddingV:4,fontSize:12,minHeight:26,closeSize:16,closeFont:12,gap:6,iconSize:14},md:{paddingH:12,paddingV:6,fontSize:13,minHeight:32,closeSize:18,closeFont:13,gap:8,iconSize:16}},Chip=forwardRef((e,r)=>{const{label:o,selected:s=!1,selectionMode:t="single",onPress:i,onClose:l,leftIcon:n,iconVariant:c,variant:a="filled",tone:d="neutral",size:p="md",disabled:m=!1,loading:y=!1,accessibilityLabel:g,haptic:b,style:u,textStyle:f,containerStyle:h,closeButtonStyle:S,closeIconStyle:x,testID:z}=e,k=useTheme(),I=!!i&&!m,{scale:C,pressIn:j,pressOut:H}=usePressAnimation({enabled:I}),M=useMemo(()=>toneFor(k,d),[k,d]),T=k.components.chip?.[p],w={paddingH:T?.paddingHorizontal??sizeMap[p].paddingH,paddingV:T?.paddingVertical??sizeMap[p].paddingV,fontSize:T?.fontSize??sizeMap[p].fontSize,minHeight:T?.minHeight??sizeMap[p].minHeight,closeSize:T?.closeSize??sizeMap[p].closeSize,closeFont:T?.closeFontSize??sizeMap[p].closeFont,gap:T?.gap??sizeMap[p].gap,iconSize:T?.iconSize??sizeMap[p].iconSize},_="filled"===a,F="soft"===a,B=(()=>{if(F){const e=s?M.selectedOn:M.on;return tintOf(e,s?.24:.14,s?M.selectedBg:M.base)}return s?_?M.selectedBg:"transparent":_?M.base:"transparent"})(),O=F?"transparent":s?M.selectedBorder:_?"transparent":M.border,P=m?k.colors.text.disabled:s?F?k.colors.text.primary:M.selectedInk:M.ink,V=_||F?0:k.colors.border.width,handlePress=()=>{if(!I)return;const e=resolveHaptic(b,"selection");e&&triggerHaptic(e),i?.()},L=g??o,v=_jsxs(View,{style:styles.row,children:[n?_jsx(View,{style:{marginRight:w.gap},children:renderSlotIcon(n,{color:P,size:w.iconSize,disabled:m},c)}):null,_jsx(Text,{style:[styles.label,{color:P,fontSize:w.fontSize,...fontFor(k,"medium")},f],numberOfLines:1,children:o??" "}),l?_jsx(Pressable,{onPress:()=>{m||(!1!==b&&triggerHaptic("impactLight"),l?.())},disabled:m,accessibilityRole:"button",accessibilityLabel:`Remove ${o}`,accessibilityState:{disabled:m},"aria-disabled":m,hitSlop:6,style:({pressed:e})=>[styles.close,{width:w.closeSize,height:w.closeSize,borderRadius:w.closeSize/2,...smoothCorners,marginLeft:w.gap,backgroundColor:e?k.colors.surface.pressed:k.colors.surface.hovered},S],children:_jsx(Text,{style:[{color:P,fontSize:w.closeFont,...fontFor(k,"bold"),lineHeight:w.closeFont+2},x],allowFontScaling:!1,children:"×"})}):null]}),A={paddingHorizontal:w.paddingH,paddingVertical:w.paddingV,minHeight:w.minHeight,borderRadius:k.radius.full,...smoothCorners,backgroundColor:B,borderWidth:V,borderColor:O,opacity:m?.55:1};let R;return R=I?_jsx(Animated.View,{style:{transform:[{scale:C}],alignSelf:"flex-start"},children:_jsx(Pressable,{ref:r,onPress:handlePress,onPressIn:j,onPressOut:H,disabled:!I,accessibilityRole:"multiple"===t?"checkbox":"button",accessibilityLabel:L,accessibilityState:"multiple"===t?{checked:s,disabled:m}:{selected:s,disabled:m},"aria-checked":"multiple"===t?s:void 0,"aria-selected":"multiple"===t?void 0:s,"aria-disabled":m,android_ripple:{color:k.colors.surface.pressed,borderless:!1},testID:z,style:({pressed:e})=>[styles.base,A,e&&"outlined"===a?{backgroundColor:k.colors.surface.pressed}:null,h,u],children:v})}):_jsx(View,{ref:r,style:[styles.base,A,h,u],accessible:!0,accessibilityRole:"text",accessibilityLabel:L,accessibilityState:{selected:s,disabled:m},"aria-selected":s,"aria-disabled":m,testID:z,children:v}),y?_jsx(ChipSkeleton,{...e}):R});Chip.displayName="Chip";const ChipSkeleton=({label:e,size:r="md",leftIcon:o,onClose:s,style:t,containerStyle:i})=>{const l=sizeMap[r],n=Math.max(40,Math.min(120,7*(e??"").length)),c=l.minHeight,a=c/2,d=n+2*l.paddingH+(void 0!==o?l.gap+14:0)+(void 0!==s?l.gap+l.closeSize:0);return _jsx(Skeleton,{width:d,height:c,radius:a,style:[{alignSelf:"flex-start"},i,t]})};ChipSkeleton.displayName="ChipSkeleton",Chip.Skeleton=ChipSkeleton;const styles=StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},label:{textAlign:"center"},close:{alignItems:"center",justifyContent:"center"}});export{Chip};export default Chip;
1
+ "use strict";import{forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const toneFor=(e,o)=>{switch(o){case"primary":return{base:e.colors.primaryMuted,on:e.colors.primary,ink:e.colors.toneText.primary,border:e.colors.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};case"success":return{base:e.colors.background.tertiary,on:e.colors.success,ink:e.colors.toneText.success,border:e.colors.success,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};case"warning":return{base:e.colors.background.tertiary,on:e.colors.warning,ink:e.colors.toneText.warning,border:e.colors.warning,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};case"error":return{base:e.colors.background.tertiary,on:e.colors.error,ink:e.colors.toneText.error,border:e.colors.error,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};case"info":return{base:e.colors.background.tertiary,on:e.colors.info,ink:e.colors.toneText.info,border:e.colors.info,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary};default:return{base:e.colors.background.tertiary,on:e.colors.text.primary,ink:e.colors.text.primary,border:e.colors.border.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedInk:e.colors.toneText.primary,selectedBorder:e.colors.primary}}},SOFT_FILL_OPACITY=.14,SOFT_SELECTED_FILL_OPACITY=.24,sizeMap={sm:{paddingH:10,paddingV:4,fontSize:12,minHeight:26,closeSize:16,closeFont:12,gap:6,iconSize:14},md:{paddingH:12,paddingV:6,fontSize:13,minHeight:32,closeSize:18,closeFont:13,gap:8,iconSize:16}},hasChipCount=e=>null!=e&&""!==e,Chip=forwardRef((e,o)=>{const{label:r,count:t,selected:s=!1,selectionMode:i="single",onPress:l,onClose:n,leftIcon:a,iconVariant:c,variant:d="filled",tone:p="neutral",size:m="md",disabled:u=!1,loading:g=!1,accessibilityLabel:y,haptic:b,style:h,textStyle:f,containerStyle:S,countStyle:x,closeButtonStyle:z,closeIconStyle:k,testID:C}=e,I=useTheme(),M=!!l&&!u,j="radio"===i,H=!!l&&(!u||j),T=hasChipCount(t),{scale:w,pressIn:_,pressOut:F}=usePressAnimation({enabled:M}),O=useMemo(()=>toneFor(I,p),[I,p]),B=I.components.chip?.[m],L={paddingH:B?.paddingHorizontal??sizeMap[m].paddingH,paddingV:B?.paddingVertical??sizeMap[m].paddingV,fontSize:B?.fontSize??sizeMap[m].fontSize,minHeight:B?.minHeight??sizeMap[m].minHeight,closeSize:B?.closeSize??sizeMap[m].closeSize,closeFont:B?.closeFontSize??sizeMap[m].closeFont,gap:B?.gap??sizeMap[m].gap,iconSize:B?.iconSize??sizeMap[m].iconSize},V=Math.max(0,Math.ceil((44-L.minHeight)/2)),P=j?{top:V,bottom:V}:void 0,v="filled"===d,A="soft"===d,R=(()=>{if(A){const e=s?O.selectedOn:O.on;return tintOf(e,s?.24:.14,s?O.selectedBg:O.base)}return s?v?O.selectedBg:"transparent":v?O.base:"transparent"})(),D=A?"transparent":s?O.selectedBorder:v?"transparent":O.border,E=u?I.colors.text.disabled:s?A?I.colors.text.primary:O.selectedInk:O.ink,$=v||A?0:I.colors.border.width,handlePress=()=>{if(!M)return;const e=resolveHaptic(b,"selection");e&&triggerHaptic(e),l?.()},N=y??(T?`${r}, ${t}`:r),Y=_jsxs(View,{style:styles.row,children:[a?_jsx(View,{style:{marginRight:L.gap},children:renderSlotIcon(a,{color:E,size:L.iconSize,disabled:u},c)}):null,_jsx(Text,{style:[styles.label,{color:E,fontSize:L.fontSize,...fontFor(I,"medium")},f],numberOfLines:1,children:r??" "}),T?_jsx(Text,{style:[styles.count,{color:E,fontSize:Math.min(I.typography.fontSize.xs,L.fontSize),marginLeft:I.spacing.xs,...fontFor(I,"normal")},x],numberOfLines:1,children:t}):null,n?_jsx(Pressable,{onPress:()=>{u||(!1!==b&&triggerHaptic("impactLight"),n?.())},disabled:u,accessibilityRole:"button",accessibilityLabel:`Remove ${r}`,accessibilityState:{disabled:u},"aria-disabled":u,hitSlop:6,style:({pressed:e})=>[styles.close,{width:L.closeSize,height:L.closeSize,borderRadius:L.closeSize/2,...smoothCorners,marginLeft:L.gap,backgroundColor:e?I.colors.surface.pressed:I.colors.surface.hovered},z],children:_jsx(Text,{style:[{color:E,fontSize:L.closeFont,...fontFor(I,"bold"),lineHeight:L.closeFont+2},k],maxFontSizeMultiplier:1,children:"×"})}):null]}),U={paddingHorizontal:L.paddingH,paddingVertical:L.paddingV,minHeight:L.minHeight,borderRadius:I.radius.full,...smoothCorners,backgroundColor:R,borderWidth:$,borderColor:D,opacity:u?.55:1};let W;return W=H?_jsx(Animated.View,{style:{transform:[{scale:w}],alignSelf:"flex-start"},children:_jsx(Pressable,{ref:o,onPress:handlePress,onPressIn:_,onPressOut:F,disabled:!M,accessibilityRole:j?"radio":"multiple"===i?"checkbox":"button",accessibilityLabel:N,accessibilityState:j||"multiple"===i?{checked:s,disabled:u}:{selected:s,disabled:u},"aria-checked":j||"multiple"===i?s:void 0,"aria-selected":j||"multiple"===i?void 0:s,"aria-disabled":u,hitSlop:P,android_ripple:{color:I.colors.surface.pressed,borderless:!1},testID:C,style:({pressed:e})=>[styles.base,U,e&&"outlined"===d?{backgroundColor:I.colors.surface.pressed}:null,S,h],children:Y})}):_jsx(View,{ref:o,style:[styles.base,U,S,h],accessible:!0,accessibilityRole:"text",accessibilityLabel:N,accessibilityState:{selected:s,disabled:u},"aria-selected":s,"aria-disabled":u,testID:C,children:Y}),g?_jsx(ChipSkeleton,{...e}):W});Chip.displayName="Chip";const ChipSkeleton=({label:e,count:o,size:r="md",leftIcon:t,onClose:s,style:i,containerStyle:l})=>{const n=sizeMap[r],a=Math.max(40,Math.min(120,7*(e??"").length)),c=n.minHeight,d=c/2,p=a+2*n.paddingH+(hasChipCount(o)?n.gap/2+7*String(o).length:0)+(void 0!==t?n.gap+14:0)+(void 0!==s?n.gap+n.closeSize:0);return _jsx(Skeleton,{width:p,height:c,radius:d,style:[{alignSelf:"flex-start"},l,i]})};ChipSkeleton.displayName="ChipSkeleton",Chip.Skeleton=ChipSkeleton;const styles=StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},label:{flexShrink:1,textAlign:"center"},count:{flexShrink:0,fontVariant:["tabular-nums"]},close:{alignItems:"center",justifyContent:"center"}});export{Chip};export default Chip;
@@ -1 +1 @@
1
- "use strict";import{forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const SIZE_FALLBACK={sm:{iconSize:48,titleFontSize:"lg",descriptionFontSize:"sm",paddingVertical:"lg"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl"}},sizeFor=(e,t)=>{const i={...SIZE_FALLBACK[t],...e.components.emptyState?.[t]??{}};return{iconSize:i.iconSize,titleSize:e.typography.fontSize[i.titleFontSize],descriptionSize:e.typography.fontSize[i.descriptionFontSize],paddingVertical:e.spacing[i.paddingVertical]}},ActionButton=({action:e,variant:t})=>{const i=useTheme(),{scale:r,pressIn:o,pressOut:s}=usePressAnimation({enabled:!0}),n=useMemo(()=>buildActionStyles(i),[i]),l="primary"===t,a=useSquircle(!0,i.radius.md),fillFor=e=>l?i.colors.primary:e?i.colors.surface.pressed:"transparent";return _jsx(Animated.View,{style:{transform:[{scale:r}]},children:_jsx(Pressable,{onPress:()=>{triggerHaptic("selection"),e.onPress()},onPressIn:o,onPressOut:s,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,accessibilityHint:e.accessibilityHint,testID:e.testID,onLayout:a.onLayout,android_ripple:{color:l?i.colors.primaryHover:i.colors.surface.pressed,borderless:!1},style:({pressed:e})=>[n.button,l?n.buttonPrimary:n.buttonSecondary,!e||l||a.active?null:n.buttonSecondaryPressed,a.active?n.buttonSquircleHost:null],children:({pressed:t})=>_jsxs(_Fragment,{children:[a.active&&a.size?_jsx(SquircleFill,{width:a.size.width,height:a.size.height,radius:i.radius.md,fill:fillFor(t),stroke:l?void 0:i.colors.border.primary,strokeWidth:l?0:1,outset:l?0:1}):null,_jsx(Text,{style:[n.buttonText,l?n.buttonTextPrimary:n.buttonTextSecondary],numberOfLines:1,children:e.label})]})})})},EmptyState=forwardRef((e,t)=>{const{icon:i,title:r,description:o,action:s,secondaryAction:n,size:l="md",fill:a=!1,style:c,testID:d}=e,u=useTheme(),m=useMemo(()=>sizeFor(u,l),[u,l]),p=useMemo(()=>buildStyles(u),[u]);return _jsxs(View,{ref:t,accessibilityRole:"summary",testID:d,style:[p.root,{paddingVertical:m.paddingVertical},a?p.fill:null,c],children:[i?_jsx(View,{style:[p.iconCircle,{width:m.iconSize,height:m.iconSize,borderRadius:m.iconSize/2,...smoothCorners}],children:i}):null,_jsx(Text,{style:[p.title,{fontSize:m.titleSize,...fontFor(u,"semibold")}],children:r}),o?_jsx(Text,{style:[p.description,{fontSize:m.descriptionSize}],children:o}):null,s||n?_jsxs(View,{style:p.actions,children:[s?_jsx(ActionButton,{action:s,variant:"primary"}):null,n?_jsx(ActionButton,{action:n,variant:"secondary"}):null]}):null]})});EmptyState.displayName="EmptyState";const buildStyles=e=>StyleSheet.create({root:{alignItems:"center",justifyContent:"center",paddingHorizontal:e.spacing.lg,gap:e.spacing.md},fill:{flexGrow:1},iconCircle:{backgroundColor:e.colors.surface.disabled,alignItems:"center",justifyContent:"center"},title:{color:e.colors.text.primary,textAlign:"center"},description:{color:e.colors.text.secondary,textAlign:"center",maxWidth:320,lineHeight:e.typography.fontSize.base*e.typography.lineHeight.normal},actions:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm,marginTop:e.spacing.xs}}),buildActionStyles=e=>StyleSheet.create({button:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,minHeight:42,borderRadius:e.radius.md,...smoothCorners,alignItems:"center",justifyContent:"center",flexDirection:"row"},buttonPrimary:{backgroundColor:e.colors.primary},buttonSecondary:{backgroundColor:"transparent",borderWidth:1,borderColor:e.colors.border.primary},buttonSecondaryPressed:{backgroundColor:e.colors.surface.pressed},buttonSquircleHost:{backgroundColor:"transparent",borderColor:"transparent",overflow:"visible"},buttonText:{fontSize:e.typography.fontSize.base,...fontFor(e,"semibold")},buttonTextPrimary:{color:e.colors.onPrimary},buttonTextSecondary:{color:e.colors.text.primary}});export{EmptyState};export default EmptyState;
1
+ "use strict";import{forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const SIZE_FALLBACK={sm:{iconSize:48,titleFontSize:"lg",descriptionFontSize:"sm",paddingVertical:"lg",titleGap:"md",descriptionGap:"xs"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl",titleGap:"md",descriptionGap:"xs"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl",titleGap:"md",descriptionGap:"xs"}},sizeFor=(e,t)=>{const i={...SIZE_FALLBACK[t],...e.components.emptyState?.[t]??{}};return{iconSize:i.iconSize,titleSize:e.typography.fontSize[i.titleFontSize],descriptionSize:e.typography.fontSize[i.descriptionFontSize],paddingVertical:e.spacing[i.paddingVertical],titleGap:e.spacing[i.titleGap],descriptionGap:e.spacing[i.descriptionGap]}},ActionButton=({action:e,variant:t})=>{const i=useTheme(),{scale:r,pressIn:o,pressOut:s}=usePressAnimation({enabled:!0}),n=useMemo(()=>buildActionStyles(i),[i]),l="primary"===t,a=useSquircle(!0,i.radius.md),fillFor=e=>l?i.colors.primary:e?i.colors.surface.pressed:"transparent";return _jsx(Animated.View,{style:{transform:[{scale:r}]},children:_jsx(Pressable,{onPress:()=>{triggerHaptic("selection"),e.onPress()},onPressIn:o,onPressOut:s,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,accessibilityHint:e.accessibilityHint,testID:e.testID,onLayout:a.onLayout,android_ripple:{color:l?i.colors.primaryHover:i.colors.surface.pressed,borderless:!1},style:({pressed:e})=>[n.button,l?n.buttonPrimary:n.buttonSecondary,!e||l||a.active?null:n.buttonSecondaryPressed,a.active?n.buttonSquircleHost:null],children:({pressed:t})=>_jsxs(_Fragment,{children:[a.active&&a.size?_jsx(SquircleFill,{width:a.size.width,height:a.size.height,radius:i.radius.md,fill:fillFor(t),stroke:l?void 0:i.colors.border.primary,strokeWidth:l?0:1,outset:l?0:1}):null,_jsx(Text,{style:[n.buttonText,l?n.buttonTextPrimary:n.buttonTextSecondary],numberOfLines:1,children:e.label})]})})})},EmptyState=forwardRef((e,t)=>{const{icon:i,title:r,description:o,action:s,secondaryAction:n,size:l="md",fill:a=!1,style:c,testID:d}=e,p=useTheme(),m=useMemo(()=>sizeFor(p,l),[p,l]),u=useMemo(()=>buildStyles(p),[p]);return _jsxs(View,{ref:t,accessibilityRole:"summary",testID:d,style:[u.root,{paddingVertical:m.paddingVertical},a?u.fill:null,c],children:[i?_jsx(View,{style:[u.iconCircle,{width:m.iconSize,height:m.iconSize,marginBottom:m.titleGap,borderRadius:m.iconSize/2,...smoothCorners}],children:i}):null,_jsx(Text,{style:[u.title,{fontSize:m.titleSize,...fontFor(p,"semibold")}],children:r}),o?_jsx(Text,{style:[u.description,{fontSize:m.descriptionSize,marginTop:m.descriptionGap}],children:o}):null,s||n?_jsxs(View,{style:u.actions,children:[s?_jsx(ActionButton,{action:s,variant:"primary"}):null,n?_jsx(ActionButton,{action:n,variant:"secondary"}):null]}):null]})});EmptyState.displayName="EmptyState";const buildStyles=e=>StyleSheet.create({root:{alignItems:"center",justifyContent:"center",paddingHorizontal:e.spacing.lg},fill:{flexGrow:1},iconCircle:{backgroundColor:e.colors.surface.disabled,alignItems:"center",justifyContent:"center"},title:{color:e.colors.text.primary,textAlign:"center"},description:{color:e.colors.text.secondary,textAlign:"center",maxWidth:320,lineHeight:e.typography.fontSize.base*e.typography.lineHeight.normal},actions:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm,marginTop:e.spacing.md+e.spacing.xs}}),buildActionStyles=e=>StyleSheet.create({button:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,minHeight:42,borderRadius:e.radius.md,...smoothCorners,alignItems:"center",justifyContent:"center",flexDirection:"row"},buttonPrimary:{backgroundColor:e.colors.primary},buttonSecondary:{backgroundColor:"transparent",borderWidth:1,borderColor:e.colors.border.primary},buttonSecondaryPressed:{backgroundColor:e.colors.surface.pressed},buttonSquircleHost:{backgroundColor:"transparent",borderColor:"transparent",overflow:"visible"},buttonText:{fontSize:e.typography.fontSize.base,...fontFor(e,"semibold")},buttonTextPrimary:{color:e.colors.onPrimary},buttonTextSecondary:{color:e.colors.text.primary}});export{EmptyState};export default EmptyState;
@@ -1 +1 @@
1
- "use strict";import{Logger,publicClient}from"@webority/mobile-core";import{downloadFile}from"@webority/mobile-core/download";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Image,PixelRatio,ScrollView,StyleSheet,useWindowDimensions,View}from"react-native";import PdfRasterizer from"../../specs/NativePdfRasterizer.js";import{hashString}from"../../utils/hashString.js";import{Spinner}from"../Spinner/index.js";import{jsx as _jsx}from"react/jsx-runtime";const HAS_SCHEME=/^[a-z][a-z0-9+.-]*:/i,MAX_RENDER_SCALE=3,RENDER_WINDOW=1,toError=e=>e instanceof Error?e:new Error(String(e)),scaleForWidth=(e,t)=>{if(t<=0)return 1;const r=e/t*PixelRatio.get();return Math.min(Math.max(r,1),3)},cacheFileName=e=>{const t=(e.split("#")[0]?.split("?")[0]??"").split("/").pop()??"",r=/\.[a-z0-9]{1,8}$/i.exec(t)?.[0]??"";return`${hashString(e)}${r.toLowerCase()}`},localPathFromSource=async e=>{if(!HAS_SCHEME.test(e.uri)||e.uri.startsWith("file://"))return e.uri.replace(/^file:\/\//,"");return(await downloadFile({client:e.client??publicClient,url:e.uri,fileName:cacheFileName(e.uri),headers:e.headers,overwrite:!1===e.cache})).path};export const FileViewer=({source:e,onLoadComplete:t,onPageChanged:r,onError:i,loadingIndicator:a,style:o,testID:s,accessibilityLabel:n})=>{const{width:l}=useWindowDimensions(),[c,u]=useState(0),[h,d]=useState({width:612,height:792}),f=h.height/h.width,[m,p]=useState({}),[g,w]=useState(0),y=useRef(null),S=useRef(i);S.current=i;const b=useRef(t);b.current=t;const x=useRef(r);x.current=r;const E=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(E);if(e)return;const r=await PdfRasterizer.open(t);if(e)return void await PdfRasterizer.close(r.handle).catch(()=>{});y.current=r.handle,u(r.pageCount),w(0),p({}),r.pageWidth>0&&r.pageHeight>0&&d({width:r.pageWidth,height:r.pageHeight}),b.current?.(r.pageCount)}catch(t){if(!e){const e=toError(t);Logger.error("[@webority/mobile-ui] FileViewer failed to load.",e),S.current?.(e)}}else S.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}},[E]),useEffect(()=>()=>{const e=y.current;e&&PdfRasterizer?.close(e).catch(()=>{})},[]);const R=useCallback(async e=>{const t=y.current;if(t&&PdfRasterizer)try{const r=scaleForWidth(l,h.width),i=await PdfRasterizer.renderPage(t,e,r);p(t=>t[e]?t:{...t,[e]:i})}catch(t){Logger.error(`[@webority/mobile-ui] FileViewer failed to render page ${e}.`,toError(t))}},[h.width,l]),P=l*f;useEffect(()=>{if(0===c)return;const e=Math.max(0,g-1),t=Math.min(c-1,g+1);for(let r=e;r<=t;r+=1)R(r)},[g,c,R]);const M=useCallback(e=>{if(P<=0)return;const t=Math.min(c-1,Math.max(0,Math.round(e.nativeEvent.contentOffset.y/P)));w(e=>(e!==t&&x.current?.(t+1,c),t))},[c,P]),j=useMemo(()=>Array.from({length:c},(e,t)=>t),[c]),z=Math.max(0,g-1),C=Math.min(c-1,g+1);return _jsx(View,{style:[styles.root,o],testID:s,accessible:void 0!==n,accessibilityLabel:n,accessibilityRole:"none",children:0===c?_jsx(View,{style:styles.pagePlaceholder,children:a?a():_jsx(Spinner,{size:"lg"})}):_jsx(ScrollView,{onScroll:M,scrollEventThrottle:32,showsVerticalScrollIndicator:!0,removeClippedSubviews:!0,children:j.map(e=>{const t=e>=z&&e<=C,r=t?m[e]:void 0;return _jsx(View,{style:[styles.page,{width:l,height:P}],children:r?_jsx(Image,{source:{uri:r},style:styles.pageImage,resizeMode:"contain",accessible:!1}):_jsx(View,{style:styles.pagePlaceholder,children:t?a?.()??_jsx(Spinner,{size:"lg"}):null})},e)})})})};FileViewer.displayName="FileViewer";const styles=StyleSheet.create({root:{flex:1},page:{alignSelf:"center"},pageImage:{flex:1},pagePlaceholder:{flex:1,alignItems:"center",justifyContent:"center"}});export default FileViewer;
1
+ "use strict";import{Logger,publicClient}from"@webority/mobile-core";import{downloadFile}from"@webority/mobile-core/download";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{hashString}from"../../utils/hashString.js";import{Spinner}from"../Spinner/index.js";import{FileViewerPage}from"./FileViewerPage.js";import{useFileViewerZoom,ZOOM_REST}from"./useFileViewerZoom.js";import{jsx as _jsx}from"react/jsx-runtime";const HAS_SCHEME=/^[a-z][a-z0-9+.-]*:/i,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},cacheFileName=e=>{const t=(e.split("#")[0]?.split("?")[0]??"").split("/").pop()??"",r=/\.[a-z0-9]{1,8}$/i.exec(t)?.[0]??"";return`${hashString(e)}${r.toLowerCase()}`},localPathFromSource=async e=>{if(!HAS_SCHEME.test(e.uri)||e.uri.startsWith("file://"))return e.uri.replace(/^file:\/\//,"");return(await downloadFile({client:e.client??publicClient,url:e.uri,fileName:cacheFileName(e.uri),headers:e.headers,overwrite:!1===e.cache})).path},AnimatedScrollView=Animated.createAnimatedComponent(ScrollView);export const FileViewer=({source:e,onLoadComplete:t,onPageChanged:r,onError:i,loadingIndicator:o,zoomEnabled:a=!0,maxZoom:l=4,style:s,testID:n,accessibilityLabel:c})=>{const u=useTheme().spacing.sm,{width:h,height:d}=useWindowDimensions(),[m,f]=useState({width:0,height:0}),[p,w]=useState(0),[g,S]=useState({width:612,height:792}),E=g.height/g.width,[R,y]=useState({}),[b,x]=useState(null),[V,_]=useState(0),M=useRef(0),v=useRef(null),F=useRef(null),j=useRef(i);j.current=i;const P=useRef(t);P.current=t;const z=useRef(r);z.current=r;const C=useRef(o);C.current=o;const A=h*E,O=A+u,D=m.height>0?m.height:d,{scrollRef:L,scrollGesture:Z,zoomGesture:H,zoomStyle:N,zoomLevel:T,resetZoom:W}=useFileViewerZoom({zoomEnabled:a,maxZoom:l,viewportWidth:m.width>0?m.width:h,viewportHeight:D,maxScroll:Math.max(0,p*O-u-D)}),k=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(k);if(e)return;const r=await PdfRasterizer.open(t);if(e)return void await PdfRasterizer.close(r.handle).catch(()=>{});v.current=r.handle,M.current=0,w(r.pageCount),_(0),y({}),x(null),W(),r.pageWidth>0&&r.pageHeight>0&&S({width:r.pageWidth,height:r.pageHeight}),P.current?.(r.pageCount)}catch(t){if(!e){const e=toError(t);Logger.error("[@webority/mobile-ui] FileViewer failed to load.",e),j.current?.(e)}}else j.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=v.current;v.current=null,t&&PdfRasterizer?.close(t).catch(()=>{})}},[k,W]);const G=scaleForWidth(h,g.width,1),I=T>ZOOM_REST?scaleForWidth(h,g.width,Math.ceil(T)):0,$=useCallback(async()=>{const e=v.current;if(!e||!PdfRasterizer||0===p)return;if(F.current===e)return;let t;if(void 0===R[V])t={page:V,scale:G,sharp:!1};else if(I>G&&null!==R[V]&&(b?.page!==V||b.scale!==I))t={page:V,scale:I,sharp:!0};else for(let e=1;e<=3&&!t;e+=1)for(const r of[V+e,V-e])if(r>=0&&r<p&&void 0===R[r]){t={page:r,scale:G,sharp:!1};break}if(!t)return;const{page:r,scale:i,sharp:o}=t;F.current=e;let a=null;try{a=await PdfRasterizer.renderPage(e,r,i)}catch(t){v.current===e&&Logger.error(`[@webority/mobile-ui] FileViewer failed to render page ${r}.`,toError(t))}finally{F.current===e&&(F.current=null)}v.current===e&&(o?x({page:r,scale:i,uri:a}):y(e=>({...e,[r]:a})))},[G,V,p,R,b,I]);useEffect(()=>{$()},[$]),useEffect(()=>{T<=ZOOM_REST&&x(null)},[T]);const U=useCallback(e=>{const{width:t,height:r}=e.nativeEvent.layout;f(e=>e.width===t&&e.height===r?e:{width:t,height:r})},[]),X=useCallback(e=>{if(O<=0||0===p)return;const t=Math.min(p-1,Math.max(0,Math.round(e.nativeEvent.contentOffset.y/O)));t!==M.current&&(M.current=t,_(t),z.current?.(t+1,p))},[p,O]),q=useCallback(()=>C.current?.()??_jsx(Spinner,{size:"lg"}),[]),B=useMemo(()=>({gap:u}),[u]),J=useMemo(()=>Array.from({length:p},(e,t)=>t),[p]),K=T>ZOOM_REST;return _jsx(GestureHandlerRootView,{style:[styles.root,s],onLayout:U,testID:n,accessible:void 0!==c,accessibilityLabel:c,accessibilityRole:"none",children:0===p?_jsx(View,{style:styles.pagePlaceholder,children:o?o():_jsx(Spinner,{size:"lg"})}):_jsx(GestureDetector,{gesture:H,children:_jsx(View,{style:styles.viewport,collapsable:!1,children:_jsx(Animated.View,{style:[styles.viewport,N],children:_jsx(GestureDetector,{gesture:Z,children:_jsx(AnimatedScrollView,{ref:L,onScroll:X,scrollEventThrottle:16,scrollEnabled:!K,showsVerticalScrollIndicator:!K,contentContainerStyle:B,children:J.map(e=>_jsx(FileViewerPage,{width:h,height:A,uri:K&&b?.page===e&&b.uri?b.uri:R[e],mounted:Math.abs(e-V)<=2,renderLoading:q},e))})})})})})})};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;
@@ -0,0 +1 @@
1
+ "use strict";import{Image}from"expo-image";import{memo}from"react";import{StyleSheet,View}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";const FileViewerPageView=({width:e,height:t,uri:i,mounted:l,renderLoading:r})=>_jsx(View,{style:[styles.page,{width:e,height:t}],children:l&&i?_jsx(Image,{source:{uri:i},style:StyleSheet.absoluteFill,contentFit:"contain",cachePolicy:"none",allowDownscaling:!1,transition:0,accessible:!1}):l&&void 0===i?_jsx(View,{style:styles.pagePlaceholder,children:r()}):null});export const FileViewerPage=memo(FileViewerPageView);const styles=StyleSheet.create({page:{alignSelf:"center"},pagePlaceholder:{flex:1,alignItems:"center",justifyContent:"center"}});
@@ -0,0 +1 @@
1
+ "use strict";import{useCallback,useEffect,useMemo,useState}from"react";import{Gesture}from"react-native-gesture-handler";import{runOnJS,scrollTo,useAnimatedRef,useAnimatedStyle,useScrollViewOffset,useSharedValue,withTiming}from"react-native-reanimated";const DOUBLE_TAP_ZOOM=2.5;export const ZOOM_REST=1.01;const clamp=(e,a,l)=>{"worklet";return Math.min(Math.max(e,a),l)},panLimit=(e,a)=>{"worklet";return e*(a-1)/2};export const useFileViewerZoom=({zoomEnabled:e,maxZoom:a,viewportWidth:l,viewportHeight:u,maxScroll:t})=>{const[i,n]=useState(1),v=useAnimatedRef(),r=useScrollViewOffset(v),o=useSharedValue(0),s=useSharedValue(0),m=useSharedValue(0),c=useSharedValue(0),h=useSharedValue(1),d=useSharedValue(1),w=useSharedValue(0),S=useSharedValue(0),p=useSharedValue(0),f=useSharedValue(0);useEffect(()=>{m.value=l,c.value=u,s.value=t},[l,u,t,m,c,s]);const T=useCallback(()=>{h.value=withTiming(1),w.value=withTiming(0),S.value=withTiming(0),d.value=1,p.value=0,f.value=0,n(1)},[h,d,w,S,p,f]);useEffect(()=>{e||T()},[e,T]);const g=useCallback(e=>n(e),[]),V=useMemo(()=>Gesture.Native(),[]),k=useMemo(()=>{const l=Math.max(1,a),u=Math.min(2.5,l),t=Gesture.Pinch().enabled(e).onStart(()=>{"worklet";d.value=h.value,p.value=w.value,f.value=S.value}).onUpdate(e=>{"worklet";const a=clamp(d.value*e.scale,1,l),u=e.focalX-m.value/2,t=e.focalY-c.value/2,i=a/d.value,n=panLimit(m.value,a),v=panLimit(c.value,a);w.value=clamp(u-(u-p.value)*i,-n,n),S.value=clamp(t-(t-f.value)*i,-v,v),h.value=a}).onEnd(()=>{"worklet";if(h.value<=1.01)return h.value=withTiming(1),w.value=withTiming(0),S.value=withTiming(0),d.value=1,p.value=0,f.value=0,void runOnJS(g)(1);d.value=h.value,p.value=w.value,f.value=S.value,runOnJS(g)(h.value)}),i=Gesture.Pan().enabled(e).minPointers(1).maxPointers(1).manualActivation(!0).onTouchesMove((e,a)=>{"worklet";h.value>1.01?a.activate():a.fail()}).onStart(()=>{"worklet";p.value=w.value,f.value=S.value,o.value=r.value}).onUpdate(e=>{"worklet";const a=h.value,l=panLimit(m.value,a),u=panLimit(c.value,a);w.value=clamp(p.value+e.translationX,-l,l);const t=f.value+e.translationY,i=clamp(t,-u,u),n=t-i;if(0!==n){const e=clamp(o.value-n/a,0,s.value);e!==o.value&&(o.value=e,scrollTo(v,0,e,!1)),f.value-=n}S.value=i}).onEnd(()=>{"worklet";p.value=w.value,f.value=S.value}),n=Gesture.Tap().enabled(e).numberOfTaps(2).maxDistance(10).onEnd(e=>{"worklet";if(h.value>1.01)return h.value=withTiming(1),w.value=withTiming(0),S.value=withTiming(0),d.value=1,p.value=0,f.value=0,void runOnJS(g)(1);if(u<=1.01)return;const a=e.x-m.value/2,l=e.y-c.value/2,t=panLimit(m.value,u),i=panLimit(c.value,u),n=clamp(-a*(u-1),-t,t),v=clamp(-l*(u-1),-i,i);h.value=withTiming(u),w.value=withTiming(n),S.value=withTiming(v),d.value=u,p.value=n,f.value=v,runOnJS(g)(u)});return t.simultaneousWithExternalGesture(V),i.simultaneousWithExternalGesture(V),n.simultaneousWithExternalGesture(V),Gesture.Simultaneous(t,i,n)},[a,e,g,V,v,r,o,s,m,c,h,d,w,S,p,f]),O=useAnimatedStyle(()=>({transform:[{translateX:w.value},{translateY:S.value},{scale:h.value}]}));return{scrollRef:v,scrollGesture:V,zoomGesture:k,zoomStyle:O,zoomLevel:i,resetZoom:T}};
@@ -0,0 +1 @@
1
+ "use strict";import{forwardRef,memo,useCallback,useEffect,useMemo,useRef}from"react";import{ScrollView,StyleSheet,View}from"react-native";import{useReducedMotion}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{Chip}from"../Chip/index.js";import{jsx as _jsx}from"react/jsx-runtime";const FilterChipRowItem=memo(({itemKey:e,label:t,count:o,disabled:i,selected:r,size:a,variant:n,tone:l,haptic:s,onSelect:c,onItemLayout:u})=>{const d=useCallback(()=>c(e),[c,e]),p=useCallback(t=>u(e,t.nativeEvent.layout),[u,e]);return _jsx(View,{onLayout:p,collapsable:!1,children:_jsx(Chip,{label:t,count:o,selected:r,selectionMode:"radio",disabled:i,size:a,variant:n,tone:l,haptic:!r&&s,onPress:d})})});FilterChipRowItem.displayName="FilterChipRowItem";const FilterChipRow=forwardRef((e,t)=>{const{items:o,value:i,onChange:r,bleed:a=0,size:n,variant:l,tone:s,haptic:c,accessibilityLabel:u,style:d,contentContainerStyle:p,testID:h}=e,m=useTheme(),w=useReducedMotion(),C=useRef(null),b=useRef({viewport:0,content:0,chips:{},revealed:null}),f=useRef(i),y=useRef(r);useEffect(()=>{y.current=r},[r]);const x=useCallback((e,t)=>{const o=b.current,i=o.chips[e];if(!i||0===o.viewport||0===o.content)return;const r=i.x+i.width/2-o.viewport/2,a=Math.min(Math.max(r,0),Math.max(o.content-o.viewport,0));C.current?.scrollTo({x:a,animated:t&&!w}),o.revealed=e},[w]),R=useCallback(()=>{b.current.revealed!==f.current&&x(f.current,!1)},[x]);useEffect(()=>{f.current=i,x(i,!0)},[i,x]);const v=useCallback(e=>{b.current.viewport=e.nativeEvent.layout.width,R()},[R]),k=useCallback(e=>{b.current.content=e,R()},[R]),S=useCallback((e,t)=>{b.current.chips[e]={x:t.x,width:t.width},R()},[R]),j=useCallback(e=>{e!==f.current?y.current(e):x(e,!0)},[x]),I=useMemo(()=>[styles.row,{paddingHorizontal:a,columnGap:m.spacing.xs},p],[a,m.spacing.xs,p]);return _jsx(View,{ref:t,accessibilityRole:"radiogroup",accessibilityLabel:u,testID:h,style:[a>0?{marginHorizontal:-a}:null,d],children:_jsx(ScrollView,{ref:C,horizontal:!0,showsHorizontalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",contentContainerStyle:I,onLayout:v,onContentSizeChange:k,children:o.map(e=>_jsx(FilterChipRowItem,{itemKey:e.key,label:e.label,count:e.count,disabled:e.disabled,selected:e.key===i,size:n,variant:l,tone:s,haptic:c,onSelect:j,onItemLayout:S},e.key))})})});FilterChipRow.displayName="FilterChipRow";const styles=StyleSheet.create({row:{alignItems:"center"}});export{FilterChipRow};export default FilterChipRow;
@@ -0,0 +1 @@
1
+ "use strict";export{default,FilterChipRow}from"./FilterChipRow.js";
@@ -1 +1 @@
1
- "use strict";import React,{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{AccessibilityInfo,Animated,Easing,Platform,Pressable,StyleSheet,Text,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{ACCENT_PRESSED_TINT}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const sizeMap={sm:{diameter:40,iconSize:18,fontSize:13,labelPaddingHorizontal:14},md:{diameter:56,iconSize:22,fontSize:15,labelPaddingHorizontal:18},lg:{diameter:72,iconSize:28,fontSize:16,labelPaddingHorizontal:22}},toneBackground=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"error":return e.colors.error;case"neutral":return e.colors.background.tertiary;default:return e.colors.primary}},pressedTintFor=(e,t)=>"neutral"===t?e.colors.surface.pressed:ACCENT_PRESSED_TINT,toneForeground=(e,t)=>{if("neutral"===t)return e.colors.text.primary;switch(t){case"success":return e.colors.onSuccess;case"warning":return e.colors.onWarning;case"error":return e.colors.onError;default:return e.colors.onPrimary}},FloatingActionButton=forwardRef((e,t)=>{const{icon:o,onPress:n,label:s,size:i="md",tone:r="primary",position:a,bottomOffset:l,disabled:c=!1,hideOnScroll:u=!1,isScrolling:d=!1,accessibilityLabel:m,accessibilityHint:g,haptic:b,style:p,containerStyle:f,labelStyle:h,testID:y}=e,S=useTheme(),x=useSafeAreaInsets(),A=sizeMap[i],R=useMemo(()=>buildStyles(S),[S]),{scale:_,pressIn:w,pressOut:v}=usePressAnimation({enabled:!c}),C=S.components.floatingActionButton,j=C?.edgeOffset??24,E=C?.bottomOffset??24,I=useRef(createAnimatedValue(0)).current;useEffect(()=>{if(!u)return void setNativeValue(I,0);const e=Animated.timing(I,{toValue:d?1:0,duration:S.motion.duration.normal,easing:Easing.bezier(...S.motion.easing.standard),useNativeDriver:!0});return e.start(),()=>e.stop()},[u,d,I,S.motion.duration.normal,S.motion.easing.standard]);const P=I.interpolate({inputRange:[0,1],outputRange:[0,A.diameter+(l??E)+x.bottom+j]}),F=I.interpolate({inputRange:[0,1],outputRange:[1,0]}),V=o,T="string"==typeof s&&s.length>0,k=c?S.colors.surface.disabled:toneBackground(S,r),z=c?S.colors.text.disabled:toneForeground(S,r),D=useMemo(()=>{if(!a)return null;const e=(l??E)+x.bottom;switch(a){case"bottomLeft":return{position:"absolute",bottom:e,left:j};case"bottomCenter":return{position:"absolute",bottom:e,alignSelf:"center"};default:return{position:"absolute",bottom:e,right:j}}},[a,l,x.bottom,E,j]);return _jsx(Animated.View,{style:[D,{transform:[{translateY:P},{scale:_}],opacity:F},f,p],pointerEvents:u&&d?"none":"auto",children:_jsx(Pressable,{ref:t,onPress:e=>{if(c)return;const t=resolveHaptic(b,"impactLight");t&&triggerHaptic(t),n()},onPressIn:w,onPressOut:v,disabled:c,accessibilityRole:"button",accessibilityLabel:m,accessibilityHint:g,accessibilityState:{disabled:c},"aria-disabled":c,testID:y,style:[R.base,T?{height:A.diameter,paddingHorizontal:A.labelPaddingHorizontal,borderRadius:A.diameter/2,...smoothCorners}:{width:A.diameter,height:A.diameter,borderRadius:A.diameter/2,...smoothCorners},S.shadows.lg,{backgroundColor:k,opacity:c?.55:1}],children:({pressed:e})=>_jsxs(_Fragment,{children:[e&&!c?_jsx(View,{pointerEvents:"none",testID:"fab-pressed",style:[R.pressedTint,{backgroundColor:pressedTintFor(S,r),borderRadius:A.diameter/2,...smoothCorners}]}):null,V,T?_jsx(Text,{style:[R.label,{color:z,fontSize:A.fontSize,fontWeight:S.typography.fontWeight.semibold,marginLeft:S.spacing.sm},h],numberOfLines:1,children:s}):null]})})})});FloatingActionButton.displayName="FloatingActionButton";const buildStyles=e=>StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",overflow:"hidden"},pressedTint:{position:"absolute",top:0,right:0,bottom:0,left:0},label:{includeFontPadding:!1}}),FAB_GROUP_MIN_ACTIONS=2,FAB_GROUP_MAX_ACTIONS=6,FAB_GROUP_RANGE="2 to 6",describeActionProblem=e=>e.length<2?`was given ${e.length} action(s); a menu holds 2 to 6.`:e.length>6?`was given ${e.length} actions; a menu holds 2 to 6, so only the first 6 are drawn.`:e.some(e=>"string"!=typeof e.label||""===e.label.trim())?"has an action without a visible `label`; every menu action needs one.":"",FloatingActionButtonGroup=e=>{const{primaryIcon:t,primaryActiveIcon:o,actions:n,open:s,defaultOpen:i=!1,onOpenChange:r,position:a="bottomRight",bottomOffset:l,size:c="md",accessibilityLabel:u="Quick actions",haptic:d,hideOnScroll:m=!1,isScrolling:g=!1,containerStyle:b,secondaryActionStyle:p,labelPillStyle:f,labelStyle:h,testID:y}=e,S=useTheme(),x=useSafeAreaInsets(),A=sizeMap[c],R=useMemo(()=>buildGroupStyles(S),[S]),_=S.components.floatingActionButton,w=_?.edgeOffset??24,v=_?.bottomOffset??24,C=_?.secondaryGap??16,j=_?.staggerMs??50,E=useMemo(()=>n.slice(0,6),[n]),I=E.length,P=useMemo(()=>E.map((e,t)=>({action:e,index:t})).reverse(),[E]),F=__DEV__?describeActionProblem(n):"";useEffect(()=>{__DEV__&&F&&console.warn(`[@webority/mobile-ui] FloatingActionButtonGroup ${F}`)},[F]);const V="boolean"==typeof s,[T,k]=useState(i),z=V?s:T,D=useRef(createAnimatedValue(0)).current;useEffect(()=>{if(!m)return void setNativeValue(D,0);const e=Animated.timing(D,{toValue:g?1:0,duration:S.motion.duration.normal,easing:Easing.bezier(...S.motion.easing.standard),useNativeDriver:!0});return e.start(),()=>e.stop()},[m,g,D,S.motion.duration.normal,S.motion.easing.standard]);const O=m&&g;useEffect(()=>{O&&z&&(V||k(!1),r?.(!1))},[O,z,V,r]);const B=D.interpolate({inputRange:[0,1],outputRange:[0,A.diameter+(l??v)+x.bottom+w]}),N=D.interpolate({inputRange:[0,1],outputRange:[1,0]}),H=useRef(createAnimatedValue(z?1:0)).current,L=useRef([]),[M,$]=useState(0);useEffect(()=>{const e=L.current;if(e.length!==I){if(e.length<I){const t=e.slice();for(let o=e.length;o<I;o+=1)t.push(new Animated.Value(z?1:0));L.current=t}else L.current=e.slice(0,I);$(e=>e+1)}},[I]),useEffect(()=>{const e=Animated.timing(H,{toValue:z?1:0,duration:S.motion.duration.normal,easing:Easing.bezier(...S.motion.easing.standard),useNativeDriver:!0});e.start();const t=L.current.map(e=>Animated.timing(e,{toValue:z?1:0,duration:S.motion.duration.normal,easing:Easing.bezier(...S.motion.easing.standard),useNativeDriver:!0})),o=z?t:[...t].reverse(),n=Animated.stagger(j,o);return n.start(),()=>{e.stop(),n.stop()}},[z,H,S.motion.duration.normal,S.motion.easing.standard,I,M,j]);const G=useCallback(e=>{const t=resolveHaptic(d,"impactLight");t&&triggerHaptic(t),V||k(e),r?.(e)},[V,r,d]),W=useRef(null),U=useRef(z),Y=useRef(!1);useEffect(()=>{if(U.current===z)return;U.current=z;const e=Y.current;if(Y.current=!1,O||e)return;const t=W.current;t&&("web"===Platform.OS?t.focus?.():AccessibilityInfo.sendAccessibilityEvent(t,"focus"));announce(z?`${u}, expanded, ${I} ${1===I?"action":"actions"}`:`${u}, collapsed`)},[z,O,u,I]);const Q=useCallback(()=>{G(!z)},[z,G]),X=useCallback(e=>{!1!==d&&triggerHaptic("selection"),Y.current=!0,e.onPress(),V||k(!1),r?.(!1)},[V,r,d]),q=useCallback(()=>{z&&G(!1)},[z,G]),J=useMemo(()=>{const e=(l??v)+x.bottom;switch(a){case"bottomLeft":return{position:"absolute",bottom:e,left:w,alignItems:"flex-start"};case"bottomCenter":return{position:"absolute",bottom:e,alignSelf:"center",alignItems:"center"};default:return{position:"absolute",bottom:e,right:w,alignItems:"flex-end"}}},[a,l,x.bottom,v,w]),slotOffset=e=>-(A.diameter+C)*(e+1),K=useMemo(()=>{switch(a){case"bottomLeft":return{left:0,right:0,justifyContent:"flex-start"};case"bottomCenter":return{left:0,right:0,justifyContent:"center"};default:return{left:0,right:0,justifyContent:"flex-end"}}},[a]),Z=.78*A.diameter,ee=useMemo(()=>{const e=Z+S.spacing.sm;switch(a){case"bottomLeft":return{left:e,alignItems:"flex-start"};case"bottomCenter":return{right:A.diameter/2+Z/2+S.spacing.sm,alignItems:"flex-end"};default:return{right:e,alignItems:"flex-end"}}},[a,Z,A.diameter,S.spacing.sm]),te=H.interpolate({inputRange:[0,1],outputRange:[0,.4]}),oe=H.interpolate({inputRange:[0,1],outputRange:["0deg","45deg"]});return _jsxs(_Fragment,{children:[z?_jsx(Animated.View,{pointerEvents:z?"auto":"none",style:[StyleSheet.absoluteFill,{backgroundColor:S.colors.background.overlay,opacity:te}],children:_jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:q,accessibilityElementsHidden:!0,importantForAccessibility:"no",testID:y?`${y}-backdrop`:void 0})}):null,_jsxs(Animated.View,{pointerEvents:O?"none":"box-none",style:[J,{transform:[{translateY:B}],opacity:N},b],accessibilityRole:"menu",testID:y,children:[P.map(({action:e,index:t})=>{const o=L.current[t];if(!o)return null;const n=o.interpolate({inputRange:[0,1],outputRange:[0,slotOffset(t)]}),s=o.interpolate({inputRange:[0,1],outputRange:[.6,1]}),i=toneBackground(S,e.tone??"primary"),r=toneForeground(S,e.tone??"primary"),a=e.label?_jsx(View,{pointerEvents:"none",style:[R.labelSlot,ee],testID:y?`${y}-label-${e.key}`:void 0,children:_jsx(View,{style:[R.labelPill,S.shadows.sm,{backgroundColor:S.colors.background.elevated,paddingHorizontal:S.spacing.sm,paddingVertical:S.spacing.xs,borderRadius:S.radius.sm,...smoothCorners},f],children:_jsx(Text,{style:[{color:S.colors.text.primary,fontSize:S.typography.fontSize.sm,fontWeight:S.typography.fontWeight.medium},h],numberOfLines:1,children:e.label})})}):null;return _jsxs(Animated.View,{pointerEvents:z?"auto":"none",accessibilityElementsHidden:!z,importantForAccessibility:z?"auto":"no-hide-descendants","aria-hidden":!z,style:[R.secondaryRow,K,{position:"absolute",bottom:0,opacity:o,transform:[{translateY:n},{scale:s}]}],children:[_jsx(Pressable,{onPress:()=>X(e),focusable:z,accessibilityRole:"menuitem",accessibilityLabel:e.accessibilityLabel,style:[R.fabBase,S.shadows.md,{width:Z,height:Z,borderRadius:Z/2,...smoothCorners,backgroundColor:i},p],testID:y?`${y}-action-${e.key}`:void 0,children:({pressed:t})=>_jsxs(_Fragment,{children:[t?_jsx(View,{pointerEvents:"none",testID:"fab-pressed",style:[R.pressedTint,{backgroundColor:pressedTintFor(S,e.tone??"primary"),borderRadius:Z/2,...smoothCorners}]}):null,React.isValidElement(e.icon)?e.icon:_jsx(Text,{style:{color:r},children:String(e.icon??"")})]})}),a]},e.key)}),_jsx(Pressable,{ref:W,onPress:Q,accessibilityRole:"button",accessibilityLabel:u,accessibilityState:{expanded:z},"aria-expanded":z,style:[R.fabBase,S.shadows.lg,{width:A.diameter,height:A.diameter,borderRadius:A.diameter/2,...smoothCorners,backgroundColor:S.colors.primary}],testID:y?`${y}-primary`:void 0,children:({pressed:e})=>_jsxs(_Fragment,{children:[e?_jsx(View,{pointerEvents:"none",testID:"fab-pressed",style:[R.pressedTint,{backgroundColor:ACCENT_PRESSED_TINT,borderRadius:A.diameter/2,...smoothCorners}]}):null,_jsx(Animated.View,{style:o?void 0:{transform:[{rotate:oe}]},children:z&&o?o:t})]})})]})]})},buildGroupStyles=e=>StyleSheet.create({fabBase:{flexDirection:"row",alignItems:"center",justifyContent:"center",overflow:"hidden"},pressedTint:{position:"absolute",top:0,right:0,bottom:0,left:0},secondaryRow:{flexDirection:"row",alignItems:"center"},labelSlot:{position:"absolute",top:0,bottom:0,justifyContent:"center"},labelPill:{alignSelf:"auto"}});export{FloatingActionButton,FloatingActionButtonGroup};export default FloatingActionButton;
1
+ "use strict";import React,{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{AccessibilityInfo,Animated,Easing,Platform,Pressable,StyleSheet,Text,View}from"react-native";import Reanimated,{cancelAnimation,Easing as ReanimatedEasing,useAnimatedStyle,useSharedValue,withTiming}from"react-native-reanimated";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{ACCENT_PRESSED_TINT}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const sizeMap={sm:{diameter:40,iconSize:18,fontSize:13,labelPaddingHorizontal:14},md:{diameter:56,iconSize:22,fontSize:15,labelPaddingHorizontal:18},lg:{diameter:72,iconSize:28,fontSize:16,labelPaddingHorizontal:22}},toneBackground=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"error":return e.colors.error;case"neutral":return e.colors.background.tertiary;default:return e.colors.primary}},pressedTintFor=(e,t)=>"neutral"===t?e.colors.surface.pressed:ACCENT_PRESSED_TINT,toneForeground=(e,t)=>{if("neutral"===t)return e.colors.text.primary;switch(t){case"success":return e.colors.onSuccess;case"warning":return e.colors.onWarning;case"error":return e.colors.onError;default:return e.colors.onPrimary}},FloatingActionButton=forwardRef((e,t)=>{const{icon:o,onPress:n,label:i,collapsed:s=!1,size:r="md",tone:a="primary",position:l,bottomOffset:c,disabled:u=!1,hideOnScroll:d=!1,isScrolling:m=!1,accessibilityLabel:g,accessibilityHint:b,haptic:p,style:f,containerStyle:h,labelStyle:y,testID:S}=e,x=useTheme(),R=useSafeAreaInsets(),w=sizeMap[r],A=useMemo(()=>buildStyles(x),[x]),{scale:v,pressIn:_,pressOut:C}=usePressAnimation({enabled:!u}),E=x.components.floatingActionButton,j=E?.edgeOffset??24,I=E?.bottomOffset??24,P=useRef(createAnimatedValue(0)).current;useEffect(()=>{if(!d)return void setNativeValue(P,0);const e=Animated.timing(P,{toValue:m?1:0,duration:x.motion.duration.normal,easing:Easing.bezier(...x.motion.easing.standard),useNativeDriver:!0});return e.start(),()=>e.stop()},[d,m,P,x.motion.duration.normal,x.motion.easing.standard]);const V=P.interpolate({inputRange:[0,1],outputRange:[0,w.diameter+(c??I)+R.bottom+j]}),k=P.interpolate({inputRange:[0,1],outputRange:[1,0]}),F=o,T="string"==typeof i&&i.length>0,z=T&&s,D=useReducedMotion(),M=x.spacing.sm,O=w.labelPaddingHorizontal,B=x.motion.duration.fast,N=x.motion.easing.standard,H=useSharedValue(z?1:0),[L,$]=useState(null);useEffect(()=>{const e=z?1:0;return H.value=D?e:withTiming(e,{duration:B,easing:ReanimatedEasing.bezier(...N)}),()=>cancelAnimation(H)},[z,D,H,B,N]);const G=useCallback(e=>{const t=Math.ceil(e);$(e=>e===t?e:t)},[]),W=useAnimatedStyle(()=>({paddingHorizontal:O*(1-H.value)})),U=useAnimatedStyle(()=>{const e=Math.max(0,1-2*H.value);return null===L?H.value>=1?{opacity:e,width:0}:{opacity:e}:{opacity:e,width:(L+M)*(1-H.value)}}),Y=u?x.colors.surface.disabled:toneBackground(x,a),Q=u?x.colors.text.disabled:toneForeground(x,a),X=useMemo(()=>{if(!l)return null;const e=(c??I)+R.bottom;switch(l){case"bottomLeft":return{position:"absolute",bottom:e,left:j};case"bottomCenter":return{position:"absolute",bottom:e,alignSelf:"center"};default:return{position:"absolute",bottom:e,right:j}}},[l,c,R.bottom,I,j]);return _jsx(Animated.View,{style:[X,{transform:[{translateY:V},{scale:v}],opacity:k},h,f],pointerEvents:d&&m?"none":"auto",children:_jsx(Pressable,{ref:t,onPress:e=>{if(u)return;const t=resolveHaptic(p,"impactLight");t&&triggerHaptic(t),n()},onPressIn:_,onPressOut:C,disabled:u,accessibilityRole:"button",accessibilityLabel:g,accessibilityHint:b,accessibilityState:{disabled:u},"aria-disabled":u,testID:S,style:[A.base,T?{height:w.diameter,minWidth:w.diameter,borderRadius:w.diameter/2,...smoothCorners}:{width:w.diameter,height:w.diameter,borderRadius:w.diameter/2,...smoothCorners},x.shadows.lg,{backgroundColor:Y,opacity:u?.55:1}],children:({pressed:e})=>_jsxs(_Fragment,{children:[e&&!u?_jsx(View,{pointerEvents:"none",testID:"fab-pressed",style:[A.pressedTint,{backgroundColor:pressedTintFor(x,a),borderRadius:w.diameter/2,...smoothCorners}]}):null,T?_jsxs(Reanimated.View,{style:[A.extendedRow,W],children:[F,_jsx(Reanimated.View,{style:[A.labelClip,U],children:_jsx(Text,{onLayout:e=>G(e.nativeEvent.layout.width),style:[A.label,{color:Q,fontSize:w.fontSize,fontWeight:x.typography.fontWeight.semibold,marginLeft:M},y],numberOfLines:1,children:i})})]}):F]})})})});FloatingActionButton.displayName="FloatingActionButton";const buildStyles=e=>StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",overflow:"hidden"},pressedTint:{position:"absolute",top:0,right:0,bottom:0,left:0},extendedRow:{flexDirection:"row",alignItems:"center"},labelClip:{flexDirection:"row",overflow:"hidden"},label:{includeFontPadding:!1,flexShrink:0}}),FAB_GROUP_MIN_ACTIONS=2,FAB_GROUP_MAX_ACTIONS=6,FAB_GROUP_RANGE="2 to 6",describeActionProblem=e=>e.length<2?`was given ${e.length} action(s); a menu holds 2 to 6.`:e.length>6?`was given ${e.length} actions; a menu holds 2 to 6, so only the first 6 are drawn.`:e.some(e=>"string"!=typeof e.label||""===e.label.trim())?"has an action without a visible `label`; every menu action needs one.":"",FloatingActionButtonGroup=e=>{const{primaryIcon:t,primaryActiveIcon:o,actions:n,open:i,defaultOpen:s=!1,onOpenChange:r,position:a="bottomRight",bottomOffset:l,size:c="md",accessibilityLabel:u="Quick actions",haptic:d,hideOnScroll:m=!1,isScrolling:g=!1,containerStyle:b,secondaryActionStyle:p,labelPillStyle:f,labelStyle:h,testID:y}=e,S=useTheme(),x=useSafeAreaInsets(),R=sizeMap[c],w=useMemo(()=>buildGroupStyles(S),[S]),A=S.components.floatingActionButton,v=A?.edgeOffset??24,_=A?.bottomOffset??24,C=A?.secondaryGap??16,E=A?.staggerMs??50,j=useMemo(()=>n.slice(0,6),[n]),I=j.length,P=useMemo(()=>j.map((e,t)=>({action:e,index:t})).reverse(),[j]),V=__DEV__?describeActionProblem(n):"";useEffect(()=>{__DEV__&&V&&console.warn(`[@webority/mobile-ui] FloatingActionButtonGroup ${V}`)},[V]);const k="boolean"==typeof i,[F,T]=useState(s),z=k?i:F,D=useRef(createAnimatedValue(0)).current;useEffect(()=>{if(!m)return void setNativeValue(D,0);const e=Animated.timing(D,{toValue:g?1:0,duration:S.motion.duration.normal,easing:Easing.bezier(...S.motion.easing.standard),useNativeDriver:!0});return e.start(),()=>e.stop()},[m,g,D,S.motion.duration.normal,S.motion.easing.standard]);const M=m&&g;useEffect(()=>{M&&z&&(k||T(!1),r?.(!1))},[M,z,k,r]);const O=D.interpolate({inputRange:[0,1],outputRange:[0,R.diameter+(l??_)+x.bottom+v]}),B=D.interpolate({inputRange:[0,1],outputRange:[1,0]}),N=useRef(createAnimatedValue(z?1:0)).current,H=useRef([]),[L,$]=useState(0);useEffect(()=>{const e=H.current;if(e.length!==I){if(e.length<I){const t=e.slice();for(let o=e.length;o<I;o+=1)t.push(new Animated.Value(z?1:0));H.current=t}else H.current=e.slice(0,I);$(e=>e+1)}},[I]),useEffect(()=>{const e=Animated.timing(N,{toValue:z?1:0,duration:S.motion.duration.normal,easing:Easing.bezier(...S.motion.easing.standard),useNativeDriver:!0});e.start();const t=H.current.map(e=>Animated.timing(e,{toValue:z?1:0,duration:S.motion.duration.normal,easing:Easing.bezier(...S.motion.easing.standard),useNativeDriver:!0})),o=z?t:[...t].reverse(),n=Animated.stagger(E,o);return n.start(),()=>{e.stop(),n.stop()}},[z,N,S.motion.duration.normal,S.motion.easing.standard,I,L,E]);const G=useCallback(e=>{const t=resolveHaptic(d,"impactLight");t&&triggerHaptic(t),k||T(e),r?.(e)},[k,r,d]),W=useRef(null),U=useRef(z),Y=useRef(!1);useEffect(()=>{if(U.current===z)return;U.current=z;const e=Y.current;if(Y.current=!1,M||e)return;const t=W.current;t&&("web"===Platform.OS?t.focus?.():AccessibilityInfo.sendAccessibilityEvent(t,"focus"));announce(z?`${u}, expanded, ${I} ${1===I?"action":"actions"}`:`${u}, collapsed`)},[z,M,u,I]);const Q=useCallback(()=>{G(!z)},[z,G]),X=useCallback(e=>{!1!==d&&triggerHaptic("selection"),Y.current=!0,e.onPress(),k||T(!1),r?.(!1)},[k,r,d]),q=useCallback(()=>{z&&G(!1)},[z,G]),J=useMemo(()=>{const e=(l??_)+x.bottom;switch(a){case"bottomLeft":return{position:"absolute",bottom:e,left:v,alignItems:"flex-start"};case"bottomCenter":return{position:"absolute",bottom:e,alignSelf:"center",alignItems:"center"};default:return{position:"absolute",bottom:e,right:v,alignItems:"flex-end"}}},[a,l,x.bottom,_,v]),slotOffset=e=>-(R.diameter+C)*(e+1),K=useMemo(()=>{switch(a){case"bottomLeft":return{left:0,right:0,justifyContent:"flex-start"};case"bottomCenter":return{left:0,right:0,justifyContent:"center"};default:return{left:0,right:0,justifyContent:"flex-end"}}},[a]),Z=.78*R.diameter,ee=useMemo(()=>{const e=Z+S.spacing.sm;switch(a){case"bottomLeft":return{left:e,alignItems:"flex-start"};case"bottomCenter":return{right:R.diameter/2+Z/2+S.spacing.sm,alignItems:"flex-end"};default:return{right:e,alignItems:"flex-end"}}},[a,Z,R.diameter,S.spacing.sm]),te=N.interpolate({inputRange:[0,1],outputRange:[0,.4]}),oe=N.interpolate({inputRange:[0,1],outputRange:["0deg","45deg"]});return _jsxs(_Fragment,{children:[z?_jsx(Animated.View,{pointerEvents:z?"auto":"none",style:[StyleSheet.absoluteFill,{backgroundColor:S.colors.background.overlay,opacity:te}],children:_jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:q,accessibilityElementsHidden:!0,importantForAccessibility:"no",testID:y?`${y}-backdrop`:void 0})}):null,_jsxs(Animated.View,{pointerEvents:M?"none":"box-none",style:[J,{transform:[{translateY:O}],opacity:B},b],accessibilityRole:"menu",testID:y,children:[P.map(({action:e,index:t})=>{const o=H.current[t];if(!o)return null;const n=o.interpolate({inputRange:[0,1],outputRange:[0,slotOffset(t)]}),i=o.interpolate({inputRange:[0,1],outputRange:[.6,1]}),s=toneBackground(S,e.tone??"primary"),r=toneForeground(S,e.tone??"primary"),a=e.label?_jsx(View,{pointerEvents:"none",style:[w.labelSlot,ee],testID:y?`${y}-label-${e.key}`:void 0,children:_jsx(View,{style:[w.labelPill,S.shadows.sm,{backgroundColor:S.colors.background.elevated,paddingHorizontal:S.spacing.sm,paddingVertical:S.spacing.xs,borderRadius:S.radius.sm,...smoothCorners},f],children:_jsx(Text,{style:[{color:S.colors.text.primary,fontSize:S.typography.fontSize.sm,fontWeight:S.typography.fontWeight.medium},h],numberOfLines:1,children:e.label})})}):null;return _jsxs(Animated.View,{pointerEvents:z?"auto":"none",accessibilityElementsHidden:!z,importantForAccessibility:z?"auto":"no-hide-descendants","aria-hidden":!z,style:[w.secondaryRow,K,{position:"absolute",bottom:0,opacity:o,transform:[{translateY:n},{scale:i}]}],children:[_jsx(Pressable,{onPress:()=>X(e),focusable:z,accessibilityRole:"menuitem",accessibilityLabel:e.accessibilityLabel,style:[w.fabBase,S.shadows.md,{width:Z,height:Z,borderRadius:Z/2,...smoothCorners,backgroundColor:s},p],testID:y?`${y}-action-${e.key}`:void 0,children:({pressed:t})=>_jsxs(_Fragment,{children:[t?_jsx(View,{pointerEvents:"none",testID:"fab-pressed",style:[w.pressedTint,{backgroundColor:pressedTintFor(S,e.tone??"primary"),borderRadius:Z/2,...smoothCorners}]}):null,React.isValidElement(e.icon)?e.icon:_jsx(Text,{style:{color:r},children:String(e.icon??"")})]})}),a]},e.key)}),_jsx(Pressable,{ref:W,onPress:Q,accessibilityRole:"button",accessibilityLabel:u,accessibilityState:{expanded:z},"aria-expanded":z,style:[w.fabBase,S.shadows.lg,{width:R.diameter,height:R.diameter,borderRadius:R.diameter/2,...smoothCorners,backgroundColor:S.colors.primary}],testID:y?`${y}-primary`:void 0,children:({pressed:e})=>_jsxs(_Fragment,{children:[e?_jsx(View,{pointerEvents:"none",testID:"fab-pressed",style:[w.pressedTint,{backgroundColor:ACCENT_PRESSED_TINT,borderRadius:R.diameter/2,...smoothCorners}]}):null,_jsx(Animated.View,{style:o?void 0:{transform:[{rotate:oe}]},children:z&&o?o:t})]})})]})]})},buildGroupStyles=e=>StyleSheet.create({fabBase:{flexDirection:"row",alignItems:"center",justifyContent:"center",overflow:"hidden"},pressedTint:{position:"absolute",top:0,right:0,bottom:0,left:0},secondaryRow:{flexDirection:"row",alignItems:"center"},labelSlot:{position:"absolute",top:0,bottom:0,justifyContent:"center"},labelPill:{alignSelf:"auto"}});export{FloatingActionButton,FloatingActionButtonGroup};export default FloatingActionButton;
@@ -1 +1 @@
1
- "use strict";import{forwardRef}from"react";import{Keyboard,Pressable,RefreshControl}from"react-native";import{KeyboardAwareScrollView as ControllerScrollView}from"react-native-keyboard-controller";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useTheme}from"../../theme/index.js";import{jsx as _jsx}from"react/jsx-runtime";const tapAreaStyle={flexGrow:1},KeyboardAwareScrollView=forwardRef((e,r)=>{const{children:o,bottomOffset:t=24,extraKeyboardSpace:a=0,safeAreaEdges:s=["bottom"],refreshing:l=!1,onRefresh:i,dismissOnTapOutside:n=!1,contentContainerStyle:d,refreshControl:c,...f}=e,m=useTheme(),p=useSafeAreaInsets(),b=s.includes("bottom"),y={paddingBottom:b?p.bottom:0,...s.includes("top")?{paddingTop:p.top}:null,...s.includes("left")?{paddingLeft:p.left}:null,...s.includes("right")?{paddingRight:p.right}:null},h=c??(i?_jsx(RefreshControl,{refreshing:l,onRefresh:i,tintColor:m.colors.primary,colors:[m.colors.primary]}):void 0);return _jsx(ControllerScrollView,{ref:r,bottomOffset:t,extraKeyboardSpace:a-(b?p.bottom:0),keyboardShouldPersistTaps:"handled",keyboardDismissMode:"none",contentContainerStyle:[d,y],refreshControl:h,...f,children:n?_jsx(Pressable,{accessible:!1,onPress:Keyboard.dismiss,style:tapAreaStyle,children:o}):o})});KeyboardAwareScrollView.displayName="KeyboardAwareScrollView";export{KeyboardAwareScrollView};export default KeyboardAwareScrollView;
1
+ "use strict";import{forwardRef}from"react";import{Keyboard,Pressable,RefreshControl}from"react-native";import{KeyboardAwareScrollView as ControllerScrollView}from"react-native-keyboard-controller";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useTheme}from"../../theme/index.js";import{jsx as _jsx}from"react/jsx-runtime";const tapAreaStyle={flexGrow:1},KeyboardAwareScrollView=forwardRef((e,r)=>{const{children:o,bottomOffset:t=24,extraKeyboardSpace:a=0,safeAreaEdges:s=["bottom"],refreshing:l=!1,onRefresh:i,dismissOnTapOutside:n=!1,contentContainerStyle:d,refreshControl:c,...f}=e,m=useTheme(),p=useSafeAreaInsets(),b=s.includes("bottom"),y={paddingBottom:b?p.bottom:0,...s.includes("top")?{paddingTop:p.top}:null,...s.includes("left")?{paddingLeft:p.left}:null,...s.includes("right")?{paddingRight:p.right}:null},h=c??(i?_jsx(RefreshControl,{refreshing:l,onRefresh:i,tintColor:m.colors.primary,colors:[m.colors.primary],progressBackgroundColor:m.colors.background.elevated,titleColor:m.colors.text.secondary}):void 0);return _jsx(ControllerScrollView,{ref:r,bottomOffset:t,extraKeyboardSpace:a-(b?p.bottom:0),keyboardShouldPersistTaps:"handled",keyboardDismissMode:"none",contentContainerStyle:[d,y],refreshControl:h,...f,children:n?_jsx(Pressable,{accessible:!1,onPress:Keyboard.dismiss,style:tapAreaStyle,children:o}):o})});KeyboardAwareScrollView.displayName="KeyboardAwareScrollView";export{KeyboardAwareScrollView};export default KeyboardAwareScrollView;
@@ -1 +1 @@
1
- "use strict";import{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Easing,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,Gradient,setNativeValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.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"error":return e.colors.error;default:return e.colors.primary}},clampProgress=e=>"number"!=typeof e||Number.isNaN(e)||e<0?0:e>1?1:e,ProgressBar=forwardRef((e,t)=>{const r=useTheme(),{progress:s,label:o,showPercent:a=!1,indeterminate:i,height:n=6,radius:l,tone:u="primary",trackColor:c,barColor:d,gradient:m,segments:p,animated:g=!0,style:h,containerStyle:f,barStyle:y,accessibilityLabel:b,testID:w}=e,x=i??"number"!=typeof s,V=clampProgress(s),j=useRef(createAnimatedValue(V)).current,R=useRef(createAnimatedValue(0)).current,v=useRef(createAnimatedValue(0)).current,A=useRef(0),C=r.components.progressBar?.determinateAnimationDuration??400,B=r.components.progressBar?.indeterminateLoopDuration??1500,S=r.components.progressBar?.indeterminateWidth??"30%",_=useMemo(()=>buildStyles(r),[r]),N=l??r.radius.full,P=c??r.colors.surface.disabled,k=d??toneColor(r,u),D=useMemo(()=>m?"string"==typeof m?r.gradients[m]??null:m:null,[m,r.gradients]),E=Array.isArray(p)&&p.length>0;useEffect(()=>{x||(g?Animated.timing(j,{toValue:V,duration:C,easing:Easing.bezier(...r.motion.easing.standard),useNativeDriver:!1}).start():j.setValue(V))},[g,V,C,j,x,r]),useEffect(()=>{if(!x)return;setNativeValue(R,0);const e=Animated.loop(Animated.timing(R,{toValue:1,duration:B,easing:Easing.inOut(Easing.ease),useNativeDriver:!0}));return e.start(),()=>{e.stop()}},[x,R,B]);const L=j.interpolate({inputRange:[0,1],outputRange:["0%","100%"]}),M=R.interpolate({inputRange:[0,1],outputRange:[-1,1]}),T=a&&!x&&!E,F=null!=o||T,z=_jsx(View,{ref:t,accessibilityRole:"progressbar",accessibilityLabel:b??("string"==typeof o?o:void 0),accessibilityValue:x?{text:"Loading"}:{min:0,max:100,now:Math.round(100*V)},testID:w,onLayout:e=>{const t=e.nativeEvent.layout.width;A.current=t,setNativeValue(v,t)},style:[_.track,{height:n,borderRadius:N,...smoothCorners,backgroundColor:P},h,f],children:E?_jsx(View,{style:[_.segments,{height:n}],children:(p??[]).map((e,t)=>_jsx(View,{style:{width:100*clampProgress(e.value)+"%",height:n,backgroundColor:e.color??toneColor(r,e.tone??"primary")}},t))}):_jsx(Animated.View,x?{style:[_.indeterminateBar,{height:n,borderRadius:N,...smoothCorners,backgroundColor:k,width:S,transform:[{translateX:Animated.multiply(M,v)}]},y]}:{style:[_.determinateBar,{height:n,borderRadius:N,...smoothCorners,backgroundColor:D?"transparent":k,width:L,overflow:D?"hidden":void 0},y],children:D?_jsx(Gradient,{gradient:D,style:StyleSheet.absoluteFill}):null})});if(!F)return z;const G={fontSize:r.typography.fontSize.sm,...fontFor(r,"medium")};return _jsxs(View,{style:_.wrapper,children:[_jsxs(View,{style:[_.labelRow,{marginBottom:r.spacing.xs}],children:["string"==typeof o||"number"==typeof o?_jsx(Text,{style:[_.label,G,{color:r.colors.text.primary}],children:o}):_jsx(View,{style:_.label,children:o}),T?_jsx(Text,{accessible:!1,importantForAccessibility:"no",style:[G,{color:r.colors.text.secondary}],children:`${Math.round(100*V)}%`}):null]}),z]})});ProgressBar.displayName="ProgressBar";const buildStyles=e=>StyleSheet.create({wrapper:{width:"100%"},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:8},label:{flexShrink:1},track:{width:"100%",overflow:"hidden"},determinateBar:{position:"absolute",left:0,top:0},indeterminateBar:{position:"absolute",left:0,top:0},segments:{flexDirection:"row",width:"100%"}});export{ProgressBar};export default ProgressBar;
1
+ "use strict";import{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Easing,StyleSheet,Text,View}from"react-native";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{createAnimatedValue,fontFor,Gradient,setNativeValue,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.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"error":return e.colors.error;default:return e.colors.primary}},GLOW_LOCATIONS=[0,.35,.5,.65,1],glowOf=e=>{const t=tintOf(e,0,"transparent"),r=tintOf(e,.6,e);return{colors:[t,r,e,r,t],locations:GLOW_LOCATIONS,start:{x:0,y:.5},end:{x:1,y:.5}}},clampProgress=e=>"number"!=typeof e||Number.isNaN(e)||e<0?0:e>1?1:e,ProgressBar=forwardRef((e,t)=>{const r=useTheme(),s=useReducedMotion(),{progress:o,label:i,showPercent:n=!1,indeterminate:a,height:l=6,radius:u,tone:c="primary",trackColor:d,barColor:m,gradient:p,segments:g,animated:f=!0,style:h,containerStyle:y,barStyle:b,accessibilityLabel:w,testID:x}=e,j=a??"number"!=typeof o,R=clampProgress(o),V=useRef(createAnimatedValue(R)).current,S=useRef(createAnimatedValue(0)).current,A=useRef(createAnimatedValue(0)).current,v=useRef(0),_=r.components.progressBar?.determinateAnimationDuration??400,C=r.components.progressBar?.indeterminateLoopDuration??1500,B=r.components.progressBar?.indeterminateWidth??"30%",O=useMemo(()=>buildStyles(r),[r]),N=u??r.radius.full,L=d??r.colors.surface.disabled,M=m??toneColor(r,c),P=useMemo(()=>p?"string"==typeof p?r.gradients[p]??null:p:null,[p,r.gradients]),k=useMemo(()=>glowOf(M),[M]),D=Array.isArray(g)&&g.length>0;useEffect(()=>{j||(f?Animated.timing(V,{toValue:R,duration:_,easing:Easing.bezier(...r.motion.easing.standard),useNativeDriver:!1}).start():V.setValue(R))},[f,R,_,V,j,r]),useEffect(()=>{if(!j||s)return;setNativeValue(S,0);const e=Animated.loop(Animated.timing(S,{toValue:1,duration:C,easing:Easing.inOut(Easing.ease),useNativeDriver:!0}));return e.start(),()=>{e.stop()}},[j,s,S,C]);const E=V.interpolate({inputRange:[0,1],outputRange:["0%","100%"]}),T=S.interpolate({inputRange:[0,1],outputRange:[-1,1]}),G=n&&!j&&!D,F=null!=i||G,I=_jsx(View,{ref:t,accessibilityRole:"progressbar",accessibilityLabel:w??("string"==typeof i?i:void 0),accessibilityValue:j?{text:"Loading"}:{min:0,max:100,now:Math.round(100*R)},testID:x,onLayout:e=>{const t=e.nativeEvent.layout.width;v.current=t,setNativeValue(A,t)},style:[O.track,{height:l,borderRadius:N,...smoothCorners,backgroundColor:L},h,y],children:D?_jsx(View,{style:[O.segments,{height:l}],children:(g??[]).map((e,t)=>_jsx(View,{style:{width:100*clampProgress(e.value)+"%",height:l,backgroundColor:e.color??toneColor(r,e.tone??"primary")}},t))}):_jsx(Animated.View,j?{style:[O.indeterminateBar,{height:l,width:s?"100%":B,transform:s?[]:[{translateX:Animated.multiply(T,A)}]},b],children:_jsx(Gradient,{gradient:k,style:StyleSheet.absoluteFill})}:{style:[O.determinateBar,{height:l,borderRadius:N,...smoothCorners,backgroundColor:P?"transparent":M,width:E,overflow:P?"hidden":void 0},b],children:P?_jsx(Gradient,{gradient:P,style:StyleSheet.absoluteFill}):null})});if(!F)return I;const z={fontSize:r.typography.fontSize.sm,...fontFor(r,"medium")};return _jsxs(View,{style:O.wrapper,children:[_jsxs(View,{style:[O.labelRow,{marginBottom:r.spacing.xs}],children:["string"==typeof i||"number"==typeof i?_jsx(Text,{style:[O.label,z,{color:r.colors.text.primary}],children:i}):_jsx(View,{style:O.label,children:i}),G?_jsx(Text,{accessible:!1,importantForAccessibility:"no",style:[z,{color:r.colors.text.secondary}],children:`${Math.round(100*R)}%`}):null]}),I]})});ProgressBar.displayName="ProgressBar";const buildStyles=e=>StyleSheet.create({wrapper:{width:"100%"},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:8},label:{flexShrink:1},track:{width:"100%",overflow:"hidden"},determinateBar:{position:"absolute",left:0,top:0},indeterminateBar:{position:"absolute",left:0,top:0},segments:{flexDirection:"row",width:"100%"}});export{ProgressBar};export default ProgressBar;
@@ -1 +1 @@
1
- "use strict";import{formatDateTime}from"@webority/mobile-core";import{forwardRef,memo,useCallback,useEffect,useImperativeHandle,useMemo,useRef,useState}from"react";import{AccessibilityInfo,PixelRatio,Platform,StyleSheet,View}from"react-native";import{Gesture,GestureDetector}from"react-native-gesture-handler";import Svg,{Path,Rect,Text as SvgText}from"react-native-svg";import{lightTheme,useTheme}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{smoothCorners}from"../../utils/corners.js";import{Button}from"../Button/index.js";import{Input}from"../Input/index.js";import{Text}from"../Text/index.js";import{BASELINE_RATIO,buildSignatureSvg,distanceBetween,FALLBACK_WIDTH,pointOf,strokePath,typedFontSize}from"./signatureGeometry.js";import{writePng}from"./writePng";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_LABELS={pad:"Signature pad",padHint:"Draw with one finger. To sign without drawing, use the type your name action.",caption:"Sign above the line. To start with an up or down stroke, rest your finger a moment first.",typedCaption:"Your typed name is used as your signature.",undo:"Undo",clear:"Clear",typeInstead:"Type your name instead",drawInstead:"Draw instead",typedLabel:"Type your name",typedPlaceholder:"Your full name",empty:"Not signed",signed:"Signed",typingAnnouncement:"Signing by typing your name. Your typed name is used as your signature. Choose Draw instead to sign with your finger.",drawingAnnouncement:"Signing by drawing. Use one finger on the pad.",clearedAnnouncement:"Signature cleared",undoneAnnouncement:"Last stroke removed",emptyError:"Add a signature first."},STROKE_WIDTH=2.5,SIDEWAYS_TO_DRAW=6,UPRIGHT_TO_SCROLL=8,REST_TO_DRAW_MS=200,MIN_POINT_GAP=.8,DEFAULT_HEIGHT=180,DEFAULT_NAME_LENGTH=100,MAX_EXPORT_SCALE=3,MIN_TARGET=44,BASELINE_OPACITY=.3,DISABLED_OPACITY=.5,TARGET_STYLE={minHeight:44},defaultScriptFont=()=>Platform.select({ios:"Snell Roundhand",default:"cursive"}),cssFontStack=e=>"cursive"===e?"cursive":`'${e}', cursive`,useScreenReader=()=>{const[e,t]=useState(!1);return useEffect(()=>{let e=!0;AccessibilityInfo.isScreenReaderEnabled().then(n=>{e&&t(n)});const n=AccessibilityInfo.addEventListener("screenReaderChanged",t);return()=>{e=!1,n.remove()}},[]),e},StrokePath=memo(({points:e,color:t})=>_jsx(Path,{d:strokePath(e),stroke:t,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}));StrokePath.displayName="SignaturePadStroke";const SignaturePad=forwardRef((e,t)=>{const{initialStrokes:n,onChange:r,initialTypedName:a="",onTypedNameChange:o,defaultMode:i="draw",onModeChange:s,onEmptyChange:l,allowTyped:d=!0,signedBy:c,signedAt:u,height:p=DEFAULT_HEIGHT,maxNameLength:m=DEFAULT_NAME_LENGTH,inkColor:g,paperColor:h,scriptFontFamily:y,labels:f,haptic:S="selection",disabled:T=!1,style:w,testID:b}=e,E=useTheme(),A=g??lightTheme.colors.text.primary,x=h??lightTheme.colors.background.elevated,_=y??defaultScriptFont(),C=useMemo(()=>({...DEFAULT_LABELS,...f}),[f]),v=useScreenReader(),I=useRef(null),[L,R]=useState(0),[P,j]=useState(()=>(n??[]).map((e,t)=>({id:t+1,points:[...e]}))),D=useRef(P),k=useRef(P.length),N=useRef(null),F=useRef(null),[M,B]=useState(d?i:"draw"),[O,G]=useState(a),[H,Y]=useState(null),U=useRef(!1),W=useRef({onChange:r,onTypedNameChange:o,onModeChange:s,onEmptyChange:l});useEffect(()=>{W.current={onChange:r,onTypedNameChange:o,onModeChange:s,onEmptyChange:l}});const $="draw"===M&&!T,z="draw"===M?0===P.length:0===O.trim().length,V=useRef(null);useEffect(()=>{V.current!==z&&(V.current=z,W.current.onEmptyChange?.(z))},[z]);const K=useCallback(e=>{D.current=e,j(e)},[]),X=useCallback(()=>{Y(Date.now()),W.current.onChange?.(D.current.map(e=>e.points))},[]),J=useMemo(()=>{const pan=e=>Gesture.Pan().enabled($).runOnJS(!0).onBegin(e=>{N.current=pointOf(e.x,e.y)}).onStart(t=>{F.current=e,k.current+=1;const n=pointOf(t.x,t.y);K([...D.current,{id:k.current,points:[N.current??n,n]}])}).onUpdate(t=>{if(F.current!==e)return;const n=D.current[D.current.length-1],r=pointOf(t.x,t.y);distanceBetween(n.points[n.points.length-1],r)<.8||K([...D.current.slice(0,-1),{...n,points:[...n.points,r]}])}).onFinalize(()=>{F.current===e&&(F.current=null,X())}),e=pan("sideways").activeOffsetX([-6,6]).failOffsetY([-8,8]),t=pan("rested").activateAfterLongPress(200);return Gesture.Race(e,t)},[$,K,X]),q=useCallback(e=>{B(e),W.current.onModeChange?.(e),announce("type"===e?C.typingAnnouncement:C.drawingAnnouncement)},[C.typingAnnouncement,C.drawingAnnouncement]);useEffect(()=>{v&&d&&!U.current&&"draw"===M&&0===D.current.length&&q("type")},[v,d,M,q]);const Q=useCallback(()=>{U.current=!0,q("draw"===M?"type":"draw")},[M,q]),Z=useCallback(e=>{G(e),Y(Date.now()),W.current.onTypedNameChange?.(e)},[]),ee=useCallback(()=>{"type"===M?Z(""):(K([]),X()),announce(C.clearedAnnouncement)},[M,Z,K,X,C.clearedAnnouncement]),te=useCallback(()=>{"draw"===M&&0!==D.current.length&&(K(D.current.slice(0,-1)),X(),announce(C.undoneAnnouncement))},[M,K,X,C.undoneAnnouncement]),ne=L||FALLBACK_WIDTH;useImperativeHandle(t,()=>({toFile:()=>new Promise((e,t)=>{if(z)return void t(new Error(C.emptyError));if(!I.current)return void t(new Error("The signature pad is not on screen."));const n=Math.min(3,Math.max(1,PixelRatio.get()));I.current.toDataURL(n=>{try{e(writePng(n))}catch(e){t(e)}},{width:ne*n,height:p*n})}),toSvg:()=>buildSignatureSvg({width:ne,height:p,mode:M,strokes:P.map(e=>e.points),typedName:O,ink:A,paper:x,strokeWidth:2.5,fontFamily:cssFontStack(_)}),clear:ee,undo:te,isEmpty:()=>z}),[z,C.emptyError,ne,p,M,P,O,A,x,_,ee,te]);const re=useMemo(()=>[{name:"undo",label:C.undo},{name:"clear",label:C.clear},...d?[{name:"toggleMode",label:"draw"===M?C.typeInstead:C.drawInstead}]:[]],[C.undo,C.clear,C.typeInstead,C.drawInstead,d,M]),ae=useCallback(e=>{if(T)return;const{actionName:t}=e.nativeEvent;"undo"===t?te():"clear"===t?ee():"toggleMode"===t&&d&&Q()},[T,te,ee,Q,d]),oe=useCallback(e=>{R(e.nativeEvent.layout.width)},[]),ie=useMemo(()=>StyleSheet.create({root:{gap:E.spacing.sm},pad:{height:p,borderWidth:E.colors.border.width,borderColor:E.colors.border.primary,borderRadius:E.radius.md,...smoothCorners,overflow:"hidden",backgroundColor:x,opacity:T?.5:1},baseline:{position:"absolute",left:E.spacing.md,right:E.spacing.md,top:p*BASELINE_RATIO,height:StyleSheet.hairlineWidth,backgroundColor:A,opacity:.3},actions:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:E.spacing.xs},trailing:{flexDirection:"row",alignItems:"center",gap:E.spacing.xs}}),[E,p,x,A,T]),se=O.trim(),le=u??H,de=c&&!z?`Signed by ${c}${le?`, ${formatDateTime(le)}`:""}`:null,ce="type"===M&&se?`${C.pad}. ${se}`:C.pad;return _jsxs(View,{style:[ie.root,w],testID:b,children:[_jsx(GestureDetector,{gesture:J,children:_jsxs(View,{style:ie.pad,onLayout:oe,accessible:!0,accessibilityRole:"image",accessibilityLabel:ce,accessibilityHint:"draw"===M?C.padHint:void 0,accessibilityValue:{text:z?C.empty:C.signed},accessibilityState:{disabled:T},"aria-disabled":T,accessibilityActions:re,onAccessibilityAction:ae,children:[_jsxs(Svg,{ref:I,width:"100%",height:p,children:[_jsx(Rect,{x:"0",y:"0",width:"100%",height:"100%",fill:x}),"draw"===M?P.map(e=>_jsx(StrokePath,{points:e.points,color:A},e.id)):null,"type"===M&&se?_jsx(SvgText,{x:ne/2,y:p*BASELINE_RATIO,fontSize:typedFontSize(ne,se),fontFamily:_,textAnchor:"middle",fill:A,children:se}):null]}),_jsx(View,{pointerEvents:"none",style:ie.baseline})]})}),"type"===M?_jsx(Input,{label:C.typedLabel,placeholder:C.typedPlaceholder,value:O,onChangeText:Z,maxLength:m,disabled:T,autoComplete:"name",textContentType:"name",autoCapitalize:"words",autoCorrect:!1,returnKeyType:"done",testID:b?`${b}-name`:void 0}):null,_jsx(Text,{variant:"caption",color:"tertiary",children:"draw"===M?C.caption:C.typedCaption}),_jsxs(View,{style:ie.actions,children:[d?_jsx(Button,{title:"draw"===M?C.typeInstead:C.drawInstead,variant:"ghost",tone:"primary",size:"md",style:TARGET_STYLE,haptic:S,disabled:T,onPress:Q,testID:b?`${b}-mode`:void 0}):_jsx(View,{}),"draw"===M&&P.length>0?_jsxs(View,{style:ie.trailing,children:[_jsx(Button,{title:C.undo,variant:"ghost",tone:"primary",size:"md",style:TARGET_STYLE,haptic:S,disabled:T,onPress:te,testID:b?`${b}-undo`:void 0}),_jsx(Button,{title:C.clear,variant:"ghost",tone:"primary",size:"md",style:TARGET_STYLE,haptic:S,disabled:T,onPress:ee,testID:b?`${b}-clear`:void 0})]}):null,"type"===M&&se?_jsx(Button,{title:C.clear,variant:"ghost",tone:"primary",size:"md",style:TARGET_STYLE,haptic:S,disabled:T,onPress:ee,testID:b?`${b}-clear`:void 0}):null]}),de?_jsx(Text,{variant:"caption",color:"secondary",children:de}):null]})});SignaturePad.displayName="SignaturePad";export{SignaturePad};export default SignaturePad;
1
+ "use strict";import{formatDateTime}from"@webority/mobile-core";import{forwardRef,memo,useCallback,useEffect,useImperativeHandle,useMemo,useRef,useState}from"react";import{AccessibilityInfo,PixelRatio,Platform,StyleSheet,View}from"react-native";import{Gesture,GestureDetector}from"react-native-gesture-handler";import Svg,{Path,Rect,Text as SvgText}from"react-native-svg";import{lightTheme,useTheme}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{smoothCorners}from"../../utils/corners.js";import{Button}from"../Button/index.js";import{Input}from"../Input/index.js";import{Text}from"../Text/index.js";import{BASELINE_RATIO,buildSignatureSvg,distanceBetween,FALLBACK_WIDTH,pointOf,strokePath,typedFontSize}from"./signatureGeometry.js";import{writePng}from"./writePng";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_LABELS={pad:"Signature pad",padHint:"Draw with one finger. To sign without drawing, use the type your name action.",caption:"Sign above the line. To start with an up or down stroke, rest your finger a moment first.",typedCaption:"Your typed name is used as your signature.",undo:"Undo",clear:"Clear",typeInstead:"Type your name instead",drawInstead:"Draw instead",typedLabel:"Type your name",typedPlaceholder:"Your full name",empty:"Not signed",signed:"Signed",typingAnnouncement:"Signing by typing your name. Your typed name is used as your signature. Choose Draw instead to sign with your finger.",drawingAnnouncement:"Signing by drawing. Use one finger on the pad.",clearedAnnouncement:"Signature cleared",undoneAnnouncement:"Last stroke removed",emptyError:"Add a signature first."},STROKE_WIDTH=2.5,SIDEWAYS_TO_DRAW=6,UPRIGHT_TO_SCROLL=8,REST_TO_DRAW_MS=200,MIN_POINT_GAP=.8,DEFAULT_HEIGHT=180,DEFAULT_NAME_LENGTH=100,MAX_EXPORT_SCALE=3,MIN_TARGET=44,BASELINE_OPACITY=.3,DISABLED_OPACITY=.5,TARGET_STYLE={minHeight:44},defaultScriptFont=()=>Platform.select({ios:"Snell Roundhand",default:"cursive"}),cssFontStack=e=>"cursive"===e?"cursive":`'${e}', cursive`,useScreenReader=()=>{const[e,t]=useState(!1);return useEffect(()=>{let e=!0;AccessibilityInfo.isScreenReaderEnabled().then(n=>{e&&t(n)});const n=AccessibilityInfo.addEventListener("screenReaderChanged",t);return()=>{e=!1,n.remove()}},[]),e},StrokePath=memo(({points:e,color:t})=>_jsx(Path,{d:strokePath(e),stroke:t,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}));StrokePath.displayName="SignaturePadStroke";const Marks=({mode:e,strokes:t,name:n,color:r,fontFamily:a,width:o,height:i})=>"draw"===e?_jsx(_Fragment,{children:t.map(e=>_jsx(StrokePath,{points:e.points,color:r},e.id))}):n?_jsx(SvgText,{x:o/2,y:i*BASELINE_RATIO,fontSize:typedFontSize(o,n),fontFamily:a,textAnchor:"middle",fill:r,children:n}):null,SignaturePad=forwardRef((e,t)=>{const{initialStrokes:n,onChange:r,initialTypedName:a="",onTypedNameChange:o,defaultMode:i="draw",onModeChange:s,onEmptyChange:l,allowTyped:d=!0,signedBy:c,signedAt:u,height:m=DEFAULT_HEIGHT,maxNameLength:p=DEFAULT_NAME_LENGTH,inkColor:h,paperColor:g,scriptFontFamily:y,labels:f,haptic:S="selection",disabled:T=!1,style:w,testID:x}=e,b=useTheme(),_=void 0===h&&void 0===g,E=_?b.colors.text.primary:h??lightTheme.colors.text.primary,A=_?b.colors.background.elevated:g??lightTheme.colors.background.elevated,v=_?lightTheme.colors.text.primary:E,C=_?lightTheme.colors.background.elevated:A,I=v!==E||C!==A,R=y??defaultScriptFont(),L=useMemo(()=>({...DEFAULT_LABELS,...f}),[f]),k=useScreenReader(),j=useRef(null),P=useRef(null),[D,F]=useState(0),[M,N]=useState(()=>(n??[]).map((e,t)=>({id:t+1,points:[...e]}))),B=useRef(M),O=useRef(M.length),G=useRef(null),H=useRef(null),[Y,U]=useState(d?i:"draw"),[W,$]=useState(a),[z,V]=useState(null),K=useRef(!1),X=useRef({onChange:r,onTypedNameChange:o,onModeChange:s,onEmptyChange:l});useEffect(()=>{X.current={onChange:r,onTypedNameChange:o,onModeChange:s,onEmptyChange:l}});const J="draw"===Y&&!T,q="draw"===Y?0===M.length:0===W.trim().length,Q=useRef(null);useEffect(()=>{Q.current!==q&&(Q.current=q,X.current.onEmptyChange?.(q))},[q]);const Z=useCallback(e=>{B.current=e,N(e)},[]),ee=useCallback(()=>{V(Date.now()),X.current.onChange?.(B.current.map(e=>e.points))},[]),te=useMemo(()=>{const pan=e=>Gesture.Pan().enabled(J).runOnJS(!0).onBegin(e=>{G.current=pointOf(e.x,e.y)}).onStart(t=>{H.current=e,O.current+=1;const n=pointOf(t.x,t.y);Z([...B.current,{id:O.current,points:[G.current??n,n]}])}).onUpdate(t=>{if(H.current!==e)return;const n=B.current[B.current.length-1],r=pointOf(t.x,t.y);distanceBetween(n.points[n.points.length-1],r)<.8||Z([...B.current.slice(0,-1),{...n,points:[...n.points,r]}])}).onFinalize(()=>{H.current===e&&(H.current=null,ee())}),e=pan("sideways").activeOffsetX([-6,6]).failOffsetY([-8,8]),t=pan("rested").activateAfterLongPress(200);return Gesture.Race(e,t)},[J,Z,ee]),ne=useCallback(e=>{U(e),X.current.onModeChange?.(e),announce("type"===e?L.typingAnnouncement:L.drawingAnnouncement)},[L.typingAnnouncement,L.drawingAnnouncement]);useEffect(()=>{k&&d&&!K.current&&"draw"===Y&&0===B.current.length&&ne("type")},[k,d,Y,ne]);const re=useCallback(()=>{K.current=!0,ne("draw"===Y?"type":"draw")},[Y,ne]),ae=useCallback(e=>{$(e),V(Date.now()),X.current.onTypedNameChange?.(e)},[]),oe=useCallback(()=>{"type"===Y?ae(""):(Z([]),ee()),announce(L.clearedAnnouncement)},[Y,ae,Z,ee,L.clearedAnnouncement]),ie=useCallback(()=>{"draw"===Y&&0!==B.current.length&&(Z(B.current.slice(0,-1)),ee(),announce(L.undoneAnnouncement))},[Y,Z,ee,L.undoneAnnouncement]),se=D||FALLBACK_WIDTH;useImperativeHandle(t,()=>({toFile:()=>new Promise((e,t)=>{if(q)return void t(new Error(L.emptyError));const n=I?P.current:j.current;if(!n)return void t(new Error("The signature pad is not on screen."));const r=Math.min(3,Math.max(1,PixelRatio.get()));n.toDataURL(n=>{try{e(writePng(n))}catch(e){t(e)}},{width:se*r,height:m*r})}),toSvg:()=>buildSignatureSvg({width:se,height:m,mode:Y,strokes:M.map(e=>e.points),typedName:W,ink:v,paper:C,strokeWidth:2.5,fontFamily:cssFontStack(R)}),clear:oe,undo:ie,isEmpty:()=>q}),[q,L.emptyError,se,m,Y,M,W,I,v,C,R,oe,ie]);const le=useMemo(()=>[{name:"undo",label:L.undo},{name:"clear",label:L.clear},...d?[{name:"toggleMode",label:"draw"===Y?L.typeInstead:L.drawInstead}]:[]],[L.undo,L.clear,L.typeInstead,L.drawInstead,d,Y]),de=useCallback(e=>{if(T)return;const{actionName:t}=e.nativeEvent;"undo"===t?ie():"clear"===t?oe():"toggleMode"===t&&d&&re()},[T,ie,oe,re,d]),ce=useCallback(e=>{F(e.nativeEvent.layout.width)},[]),ue=useMemo(()=>StyleSheet.create({root:{gap:b.spacing.sm},pad:{height:m,borderWidth:b.colors.border.width,borderColor:b.colors.border.primary,borderRadius:b.radius.md,...smoothCorners,overflow:"hidden",backgroundColor:A,opacity:T?.5:1},baseline:{position:"absolute",left:b.spacing.md,right:b.spacing.md,top:m*BASELINE_RATIO,height:StyleSheet.hairlineWidth,backgroundColor:E,opacity:.3},actions:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:b.spacing.xs},trailing:{flexDirection:"row",alignItems:"center",gap:b.spacing.xs}}),[b,m,A,E,T]),me=W.trim(),pe=u??z,he=c&&!q?`Signed by ${c}${pe?`, ${formatDateTime(pe)}`:""}`:null,ge="type"===Y&&me?`${L.pad}. ${me}`:L.pad;return _jsxs(View,{style:[ue.root,w],testID:x,children:[_jsx(GestureDetector,{gesture:te,children:_jsxs(View,{style:ue.pad,onLayout:ce,accessible:!0,accessibilityRole:"image",accessibilityLabel:ge,accessibilityHint:"draw"===Y?L.padHint:void 0,accessibilityValue:{text:q?L.empty:L.signed},accessibilityState:{disabled:T},"aria-disabled":T,accessibilityActions:le,onAccessibilityAction:de,children:[I?_jsxs(Svg,{ref:P,style:StyleSheet.absoluteFill,width:"100%",height:m,children:[_jsx(Rect,{x:"0",y:"0",width:"100%",height:"100%",fill:C}),_jsx(Marks,{mode:Y,strokes:M,name:me,color:v,fontFamily:R,width:se,height:m})]}):null,_jsxs(Svg,{ref:j,width:"100%",height:m,children:[_jsx(Rect,{x:"0",y:"0",width:"100%",height:"100%",fill:A}),_jsx(Marks,{mode:Y,strokes:M,name:me,color:E,fontFamily:R,width:se,height:m})]}),_jsx(View,{pointerEvents:"none",style:ue.baseline})]})}),"type"===Y?_jsx(Input,{label:L.typedLabel,placeholder:L.typedPlaceholder,value:W,onChangeText:ae,maxLength:p,disabled:T,autoComplete:"name",textContentType:"name",autoCapitalize:"words",autoCorrect:!1,returnKeyType:"done",testID:x?`${x}-name`:void 0}):null,_jsx(Text,{variant:"caption",color:"tertiary",children:"draw"===Y?L.caption:L.typedCaption}),_jsxs(View,{style:ue.actions,children:[d?_jsx(Button,{title:"draw"===Y?L.typeInstead:L.drawInstead,variant:"ghost",tone:"primary",size:"md",style:TARGET_STYLE,haptic:S,disabled:T,onPress:re,testID:x?`${x}-mode`:void 0}):_jsx(View,{}),"draw"===Y&&M.length>0?_jsxs(View,{style:ue.trailing,children:[_jsx(Button,{title:L.undo,variant:"ghost",tone:"primary",size:"md",style:TARGET_STYLE,haptic:S,disabled:T,onPress:ie,testID:x?`${x}-undo`:void 0}),_jsx(Button,{title:L.clear,variant:"ghost",tone:"primary",size:"md",style:TARGET_STYLE,haptic:S,disabled:T,onPress:oe,testID:x?`${x}-clear`:void 0})]}):null,"type"===Y&&me?_jsx(Button,{title:L.clear,variant:"ghost",tone:"primary",size:"md",style:TARGET_STYLE,haptic:S,disabled:T,onPress:oe,testID:x?`${x}-clear`:void 0}):null]}),he?_jsx(Text,{variant:"caption",color:"secondary",children:he}):null]})});SignaturePad.displayName="SignaturePad";export{SignaturePad};export default SignaturePad;
@@ -0,0 +1 @@
1
+ "use strict";import{forwardRef}from"react";import{StyleSheet,View}from"react-native";import{smoothCorners}from"../../utils/corners.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const PER_EDGE_KEYS=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderTopStartRadius","borderTopEndRadius","borderBottomStartRadius","borderBottomEndRadius","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStartWidth","borderEndWidth","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderStartColor","borderEndColor"],readShape=r=>{const{borderRadius:e,backgroundColor:o,borderColor:t,borderWidth:i=0,borderStyle:d}=r;if("number"!=typeof e||e<=0||"hidden"===r.overflow||(r.elevation??0)>0||void 0!==d&&"solid"!==d||PER_EDGE_KEYS.some(e=>void 0!==r[e]))return null;const s="string"==typeof o&&"transparent"!==o,l=i>0&&"string"==typeof t&&"transparent"!==t;return void 0!==o&&"string"!=typeof o||i>0&&void 0!==t&&"string"!=typeof t||!s&&!l?null:{radius:e,fill:s?o:"transparent",stroke:l?t:void 0,strokeWidth:l?i:0,outset:i}},SquircleView=forwardRef(({style:r,children:e,onLayout:o,...t},i)=>{const d=StyleSheet.flatten(r)??{},s=readShape(d),l="number"==typeof d.borderRadius?d.borderRadius:0,a=useSquircle(l>0,l,o),n=a.active?a.size:null,u=null!==s&&null!==n;return _jsxs(View,{ref:i,...t,onLayout:a.onLayout,style:[l>0?smoothCorners:null,r,u?styles.hostTransparent:null],children:[s&&n?_jsx(SquircleFill,{width:n.width,height:n.height,radius:s.radius,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth,outset:s.outset}):null,e]})});SquircleView.displayName="SquircleView";const styles=StyleSheet.create({hostTransparent:{backgroundColor:"transparent",borderColor:"transparent"}});export{SquircleView};export default SquircleView;
@@ -0,0 +1 @@
1
+ "use strict";export{SquircleView}from"./SquircleView.js";
@@ -1 +1 @@
1
- "use strict";export{Accordion,AccordionGroup}from"./Accordion/index.js";export{AmountSlider}from"./AmountSlider/index.js";export{AnimatePresence}from"./AnimatePresence/index.js";export{AppBar}from"./AppBar/index.js";export{AsyncBlock}from"./AsyncBlock/index.js";export{AuthedImage,authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./AuthedImage/index.js";export{Autocomplete}from"./Autocomplete/index.js";export{Avatar,AvatarGroup}from"./Avatar/index.js";export{Badge}from"./Badge/index.js";export{Banner}from"./Banner/index.js";export{BarChart}from"./BarChart/index.js";export{BottomNavigation}from"./BottomNavigation/index.js";export{BottomSheet,useBottomSheet,useSheetSwap}from"./BottomSheet/index.js";export{Box,Row,Spacer,Stack}from"./Box/index.js";export{Button}from"./Button/index.js";export{Calendar}from"./Calendar/index.js";export{Card}from"./Card/index.js";export{Carousel}from"./Carousel/index.js";export{Checkbox}from"./Checkbox/index.js";export{Chip}from"./Chip/index.js";export{ChoiceGroup}from"./ChoiceGroup/index.js";export{Composer}from"./Composer/index.js";export{Confetti}from"./Confetti/index.js";export{DatePicker}from"./DatePicker/index.js";export{DateRangePicker}from"./DateRangePicker/index.js";export{DateSeparator,DEFAULT_DATE_SEPARATOR_LABELS,dayLabel}from"./DateSeparator/index.js";export{cleanDecimalText,DecimalInput,parseDecimalText}from"./DecimalInput/index.js";export{Descriptions}from"./Descriptions/index.js";export{Dialog}from"./Dialog/index.js";export{Divider}from"./Divider/index.js";export{Drawer}from"./Drawer/index.js";export{EmptyState}from"./EmptyState/index.js";export{ErrorBoundary,useErrorHandler,withErrorBoundary}from"./ErrorBoundary/index.js";export{FilePicker,formatFileSize}from"./FilePicker/index.js";export{FileViewer}from"./FileViewer/index.js";export{FloatingActionButton,FloatingActionButtonGroup}from"./FloatingActionButton/index.js";export{ForceUpdateDialog}from"./ForceUpdateDialog/index.js";export{FormField}from"./FormField/index.js";export{IconBadge}from"./IconBadge/index.js";export{IconButton}from"./IconButton/index.js";export{ImageGallery}from"./ImageGallery/index.js";export{InlineSelect}from"./InlineSelect/index.js";export{Input}from"./Input/index.js";export{KeyboardAwareScrollView}from"./KeyboardAwareScrollView/index.js";export{KeyboardToolbar}from"./KeyboardToolbar/index.js";export{ListItem}from"./ListItem/index.js";export{LoaderOverlay,loader,useLoader}from"./LoaderOverlay/index.js";export{Markdown}from"./Markdown/index.js";export{Menu}from"./Menu/index.js";export{DEFAULT_MESSAGE_BUBBLE_LABELS,MessageBubble}from"./MessageBubble/index.js";export{DEFAULT_MESSAGE_LIST_LABELS,MessageList}from"./MessageList/index.js";export{MODAL_DISMISS_GRACE_MS,Modal}from"./Modal/index.js";export{Notation,parseNotation,sym}from"./Notation/index.js";export{NumberInput}from"./NumberInput/index.js";export{OnboardingPager}from"./OnboardingPager/index.js";export{OptionSheet}from"./OptionSheet/index.js";export{OTPInput}from"./OTPInput/index.js";export{PaymentResult}from"./PaymentResult/index.js";export{PermissionPrompt,usePermissionPrompt}from"./PermissionPrompt/index.js";export{ALL_CALLING_CODES,DEFAULT_CALLING_CODES,formatE164,PhoneNumberInput,parseE164}from"./PhoneNumberInput/index.js";export{PickerTrigger}from"./PickerTrigger/index.js";export{ProfileCompletion}from"./ProfileCompletion/index.js";export{ProfilePicker}from"./ProfilePicker/index.js";export{ProgressBar}from"./ProgressBar/index.js";export{ProgressRing}from"./ProgressRing/index.js";export{Radio,RadioDot,RadioGroup}from"./Radio/index.js";export{Rating}from"./Rating/index.js";export{Repeater}from"./Repeater/index.js";export{applyMarkdownAction,RichTextEditor}from"./RichTextEditor/index.js";export{ScannerOverlay}from"./ScannerOverlay/index.js";export{SearchBar,useRecentSearches}from"./SearchBar/index.js";export{SectionHeader}from"./SectionHeader/index.js";export{SegmentedControl}from"./SegmentedControl/index.js";export{Select}from"./Select/index.js";export{SignaturePad}from"./SignaturePad/index.js";export{Skeleton,SkeletonCircle,SkeletonClockProvider,SkeletonContent,SkeletonList,SkeletonProvider,SkeletonSkip,SkeletonText,useReduceMotion,useSkeletonClock,useSkeletonDefaults}from"./Skeleton/index.js";export{Slider}from"./Slider/index.js";export{SliderField}from"./SliderField/index.js";export{SlideToConfirm}from"./SlideToConfirm/index.js";export{Sparkline}from"./Sparkline/index.js";export{Spinner}from"./Spinner/index.js";export{StatTile}from"./StatTile/index.js";export{StatusBadge}from"./StatusBadge/index.js";export{Stepper}from"./Stepper/index.js";export{Swipeable}from"./Swipeable/index.js";export{Switch}from"./Switch/index.js";export{Tabs}from"./Tabs/index.js";export{TagInput}from"./TagInput/index.js";export{Text}from"./Text/index.js";export{Timeline}from"./Timeline/index.js";export{TimePicker}from"./TimePicker/index.js";export{Toast,ToastHost,ToastProvider,toast,useToast}from"./Toast/index.js";export{Tooltip}from"./Tooltip/index.js";export{Tour}from"./Tour/index.js";export{TypingIndicator}from"./TypingIndicator/index.js";export{WheelPicker}from"./WheelPicker/index.js";export{ZoomableImage}from"./ZoomableImage/index.js";
1
+ "use strict";export{Accordion,AccordionGroup}from"./Accordion/index.js";export{AmountSlider}from"./AmountSlider/index.js";export{AnimatePresence}from"./AnimatePresence/index.js";export{AppBar}from"./AppBar/index.js";export{AsyncBlock}from"./AsyncBlock/index.js";export{AuthedImage,authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./AuthedImage/index.js";export{Autocomplete}from"./Autocomplete/index.js";export{Avatar,AvatarGroup}from"./Avatar/index.js";export{Badge}from"./Badge/index.js";export{Banner}from"./Banner/index.js";export{BarChart}from"./BarChart/index.js";export{BottomNavigation}from"./BottomNavigation/index.js";export{BottomSheet,useBottomSheet,useSheetSwap}from"./BottomSheet/index.js";export{Box,Row,Spacer,Stack}from"./Box/index.js";export{Button}from"./Button/index.js";export{Calendar}from"./Calendar/index.js";export{Card}from"./Card/index.js";export{Carousel}from"./Carousel/index.js";export{Checkbox}from"./Checkbox/index.js";export{Chip}from"./Chip/index.js";export{ChoiceGroup}from"./ChoiceGroup/index.js";export{Composer}from"./Composer/index.js";export{Confetti}from"./Confetti/index.js";export{DatePicker}from"./DatePicker/index.js";export{DateRangePicker}from"./DateRangePicker/index.js";export{DateSeparator,DEFAULT_DATE_SEPARATOR_LABELS,dayLabel}from"./DateSeparator/index.js";export{cleanDecimalText,DecimalInput,parseDecimalText}from"./DecimalInput/index.js";export{Descriptions}from"./Descriptions/index.js";export{Dialog}from"./Dialog/index.js";export{Divider}from"./Divider/index.js";export{Drawer}from"./Drawer/index.js";export{EmptyState}from"./EmptyState/index.js";export{ErrorBoundary,useErrorHandler,withErrorBoundary}from"./ErrorBoundary/index.js";export{FilePicker,formatFileSize}from"./FilePicker/index.js";export{FileViewer}from"./FileViewer/index.js";export{FilterChipRow}from"./FilterChipRow/index.js";export{FloatingActionButton,FloatingActionButtonGroup}from"./FloatingActionButton/index.js";export{ForceUpdateDialog}from"./ForceUpdateDialog/index.js";export{FormField}from"./FormField/index.js";export{IconBadge}from"./IconBadge/index.js";export{IconButton}from"./IconButton/index.js";export{ImageGallery}from"./ImageGallery/index.js";export{InlineSelect}from"./InlineSelect/index.js";export{Input}from"./Input/index.js";export{KeyboardAwareScrollView}from"./KeyboardAwareScrollView/index.js";export{KeyboardToolbar}from"./KeyboardToolbar/index.js";export{ListItem}from"./ListItem/index.js";export{LoaderOverlay,loader,useLoader}from"./LoaderOverlay/index.js";export{Markdown}from"./Markdown/index.js";export{Menu}from"./Menu/index.js";export{DEFAULT_MESSAGE_BUBBLE_LABELS,MessageBubble}from"./MessageBubble/index.js";export{DEFAULT_MESSAGE_LIST_LABELS,MessageList}from"./MessageList/index.js";export{MODAL_DISMISS_GRACE_MS,Modal}from"./Modal/index.js";export{Notation,parseNotation,sym}from"./Notation/index.js";export{NumberInput}from"./NumberInput/index.js";export{OnboardingPager}from"./OnboardingPager/index.js";export{OptionSheet}from"./OptionSheet/index.js";export{OTPInput}from"./OTPInput/index.js";export{PaymentResult}from"./PaymentResult/index.js";export{PermissionPrompt,usePermissionPrompt}from"./PermissionPrompt/index.js";export{ALL_CALLING_CODES,DEFAULT_CALLING_CODES,formatE164,PhoneNumberInput,parseE164}from"./PhoneNumberInput/index.js";export{PickerTrigger}from"./PickerTrigger/index.js";export{ProfileCompletion}from"./ProfileCompletion/index.js";export{ProfilePicker}from"./ProfilePicker/index.js";export{ProgressBar}from"./ProgressBar/index.js";export{ProgressRing}from"./ProgressRing/index.js";export{Radio,RadioDot,RadioGroup}from"./Radio/index.js";export{Rating}from"./Rating/index.js";export{Repeater}from"./Repeater/index.js";export{applyMarkdownAction,RichTextEditor}from"./RichTextEditor/index.js";export{ScannerOverlay}from"./ScannerOverlay/index.js";export{SearchBar,useRecentSearches}from"./SearchBar/index.js";export{SectionHeader}from"./SectionHeader/index.js";export{SegmentedControl}from"./SegmentedControl/index.js";export{Select}from"./Select/index.js";export{SignaturePad}from"./SignaturePad/index.js";export{Skeleton,SkeletonCircle,SkeletonClockProvider,SkeletonContent,SkeletonList,SkeletonProvider,SkeletonSkip,SkeletonText,useReduceMotion,useSkeletonClock,useSkeletonDefaults}from"./Skeleton/index.js";export{Slider}from"./Slider/index.js";export{SliderField}from"./SliderField/index.js";export{SlideToConfirm}from"./SlideToConfirm/index.js";export{Sparkline}from"./Sparkline/index.js";export{Spinner}from"./Spinner/index.js";export{SquircleView}from"./SquircleView/index.js";export{StatTile}from"./StatTile/index.js";export{StatusBadge}from"./StatusBadge/index.js";export{Stepper}from"./Stepper/index.js";export{Swipeable}from"./Swipeable/index.js";export{Switch}from"./Switch/index.js";export{Tabs}from"./Tabs/index.js";export{TagInput}from"./TagInput/index.js";export{Text}from"./Text/index.js";export{Timeline}from"./Timeline/index.js";export{TimePicker}from"./TimePicker/index.js";export{Toast,ToastHost,ToastProvider,toast,useToast}from"./Toast/index.js";export{Tooltip}from"./Tooltip/index.js";export{Tour}from"./Tour/index.js";export{TypingIndicator}from"./TypingIndicator/index.js";export{WheelPicker}from"./WheelPicker/index.js";export{ZoomableImage}from"./ZoomableImage/index.js";
@@ -1 +1 @@
1
- "use strict";import{SQUIRCLE_SMOOTHING}from"../utils/squircle.js";const typography={fontSize:{xs:11,sm:13,base:15,lg:17,xl:20,"2xl":24,"3xl":30,"4xl":36},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:1.2,normal:1.4,relaxed:1.6},letterSpacing:{tight:-.2,normal:0,wide:.4}},spacing={none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius={none:0,xs:4,sm:6,md:10,lg:14,xl:20,"2xl":28,full:9999},FIELD_RADIUS=10,fieldSizes={sm:{paddingHorizontal:12,paddingVertical:10,minHeight:38,fontSize:13,borderRadius:10,iconSize:14,labelFontSize:11,labelGap:4,messageFontSize:11,messageGap:2},md:{paddingHorizontal:14,paddingVertical:13,minHeight:44,fontSize:14,borderRadius:10,iconSize:16,labelFontSize:12,labelGap:4,messageFontSize:12,messageGap:2},lg:{paddingHorizontal:16,paddingVertical:15,minHeight:52,fontSize:16,borderRadius:10,iconSize:18,labelFontSize:13,labelGap:4,messageFontSize:13,messageGap:2}},components={button:{xs:{paddingHorizontal:10,paddingVertical:4,minHeight:28,fontSize:12,borderRadius:8},sm:{paddingHorizontal:12,paddingVertical:6,minHeight:34,fontSize:14,borderRadius:10},md:{paddingHorizontal:16,paddingVertical:9,minHeight:42,fontSize:16,borderRadius:12},lg:{paddingHorizontal:20,paddingVertical:12,minHeight:50,fontSize:18,borderRadius:14},xl:{paddingHorizontal:24,paddingVertical:14,minHeight:58,fontSize:20,borderRadius:16}},input:{sm:{...fieldSizes.sm,multilineMinHeight:72},md:{...fieldSizes.md,multilineMinHeight:92},lg:{...fieldSizes.lg,multilineMinHeight:110}},searchBar:{sm:{borderRadius:radius.full},md:{borderRadius:radius.full},lg:{borderRadius:radius.full}},emptyState:{sm:{iconSize:48,titleFontSize:"lg",descriptionFontSize:"sm",paddingVertical:"lg"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl"}},field:{defaultVariant:"outlined",sm:fieldSizes.sm,md:fieldSizes.md,lg:fieldSizes.lg},listItem:{sm:{paddingVertical:"sm",titleFontSize:"sm",subtitleFontSize:"xs",minHeight:44},md:{paddingVertical:"md",titleFontSize:"base",subtitleFontSize:"sm",minHeight:56},lg:{paddingVertical:"lg",titleFontSize:"lg",subtitleFontSize:"sm",minHeight:72}},badge:{sm:{fontSize:10,minWidth:16,height:16,paddingHorizontal:5,dotSize:8},md:{fontSize:11,minWidth:20,height:20,paddingHorizontal:6,dotSize:10},borderWidth:1.5,anchorOffset:4},chip:{sm:{paddingHorizontal:10,paddingVertical:4,fontSize:12,minHeight:26,closeSize:16,closeFontSize:12,gap:6},md:{paddingHorizontal:12,paddingVertical:6,fontSize:13,minHeight:32,closeSize:18,closeFontSize:13,gap:8}},checkbox:{sm:{boxSize:16},md:{boxSize:20},lg:{boxSize:24},labelGap:10},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},labelGap:10},switch:{sm:{trackWidth:42,trackHeight:26,thumbSize:22,padding:2},md:{trackWidth:51,trackHeight:31,thumbSize:27,padding:2},lg:{trackWidth:60,trackHeight:36,thumbSize:32,padding:2},thumbColor:"#FFFFFF"},otpInput:{sm:{cell:36,fontSize:16,borderRadius:8,gap:8},md:{cell:48,fontSize:20,borderRadius:10,gap:10},lg:{cell:56,fontSize:24,borderRadius:12,gap:12}},dialog:{iconWrapperSize:48,iconWrapperBorderRadius:24,actionButtonMinHeight:44},toast:{iconCircleSize:28,iconCircleBorderRadius:14,iconGlyphFontSize:16,tintBarWidth:0},banner:{tintBarWidth:0},formField:{inlineLabelWidth:"35%"}},motion={duration:{instant:80,fast:160,normal:240,slow:360,slower:500},easing:{standard:[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]},spring:{gentle:{damping:26,stiffness:240,mass:.9},bouncy:{damping:16,stiffness:200,mass:.7},snappy:{damping:20,stiffness:300,mass:.7}}},lightShadows={none:{},xs:{shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.04,shadowRadius:2,elevation:1},sm:{shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.06,shadowRadius:4,elevation:2},md:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.08,shadowRadius:8,elevation:4},lg:{shadowColor:"#000",shadowOffset:{width:0,height:8},shadowOpacity:.1,shadowRadius:16,elevation:8},xl:{shadowColor:"#000",shadowOffset:{width:0,height:12},shadowOpacity:.14,shadowRadius:24,elevation:12},"2xl":{shadowColor:"#000",shadowOffset:{width:0,height:20},shadowOpacity:.18,shadowRadius:32,elevation:20}},darkShadows={none:{},xs:{shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.3,shadowRadius:2,elevation:1},sm:{shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.4,shadowRadius:4,elevation:2},md:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.5,shadowRadius:8,elevation:4},lg:{shadowColor:"#000",shadowOffset:{width:0,height:8},shadowOpacity:.55,shadowRadius:16,elevation:8},xl:{shadowColor:"#000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12},"2xl":{shadowColor:"#000",shadowOffset:{width:0,height:20},shadowOpacity:.7,shadowRadius:32,elevation:20}};export const lightTheme={mode:"light",colors:{primary:"#5B5BD6",primaryHover:"#4F4FBF",primaryPressed:"#4040A8",primaryMuted:"#EEEEFC",secondary:"#F4F4F8",secondaryHover:"#E9E9F0",success:"#18864F",warning:"#F59E0B",error:"#E12C32",info:"#1B6EF5",onPrimary:"#FFFFFF",onSecondary:"#0F0F1A",onSuccess:"#FFFFFF",onWarning:"#0F0F1A",onError:"#FFFFFF",onInfo:"#FFFFFF",onOverlay:"#FFFFFF",toneText:{primary:"#4F4FD3",success:"#147042",warning:"#8F5C06",error:"#BC1B20",info:"#0958D9"},text:{primary:"#0F0F1A",secondary:"#52525B",tertiary:"#62626B",inverse:"#FFFFFF",strong:"#252F4A",disabled:"#B4B4BB",link:"#5B5BD6"},background:{primary:"#FFFFFF",secondary:"#F8F8FB",tertiary:"#F1F1F5",elevated:"#FFFFFF",overlay:"rgba(15, 15, 26, 0.5)",inverse:"#0F0F1A"},border:{primary:"#E5E5EC",secondary:"#EFEFF3",focus:"#5B5BD6",error:"#E5484D",width:1},field:{background:"#F9FBFC",backgroundFocused:"#FFFFFF",backgroundDisabled:"#F5F6FA",border:"#EBEDF3",borderFocused:"#BED2F9",borderError:"#FDBFCE",label:"#242F4A",text:"#252F4A",textDisabled:"#C4CADA",placeholder:"#626D8B",placeholderDisabled:"#C4CADA",icon:"#7A849F",iconFocused:"#4B5675",iconDisabled:"#C4CADA",caret:"#5B8DEE",message:"#D81736"},surface:{pressed:"rgba(15, 15, 26, 0.06)",hovered:"rgba(15, 15, 26, 0.04)",selected:"rgba(91, 91, 214, 0.1)",disabled:"#F1F1F5"},glass:{fill:"rgba(255, 255, 255, 0.28)",border:"rgba(255, 255, 255, 0.45)",on:"#0F0F1A",badge:"#FFFFFF"},skeleton:{background:"#EBEDF3",highlight:"#F5F6FA"},avatarPalette:["#5B5BD6","#0A7979","#A45A05","#CD226E","#2462EB","#7C3AED","#047C57","#D42222"]},typography:typography,spacing:spacing,radius:radius,cornerSmoothing:SQUIRCLE_SMOOTHING,shadows:lightShadows,motion:motion,components:components,gradients:{}};export const darkTheme={mode:"dark",colors:{primary:"#7C7CE8",primaryHover:"#9292EE",primaryPressed:"#A8A8F2",primaryMuted:"#1F1F3D",secondary:"#1F1F26",secondaryHover:"#2A2A33",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA",onPrimary:"#0F0F1A",onSecondary:"#FAFAFA",onSuccess:"#0F0F1A",onWarning:"#0F0F1A",onError:"#0F0F1A",onInfo:"#0F0F1A",onOverlay:"#FFFFFF",toneText:{primary:"#8989EA",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},text:{primary:"#FAFAFA",secondary:"#B4B4BB",tertiary:"#919199",inverse:"#0F0F1A",strong:"#E2E2E2",disabled:"#52525B",link:"#9292EE"},background:{primary:"#0B0B12",secondary:"#13131C",tertiary:"#1C1C26",elevated:"#1C1C26",overlay:"rgba(0, 0, 0, 0.65)",inverse:"#FAFAFA"},border:{primary:"#27272F",secondary:"#1C1C26",focus:"#7C7CE8",error:"#F87171",width:1},field:{background:"#13131C",backgroundFocused:"#0B0B12",backgroundDisabled:"#1C1C26",border:"#27272F",borderFocused:"#3D5FB0",borderError:"#8A2F42",label:"#E4E6EE",text:"#FAFAFA",textDisabled:"#52525B",placeholder:"#84848D",placeholderDisabled:"#52525B",icon:"#8B8B95",iconFocused:"#D4D4DB",iconDisabled:"#52525B",caret:"#7C9EF0",message:"#F87171"},surface:{pressed:"rgba(255, 255, 255, 0.08)",hovered:"rgba(255, 255, 255, 0.05)",selected:"rgba(124, 124, 232, 0.18)",disabled:"#1C1C26"},glass:{fill:"rgba(255, 255, 255, 0.28)",border:"rgba(255, 255, 255, 0.45)",on:"#0F0F1A",badge:"#FFFFFF"},skeleton:{background:"#1C1C26",highlight:"#27272F"},avatarPalette:["#8B8BEE","#2DD4BF","#FCD34D","#F472B6","#60A5FA","#A78BFA","#34D399","#F87171"]},typography:typography,spacing:spacing,radius:radius,cornerSmoothing:SQUIRCLE_SMOOTHING,shadows:darkShadows,motion:motion,components:components,gradients:{}};
1
+ "use strict";import{SQUIRCLE_SMOOTHING}from"../utils/squircle.js";const typography={fontSize:{xs:11,sm:13,base:15,lg:17,xl:20,"2xl":24,"3xl":30,"4xl":36},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:1.2,normal:1.4,relaxed:1.6},letterSpacing:{tight:-.2,normal:0,wide:.4}},spacing={none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius={none:0,xs:4,sm:6,md:10,lg:14,xl:20,"2xl":28,full:9999},FIELD_RADIUS=10,fieldSizes={sm:{paddingHorizontal:12,paddingVertical:10,minHeight:38,fontSize:13,borderRadius:10,iconSize:14,labelFontSize:11,labelGap:4,messageFontSize:11,messageGap:2},md:{paddingHorizontal:14,paddingVertical:13,minHeight:44,fontSize:14,borderRadius:10,iconSize:16,labelFontSize:12,labelGap:4,messageFontSize:12,messageGap:2},lg:{paddingHorizontal:16,paddingVertical:15,minHeight:52,fontSize:16,borderRadius:10,iconSize:18,labelFontSize:13,labelGap:4,messageFontSize:13,messageGap:2}},components={button:{xs:{paddingHorizontal:10,paddingVertical:4,minHeight:28,fontSize:12,borderRadius:8},sm:{paddingHorizontal:12,paddingVertical:6,minHeight:34,fontSize:14,borderRadius:10},md:{paddingHorizontal:16,paddingVertical:9,minHeight:42,fontSize:16,borderRadius:12},lg:{paddingHorizontal:20,paddingVertical:12,minHeight:50,fontSize:18,borderRadius:14},xl:{paddingHorizontal:24,paddingVertical:14,minHeight:58,fontSize:20,borderRadius:16}},input:{sm:{...fieldSizes.sm,multilineMinHeight:72},md:{...fieldSizes.md,multilineMinHeight:92},lg:{...fieldSizes.lg,multilineMinHeight:110}},searchBar:{sm:{borderRadius:radius.full},md:{borderRadius:radius.full},lg:{borderRadius:radius.full}},emptyState:{sm:{iconSize:48,titleFontSize:"lg",descriptionFontSize:"sm",paddingVertical:"lg",titleGap:"md",descriptionGap:"xs"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl",titleGap:"md",descriptionGap:"xs"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl",titleGap:"md",descriptionGap:"xs"}},field:{defaultVariant:"outlined",sm:fieldSizes.sm,md:fieldSizes.md,lg:fieldSizes.lg},listItem:{sm:{paddingVertical:"sm",titleFontSize:"sm",subtitleFontSize:"xs",minHeight:44},md:{paddingVertical:"md",titleFontSize:"base",subtitleFontSize:"sm",minHeight:56},lg:{paddingVertical:"lg",titleFontSize:"lg",subtitleFontSize:"sm",minHeight:72}},badge:{sm:{fontSize:10,minWidth:16,height:16,paddingHorizontal:5,dotSize:8},md:{fontSize:11,minWidth:20,height:20,paddingHorizontal:6,dotSize:10},borderWidth:1.5,anchorOffset:4},chip:{sm:{paddingHorizontal:10,paddingVertical:4,fontSize:12,minHeight:26,closeSize:16,closeFontSize:12,gap:6},md:{paddingHorizontal:12,paddingVertical:6,fontSize:13,minHeight:32,closeSize:18,closeFontSize:13,gap:8}},checkbox:{sm:{boxSize:16},md:{boxSize:20},lg:{boxSize:24},labelGap:10},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},labelGap:10},switch:{sm:{trackWidth:42,trackHeight:26,thumbSize:22,padding:2},md:{trackWidth:51,trackHeight:31,thumbSize:27,padding:2},lg:{trackWidth:60,trackHeight:36,thumbSize:32,padding:2},thumbColor:"#FFFFFF"},otpInput:{sm:{cell:36,fontSize:16,borderRadius:8,gap:8},md:{cell:48,fontSize:20,borderRadius:10,gap:10},lg:{cell:56,fontSize:24,borderRadius:12,gap:12}},dialog:{iconWrapperSize:48,iconWrapperBorderRadius:24,actionButtonMinHeight:44},toast:{iconCircleSize:28,iconCircleBorderRadius:14,iconGlyphFontSize:16,tintBarWidth:0},banner:{tintBarWidth:0},formField:{inlineLabelWidth:"35%"}},motion={duration:{instant:80,fast:160,normal:240,slow:360,slower:500},easing:{standard:[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]},spring:{gentle:{damping:26,stiffness:240,mass:.9},bouncy:{damping:16,stiffness:200,mass:.7},snappy:{damping:20,stiffness:300,mass:.7}}},lightShadows={none:{},xs:{shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.04,shadowRadius:2,elevation:1},sm:{shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.06,shadowRadius:4,elevation:2},md:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.08,shadowRadius:8,elevation:4},lg:{shadowColor:"#000",shadowOffset:{width:0,height:8},shadowOpacity:.1,shadowRadius:16,elevation:8},xl:{shadowColor:"#000",shadowOffset:{width:0,height:12},shadowOpacity:.14,shadowRadius:24,elevation:12},"2xl":{shadowColor:"#000",shadowOffset:{width:0,height:20},shadowOpacity:.18,shadowRadius:32,elevation:20}},darkShadows={none:{},xs:{shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.3,shadowRadius:2,elevation:1},sm:{shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.4,shadowRadius:4,elevation:2},md:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.5,shadowRadius:8,elevation:4},lg:{shadowColor:"#000",shadowOffset:{width:0,height:8},shadowOpacity:.55,shadowRadius:16,elevation:8},xl:{shadowColor:"#000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12},"2xl":{shadowColor:"#000",shadowOffset:{width:0,height:20},shadowOpacity:.7,shadowRadius:32,elevation:20}};export const lightTheme={mode:"light",colors:{primary:"#5B5BD6",primaryHover:"#4F4FBF",primaryPressed:"#4040A8",primaryMuted:"#EEEEFC",secondary:"#F4F4F8",secondaryHover:"#E9E9F0",success:"#18864F",warning:"#F59E0B",error:"#E12C32",info:"#1B6EF5",onPrimary:"#FFFFFF",onSecondary:"#0F0F1A",onSuccess:"#FFFFFF",onWarning:"#0F0F1A",onError:"#FFFFFF",onInfo:"#FFFFFF",onOverlay:"#FFFFFF",toneText:{primary:"#4F4FD3",success:"#147042",warning:"#8F5C06",error:"#BC1B20",info:"#0958D9"},text:{primary:"#0F0F1A",secondary:"#52525B",tertiary:"#62626B",inverse:"#FFFFFF",strong:"#252F4A",disabled:"#B4B4BB",link:"#5B5BD6"},background:{primary:"#FFFFFF",secondary:"#F8F8FB",tertiary:"#F1F1F5",elevated:"#FFFFFF",overlay:"rgba(15, 15, 26, 0.5)",inverse:"#0F0F1A"},border:{primary:"#E5E5EC",secondary:"#EFEFF3",focus:"#5B5BD6",error:"#E5484D",width:1},field:{background:"#F9FBFC",backgroundFocused:"#FFFFFF",backgroundDisabled:"#F5F6FA",border:"#EBEDF3",borderFocused:"#BED2F9",borderError:"#FDBFCE",label:"#242F4A",text:"#252F4A",textDisabled:"#C4CADA",placeholder:"#626D8B",placeholderDisabled:"#C4CADA",icon:"#7A849F",iconFocused:"#4B5675",iconDisabled:"#C4CADA",caret:"#5B8DEE",message:"#D81736"},surface:{pressed:"rgba(15, 15, 26, 0.06)",hovered:"rgba(15, 15, 26, 0.04)",selected:"rgba(91, 91, 214, 0.1)",disabled:"#F1F1F5"},glass:{fill:"rgba(255, 255, 255, 0.28)",border:"rgba(255, 255, 255, 0.45)",on:"#0F0F1A",badge:"#FFFFFF"},skeleton:{background:"#EBEDF3",highlight:"#F5F6FA"},avatarPalette:["#5B5BD6","#0A7979","#A45A05","#CD226E","#2462EB","#7C3AED","#047C57","#D42222"]},typography:typography,spacing:spacing,radius:radius,cornerSmoothing:SQUIRCLE_SMOOTHING,shadows:lightShadows,motion:motion,components:components,gradients:{}};export const darkTheme={mode:"dark",colors:{primary:"#7C7CE8",primaryHover:"#9292EE",primaryPressed:"#A8A8F2",primaryMuted:"#1F1F3D",secondary:"#1F1F26",secondaryHover:"#2A2A33",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA",onPrimary:"#0F0F1A",onSecondary:"#FAFAFA",onSuccess:"#0F0F1A",onWarning:"#0F0F1A",onError:"#0F0F1A",onInfo:"#0F0F1A",onOverlay:"#FFFFFF",toneText:{primary:"#8989EA",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},text:{primary:"#FAFAFA",secondary:"#B4B4BB",tertiary:"#919199",inverse:"#0F0F1A",strong:"#E2E2E2",disabled:"#52525B",link:"#9292EE"},background:{primary:"#0B0B12",secondary:"#13131C",tertiary:"#1C1C26",elevated:"#1C1C26",overlay:"rgba(0, 0, 0, 0.65)",inverse:"#FAFAFA"},border:{primary:"#27272F",secondary:"#1C1C26",focus:"#7C7CE8",error:"#F87171",width:1},field:{background:"#13131C",backgroundFocused:"#0B0B12",backgroundDisabled:"#1C1C26",border:"#27272F",borderFocused:"#3D5FB0",borderError:"#8A2F42",label:"#E4E6EE",text:"#FAFAFA",textDisabled:"#52525B",placeholder:"#84848D",placeholderDisabled:"#52525B",icon:"#8B8B95",iconFocused:"#D4D4DB",iconDisabled:"#52525B",caret:"#7C9EF0",message:"#F87171"},surface:{pressed:"rgba(255, 255, 255, 0.08)",hovered:"rgba(255, 255, 255, 0.05)",selected:"rgba(124, 124, 232, 0.18)",disabled:"#1C1C26"},glass:{fill:"rgba(255, 255, 255, 0.28)",border:"rgba(255, 255, 255, 0.45)",on:"#0F0F1A",badge:"#FFFFFF"},skeleton:{background:"#1C1C26",highlight:"#27272F"},avatarPalette:["#8B8BEE","#2DD4BF","#FCD34D","#F472B6","#60A5FA","#A78BFA","#34D399","#F87171"]},typography:typography,spacing:spacing,radius:radius,cornerSmoothing:SQUIRCLE_SMOOTHING,shadows:darkShadows,motion:motion,components:components,gradients:{}};
@@ -1,6 +1,7 @@
1
1
  import type React from 'react';
2
- import type { ImageSourcePropType, ImageStyle, View as RNView, StyleProp, TextStyle, ViewStyle } from 'react-native';
2
+ import type { GestureResponderEvent, ImageSourcePropType, ImageStyle, PressableProps, View as RNView, StyleProp, TextStyle, ViewStyle } from 'react-native';
3
3
  import type { Theme } from '../../theme/types';
4
+ import type { HapticType } from '../../utils/hapticUtils';
4
5
  /**
5
6
  * Props passed to a custom {@link AvatarProps.ImageComponent}. The built-in
6
7
  * image is expo-image's `Image`, and both it (`contentFit`) and React Native's
@@ -72,7 +73,30 @@ export interface AvatarProps {
72
73
  * when data arrives. Use this while the data driving the component is being fetched.
73
74
  */
74
75
  loading?: boolean;
76
+ /**
77
+ * Accessible name. The default is `"<name>'s avatar"`, or the name alone
78
+ * when the avatar is pressable.
79
+ */
75
80
  accessibilityLabel?: string;
81
+ /**
82
+ * Makes the avatar a button: it is announced as one, dims while pressed and
83
+ * fires the haptic. Pass it to open a profile or a photo menu. Ignored
84
+ * while `loading`.
85
+ */
86
+ onPress?: (event: GestureResponderEvent) => void;
87
+ /** Long press; also makes the avatar a button. The `longPress` haptic fires first. */
88
+ onLongPress?: (event: GestureResponderEvent) => void;
89
+ /**
90
+ * Haptic on a press (default `'selection'`) and a long press (default
91
+ * `'longPress'`). A type replaces both; `false` turns both off. Only a
92
+ * pressable avatar fires one.
93
+ */
94
+ haptic?: HapticType | false;
95
+ /**
96
+ * Extra touch area of a pressable avatar. Unset, it grows the avatar to
97
+ * 44 points on each side, so `xs` and `sm` stay easy to hit.
98
+ */
99
+ hitSlop?: PressableProps['hitSlop'];
76
100
  style?: StyleProp<ViewStyle>;
77
101
  textStyle?: StyleProp<TextStyle>;
78
102
  testID?: string;
@@ -11,14 +11,25 @@ import type { SlotIcon } from '../AppIcon/slotIcon';
11
11
  export type ChipVariant = 'filled' | 'outlined' | 'soft';
12
12
  export type ChipTone = 'primary' | 'neutral' | 'success' | 'warning' | 'error' | 'info';
13
13
  export type ChipSize = 'sm' | 'md';
14
- export type ChipSelectionMode = 'single' | 'multiple';
14
+ export type ChipSelectionMode = 'single' | 'multiple' | 'radio';
15
15
  export interface ChipProps {
16
16
  label: string;
17
+ /**
18
+ * A figure after the label, drawn quieter than it (regular weight, caption
19
+ * size, tabular digits): "Open" with `count={4}`. `0` is shown; `undefined`
20
+ * and an empty string draw nothing, so a count still loading leaves the
21
+ * label alone. The accessibility label becomes "Open, 4" unless
22
+ * `accessibilityLabel` is set.
23
+ */
24
+ count?: number | string;
17
25
  selected?: boolean;
18
26
  /**
19
27
  * How a pressable chip announces itself. `'single'` (default) is a button
20
28
  * with a selected state; `'multiple'` is a checkbox whose checked state
21
- * follows `selected`, for chips that toggle independently.
29
+ * follows `selected`, for chips that toggle independently; `'radio'` is a
30
+ * radio whose checked state follows `selected`, for one-of-many chips inside
31
+ * a radiogroup. A disabled `'radio'` chip with an `onPress` stays a radio
32
+ * (announced disabled) instead of falling back to plain text.
22
33
  */
23
34
  selectionMode?: ChipSelectionMode;
24
35
  onPress?: () => void;
@@ -51,6 +62,8 @@ export interface ChipProps {
51
62
  textStyle?: StyleProp<TextStyle>;
52
63
  /** Style override for the chip outer container (alias to style, applied after). */
53
64
  containerStyle?: StyleProp<ViewStyle>;
65
+ /** Style override for the count text. */
66
+ countStyle?: StyleProp<TextStyle>;
54
67
  /** Style override for the close (×) button pressable. */
55
68
  closeButtonStyle?: StyleProp<ViewStyle>;
56
69
  /** Style override for the close (×) glyph text. */
@@ -20,22 +20,33 @@ export interface FileViewerProps {
20
20
  onError?: (error: Error) => void;
21
21
  /** Replaces the default themed spinner shown while the document loads. */
22
22
  loadingIndicator?: () => React.ReactNode;
23
+ /** Pinch, double-tap zoom and pan while zoomed. Default true. */
24
+ zoomEnabled?: boolean;
25
+ /** Upper bound on pinch zoom, as a multiple of the page fitting the width. Default 4. */
26
+ maxZoom?: number;
23
27
  style?: StyleProp<ViewStyle>;
24
28
  testID?: string;
25
29
  accessibilityLabel?: string;
26
30
  }
27
31
  /**
28
32
  * Renders a PDF via our own native rasterizer (Core Graphics on iOS, PdfRenderer on
29
- * Android) — no third-party PDF dependency. Pages are paged through a plain
30
- * `ScrollView` with manual windowed mounting (render the visible page ±
31
- * `RENDER_WINDOW`), not a `FlatList` — a `VirtualizedList`-based component
32
- * would trip React Native's "VirtualizedLists should never be nested inside
33
- * plain ScrollViews" the moment a consumer embeds FileViewer in their own
34
- * scrolling screen, which is a completely ordinary way to use it. Avoiding the
35
- * VirtualizedList primitive entirely removes that whole class of warning
36
- * rather than working around one instance of it. The WebView fallback
37
- * consumer apps use for non-PDF office documents is a distinct rendering
38
- * strategy and stays app-side.
33
+ * Android), with no third-party PDF dependency. Pages are paged through a plain
34
+ * `ScrollView` with manual windowed mounting, not a `FlatList`: a
35
+ * `VirtualizedList`-based component would trip React Native's "VirtualizedLists
36
+ * should never be nested inside plain ScrollViews" the moment a consumer embeds
37
+ * FileViewer in their own scrolling screen, which is a completely ordinary way to
38
+ * use it. Avoiding the VirtualizedList primitive entirely removes that whole class
39
+ * of warning rather than working around one instance of it. The WebView fallback
40
+ * consumer apps use for non-PDF office documents is a distinct rendering strategy
41
+ * and stays app-side.
42
+ *
43
+ * Pages render one at a time, nearest the reader first, `RENDER_AHEAD` each way,
44
+ * and their files are kept, so scrolling back or ahead never lands on a blank
45
+ * page; only `MOUNT_AROUND` pages each side decode their image. Pinch zooms around
46
+ * the fingers and a double tap zooms in on the tap or back out; the transform sits
47
+ * on the whole scroll view, so while zoomed a one-finger drag pans and, past the
48
+ * zoomed page's top or bottom edge, carries on into the document's scroll. A
49
+ * settled zoom re-renders the page in view at the sharper scale it needs.
39
50
  */
40
51
  export declare const FileViewer: React.FC<FileViewerProps>;
41
52
  export default FileViewer;