@webority/mobile-ui 0.161.0 → 0.163.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas-kit/kit.js +7 -7
- package/dist/canvas-kit/manifest.json +1 -1
- package/dist/canvas-kit/release.json +5 -5
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/commonjs/components/Confetti/Confetti.js +1 -1
- package/lib/commonjs/components/Drawer/Drawer.js +1 -1
- package/lib/commonjs/components/FileViewer/useFileViewerZoom.js +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/commonjs/components/NonModalBottomSheet/NonModalBottomSheet.js +1 -1
- package/lib/commonjs/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
- package/lib/commonjs/components/SlideToConfirm/SlideToConfirm.js +1 -1
- package/lib/commonjs/components/Slider/Slider.js +1 -1
- package/lib/commonjs/components/SortableList/SortableList.js +1 -1
- package/lib/commonjs/components/Swipeable/Swipeable.js +1 -1
- package/lib/commonjs/components/TagInput/TagInput.js +1 -1
- package/lib/commonjs/components/ZoomableImage/ZoomableImage.js +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/module/components/Confetti/Confetti.js +1 -1
- package/lib/module/components/Drawer/Drawer.js +1 -1
- package/lib/module/components/FileViewer/useFileViewerZoom.js +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/module/components/NonModalBottomSheet/NonModalBottomSheet.js +1 -1
- package/lib/module/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
- package/lib/module/components/SlideToConfirm/SlideToConfirm.js +1 -1
- package/lib/module/components/Slider/Slider.js +1 -1
- package/lib/module/components/SortableList/SortableList.js +1 -1
- package/lib/module/components/Swipeable/Swipeable.js +1 -1
- package/lib/module/components/TagInput/TagInput.js +1 -1
- package/lib/module/components/ZoomableImage/ZoomableImage.js +1 -1
- package/lib/typescript/commonjs/components/PhoneNumberInput/PhoneNumberInput.d.ts +1 -1
- package/lib/typescript/module/components/PhoneNumberInput/PhoneNumberInput.d.ts +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback,useEffect,useMemo,useRef}from"react";import{Dimensions,Pressable,StyleSheet,View}from"react-native";import{GestureDetector,usePanGesture}from"react-native-gesture-handler";import Animated,{cancelAnimation,
|
|
1
|
+
"use strict";import{useCallback,useEffect,useMemo,useRef}from"react";import{Dimensions,Pressable,StyleSheet,View}from"react-native";import{GestureDetector,usePanGesture}from"react-native-gesture-handler";import Animated,{cancelAnimation,useAnimatedStyle,useSharedValue,withSpring}from"react-native-reanimated";import{scheduleOnRN}from"react-native-worklets";import{useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const SPRING_CONFIG={damping:22,stiffness:260,mass:1},DRAG_ACTIVATION_OFFSET=10,RUBBER_BAND_FACTOR=.35,FAIL_OFFSET_Y=15,ACTION_ICON_SIZE=20,toneToBg=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;default:return e.colors.neutral}},toneToOnColor=(e,t)=>{switch(t){case"primary":return e.colors["on-primary"];case"success":return e.colors["on-success"];case"warning":return e.colors["on-warning"];case"danger":return e.colors["on-danger"];case"info":return e.colors["on-info"];default:return e.colors["on-neutral"]}},Swipeable=e=>{const{children:t,leftActions:n,rightActions:s,threshold:i,fullSwipeThreshold:o,onSwipeOpen:r,onSwipeClose:a,disabled:l=!1,haptic:c,containerStyle:u,contentStyle:d,actionStyle:m,accessibilityLabel:h,testID:p}=e,S=useTheme(),b=i??80,f=o??200,w=useMemo(()=>buildStyles(S),[S]),g=useMemo(()=>buildActionStyles(S),[S]),y=!!n&&n.length>0,v=!!s&&s.length>0,x=Dimensions.get("window").width,A=y?b*(n?.length??0):0,I=v?b*(s?.length??0):0,_=useSharedValue(0),N=useSharedValue(0),C=useRef(null);useEffect(()=>()=>{cancelAnimation(_),cancelAnimation(N)},[_,N]);const O=useCallback(e=>{C.current!==e&&(C.current=e,r?.(e))},[r]),R=useCallback(()=>{null!==C.current&&(C.current=null,a?.())},[a]),j=useCallback(e=>{const t="left"===e?n:s,i=t?.[0];i&&(!1!==c&&triggerHaptic("notificationSuccess"),i.onPress(),_.value=withSpring(0,SPRING_CONFIG),C.current=null,a?.())},[n,s,_,a,c]),G=useCallback(()=>{_.value=withSpring(0,SPRING_CONFIG),R()},[_,R]),k=useCallback(e=>{const t=resolveHaptic(c,"selection");t&&triggerHaptic(t),e.onPress(),G()},[G,c]),P=useMemo(()=>{const e=A,t=I,n=f,s=-f,i=x,o=-x,r=b,a=y,c=v;return{enabled:!l,testID:p?`${p}-gesture`:"swipeable-gesture",activeOffsetX:[-10,10],failOffsetY:[-15,15],onActivate:()=>{"worklet";N.value=_.value},onUpdate:n=>{"worklet";const s=N.value+n.translationX;_.value=s>0&&!a||s<0&&!c?0:s>e&&a?e+.35*(s-e):s<-t&&c?.35*(s+t)-t:s},onDeactivate:()=>{"worklet";const l=_.value;return a&&l>=n?(_.value=withSpring(i,SPRING_CONFIG),void scheduleOnRN(j,"left")):c&&l<=s?(_.value=withSpring(o,SPRING_CONFIG),void scheduleOnRN(j,"right")):a&&l>=r?(_.value=withSpring(e,SPRING_CONFIG),void scheduleOnRN(O,"left")):c&&l<=-r?(_.value=withSpring(-t,SPRING_CONFIG),void scheduleOnRN(O,"right")):(_.value=withSpring(0,SPRING_CONFIG),void scheduleOnRN(R))}}},[l,N,j,f,y,v,A,R,O,I,x,b,_,p]),T=usePanGesture(P),V=useAnimatedStyle(()=>({transform:[{translateX:_.value}]}),[_]),F=useAnimatedStyle(()=>({opacity:A>0?Math.min(1,Math.max(0,_.value/A)):0}),[A,_]),D=useAnimatedStyle(()=>({opacity:I>0?Math.min(1,Math.max(0,-_.value/I)):0}),[I,_]),E=useMemo(()=>{const e=[];return n?.forEach(t=>{e.push({name:t.key,label:t.label})}),s?.forEach(t=>{e.push({name:t.key,label:t.label})}),e},[n,s]),B=useCallback(e=>{const t=e.nativeEvent.actionName,i=[...n??[],...s??[]].find(e=>e.key===t);i&&(!1!==c&&triggerHaptic("selection"),i.onPress())},[n,s,c]);return y||v?_jsxs(View,{style:[w.root,u],testID:p,accessibilityLabel:h,accessibilityActions:E,onAccessibilityAction:B,children:[y?_jsx(Animated.View,{style:[w.actionsRow,w.actionsLeft,{width:A},m,F],pointerEvents:"box-none",children:n?.map(e=>_jsx(ActionButton,{action:e,theme:S,actionStyles:g,width:b,onPress:k},e.key))}):null,v?_jsx(Animated.View,{style:[w.actionsRow,w.actionsRight,{width:I},m,D],pointerEvents:"box-none",children:s?.map(e=>_jsx(ActionButton,{action:e,theme:S,actionStyles:g,width:b,onPress:k},e.key))}):null,_jsx(GestureDetector,{gesture:T,children:_jsx(Animated.View,{style:[w.content,d,V],children:t})})]}):_jsx(View,{style:u,testID:p,children:t})};Swipeable.displayName="Swipeable";const ActionButton=({action:e,theme:t,actionStyles:n,width:s,onPress:i})=>{assertValidValue("Swipeable","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const o=e.tone??"neutral",r=toneToBg(t,o),a=renderSlotIcon(e.icon,{color:toneToOnColor(t,o),size:20,disabled:!1});return _jsxs(Pressable,{onPress:()=>i(e),accessibilityRole:"button",accessibilityLabel:e.label,style:[n.button,{width:s,backgroundColor:r,paddingHorizontal:t.space.sm}],children:[a?_jsx(View,{style:n.icon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:a}):null,_jsx(Text,{variant:"bodySmall",weight:"semibold",style:[n.label,{color:toneToOnColor(t,o)}],numberOfLines:1,children:e.label})]})},buildActionStyles=e=>StyleSheet.create({button:{flexGrow:0,flexShrink:0,alignItems:"center",justifyContent:"center"},icon:{marginBottom:e.space.xxs},label:{textAlign:"center"}}),buildStyles=e=>StyleSheet.create({root:{position:"relative",overflow:"hidden"},content:{backgroundColor:"transparent"},actionsRow:{position:"absolute",top:0,bottom:0,flexDirection:"row"},actionsLeft:{left:0},actionsRight:{right:0,justifyContent:"flex-end"}});export{Swipeable};export default Swipeable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useMemo,useRef,useState}from"react";import{StyleSheet,TextInput,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{fontFor,useTheme}from"../../theme/index.js";import{mergeRefs,resolveHaptic,triggerHaptic}from"../../utils/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{Chip}from"../Chip/index.js";import{FieldBase,FieldLabel,FieldMessage,hasFieldText,RequiredPlaceholder}from"../FieldBase/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const TagInput=forwardRef((e,t)=>{const{value:s,defaultValue:l,onChange:a,placeholder:
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useMemo,useRef,useState}from"react";import{StyleSheet,TextInput,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{fontFor,useTheme}from"../../theme/index.js";import{mergeRefs,resolveHaptic,triggerHaptic}from"../../utils/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{Chip}from"../Chip/index.js";import{FieldBase,FieldLabel,FieldMessage,hasFieldText,RequiredPlaceholder}from"../FieldBase/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const TagInput=forwardRef((e,t)=>{const{value:s,defaultValue:l,onChange:a,placeholder:i,label:r,helperText:o,error:n,required:u,disabled:d=!1,size:c="md",variant:p,maxTags:m,unique:x=!0,transform:f,separators:h=[","],haptic:g,onFocus:b,style:j,testID:y}=e;assertValidValue("TagInput","size",e.size,["sm","md","lg"]),assertValidValue("TagInput","variant",e.variant,["outline","filled","underline"]);const v=useTheme(),C=useMemo(()=>buildStyles(v),[v]),[T,F]=useControllableState({value:s,defaultValue:l??[],onChange:a}),[S,V]=useState(""),[w,k]=useState(!1),I=useRef(null),z=useMemo(()=>mergeRefs(I,t),[t]),_=useCallback(()=>{d||I.current?.focus()},[d]),B="number"==typeof m&&T.length>=m,R=!0===n||hasFieldText(n),H=u&&!r&&0===T.length&&0===S.length&&Boolean(i),M=useCallback(e=>{const t=f?f(e.trim()):e.trim();if(!t)return;if(B)return;if(x&&T.some(e=>e.toLowerCase()===t.toLowerCase()))return void V("");F([...T,t]),V("");const s=resolveHaptic(g,"selection");s&&triggerHaptic(s)},[B,g,F,T,f,x]),q=useCallback(e=>{const t=T.filter((t,s)=>s!==e);F(t);const s=resolveHaptic(g,"selection");s&&triggerHaptic(s)},[g,F,T]),L=useCallback(e=>{const t=h.find(t=>t.length>0&&e.includes(t));t?M(e.slice(0,e.indexOf(t))):V(e)},[M,h]),D=useCallback(e=>{d||"Backspace"===e.nativeEvent.key&&""===S&&T.length>0&&q(T.length-1)},[d,S,q,T.length]),P=useMemo(()=>T.map((e,t)=>({key:`${e}-${t}`,tag:e,index:t})),[T]),$=_jsx(FieldBase,{size:c,variant:p,focused:w,disabled:d,error:R,filled:T.length>0||S.length>0,onPress:_,pressFeedback:!1,style:j,children:_jsxs(View,{style:C.wrap,children:[P.map(({key:e,tag:t,index:s})=>_jsx(Chip,{label:t,size:"sm",onRemove:d?void 0:()=>q(s),haptic:g},e)),_jsxs(View,{style:C.inputBox,children:[_jsx(TextInput,{ref:z,value:S,onChangeText:L,onKeyPress:D,onSubmitEditing:()=>M(S),onFocus:e=>{k(!0),b?.(e)},onBlur:()=>{k(!1),M(S)},editable:!d&&!B,placeholder:B||H?void 0:i,placeholderTextColor:v.colors["text-subtle"],submitBehavior:"submit",returnKeyType:"done",accessibilityLabel:r??i,style:[C.input,{color:v.colors["text-body"],fontSize:v.text.base.size}],testID:y?`${y}-input`:void 0}),H?_jsx(RequiredPlaceholder,{text:i??"",color:v.colors["text-subtle"],fontSize:v.text.base.size,weightStyle:fontFor(v,"normal")}):null]})]})});return _jsxs(View,{testID:y,children:[r?_jsx(FieldLabel,{size:c,required:u,children:r}):null,$,_jsx(FieldMessage,{size:c,error:R,text:R?n:o})]})});TagInput.displayName="TagInput";const buildStyles=e=>StyleSheet.create({wrap:{flex:1,flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:e.space.xs,paddingVertical:e.space.xs},inputBox:{flexGrow:1,minWidth:80},input:{...fontFor(e,"normal"),padding:e.space.none}});export default TagInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback,useEffect,useMemo}from"react";import{StyleSheet}from"react-native";import{GestureDetector,useCompetingGestures,usePanGesture,usePinchGesture,useTapGesture}from"react-native-gesture-handler";import Animated,{
|
|
1
|
+
"use strict";import{useCallback,useEffect,useMemo}from"react";import{StyleSheet}from"react-native";import{GestureDetector,useCompetingGestures,usePanGesture,usePinchGesture,useTapGesture}from"react-native-gesture-handler";import Animated,{useAnimatedStyle,useSharedValue,withSpring}from"react-native-reanimated";import{scheduleOnRN}from"react-native-worklets";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{jsx as _jsx}from"react/jsx-runtime";const DEFAULT_MAX_SCALE=4,DEFAULT_MIN_SCALE=1,DEFAULT_DOUBLE_TAP_SCALE=2,SPRING_CONFIG={damping:18,stiffness:220,mass:1};export const ZoomableImage=({children:e,maxScale:a=4,minScale:t=1,doubleTapScale:l=2,disabled:u=!1,haptic:i,style:s,accessibilityLabel:r,testID:n})=>{const o=useSharedValue(1),v=useSharedValue(1),c=useSharedValue(0),m=useSharedValue(0),S=useSharedValue(0),d=useSharedValue(0),p=useCallback(()=>{o.value=withSpring(1,SPRING_CONFIG),v.value=1,c.value=withSpring(0,SPRING_CONFIG),m.value=withSpring(0,SPRING_CONFIG),S.value=0,d.value=0},[o,v,c,m,S,d]);useEffect(()=>{u&&p()},[u,p]);const h=useCallback(()=>{const e=resolveHaptic(i,"impactLight");e&&triggerHaptic(e)},[i]),G=useMemo(()=>({enabled:!u,onActivate:()=>{"worklet";v.value=o.value},onUpdate:e=>{"worklet";const l=v.value*e.scale;o.value=l<t?t+.3*(l-t):l>a?a+.2*(l-a):l},onDeactivate:()=>{"worklet";return o.value<t?(o.value=withSpring(t,SPRING_CONFIG),c.value=withSpring(0,SPRING_CONFIG),m.value=withSpring(0,SPRING_CONFIG),v.value=t,S.value=0,void(d.value=0)):o.value>a?(o.value=withSpring(a,SPRING_CONFIG),void(v.value=a)):void(v.value=o.value)}}),[u,o,v,c,m,S,d,t,a]),I=usePinchGesture(G),g=useMemo(()=>({enabled:!u,minPointers:1,maxPointers:1,onActivate:()=>{"worklet";S.value=c.value,d.value=m.value},onUpdate:e=>{"worklet";o.value<=1||(c.value=S.value+e.translationX,m.value=d.value+e.translationY)},onDeactivate:()=>{"worklet";S.value=c.value,d.value=m.value}}),[u,o,c,m,S,d]),N=usePanGesture(g),w=useMemo(()=>({enabled:!u,numberOfTaps:2,onDeactivate:()=>{"worklet";scheduleOnRN(h),o.value>1?(o.value=withSpring(1,SPRING_CONFIG),c.value=withSpring(0,SPRING_CONFIG),m.value=withSpring(0,SPRING_CONFIG),v.value=1,S.value=0,d.value=0):(o.value=withSpring(l,SPRING_CONFIG),v.value=l)}}),[u,o,v,c,m,S,d,h,l]),_=useTapGesture(w),C=useCompetingGestures(I,N,_),b=useAnimatedStyle(()=>({transform:[{translateX:c.value},{translateY:m.value},{scale:o.value}]}),[c,m,o]);return _jsx(GestureDetector,{gesture:C,children:_jsx(Animated.View,{style:[styles.container,s],testID:n,accessibilityLabel:r,accessibilityState:{disabled:u},"aria-disabled":u,children:_jsx(Animated.View,{style:[styles.content,b],children:e})})})};ZoomableImage.displayName="ZoomableImage";const styles=StyleSheet.create({container:{flex:1,alignItems:"center",justifyContent:"center",overflow:"hidden"},content:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center"}});export default ZoomableImage;
|
|
@@ -80,7 +80,7 @@ export interface PhoneNumberInfo {
|
|
|
80
80
|
/** Validity under the `validation` prop. */
|
|
81
81
|
valid: boolean;
|
|
82
82
|
}
|
|
83
|
-
export interface PhoneNumberInputProps extends Pick<TextInputProps, "returnKeyType" | "submitBehavior" | "onSubmitEditing"
|
|
83
|
+
export interface PhoneNumberInputProps extends Pick<TextInputProps, "returnKeyType" | "submitBehavior" | "onSubmitEditing"> {
|
|
84
84
|
value?: PhoneNumberValue | undefined;
|
|
85
85
|
/**
|
|
86
86
|
* Controlled value as one E.164 string (`'+14155550123'`, `''` for empty),
|
|
@@ -80,7 +80,7 @@ export interface PhoneNumberInfo {
|
|
|
80
80
|
/** Validity under the `validation` prop. */
|
|
81
81
|
valid: boolean;
|
|
82
82
|
}
|
|
83
|
-
export interface PhoneNumberInputProps extends Pick<TextInputProps, "returnKeyType" | "submitBehavior" | "onSubmitEditing"
|
|
83
|
+
export interface PhoneNumberInputProps extends Pick<TextInputProps, "returnKeyType" | "submitBehavior" | "onSubmitEditing"> {
|
|
84
84
|
value?: PhoneNumberValue | undefined;
|
|
85
85
|
/**
|
|
86
86
|
* Controlled value as one E.164 string (`'+14155550123'`, `''` for empty),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.163.0",
|
|
4
4
|
"description": "Beautiful, animated, accessible React Native components, theme and form engine for Webority projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -115,13 +115,13 @@
|
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@webority/markdown-core": "0.
|
|
118
|
+
"@webority/markdown-core": "0.163.0"
|
|
119
119
|
},
|
|
120
120
|
"peerDependencies": {
|
|
121
121
|
"@react-navigation/bottom-tabs": ">=7.0.0",
|
|
122
122
|
"@react-navigation/native": ">=7.0.0",
|
|
123
|
-
"@webority/canvas-kit": "0.
|
|
124
|
-
"@webority/mobile-core": "0.
|
|
123
|
+
"@webority/canvas-kit": "0.163.0",
|
|
124
|
+
"@webority/mobile-core": "0.163.0",
|
|
125
125
|
"expo": ">=58.0.0",
|
|
126
126
|
"expo-file-system": ">=58.0.0",
|
|
127
127
|
"expo-haptics": ">=58.0.0",
|
|
@@ -185,10 +185,10 @@
|
|
|
185
185
|
"@types/node": "25.6.0",
|
|
186
186
|
"@types/react": "19.3.0",
|
|
187
187
|
"@types/react-test-renderer": "19.3.0",
|
|
188
|
-
"@webority/canvas-kit": "0.
|
|
189
|
-
"@webority/mobile-core": "0.
|
|
188
|
+
"@webority/canvas-kit": "0.163.0",
|
|
189
|
+
"@webority/mobile-core": "0.163.0",
|
|
190
190
|
"@webority/mobile-dev": "0.0.0",
|
|
191
|
-
"@webority/tokens": "0.
|
|
191
|
+
"@webority/tokens": "0.163.0",
|
|
192
192
|
"expo": "58.0.23",
|
|
193
193
|
"expo-file-system": "58.0.13",
|
|
194
194
|
"expo-haptics": "58.0.7",
|