@webority/mobile-ui 0.111.0 → 0.112.3

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 (38) hide show
  1. package/dist/canvas-kit/kit.js +1248 -1095
  2. package/dist/canvas-kit/manifest.json +24 -58
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/lib/commonjs/components/Markdown/Markdown.js +1 -1
  5. package/lib/commonjs/components/MessageBubble/MessageBubble.js +1 -1
  6. package/lib/commonjs/components/NumberInput/NumberInput.js +1 -1
  7. package/lib/commonjs/components/Screen/Screen.js +1 -1
  8. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
  9. package/lib/commonjs/components/Skeleton/Skeleton.js +1 -1
  10. package/lib/commonjs/components/Skeleton/SkeletonContent.js +1 -1
  11. package/lib/commonjs/components/Skeleton/SkeletonList.js +1 -1
  12. package/lib/commonjs/components/SortableList/SortableList.js +1 -1
  13. package/lib/module/components/Markdown/Markdown.js +1 -1
  14. package/lib/module/components/MessageBubble/MessageBubble.js +1 -1
  15. package/lib/module/components/NumberInput/NumberInput.js +1 -1
  16. package/lib/module/components/Screen/Screen.js +1 -1
  17. package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
  18. package/lib/module/components/Skeleton/Skeleton.js +1 -1
  19. package/lib/module/components/Skeleton/SkeletonContent.js +1 -1
  20. package/lib/module/components/Skeleton/SkeletonList.js +1 -1
  21. package/lib/module/components/SortableList/SortableList.js +1 -1
  22. package/lib/typescript/commonjs/components/Markdown/Markdown.d.ts +17 -10
  23. package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +1 -1
  24. package/lib/typescript/commonjs/components/RichTextEditor/markdownActions.d.ts +2 -2
  25. package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +0 -2
  26. package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +1 -3
  27. package/lib/typescript/commonjs/components/Skeleton/SkeletonList.d.ts +1 -3
  28. package/lib/typescript/module/components/Markdown/Markdown.d.ts +17 -10
  29. package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +1 -1
  30. package/lib/typescript/module/components/RichTextEditor/markdownActions.d.ts +2 -2
  31. package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +0 -2
  32. package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +1 -3
  33. package/lib/typescript/module/components/Skeleton/SkeletonList.d.ts +1 -3
  34. package/package.json +9 -6
  35. package/lib/commonjs/components/Markdown/parse.js +0 -1
  36. package/lib/module/components/Markdown/parse.js +0 -1
  37. package/lib/typescript/commonjs/components/Markdown/parse.d.ts +0 -63
  38. package/lib/typescript/module/components/Markdown/parse.d.ts +0 -63
@@ -1 +1 @@
1
- "use strict";import React,{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Pressable,StyleSheet,TextInput,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{resolveFieldSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{FieldBase,FieldLabel,FieldMessage,fieldTextAsString,hasFieldText,resolveFieldTextStyle}from"../FieldBase/FieldBase.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const NUMBER_INPUT_SIZES=["sm","md","lg"],NUMBER_INPUT_VARIANTS=["inline","horizontal","stacked"];export const DEFAULT_NUMBER_INPUT_LABELS=Object.freeze({decrease:"Decrease",increase:"Increase",input:"Number input"});const DEFAULT_LONG_PRESS_DELAY=500,DEFAULT_LONG_PRESS_INTERVAL=80,roundToPrecision=(e,t)=>{if(!Number.isFinite(e))return 0;if(t<=0)return Math.round(e);const i=10**t;return Math.round(e*i)/i},clamp=(e,t,i)=>e<t?t:e>i?i:e,formatValue=(e,t,i)=>Number.isFinite(e)?t&&i>0?e.toFixed(i):String(Math.trunc(e)):"",sanitizeTyped=(e,t)=>{if(!e)return"";let i=e.replace(/[^0-9.-]/g,"");if(i=i.replace(/(?!^)-/g,""),t){const e=i.indexOf(".");-1!==e&&(i=i.slice(0,e+1)+i.slice(e+1).replace(/\./g,""))}else i=i.replace(/\./g,"");return i},NumberInput=forwardRef((e,t)=>{const{value:i,defaultValue:s,onChange:l,min:r=Number.NEGATIVE_INFINITY,max:n=Number.POSITIVE_INFINITY,step:a=1,allowDecimal:o=!1,precision:c=0,label:u,help:d,helperText:b,error:m,disabled:p=!1,size:f="md",variant:x="inline",unit:h,haptic:y,labels:S,accessibilityLabel:I,style:T,containerStyle:N,inputStyle:g,buttonStyle:_,unitStyle:F,labelStyle:j,textInputProps:v,testID:E}=e;warnInvalidValue("NumberInput","size",e.size,NUMBER_INPUT_SIZES),warnInvalidValue("NumberInput","variant",e.variant,NUMBER_INPUT_VARIANTS);const R=useMemo(()=>({...DEFAULT_NUMBER_INPUT_LABELS,...S}),[S]),[C,w]=useControllableState({value:i,defaultValue:s??e.min??0,onChange:l}),L=useTheme(),P=resolveFieldSize(L,f),V=resolveFieldTextStyle(L,{disabled:p}),z=useMemo(()=>buildStyles(L),[L]),A=useRef(null),[k,U]=useState(formatValue(C,o,c)),[B,M]=useState(!1),[D,H]=useState(!1),O=useCallback(()=>{p||A.current?.focus()},[p]),G=useRef(null),W=useRef(null),Y=useCallback(()=>{null!==G.current&&(clearTimeout(G.current),G.current=null),null!==W.current&&(clearInterval(W.current),W.current=null)},[]);useEffect(()=>Y,[Y]),useEffect(()=>{B||U(formatValue(C,o,c))},[C,o,c,B]);const Z=C<=r,$=C>=n,q=!p,J=useCallback(e=>{const t=roundToPrecision(e,o?c:0),i=clamp(t,r,n);i!==C&&w(i)},[o,n,r,w,c,C]),K=useCallback(()=>{if(!q||Z)return;const e=resolveHaptic(y,"selection");e&&triggerHaptic(e),J(C-a)},[Z,q,y,J,a,C]),Q=useCallback(()=>{if(!q||$)return;const e=resolveHaptic(y,"selection");e&&triggerHaptic(e),J(C+a)},[$,q,y,J,a,C]);React.useImperativeHandle(t,()=>({focus:()=>A.current?.focus(),blur:()=>A.current?.blur(),clear:()=>{U(""),Number.isFinite(r)&&r>0?w(r):w(0<r?r:0>n?n:0)}}),[n,r,w]);const X=useCallback(e=>{q&&(Y(),G.current=setTimeout(()=>{W.current=setInterval(()=>{"inc"===e?Q():K()},80)},500))},[Y,K,Q,q]),ee=useCallback(e=>{const t=sanitizeTyped(e,o);U(t);const i=Number(t);""!==t&&"-"!==t&&"."!==t&&Number.isFinite(i)&&i>=r&&i<=n&&i!==C&&w(roundToPrecision(i,o?c:0))},[o,n,r,w,c,C]),te=useCallback(()=>{M(!1),H(!1);const e=Number(k);if(""===k||!Number.isFinite(e))return void U(formatValue(C,o,c));const t=roundToPrecision(e,o?c:0),i=clamp(t,r,n);i!==C&&w(i),U(formatValue(i,o,c))},[o,k,n,r,w,c,C]),ie=useCallback(()=>{M(!0),H(!0)},[]),se=Z||p?L.colors["text-disabled"]:L.colors["text-body"],le=$||p?L.colors["text-disabled"]:L.colors["text-body"],re=P.icon+8,renderStepper=(e,t,i,s,l,r)=>_jsx(Pressable,{onPress:t,onLongPress:()=>X(e),onPressOut:Y,delayLongPress:500,disabled:i,accessibilityRole:"button",accessibilityLabel:s,accessibilityState:{disabled:i},"aria-disabled":i,style:({pressed:e})=>[{width:re,height:re,alignItems:"center",justifyContent:"center",borderRadius:L.radius.pill,...smoothCorners},e&&!i?{backgroundColor:L.colors["surface-pressed"]}:null,_],testID:`${E??"numberinput"}-${"inc"===e?"plus":"minus"}`,children:_jsx(Text,{variant:"body",weight:"semibold",style:{fontSize:P.icon,color:l,fontWeight:L.weight.semibold,lineHeight:P.icon+2},children:r})}),ne=I??fieldTextAsString(u)??R.input,ae=!0===m||hasFieldText(m),oe=_jsx(FieldBase,{size:f,disabled:p,error:ae,filled:!0,focused:D,onPress:O,pressFeedback:!1,leading:renderStepper("dec",K,Z||p,R.decrease,se,"−"),trailing:renderStepper("inc",Q,$||p,R.increase,le,"+"),children:_jsxs(View,{style:z.inputRow,children:[_jsx(TextInput,{ref:A,value:k,onChangeText:ee,onFocus:ie,onBlur:te,editable:!p,keyboardType:o?"decimal-pad":"number-pad",selectTextOnFocus:!0,accessibilityRole:"adjustable",accessibilityLabel:ne,accessibilityValue:{now:Number.isFinite(C)?C:0},accessibilityState:{disabled:p},"aria-disabled":p,accessibilityActions:[{name:"increment",label:R.increase},{name:"decrement",label:R.decrease}],onAccessibilityAction:e=>{"increment"===e.nativeEvent.actionName&&Q(),"decrement"===e.nativeEvent.actionName&&K()},style:[z.input,{fontSize:P.text,color:V.color,...V.weightStyle},g],...v}),h?_jsx(Text,{variant:"bodySmall",style:[z.unit,{fontSize:P.text,color:V.placeholderColor},F],children:h}):null]})}),ce=hasFieldText(u)?_jsx(FieldLabel,{size:f,help:d,style:j,children:u}):null,ue=_jsx(FieldMessage,{size:f,error:ae,text:ae?m:b});return _jsxs(View,"horizontal"===x?{style:[z.horizontalContainer,T,N],testID:E,accessibilityState:{disabled:p},"aria-disabled":p,children:[_jsx(View,{style:z.horizontalLabelWrap,children:ce}),_jsxs(View,{children:[oe,ue]})]}:{style:[T,N],testID:E,accessibilityState:{disabled:p},"aria-disabled":p,children:[ce,oe,ue]})});NumberInput.displayName="NumberInput";const buildStyles=e=>StyleSheet.create({inputRow:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},input:{flex:1,textAlign:"center",padding:e.space.none,margin:e.space.none,includeFontPadding:!1},unit:{marginLeft:e.space.xs},label:{marginBottom:e.space.xs},helper:{marginTop:e.space.xs},horizontalContainer:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},horizontalLabelWrap:{flexShrink:1,paddingRight:e.space.md}});export{NumberInput};export default NumberInput;
1
+ "use strict";import React,{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Pressable,StyleSheet,TextInput,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{resolveFieldSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{FieldBase,FieldLabel,FieldMessage,fieldTextAsString,hasFieldText,resolveFieldTextStyle}from"../FieldBase/FieldBase.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const NUMBER_INPUT_SIZES=["sm","md","lg"],NUMBER_INPUT_VARIANTS=["inline","horizontal"];export const DEFAULT_NUMBER_INPUT_LABELS=Object.freeze({decrease:"Decrease",increase:"Increase",input:"Number input"});const DEFAULT_LONG_PRESS_DELAY=500,DEFAULT_LONG_PRESS_INTERVAL=80,roundToPrecision=(e,t)=>{if(!Number.isFinite(e))return 0;if(t<=0)return Math.round(e);const i=10**t;return Math.round(e*i)/i},clamp=(e,t,i)=>e<t?t:e>i?i:e,formatValue=(e,t,i)=>Number.isFinite(e)?t&&i>0?e.toFixed(i):String(Math.trunc(e)):"",sanitizeTyped=(e,t)=>{if(!e)return"";let i=e.replace(/[^0-9.-]/g,"");if(i=i.replace(/(?!^)-/g,""),t){const e=i.indexOf(".");-1!==e&&(i=i.slice(0,e+1)+i.slice(e+1).replace(/\./g,""))}else i=i.replace(/\./g,"");return i},NumberInput=forwardRef((e,t)=>{const{value:i,defaultValue:l,onChange:s,min:r=Number.NEGATIVE_INFINITY,max:n=Number.POSITIVE_INFINITY,step:a=1,allowDecimal:o=!1,precision:c=0,label:u,help:d,helperText:b,error:m,disabled:p=!1,size:f="md",variant:x="inline",unit:h,haptic:y,labels:S,accessibilityLabel:I,style:T,containerStyle:N,inputStyle:g,buttonStyle:_,unitStyle:F,labelStyle:j,textInputProps:v,testID:E}=e;warnInvalidValue("NumberInput","size",e.size,NUMBER_INPUT_SIZES),warnInvalidValue("NumberInput","variant",e.variant,NUMBER_INPUT_VARIANTS);const R=useMemo(()=>({...DEFAULT_NUMBER_INPUT_LABELS,...S}),[S]),[C,w]=useControllableState({value:i,defaultValue:l??e.min??0,onChange:s}),L=useTheme(),P=resolveFieldSize(L,f),V=resolveFieldTextStyle(L,{disabled:p}),z=useMemo(()=>buildStyles(L),[L]),A=useRef(null),[U,k]=useState(formatValue(C,o,c)),[B,M]=useState(!1),[D,H]=useState(!1),O=useCallback(()=>{p||A.current?.focus()},[p]),G=useRef(null),W=useRef(null),Y=useCallback(()=>{null!==G.current&&(clearTimeout(G.current),G.current=null),null!==W.current&&(clearInterval(W.current),W.current=null)},[]);useEffect(()=>Y,[Y]),useEffect(()=>{B||k(formatValue(C,o,c))},[C,o,c,B]);const Z=C<=r,$=C>=n,q=!p,J=useCallback(e=>{const t=roundToPrecision(e,o?c:0),i=clamp(t,r,n);i!==C&&w(i)},[o,n,r,w,c,C]),K=useCallback(()=>{if(!q||Z)return;const e=resolveHaptic(y,"selection");e&&triggerHaptic(e),J(C-a)},[Z,q,y,J,a,C]),Q=useCallback(()=>{if(!q||$)return;const e=resolveHaptic(y,"selection");e&&triggerHaptic(e),J(C+a)},[$,q,y,J,a,C]);React.useImperativeHandle(t,()=>({focus:()=>A.current?.focus(),blur:()=>A.current?.blur(),clear:()=>{k(""),Number.isFinite(r)&&r>0?w(r):w(0<r?r:0>n?n:0)}}),[n,r,w]);const X=useCallback(e=>{q&&(Y(),G.current=setTimeout(()=>{W.current=setInterval(()=>{"inc"===e?Q():K()},80)},500))},[Y,K,Q,q]),ee=useCallback(e=>{const t=sanitizeTyped(e,o);k(t);const i=Number(t);""!==t&&"-"!==t&&"."!==t&&Number.isFinite(i)&&i>=r&&i<=n&&i!==C&&w(roundToPrecision(i,o?c:0))},[o,n,r,w,c,C]),te=useCallback(()=>{M(!1),H(!1);const e=Number(U);if(""===U||!Number.isFinite(e))return void k(formatValue(C,o,c));const t=roundToPrecision(e,o?c:0),i=clamp(t,r,n);i!==C&&w(i),k(formatValue(i,o,c))},[o,U,n,r,w,c,C]),ie=useCallback(()=>{M(!0),H(!0)},[]),le=Z||p?L.colors["text-disabled"]:L.colors["text-body"],se=$||p?L.colors["text-disabled"]:L.colors["text-body"],re=P.icon+8,renderStepper=(e,t,i,l,s,r)=>_jsx(Pressable,{onPress:t,onLongPress:()=>X(e),onPressOut:Y,delayLongPress:500,disabled:i,accessibilityRole:"button",accessibilityLabel:l,accessibilityState:{disabled:i},"aria-disabled":i,style:({pressed:e})=>[{width:re,height:re,alignItems:"center",justifyContent:"center",borderRadius:L.radius.pill,...smoothCorners},e&&!i?{backgroundColor:L.colors["surface-pressed"]}:null,_],testID:`${E??"numberinput"}-${"inc"===e?"plus":"minus"}`,children:_jsx(Text,{variant:"body",weight:"semibold",style:{fontSize:P.icon,color:s,fontWeight:L.weight.semibold,lineHeight:P.icon+2},children:r})}),ne=I??fieldTextAsString(u)??R.input,ae=!0===m||hasFieldText(m),oe=_jsx(FieldBase,{size:f,disabled:p,error:ae,filled:!0,focused:D,onPress:O,pressFeedback:!1,leading:renderStepper("dec",K,Z||p,R.decrease,le,"−"),trailing:renderStepper("inc",Q,$||p,R.increase,se,"+"),children:_jsxs(View,{style:z.inputRow,children:[_jsx(TextInput,{ref:A,value:U,onChangeText:ee,onFocus:ie,onBlur:te,editable:!p,keyboardType:o?"decimal-pad":"number-pad",selectTextOnFocus:!0,accessibilityRole:"adjustable",accessibilityLabel:ne,accessibilityValue:{now:Number.isFinite(C)?C:0},accessibilityState:{disabled:p},"aria-disabled":p,accessibilityActions:[{name:"increment",label:R.increase},{name:"decrement",label:R.decrease}],onAccessibilityAction:e=>{"increment"===e.nativeEvent.actionName&&Q(),"decrement"===e.nativeEvent.actionName&&K()},style:[z.input,{fontSize:P.text,color:V.color,...V.weightStyle},g],...v}),h?_jsx(Text,{variant:"bodySmall",style:[z.unit,{fontSize:P.text,color:V.placeholderColor},F],children:h}):null]})}),ce=hasFieldText(u)?_jsx(FieldLabel,{size:f,help:d,style:j,children:u}):null,ue=_jsx(FieldMessage,{size:f,error:ae,text:ae?m:b});return _jsxs(View,"horizontal"===x?{style:[z.horizontalContainer,T,N],testID:E,accessibilityState:{disabled:p},"aria-disabled":p,children:[_jsx(View,{style:z.horizontalLabelWrap,children:ce}),_jsxs(View,{children:[oe,ue]})]}:{style:[T,N],testID:E,accessibilityState:{disabled:p},"aria-disabled":p,children:[ce,oe,ue]})});NumberInput.displayName="NumberInput";const buildStyles=e=>StyleSheet.create({inputRow:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},input:{flex:1,textAlign:"center",padding:e.space.none,margin:e.space.none,includeFontPadding:!1},unit:{marginLeft:e.space.xs},label:{marginBottom:e.space.xs},helper:{marginTop:e.space.xs},horizontalContainer:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},horizontalLabelWrap:{flexShrink:1,paddingRight:e.space.md}});export{NumberInput};export default NumberInput;
@@ -1 +1 @@
1
- "use strict";import{cloneElement,createElement,isValidElement,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,BackHandler,FlatList,StyleSheet,View}from"react-native";import{KeyboardStickyView}from"react-native-keyboard-controller";import{useSharedValue}from"react-native-reanimated";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useRefreshControl}from"../../hooks/useRefreshControl.js";import{useTheme}from"../../theme/index.js";import{AppBar}from"../AppBar/index.js";import{AsyncBlock}from"../AsyncBlock/index.js";import{EmptyState}from"../EmptyState/index.js";import{KeyboardAwareScrollView}from"../KeyboardAwareScrollView/index.js";import{KeyboardToolbar}from"../KeyboardToolbar/index.js";import{PagedListFooter}from"../PagedListFooter/index.js";import{ScrollHostContext}from"./ScrollHost.js";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{};function renderFooter(e){return isValidElement(e)?e:e?createElement(e):null}const buildStyles=e=>StyleSheet.create({flex:{flex:1},root:{flex:1,backgroundColor:e.colors.bg},overlay:{position:"absolute",top:0,left:0,right:0},footer:{backgroundColor:e.colors.bg,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:e.colors.border}});export function Screen(e){const{title:t,subtitle:o,largeTitle:r=!0,onBack:n,rightActions:l,leading:s,children:a,onRefresh:i,refreshing:d=!1,footer:c,scroll:u=!0,list:f,edges:m=DEFAULT_EDGES,keyboardToolbar:p=!0,bottomInset:h=0,scrollRef:g,onScroll:y,contentContainerStyle:S,testID:v}=e,x=useTheme(),b=useSafeAreaInsets(),E=useMemo(()=>buildStyles(x),[x]),[j]=useState(()=>new Animated.Value(0)),[C,T]=useState(0),k=void 0!==n,R=useRef(n);R.current=n;const _=Boolean(t||o||n||s||l?.length),L=r&&void 0!==t,V=L&&(void 0!==f||u),A=V?C:0,w=void 0!==c,{refreshControl:B}=useRefreshControl({onRefresh:i??noop,refreshing:d}),F=i?cloneElement(B,{progressViewOffset:A}):void 0,M=useSharedValue(0),K=useSharedValue(0),D=useSharedValue(0),H=useSharedValue(0),I=useRef(null),O=useRef(0),P=useRef(0),N=useMemo(()=>({top:M,bottom:K,offset:D,maxOffset:H,scrollTo:e=>I.current?.scrollTo({y:e,animated:!1})}),[M,K,D,H]),W=useCallback(e=>{I.current=e,"function"==typeof g?g(e):g&&(g.current=e)},[g]),G=useCallback(()=>{H.value=Math.max(0,O.current-P.current)},[H]),U=useRef(y);U.current=y;const z=useMemo(()=>Animated.event([{nativeEvent:{contentOffset:{y:j}}}],{useNativeDriver:!1,listener:e=>{D.value=e.nativeEvent.contentOffset.y,U.current?.(e)}}),[j,D]),Y=useCallback(e=>{const{height:t}=e.nativeEvent.layout;T(e=>Math.max(e,t))},[]);useEffect(()=>{if(!k)return;const e=BackHandler.addEventListener("hardwareBackPress",()=>(R.current?.(),!0));return()=>e.remove()},[k]);const q=m.includes("left")?b.left:0,J=m.includes("right")?b.right:0,Q=m.includes("bottom")?b.bottom:0,X=m.includes("top")&&!_?b.top:0,Z=m.filter(e=>"top"!==e&&!("bottom"===e&&w)),$=_?_jsx(View,{style:V?E.overlay:void 0,onLayout:V?Y:void 0,children:_jsx(AppBar,{title:t,subtitle:o,variant:L?"large":"default",scrollY:V?j:void 0,onBack:n,rightActions:l,leading:s})}):null,ee=V||y?z:void 0,te=useCallback(()=>{I.current?.getNativeScrollRef()?.measureInWindow((e,t,o,r)=>{P.current=r,M.value=t+A,K.value=t+r,G()})},[A,M,K,G]);useEffect(()=>{te()},[te]);const oe=useCallback((e,t)=>{O.current=t,G()},[G]);let re;if(void 0!==f){const{state:e,paging:t,...o}=f,handleEndReached=e=>{t?.hasMore&&!t.loadingMore&&null==t.errorMore&&t.loadMore(),o.onEndReached?.(e)},r=_jsx(FlatList,{keyboardShouldPersistTaps:"handled",onEndReachedThreshold:t?.5:void 0,...o,ref:g,refreshControl:F,onScroll:ee,onEndReached:t?handleEndReached:o.onEndReached,ListEmptyComponent:e?.empty?_jsx(EmptyState,{...e.empty}):void 0,ListFooterComponent:t||o.ListFooterComponent?_jsxs(_Fragment,{children:[renderFooter(o.ListFooterComponent),t?_jsx(PagedListFooter,{paging:t}):null]}):void 0,scrollEventThrottle:16,style:E.flex,contentContainerStyle:[{paddingTop:A,paddingLeft:q,paddingRight:J},{paddingBottom:(w?0:Q)+h},o.contentContainerStyle,S]});re=e?_jsx(AsyncBlock,{loading:e.loading,error:e.error,errorTitle:e.errorTitle,onRetry:e.onRetry,skeleton:e.skeleton,style:[E.flex,{paddingTop:A}],children:r}):r}else re=u?_jsx(ScrollHostContext.Provider,{value:N,children:_jsxs(KeyboardAwareScrollView,{ref:W,refreshControl:F,onScroll:z,scrollEventThrottle:16,onLayout:te,onContentSizeChange:oe,safeAreaEdges:Z,style:E.flex,contentContainerStyle:[{paddingTop:A},S],children:[a,h>0?_jsx(View,{style:{height:h}}):null]})}):_jsx(View,{style:[E.flex,{paddingLeft:q,paddingRight:J,paddingBottom:(w?0:Q)+h},S],children:a});const ne=w?_jsx(KeyboardStickyView,{style:[E.footer,{paddingLeft:q,paddingRight:J,paddingBottom:Q+h}],children:c}):null;return _jsxs(View,{testID:v,style:[E.root,{paddingTop:X}],children:[V?null:$,re,ne,void 0!==f?a:null,V?$:null,p?_jsx(KeyboardToolbar,{}):null]})}
1
+ "use strict";import{cloneElement,createElement,isValidElement,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,BackHandler,FlatList,StyleSheet,View}from"react-native";import{KeyboardStickyView}from"react-native-keyboard-controller";import{useSharedValue}from"react-native-reanimated";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useRefreshControl}from"../../hooks/useRefreshControl.js";import{useTheme}from"../../theme/index.js";import{AppBar}from"../AppBar/index.js";import{AsyncBlock}from"../AsyncBlock/index.js";import{EmptyState}from"../EmptyState/index.js";import{KeyboardAwareScrollView}from"../KeyboardAwareScrollView/index.js";import{KeyboardToolbar}from"../KeyboardToolbar/index.js";import{PagedListFooter}from"../PagedListFooter/index.js";import{ScrollHostContext}from"./ScrollHost.js";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{};function renderFooter(e){return isValidElement(e)?e:e?createElement(e):null}const buildStyles=e=>StyleSheet.create({flex:{flex:1},root:{flex:1,backgroundColor:e.colors.bg},overlay:{position:"absolute",top:0,left:0,right:0},footer:{backgroundColor:e.colors.bg,borderTopWidth:StyleSheet.hairlineWidth,borderTopColor:e.colors.border}});export function Screen(e){const{title:t,subtitle:o,largeTitle:r=!0,onBack:n,rightActions:l,leading:s,children:a,onRefresh:i,refreshing:d=!1,footer:c,scroll:u=!0,list:f,edges:m=DEFAULT_EDGES,keyboardToolbar:h=!0,bottomInset:p=0,scrollRef:g,onScroll:y,contentContainerStyle:S,testID:v}=e,x=useTheme(),b=useSafeAreaInsets(),C=useMemo(()=>buildStyles(x),[x]),[E]=useState(()=>new Animated.Value(0)),[j,T]=useState(0),k=void 0!==n,R=useRef(n);R.current=n;const L=Boolean(t||o||n||s||l?.length),_=r&&void 0!==t,V=_&&(void 0!==f||u),A=V?j:0,w=void 0!==c,{refreshControl:F}=useRefreshControl({onRefresh:i??noop,refreshing:d}),B=i?cloneElement(F,{progressViewOffset:A}):void 0,M=useSharedValue(0),K=useSharedValue(0),D=useSharedValue(0),H=useSharedValue(0),O=useRef(null),P=useRef(0),I=useRef(0),z=useMemo(()=>({top:M,bottom:K,offset:D,maxOffset:H,scrollTo:e=>{const t=O.current;t instanceof FlatList?t.scrollToOffset({offset:e,animated:!1}):t?.scrollTo({y:e,animated:!1})}}),[M,K,D,H]),N=useCallback(e=>{O.current=e,"function"==typeof g?g(e):g&&(g.current=e)},[g]),W=useCallback(()=>{H.value=Math.max(0,P.current-I.current)},[H]),G=useRef(y);G.current=y;const U=useMemo(()=>Animated.event([{nativeEvent:{contentOffset:{y:E}}}],{useNativeDriver:!1,listener:e=>{D.value=e.nativeEvent.contentOffset.y,G.current?.(e)}}),[E,D]),Y=useCallback(e=>{const{height:t}=e.nativeEvent.layout;T(e=>Math.max(e,t))},[]);useEffect(()=>{if(!k)return;const e=BackHandler.addEventListener("hardwareBackPress",()=>(R.current?.(),!0));return()=>e.remove()},[k]);const q=m.includes("left")?b.left:0,J=m.includes("right")?b.right:0,Q=m.includes("bottom")?b.bottom:0,X=m.includes("top")&&!L?b.top:0,Z=m.filter(e=>"top"!==e&&!("bottom"===e&&w)),$=L?_jsx(View,{style:V?C.overlay:void 0,onLayout:V?Y:void 0,children:_jsx(AppBar,{title:t,subtitle:o,variant:_?"large":"default",scrollY:V?E:void 0,onBack:n,rightActions:l,leading:s})}):null,ee=useCallback(()=>{const e=O.current?.getNativeScrollRef();e&&e.measureInWindow((e,t,o,r)=>{I.current=r,M.value=t+A,K.value=t+r,W()})},[A,M,K,W]);useEffect(()=>{ee()},[ee]);const te=useCallback((e,t)=>{P.current=t,W()},[W]);let oe;if(void 0!==f){const{state:e,paging:t,...o}=f,handleEndReached=e=>{t?.hasMore&&!t.loadingMore&&null==t.errorMore&&t.loadMore(),o.onEndReached?.(e)},r=_jsx(FlatList,{keyboardShouldPersistTaps:"handled",onEndReachedThreshold:t?.5:void 0,...o,ref:N,refreshControl:B,onScroll:U,onLayout:e=>{ee(),o.onLayout?.(e)},onContentSizeChange:(e,t)=>{te(e,t),o.onContentSizeChange?.(e,t)},onEndReached:t?handleEndReached:o.onEndReached,ListEmptyComponent:e?.empty?_jsx(EmptyState,{...e.empty}):void 0,ListFooterComponent:t||o.ListFooterComponent?_jsxs(_Fragment,{children:[renderFooter(o.ListFooterComponent),t?_jsx(PagedListFooter,{paging:t}):null]}):void 0,scrollEventThrottle:16,style:C.flex,contentContainerStyle:[{paddingTop:A,paddingLeft:q,paddingRight:J},{paddingBottom:(w?0:Q)+p},o.contentContainerStyle,S]});oe=_jsx(ScrollHostContext.Provider,{value:z,children:e?_jsx(AsyncBlock,{loading:e.loading,error:e.error,errorTitle:e.errorTitle,onRetry:e.onRetry,skeleton:e.skeleton,style:[C.flex,{paddingTop:A}],children:r}):r})}else oe=u?_jsx(ScrollHostContext.Provider,{value:z,children:_jsxs(KeyboardAwareScrollView,{ref:N,refreshControl:B,onScroll:U,scrollEventThrottle:16,onLayout:ee,onContentSizeChange:te,safeAreaEdges:Z,style:C.flex,contentContainerStyle:[{paddingTop:A},S],children:[a,p>0?_jsx(View,{style:{height:p}}):null]})}):_jsx(View,{style:[C.flex,{paddingLeft:q,paddingRight:J,paddingBottom:(w?0:Q)+p},S],children:a});const re=w?_jsx(KeyboardStickyView,{style:[C.footer,{paddingLeft:q,paddingRight:J,paddingBottom:Q+p}],children:c}):null;return _jsxs(View,{testID:v,style:[C.root,{paddingTop:X}],children:[V?null:$,oe,re,void 0!==f?a:null,V?$:null,h?_jsx(KeyboardToolbar,{}):null]})}
@@ -1 +1 @@
1
- "use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,resolveSegmentedControlSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{FieldLabel,FieldMessage,hasFieldText}from"../FieldBase/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const LABEL_LINE_HEIGHT_RATIO=1.25,activeInkFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"neutral":return e.colors["text-body"];case"success":return e.colors["success-text"];case"warning":return e.colors["warning-text"];case"danger":return e.colors["danger-text"];default:return e.colors["info-text"]}},SegmentedControl=forwardRef((e,t)=>{const{segments:r,label:i,helperText:s,error:l,value:n,defaultValue:o,onChange:a,size:d="md",fullWidth:c=!0,disabled:u=!1,tone:m="primary",variant:g="segmented",radius:h,labelLines:p=1,haptic:f,accessibilityLabel:b,style:x,containerStyle:S,segmentStyle:y,selectedIndicatorStyle:v,textStyle:w,labelStyle:C,testID:j}=e;warnInvalidValue("SegmentedControl","size",e.size,["sm","md","lg"]),warnInvalidValue("SegmentedControl","tone",e.tone,["primary","success","warning","danger","info","neutral"]),warnInvalidValue("SegmentedControl","variant",e.variant,["underline","pills","segmented"]);const[I,V]=useControllableState({value:n,defaultValue:o??r[0]?.value,onChange:a}),k=useTheme(),F=k.components["segmented-control"],L=useMemo(()=>buildStyles(k),[k]),_=useMemo(()=>resolveSegmentedControlSize(k,d),[k,d]),z=p>=2?2:1,M=z>1,R="segmented"===g,T="underline"===g,A="pills"===g,E=R?k.space[F["track-padding"]]:0,H=Math.ceil(1.25*_.text)*(z-1),q=F["underline-height"],D=k.space[F["pill-inset"]],W="number"==typeof h?h:h?k.radius[h]:void 0,B=W??k.radius.md,P=void 0===W?k.radius.sm:Math.max(W-E,0),N=W??k.radius.pill,O=W??k.radius.none,[G,X]=useState(0),J=useRef(createAnimatedValue(0)).current,K=Math.max(0,r.findIndex(e=>e.value===I)),Q=G>0?(G-2*E)/Math.max(r.length,1):0,U=useCallback((e,t)=>{if(t<=0)return;const r=t*e,i=k.motion.spring.snappy,s=Animated.spring(J,{toValue:r,damping:i.damping,stiffness:i.stiffness,mass:i.mass,overshootClamping:!0,useNativeDriver:!0});return s.start(),s},[k.motion.spring.snappy,J]),Y=useRef(null);useEffect(()=>{if(Q<=0)return;const e=null!==Y.current&&Y.current!==K;if(Y.current=K,!e)return void J.setValue(Q*K);const t=U(K,Q);return()=>t?.stop()},[K,Q,U,J]);const Z=useCallback(e=>{const t=e.nativeEvent.layout.width;t!==G&&X(t)},[G]),$=useCallback(e=>{if(u)return;if(e.value===I)return;const t=resolveHaptic(f,"selection");t&&triggerHaptic(t),V(e.value)},[u,V,I,f]),ee=R?k.colors.surface:A?k.colors["primary-soft"]:k.colors.primary,te=R?P:A?N:O,re=activeInkFor(k,m),ie=k.colors["bg-muted"],se=useSquircle(R,B,Z),le=!0===l||hasFieldText(l),ne=le&&!u,oe=k.colors["field-border-error"],ae=k.size.border,de=hasFieldText(i),ce=le?l:s,ue=hasFieldText(ce),me=_jsxs(View,{ref:t,accessibilityRole:"radiogroup",accessibilityLabel:b??("string"==typeof i?i:void 0),testID:j,style:[L.track,{...M?{minHeight:_.height+H}:{height:_.height},opacity:u?.55:1,alignSelf:c?"stretch":"flex-start"},R?{borderRadius:B,...smoothCorners,backgroundColor:se.active?"transparent":ie,padding:E}:T?{borderBottomColor:ne?oe:k.colors["border-subtle"],borderBottomWidth:StyleSheet.hairlineWidth}:null,S,x],onLayout:se.onLayout,children:[se.active&&se.size?_jsx(SquircleFill,{width:se.size.width,height:se.size.height,radius:B,fill:ie,stroke:ne?oe:void 0,strokeWidth:ae}):null,_jsxs(View,{style:L.row,children:[Q>0?_jsx(Animated.View,{pointerEvents:"none",style:[L.thumb,R?M?{top:0,bottom:0}:{top:0,height:_.height-2*E}:A?{top:D,bottom:D}:{bottom:0,height:q},{width:Q,borderRadius:te,...smoothCorners,backgroundColor:ee,transform:[{translateX:J}]},v]}):null,r.map(e=>{const t=e.value===I,r=t?re:k.colors["text-subtle"],i=renderSlotIcon(e.icon,{color:r,size:_.icon,selected:t,disabled:u});return _jsxs(Pressable,{onPress:()=>$(e),disabled:u,accessibilityRole:"radio",accessibilityLabel:e.label,accessibilityState:{checked:t,selected:t,disabled:u},"aria-checked":t,"aria-disabled":u,style:({pressed:e})=>[L.segment,M?L.segmentMultiline:null,{paddingHorizontal:_["padding-x"],opacity:e&&!t?.7:1},y],children:[i?_jsx(View,{style:L.segmentIcon,children:i}):null,_jsx(Text,{variant:"label",weight:t?"semibold":"medium",style:[L.segmentLabel,M?L.segmentLabelMultiline:null,{color:r,fontSize:_.text},w,C],numberOfLines:z,children:e.label})]},String(e.value))})]}),!ne||T||se.active?null:_jsx(View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{borderWidth:ae,borderColor:oe,borderRadius:R?B:N,...smoothCorners}]})]});return de||ue?_jsxs(View,{style:{alignSelf:c?"stretch":"flex-start"},children:[de?_jsx(FieldLabel,{size:d,children:i}):null,me,ue?_jsx(FieldMessage,{size:d,text:ce,error:le}):null]}):me});SegmentedControl.displayName="SegmentedControl";const buildStyles=e=>StyleSheet.create({track:{flexDirection:"row",alignItems:"stretch",position:"relative"},row:{flex:1,flexDirection:"row",alignItems:"stretch",position:"relative",overflow:"hidden"},thumb:{position:"absolute",left:0},segment:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},segmentIcon:{marginRight:e.space.xs},segmentMultiline:{paddingVertical:e.space.xs},segmentLabel:{includeFontPadding:!1},segmentLabelMultiline:{flexShrink:1,textAlign:"center"}});export{SegmentedControl};export default SegmentedControl;
1
+ "use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,resolveSegmentedControlSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{FieldLabel,FieldMessage,hasFieldText}from"../FieldBase/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const LABEL_LINE_HEIGHT_RATIO=1.25,activeInkFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"neutral":return e.colors["text-body"];case"success":return e.colors["success-text"];case"warning":return e.colors["warning-text"];case"danger":return e.colors["danger-text"];default:return e.colors["info-text"]}},SegmentedControl=forwardRef((e,t)=>{const{segments:r,label:i,helperText:s,error:l,value:n,defaultValue:o,onChange:a,size:d="md",fullWidth:c=!0,disabled:u=!1,tone:m="primary",variant:g="segmented",radius:h,labelLines:p=1,haptic:f,accessibilityLabel:b,style:x,containerStyle:S,segmentStyle:y,selectedIndicatorStyle:v,textStyle:w,labelStyle:C,testID:j}=e;warnInvalidValue("SegmentedControl","size",e.size,["sm","md","lg"]),warnInvalidValue("SegmentedControl","tone",e.tone,["primary","success","warning","danger","info","neutral"]),warnInvalidValue("SegmentedControl","variant",e.variant,["underline","pills","segmented"]);const[I,V]=useControllableState({value:n,defaultValue:o??r[0]?.value,onChange:a}),k=useTheme(),F=k.components["segmented-control"],L=useMemo(()=>buildStyles(k),[k]),_=useMemo(()=>resolveSegmentedControlSize(k,d),[k,d]),z=p>=2?2:1,M=z>1,R="segmented"===g,T="underline"===g,A="pills"===g,E=R?k.space[F["track-padding"]]:0,H=Math.ceil(1.25*_.text)*(z-1),q=F["underline-height"],D=k.space[F["pill-inset"]],W="number"==typeof h?h:h?k.radius[h]:void 0,B=W??k.radius.md,P=void 0===W?k.radius.sm:Math.max(W-E,0),N=W??k.radius.pill,O=W??k.radius.none,[G,X]=useState(0),J=useRef(createAnimatedValue(0)).current,K=Math.max(0,r.findIndex(e=>e.value===I)),Q=G>0?(G-2*E)/Math.max(r.length,1):0,U=useCallback((e,t)=>{if(t<=0)return;const r=t*e,i=k.motion.spring.snappy,s=Animated.spring(J,{toValue:r,damping:i.damping,stiffness:i.stiffness,mass:i.mass,overshootClamping:!0,useNativeDriver:!0});return s.start(),s},[k.motion.spring.snappy,J]),Y=useRef(null);useEffect(()=>{if(Q<=0)return;const e=null!==Y.current&&Y.current!==K;if(Y.current=K,!e)return void J.setValue(Q*K);const t=U(K,Q);return()=>t?.stop()},[K,Q,U,J]);const Z=useCallback(e=>{const t=e.nativeEvent.layout.width;t!==G&&X(t)},[G]),$=useCallback(e=>{if(u)return;if(e.value===I)return;const t=resolveHaptic(f,"selection");t&&triggerHaptic(t),V(e.value)},[u,V,I,f]),ee=R?k.colors.surface:A?k.colors["primary-soft"]:k.colors.primary,te=R?P:A?N:O,re=activeInkFor(k,m),ie=k.colors["bg-muted"],se=useSquircle(R,B,Z),le=!0===l||hasFieldText(l),ne=le&&!u,oe=k.colors["field-border-error"],ae=k.size.border,de=hasFieldText(i),ce=le?l:s,ue=hasFieldText(ce),me=_jsxs(View,{ref:t,accessibilityRole:"radiogroup",accessibilityLabel:b??("string"==typeof i?i:void 0),testID:j,style:[L.track,{...M?{minHeight:_.height+H}:{height:_.height},opacity:u?.55:1,alignSelf:c?"stretch":"flex-start"},R?{borderRadius:B,...smoothCorners,backgroundColor:se.active?"transparent":ie,padding:E}:T?{borderBottomColor:ne?oe:k.colors["border-subtle"],borderBottomWidth:StyleSheet.hairlineWidth}:null,S,x],onLayout:se.onLayout,children:[se.active&&se.size?_jsx(SquircleFill,{width:se.size.width,height:se.size.height,radius:B,fill:ie,stroke:ne?oe:void 0,strokeWidth:ae}):null,_jsxs(View,{style:L.row,children:[Q>0?_jsx(Animated.View,{pointerEvents:"none",style:[L.thumb,R?M?{top:0,bottom:0}:{top:0,height:_.height-2*E}:A?{top:D,bottom:D,left:D}:{bottom:0,height:q},{width:A?Math.max(Q-2*D,0):Q,borderRadius:te,...smoothCorners,backgroundColor:ee,transform:[{translateX:J}]},v]}):null,r.map(e=>{const t=e.value===I,r=t?re:k.colors["text-subtle"],i=renderSlotIcon(e.icon,{color:r,size:_.icon,selected:t,disabled:u});return _jsxs(Pressable,{onPress:()=>$(e),disabled:u,accessibilityRole:"radio",accessibilityLabel:e.label,accessibilityState:{checked:t,selected:t,disabled:u},"aria-checked":t,"aria-disabled":u,style:({pressed:e})=>[L.segment,M?L.segmentMultiline:null,{paddingHorizontal:_["padding-x"],opacity:e&&!t?.7:1},y],children:[i?_jsx(View,{style:L.segmentIcon,children:i}):null,_jsx(Text,{variant:"label",weight:t?"semibold":"medium",style:[L.segmentLabel,M?L.segmentLabelMultiline:null,{color:r,fontSize:_.text},w,C],numberOfLines:z,children:e.label})]},String(e.value))})]}),!ne||T||se.active?null:_jsx(View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{borderWidth:ae,borderColor:oe,borderRadius:R?B:N,...smoothCorners}]})]});return de||ue?_jsxs(View,{style:{alignSelf:c?"stretch":"flex-start"},children:[de?_jsx(FieldLabel,{size:d,children:i}):null,me,ue?_jsx(FieldMessage,{size:d,text:ce,error:le}):null]}):me});SegmentedControl.displayName="SegmentedControl";const buildStyles=e=>StyleSheet.create({track:{flexDirection:"row",alignItems:"stretch",position:"relative"},row:{flex:1,flexDirection:"row",alignItems:"stretch",position:"relative",overflow:"hidden"},thumb:{position:"absolute",left:0},segment:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},segmentIcon:{marginRight:e.space.xs},segmentMultiline:{paddingVertical:e.space.xs},segmentLabel:{includeFontPadding:!1},segmentLabelMultiline:{flexShrink:1,textAlign:"center"}});export{SegmentedControl};export default SegmentedControl;
@@ -1 +1 @@
1
- "use strict";import{useMemo,useState}from"react";import{Animated,StyleSheet,View}from"react-native";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{useTheme}from"../../theme/index.js";import{toBackgroundImage}from"../../theme/Gradient.js";import{useScreenDimensions}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{useSkeletonClock}from"./SkeletonClock.js";import{useSkeletonDefaults}from"./SkeletonProvider.js";import{jsx as _jsx}from"react/jsx-runtime";export const DEFAULT_SKELETON_LABELS=Object.freeze({loading:"Loading"});const resolveRadius=(e,t)=>"number"==typeof t?t:e.radius[t],resolveWidth=e=>void 0===e?"100%":e,radiusForShape=(e,t,s,o,i)=>{if(void 0!==i)return resolveRadius(e,i);switch(t){case"circle":return"number"==typeof s?Math.min(s,o)/2:o/2;case"rounded":return e.radius.md;default:return e.radius.sm}},Skeleton=e=>{const{shape:t="rect",width:s="100%",height:o=16,radius:i,variant:n,speed:r,colors:a,labels:l,style:u,testID:m}=e;warnInvalidValue("Skeleton","shape",e.shape,["rect","rounded","circle","text"]),warnInvalidValue("Skeleton","variant",e.variant,["shimmer","pulse","none"]),warnInvalidValue("Skeleton","speed",e.speed,["slow","normal","fast"]);const d=useTheme(),c=useSkeletonDefaults(),h=useSkeletonClock(),p=useReducedMotion(),S=n??c.variant??"shimmer",k=p&&"auto"===(c.animation??"auto");let g=S;h.enabled?k&&"shimmer"===S&&(g="pulse"):g="none";const y=a?.background??c.colors?.background??d.colors.skeleton,b=a?.highlight??c.colors?.highlight??d.colors["skeleton-highlight"],{responsive:v}=useScreenDimensions(),x=useMemo(()=>buildStyles(),[]),f=useMemo(()=>({...DEFAULT_SKELETON_LABELS,...l}),[l]),w=resolveWidth(s),j=v.size(o),L=radiusForShape(d,t,w,j,i),[I,M]=useState(0),R=useMemo(()=>I<=0?0:Math.max(48,.7*I),[I]),_=useMemo(()=>I<=0?0:h.shimmer.interpolate({inputRange:[0,1],outputRange:[-R,I]}),[h.shimmer,R,I]),C=useMemo(()=>"none"===g?null:"pulse"===g?_jsx(Animated.View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{backgroundColor:b,opacity:h.pulse.interpolate({inputRange:[0,1],outputRange:[0,.55]})}]}):I<=0?null:_jsx(Animated.View,{pointerEvents:"none",style:[x.shimmerBand,{width:R,transform:[{translateX:_}],experimental_backgroundImage:[toBackgroundImage({colors:["transparent",b,"transparent"],locations:[0,.5,1],start:{x:0,y:.5},end:{x:1,y:.5}})]}]}),[g,b,h.pulse,I,x.shimmerBand,R,_]);return _jsx(View,{onLayout:e=>{const t=e.nativeEvent.layout.width;t!==I&&M(t)},accessible:!0,accessibilityLabel:f.loading,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,accessibilityLiveRegion:"polite",testID:m,style:[x.base,{width:w,height:j,borderRadius:L,...smoothCorners,backgroundColor:y},u],children:C})};Skeleton.displayName="Skeleton";const SkeletonCircle=({size:e,style:t,...s})=>{const{responsive:o}=useScreenDimensions(),i=o.size(e);return _jsx(Skeleton,{...s,shape:"circle",width:i,height:e,style:t})};SkeletonCircle.displayName="SkeletonCircle";const SkeletonText=({lines:e=3,lastLineWidth:t="60%",spacing:s,fontSize:o,variant:i,speed:n,radius:r="sm",width:a="100%",labels:l,style:u,testID:m})=>{const d=useTheme(),c=s??d.space.xs,h=Math.max(1,e);return _jsx(View,{style:u,testID:m,children:Array.from({length:h}).map((e,s)=>_jsx(Skeleton,{shape:"text",width:s===h-1&&h>1?t:a,height:o??d.text.base.size,radius:r,variant:i,speed:n,labels:l,style:s<h-1?{marginBottom:c}:void 0},s))})};SkeletonText.displayName="SkeletonText";const buildStyles=()=>StyleSheet.create({base:{overflow:"hidden"},shimmerBand:{position:"absolute",top:0,bottom:0,left:0}});export{Skeleton,SkeletonCircle,SkeletonText};export default Skeleton;
1
+ "use strict";import{useMemo,useState}from"react";import{Animated,StyleSheet,View}from"react-native";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{useTheme}from"../../theme/index.js";import{toBackgroundImage}from"../../theme/Gradient.js";import{useScreenDimensions}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{useSkeletonClock}from"./SkeletonClock.js";import{useSkeletonDefaults}from"./SkeletonProvider.js";import{jsx as _jsx}from"react/jsx-runtime";export const DEFAULT_SKELETON_LABELS=Object.freeze({loading:"Loading"});const resolveRadius=(e,t)=>"number"==typeof t?t:e.radius[t],resolveWidth=e=>void 0===e?"100%":e,radiusForShape=(e,t,s,o,i)=>{if(void 0!==i)return resolveRadius(e,i);switch(t){case"circle":return"number"==typeof s?Math.min(s,o)/2:o/2;case"rounded":return e.radius.md;default:return e.radius.sm}},Skeleton=e=>{const{shape:t="rect",width:s="100%",height:o=16,radius:i,variant:n,colors:r,labels:a,style:l,testID:u}=e;warnInvalidValue("Skeleton","shape",e.shape,["rect","rounded","circle","text"]),warnInvalidValue("Skeleton","variant",e.variant,["shimmer","pulse","none"]);const m=useTheme(),d=useSkeletonDefaults(),c=useSkeletonClock(),h=useReducedMotion(),p=n??d.variant??"shimmer",S=h&&"auto"===(d.animation??"auto");let k=p;c.enabled?S&&"shimmer"===p&&(k="pulse"):k="none";const g=r?.background??d.colors?.background??m.colors.skeleton,y=r?.highlight??d.colors?.highlight??m.colors["skeleton-highlight"],{responsive:b}=useScreenDimensions(),v=useMemo(()=>buildStyles(),[]),x=useMemo(()=>({...DEFAULT_SKELETON_LABELS,...a}),[a]),f=resolveWidth(s),j=b.size(o),w=radiusForShape(m,t,f,j,i),[L,M]=useState(0),R=useMemo(()=>L<=0?0:Math.max(48,.7*L),[L]),_=useMemo(()=>L<=0?0:c.shimmer.interpolate({inputRange:[0,1],outputRange:[-R,L]}),[c.shimmer,R,L]),C=useMemo(()=>"none"===k?null:"pulse"===k?_jsx(Animated.View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{backgroundColor:y,opacity:c.pulse.interpolate({inputRange:[0,1],outputRange:[0,.55]})}]}):L<=0?null:_jsx(Animated.View,{pointerEvents:"none",style:[v.shimmerBand,{width:R,transform:[{translateX:_}],experimental_backgroundImage:[toBackgroundImage({colors:["transparent",y,"transparent"],locations:[0,.5,1],start:{x:0,y:.5},end:{x:1,y:.5}})]}]}),[k,y,c.pulse,L,v.shimmerBand,R,_]);return _jsx(View,{onLayout:e=>{const t=e.nativeEvent.layout.width;t!==L&&M(t)},accessible:!0,accessibilityLabel:x.loading,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,accessibilityLiveRegion:"polite",testID:u,style:[v.base,{width:f,height:j,borderRadius:w,...smoothCorners,backgroundColor:g},l],children:C})};Skeleton.displayName="Skeleton";const SkeletonCircle=({size:e,style:t,...s})=>{const{responsive:o}=useScreenDimensions(),i=o.size(e);return _jsx(Skeleton,{...s,shape:"circle",width:i,height:e,style:t})};SkeletonCircle.displayName="SkeletonCircle";const SkeletonText=({lines:e=3,lastLineWidth:t="60%",spacing:s,fontSize:o,variant:i,radius:n="sm",width:r="100%",labels:a,style:l,testID:u})=>{const m=useTheme(),d=s??m.space.xs,c=Math.max(1,e);return _jsx(View,{style:l,testID:u,children:Array.from({length:c}).map((e,s)=>_jsx(Skeleton,{shape:"text",width:s===c-1&&c>1?t:r,height:o??m.text.base.size,radius:n,variant:i,labels:a,style:s<c-1?{marginBottom:d}:void 0},s))})};SkeletonText.displayName="SkeletonText";const buildStyles=()=>StyleSheet.create({base:{overflow:"hidden"},shimmerBand:{position:"absolute",top:0,bottom:0,left:0}});export{Skeleton,SkeletonCircle,SkeletonText};export default Skeleton;
@@ -1 +1 @@
1
- "use strict";import React,{Children,cloneElement,isValidElement,useEffect,useMemo,useRef}from"react";import{Animated,Image,StyleSheet,Text,View}from"react-native";import{usePresenceMotion}from"../../hooks/usePresenceMotion.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{Text as LibraryText}from"../Text/index.js";import{DEFAULT_SKELETON_LABELS,Skeleton}from"./Skeleton.js";import{useSkeletonDefaults}from"./SkeletonProvider.js";import{SkeletonSkip}from"./SkeletonSkip.js";import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";const DEFAULT_REVEAL_FADE_MS=300,flattenStyle=e=>{if(!e)return{};return StyleSheet.flatten(e)??{}},resolveWidth=(e,t)=>"number"==typeof e?e:"string"!=typeof e||"auto"!==e&&"100%"!==e&&!/^\d+(\.\d+)?%$/.test(e)?t:e,resolveRadius=(e,t)=>"number"==typeof e?e:t,skeletonizeNode=(e,t,i,n,r,s="r")=>{if(null==t||"boolean"==typeof t)return null;if("string"==typeof t||"number"==typeof t)return _jsx(Skeleton,{shape:"text",width:"60%",height:14,variant:i,speed:n,colors:r},`${s}-text`);if(Array.isArray(t))return Children.map(t,(t,o)=>skeletonizeNode(e,t,i,n,r,`${s}-${o}`));if(!isValidElement(t))return null;const o=t,l=o.props??{},a=o.type;if(a===SkeletonSkip)return cloneElement(o,{key:`${s}-skip`});if("function"==typeof a||"object"==typeof a){const e=a.Skeleton;if(e){return _jsx(e,{...l},`${s}-self`)}}if(a===Image){const e=flattenStyle(l.style),t=resolveWidth(e.width,"100%"),o="number"==typeof e.height?e.height:120,a=resolveRadius(e.borderRadius,"sm");return _jsx(Skeleton,{width:t,height:o,radius:a,variant:i,speed:n,colors:r,style:{margin:"number"==typeof e.margin?e.margin:void 0}},`${s}-img`)}if(a===Text||a===LibraryText){const t=flattenStyle(l.style),o="number"==typeof t.fontSize?t.fontSize:e.text.base.size,a=resolveWidth(t.width,"85%");return _jsx(Skeleton,{shape:"text",width:a,height:Math.round(1.15*o),variant:i,speed:n,colors:r,style:{marginVertical:e.space.xxs}},`${s}-txt`)}if(null!=l.children)return cloneElement(o,{key:`${s}-w`},skeletonizeNode(e,l.children,i,n,r,`${s}-c`));if(a===View){const e=flattenStyle(l.style);if(null!=e.width||null!=e.height){const t=resolveWidth(e.width,"100%"),o="number"==typeof e.height?e.height:20,l=resolveRadius(e.borderRadius,"sm");return _jsx(Skeleton,{width:t,height:o,radius:l,variant:i,speed:n,colors:r},`${s}-vw`)}}return cloneElement(o,{key:`${s}-leaf`})},SkeletonContent=e=>{const{loading:t,children:i,placeholder:n,variant:r,speed:s,count:o=1,colors:l,labels:a,fadeDuration:u,style:c,testID:d}=e;warnInvalidValue("SkeletonContent","variant",e.variant,["shimmer","pulse","none"]),warnInvalidValue("SkeletonContent","speed",e.speed,["slow","normal","fast"]);const m=useTheme(),f=useMemo(()=>({...DEFAULT_SKELETON_LABELS,...a}),[a]),h=useSkeletonDefaults(),p=usePresenceMotion(),y=u??h.fadeDuration??(p.reduced?p.duration("default"):300),S=useRef(t),k=useRef(createAnimatedValue(t?0:1)).current;if(useEffect(()=>{let e;return S.current&&!t?(k.setValue(0),e=Animated.timing(k,{toValue:1,duration:y,useNativeDriver:!0}),e.start()):!S.current&&t&&k.setValue(1),S.current=t,()=>e?.stop()},[t,k,y]),!t)return y<=0?_jsx(_Fragment,{children:i}):_jsx(Animated.View,{style:[c,{opacity:k}],testID:d,children:i});if(void 0!==n){const e=o>1?Array.from({length:o},(e,t)=>_jsx(React.Fragment,{children:n},`sk-ph-${t}`)):n;return _jsx(View,{style:c,testID:d,accessible:!0,accessibilityLabel:f.loading,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,accessibilityLiveRegion:"polite",children:e})}const b=o>1?Array.from({length:o},(e,t)=>_jsx(React.Fragment,{children:i},`sk-rep-${t}`)):i;return _jsx(View,{style:c,testID:d,accessible:!0,accessibilityLabel:f.loading,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,accessibilityLiveRegion:"polite",children:skeletonizeNode(m,b,r,s,l)})};SkeletonContent.displayName="SkeletonContent";export{SkeletonContent};export default SkeletonContent;
1
+ "use strict";import React,{Children,cloneElement,isValidElement,useEffect,useMemo,useRef}from"react";import{Animated,Image,StyleSheet,Text,View}from"react-native";import{usePresenceMotion}from"../../hooks/usePresenceMotion.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{Text as LibraryText}from"../Text/index.js";import{DEFAULT_SKELETON_LABELS,Skeleton}from"./Skeleton.js";import{useSkeletonDefaults}from"./SkeletonProvider.js";import{SkeletonSkip}from"./SkeletonSkip.js";import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";const DEFAULT_REVEAL_FADE_MS=300,flattenStyle=e=>{if(!e)return{};return StyleSheet.flatten(e)??{}},resolveWidth=(e,t)=>"number"==typeof e?e:"string"!=typeof e||"auto"!==e&&"100%"!==e&&!/^\d+(\.\d+)?%$/.test(e)?t:e,resolveRadius=(e,t)=>"number"==typeof e?e:t,skeletonizeNode=(e,t,i,r,n="r")=>{if(null==t||"boolean"==typeof t)return null;if("string"==typeof t||"number"==typeof t)return _jsx(Skeleton,{shape:"text",width:"60%",height:14,variant:i,colors:r},`${n}-text`);if(Array.isArray(t))return Children.map(t,(t,s)=>skeletonizeNode(e,t,i,r,`${n}-${s}`));if(!isValidElement(t))return null;const s=t,o=s.props??{},l=s.type;if(l===SkeletonSkip)return cloneElement(s,{key:`${n}-skip`});if("function"==typeof l||"object"==typeof l){const e=l.Skeleton;if(e){return _jsx(e,{...o},`${n}-self`)}}if(l===Image){const e=flattenStyle(o.style),t=resolveWidth(e.width,"100%"),s="number"==typeof e.height?e.height:120,l=resolveRadius(e.borderRadius,"sm");return _jsx(Skeleton,{width:t,height:s,radius:l,variant:i,colors:r,style:{margin:"number"==typeof e.margin?e.margin:void 0}},`${n}-img`)}if(l===Text||l===LibraryText){const t=flattenStyle(o.style),s="number"==typeof t.fontSize?t.fontSize:e.text.base.size,l=resolveWidth(t.width,"85%");return _jsx(Skeleton,{shape:"text",width:l,height:Math.round(1.15*s),variant:i,colors:r,style:{marginVertical:e.space.xxs}},`${n}-txt`)}if(null!=o.children)return cloneElement(s,{key:`${n}-w`},skeletonizeNode(e,o.children,i,r,`${n}-c`));if(l===View){const e=flattenStyle(o.style);if(null!=e.width||null!=e.height){const t=resolveWidth(e.width,"100%"),s="number"==typeof e.height?e.height:20,o=resolveRadius(e.borderRadius,"sm");return _jsx(Skeleton,{width:t,height:s,radius:o,variant:i,colors:r},`${n}-vw`)}}return cloneElement(s,{key:`${n}-leaf`})},SkeletonContent=e=>{const{loading:t,children:i,placeholder:r,variant:n,count:s=1,colors:o,labels:l,fadeDuration:a,style:u,testID:c}=e;warnInvalidValue("SkeletonContent","variant",e.variant,["shimmer","pulse","none"]);const d=useTheme(),m=useMemo(()=>({...DEFAULT_SKELETON_LABELS,...l}),[l]),f=useSkeletonDefaults(),h=usePresenceMotion(),y=a??f.fadeDuration??(h.reduced?h.duration("default"):300),p=useRef(t),S=useRef(createAnimatedValue(t?0:1)).current;if(useEffect(()=>{let e;return p.current&&!t?(S.setValue(0),e=Animated.timing(S,{toValue:1,duration:y,useNativeDriver:!0}),e.start()):!p.current&&t&&S.setValue(1),p.current=t,()=>e?.stop()},[t,S,y]),!t)return y<=0?_jsx(_Fragment,{children:i}):_jsx(Animated.View,{style:[u,{opacity:S}],testID:c,children:i});if(void 0!==r){const e=s>1?Array.from({length:s},(e,t)=>_jsx(React.Fragment,{children:r},`sk-ph-${t}`)):r;return _jsx(View,{style:u,testID:c,accessible:!0,accessibilityLabel:m.loading,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,accessibilityLiveRegion:"polite",children:e})}const b=s>1?Array.from({length:s},(e,t)=>_jsx(React.Fragment,{children:i},`sk-rep-${t}`)):i;return _jsx(View,{style:u,testID:c,accessible:!0,accessibilityLabel:m.loading,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,accessibilityLiveRegion:"polite",children:skeletonizeNode(d,b,n,o)})};SkeletonContent.displayName="SkeletonContent";export{SkeletonContent};export default SkeletonContent;
@@ -1 +1 @@
1
- "use strict";import React from"react";import{FlatList,View}from"react-native";import{SkeletonContent}from"./SkeletonContent.js";import{useSkeletonDefaults}from"./SkeletonProvider.js";import{jsx as _jsx}from"react/jsx-runtime";function SkeletonListInner(e){const{loading:t,data:n,renderItem:o,renderPlaceholder:r,placeholderCount:l,variant:s,speed:a,colors:i,labels:c,placeholderContainerStyle:m,horizontal:d,contentContainerStyle:u,style:f,testID:S,...h}=e,p=useSkeletonDefaults(),x=l??p.placeholderCount??3;if(t){const e=Array.from({length:Math.max(0,x)},(e,t)=>_jsx(React.Fragment,{children:r?r(t):null},`sk-list-${t}`));return _jsx(SkeletonContent,{loading:!0,variant:s,speed:a,colors:i,labels:c,style:f,testID:S,children:_jsx(View,{style:[d?styles.row:styles.column,m],children:e})})}return _jsx(FlatList,{data:n??[],renderItem:o,horizontal:d,contentContainerStyle:u,style:f,testID:S,...h})}const styles={row:{flexDirection:"row"},column:{flexDirection:"column"}};export const SkeletonList=SkeletonListInner;
1
+ "use strict";import React from"react";import{FlatList,View}from"react-native";import{SkeletonContent}from"./SkeletonContent.js";import{useSkeletonDefaults}from"./SkeletonProvider.js";import{jsx as _jsx}from"react/jsx-runtime";function SkeletonListInner(e){const{loading:t,data:n,renderItem:o,renderPlaceholder:r,placeholderCount:l,variant:s,colors:a,labels:i,placeholderContainerStyle:c,horizontal:m,contentContainerStyle:d,style:u,testID:f,...S}=e,h=useSkeletonDefaults(),x=l??h.placeholderCount??3;if(t){const e=Array.from({length:Math.max(0,x)},(e,t)=>_jsx(React.Fragment,{children:r?r(t):null},`sk-list-${t}`));return _jsx(SkeletonContent,{loading:!0,variant:s,colors:a,labels:i,style:u,testID:f,children:_jsx(View,{style:[m?styles.row:styles.column,c],children:e})})}return _jsx(FlatList,{data:n??[],renderItem:o,horizontal:m,contentContainerStyle:d,style:u,testID:f,...S})}const styles={row:{flexDirection:"row"},column:{flexDirection:"column"}};export const SkeletonList=SkeletonListInner;
@@ -1 +1 @@
1
- "use strict";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{StyleSheet,View}from"react-native";import{Gesture,GestureDetector}from"react-native-gesture-handler";import Animated,{cancelAnimation,measure,runOnJS,scrollTo,useAnimatedRef,useAnimatedScrollHandler,useAnimatedStyle,useFrameCallback,useSharedValue,withSpring}from"react-native-reanimated";import{useTheme}from"../../theme/index.js";import{triggerHaptic}from"../../utils/index.js";import{useScrollHost}from"../Screen/ScrollHost.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_SORTABLE_LIST_LABELS=Object.freeze({moveUp:"Move up",moveDown:"Move down"});const LONG_PRESS_MS=350,EDGE_PX=48,SCROLL_STEP_PX=12,SCROLL_SLACK_PX=1,SPRING_CONFIG={damping:22,stiffness:260,mass:1},ACTION_STEP={moveUp:-1,moveDown:1},noop=e=>{};export function moveItem(e,t,a){const l=e.slice();if(t<0||t>=l.length)return l;const[o]=l.splice(t,1);return l.splice(a,0,o),l}export function topOf(e,t){"worklet";let a=0;for(let l=0;l<t;l++)a+=e[l]??0;return a}export function slotTop(e,t,a){"worklet";let l=0,o=0;for(let r=0;r<e.length&&o<a;r++)r!==t&&(l+=e[r]??0,o++);return l}export function dropIndex(e,t,a){"worklet";const l=topOf(e,t)+(e[t]??0)/2+a;let o=0,r=0;for(let a=0;a<e.length;a++){const s=e[a]??0;a!==t&&r+s/2<l&&o++,r+=s}return o}export function rowShifts(e,t,a){const l=[];let o=0;for(const t of e)l.push(o),o+=t;const r=e.map(()=>0),s=moveItem(e.map((e,t)=>t),t,a);let n=0;for(const t of s)r[t]=n-(l[t]??0),n+=e[t]??0;return r}const buildStyles=e=>StyleSheet.create({handleRow:{flexDirection:"row",alignItems:"center"},handle:{paddingHorizontal:e.space.sm,paddingVertical:e.space.md,gap:e.space.xxs},bar:{width:e.space.md,height:e.space.xxs,backgroundColor:e.colors["text-muted"]},body:{flex:1}});function SortableRow({rowKey:e,index:t,count:a,shift:l,isActive:o,dragging:r,handle:s,disabled:n,shared:u,callbacks:i,labels:c,children:d}){const m=useTheme(),v=useMemo(()=>buildStyles(m),[m]),h=useSharedValue(0);useEffect(()=>{h.value=r&&!o?withSpring(l,SPRING_CONFIG):l},[r,o,l,h]),useEffect(()=>()=>{cancelAnimation(h)},[h]);const S=useAnimatedStyle(()=>({transform:[{translateY:o?u.dragY.value:h.value}],zIndex:o?1:0})),f=useMemo(()=>{const{dragIndex:e,dropTo:a,dragY:l,translation:o,absoluteY:r,scrollY:c,scrollStart:d,hostOffset:m,hostStart:v,hostTarget:h,heights:S}=u,{onLift:f,onDrop:g,onSettled:p}=i,b=Gesture.Pan().enabled(!n).onStart(()=>{"worklet";e.value=t,a.value=t,d.value=c.value,v.value=m.value,h.value=m.value,o.value=0,l.value=0,runOnJS(f)(t)}).onUpdate(a=>{"worklet";e.value===t&&(o.value=a.translationY,r.value=a.absoluteY)}).onFinalize(()=>{"worklet";if(e.value!==t)return;const o=a.value,r=S.value;e.value=-1,l.value=topOf(r,t)+l.value-slotTop(r,t,o),l.value=withSpring(0,SPRING_CONFIG,e=>{"worklet";e&&runOnJS(p)()}),runOnJS(g)(t,o)});return s?b:b.activateAfterLongPress(350)},[n,s,t,i,u]),g=n?[]:[...t>0?[{name:"moveUp",label:c.moveUp}]:[],...t<a-1?[{name:"moveDown",label:c.moveDown}]:[]];return _jsx(Animated.View,{style:S,onLayout:t=>i.onHeight(e,t.nativeEvent.layout.height),accessibilityActions:g,onAccessibilityAction:e=>{if(n)return;const l=t+(ACTION_STEP[e.nativeEvent.actionName]??0);l!==t&&l>=0&&l<a&&i.onMove(t,l)},testID:`sortable-row-${e}`,children:s?_jsxs(View,{style:v.handleRow,children:[_jsx(GestureDetector,{gesture:f,children:_jsxs(View,{style:v.handle,children:[_jsx(View,{style:v.bar}),_jsx(View,{style:v.bar}),_jsx(View,{style:v.bar})]})}),_jsx(View,{style:v.body,children:d})]}):_jsx(GestureDetector,{gesture:f,children:_jsx(View,{children:d})})})}export function SortableList(e){const{data:t,keyExtractor:a,renderItem:l,onReorder:o,handle:r=!1,disabled:s=!1,accessibilityLabel:n,labels:u,testID:i}=e,c=useMemo(()=>({...DEFAULT_SORTABLE_LIST_LABELS,...u}),[u]),d=useMemo(()=>t.map((e,t)=>({key:a(e,t),item:e})),[t,a]),m=useMemo(()=>d.map(e=>e.key),[d]),v=useAnimatedRef(),h=useSharedValue(0),S=useSharedValue(0),f=useSharedValue(0),g=useScrollHost(),p=useSharedValue(0),b=null!==g,x=g?.top??p,w=g?.bottom??p,y=g?.offset??p,_=g?.maxOffset??p,k=g?.scrollTo??noop,A=useSharedValue(0),L=useSharedValue(0),O=useSharedValue(0),V=useSharedValue(0),I=useSharedValue(-1),T=useSharedValue(-1),C=useSharedValue(0),E=useSharedValue([]),j=useRef(new Map),M=useRef(m),[R,D]=useState(null),Y=useCallback(()=>{E.value=M.current.map(e=>j.current.get(e)??0)},[E]);useEffect(()=>{M.current=m,Y()},[m,Y]),useEffect(()=>()=>{cancelAnimation(C)},[C]);const G=useCallback(e=>{D(t=>t?.dragging?{...t,to:e}:t)},[]),P=useFrameCallback(()=>{"worklet";const e=I.value;if(e<0)return;const t=measure(v);if(t){const e=b?Math.max(t.pageY,x.value):t.pageY,a=b?Math.min(t.pageY+t.height,w.value):t.pageY+t.height,l=Math.max(0,f.value-t.height-1);V.value<e+48?h.value>1?scrollTo(v,0,Math.max(0,h.value-12),!1):b&&L.value>0&&(L.value=Math.max(0,L.value-12),runOnJS(k)(L.value)):V.value>a-48&&(h.value<l?scrollTo(v,0,Math.min(l,h.value+12),!1):b&&L.value<_.value&&(L.value=Math.min(_.value,L.value+12),runOnJS(k)(L.value)))}C.value=O.value+h.value-S.value+y.value-A.value;const a=dropIndex(E.value,e,C.value);a!==T.value&&(T.value=a,runOnJS(G)(a))},!1),N=useCallback(e=>{triggerHaptic("longPress"),P.setActive(!0),D({key:m[e]??"",from:e,to:e,dragging:!0})},[P,m]),H=useCallback((e,t)=>{P.setActive(!1),D(e=>e?{...e,to:t,dragging:!1}:e),t!==e&&o(moveItem(m,e,t))},[P,m,o]),F=useCallback(()=>{D(e=>e&&!e.dragging?null:e)},[]),J=useCallback((e,t)=>{o(moveItem(m,e,t))},[m,o]),U=useCallback((e,t)=>{j.current.set(e,t),Y()},[Y]),z=useAnimatedScrollHandler({onScroll:e=>{"worklet";h.value=e.contentOffset.y}}),B=useCallback((e,t)=>{f.value=t},[f]),K=useMemo(()=>({scrollRef:v,scrollY:h,scrollStart:S,hostOffset:y,hostStart:A,hostTarget:L,translation:O,absoluteY:V,dragIndex:I,dropTo:T,dragY:C,heights:E}),[v,h,S,y,A,L,O,V,I,T,C,E]),X=useMemo(()=>({onLift:N,onDrop:H,onSettled:F,onMove:J,onHeight:U}),[N,H,F,J,U]),$=!0===R?.dragging,q=$&&R?rowShifts(m.map(e=>j.current.get(e)??0),R.from,R.to):null;return _jsx(Animated.ScrollView,{ref:v,onScroll:z,onContentSizeChange:B,scrollEventThrottle:16,scrollEnabled:!$,accessibilityLabel:n,testID:i,children:d.map((e,t)=>{const a=R?.key===e.key;return _jsx(SortableRow,{rowKey:e.key,index:t,count:d.length,shift:q?.[t]??0,isActive:a,dragging:$,handle:r,disabled:s,shared:K,callbacks:X,labels:c,children:l({item:e.item,index:t,isActive:a})},e.key)})})}SortableList.displayName="SortableList";export default SortableList;
1
+ "use strict";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{StyleSheet,View}from"react-native";import{Gesture,GestureDetector}from"react-native-gesture-handler";import Animated,{cancelAnimation,measure,runOnJS,scrollTo,useAnimatedRef,useAnimatedScrollHandler,useAnimatedStyle,useFrameCallback,useSharedValue,withSpring}from"react-native-reanimated";import{useTheme}from"../../theme/index.js";import{triggerHaptic}from"../../utils/index.js";import{useScrollHost}from"../Screen/ScrollHost.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_SORTABLE_LIST_LABELS=Object.freeze({moveUp:"Move up",moveDown:"Move down"});const LONG_PRESS_MS=350,EDGE_PX=48,SCROLL_STEP_PX=12,SCROLL_SLACK_PX=1,SPRING_CONFIG={damping:22,stiffness:260,mass:1},ACTION_STEP={moveUp:-1,moveDown:1},noop=e=>{};export function moveItem(e,t,a){const l=e.slice();if(t<0||t>=l.length)return l;const[o]=l.splice(t,1);return l.splice(a,0,o),l}export function topOf(e,t){"worklet";let a=0;for(let l=0;l<t;l++)a+=e[l]??0;return a}export function slotTop(e,t,a){"worklet";let l=0,o=0;for(let r=0;r<e.length&&o<a;r++)r!==t&&(l+=e[r]??0,o++);return l}export function dropIndex(e,t,a){"worklet";const l=topOf(e,t)+(e[t]??0)/2+a;let o=0,r=0;for(let a=0;a<e.length;a++){const s=e[a]??0;a!==t&&r+s/2<l&&o++,r+=s}return o}export function rowShifts(e,t,a){const l=[];let o=0;for(const t of e)l.push(o),o+=t;const r=e.map(()=>0),s=moveItem(e.map((e,t)=>t),t,a);let n=0;for(const t of s)r[t]=n-(l[t]??0),n+=e[t]??0;return r}const buildStyles=e=>StyleSheet.create({handleRow:{flexDirection:"row",alignItems:"center"},handle:{paddingHorizontal:e.space.sm,paddingVertical:e.space.md,gap:e.space.xxs},bar:{width:e.space.md,height:e.space.xxs,backgroundColor:e.colors["text-muted"]},body:{flex:1}});function SortableRow({rowKey:e,index:t,count:a,shift:l,isActive:o,dragging:r,handle:s,disabled:n,shared:u,callbacks:i,labels:c,children:d}){const m=useTheme(),v=useMemo(()=>buildStyles(m),[m]),h=useSharedValue(0);useEffect(()=>{h.value=r&&!o?withSpring(l,SPRING_CONFIG):l},[r,o,l,h]),useEffect(()=>()=>{cancelAnimation(h)},[h]);const S=useAnimatedStyle(()=>({transform:[{translateY:o?u.dragY.value:h.value}],zIndex:o?1:0})),f=useMemo(()=>{const{dragIndex:e,dropTo:a,dragY:l,translation:o,absoluteY:r,scrollY:c,scrollStart:d,hostOffset:m,hostStart:v,hostTarget:h,heights:S}=u,{onLift:f,onDrop:g,onSettled:p}=i,b=Gesture.Pan().enabled(!n).onStart(s=>{"worklet";r.value=s.absoluteY,e.value=t,a.value=t,d.value=c.value,v.value=m.value,h.value=m.value,o.value=0,l.value=0,runOnJS(f)(t)}).onUpdate(a=>{"worklet";e.value===t&&(o.value=a.translationY,r.value=a.absoluteY)}).onFinalize(()=>{"worklet";if(e.value!==t)return;const o=a.value,r=S.value;e.value=-1,l.value=topOf(r,t)+l.value-slotTop(r,t,o),l.value=withSpring(0,SPRING_CONFIG,e=>{"worklet";e&&runOnJS(p)()}),runOnJS(g)(t,o)});return s?b:b.activateAfterLongPress(350)},[n,s,t,i,u]),g=n?[]:[...t>0?[{name:"moveUp",label:c.moveUp}]:[],...t<a-1?[{name:"moveDown",label:c.moveDown}]:[]];return _jsx(Animated.View,{style:S,onLayout:t=>i.onHeight(e,t.nativeEvent.layout.height),accessibilityActions:g,onAccessibilityAction:e=>{if(n)return;const l=t+(ACTION_STEP[e.nativeEvent.actionName]??0);l!==t&&l>=0&&l<a&&i.onMove(t,l)},testID:`sortable-row-${e}`,children:s?_jsxs(View,{style:v.handleRow,children:[_jsx(GestureDetector,{gesture:f,children:_jsxs(View,{style:v.handle,children:[_jsx(View,{style:v.bar}),_jsx(View,{style:v.bar}),_jsx(View,{style:v.bar})]})}),_jsx(View,{style:v.body,children:d})]}):_jsx(GestureDetector,{gesture:f,children:_jsx(View,{children:d})})})}export function SortableList(e){const{data:t,keyExtractor:a,renderItem:l,onReorder:o,handle:r=!1,disabled:s=!1,accessibilityLabel:n,labels:u,testID:i}=e,c=useMemo(()=>({...DEFAULT_SORTABLE_LIST_LABELS,...u}),[u]),d=useMemo(()=>t.map((e,t)=>({key:a(e,t),item:e})),[t,a]),m=useMemo(()=>d.map(e=>e.key),[d]),v=useAnimatedRef(),h=useSharedValue(0),S=useSharedValue(0),f=useSharedValue(0),g=useScrollHost(),p=useSharedValue(0),b=null!==g,x=g?.top??p,w=g?.bottom??p,y=g?.offset??p,_=g?.maxOffset??p,k=g?.scrollTo??noop,A=useSharedValue(0),L=useSharedValue(0),O=useSharedValue(0),V=useSharedValue(0),I=useSharedValue(-1),T=useSharedValue(-1),C=useSharedValue(0),E=useSharedValue([]),j=useRef(new Map),M=useRef(m),[R,D]=useState(null),Y=useCallback(()=>{E.value=M.current.map(e=>j.current.get(e)??0)},[E]);useEffect(()=>{M.current=m,Y()},[m,Y]),useEffect(()=>()=>{cancelAnimation(C)},[C]);const G=useCallback(e=>{D(t=>t?.dragging?{...t,to:e}:t)},[]),P=useFrameCallback(()=>{"worklet";const e=I.value;if(e<0)return;const t=measure(v);if(t){const e=b?Math.max(t.pageY,x.value):t.pageY,a=b?Math.min(t.pageY+t.height,w.value):t.pageY+t.height,l=Math.max(0,f.value-t.height-1);V.value<e+48?h.value>1?scrollTo(v,0,Math.max(0,h.value-12),!1):b&&L.value>0&&(L.value=Math.max(0,L.value-12),runOnJS(k)(L.value)):V.value>a-48&&(h.value<l?scrollTo(v,0,Math.min(l,h.value+12),!1):b&&L.value<_.value&&(L.value=Math.min(_.value,L.value+12),runOnJS(k)(L.value)))}C.value=O.value+h.value-S.value+y.value-A.value;const a=dropIndex(E.value,e,C.value);a!==T.value&&(T.value=a,runOnJS(G)(a))},!1),N=useCallback(e=>{triggerHaptic("longPress"),P.setActive(!0),D({key:m[e]??"",from:e,to:e,dragging:!0})},[P,m]),H=useCallback((e,t)=>{P.setActive(!1),D(e=>e?{...e,to:t,dragging:!1}:e),t!==e&&o(moveItem(m,e,t))},[P,m,o]),F=useCallback(()=>{D(e=>e&&!e.dragging?null:e)},[]),J=useCallback((e,t)=>{o(moveItem(m,e,t))},[m,o]),U=useCallback((e,t)=>{j.current.set(e,t),Y()},[Y]),z=useAnimatedScrollHandler({onScroll:e=>{"worklet";h.value=e.contentOffset.y}}),B=useCallback((e,t)=>{f.value=t},[f]),K=useMemo(()=>({scrollRef:v,scrollY:h,scrollStart:S,hostOffset:y,hostStart:A,hostTarget:L,translation:O,absoluteY:V,dragIndex:I,dropTo:T,dragY:C,heights:E}),[v,h,S,y,A,L,O,V,I,T,C,E]),X=useMemo(()=>({onLift:N,onDrop:H,onSettled:F,onMove:J,onHeight:U}),[N,H,F,J,U]),$=!0===R?.dragging,q=$&&R?rowShifts(m.map(e=>j.current.get(e)??0),R.from,R.to):null;return _jsx(Animated.ScrollView,{ref:v,onScroll:z,onContentSizeChange:B,scrollEventThrottle:16,scrollEnabled:!$,accessibilityLabel:n,testID:i,children:d.map((e,t)=>{const a=R?.key===e.key;return _jsx(SortableRow,{rowKey:e.key,index:t,count:d.length,shift:q?.[t]??0,isActive:a,dragging:$,handle:r,disabled:s,shared:K,callbacks:X,labels:c,children:l({item:e.item,index:t,isActive:a})},e.key)})})}SortableList.displayName="SortableList";export default SortableList;
@@ -1,9 +1,18 @@
1
+ import { type MarkdownHeadings, type MarkdownLinks } from "@webority/markdown-core";
1
2
  import type React from "react";
2
3
  import type { StyleProp, TextStyle, ViewStyle } from "react-native";
3
- export interface MarkdownProps {
4
+ export interface MarkdownProps<T = string> {
4
5
  /** The markdown source. An empty or missing string renders nothing. */
5
6
  children?: string;
6
- /** Called instead of Linking.openURL when a link is pressed. */
7
+ /** `web` makes web and contact addresses pressable; `app` makes the links `resolveLink` maps pressable. Any other scheme is plain text. */
8
+ links?: MarkdownLinks;
9
+ /** `outline` sizes each heading by its level; `text` draws every heading as bold body text. */
10
+ headings?: MarkdownHeadings;
11
+ /** Maps an app link's address to what `onAppLinkPress` receives. Null leaves the link as plain text. */
12
+ resolveLink?: (href: string) => T | null | undefined;
13
+ /** Opens an app link. Without it, app links show as plain text. */
14
+ onAppLinkPress?: (target: T) => void;
15
+ /** Called instead of Linking.openURL when a web or contact link is pressed. */
7
16
  onLinkPress?: (href: string) => void;
8
17
  /**
9
18
  * When true, renders the component as its authored skeleton placeholder shape.
@@ -17,13 +26,11 @@ export interface MarkdownProps {
17
26
  testID?: string;
18
27
  }
19
28
  /**
20
- * Renders a small, deliberate subset of markdown using the theme's own type
21
- * scale and colours, with no dependency.
22
- *
23
- * It exists because Expo has no markdown module and the alternative on npm has
24
- * not shipped since 2022. What it covers is what our content contains: release
25
- * notes, help text and descriptions written by people. Nested lists, tables and
26
- * inline HTML are out of scope on purpose — see parse.ts.
29
+ * Renders the shared markdown grammar with the theme's own type scale and colours,
30
+ * with no dependency. Inline HTML is plain text.
27
31
  */
28
- export declare const Markdown: React.FC<MarkdownProps>;
32
+ export declare function Markdown<T = string>({ children, links, headings, resolveLink, onAppLinkPress, onLinkPress, loading, style, textStyle, testID, }: MarkdownProps<T>): React.ReactElement | null;
33
+ export declare namespace Markdown {
34
+ var displayName: string;
35
+ }
29
36
  //# sourceMappingURL=Markdown.d.ts.map
@@ -3,7 +3,7 @@ import type { StyleProp, TextInputProps, TextStyle, ViewStyle } from "react-nati
3
3
  import type { Size } from "../../types/vocabulary";
4
4
  import type { HapticType } from "../../utils";
5
5
  export type NumberInputSize = Extract<Size, "sm" | "md" | "lg">;
6
- export type NumberInputVariant = "inline" | "horizontal" | "stacked";
6
+ export type NumberInputVariant = "inline" | "horizontal";
7
7
  export interface NumberInputLabels {
8
8
  decrease: string;
9
9
  increase: string;
@@ -2,10 +2,10 @@
2
2
  * The text transforms behind the editor's toolbar, kept out of the component so
3
3
  * the behaviour people actually notice — toggling bold OFF again, and where the
4
4
  * caret lands when nothing is selected — can be tested as data, with no
5
- * rendering involved. Same split as Markdown/parse.ts.
5
+ * rendering involved.
6
6
  *
7
7
  * The output targets our own `<Markdown>` renderer, so the vocabulary is the
8
- * subset that parser reads: `**`, `*`, `~~`, backtick, `[](…)`, `#`, `##`,
8
+ * subset the @webority/markdown-core grammar reads: `**`, `*`, `~~`, backtick, `[](…)`, `#`, `##`,
9
9
  * `- `, `1. `, `> `. Nothing here emits anything that renderer would show as
10
10
  * literal text.
11
11
  */
@@ -57,8 +57,6 @@ export interface SkeletonProps {
57
57
  radius?: SkeletonRadius;
58
58
  /** Animation pattern. */
59
59
  variant?: SkeletonVariant;
60
- /** Sweep speed for shimmer. */
61
- speed?: SkeletonSpeed;
62
60
  /**
63
61
  * Per-instance color override. Falls back to provider defaults, then theme.
64
62
  * Use for one-off contrast adjustments (dark shimmer on a light banner);
@@ -48,7 +48,7 @@
48
48
  import type { ComponentType, ReactNode } from "react";
49
49
  import React from "react";
50
50
  import type { StyleProp, ViewStyle } from "react-native";
51
- import type { SkeletonLabels, SkeletonSpeed, SkeletonVariant } from "./Skeleton";
51
+ import type { SkeletonLabels, SkeletonVariant } from "./Skeleton";
52
52
  import type { SkeletonColors } from "./SkeletonProvider";
53
53
  /**
54
54
  * Components that ship their own placeholder shape declare this static. The
@@ -72,8 +72,6 @@ export interface SkeletonContentProps {
72
72
  placeholder?: ReactNode;
73
73
  /** Animation style forwarded to walker-produced `<Skeleton>` blocks. */
74
74
  variant?: SkeletonVariant;
75
- /** Animation speed forwarded to walker-produced `<Skeleton>` blocks. */
76
- speed?: SkeletonSpeed;
77
75
  /**
78
76
  * Repeat `placeholder` (or `children`, when no placeholder is provided)
79
77
  * this many times while loading. Useful for list layouts where the
@@ -1,6 +1,6 @@
1
1
  import type { ReactElement, ReactNode } from "react";
2
2
  import type { FlatListProps, StyleProp, ViewStyle } from "react-native";
3
- import type { SkeletonLabels, SkeletonSpeed, SkeletonVariant } from "./Skeleton";
3
+ import type { SkeletonLabels, SkeletonVariant } from "./Skeleton";
4
4
  import type { SkeletonColors } from "./SkeletonProvider";
5
5
  export interface SkeletonListProps<ItemT> extends Omit<FlatListProps<ItemT>, "data" | "renderItem"> {
6
6
  /** Whether the list is in its initial loading state. */
@@ -18,8 +18,6 @@ export interface SkeletonListProps<ItemT> extends Omit<FlatListProps<ItemT>, "da
18
18
  placeholderCount?: number;
19
19
  /** Animation style — same as Skeleton. */
20
20
  variant?: SkeletonVariant;
21
- /** Animation speed — same as Skeleton. */
22
- speed?: SkeletonSpeed;
23
21
  /** Colour override forwarded to the placeholder skeletons. */
24
22
  colors?: SkeletonColors;
25
23
  /** Screen-reader copy for the placeholder state, merged over the English defaults. */
@@ -1,9 +1,18 @@
1
+ import { type MarkdownHeadings, type MarkdownLinks } from "@webority/markdown-core";
1
2
  import type React from "react";
2
3
  import type { StyleProp, TextStyle, ViewStyle } from "react-native";
3
- export interface MarkdownProps {
4
+ export interface MarkdownProps<T = string> {
4
5
  /** The markdown source. An empty or missing string renders nothing. */
5
6
  children?: string;
6
- /** Called instead of Linking.openURL when a link is pressed. */
7
+ /** `web` makes web and contact addresses pressable; `app` makes the links `resolveLink` maps pressable. Any other scheme is plain text. */
8
+ links?: MarkdownLinks;
9
+ /** `outline` sizes each heading by its level; `text` draws every heading as bold body text. */
10
+ headings?: MarkdownHeadings;
11
+ /** Maps an app link's address to what `onAppLinkPress` receives. Null leaves the link as plain text. */
12
+ resolveLink?: (href: string) => T | null | undefined;
13
+ /** Opens an app link. Without it, app links show as plain text. */
14
+ onAppLinkPress?: (target: T) => void;
15
+ /** Called instead of Linking.openURL when a web or contact link is pressed. */
7
16
  onLinkPress?: (href: string) => void;
8
17
  /**
9
18
  * When true, renders the component as its authored skeleton placeholder shape.
@@ -17,13 +26,11 @@ export interface MarkdownProps {
17
26
  testID?: string;
18
27
  }
19
28
  /**
20
- * Renders a small, deliberate subset of markdown using the theme's own type
21
- * scale and colours, with no dependency.
22
- *
23
- * It exists because Expo has no markdown module and the alternative on npm has
24
- * not shipped since 2022. What it covers is what our content contains: release
25
- * notes, help text and descriptions written by people. Nested lists, tables and
26
- * inline HTML are out of scope on purpose — see parse.ts.
29
+ * Renders the shared markdown grammar with the theme's own type scale and colours,
30
+ * with no dependency. Inline HTML is plain text.
27
31
  */
28
- export declare const Markdown: React.FC<MarkdownProps>;
32
+ export declare function Markdown<T = string>({ children, links, headings, resolveLink, onAppLinkPress, onLinkPress, loading, style, textStyle, testID, }: MarkdownProps<T>): React.ReactElement | null;
33
+ export declare namespace Markdown {
34
+ var displayName: string;
35
+ }
29
36
  //# sourceMappingURL=Markdown.d.ts.map
@@ -3,7 +3,7 @@ import type { StyleProp, TextInputProps, TextStyle, ViewStyle } from "react-nati
3
3
  import type { Size } from "../../types/vocabulary.js";
4
4
  import type { HapticType } from "../../utils/index.js";
5
5
  export type NumberInputSize = Extract<Size, "sm" | "md" | "lg">;
6
- export type NumberInputVariant = "inline" | "horizontal" | "stacked";
6
+ export type NumberInputVariant = "inline" | "horizontal";
7
7
  export interface NumberInputLabels {
8
8
  decrease: string;
9
9
  increase: string;
@@ -2,10 +2,10 @@
2
2
  * The text transforms behind the editor's toolbar, kept out of the component so
3
3
  * the behaviour people actually notice — toggling bold OFF again, and where the
4
4
  * caret lands when nothing is selected — can be tested as data, with no
5
- * rendering involved. Same split as Markdown/parse.ts.
5
+ * rendering involved.
6
6
  *
7
7
  * The output targets our own `<Markdown>` renderer, so the vocabulary is the
8
- * subset that parser reads: `**`, `*`, `~~`, backtick, `[](…)`, `#`, `##`,
8
+ * subset the @webority/markdown-core grammar reads: `**`, `*`, `~~`, backtick, `[](…)`, `#`, `##`,
9
9
  * `- `, `1. `, `> `. Nothing here emits anything that renderer would show as
10
10
  * literal text.
11
11
  */
@@ -57,8 +57,6 @@ export interface SkeletonProps {
57
57
  radius?: SkeletonRadius;
58
58
  /** Animation pattern. */
59
59
  variant?: SkeletonVariant;
60
- /** Sweep speed for shimmer. */
61
- speed?: SkeletonSpeed;
62
60
  /**
63
61
  * Per-instance color override. Falls back to provider defaults, then theme.
64
62
  * Use for one-off contrast adjustments (dark shimmer on a light banner);
@@ -48,7 +48,7 @@
48
48
  import type { ComponentType, ReactNode } from "react";
49
49
  import React from "react";
50
50
  import type { StyleProp, ViewStyle } from "react-native";
51
- import type { SkeletonLabels, SkeletonSpeed, SkeletonVariant } from "./Skeleton.js";
51
+ import type { SkeletonLabels, SkeletonVariant } from "./Skeleton.js";
52
52
  import type { SkeletonColors } from "./SkeletonProvider.js";
53
53
  /**
54
54
  * Components that ship their own placeholder shape declare this static. The
@@ -72,8 +72,6 @@ export interface SkeletonContentProps {
72
72
  placeholder?: ReactNode;
73
73
  /** Animation style forwarded to walker-produced `<Skeleton>` blocks. */
74
74
  variant?: SkeletonVariant;
75
- /** Animation speed forwarded to walker-produced `<Skeleton>` blocks. */
76
- speed?: SkeletonSpeed;
77
75
  /**
78
76
  * Repeat `placeholder` (or `children`, when no placeholder is provided)
79
77
  * this many times while loading. Useful for list layouts where the
@@ -1,6 +1,6 @@
1
1
  import type { ReactElement, ReactNode } from "react";
2
2
  import type { FlatListProps, StyleProp, ViewStyle } from "react-native";
3
- import type { SkeletonLabels, SkeletonSpeed, SkeletonVariant } from "./Skeleton.js";
3
+ import type { SkeletonLabels, SkeletonVariant } from "./Skeleton.js";
4
4
  import type { SkeletonColors } from "./SkeletonProvider.js";
5
5
  export interface SkeletonListProps<ItemT> extends Omit<FlatListProps<ItemT>, "data" | "renderItem"> {
6
6
  /** Whether the list is in its initial loading state. */
@@ -18,8 +18,6 @@ export interface SkeletonListProps<ItemT> extends Omit<FlatListProps<ItemT>, "da
18
18
  placeholderCount?: number;
19
19
  /** Animation style — same as Skeleton. */
20
20
  variant?: SkeletonVariant;
21
- /** Animation speed — same as Skeleton. */
22
- speed?: SkeletonSpeed;
23
21
  /** Colour override forwarded to the placeholder skeletons. */
24
22
  colors?: SkeletonColors;
25
23
  /** Screen-reader copy for the placeholder state, merged over the English defaults. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/mobile-ui",
3
- "version": "0.111.0",
3
+ "version": "0.112.3",
4
4
  "description": "Beautiful, animated, accessible React Native components, theme and form engine for Webority projects.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -84,6 +84,9 @@
84
84
  "javaPackageName": "com.webority.mobileui.pdfrasterizer"
85
85
  }
86
86
  },
87
+ "dependencies": {
88
+ "@webority/markdown-core": "0.112.3"
89
+ },
87
90
  "peerDependencies": {
88
91
  "@react-navigation/bottom-tabs": ">=7.0.0",
89
92
  "@react-navigation/native": ">=7.0.0",
@@ -100,8 +103,8 @@
100
103
  "react-native-safe-area-context": ">=5.4.0",
101
104
  "react-native-svg": ">=15.0.0",
102
105
  "react-native-worklets": ">=0.10.0",
103
- "@webority/canvas-kit": "0.111.0",
104
- "@webority/mobile-core": "0.111.0"
106
+ "@webority/canvas-kit": "0.112.3",
107
+ "@webority/mobile-core": "0.112.3"
105
108
  },
106
109
  "peerDependenciesMeta": {
107
110
  "@react-navigation/bottom-tabs": {
@@ -170,10 +173,10 @@
170
173
  "react-test-renderer": "19.2.8",
171
174
  "rimraf": "6.1.3",
172
175
  "typescript": "5.9.3",
173
- "@webority/canvas-kit": "0.111.0",
174
- "@webority/mobile-core": "0.111.0",
176
+ "@webority/canvas-kit": "0.112.3",
175
177
  "@webority/mobile-dev": "0.0.0",
176
- "@webority/tokens": "0.111.0"
178
+ "@webority/mobile-core": "0.112.3",
179
+ "@webority/tokens": "0.112.3"
177
180
  },
178
181
  "scripts": {
179
182
  "build": "bob build && node ../mobile-dev/scripts/minify-lib.mjs && node -e \"require('node:fs').rmSync('dist/canvas-kit',{recursive:true,force:true})\" && node ../canvas-kit/dist/cli.js build --config canvas-kit.json --out dist/canvas-kit",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.parseMarkdown=exports.parseInline=exports.markdownToPlainText=void 0;const INLINE_PATTERNS=[{re:/^`([^`]+)`/,build:e=>({type:"code",value:e[1]})},{re:/^\[([^\]]*)\]\(([^)\s]+)\)/,build:(e,n)=>({type:"link",href:e[2],children:n(e[1])})},{re:/^\*\*([\s\S]+?)\*\*/,build:(e,n)=>({type:"strong",children:n(e[1])})},{re:/^__([\s\S]+?)__/,build:(e,n)=>({type:"strong",children:n(e[1])})},{re:/^~~([\s\S]+?)~~/,build:(e,n)=>({type:"strike",children:n(e[1])})},{re:/^\*([^*\n]+)\*/,build:(e,n)=>({type:"em",children:n(e[1])})},{re:/^_([^_\n]+)_/,build:(e,n)=>({type:"em",children:n(e[1])})}],parseInline=e=>{const n=[];let t="",r=e;const flush=()=>{t&&(n.push({type:"text",value:t}),t="")};for(;r.length>0;){if(r.startsWith("\\")&&r.length>1){t+=r[1],r=r.slice(2);continue}let e=!1;for(const{re:t,build:s}of INLINE_PATTERNS){const i=t.exec(r);if(i){flush(),n.push(s(i,parseInline)),r=r.slice(i[0].length),e=!0;break}}e||(t+=r[0],r=r.slice(1))}return flush(),n};exports.parseInline=parseInline;const MAX_LIST_DEPTH=4,depthOf=e=>{const n=e.replace(/\t/g," ").length;return Math.min(Math.floor(n/2),4)},HEADING=/^(#{1,6})\s+(.*)$/,UNORDERED=/^(\s*)[-*+]\s+(.*)$/,ORDERED=/^(\s*)(\d+)[.)]\s+(.*)$/,QUOTE=/^\s*>\s?(.*)$/,RULE=/^\s*([-*_])\s*(?:\1\s*){2,}$/,FENCE=/^\s*```\s*(\S+)?\s*$/,parseMarkdown=e=>{const n=[],t=(e??"").replace(/\r\n?/g,"\n").split("\n");let r=[];const flushParagraph=()=>{r.length>0&&(n.push({type:"paragraph",children:parseInline(r.join(" ").trim())}),r=[])};for(let e=0;e<t.length;e++){const s=t[e],i=FENCE.exec(s);if(i){flushParagraph();const r=[];for(e++;e<t.length&&!FENCE.test(t[e]);)r.push(t[e]),e++;n.push({type:"codeBlock",value:r.join("\n"),language:i[1]});continue}if(""===s.trim()){flushParagraph();continue}if(RULE.test(s)){flushParagraph(),n.push({type:"rule"});continue}const l=HEADING.exec(s);if(l){flushParagraph(),n.push({type:"heading",level:l[1].length,children:parseInline(l[2])});continue}const o=ORDERED.exec(s);if(o){flushParagraph(),n.push({type:"listItem",ordered:!0,index:Number(o[2]),depth:depthOf(o[1]),children:parseInline(o[3])});continue}const p=UNORDERED.exec(s);if(p){flushParagraph(),n.push({type:"listItem",ordered:!1,index:0,depth:depthOf(p[1]),children:parseInline(p[2])});continue}const a=QUOTE.exec(s);a?(flushParagraph(),n.push({type:"quote",children:parseInline(a[1])})):r.push(s.trim())}return flushParagraph(),n};exports.parseMarkdown=parseMarkdown;const inlinePlainText=e=>e.map(e=>"text"===e.type||"code"===e.type?e.value:inlinePlainText(e.children)).join(""),markdownToPlainText=e=>parseMarkdown(e).map(e=>{switch(e.type){case"heading":case"paragraph":case"listItem":case"quote":return inlinePlainText(e.children);case"codeBlock":return e.value;default:return""}}).filter(Boolean).join(" ");exports.markdownToPlainText=markdownToPlainText;
@@ -1 +0,0 @@
1
- "use strict";const INLINE_PATTERNS=[{re:/^`([^`]+)`/,build:e=>({type:"code",value:e[1]})},{re:/^\[([^\]]*)\]\(([^)\s]+)\)/,build:(e,t)=>({type:"link",href:e[2],children:t(e[1])})},{re:/^\*\*([\s\S]+?)\*\*/,build:(e,t)=>({type:"strong",children:t(e[1])})},{re:/^__([\s\S]+?)__/,build:(e,t)=>({type:"strong",children:t(e[1])})},{re:/^~~([\s\S]+?)~~/,build:(e,t)=>({type:"strike",children:t(e[1])})},{re:/^\*([^*\n]+)\*/,build:(e,t)=>({type:"em",children:t(e[1])})},{re:/^_([^_\n]+)_/,build:(e,t)=>({type:"em",children:t(e[1])})}];export const parseInline=e=>{const t=[];let n="",i=e;const flush=()=>{n&&(t.push({type:"text",value:n}),n="")};for(;i.length>0;){if(i.startsWith("\\")&&i.length>1){n+=i[1],i=i.slice(2);continue}let e=!1;for(const{re:n,build:s}of INLINE_PATTERNS){const r=n.exec(i);if(r){flush(),t.push(s(r,parseInline)),i=i.slice(r[0].length),e=!0;break}}e||(n+=i[0],i=i.slice(1))}return flush(),t};const MAX_LIST_DEPTH=4,depthOf=e=>{const t=e.replace(/\t/g," ").length;return Math.min(Math.floor(t/2),4)},HEADING=/^(#{1,6})\s+(.*)$/,UNORDERED=/^(\s*)[-*+]\s+(.*)$/,ORDERED=/^(\s*)(\d+)[.)]\s+(.*)$/,QUOTE=/^\s*>\s?(.*)$/,RULE=/^\s*([-*_])\s*(?:\1\s*){2,}$/,FENCE=/^\s*```\s*(\S+)?\s*$/;export const parseMarkdown=e=>{const t=[],n=(e??"").replace(/\r\n?/g,"\n").split("\n");let i=[];const flushParagraph=()=>{i.length>0&&(t.push({type:"paragraph",children:parseInline(i.join(" ").trim())}),i=[])};for(let e=0;e<n.length;e++){const s=n[e],r=FENCE.exec(s);if(r){flushParagraph();const i=[];for(e++;e<n.length&&!FENCE.test(n[e]);)i.push(n[e]),e++;t.push({type:"codeBlock",value:i.join("\n"),language:r[1]});continue}if(""===s.trim()){flushParagraph();continue}if(RULE.test(s)){flushParagraph(),t.push({type:"rule"});continue}const l=HEADING.exec(s);if(l){flushParagraph(),t.push({type:"heading",level:l[1].length,children:parseInline(l[2])});continue}const c=ORDERED.exec(s);if(c){flushParagraph(),t.push({type:"listItem",ordered:!0,index:Number(c[2]),depth:depthOf(c[1]),children:parseInline(c[3])});continue}const o=UNORDERED.exec(s);if(o){flushParagraph(),t.push({type:"listItem",ordered:!1,index:0,depth:depthOf(o[1]),children:parseInline(o[2])});continue}const p=QUOTE.exec(s);p?(flushParagraph(),t.push({type:"quote",children:parseInline(p[1])})):i.push(s.trim())}return flushParagraph(),t};const inlinePlainText=e=>e.map(e=>"text"===e.type||"code"===e.type?e.value:inlinePlainText(e.children)).join("");export const markdownToPlainText=e=>parseMarkdown(e).map(e=>{switch(e.type){case"heading":case"paragraph":case"listItem":case"quote":return inlinePlainText(e.children);case"codeBlock":return e.value;default:return""}}).filter(Boolean).join(" ");
@@ -1,63 +0,0 @@
1
- /**
2
- * A deliberately small CommonMark subset, parsed without a dependency.
3
- *
4
- * The scope is what our own content actually contains — release notes, help
5
- * text, descriptions written by people in a web editor — not a spec-complete
6
- * renderer. Nested lists, tables, footnotes, HTML blocks and reference links
7
- * are out of scope on purpose: supporting them means a parser nobody here can
8
- * maintain, and content that needs them is a sign it should not be markdown.
9
- *
10
- * Kept separate from the component so the grammar can be tested as data, with
11
- * no rendering involved.
12
- */
13
- export type InlineNode = {
14
- type: "text";
15
- value: string;
16
- } | {
17
- type: "strong";
18
- children: InlineNode[];
19
- } | {
20
- type: "em";
21
- children: InlineNode[];
22
- } | {
23
- type: "code";
24
- value: string;
25
- } | {
26
- type: "strike";
27
- children: InlineNode[];
28
- } | {
29
- type: "link";
30
- href: string;
31
- children: InlineNode[];
32
- };
33
- export type BlockNode = {
34
- type: "heading";
35
- level: 1 | 2 | 3 | 4 | 5 | 6;
36
- children: InlineNode[];
37
- } | {
38
- type: "paragraph";
39
- children: InlineNode[];
40
- } | {
41
- type: "listItem";
42
- ordered: boolean;
43
- index: number;
44
- depth: number;
45
- children: InlineNode[];
46
- } | {
47
- type: "quote";
48
- children: InlineNode[];
49
- } | {
50
- type: "codeBlock";
51
- value: string;
52
- language?: string;
53
- } | {
54
- type: "rule";
55
- };
56
- export declare const parseInline: (input: string) => InlineNode[];
57
- export declare const parseMarkdown: (source: string) => BlockNode[];
58
- /**
59
- * The text a screen reader should speak for a markdown source: the words without
60
- * the emphasis, code, link and heading marks, one block after another.
61
- */
62
- export declare const markdownToPlainText: (source: string) => string;
63
- //# sourceMappingURL=parse.d.ts.map