@webority/mobile-ui 0.10.0 → 0.11.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/android/src/newarch/java/com/webority/mobileui/pdfrasterizer/PdfRasterizerModule.kt +6 -7
- package/ios/PdfRasterizer.mm +36 -9
- package/lib/commonjs/components/Checkbox/Checkbox.js +1 -1
- package/lib/commonjs/components/FieldBase/ChoiceText.js +1 -1
- package/lib/commonjs/components/FieldBase/FieldBase.js +1 -1
- package/lib/commonjs/components/FieldBase/useFloatingLabel.js +1 -1
- package/lib/commonjs/components/FormField/FormField.js +1 -1
- package/lib/commonjs/components/Input/Input.js +1 -1
- package/lib/commonjs/components/Notation/Notation.js +1 -1
- package/lib/commonjs/components/OptionSheet/OptionSheet.js +1 -1
- package/lib/commonjs/components/PermissionPrompt/PermissionPrompt.js +1 -0
- package/lib/commonjs/components/PermissionPrompt/index.js +1 -0
- package/lib/commonjs/components/PermissionPrompt/usePermissionPrompt.js +1 -0
- package/lib/commonjs/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
- package/lib/commonjs/components/Radio/Radio.js +1 -1
- package/lib/commonjs/components/Radio/RadioGroup.js +1 -1
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/commonjs/components/Select/Select.js +1 -1
- package/lib/commonjs/components/Switch/Switch.js +1 -1
- package/lib/commonjs/components/TagInput/TagInput.js +1 -1
- package/lib/commonjs/components/index.js +1 -1
- package/lib/module/components/Checkbox/Checkbox.js +1 -1
- package/lib/module/components/FieldBase/ChoiceText.js +1 -1
- package/lib/module/components/FieldBase/FieldBase.js +1 -1
- package/lib/module/components/FieldBase/useFloatingLabel.js +1 -1
- package/lib/module/components/FormField/FormField.js +1 -1
- package/lib/module/components/Input/Input.js +1 -1
- package/lib/module/components/Notation/Notation.js +1 -1
- package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
- package/lib/module/components/PermissionPrompt/PermissionPrompt.js +1 -0
- package/lib/module/components/PermissionPrompt/index.js +1 -0
- package/lib/module/components/PermissionPrompt/usePermissionPrompt.js +1 -0
- package/lib/module/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
- package/lib/module/components/Radio/Radio.js +1 -1
- package/lib/module/components/Radio/RadioGroup.js +1 -1
- package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/module/components/Select/Select.js +1 -1
- package/lib/module/components/Switch/Switch.js +1 -1
- package/lib/module/components/TagInput/TagInput.js +1 -1
- package/lib/module/components/index.js +1 -1
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +4 -1
- package/lib/typescript/commonjs/components/FileViewer/FileViewer.d.ts +1 -1
- package/lib/typescript/commonjs/components/Notation/Notation.d.ts +10 -4
- package/lib/typescript/commonjs/components/OptionSheet/OptionSheet.d.ts +2 -0
- package/lib/typescript/commonjs/components/PermissionPrompt/PermissionPrompt.d.ts +39 -0
- package/lib/typescript/commonjs/components/PermissionPrompt/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/PermissionPrompt/usePermissionPrompt.d.ts +44 -0
- package/lib/typescript/commonjs/components/PhoneNumberInput/PhoneNumberInput.d.ts +5 -2
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +13 -4
- package/lib/typescript/commonjs/components/Radio/RadioGroup.d.ts +5 -0
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +5 -1
- package/lib/typescript/commonjs/components/Select/Select.d.ts +2 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +11 -4
- package/lib/typescript/commonjs/components/TagInput/TagInput.d.ts +4 -0
- package/lib/typescript/commonjs/components/index.d.ts +2 -0
- package/lib/typescript/commonjs/specs/NativePdfRasterizer.d.ts +1 -1
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +4 -1
- package/lib/typescript/module/components/FileViewer/FileViewer.d.ts +1 -1
- package/lib/typescript/module/components/Notation/Notation.d.ts +10 -4
- package/lib/typescript/module/components/OptionSheet/OptionSheet.d.ts +2 -0
- package/lib/typescript/module/components/PermissionPrompt/PermissionPrompt.d.ts +39 -0
- package/lib/typescript/module/components/PermissionPrompt/index.d.ts +5 -0
- package/lib/typescript/module/components/PermissionPrompt/usePermissionPrompt.d.ts +44 -0
- package/lib/typescript/module/components/PhoneNumberInput/PhoneNumberInput.d.ts +5 -2
- package/lib/typescript/module/components/Radio/Radio.d.ts +13 -4
- package/lib/typescript/module/components/Radio/RadioGroup.d.ts +5 -0
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +5 -1
- package/lib/typescript/module/components/Select/Select.d.ts +2 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +11 -4
- package/lib/typescript/module/components/TagInput/TagInput.d.ts +4 -0
- package/lib/typescript/module/components/index.d.ts +2 -0
- package/lib/typescript/module/specs/NativePdfRasterizer.d.ts +1 -1
- package/package.json +3 -3
- package/src/specs/NativePdfRasterizer.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{FieldLabel,FieldMessage,hasFieldText}from"../FieldBase/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const segmentedControlSizes={sm:{height:32,fontSize:12,paddingHorizontal:10,iconSize:14},md:{height:40,fontSize:14,paddingHorizontal:14,iconSize:16},lg:{height:48,fontSize:16,paddingHorizontal:18,iconSize:18}};export const segmentedControlTrackPadding=4;const LABEL_LINE_HEIGHT_RATIO=1.25,sizeMap=segmentedControlSizes,TRACK_PADDING=4,SegmentedControl=forwardRef((e,t)=>{const{segments:i,label:o,helperText:
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{FieldLabel,FieldMessage,hasFieldText}from"../FieldBase/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const segmentedControlSizes={sm:{height:32,fontSize:12,paddingHorizontal:10,iconSize:14},md:{height:40,fontSize:14,paddingHorizontal:14,iconSize:16},lg:{height:48,fontSize:16,paddingHorizontal:18,iconSize:18}};export const segmentedControlTrackPadding=4;const LABEL_LINE_HEIGHT_RATIO=1.25,sizeMap=segmentedControlSizes,TRACK_PADDING=4,SegmentedControl=forwardRef((e,t)=>{const{segments:i,label:o,helperText:r,error:l,value:s,defaultValue:n,onChange:a,size:d="md",fullWidth:c=!0,disabled:u=!1,tone:m="primary",variant:h="segmented",radius:g,labelLines:p=1,haptic:f,accessibilityLabel:b,style:S,containerStyle:y,segmentStyle:x,selectedIndicatorStyle:z,textStyle:v,labelStyle:C,testID:j}=e,[w,k]=useControllableState({value:s,defaultValue:n??i[0]?.value,onChange:a}),I=useTheme(),_=I.components.segmentedControl,H=useMemo(()=>buildStyles(I),[I]),L=sizeMap[d],F={height:_?.[d]?.height??L.height,fontSize:_?.[d]?.fontSize??L.fontSize,paddingHorizontal:_?.[d]?.paddingHorizontal??L.paddingHorizontal,iconSize:_?.[d]?.iconSize??L.iconSize},M=p>=2?2:1,T=M>1,V="segmented"===h,R="underline"===h,A="pills"===h,E=V?_?.trackPadding??4:0,D=Math.ceil(1.25*F.fontSize)*(M-1),W=_?.underlineHeight??2,P=_?.pillInset??4,q="number"==typeof g?g:g?I.radius[g]:_?.radius,B=q??I.radius.md,N=void 0===q?I.radius.sm:Math.max(q-E,0),G=q??I.radius.full,O=q??0,[K,X]=useState(0),J=useRef(createAnimatedValue(0)).current,Q=Math.max(0,i.findIndex(e=>e.value===w)),U=K>0?(K-2*E)/Math.max(i.length,1):0,Y=useCallback((e,t)=>{if(t<=0)return;const i=t*e,o=I.motion.spring.snappy,r=Animated.spring(J,{toValue:i,damping:o.damping,stiffness:o.stiffness,mass:o.mass,overshootClamping:!0,useNativeDriver:!0});return r.start(),r},[I.motion.spring.snappy,J]);useEffect(()=>{if(U>0){const e=Y(Q,U);return()=>e?.stop()}},[Q,U,Y]);const Z=useCallback(e=>{const t=e.nativeEvent.layout.width;t!==K&&X(t)},[K]),$=useCallback(e=>{if(u)return;if(e.value===w)return;const t=resolveHaptic(f,"selection");t&&triggerHaptic(t),k(e.value)},[u,k,w,f]),ee=V?I.colors.background.elevated:A?I.colors.primaryMuted:I.colors.primary,te=V?N:A?G:O,ie="neutral"===m?I.colors.text.primary:I.colors.primary,oe=I.colors.background.tertiary,re=useSquircle(V,B,Z),le=!0===l||hasFieldText(l),se=le&&!u,ne=I.colors.field.borderError,ae=I.colors.border.width,de=hasFieldText(o),ce=le?l:r,ue=hasFieldText(ce),me=_jsxs(View,{ref:t,accessibilityRole:"radiogroup",accessibilityLabel:b??("string"==typeof o?o:void 0),testID:j,style:[H.track,{...T?{minHeight:F.height+D}:{height:F.height},opacity:u?.55:1,alignSelf:c?"stretch":"flex-start"},V?{borderRadius:B,...smoothCorners,backgroundColor:re.active?"transparent":oe,padding:E}:R?{borderBottomColor:se?ne:I.colors.border.secondary,borderBottomWidth:StyleSheet.hairlineWidth}:null,y,S],onLayout:re.onLayout,children:[re.active&&re.size?_jsx(SquircleFill,{width:re.size.width,height:re.size.height,radius:B,fill:oe,stroke:se?ne:void 0,strokeWidth:ae}):null,_jsxs(View,{style:H.row,children:[U>0?_jsx(Animated.View,{pointerEvents:"none",style:[H.thumb,V?T?{top:0,bottom:0}:{top:0,height:F.height-2*E}:A?{top:P,bottom:P}:{bottom:0,height:W},{width:U,borderRadius:te,...smoothCorners,backgroundColor:ee,transform:[{translateX:J}]},z]}):null,i.map(e=>{const t=e.value===w,i=t?ie:I.colors.text.tertiary,o=renderSlotIcon(e.icon,{color:i,size:F.iconSize,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})=>[H.segment,T?H.segmentMultiline:null,{paddingHorizontal:F.paddingHorizontal,opacity:e&&!t?.7:1},x],children:[o?_jsx(View,{style:H.segmentIcon,children:o}):null,_jsx(Text,{style:[H.segmentLabel,T?H.segmentLabelMultiline:null,{color:i,fontSize:F.fontSize,fontWeight:t?I.typography.fontWeight.semibold:I.typography.fontWeight.medium},v,C],numberOfLines:M,children:e.label})]},String(e.value))})]}),!se||R||re.active?null:_jsx(View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{borderWidth:ae,borderColor:ne,borderRadius:V?B:G,...smoothCorners}]})]});return de||ue?_jsxs(View,{style:{alignSelf:c?"stretch":"flex-start"},children:[de?_jsx(FieldLabel,{size:d,children:o}):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:6},segmentMultiline:{paddingVertical:6},segmentLabel:{includeFontPadding:!1},segmentLabelMultiline:{flexShrink:1,textAlign:"center"}});export{SegmentedControl};export default SegmentedControl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useMemo,useState}from"react";import{StyleSheet,Text,View}from"react-native";import{useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Chevron}from"../FieldBase/Chevron.js";import{FieldBase,FieldLabel,FieldMessage,fieldTextAsString,hasFieldText,RequiredMark,resolveFieldSize,resolveFieldTextStyle,resolveVariantColors}from"../FieldBase/FieldBase.js";import{NotationInkContext}from"../Notation/Notation.js";import{OptionSheet}from"../OptionSheet/OptionSheet.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const sameSelectValue=(e,t)=>String(e)===String(t),containsValue=(e,t)=>e.some(e=>sameSelectValue(e,t)),Select=forwardRef((e,t)=>{const{options:l,getOptionLabel:i,getOptionValue:o,getOptionDisabled:r,getOptionDescription:n,getOptionIcon:s,placeholder:a,searchable:
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useMemo,useState}from"react";import{StyleSheet,Text,View}from"react-native";import{useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Chevron}from"../FieldBase/Chevron.js";import{FieldBase,FieldLabel,FieldMessage,fieldTextAsString,hasFieldText,RequiredMark,resolveFieldSize,resolveFieldTextStyle,resolveVariantColors}from"../FieldBase/FieldBase.js";import{NotationInkContext}from"../Notation/Notation.js";import{OptionSheet}from"../OptionSheet/OptionSheet.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const sameSelectValue=(e,t)=>String(e)===String(t),containsValue=(e,t)=>e.some(e=>sameSelectValue(e,t)),Select=forwardRef((e,t)=>{const{options:l,getOptionLabel:i,getOptionValue:o,getOptionDisabled:r,getOptionDescription:n,getOptionIcon:s,placeholder:a,onOpenChange:d,searchable:c=!1,haptic:u,label:p,help:f,title:S,required:h=!1,error:x,helperText:g,prefix:b,numberOfLines:m=1,disabled:v=!1,size:y="md",variant:C,leftIcon:j,rightIcon:F,chevronColor:O,chevronSize:k,borderRadius:z,accessibilityLabel:T,labelStyle:V,style:_,triggerStyle:I,textStyle:H,optionStyle:R,selectedOptionStyle:w,optionTextStyle:L,selectedOptionTextStyle:M,testID:N}=e,D=!0===e.multi,P=useCallback(e=>i?i(e):e.label??"",[i]),B=useCallback(e=>o?o(e):e.value,[o]),q=useCallback(e=>r?r(e):!0===e.disabled,[r]),A=useCallback(e=>n?n(e):e.description,[n]),E=useCallback(e=>s?s(e):e.icon,[s]),$=useTheme(),G=useMemo(()=>buildStyles($),[$]),J=resolveFieldSize($,y),K=resolveFieldTextStyle($,{disabled:v}),Q=C??$.components.select?.defaultVariant??$.components.field?.defaultVariant??"outlined",U=useMemo(()=>{const e=$.components.select?.fillColors?.[Q];if(!e)return;const t={};return void 0!==e.idleEmpty&&(t.backgroundIdleEmpty=e.idleEmpty),void 0!==e.idleFilled&&(t.backgroundIdleFilled=e.idleFilled),void 0!==e.focus&&(t.backgroundFocused=e.focus),void 0!==e.error&&(t.backgroundError=e.error),void 0!==e.disabled&&(t.backgroundDisabled=e.disabled),Object.keys(t).length>0?t:void 0},[$.components.select?.fillColors,Q]),W=z??$.components.select?.borderRadius,[X,Y]=useState(!1),Z=useCallback(t=>{if(D){const l=e.value??[];return containsValue(l,t)}return null!=e.value&&sameSelectValue(e.value,t)},[D,e.value]),ee=useMemo(()=>{if(D){const t=e.value??[];return l.filter(e=>containsValue(t,B(e)))}const t=e.value;if(null==t)return[];const i=l.find(e=>sameSelectValue(B(e),t));return i?[i]:[]},[D,l,e.value,B]),te=useCallback(()=>{if(v)return;const e=resolveHaptic(u,"selection");e&&triggerHaptic(e),Y(!0)},[v,u]),le=useCallback(()=>{Y(!1)},[]),ie=useCallback(t=>{if(q(t))return;const l=B(t),i=resolveHaptic(u,"selection");if(i&&triggerHaptic(i),D){const t=e.value??[],i=containsValue(t,l)?t.filter(e=>!sameSelectValue(e,l)):[...t,l];return void e.onChange(i)}e.onChange(l),le()},[D,e,le,q,B,u]),oe=0===ee.length?a??"Select…":ee.map(e=>P(e)).join(", "),re=0===ee.length,ne=!0===x||hasFieldText(x),se=hasFieldText(p),ae=fieldTextAsString(p),de=Math.round(1.4*J.fontSize),ce=useMemo(()=>({fontSize:J.fontSize,color:K.placeholderColor}),[J.fontSize,K.placeholderColor]),ue={color:v?$.colors.field.iconDisabled:X?$.colors.field.iconFocused:$.colors.field.icon,size:J.iconSize,disabled:v,focused:X,error:ne},pe=0===ee.length?a??"No selection":`Selected: ${ee.map(e=>P(e)).join(", ")}`,fe=T??`${ae??"Select"}. ${pe}`;return _jsxs(View,{style:[G.container,_],testID:N,children:[se?_jsx(FieldLabel,{size:y,required:h,help:f,style:V,children:p}):null,_jsx(View,{ref:t,collapsable:!1,children:_jsxs(FieldBase,{size:y,variant:Q,disabled:v,error:ne,filled:ee.length>0,onPress:te,borderRadius:W,fillOverrides:U,paddingHorizontal:"underline"===Q?0:void 0,accessibilityRole:"button",accessibilityLabel:fe,accessibilityState:{disabled:v,expanded:X},"aria-disabled":v,"aria-expanded":X,style:I,slotAlign:1===m?"center":"top",slotLineHeight:1===m?void 0:de,leading:j?_jsx(View,{children:renderSlotIcon(j,ue)}):null,trailing:F?_jsx(View,{children:renderSlotIcon(F,ue)}):_jsx(Chevron,{color:O??(v?$.colors.text.disabled:$.colors.text.tertiary),size:k??J.iconSize,open:X,style:G.chevron}),children:[hasFieldText(b)?"string"==typeof b||"number"==typeof b?_jsx(Text,{style:[G.prefix,{color:K.placeholderColor,fontSize:J.fontSize,lineHeight:1===m?void 0:de,marginRight:$.spacing.xs}],children:b}):_jsx(View,{style:[G.prefixNode,{minHeight:1===m?void 0:de,justifyContent:"center",marginRight:$.spacing.xs}],children:_jsx(Text,{style:[G.prefix,{color:K.placeholderColor,fontSize:J.fontSize,lineHeight:1===m?void 0:de}],children:_jsx(NotationInkContext.Provider,{value:ce,children:b})})}):null,_jsxs(Text,{style:[G.triggerText,{color:re?K.placeholderColor:K.color,fontSize:J.fontSize,lineHeight:1===m?void 0:de,...K.weightStyle},H],numberOfLines:m,children:[oe,re&&h&&!se?_jsx(RequiredMark,{}):null]})]})}),_jsx(FieldMessage,{size:y,error:ne,text:ne?x:g}),_jsx(OptionSheet,{open:X,onClose:le,onOpenChange:d,title:S??ae,accessibilityLabel:ae??(se?S:void 0)??a??"Options",options:l,labelOf:P,getValue:B,disabledOf:q,descriptionOf:A,iconOf:E,isSelected:Z,onSelect:ie,multi:D,searchable:c,optionStyle:R,selectedOptionStyle:w,optionTextStyle:L,selectedOptionTextStyle:M,searchSelectionColor:resolveVariantColors($,Q,U).borderFocusedRepresentative})]})});Select.displayName="Select";const buildStyles=e=>StyleSheet.create({container:{width:"100%"},label:{includeFontPadding:!1},triggerText:{flex:1,includeFontPadding:!1},errorText:{includeFontPadding:!1},prefix:{flexShrink:0,includeFontPadding:!1},prefixNode:{flexShrink:0},chevron:{marginLeft:8}});export{Select};export default Select;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Easing,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{ChoiceText,hasChoiceDetail}from"../FieldBase/ChoiceText.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const sizeMap={sm:{trackWidth:42,trackHeight:26,thumbSize:22,padding:2},md:{trackWidth:51,trackHeight:31,thumbSize:27,padding:2},lg:{trackWidth:60,trackHeight:36,thumbSize:32,padding:2}},toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"error":return e.colors.error;default:return e.colors.primary}},Switch=forwardRef((e,t)=>{const{value:i,defaultValue:s,onChange:r,disabled:a=!1,size:o="md",tone:n="primary",label:
|
|
1
|
+
"use strict";import{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Easing,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{ChoiceText,hasChoiceDetail}from"../FieldBase/ChoiceText.js";import{fieldTextAsString,hasFieldText}from"../FieldBase/FieldBase.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const sizeMap={sm:{trackWidth:42,trackHeight:26,thumbSize:22,padding:2},md:{trackWidth:51,trackHeight:31,thumbSize:27,padding:2},lg:{trackWidth:60,trackHeight:36,thumbSize:32,padding:2}},toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"error":return e.colors.error;default:return e.colors.primary}},Switch=forwardRef((e,t)=>{const{value:i,defaultValue:s,onChange:r,disabled:a=!1,size:o="md",tone:n="primary",label:l,description:c,error:d,labelLines:u,layout:h="inline",accessibilityLabel:m,haptic:p="selection",bounce:b=!1,style:f,containerStyle:g,trackStyle:y,thumbStyle:x,testID:w,...S}=e,[C,j]=useControllableState({value:i,defaultValue:s??!1,onChange:r}),k=useTheme(),R={...sizeMap[o],...k.components.switch?.[o]??{}},T=k.components.switch?.thumbColor??"#FFFFFF",v=useMemo(()=>buildStyles(k),[k]),A="dark"===k.mode?k.colors.secondary:k.colors.surface.disabled,V=toneColor(k,n),F=useRef(createAnimatedValue(C?1:0)).current;useEffect(()=>{const e=Animated.spring(F,{toValue:C?1:0,damping:k.motion.spring.snappy.damping,stiffness:k.motion.spring.snappy.stiffness,mass:k.motion.spring.snappy.mass,useNativeDriver:!0});return e.start(),()=>e.stop()},[C,F,k.motion.spring.snappy]);const H=useRef(createAnimatedValue(C?1:0)).current;useEffect(()=>{const e=Animated.timing(H,{toValue:C?1:0,duration:k.motion.duration.fast,easing:Easing.out(Easing.ease),useNativeDriver:!1});return e.start(),()=>e.stop()},[C,H,k.motion.duration.fast]);const D=R.padding,_=R.trackWidth-R.thumbSize-R.padding,z=F.interpolate({inputRange:[0,1],outputRange:[D,_]}),E=H.interpolate({inputRange:[0,1],outputRange:[A,V]}),L=useRef(createAnimatedValue(1)).current,P=useRef(!0);useEffect(()=>{if(!b)return;if(P.current)return void(P.current=!1);const e=Animated.sequence([Animated.spring(L,{toValue:1.15,damping:10,stiffness:220,mass:1,useNativeDriver:!0}),Animated.spring(L,{toValue:1,damping:14,stiffness:240,mass:1,useNativeDriver:!0})]);return e.start(),()=>e.stop()},[C,b,L]);const handlePress=e=>{a||(!1!==p&&triggerHaptic(p),j(!C),S.onPressOut?.(e))},W=m??fieldTextAsString(l),I=hasFieldText(l)||hasChoiceDetail(c,d),N=(!0===d||hasFieldText(d))&&!C&&!a,M="row"===h&&I,B=_jsxs(Animated.View,{style:[v.track,{width:R.trackWidth,height:R.trackHeight,borderRadius:R.trackHeight/2,...smoothCorners,backgroundColor:E},y],children:[N?_jsx(View,{pointerEvents:"none",style:[v.errorRing,{borderRadius:R.trackHeight/2,...smoothCorners,borderWidth:k.colors.border.width,borderColor:k.colors.field.borderError}]}):null,_jsx(Animated.View,{style:[v.thumb,k.shadows.sm,{backgroundColor:T,width:R.thumbSize,height:R.thumbSize,borderRadius:R.thumbSize/2,...smoothCorners,transform:[{translateX:z},{scale:L}]},x]})]});if(M)return _jsxs(Pressable,{ref:t,onPress:handlePress,disabled:a,accessibilityRole:"switch",accessibilityLabel:W,accessibilityHint:S.accessibilityHint??fieldTextAsString(c),accessibilityState:{checked:C,disabled:a},"aria-checked":C,"aria-disabled":a,testID:w,...S,style:({pressed:e})=>[v.row,v.spreadRow,hasChoiceDetail(c,d)?v.rowTop:null,{opacity:a?.55:e?.9:1},g,f],children:[_jsx(ChoiceText,{label:l,description:c,error:d,disabled:a,labelLines:u||void 0,descriptionLines:u||void 0,style:v.spreadText}),B]});const q=_jsx(Pressable,{ref:t,onPress:handlePress,disabled:a,accessibilityRole:"switch",accessibilityLabel:W,accessibilityHint:S.accessibilityHint??fieldTextAsString(c),accessibilityState:{checked:C,disabled:a},"aria-checked":C,"aria-disabled":a,testID:w,hitSlop:8,...S,style:({pressed:e})=>[{opacity:a?.55:e?.9:1},I?null:f],children:B});return I?_jsxs(View,{style:[v.row,hasChoiceDetail(c,d)?v.rowTop:null,g,f],children:[q,_jsx(ChoiceText,{label:l,description:c,error:d,disabled:a,labelLines:u||void 0,descriptionLines:u||void 0,style:v.text})]}):g?_jsx(View,{style:g,children:q}):q});Switch.displayName="Switch";const buildStyles=e=>StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},track:{justifyContent:"center"},thumb:{position:"absolute",top:2},errorRing:{...StyleSheet.absoluteFill},rowTop:{alignItems:"flex-start"},text:{marginLeft:10},spreadRow:{minHeight:44,justifyContent:"space-between"},spreadText:{flex:1,marginRight:12}});export{Switch};export default Switch;
|
|
@@ -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{Chip}from"../Chip/index.js";import{FieldBase,hasFieldText}from"../FieldBase/index.js";import{
|
|
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{Chip}from"../Chip/index.js";import{FieldBase,FieldLabel,FieldMessage,hasFieldText}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:r,onChange:i,placeholder:a,label:l,helperText:o,error:n,required:u,disabled:c=!1,size:d="md",variant:p,maxTags:m,unique:f=!0,transform:x,separators:g=[","],haptic:h,style:b,testID:y}=e,C=useTheme(),j=useMemo(()=>buildStyles(C),[C]),[v,S]=useControllableState({value:s,defaultValue:r??[],onChange:i}),[T,F]=useState(""),[w,k]=useState(!1),I=useRef(null),_=useMemo(()=>mergeRefs(I,t),[t]),z=useCallback(()=>{c||I.current?.focus()},[c]),H="number"==typeof m&&v.length>=m,R=!0===n||hasFieldText(n),V=useCallback(e=>{const t=x?x(e.trim()):e.trim();if(!t)return;if(H)return;if(f&&v.some(e=>e.toLowerCase()===t.toLowerCase()))return void F("");S([...v,t]),F("");const s=resolveHaptic(h,"selection");s&&triggerHaptic(s)},[H,h,S,v,x,f]),B=useCallback(e=>{const t=v.filter((t,s)=>s!==e);S(t);const s=resolveHaptic(h,"selection");s&&triggerHaptic(s)},[h,S,v]),L=useCallback(e=>{const t=g.find(t=>t.length>0&&e.includes(t));if(t){const[s]=e.split(t);return void V(s)}F(e)},[V,g]),M=useCallback(e=>{c||"Backspace"===e.nativeEvent.key&&""===T&&v.length>0&&B(v.length-1)},[c,T,B,v.length]),D=_jsx(FieldBase,{size:d,variant:p,focused:w,disabled:c,error:R,filled:v.length>0||T.length>0,onPress:z,pressFeedback:!1,style:b,children:_jsxs(View,{style:j.wrap,children:[v.map((e,t)=>_jsx(Chip,{label:e,size:"sm",onClose:c?void 0:()=>B(t),haptic:h},`${e}-${t}`)),_jsx(TextInput,{ref:_,value:T,onChangeText:L,onKeyPress:M,onSubmitEditing:()=>V(T),onFocus:()=>k(!0),onBlur:()=>{k(!1),V(T)},editable:!c&&!H,placeholder:H?void 0:a,placeholderTextColor:C.colors.text.tertiary,blurOnSubmit:!1,returnKeyType:"done",accessibilityLabel:l??a,style:[j.input,{color:C.colors.text.primary,fontSize:C.typography.fontSize.base}],testID:y?`${y}-input`:void 0})]})});return _jsxs(View,{testID:y,children:[l?_jsx(FieldLabel,{size:d,required:u,children:l}):null,D,_jsx(FieldMessage,{size:d,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.spacing.xs,paddingVertical:e.spacing.xs},input:{...fontFor(e,"normal"),flexGrow:1,minWidth:80,padding:0}});export default TagInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{Accordion,AccordionGroup}from"./Accordion/index.js";export{AmountSlider}from"./AmountSlider/index.js";export{AnimatePresence}from"./AnimatePresence/index.js";export{AppBar}from"./AppBar/index.js";export{AsyncBlock}from"./AsyncBlock/index.js";export{AuthedImage,authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./AuthedImage/index.js";export{Autocomplete}from"./Autocomplete/index.js";export{Avatar,AvatarGroup}from"./Avatar/index.js";export{Badge}from"./Badge/index.js";export{Banner}from"./Banner/index.js";export{BarChart}from"./BarChart/index.js";export{BottomNavigation}from"./BottomNavigation/index.js";export{BottomSheet,useBottomSheet,useSheetSwap}from"./BottomSheet/index.js";export{Box,Row,Spacer,Stack}from"./Box/index.js";export{Button}from"./Button/index.js";export{Calendar}from"./Calendar/index.js";export{Card}from"./Card/index.js";export{Carousel}from"./Carousel/index.js";export{Checkbox}from"./Checkbox/index.js";export{Chip}from"./Chip/index.js";export{ChoiceGroup}from"./ChoiceGroup/index.js";export{Composer}from"./Composer/index.js";export{Confetti}from"./Confetti/index.js";export{DatePicker}from"./DatePicker/index.js";export{DateRangePicker}from"./DateRangePicker/index.js";export{DateSeparator,DEFAULT_DATE_SEPARATOR_LABELS,dayLabel}from"./DateSeparator/index.js";export{cleanDecimalText,DecimalInput,parseDecimalText}from"./DecimalInput/index.js";export{Descriptions}from"./Descriptions/index.js";export{Dialog}from"./Dialog/index.js";export{Divider}from"./Divider/index.js";export{Drawer}from"./Drawer/index.js";export{EmptyState}from"./EmptyState/index.js";export{ErrorBoundary,useErrorHandler,withErrorBoundary}from"./ErrorBoundary/index.js";export{FilePicker,formatFileSize}from"./FilePicker/index.js";export{FileViewer}from"./FileViewer/index.js";export{FloatingActionButton,FloatingActionButtonGroup}from"./FloatingActionButton/index.js";export{ForceUpdateDialog}from"./ForceUpdateDialog/index.js";export{FormField}from"./FormField/index.js";export{IconBadge}from"./IconBadge/index.js";export{IconButton}from"./IconButton/index.js";export{ImageGallery}from"./ImageGallery/index.js";export{InlineSelect}from"./InlineSelect/index.js";export{Input}from"./Input/index.js";export{KeyboardAwareScrollView}from"./KeyboardAwareScrollView/index.js";export{KeyboardToolbar}from"./KeyboardToolbar/index.js";export{ListItem}from"./ListItem/index.js";export{LoaderOverlay,loader,useLoader}from"./LoaderOverlay/index.js";export{Markdown}from"./Markdown/index.js";export{Menu}from"./Menu/index.js";export{DEFAULT_MESSAGE_BUBBLE_LABELS,MessageBubble}from"./MessageBubble/index.js";export{DEFAULT_MESSAGE_LIST_LABELS,MessageList}from"./MessageList/index.js";export{MODAL_DISMISS_GRACE_MS,Modal}from"./Modal/index.js";export{Notation,parseNotation,sym}from"./Notation/index.js";export{NumberInput}from"./NumberInput/index.js";export{OnboardingPager}from"./OnboardingPager/index.js";export{OptionSheet}from"./OptionSheet/index.js";export{OTPInput}from"./OTPInput/index.js";export{PaymentResult}from"./PaymentResult/index.js";export{ALL_CALLING_CODES,DEFAULT_CALLING_CODES,formatE164,PhoneNumberInput,parseE164}from"./PhoneNumberInput/index.js";export{PickerTrigger}from"./PickerTrigger/index.js";export{ProfileCompletion}from"./ProfileCompletion/index.js";export{ProfilePicker}from"./ProfilePicker/index.js";export{ProgressBar}from"./ProgressBar/index.js";export{ProgressRing}from"./ProgressRing/index.js";export{Radio,RadioDot,RadioGroup}from"./Radio/index.js";export{Rating}from"./Rating/index.js";export{Repeater}from"./Repeater/index.js";export{applyMarkdownAction,RichTextEditor}from"./RichTextEditor/index.js";export{ScannerOverlay}from"./ScannerOverlay/index.js";export{SearchBar,useRecentSearches}from"./SearchBar/index.js";export{SectionHeader}from"./SectionHeader/index.js";export{SegmentedControl}from"./SegmentedControl/index.js";export{Select}from"./Select/index.js";export{SignaturePad}from"./SignaturePad/index.js";export{Skeleton,SkeletonCircle,SkeletonClockProvider,SkeletonContent,SkeletonList,SkeletonProvider,SkeletonSkip,SkeletonText,useReduceMotion,useSkeletonClock,useSkeletonDefaults}from"./Skeleton/index.js";export{Slider}from"./Slider/index.js";export{SliderField}from"./SliderField/index.js";export{SlideToConfirm}from"./SlideToConfirm/index.js";export{Sparkline}from"./Sparkline/index.js";export{Spinner}from"./Spinner/index.js";export{StatTile}from"./StatTile/index.js";export{StatusBadge}from"./StatusBadge/index.js";export{Stepper}from"./Stepper/index.js";export{Swipeable}from"./Swipeable/index.js";export{Switch}from"./Switch/index.js";export{Tabs}from"./Tabs/index.js";export{TagInput}from"./TagInput/index.js";export{Text}from"./Text/index.js";export{Timeline}from"./Timeline/index.js";export{TimePicker}from"./TimePicker/index.js";export{Toast,ToastHost,ToastProvider,toast,useToast}from"./Toast/index.js";export{Tooltip}from"./Tooltip/index.js";export{Tour}from"./Tour/index.js";export{TypingIndicator}from"./TypingIndicator/index.js";export{WheelPicker}from"./WheelPicker/index.js";export{ZoomableImage}from"./ZoomableImage/index.js";
|
|
1
|
+
"use strict";export{Accordion,AccordionGroup}from"./Accordion/index.js";export{AmountSlider}from"./AmountSlider/index.js";export{AnimatePresence}from"./AnimatePresence/index.js";export{AppBar}from"./AppBar/index.js";export{AsyncBlock}from"./AsyncBlock/index.js";export{AuthedImage,authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./AuthedImage/index.js";export{Autocomplete}from"./Autocomplete/index.js";export{Avatar,AvatarGroup}from"./Avatar/index.js";export{Badge}from"./Badge/index.js";export{Banner}from"./Banner/index.js";export{BarChart}from"./BarChart/index.js";export{BottomNavigation}from"./BottomNavigation/index.js";export{BottomSheet,useBottomSheet,useSheetSwap}from"./BottomSheet/index.js";export{Box,Row,Spacer,Stack}from"./Box/index.js";export{Button}from"./Button/index.js";export{Calendar}from"./Calendar/index.js";export{Card}from"./Card/index.js";export{Carousel}from"./Carousel/index.js";export{Checkbox}from"./Checkbox/index.js";export{Chip}from"./Chip/index.js";export{ChoiceGroup}from"./ChoiceGroup/index.js";export{Composer}from"./Composer/index.js";export{Confetti}from"./Confetti/index.js";export{DatePicker}from"./DatePicker/index.js";export{DateRangePicker}from"./DateRangePicker/index.js";export{DateSeparator,DEFAULT_DATE_SEPARATOR_LABELS,dayLabel}from"./DateSeparator/index.js";export{cleanDecimalText,DecimalInput,parseDecimalText}from"./DecimalInput/index.js";export{Descriptions}from"./Descriptions/index.js";export{Dialog}from"./Dialog/index.js";export{Divider}from"./Divider/index.js";export{Drawer}from"./Drawer/index.js";export{EmptyState}from"./EmptyState/index.js";export{ErrorBoundary,useErrorHandler,withErrorBoundary}from"./ErrorBoundary/index.js";export{FilePicker,formatFileSize}from"./FilePicker/index.js";export{FileViewer}from"./FileViewer/index.js";export{FloatingActionButton,FloatingActionButtonGroup}from"./FloatingActionButton/index.js";export{ForceUpdateDialog}from"./ForceUpdateDialog/index.js";export{FormField}from"./FormField/index.js";export{IconBadge}from"./IconBadge/index.js";export{IconButton}from"./IconButton/index.js";export{ImageGallery}from"./ImageGallery/index.js";export{InlineSelect}from"./InlineSelect/index.js";export{Input}from"./Input/index.js";export{KeyboardAwareScrollView}from"./KeyboardAwareScrollView/index.js";export{KeyboardToolbar}from"./KeyboardToolbar/index.js";export{ListItem}from"./ListItem/index.js";export{LoaderOverlay,loader,useLoader}from"./LoaderOverlay/index.js";export{Markdown}from"./Markdown/index.js";export{Menu}from"./Menu/index.js";export{DEFAULT_MESSAGE_BUBBLE_LABELS,MessageBubble}from"./MessageBubble/index.js";export{DEFAULT_MESSAGE_LIST_LABELS,MessageList}from"./MessageList/index.js";export{MODAL_DISMISS_GRACE_MS,Modal}from"./Modal/index.js";export{Notation,parseNotation,sym}from"./Notation/index.js";export{NumberInput}from"./NumberInput/index.js";export{OnboardingPager}from"./OnboardingPager/index.js";export{OptionSheet}from"./OptionSheet/index.js";export{OTPInput}from"./OTPInput/index.js";export{PaymentResult}from"./PaymentResult/index.js";export{PermissionPrompt,usePermissionPrompt}from"./PermissionPrompt/index.js";export{ALL_CALLING_CODES,DEFAULT_CALLING_CODES,formatE164,PhoneNumberInput,parseE164}from"./PhoneNumberInput/index.js";export{PickerTrigger}from"./PickerTrigger/index.js";export{ProfileCompletion}from"./ProfileCompletion/index.js";export{ProfilePicker}from"./ProfilePicker/index.js";export{ProgressBar}from"./ProgressBar/index.js";export{ProgressRing}from"./ProgressRing/index.js";export{Radio,RadioDot,RadioGroup}from"./Radio/index.js";export{Rating}from"./Rating/index.js";export{Repeater}from"./Repeater/index.js";export{applyMarkdownAction,RichTextEditor}from"./RichTextEditor/index.js";export{ScannerOverlay}from"./ScannerOverlay/index.js";export{SearchBar,useRecentSearches}from"./SearchBar/index.js";export{SectionHeader}from"./SectionHeader/index.js";export{SegmentedControl}from"./SegmentedControl/index.js";export{Select}from"./Select/index.js";export{SignaturePad}from"./SignaturePad/index.js";export{Skeleton,SkeletonCircle,SkeletonClockProvider,SkeletonContent,SkeletonList,SkeletonProvider,SkeletonSkip,SkeletonText,useReduceMotion,useSkeletonClock,useSkeletonDefaults}from"./Skeleton/index.js";export{Slider}from"./Slider/index.js";export{SliderField}from"./SliderField/index.js";export{SlideToConfirm}from"./SlideToConfirm/index.js";export{Sparkline}from"./Sparkline/index.js";export{Spinner}from"./Spinner/index.js";export{StatTile}from"./StatTile/index.js";export{StatusBadge}from"./StatusBadge/index.js";export{Stepper}from"./Stepper/index.js";export{Swipeable}from"./Swipeable/index.js";export{Switch}from"./Switch/index.js";export{Tabs}from"./Tabs/index.js";export{TagInput}from"./TagInput/index.js";export{Text}from"./Text/index.js";export{Timeline}from"./Timeline/index.js";export{TimePicker}from"./TimePicker/index.js";export{Toast,ToastHost,ToastProvider,toast,useToast}from"./Toast/index.js";export{Tooltip}from"./Tooltip/index.js";export{Tour}from"./Tour/index.js";export{TypingIndicator}from"./TypingIndicator/index.js";export{WheelPicker}from"./WheelPicker/index.js";export{ZoomableImage}from"./ZoomableImage/index.js";
|
|
@@ -16,7 +16,10 @@ export interface CheckboxProps extends Omit<PressableProps, 'style' | 'children'
|
|
|
16
16
|
label?: React.ReactNode;
|
|
17
17
|
/** Secondary line under the label. A string or a node; a node description adds nothing to the accessibility hint. */
|
|
18
18
|
description?: React.ReactNode;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Error line under the label (and description); also draws the box in the error colour. A string
|
|
21
|
+
* or a node; `true` shows the error state without a message.
|
|
22
|
+
*/
|
|
20
23
|
error?: React.ReactNode;
|
|
21
24
|
/**
|
|
22
25
|
* Drawn beside the label, after it (a glossary info button, say). It sits
|
|
@@ -25,7 +25,7 @@ export interface FileViewerProps {
|
|
|
25
25
|
accessibilityLabel?: string;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Renders a PDF via our own native rasterizer (
|
|
28
|
+
* Renders a PDF via our own native rasterizer (Core Graphics on iOS, PdfRenderer on
|
|
29
29
|
* Android) — no third-party PDF dependency. Pages are paged through a plain
|
|
30
30
|
* `ScrollView` with manual windowed mounting (render the visible page ±
|
|
31
31
|
* `RENDER_WINDOW`), not a `FlatList` — a `VirtualizedList`-based component
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { ColorValue } from 'react-native';
|
|
2
|
+
import type { ColorValue, StyleProp, TextStyle } from 'react-native';
|
|
3
3
|
export interface NotationRun {
|
|
4
4
|
text: string;
|
|
5
5
|
/** The subscript that follows `text`, when the run is a symbol. */
|
|
@@ -24,8 +24,8 @@ export interface NotationProps {
|
|
|
24
24
|
/** Follows the symbol after a space. */
|
|
25
25
|
desc?: string;
|
|
26
26
|
/**
|
|
27
|
-
* Subscript ink. Inside a field label it defaults to
|
|
28
|
-
* `colors.text.primary`; pass the parent's colour when it differs.
|
|
27
|
+
* Subscript ink. Inside a field's or choice's label or message line it defaults to that line's
|
|
28
|
+
* ink, elsewhere to `colors.text.primary`; pass the parent's colour when it differs.
|
|
29
29
|
*/
|
|
30
30
|
color?: string;
|
|
31
31
|
testID?: string;
|
|
@@ -37,8 +37,14 @@ export interface NotationInk {
|
|
|
37
37
|
fontSize: number;
|
|
38
38
|
color: ColorValue;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Provided by a field's text lines (FieldLabel, the floating label, FieldMessage, the FormField
|
|
42
|
+
* label, helper and error, and the Checkbox, Radio and Switch label, description and error) so a
|
|
43
|
+
* subscript inside one scales and inks with that line.
|
|
44
|
+
*/
|
|
41
45
|
export declare const NotationInkContext: React.Context<NotationInk | null>;
|
|
46
|
+
/** The ink for a line's provider: the line's own `style` size and colour win over its defaults. */
|
|
47
|
+
export declare const useNotationInk: (style: StyleProp<TextStyle>, fontSize: number, color: ColorValue) => NotationInk;
|
|
42
48
|
/** A symbol of a standard with its subscript drawn small and lowered below the baseline. */
|
|
43
49
|
export declare const Notation: React.FC<NotationProps>;
|
|
44
50
|
/** A symbol as the standard prints it: `sym('C', 'IP')` is C with a small IP, then `desc` if given. */
|
|
@@ -45,6 +45,8 @@ export interface OptionSheetProps {
|
|
|
45
45
|
* earlier, iOS attaches it to the closing window and dismisses it with it.
|
|
46
46
|
*/
|
|
47
47
|
onAfterClose?: () => void;
|
|
48
|
+
/** Called with `true` when `open` turns on and `false` when it turns off, not again while it stays the same. */
|
|
49
|
+
onOpenChange?: (open: boolean) => void;
|
|
48
50
|
/** Sheet heading. Also the modal's a11y label fallback. */
|
|
49
51
|
title?: string;
|
|
50
52
|
options: ReadonlyArray<unknown>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PermissionKind, PermissionStatus } from '@webority/mobile-core/permissions';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import type { HapticType } from '../../utils/hapticUtils';
|
|
5
|
+
import type { SlotIcon } from '../AppIcon/slotIcon';
|
|
6
|
+
export interface PermissionPromptFallback {
|
|
7
|
+
/** Names the other way to do the job ("Enter address instead"). */
|
|
8
|
+
label: string;
|
|
9
|
+
onPress: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface PermissionPromptProps {
|
|
12
|
+
kind: PermissionKind;
|
|
13
|
+
/** What the feature is ("Scan a receipt"). Read first by a screen reader. */
|
|
14
|
+
title: string;
|
|
15
|
+
/** One sentence: what the app does with the access, ending in a full stop. */
|
|
16
|
+
reason: string;
|
|
17
|
+
/** An AppIcon name or any node, drawn in a tinted disc above the title. */
|
|
18
|
+
icon?: SlotIcon;
|
|
19
|
+
/** The status each time it settles: after the first check finds nothing to ask, and after each request or Cancel. */
|
|
20
|
+
onResult: (status: PermissionStatus) => void;
|
|
21
|
+
/** The way to carry on without the access, shown in the unavailable state. */
|
|
22
|
+
fallback?: PermissionPromptFallback;
|
|
23
|
+
/** Haptic on each button press. Default `'selection'`. */
|
|
24
|
+
haptic?: HapticType | false;
|
|
25
|
+
style?: StyleProp<ViewStyle>;
|
|
26
|
+
testID?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Explains why the app needs a permission before the system prompt, in the way
|
|
30
|
+
* each platform's review accepts. iOS gets one Continue button that opens the
|
|
31
|
+
* system prompt, with no way to leave first (App Review rejects a "Not now").
|
|
32
|
+
* Android asks straight away the first time and explains only after one
|
|
33
|
+
* refusal, with Cancel. Once access is refused or the device lacks it, the
|
|
34
|
+
* prompt becomes an inline state with the fallback, and Open Settings only
|
|
35
|
+
* when it was already off on arrival, never straight after a refusal.
|
|
36
|
+
*/
|
|
37
|
+
export declare const PermissionPrompt: React.FC<PermissionPromptProps>;
|
|
38
|
+
export default PermissionPrompt;
|
|
39
|
+
//# sourceMappingURL=PermissionPrompt.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { PermissionPromptFallback, PermissionPromptProps } from './PermissionPrompt';
|
|
2
|
+
export { default, PermissionPrompt } from './PermissionPrompt';
|
|
3
|
+
export type { PermissionPromptView, UsePermissionPromptOptions, UsePermissionPromptResult } from './usePermissionPrompt';
|
|
4
|
+
export { usePermissionPrompt } from './usePermissionPrompt';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PermissionKind, PermissionStatus } from '@webority/mobile-core/permissions';
|
|
2
|
+
/**
|
|
3
|
+
* - `pending`: the first status read, or on Android the system prompt asked straight away.
|
|
4
|
+
* - `explain`: the explainer with Continue (and Cancel on Android).
|
|
5
|
+
* - `unavailable`: the feature cannot work; offer the fallback.
|
|
6
|
+
* - `authorized`: granted or limited; the feature can run.
|
|
7
|
+
*/
|
|
8
|
+
export type PermissionPromptView = 'pending' | 'explain' | 'unavailable' | 'authorized';
|
|
9
|
+
export interface UsePermissionPromptOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Called each time the status settles with no question left open: when the first
|
|
12
|
+
* check finds nothing to ask (granted, limited, blocked or unavailable), and after
|
|
13
|
+
* each request or Cancel.
|
|
14
|
+
*/
|
|
15
|
+
onResult?: (status: PermissionStatus) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface UsePermissionPromptResult {
|
|
18
|
+
view: PermissionPromptView;
|
|
19
|
+
/** The latest status, `null` until the first check returns. */
|
|
20
|
+
status: PermissionStatus | null;
|
|
21
|
+
/** True while the system prompt is up. */
|
|
22
|
+
requesting: boolean;
|
|
23
|
+
/** Android only: the explainer offers Cancel, as Android requires; iOS and web never do. */
|
|
24
|
+
cancellable: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* True only when the status was already `blocked` when this prompt opened, so
|
|
27
|
+
* Open Settings never appears straight after the person refused.
|
|
28
|
+
*/
|
|
29
|
+
showSettings: boolean;
|
|
30
|
+
/** Shows the system prompt. Resolves the new status, or `null` when one is already up. */
|
|
31
|
+
request: () => Promise<PermissionStatus | null>;
|
|
32
|
+
/** Leaves the explainer for the unavailable state without asking. */
|
|
33
|
+
cancel: () => void;
|
|
34
|
+
openSettings: () => Promise<boolean>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Decides what a permission prompt shows, by platform:
|
|
38
|
+
* - iOS and web explain first whenever a request can still show the system prompt.
|
|
39
|
+
* - Android asks straight away the first time, and explains only after one refusal
|
|
40
|
+
* (`denied`), the case Android's rationale flow covers.
|
|
41
|
+
* - `blocked` or `unavailable` goes to the unavailable state.
|
|
42
|
+
*/
|
|
43
|
+
export declare const usePermissionPrompt: (kind: PermissionKind, { onResult }?: UsePermissionPromptOptions) => UsePermissionPromptResult;
|
|
44
|
+
//# sourceMappingURL=usePermissionPrompt.d.ts.map
|
|
@@ -159,7 +159,10 @@ export interface PhoneNumberInputProps extends Pick<TextInputProps, 'returnKeyTy
|
|
|
159
159
|
labelStyle?: StyleProp<TextStyle>;
|
|
160
160
|
placeholder?: string;
|
|
161
161
|
helperText?: string;
|
|
162
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* The app's own error text, a string or a node; it replaces the built-in invalid-number message.
|
|
164
|
+
* `true` shows the error state and keeps the built-in message; `false` and `''` change nothing.
|
|
165
|
+
*/
|
|
163
166
|
error?: ReactNode;
|
|
164
167
|
/**
|
|
165
168
|
* Text under the field once the typed number is not a real number for the
|
|
@@ -169,7 +172,7 @@ export interface PhoneNumberInputProps extends Pick<TextInputProps, 'returnKeyTy
|
|
|
169
172
|
* a cleared field earns that grace again. Default `'Enter a valid mobile
|
|
170
173
|
* number'` under `validation="mobile"`, else `'Enter a valid number'`;
|
|
171
174
|
* a string replaces the text, `false` turns the message off. Nothing shows
|
|
172
|
-
* under `validation={false}`, and `error` always wins.
|
|
175
|
+
* under `validation={false}`, and an `error` text always wins.
|
|
173
176
|
*/
|
|
174
177
|
invalidMessage?: string | false;
|
|
175
178
|
required?: boolean;
|
|
@@ -8,6 +8,8 @@ export interface RadioGroupContextValue {
|
|
|
8
8
|
selectedValue: RadioValue | undefined;
|
|
9
9
|
onChange: (value: RadioValue) => void;
|
|
10
10
|
disabled: boolean;
|
|
11
|
+
/** The group is in error: every radio draws its empty ring in the error colour. */
|
|
12
|
+
error?: boolean;
|
|
11
13
|
}
|
|
12
14
|
export declare const RadioGroupContext: import("react").Context<RadioGroupContextValue | null>;
|
|
13
15
|
export declare const useRadioGroup: () => RadioGroupContextValue | null;
|
|
@@ -16,10 +18,17 @@ export interface RadioProps extends Omit<PressableProps, 'style' | 'children' |
|
|
|
16
18
|
selected?: boolean;
|
|
17
19
|
onChange?: (value: RadioValue) => void;
|
|
18
20
|
disabled?: boolean;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* A string, or a node for a symbol with a subscript. A node label needs an
|
|
23
|
+
* explicit `accessibilityLabel` (the radio's screen-reader name).
|
|
24
|
+
*/
|
|
25
|
+
label?: ReactNode;
|
|
26
|
+
/** Secondary line under the label. A string or a node; a node description adds nothing to the accessibility hint. */
|
|
27
|
+
description?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Error line under the label (and description); also draws the empty ring in the error colour.
|
|
30
|
+
* A string or a node; `true` shows the error state without a message.
|
|
31
|
+
*/
|
|
23
32
|
error?: ReactNode;
|
|
24
33
|
size?: RadioSize;
|
|
25
34
|
tone?: RadioTone;
|
|
@@ -7,6 +7,11 @@ export interface RadioGroupProps {
|
|
|
7
7
|
onChange?: (value: RadioValue) => void;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* One error line under the group, and every radio's empty ring in the error colour. A string or
|
|
12
|
+
* a node; `true` shows the error state without a message.
|
|
13
|
+
*/
|
|
14
|
+
error?: React.ReactNode;
|
|
10
15
|
accessibilityLabel?: string;
|
|
11
16
|
style?: StyleProp<ViewStyle>;
|
|
12
17
|
testID?: string;
|
|
@@ -46,7 +46,11 @@ export interface SegmentedControlProps {
|
|
|
46
46
|
label?: ReactNode;
|
|
47
47
|
/** Helper line under the control. */
|
|
48
48
|
helperText?: ReactNode;
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Error line under the control, in the error colour, with the control outlined (the underline
|
|
51
|
+
* look recolours its divider). Replaces `helperText`; `true` shows the error state without a
|
|
52
|
+
* message.
|
|
53
|
+
*/
|
|
50
54
|
error?: ReactNode;
|
|
51
55
|
value?: SegmentValue;
|
|
52
56
|
defaultValue?: SegmentValue;
|
|
@@ -34,6 +34,8 @@ interface BaseSelectProps<T = SelectOption> {
|
|
|
34
34
|
/** Defaults to `(o) => (o as SelectOption).icon`. */
|
|
35
35
|
getOptionIcon?: (option: T) => React.ReactNode;
|
|
36
36
|
placeholder?: string;
|
|
37
|
+
/** Called with `true` when the option sheet opens and `false` when it closes. */
|
|
38
|
+
onOpenChange?: (open: boolean) => void;
|
|
37
39
|
searchable?: boolean;
|
|
38
40
|
/**
|
|
39
41
|
* Haptic feedback for interactions. Pass false to disable; pass a HapticType
|
|
@@ -12,10 +12,17 @@ export interface SwitchProps extends Omit<PressableProps, 'style' | 'children' |
|
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
size?: SwitchSize;
|
|
14
14
|
tone?: SwitchTone;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
/**
|
|
16
|
+
* A string, or a node for a symbol with a subscript. A node label needs an
|
|
17
|
+
* explicit `accessibilityLabel` (the switch's screen-reader name).
|
|
18
|
+
*/
|
|
19
|
+
label?: ReactNode;
|
|
20
|
+
/** Secondary line under the label. A string or a node; a node description adds nothing to the accessibility hint. */
|
|
21
|
+
description?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Error line under the label (and description); also outlines the off track in the error colour.
|
|
24
|
+
* A string or a node; `true` shows the error state without a message.
|
|
25
|
+
*/
|
|
19
26
|
error?: ReactNode;
|
|
20
27
|
/**
|
|
21
28
|
* Lines the label (and the description) may take before truncating with an
|
|
@@ -10,6 +10,10 @@ export interface TagInputProps {
|
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
label?: string;
|
|
12
12
|
helperText?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A string or a node puts the field in the error state and shows it below in place of the
|
|
15
|
+
* helper; `true` shows the error state without a message.
|
|
16
|
+
*/
|
|
13
17
|
error?: ReactNode;
|
|
14
18
|
required?: boolean;
|
|
15
19
|
disabled?: boolean;
|
|
@@ -114,6 +114,8 @@ export type { OTPInputProps, OTPInputRef, OTPInputSize } from './OTPInput';
|
|
|
114
114
|
export { OTPInput } from './OTPInput';
|
|
115
115
|
export type { PaymentResultProps, PaymentResultStatus } from './PaymentResult';
|
|
116
116
|
export { PaymentResult } from './PaymentResult';
|
|
117
|
+
export type { PermissionPromptFallback, PermissionPromptProps, PermissionPromptView, UsePermissionPromptOptions, UsePermissionPromptResult } from './PermissionPrompt';
|
|
118
|
+
export { PermissionPrompt, usePermissionPrompt } from './PermissionPrompt';
|
|
117
119
|
export type { CallingCode, PhoneNumberInfo, PhoneNumberInputLabelMode, PhoneNumberInputProps, PhoneNumberInputRef, PhoneNumberValidation, PhoneNumberValue } from './PhoneNumberInput';
|
|
118
120
|
export { ALL_CALLING_CODES, DEFAULT_CALLING_CODES, formatE164, PhoneNumberInput, parseE164 } from './PhoneNumberInput';
|
|
119
121
|
export type { PickerTriggerProps, PickerTriggerSize, PickerTriggerVariant } from './PickerTrigger';
|
|
@@ -3,7 +3,7 @@ export interface PdfDocumentInfo {
|
|
|
3
3
|
/** Opaque handle for every subsequent call (getPageInfo/renderPage/close) — NOT the file path. */
|
|
4
4
|
handle: string;
|
|
5
5
|
pageCount: number;
|
|
6
|
-
/** Points (1/72 in), the
|
|
6
|
+
/** Points (1/72 in), the page size of page 0 as displayed (after the page's /Rotate) — a per-page size read happens in renderPage. */
|
|
7
7
|
pageWidth: number;
|
|
8
8
|
pageHeight: number;
|
|
9
9
|
}
|
|
@@ -16,7 +16,10 @@ export interface CheckboxProps extends Omit<PressableProps, 'style' | 'children'
|
|
|
16
16
|
label?: React.ReactNode;
|
|
17
17
|
/** Secondary line under the label. A string or a node; a node description adds nothing to the accessibility hint. */
|
|
18
18
|
description?: React.ReactNode;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Error line under the label (and description); also draws the box in the error colour. A string
|
|
21
|
+
* or a node; `true` shows the error state without a message.
|
|
22
|
+
*/
|
|
20
23
|
error?: React.ReactNode;
|
|
21
24
|
/**
|
|
22
25
|
* Drawn beside the label, after it (a glossary info button, say). It sits
|
|
@@ -25,7 +25,7 @@ export interface FileViewerProps {
|
|
|
25
25
|
accessibilityLabel?: string;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Renders a PDF via our own native rasterizer (
|
|
28
|
+
* Renders a PDF via our own native rasterizer (Core Graphics on iOS, PdfRenderer on
|
|
29
29
|
* Android) — no third-party PDF dependency. Pages are paged through a plain
|
|
30
30
|
* `ScrollView` with manual windowed mounting (render the visible page ±
|
|
31
31
|
* `RENDER_WINDOW`), not a `FlatList` — a `VirtualizedList`-based component
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { ColorValue } from 'react-native';
|
|
2
|
+
import type { ColorValue, StyleProp, TextStyle } from 'react-native';
|
|
3
3
|
export interface NotationRun {
|
|
4
4
|
text: string;
|
|
5
5
|
/** The subscript that follows `text`, when the run is a symbol. */
|
|
@@ -24,8 +24,8 @@ export interface NotationProps {
|
|
|
24
24
|
/** Follows the symbol after a space. */
|
|
25
25
|
desc?: string;
|
|
26
26
|
/**
|
|
27
|
-
* Subscript ink. Inside a field label it defaults to
|
|
28
|
-
* `colors.text.primary`; pass the parent's colour when it differs.
|
|
27
|
+
* Subscript ink. Inside a field's or choice's label or message line it defaults to that line's
|
|
28
|
+
* ink, elsewhere to `colors.text.primary`; pass the parent's colour when it differs.
|
|
29
29
|
*/
|
|
30
30
|
color?: string;
|
|
31
31
|
testID?: string;
|
|
@@ -37,8 +37,14 @@ export interface NotationInk {
|
|
|
37
37
|
fontSize: number;
|
|
38
38
|
color: ColorValue;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Provided by a field's text lines (FieldLabel, the floating label, FieldMessage, the FormField
|
|
42
|
+
* label, helper and error, and the Checkbox, Radio and Switch label, description and error) so a
|
|
43
|
+
* subscript inside one scales and inks with that line.
|
|
44
|
+
*/
|
|
41
45
|
export declare const NotationInkContext: React.Context<NotationInk | null>;
|
|
46
|
+
/** The ink for a line's provider: the line's own `style` size and colour win over its defaults. */
|
|
47
|
+
export declare const useNotationInk: (style: StyleProp<TextStyle>, fontSize: number, color: ColorValue) => NotationInk;
|
|
42
48
|
/** A symbol of a standard with its subscript drawn small and lowered below the baseline. */
|
|
43
49
|
export declare const Notation: React.FC<NotationProps>;
|
|
44
50
|
/** A symbol as the standard prints it: `sym('C', 'IP')` is C with a small IP, then `desc` if given. */
|
|
@@ -45,6 +45,8 @@ export interface OptionSheetProps {
|
|
|
45
45
|
* earlier, iOS attaches it to the closing window and dismisses it with it.
|
|
46
46
|
*/
|
|
47
47
|
onAfterClose?: () => void;
|
|
48
|
+
/** Called with `true` when `open` turns on and `false` when it turns off, not again while it stays the same. */
|
|
49
|
+
onOpenChange?: (open: boolean) => void;
|
|
48
50
|
/** Sheet heading. Also the modal's a11y label fallback. */
|
|
49
51
|
title?: string;
|
|
50
52
|
options: ReadonlyArray<unknown>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PermissionKind, PermissionStatus } from '@webority/mobile-core/permissions';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import type { HapticType } from '../../utils/hapticUtils.js';
|
|
5
|
+
import type { SlotIcon } from '../AppIcon/slotIcon.js';
|
|
6
|
+
export interface PermissionPromptFallback {
|
|
7
|
+
/** Names the other way to do the job ("Enter address instead"). */
|
|
8
|
+
label: string;
|
|
9
|
+
onPress: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface PermissionPromptProps {
|
|
12
|
+
kind: PermissionKind;
|
|
13
|
+
/** What the feature is ("Scan a receipt"). Read first by a screen reader. */
|
|
14
|
+
title: string;
|
|
15
|
+
/** One sentence: what the app does with the access, ending in a full stop. */
|
|
16
|
+
reason: string;
|
|
17
|
+
/** An AppIcon name or any node, drawn in a tinted disc above the title. */
|
|
18
|
+
icon?: SlotIcon;
|
|
19
|
+
/** The status each time it settles: after the first check finds nothing to ask, and after each request or Cancel. */
|
|
20
|
+
onResult: (status: PermissionStatus) => void;
|
|
21
|
+
/** The way to carry on without the access, shown in the unavailable state. */
|
|
22
|
+
fallback?: PermissionPromptFallback;
|
|
23
|
+
/** Haptic on each button press. Default `'selection'`. */
|
|
24
|
+
haptic?: HapticType | false;
|
|
25
|
+
style?: StyleProp<ViewStyle>;
|
|
26
|
+
testID?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Explains why the app needs a permission before the system prompt, in the way
|
|
30
|
+
* each platform's review accepts. iOS gets one Continue button that opens the
|
|
31
|
+
* system prompt, with no way to leave first (App Review rejects a "Not now").
|
|
32
|
+
* Android asks straight away the first time and explains only after one
|
|
33
|
+
* refusal, with Cancel. Once access is refused or the device lacks it, the
|
|
34
|
+
* prompt becomes an inline state with the fallback, and Open Settings only
|
|
35
|
+
* when it was already off on arrival, never straight after a refusal.
|
|
36
|
+
*/
|
|
37
|
+
export declare const PermissionPrompt: React.FC<PermissionPromptProps>;
|
|
38
|
+
export default PermissionPrompt;
|
|
39
|
+
//# sourceMappingURL=PermissionPrompt.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { PermissionPromptFallback, PermissionPromptProps } from './PermissionPrompt.js';
|
|
2
|
+
export { default, PermissionPrompt } from './PermissionPrompt.js';
|
|
3
|
+
export type { PermissionPromptView, UsePermissionPromptOptions, UsePermissionPromptResult } from './usePermissionPrompt.js';
|
|
4
|
+
export { usePermissionPrompt } from './usePermissionPrompt.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|