@webority/mobile-ui 0.131.0 → 0.132.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas-kit/kit.js +4960 -4856
- package/dist/canvas-kit/manifest.json +34 -2
- package/dist/canvas-kit/release.json +6 -6
- package/lib/commonjs/components/AppBar/AppBar.js +1 -1
- package/lib/commonjs/components/BarChart/BarChart.js +1 -1
- package/lib/commonjs/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/commonjs/components/FileViewer/FileViewer.js +1 -1
- package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
- package/lib/commonjs/components/ScannerOverlay/ScannerOverlay.js +1 -1
- package/lib/commonjs/components/Screen/Screen.js +1 -1
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/commonjs/components/WheelPicker/Wheel.js +1 -1
- package/lib/commonjs/navigation/NavigationScreen.js +1 -1
- package/lib/commonjs/network/NetworkStatusBanner.js +1 -1
- package/lib/commonjs/theme/merge.js +1 -1
- package/lib/commonjs/theme/tokens.generated.js +1 -1
- package/lib/module/components/AppBar/AppBar.js +1 -1
- package/lib/module/components/BarChart/BarChart.js +1 -1
- package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/module/components/FileViewer/FileViewer.js +1 -1
- package/lib/module/components/OTPInput/OTPInput.js +1 -1
- package/lib/module/components/ScannerOverlay/ScannerOverlay.js +1 -1
- package/lib/module/components/Screen/Screen.js +1 -1
- package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/module/components/WheelPicker/Wheel.js +1 -1
- package/lib/module/navigation/NavigationScreen.js +1 -1
- package/lib/module/network/NetworkStatusBanner.js +1 -1
- package/lib/module/theme/merge.js +1 -1
- package/lib/module/theme/tokens.generated.js +1 -1
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +3 -1
- package/lib/typescript/commonjs/components/ChoiceGroup/ChoiceGroup.d.ts +3 -3
- package/lib/typescript/commonjs/components/Screen/Screen.d.ts +4 -0
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +2 -1
- package/lib/typescript/commonjs/navigation/NavigationScreen.d.ts +2 -2
- package/lib/typescript/commonjs/network/NetworkStatusBanner.d.ts +7 -2
- package/lib/typescript/commonjs/theme/tokens.generated.d.ts +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +5 -1
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +3 -1
- package/lib/typescript/module/components/ChoiceGroup/ChoiceGroup.d.ts +3 -3
- package/lib/typescript/module/components/Screen/Screen.d.ts +4 -0
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +2 -1
- package/lib/typescript/module/navigation/NavigationScreen.d.ts +2 -2
- package/lib/typescript/module/network/NetworkStatusBanner.d.ts +7 -2
- package/lib/typescript/module/theme/tokens.generated.d.ts +1 -1
- package/lib/typescript/module/theme/types.d.ts +5 -1
- package/package.json +7 -7
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"kind": "WeborityPhone",
|
|
3
3
|
"library": {
|
|
4
4
|
"name": "@webority/mobile-ui",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.132.0"
|
|
6
6
|
},
|
|
7
7
|
"rendererProtocolVersion": 13,
|
|
8
8
|
"platform": "Phone",
|
|
@@ -546,7 +546,14 @@
|
|
|
546
546
|
"name": "divider",
|
|
547
547
|
"type": "boolean",
|
|
548
548
|
"required": false,
|
|
549
|
-
"description": "Draws a hairline under the bar;
|
|
549
|
+
"description": "Draws a hairline under the bar; off by default."
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"name": "elevated",
|
|
553
|
+
"type": "boolean",
|
|
554
|
+
"required": false,
|
|
555
|
+
"description": "Draws a shadow under the bar, for content scrolled beneath it; ignored when the bar is transparent.",
|
|
556
|
+
"default": false
|
|
550
557
|
},
|
|
551
558
|
{
|
|
552
559
|
"name": "gutter",
|
|
@@ -13508,6 +13515,13 @@
|
|
|
13508
13515
|
"description": "Keeps the content inside the page's side margin. List pages default to false, because their rows carry their own padding.",
|
|
13509
13516
|
"default": true
|
|
13510
13517
|
},
|
|
13518
|
+
{
|
|
13519
|
+
"name": "headerShadowOnScroll",
|
|
13520
|
+
"type": "boolean",
|
|
13521
|
+
"required": false,
|
|
13522
|
+
"description": "Shows a shadow under the fixed bar once the content scrolls, and hides it back at the top.",
|
|
13523
|
+
"default": true
|
|
13524
|
+
},
|
|
13511
13525
|
{
|
|
13512
13526
|
"name": "keyboardToolbar",
|
|
13513
13527
|
"type": "boolean",
|
|
@@ -13591,6 +13605,12 @@
|
|
|
13591
13605
|
"type": "string",
|
|
13592
13606
|
"required": false,
|
|
13593
13607
|
"description": "The app bar title."
|
|
13608
|
+
},
|
|
13609
|
+
{
|
|
13610
|
+
"name": "trailing",
|
|
13611
|
+
"type": "node",
|
|
13612
|
+
"required": false,
|
|
13613
|
+
"description": "Content at the right edge of the app bar, such as a profile avatar, in place of the last right action."
|
|
13594
13614
|
}
|
|
13595
13615
|
],
|
|
13596
13616
|
"itemsTakeAction": [],
|
|
@@ -20468,6 +20488,7 @@
|
|
|
20468
20488
|
"neutral",
|
|
20469
20489
|
"neutral-hover",
|
|
20470
20490
|
"neutral-text",
|
|
20491
|
+
"offline-fill",
|
|
20471
20492
|
"on-danger",
|
|
20472
20493
|
"on-glass",
|
|
20473
20494
|
"on-info",
|
|
@@ -20479,6 +20500,7 @@
|
|
|
20479
20500
|
"on-surface-dark",
|
|
20480
20501
|
"on-surface-dark-muted",
|
|
20481
20502
|
"on-warning",
|
|
20503
|
+
"online-fill",
|
|
20482
20504
|
"primary",
|
|
20483
20505
|
"primary-hover",
|
|
20484
20506
|
"primary-pressed",
|
|
@@ -20607,6 +20629,7 @@
|
|
|
20607
20629
|
"neutral": "Quiet unbranded fill for supporting actions such as Back, Skip and Close.",
|
|
20608
20630
|
"neutral-hover": "Neutral fill while a control is hovered.",
|
|
20609
20631
|
"neutral-text": "Text on the soft neutral background.",
|
|
20632
|
+
"offline-fill": "Fill of the offline network banner: the source red, not the contrast-darkened danger fill.",
|
|
20610
20633
|
"on-danger": "Ink on a solid danger fill.",
|
|
20611
20634
|
"on-glass": "Ink on a translucent control on a brand surface.",
|
|
20612
20635
|
"on-info": "Ink on a solid info fill.",
|
|
@@ -20618,6 +20641,7 @@
|
|
|
20618
20641
|
"on-surface-dark": "Text and icons on a surface-dark band.",
|
|
20619
20642
|
"on-surface-dark-muted": "Secondary text on a surface-dark band.",
|
|
20620
20643
|
"on-warning": "Ink on a solid warning fill.",
|
|
20644
|
+
"online-fill": "Fill of the back-online network banner: the source green, not the contrast-darkened success fill.",
|
|
20621
20645
|
"primary": "Primary fill for buttons, selected states and borders.",
|
|
20622
20646
|
"primary-hover": "Primary fill while a control is hovered or pressed.",
|
|
20623
20647
|
"primary-pressed": "Primary fill while a control is pressed.",
|
|
@@ -20829,6 +20853,10 @@
|
|
|
20829
20853
|
"light": "#52525b",
|
|
20830
20854
|
"dark": "#b4b4bb"
|
|
20831
20855
|
},
|
|
20856
|
+
"offline-fill": {
|
|
20857
|
+
"light": "#e82646",
|
|
20858
|
+
"dark": "#e82646"
|
|
20859
|
+
},
|
|
20832
20860
|
"on-danger": {
|
|
20833
20861
|
"light": "#ffffff",
|
|
20834
20862
|
"dark": "#0f0f1a"
|
|
@@ -20873,6 +20901,10 @@
|
|
|
20873
20901
|
"light": "#0f0f1a",
|
|
20874
20902
|
"dark": "#0f0f1a"
|
|
20875
20903
|
},
|
|
20904
|
+
"online-fill": {
|
|
20905
|
+
"light": "#04b440",
|
|
20906
|
+
"dark": "#04b440"
|
|
20907
|
+
},
|
|
20876
20908
|
"primary": {
|
|
20877
20909
|
"light": "#5b5bd6",
|
|
20878
20910
|
"dark": "#7c7ce8"
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-phone",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.132.0",
|
|
4
4
|
"platform": "Phone",
|
|
5
5
|
"kitModuleVersion": 2,
|
|
6
6
|
"rendererProtocolVersion": 13,
|
|
7
7
|
"library": {
|
|
8
8
|
"name": "@webority/mobile-ui",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.132.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "93ccea95aa1fbffca8372ee25e3db8d82ff10670b54197758a7ab058153bc0b3",
|
|
14
|
+
"bytes": 663451
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "f2105393c7f83bf51c3b5b4605eeb7182ac63bcd5ca9f7cc59f2706df6ea9f4f",
|
|
18
|
+
"bytes": 6110395
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_APP_BAR_LABELS=exports.AppBar=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_index2=require("../Menu/index.js"),_Text=require("../Text/Text.js"),_jsxRuntime=require("react/jsx-runtime");const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4,DEFAULT_APP_BAR_LABELS=exports.DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"}),variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1};case"large":return{height:56,titleSize:e.text["2xl"].size,titleWeight:"bold",subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1}}},ActionButton=(0,_react.forwardRef)(({action:e,side:t,badgeStyle:i,haptic:n,flush:a,onPress:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_APP_BAR_LABELS=exports.AppBar=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_index2=require("../Menu/index.js"),_Text=require("../Text/Text.js"),_jsxRuntime=require("react/jsx-runtime");const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4,DEFAULT_APP_BAR_LABELS=exports.DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"}),variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1};case"large":return{height:56,titleSize:e.text["2xl"].size,titleWeight:"bold",subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",subtitleLines:1}}},ActionButton=(0,_react.forwardRef)(({action:e,side:t,badgeStyle:i,haptic:n,flush:a,onPress:l},r)=>{const s=(0,_index.useTheme)(),{style:o,pressIn:c,pressOut:d}=(0,_usePressAnimation.usePressAnimation)({enabled:!0}),u=(0,_react.useMemo)(()=>buildActionStyles(s),[s]),p=e.badge,h=void 0!==p&&0!==p,x=void 0!==e.label;return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:o,children:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:r,onPress:t=>{const i=(0,_hapticUtils.resolveHaptic)(n,"selection");i&&(0,_hapticUtils.triggerHaptic)(i),"onPress"in e&&e.onPress(),l?.(t)},onPressIn:c,onPressOut:d,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,android_ripple:{color:s.colors["surface-pressed"],borderless:!x},style:({pressed:e})=>[x?u.textButton:u.actionButton,a?null:"left"===t?u.actionLeft:u.actionRight,e&&!x?u.actionPressed:null,e&&x?u.textPressed:null],children:[x?(0,_jsxRuntime.jsx)(_Text.Text,{variant:"body",weight:"semibold",color:"link",numberOfLines:1,children:e.label}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:u.iconWrap,children:e.icon}),h?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[u.badge,i],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_Text.Text,{variant:"caption",weight:"semibold",numberOfLines:1,style:u.badgeText,children:String(p)})}):null,e.dot?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:e.testID?`${e.testID}-dot`:"appbar-action-dot",style:u.dot,pointerEvents:"none"}):null]})})}),COLLAPSE_RANGE=60,AppBar=exports.AppBar=(0,_react.forwardRef)((e,t)=>{const{title:i,subtitle:n,titleAlignment:a="left",leftAction:l,rightActions:r,leading:s,trailing:o,onBack:c,gutter:d,titleVariant:u,titleOffset:p,height:h,divider:x,elevated:g=!1,variant:m="default",transparent:_=!1,scrollY:b,style:f,containerStyle:j,titleStyle:v,subtitleStyle:y,badgeStyle:A,haptic:R,labels:S,testID:w}=e;(0,_warnInvalidValue.warnInvalidValue)("AppBar","variant",e.variant,["default","large","compact"]),(0,_warnInvalidValue.warnInvalidValue)("AppBar","titleAlignment",e.titleAlignment,["left","center"]);const I=(0,_react.useMemo)(()=>({...DEFAULT_APP_BAR_LABELS,...S}),[S]),B=(0,_index.useTheme)(),L=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),N=(0,_react.useMemo)(()=>variantSize(B,m),[B,m]),T=(0,_react.useMemo)(()=>buildStyles(B),[B]),P="large"===m,C=P&&void 0!==b,[z,V]=(0,_react.useState)(40),O=(0,_react.useCallback)(e=>V(e.nativeEvent.layout.height),[]),E=l??(c?{icon:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"arrow-left",size:24,color:B.colors["text-body"]}),onPress:c,accessibilityLabel:I.back}:void 0),D=o?void 0:r?.[r.length-1],opticalInset=e=>void 0===e?0:void 0!==e.label?B.space.sm:Math.max((44-(e.glyphSize??24))/2,0),W=void 0===d?null:{paddingLeft:Math.max(d-opticalInset(E),0),paddingRight:Math.max(d-opticalInset(D),0)},k=void 0!==p,F=Boolean(E)||Boolean(s),q=!k&&"left"===a&&Boolean(E),H=k||q||!F&&"left"===a,M="default"!==m||F?N.titleSize:B.text.xl.size,U=x??!1,$=_reactNative.StyleSheet.hairlineWidth,G=(0,_react.useMemo)(()=>b?{rootHeight:b.interpolate({inputRange:[0,60],outputRange:[L.top+N.height+z,L.top+N.height],extrapolate:"clamp"}),titleRowOpacity:b.interpolate({inputRange:[0,30],outputRange:[1,0],extrapolate:"clamp"}),compactTitleOpacity:b.interpolate({inputRange:[30,60],outputRange:[0,1],extrapolate:"clamp"}),borderOpacity:b.interpolate({inputRange:[0,60],outputRange:[0,1],extrapolate:"clamp"})}:null,[b,L.top,N.height,z]),Z=i?u?(0,_jsxRuntime.jsx)(_Text.Text,{variant:u,align:"center"===a?"center":"left",accessibilityRole:"header",numberOfLines:1,style:[T.titleVariant,v],children:i}):(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{accessibilityRole:"header",style:[T.title,{fontSize:M,fontWeight:B.weight[N.titleWeight],textAlign:"center"===a?"center":"left"},n?T.stackedText:null,v],numberOfLines:1,children:i}):null,Y=C&&G&&i?(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:[T.title,{fontSize:B.text.lg.size,fontWeight:B.weight.semibold,textAlign:"center"===a?"center":"left",opacity:G.compactTitleOpacity}],numberOfLines:1,children:i}):null,J=n?(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{style:[T.subtitle,{textAlign:"center"===a?"center":"left"},y],numberOfLines:N.subtitleLines,children:n}):null,K=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[T.titleColumn,"center"===a?T.titleColumnCenter:null],children:[Z,J]}),Q=C?_reactNative.Animated.View:_reactNative.View,X=C&&G?{height:G.rootHeight,overflow:"hidden"}:P&&void 0===h?null:{height:(h??N.height)+L.top};return(0,_jsxRuntime.jsxs)(Q,{ref:t,testID:w,style:[T.root,{paddingTop:L.top,backgroundColor:_?"transparent":B.colors.surface},X,!C&&U?{borderBottomWidth:$,borderBottomColor:B.colors.border}:null,g&&!_?B.shadow.card:null,j,f],children:[C&&G&&U?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[T.animatedBorder,{backgroundColor:B.colors.border,opacity:G.borderOpacity}]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:P&&w?`${w}-bar-row`:void 0,style:[T.row,P?{height:N.height}:{flex:1},W],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:w?`${w}-leading-slot`:void 0,style:[T.sideSlot,H?T.sideSlotCompact:null],children:[E?(0,_jsxRuntime.jsx)(ActionButton,{action:E,side:"left",haptic:R,flush:k||q}):null,null!=s&&!1!==s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:T.slotNode,children:s}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[T.center,"center"===a?T.centerAligned:T.centerLeft,k?{paddingLeft:F?p:B.space.none,paddingRight:B.space.none}:H?{paddingLeft:B.space.none}:null],children:P?Y:K}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[T.sideSlot,T.sideSlotRight,k?T.sideSlotCompact:null],children:[r?.map((e,t)=>(0,_jsxRuntime.jsx)(_react.Fragment,{children:"menu"in e?(0,_jsxRuntime.jsx)(_index2.Menu,{items:e.menu,title:e.menuTitle,haptic:R,trigger:(0,_jsxRuntime.jsx)(ActionButton,{action:e,side:"right",badgeStyle:A,haptic:R,flush:k})}):(0,_jsxRuntime.jsx)(ActionButton,{action:e,side:"right",badgeStyle:A,haptic:R,flush:k})},`appbar-right-${t}`)),null!=o&&!1!==o?(0,_jsxRuntime.jsx)(_reactNative.View,{style:T.slotNode,children:o}):null]})]}),P?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{testID:w?`${w}-title-row`:void 0,onLayout:C?O:void 0,pointerEvents:"none",style:[{paddingHorizontal:d??B.space.md,paddingBottom:B.space.sm},C&&G?{opacity:G.titleRowOpacity}:null],children:K}):null]})});AppBar.displayName="AppBar";const buildStyles=e=>_reactNative.StyleSheet.create({root:{width:"100%"},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.xs},sideSlot:{flexDirection:"row",alignItems:"center",minWidth:48},sideSlotRight:{justifyContent:"flex-end"},sideSlotCompact:{minWidth:0},slotNode:{flexDirection:"row",alignItems:"center"},center:{flex:1,minWidth:0,paddingHorizontal:e.space.xs},centerAligned:{alignItems:"center"},centerLeft:{alignItems:"flex-start"},titleColumn:{flexDirection:"column",maxWidth:"100%"},titleColumnCenter:{alignItems:"center"},title:{color:e.colors["text-body"]},titleVariant:{includeFontPadding:!1,textAlignVertical:"center"},stackedText:{includeFontPadding:!1},subtitle:{includeFontPadding:!1,color:e.colors["text-subtle"],fontSize:e.text.sm.size,fontWeight:e.weight.normal},animatedBorder:{position:"absolute",left:0,right:0,bottom:0,height:_reactNative.StyleSheet.hairlineWidth}}),buildActionStyles=e=>_reactNative.StyleSheet.create({actionButton:{width:44,height:44,borderRadius:e.radius.pill,..._corners.smoothCorners,alignItems:"center",justifyContent:"center"},actionLeft:{marginRight:e.space.xs},actionRight:{marginLeft:e.space.xs},actionPressed:{backgroundColor:e.colors["surface-pressed"]},textButton:{minWidth:44,minHeight:44,paddingHorizontal:e.space.sm,alignItems:"center",justifyContent:"center"},textPressed:{opacity:.6},dot:{position:"absolute",top:10,right:10,width:8,height:8,borderRadius:e.radius.pill,backgroundColor:e.colors.danger},iconWrap:{alignItems:"center",justifyContent:"center"},badge:{position:"absolute",top:4,right:4,minWidth:16,height:16,paddingHorizontal:e.space.xs,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:e.colors.danger,alignItems:"center",justifyContent:"center"},badgeText:{color:e.colors["on-danger"],fontSize:e.text.xs.size,fontWeight:e.weight.semibold,lineHeight:13}});var _default=exports.default=AppBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_BAR_CHART_LABELS=exports.BarChart=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_index4=require("../Text/index.js"),_scale=require("./scale.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_BAR_CHART_LABELS=exports.DEFAULT_BAR_CHART_LABELS=Object.freeze({chart:"Bar chart",noData:"no data",highest:(e,t)=>`Highest: ${e}, ${t}`}),AUTO_VALUES_MAX_BARS=7,MAX_BAR_WIDTH=40,BAR_SHARE=.6,MIN_BAR_HEIGHT=2,VALUE_LABEL_ROOM=20,PLOT_PAD=6,HEADER_MIN_HEIGHT=48,AXIS_LABEL_MIN_WIDTH=44,CHAR_WIDTH=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_BAR_CHART_LABELS=exports.BarChart=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_index4=require("../Text/index.js"),_scale=require("./scale.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_BAR_CHART_LABELS=exports.DEFAULT_BAR_CHART_LABELS=Object.freeze({chart:"Bar chart",noData:"no data",highest:(e,t)=>`Highest: ${e}, ${t}`}),AUTO_VALUES_MAX_BARS=7,MAX_BAR_WIDTH=40,BAR_SHARE=.6,MIN_BAR_HEIGHT=2,VALUE_LABEL_ROOM=20,PLOT_PAD=6,HEADER_MIN_HEIGHT=48,AXIS_LABEL_MIN_WIDTH=44,CHAR_WIDTH=8,SWATCH_SIZE=10,STACK_TONES=["primary","info","success","warning","danger","neutral"],FONT_SCALE_CAP=1.2,toneColor=(e,t)=>"neutral"===t?e.colors["text-muted"]:e.colors[`${t}-text`],safe=e=>"number"==typeof e&&Number.isFinite(e)?e:0,defaultFormatValue=e=>(0,_mobileCore.formatNumber)(e),defaultFormatTick=e=>(0,_mobileCore.formatCompactNumber)(e),BarChart=exports.BarChart=(0,_react.forwardRef)((e,t)=>{const{data:r,tone:a="primary",color:i,series:s,height:n=160,label:l,summary:o,formatValue:c=defaultFormatValue,formatTick:u=defaultFormatTick,showValues:d,selection:m,defaultSelection:_=null,onSelect:x,haptic:h,labels:p,style:b,testID:f}=e;(0,_warnInvalidValue.warnInvalidValue)("BarChart","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const y=(0,_react.useMemo)(()=>({...DEFAULT_BAR_CHART_LABELS,...p}),[p]),j=(0,_index2.useTheme)(),v=r.length,[R,g]=(0,_react.useState)(0),[w,S]=(0,_index.useControllableState)({value:m,defaultValue:_,onChange:x}),T=null!==w&&w>=0&&w<v?w:null,C=(0,_react.useRef)(T);C.current=T;const A=(0,_react.useRef)(-1),M=(0,_index3.resolveHaptic)(h,"tick"),N=(0,_react.useCallback)(()=>{M&&(0,_index3.triggerHaptic)(M)},[M]),L=d??(v>0&&v<=7),V=void 0!==s&&s.length>0,E=(0,_react.useMemo)(()=>V?s.map((e,t)=>e.tone??STACK_TONES[t%STACK_TONES.length]):[],[V,s]),I=(0,_react.useMemo)(()=>V?s.map(e=>e.key):[],[V,s]),B=(0,_react.useMemo)(()=>V?r.map(e=>s.map(t=>safe(e.values?.[t.key]))):null,[r,s,V]),D=(0,_react.useMemo)(()=>B?B.map(e=>e.reduce((e,t)=>e+t,0)):r.map(e=>safe(e.value)),[r,B]),H=(0,_react.useMemo)(()=>B?B.flatMap(e=>[e.reduce((e,t)=>t>0?e+t:e,0),e.reduce((e,t)=>t<0?e+t:e,0)]):D,[B,D]),$=(0,_react.useMemo)(()=>(0,_scale.barScale)(H),[H]),k=L?20:6,O=L&&$.min<0?20:6,F=Math.max(1,n-k-O),G=(0,_react.useCallback)(e=>k+($.max-e)/($.max-$.min)*F,[k,$.max,$.min,F]),q=G(0),W=(0,_react.useMemo)(()=>$.ticks.map(e=>u(e)),[$.ticks,u]),U=Math.ceil(8*Math.max(...W.map(e=>e.length),1)*1.2)+j.space.xs,z=v>0?R/v:0,P=Math.max(1,Math.ceil(44/Math.max(1,z||44))),X=(0,_react.useCallback)(e=>{const t=r[e];return t.accessibilityLabel?t.accessibilityLabel:B&&s?`${t.label}, ${s.map((t,r)=>`${t.label} ${c(B[e][r])}`).join(", ")}`:`${t.label}, ${c(D[e])}`},[r,c,D,B,s]),K=(0,_react.useMemo)(()=>{let e=-1;return D.forEach((t,r)=>{(-1===e||t>D[e])&&(e=r)}),e},[D]),J=o??(K>=0?y.highest(r[K].label,c(D[K])):""),Y=(0,_react.useRef)({fire:N,setSelected:S,count:v,plotWidth:R});Y.current={fire:N,setSelected:S,count:v,plotWidth:R};const Z=(0,_react.useMemo)(()=>{const indexAt=e=>{const{count:t,plotWidth:r}=Y.current;return 0===t||r<=0||!Number.isFinite(e)?-1:Math.min(t-1,Math.max(0,Math.floor(e/r*t)))},scrubTo=e=>{const t=indexAt(e);t<0||t===A.current||(A.current=t,Y.current.fire(),Y.current.setSelected(t))},e=_reactNativeGestureHandler.Gesture.Pan().runOnJS(!0).activeOffsetX([-8,8]).failOffsetY([-12,12]).onStart(e=>{A.current=C.current??-1,scrubTo(e.x)}).onUpdate(e=>scrubTo(e.x)).withTestId(f?`${f}-pan`:"bar-chart-pan"),t=_reactNativeGestureHandler.Gesture.Tap().runOnJS(!0).onEnd((e,t)=>{if(!t)return;const r=indexAt(e.x);r<0||(Y.current.fire(),A.current=r,Y.current.setSelected(r===C.current?null:r))}).withTestId(f?`${f}-tap`:"bar-chart-tap");return _reactNativeGestureHandler.Gesture.Race(e,t)},[f]),Q=(0,_react.useCallback)(e=>{if(0===v)return;const t=C.current,r="increment"===e.nativeEvent.actionName?null===t?0:Math.min(v-1,t+1):null===t?v-1:Math.max(0,t-1);r!==t&&(N(),S(r))},[v,N,S]),ee=(0,_react.useCallback)(e=>{const t=Math.round(e.nativeEvent.layout.width);g(e=>e===t?e:t)},[]),te=i??toneColor(j,a),re=j.radius.sm,ae=l??y.chart,ie=0===v?`${ae}, ${y.noData}`:J?`${ae}, ${J}`:ae,se=null===T?J:X(T),ne=Math.min(40,Math.max(4,.6*z)),renderStack=(e,t,r)=>{const a=e.reduce((e,t)=>t>0?e+t:e,0),i=e.reduce((e,t)=>t<0?e+t:e,0);if(0===a&&0===i)return null;const s=G(a),n=[];let l=0,o=0;return e.forEach((e,r)=>{if(0===e)return;const a=e>0?l:o,i=a+e;e>0?l=i:o=i;const c=G(a),u=G(i);n.push((0,_jsxRuntime.jsx)(_reactNative.View,{testID:f?`${f}-bar-${t}-series-${r}`:void 0,style:{position:"absolute",left:0,right:0,top:Math.min(c,u)-s,height:Math.abs(c-u),backgroundColor:toneColor(j,E[r])}},I[r]))}),(0,_jsxRuntime.jsx)(_reactNative.View,{testID:f?`${f}-bar-${t}`:void 0,style:{position:"absolute",left:(z-ne)/2,top:s,width:ne,height:Math.max(2,G(i)-s),overflow:"hidden",opacity:r?.4:1,..._corners.smoothCorners,...a>0?{borderTopLeftRadius:re,borderTopRightRadius:re}:null,...i<0?{borderBottomLeftRadius:re,borderBottomRightRadius:re}:null},children:n})},le=D.map((e,t)=>{const r=G(e),a=e>=0?r:q,i=0===e?0:Math.max(2,Math.abs(r-q)),s=null!==T&&T!==t;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.slot,{height:n}],children:[R>0&&B?renderStack(B[t],t,s):null,R>0&&!B&&i>0?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:f?`${f}-bar-${t}`:void 0,style:{position:"absolute",left:(z-ne)/2,top:a,width:ne,height:i,backgroundColor:te,opacity:s?.4:1,..._corners.smoothCorners,...e>=0?{borderTopLeftRadius:re,borderTopRightRadius:re}:{borderBottomLeftRadius:re,borderBottomRightRadius:re}}}):null,L&&R>0?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"secondary",align:"center",numberOfLines:1,maxFontSizeMultiplier:1.2,style:{position:"absolute",left:0,right:0,top:e>=0?(B?G(H[2*t]):r)-20+2:(B?G(H[2*t+1]):r)+2},children:u(e)}):null]},t)});return 0===v?(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,accessible:!0,accessibilityRole:"image",accessibilityLabel:ie,testID:f,style:[styles.root,b],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",color:"secondary",children:"No data"})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:ie,accessibilityValue:{min:0,max:v-1,now:T??0,text:se},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:Q,testID:f,style:[styles.root,b],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.header,{minHeight:48,marginBottom:j.space.sm}],children:null===T?J?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",color:"secondary",children:J}):null:(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"secondary",numberOfLines:1,children:r[T].label}),(0,_jsxRuntime.jsx)(_index4.Text,{variant:"h3",numberOfLines:1,testID:f?`${f}-callout`:void 0,children:c(D[T])})]})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.body,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:U,height:n},children:$.ticks.map((e,t)=>(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"tertiary",align:"right",numberOfLines:1,maxFontSizeMultiplier:1.2,style:{position:"absolute",right:j.space.xs,left:0,top:G(e)-8},children:W[t]},e))}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.plotColumn,children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:Z,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{height:n},onLayout:ee,testID:f?`${f}-plot`:void 0,children:[$.ticks.map(e=>(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:{position:"absolute",left:0,right:0,top:G(e)-(0===e?.75:_reactNative.StyleSheet.hairlineWidth),height:0===e?1.5:2*_reactNative.StyleSheet.hairlineWidth,backgroundColor:0===e?j.colors["text-subtle"]:j.colors["border-subtle"]}},e)),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.slots,{height:n}],children:le})]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.axis,children:r.map((e,t)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.axisSlot,children:t%P===0?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:T===t?"primary":"tertiary",weight:T===t?"semibold":void 0,align:"center",numberOfLines:1,maxFontSizeMultiplier:1.2,style:z>0?{width:z*P}:void 0,children:e.axisLabel??e.label}):null},t))})]})]}),s&&V?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.legend,{marginTop:j.space.sm,columnGap:j.space.md,rowGap:j.space.xs}],children:s.map((e,t)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.legendItem,{columnGap:j.space.xs}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:10,height:10,borderRadius:j.radius.sm,..._corners.smoothCorners,backgroundColor:toneColor(j,E[t])}}),(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"secondary",numberOfLines:1,maxFontSizeMultiplier:1.2,children:e.label})]},e.key))}):null]})});BarChart.displayName="BarChart";const styles=_reactNative.StyleSheet.create({root:{alignSelf:"stretch"},header:{justifyContent:"center"},body:{flexDirection:"row"},plotColumn:{flex:1},slots:{flexDirection:"row"},slot:{flex:1},axis:{flexDirection:"row"},legend:{flexDirection:"row",flexWrap:"wrap"},legendItem:{flexDirection:"row",alignItems:"center"},axisSlot:{flex:1,alignItems:"center",overflow:"visible"}});var _default=exports.default=BarChart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ChoiceGroup=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_ChoiceText=require("../FieldBase/ChoiceText.js"),_RadioDot=require("../Radio/RadioDot.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const sizeTokensOf=e=>({sm:{paddingHorizontal:e.space.sm,chipPaddingHorizontal:e.space.md,paddingVertical:e.space.xs,fontSize:e.text.sm.size,minHeight:32,iconSize:14},md:{paddingHorizontal:e.space.md,chipPaddingHorizontal:e.space.lg,paddingVertical:e.space.sm,fontSize:e.text.base.size,minHeight:40,iconSize:16},lg:{paddingHorizontal:e.space.lg,chipPaddingHorizontal:e.space.xl,paddingVertical:e.space.md,fontSize:e.text.lg.size,minHeight:48,iconSize:18}}),ChoiceGroup=exports.ChoiceGroup=(0,_react.forwardRef)((e,i)=>{const{options:t,getOptionLabel:r,getOptionValue:o,isOptionDisabled:a,getOptionDescription:n,getOptionIcon:l,getOptionColor:s,renderOption:c,variant:d="card",indicatorPosition:u="trailing",direction:p="row",gap:x,wrap:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ChoiceGroup=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_ChoiceText=require("../FieldBase/ChoiceText.js"),_RadioDot=require("../Radio/RadioDot.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const sizeTokensOf=e=>({sm:{paddingHorizontal:e.space.sm,chipPaddingHorizontal:e.space.md,paddingVertical:e.space.xs,fontSize:e.text.sm.size,minHeight:32,iconSize:14},md:{paddingHorizontal:e.space.md,chipPaddingHorizontal:e.space.lg,paddingVertical:e.space.sm,fontSize:e.text.base.size,minHeight:40,iconSize:16},lg:{paddingHorizontal:e.space.lg,chipPaddingHorizontal:e.space.xl,paddingVertical:e.space.md,fontSize:e.text.lg.size,minHeight:48,iconSize:18}}),ChoiceGroup=exports.ChoiceGroup=(0,_react.forwardRef)((e,i)=>{const{options:t,getOptionLabel:r,getOptionValue:o,isOptionDisabled:a,getOptionDescription:n,getOptionIcon:l,getOptionColor:s,renderOption:c,variant:d="card",indicatorPosition:u="trailing",direction:p="row",gap:x,wrap:h=!1,fullWidth:g,disabled:_=!1,size:m="md",labelLines:b,descriptionLines:v=2,haptic:j,accessibilityLabel:f,style:y,optionStyle:z,description:w,helperText:C,error:R,testID:V}=e,S=(0,_index2.useTheme)(),H=(0,_react.useMemo)(()=>buildStyles(S),[S]),I=(0,_react.useMemo)(()=>sizeTokensOf(S)[m],[S,m]);(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","variant",e.variant,["card","chip"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","direction",e.direction,["row","column"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","indicatorPosition",e.indicatorPosition,["leading","trailing"]),(0,_warnInvalidValue.warnInvalidValue)("ChoiceGroup","selectionMode",e.selectionMode,["single","multiple"]);const T=(0,_react.useCallback)(e=>r?r(e):e.label??"",[r]),k=(0,_react.useCallback)(e=>o?o(e):e.value,[o]),D=(0,_react.useCallback)(e=>a?a(e):!0===e.disabled,[a]),O=(0,_react.useCallback)(e=>n?n(e):e.description,[n]),G=(0,_react.useCallback)(e=>l?l(e):e.icon,[l]),q=(0,_react.useCallback)(e=>s?s(e):e.color,[s]),L="multiple"===e.selectionMode,{min:M,max:P}=e,[N,W]=(0,_index.useControllableState)({value:e.value,defaultValue:e.defaultValue??(L?[]:void 0),onChange:e.onChange}),B=Array.isArray(N)?N:[],F=(0,_react.useCallback)(e=>{const i=k(e);if(L){const e=B.includes(i);if(e&&null!=M&&B.length<=M)return;if(!e&&null!=P&&B.length>=P)return;const t=(0,_index3.resolveHaptic)(j,"selection");return t&&(0,_index3.triggerHaptic)(t),void W(e?B.filter(e=>e!==i):[...B,i])}const t=(0,_index3.resolveHaptic)(j,"selection");t&&(0,_index3.triggerHaptic)(t),W(i)},[j,L,M,P,B,W,k]),A=g??("card"===d&&"row"===p&&!h),$=h||A&&"row"===p,E=S.radius.md,surfaceFor=(e,i,t)=>i?{borderColor:S.colors.border,backgroundColor:S.colors["surface-disabled"]}:{borderColor:e?t:S.colors.border,backgroundColor:e?(0,_color.tintOf)(t,.12,S.colors["surface-selected"]):S.colors.bg},renderIcon=(e,i,t,r)=>{const o=G(e);if(null==o)return null;const a="string"==typeof o&&i?{name:o,variant:"bold"}:o;return(0,_slotIcon.renderSlotIcon)(a,{color:t,size:I.iconSize,disabled:r})},renderChip=e=>{const{option:i,selected:t,disabled:r,color:o}=e,a=r?S.colors["text-disabled"]:t?o:S.colors["text-body"],n=renderIcon(i,t,a,r);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[H.chip,{minHeight:I.minHeight,paddingHorizontal:I.chipPaddingHorizontal,paddingVertical:I.paddingVertical,borderRadius:S.radius.pill,..._corners.smoothCorners,borderWidth:S.size.border,...surfaceFor(t,r,o),columnGap:S.space.xs}],children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{children:n}):null,(0,_jsxRuntime.jsx)(_index4.Text,{weight:"medium",numberOfLines:b,ellipsizeMode:"tail",style:[H.cardLabel,{color:a,fontSize:I.fontSize,lineHeight:Math.round(I.fontSize*S.leading.body)}],children:T(i)})]})},renderDefaultCard=e=>{const{option:i,selected:t,disabled:r,color:o}=e,a=q(i),n=r?S.colors["text-disabled"]:a??S.colors["text-body"],l=O(i),s=renderIcon(i,t,n,r),c=(0,_jsxRuntime.jsx)(_RadioDot.RadioDot,{selected:t,color:o,disabled:r,size:m});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[H.card,{minHeight:I.minHeight,paddingHorizontal:I.paddingHorizontal,paddingVertical:I.paddingVertical,borderRadius:E,..._corners.smoothCorners,borderWidth:S.size.border,...surfaceFor(t,r,o),columnGap:S.space.sm}],children:["leading"===u?c:null,s?(0,_jsxRuntime.jsx)(_reactNative.View,{children:s}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.cardTextWrap,children:[(0,_jsxRuntime.jsx)(_index4.Text,{weight:"medium",numberOfLines:b,ellipsizeMode:"tail",style:[H.cardLabel,{color:n,fontSize:I.fontSize,lineHeight:Math.round(I.fontSize*S.leading.body)}],children:T(i)}),l?(0,_jsxRuntime.jsx)(_index4.Text,{numberOfLines:v,ellipsizeMode:"tail",style:[H.cardDescription,{color:t?S.colors["text-muted"]:S.colors["text-subtle"],fontSize:S.text.xs.size,lineHeight:Math.round(S.text.xs.size*S.leading.body)}],children:l}):null]}),"trailing"===u?c:null]})},J="string"==typeof R&&""!==R?R:void 0,K=!0===R||void 0!==J?null:C,Q=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:i,accessibilityRole:L?void 0:"radiogroup",accessibilityLabel:f,accessibilityState:{disabled:_},"aria-disabled":_,testID:V,style:[{flexDirection:p,gap:x??S.space.sm,flexWrap:$?"wrap":"nowrap"},y],children:t.map((e,i)=>{const t=k(e),r=L?B.includes(t):N===t,o=L&&null!=P&&!r&&B.length>=P,a=_||o||D(e),n=q(e)??S.colors.primary,l=c||"card"!==d?void 0:O(e);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{testID:e.testID,onPress:()=>{a||F(e)},disabled:a,accessibilityRole:L?"checkbox":"radio",accessibilityLabel:l?`${T(e)}, ${l}`:T(e),accessibilityState:{checked:r,disabled:a},"aria-checked":r,"aria-disabled":a,style:[A?H.stretchOption:null,{opacity:a&&c?.55:1},z],children:({pressed:t})=>{const o={option:e,index:i,selected:r,pressed:t&&!a,disabled:a,color:n};return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:c?c(o):"chip"===d?renderChip(o):renderDefaultCard(o)})}},String(t))})});return(0,_ChoiceText.hasChoiceDetail)({description:w,error:J,helperText:K??void 0})?(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[w?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",color:"secondary",style:{marginBottom:S.space.xs},children:w}):null,Q,void 0!==J?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",style:{marginTop:S.space.xs},children:J}):K?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",color:"tertiary",style:{marginTop:S.space.xs},children:K}):null]}):Q});ChoiceGroup.displayName="ChoiceGroup";const buildStyles=e=>_reactNative.StyleSheet.create({stretchOption:{flexGrow:1,flexShrink:0,flexBasis:"auto"},card:{flexDirection:"row",alignItems:"center"},chip:{flexDirection:"row",alignItems:"center",justifyContent:"center"},cardTextWrap:{flexGrow:1,flexShrink:1,flexBasis:"auto"},cardLabel:{includeFontPadding:!1},cardDescription:{includeFontPadding:!1,marginTop:e.space.xxs}});var _default=exports.default=ChoiceGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.FileViewer=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireDefault(require("react-native-reanimated")),_NativePdfRasterizer=_interopRequireDefault(require("../../specs/NativePdfRasterizer.js")),_index=require("../../theme/index.js"),_index2=require("../Spinner/index.js"),_FileViewerImage=require("./FileViewerImage.js"),_FileViewerPage=require("./FileViewerPage.js"),_fileSource=require("./fileSource.js"),_useFileViewerZoom=require("./useFileViewerZoom.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const MAX_RENDER_SCALE=5,RENDER_OVERSCALE=1.25,RENDER_AHEAD=3,MOUNT_AROUND=2,DEFAULT_MAX_ZOOM=4,toError=e=>e instanceof Error?e:new Error(String(e)),scaleForWidth=(e,t,r)=>{if(t<=0)return 1;const i=e/t*_reactNative.PixelRatio.get()*1.25*r;return Math.round(100*Math.min(Math.max(i,1),5))/100},AnimatedScrollView=_reactNativeReanimated.default.createAnimatedComponent(_reactNative.ScrollView),FileViewerPdf=({source:e,onLoadComplete:t,onPageChanged:r,onError:i,loadingIndicator:a,zoomEnabled:l=!0,maxZoom:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.FileViewer=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireDefault(require("react-native-reanimated")),_NativePdfRasterizer=_interopRequireDefault(require("../../specs/NativePdfRasterizer.js")),_index=require("../../theme/index.js"),_index2=require("../Spinner/index.js"),_FileViewerImage=require("./FileViewerImage.js"),_FileViewerPage=require("./FileViewerPage.js"),_fileSource=require("./fileSource.js"),_useFileViewerZoom=require("./useFileViewerZoom.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const MAX_RENDER_SCALE=5,RENDER_OVERSCALE=1.25,RENDER_AHEAD=3,MOUNT_AROUND=2,DEFAULT_MAX_ZOOM=4,toError=e=>e instanceof Error?e:new Error(String(e)),scaleForWidth=(e,t,r)=>{if(t<=0)return 1;const i=e/t*_reactNative.PixelRatio.get()*1.25*r;return Math.round(100*Math.min(Math.max(i,1),5))/100},AnimatedScrollView=_reactNativeReanimated.default.createAnimatedComponent(_reactNative.ScrollView),FileViewerPdf=({source:e,onLoadComplete:t,onPageChanged:r,onError:i,loadingIndicator:a,zoomEnabled:l=!0,maxZoom:n=4,style:s,testID:o,accessibilityLabel:c})=>{const u=(0,_index.useTheme)().space.sm,{width:d,height:_}=(0,_reactNative.useWindowDimensions)(),[h,f]=(0,_react.useState)({width:0,height:0}),m=h.width>0?h.width:d,[w,g]=(0,_react.useState)(0),[R,p]=(0,_react.useState)({width:612,height:792}),v=R.height/R.width,[x,j]=(0,_react.useState)({}),[V,y]=(0,_react.useState)(null),[b,E]=(0,_react.useState)(0),F=(0,_react.useRef)(0),S=(0,_react.useRef)(null),N=(0,_react.useRef)(null),P=(0,_react.useRef)(i);P.current=i;const M=(0,_react.useRef)(t);M.current=t;const q=(0,_react.useRef)(r);q.current=r;const z=(0,_react.useRef)(a);z.current=a;const C=m*v,D=C+u,Z=h.height>0?h.height:_,{scrollRef:O,scrollGesture:A,zoomGesture:L,zoomStyle:G,zoomLevel:H,resetZoom:I}=(0,_useFileViewerZoom.useFileViewerZoom)({zoomEnabled:l,maxZoom:n,viewportWidth:h.width>0?h.width:d,viewportHeight:Z,maxScroll:Math.max(0,w*D-u-Z)}),k=(0,_react.useMemo)(()=>({uri:e.uri,headers:e.headers,client:e.client,cache:e.cache}),[e.uri,e.headers,e.client,e.cache]);(0,_react.useEffect)(()=>{let e=!1;return(async()=>{if(_NativePdfRasterizer.default)try{const t=await(0,_fileSource.localPathFromSource)(k);if(e)return;const r=await _NativePdfRasterizer.default.open(t);if(e)return void await _NativePdfRasterizer.default.close(r.handle).catch(()=>{});S.current=r.handle,F.current=0,g(r.pageCount),E(0),j({}),y(null),I(),r.pageWidth>0&&r.pageHeight>0&&p({width:r.pageWidth,height:r.pageHeight}),M.current?.(r.pageCount)}catch(t){if(!e){const e=toError(t);_mobileCore.Logger.error("[@webority/mobile-ui] FileViewer failed to load.",e),P.current?.(e)}}else P.current?.(new Error("[@webority/mobile-ui] PdfRasterizer native module is not linked. Run pod install / rebuild the app after adding @webority/mobile-ui."))})(),()=>{e=!0;const t=S.current;S.current=null,t&&_NativePdfRasterizer.default?.close(t).catch(()=>{})}},[k,I]);const T=scaleForWidth(m,R.width,1),W=H>_useFileViewerZoom.ZOOM_REST?scaleForWidth(m,R.width,Math.ceil(H)):0,U=(0,_react.useRef)(T);U.current=T;const X=(0,_react.useRef)(W);X.current=W;const K=(0,_react.useRef)(T);(0,_react.useEffect)(()=>{K.current!==T&&(K.current=T,j({}))},[T]);const $=(0,_react.useCallback)(async()=>{const e=S.current;if(!e||!_NativePdfRasterizer.default||0===w)return;if(N.current===e)return;let t;if(void 0===x[b])t={page:b,scale:T,sharp:!1};else if(W>T&&null!==x[b]&&(V?.page!==b||V.scale!==W))t={page:b,scale:W,sharp:!0};else for(let e=1;e<=3&&!t;e+=1)for(const r of[b+e,b-e])if(r>=0&&r<w&&void 0===x[r]){t={page:r,scale:T,sharp:!1};break}if(!t)return;const{page:r,scale:i,sharp:a}=t;N.current=e;let l=null;try{l=await _NativePdfRasterizer.default.renderPage(e,r,i)}catch(t){S.current===e&&_mobileCore.Logger.error(`[@webority/mobile-ui] FileViewer failed to render page ${r}.`,toError(t))}finally{N.current===e&&(N.current=null)}S.current===e&&(i===(a?X.current:U.current)?a?y({page:r,scale:i,uri:l}):j(e=>({...e,[r]:l})):j(e=>({...e})))},[T,b,w,x,V,W]);(0,_react.useEffect)(()=>{$()},[$]),(0,_react.useEffect)(()=>{H<=_useFileViewerZoom.ZOOM_REST&&y(null)},[H]);const B=(0,_react.useCallback)(e=>{const{width:t,height:r}=e.nativeEvent.layout;f(e=>e.width===t&&e.height===r?e:{width:t,height:r})},[]),J=(0,_react.useCallback)(e=>{if(D<=0||0===w)return;const t=Math.min(w-1,Math.max(0,Math.round(e.nativeEvent.contentOffset.y/D)));t!==F.current&&(F.current=t,E(t),q.current?.(t+1,w))},[w,D]),Q=(0,_react.useCallback)(()=>z.current?.()??(0,_jsxRuntime.jsx)(_index2.Spinner,{size:"lg"}),[]),Y=(0,_react.useMemo)(()=>({gap:u}),[u]),ee=(0,_react.useMemo)(()=>Array.from({length:w},(e,t)=>t),[w]),te=H>_useFileViewerZoom.ZOOM_REST;return(0,_jsxRuntime.jsxs)(_reactNativeGestureHandler.GestureHandlerRootView,{style:[styles.root,s],onLayout:B,testID:o,accessible:void 0!==c,accessibilityLabel:c,accessibilityRole:"none",children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:L,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.viewport,collapsable:!1,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[styles.viewport,G],children:(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:A,children:(0,_jsxRuntime.jsx)(AnimatedScrollView,{ref:O,onScroll:J,scrollEventThrottle:16,scrollEnabled:!te,showsVerticalScrollIndicator:!te,contentContainerStyle:Y,children:ee.map(e=>(0,_jsxRuntime.jsx)(_FileViewerPage.FileViewerPage,{width:m,height:C,uri:te&&V?.page===e&&V.uri?V.uri:x[e],mounted:Math.abs(e-b)<=2,renderLoading:Q},e))})})})})}),0===w&&(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,styles.pagePlaceholder],children:a?a():(0,_jsxRuntime.jsx)(_index2.Spinner,{size:"lg"})})]})},FileViewer=({kind:e="auto",...t})=>"image"===(0,_fileSource.resolveKind)(e,t.source.uri)?(0,_jsxRuntime.jsx)(_FileViewerImage.FileViewerImage,{...t}):(0,_jsxRuntime.jsx)(FileViewerPdf,{...t});exports.FileViewer=FileViewer,FileViewer.displayName="FileViewer";const styles=_reactNative.StyleSheet.create({root:{flex:1,overflow:"hidden"},viewport:{flex:1},pagePlaceholder:{flex:1,alignItems:"center",justifyContent:"center"}});var _default=exports.default=FileViewer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.OTPInput=exports.DEFAULT_OTP_INPUT_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_OTP_INPUT_LABELS=exports.DEFAULT_OTP_INPUT_LABELS=Object.freeze({field:e=>`Enter ${e}-digit code`}),sanitizeChar=(e,t)=>e?"number-pad"===t?e.replace(/\D/g,""):e:"",OTPInput=exports.OTPInput=(0,_react.forwardRef)((e,t)=>{const{value:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.OTPInput=exports.DEFAULT_OTP_INPUT_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_OTP_INPUT_LABELS=exports.DEFAULT_OTP_INPUT_LABELS=Object.freeze({field:e=>`Enter ${e}-digit code`}),sanitizeChar=(e,t)=>e?"number-pad"===t?e.replace(/\D/g,""):e:"",OTPInput=exports.OTPInput=(0,_react.forwardRef)((e,t)=>{const{value:a,defaultValue:i,onChange:n,onComplete:r,length:s=6,keyboardType:l="number-pad",autoFocus:o=!1,autoFocusDelay:c=0,disabled:u=!1,error:d,size:_="md",secure:p=!1,haptic:m,labels:x,onFocus:g,accessibilityLabel:f,style:h,cellStyle:v,textStyle:b,testID:y}=e;(0,_warnInvalidValue.warnInvalidValue)("OTPInput","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("OTPInput","keyboardType",e.keyboardType,["number-pad","default"]);const T=x?{...DEFAULT_OTP_INPUT_LABELS,...x}:DEFAULT_OTP_INPUT_LABELS,[j,N]=(0,_index.useControllableState)({value:a,defaultValue:i??"",onChange:n}),I=(0,_index2.useTheme)(),E=(0,_react.useMemo)(()=>buildStyles(I),[I]),A=(0,_index2.resolveOtpInputSize)(I,_),w=I.components["otp-input"][_].radius,V=(0,_react.useRef)([]),[F,P]=(0,_react.useState)(-1),[R,C]=(0,_react.useState)(0),O=(0,_react.useRef)(null),k=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,S=(0,_react.useRef)(new Map),L=(0,_react.useMemo)(()=>{const e=S.current,t=[];for(let a=0;a<s;a+=1){let i=e.get(a);i||(i=new _reactNative.Animated.Value(0),e.set(a,i)),t.push(i)}for(const t of Array.from(e.keys()))t>=s&&e.delete(t);return t},[s]),B=(0,_react.useRef)(-1),D=I.settings.components["otp-input"]?.shakeOnError??!1,z=(0,_index.useReducedMotion)(),M=!0===d||(0,_FieldBase.hasFieldText)(d);(0,_react.useEffect)(()=>{let e;return null===O.current||!M||O.current||(m&&(0,_index3.triggerHaptic)("notificationError"),D&&!z&&((0,_index2.setNativeValue)(k,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(k,{toValue:1,duration:I.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0}),_reactNative.Animated.timing(k,{toValue:-1,duration:I.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0}),_reactNative.Animated.timing(k,{toValue:1,duration:I.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0}),_reactNative.Animated.timing(k,{toValue:0,duration:I.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0})]),e.start())),O.current=M,()=>e?.stop()},[M,k,D,m,z,I.motion.duration.instant]),(0,_react.useEffect)(()=>{const e=B.current;if(B.current=F,e===F)return;if(-1===e&&-1===F)return;const t=[];return L.forEach((a,i)=>{const n=i===F?1:0;if(i!==F&&i!==e)return;const r=_reactNative.Animated.timing(a,{toValue:n,duration:I.motion.duration.fast,easing:_reactNative.Easing.bezier(...I.motion.ease["in-out"]),useNativeDriver:!0});r.start(),t.push(r)}),()=>t.forEach(e=>{e.stop()})},[F,L,I]);const q=(0,_react.useCallback)(e=>{const t=V.current[e];t&&t.focus()},[]);(0,_react.useImperativeHandle)(t,()=>({focus:()=>q(0),blur:()=>{const e=V.current[F>=0?F:0];e?.blur()},clear:()=>{N(""),q(0)}}),[q,F,N]),(0,_react.useEffect)(()=>{if(o&&!u){const e=setTimeout(()=>q(0),c);return()=>clearTimeout(e)}},[o,c,u,q]);const U=(0,_react.useMemo)(()=>{const e=new Array(s).fill("");for(let t=0;t<Math.min(j.length,s);t+=1)e[t]=j[t]??"";return e},[j,s]),H=(0,_react.useCallback)(e=>{const t=e.slice(0,s);t!==j&&(N(t),t.length===s&&r&&r(t))},[s,N,r,j]),W=(0,_react.useCallback)((e,t)=>{const a=t.replace(/\u200B/g,""),i=sanitizeChar(a,l);if(!i){const t=U.slice(),a=(t[e]??"").length>0;if(t[e]="",H(t.join("").slice(0,s)),!a&&e>0){const t=U.slice();t[e-1]="",H(t.join("")),q(e-1)}return}const n=U[e]??"",r=n&&i.length>s&&i.startsWith(n)?i.slice(n.length):i;if(r.length>=s){const t=r.slice(0,s),a=j.length;return H(t),t.length!==a&&m&&(0,_index3.triggerHaptic)(m),void V.current[e]?.blur()}const o=U.slice();let c=e;for(let e=0;e<i.length&&c<s;e+=1)o[c]=i[e]??"",c+=1;const u=o.join("").slice(0,s),d=j.length;H(u),u.length!==d&&m&&(0,_index3.triggerHaptic)(m);const _=Math.min(c,s-1);c>=s?V.current[e]?.blur():q(_)},[U,q,l,s,m,H,j]),$=(0,_react.useCallback)((e,t)=>{if("Backspace"!==t.nativeEvent.key)return;if(0===(U[e]??"").length){if(e>0){const t=U.slice();t[e-1]="",H(t.join("")),q(e-1)}}else{const t=U.slice();t[e]="",H(t.join(""))}},[U,q,H]),G=(0,_react.useCallback)((e,t)=>{P(e),g?.(t)},[g]),K=(0,_react.useCallback)(()=>{P(-1)},[]),X=(0,_react.useCallback)(()=>{if(u)return;const e=U.indexOf("");q(-1===e?s-1:e)},[U,u,q,s]),J=(0,_react.useCallback)(e=>{C(e.nativeEvent.layout.width)},[]),Q=f??T.field(s),Y=R>0?Math.max(24,Math.min(A.cell,Math.floor((R-A.gap*(s-1))/s))):A.cell,Z=k.interpolate({inputRange:[-1,1],outputRange:[-6,6]});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:h,onLayout:J,accessible:!0,accessibilityRole:"none",accessibilityLabel:Q,accessibilityValue:{text:a},accessibilityState:{disabled:u},"aria-disabled":u,testID:y,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:X,disabled:u,accessible:!1,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[E.row,{columnGap:A.gap,transform:[{translateX:Z}]}],children:U.map((e,t)=>{const a=F===t,i=e.length>0,n=M?I.colors["danger-border"]:I.colors["focus-ring"],r=L[t];if(!r)return null;const o=p&&i?"●":e;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:E.cellWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:_,width:Y,height:Y,radius:w,borderWidth:1.5,focused:a,error:M,filled:i,disabled:u,paddingHorizontal:I.space.none,paddingVertical:I.space.none,gap:I.space.none,style:v,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:e=>{V.current[t]=e},value:(p&&i?"":e)||"",onChangeText:e=>W(t,e),onKeyPress:e=>$(t,e),onFocus:e=>G(t,e),onBlur:K,keyboardType:l,editable:!u,selectTextOnFocus:!0,caretHidden:i,maxLength:s+1,textContentType:"oneTimeCode",autoComplete:0===t?"sms-otp":"off",importantForAutofill:0===t?"yes":"no",style:[E.input,{fontSize:A.text,color:I.colors["text-body"],...(0,_index2.fontFor)(I,"semibold")},b]}),p&&i?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:E.maskOverlay,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",weight:"semibold",style:[{fontSize:A.text},b],children:o})}):null]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[E.underline,{backgroundColor:n,opacity:r}]})]},`otp-cell-${t}`)})})}),(0,_jsxRuntime.jsx)(_FieldBase.FieldMessage,{size:_,error:!0,text:d})]})});OTPInput.displayName="OTPInput";const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},cellWrapper:{alignItems:"center"},input:{width:"100%",height:"100%",textAlign:"center",padding:e.space.none},maskOverlay:{..._reactNative.StyleSheet.absoluteFill,alignItems:"center",justifyContent:"center"},underline:{marginTop:e.space.xs,height:2,width:"60%",borderRadius:e.radius.pill,..._corners.smoothCorners}});var _default=exports.default=OTPInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ScannerOverlay=exports.DEFAULT_SCANNER_OVERLAY_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useReducedMotion=require("../../hooks/useReducedMotion.js"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_index2=require("../AppIcon/index.js"),_index3=require("../Button/index.js"),_index4=require("../EmptyState/index.js"),_index5=require("../IconButton/index.js"),_index6=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const MIN_FRAME=240,DEFAULT_FRAME=260,MARK_LENGTH=32,MARK_THICKNESS=4,LIFT=.06,BREATHE_SCALE=1.03,SNAP_SCALE=1.08,T=4,CORNERS=[{key:"tl",style:{top:0,left:0,borderTopWidth:4,borderLeftWidth:4}},{key:"tr",style:{top:0,right:0,borderTopWidth:4,borderRightWidth:4}},{key:"bl",style:{bottom:0,left:0,borderBottomWidth:4,borderLeftWidth:4}},{key:"br",style:{bottom:0,right:0,borderBottomWidth:4,borderRightWidth:4}}],DEFAULT_SCANNER_OVERLAY_LABELS=exports.DEFAULT_SCANNER_OVERLAY_LABELS=Object.freeze({hint:"Point the camera at the code",found:"Code found",invalid:"This code cannot be used. Try another.",torchOn:"Turn torch on",torchOff:"Turn torch off",manualEntry:"Enter code instead",gallery:"Upload from gallery",noPermissionTitle:"Camera access is off",noPermissionMessage:"Allow camera access to scan a code.",permissionAction:"Allow camera access",noCameraTitle:"No camera found",noCameraMessage:"This device has no camera available. You can still add the code another way."}),ScannerOverlay=exports.ScannerOverlay=(0,_react.forwardRef)((e,t)=>{(0,_warnInvalidValue.warnInvalidValue)("ScannerOverlay","state",e.state,["scanning","found","invalid","noPermission","noCamera"]);const{children:i,state:n="scanning",helperText:a,labels:r,torch:s=!1,onTorchChange:o,onManualEntry:l,onGallery:c,onPermissionAction:d,frameSize:u=DEFAULT_FRAME,haptic:m,style:h,testID:_}=e,x=(0,_index.useTheme)(),p=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),f=(0,_useReducedMotion.useReducedMotion)(),v=(0,_react.useMemo)(()=>buildStyles(x),[x]),g=(0,_react.useMemo)(()=>({...DEFAULT_SCANNER_OVERLAY_LABELS,...r}),[r]),y=a??g.hint,[j,b]=(0,_react.useState)({width:0,height:0}),R="scanning"===n||"found"===n||"invalid"===n,A=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ScannerOverlay=exports.DEFAULT_SCANNER_OVERLAY_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useReducedMotion=require("../../hooks/useReducedMotion.js"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_index2=require("../AppIcon/index.js"),_index3=require("../Button/index.js"),_index4=require("../EmptyState/index.js"),_index5=require("../IconButton/index.js"),_index6=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const MIN_FRAME=240,DEFAULT_FRAME=260,MARK_LENGTH=32,MARK_THICKNESS=4,LIFT=.06,BREATHE_SCALE=1.03,SNAP_SCALE=1.08,T=4,CORNERS=[{key:"tl",style:{top:0,left:0,borderTopWidth:4,borderLeftWidth:4}},{key:"tr",style:{top:0,right:0,borderTopWidth:4,borderRightWidth:4}},{key:"bl",style:{bottom:0,left:0,borderBottomWidth:4,borderLeftWidth:4}},{key:"br",style:{bottom:0,right:0,borderBottomWidth:4,borderRightWidth:4}}],DEFAULT_SCANNER_OVERLAY_LABELS=exports.DEFAULT_SCANNER_OVERLAY_LABELS=Object.freeze({hint:"Point the camera at the code",found:"Code found",invalid:"This code cannot be used. Try another.",torchOn:"Turn torch on",torchOff:"Turn torch off",manualEntry:"Enter code instead",gallery:"Upload from gallery",noPermissionTitle:"Camera access is off",noPermissionMessage:"Allow camera access to scan a code.",permissionAction:"Allow camera access",noCameraTitle:"No camera found",noCameraMessage:"This device has no camera available. You can still add the code another way."}),ScannerOverlay=exports.ScannerOverlay=(0,_react.forwardRef)((e,t)=>{(0,_warnInvalidValue.warnInvalidValue)("ScannerOverlay","state",e.state,["scanning","found","invalid","noPermission","noCamera"]);const{children:i,state:n="scanning",helperText:a,labels:r,torch:s=!1,onTorchChange:o,onManualEntry:l,onGallery:c,onPermissionAction:d,frameSize:u=DEFAULT_FRAME,haptic:m,style:h,testID:_}=e,x=(0,_index.useTheme)(),p=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),f=(0,_useReducedMotion.useReducedMotion)(),v=(0,_react.useMemo)(()=>buildStyles(x),[x]),g=(0,_react.useMemo)(()=>({...DEFAULT_SCANNER_OVERLAY_LABELS,...r}),[r]),y=a??g.hint,[j,b]=(0,_react.useState)({width:0,height:0}),R="scanning"===n||"found"===n||"invalid"===n,A=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current,N=x.motion.duration.slower,E=x.motion.duration.default;(0,_react.useEffect)(()=>{if(A.setValue(1),f)return;let e;return"scanning"===n&&N>0?e=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(A,{toValue:1.03,duration:2*N,useNativeDriver:!0}),_reactNative.Animated.timing(A,{toValue:1,duration:2*N,useNativeDriver:!0})])):"found"===n&&E>0&&(A.setValue(1.08),e=_reactNative.Animated.timing(A,{toValue:1,duration:E,useNativeDriver:!0})),e?.start(),()=>e?.stop()},[n,f,N,E,A]);const S=(0,_react.useRef)(n);(0,_react.useEffect)(()=>{S.current!==n&&(S.current=n,!1!==m&&("found"===n?(0,_hapticUtils.triggerHaptic)("notificationSuccess"):"invalid"===n&&(0,_hapticUtils.triggerHaptic)("notificationError")))},[n,m]);const{found:w,invalid:V}=g,{noPermissionTitle:C,noPermissionMessage:L}=g,{noCameraTitle:M,noCameraMessage:I}=g;(0,_react.useEffect)(()=>{switch(n){case"scanning":(0,_announce.announce)(y);break;case"found":(0,_announce.announce)(w);break;case"invalid":(0,_announce.announce)(V,{polite:!1});break;case"noPermission":(0,_announce.announce)(`${C}. ${L}`);break;case"noCamera":(0,_announce.announce)(`${M}. ${I}`)}},[n,y,w,V,C,L,M,I]);const O=Math.max(240,Math.min(u,j.width-2*x.space.xl)),P=(j.width-O)/2,k=Math.max(x.space.md,(j.height-O)/2-.06*j.height),q=j.width>0&&j.height>0,F={borderColor:"found"===n?x.colors.success:"invalid"===n?x.colors.danger:x.colors["on-scrim"],width:32,height:32},B="found"===n||"invalid"===n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.pill,{backgroundColor:"found"===n?x.colors.success:x.colors.danger}],children:(0,_jsxRuntime.jsx)(_index6.Text,{variant:"bodySmall",weight:"semibold",align:"center",style:{color:"found"===n?x.colors["on-success"]:x.colors["on-danger"]},children:"found"===n?w:V})}):(0,_jsxRuntime.jsx)(_index6.Text,{variant:"bodySmall",align:"center",style:{color:x.colors["on-scrim"]},children:y}),D=R&&null!=o,U=R?"glass":"outline";return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,testID:_,onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;b(e=>e.width===t&&e.height===i?e:{width:t,height:i})},style:[v.root,!R&&{backgroundColor:x.colors.bg},h],children:[R?(0,_jsxRuntime.jsx)(_reactNative.View,{style:_reactNative.StyleSheet.absoluteFill,children:i}):null,R&&q?(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"none",style:_reactNative.StyleSheet.absoluteFill,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.scrim,{left:0,right:0,top:0,height:k}]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.scrim,{left:0,right:0,top:k+O,bottom:0}]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.scrim,{left:0,width:P,top:k,height:O}]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.scrim,{left:P+O,right:0,top:k,height:O}]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{position:"absolute",left:P,top:k,width:O,height:O,transform:[{scale:A}]},children:CORNERS.map(e=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.mark,F,e.style]},e.key))})]})}):null,R?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:v.panel,children:(0,_jsxRuntime.jsx)(_index4.EmptyState,{fill:!0,icon:(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"noPermission"===n?"camera":"camera-slash",size:48,color:x.colors["text-subtle"]}),title:"noPermission"===n?C:M,description:"noPermission"===n?L:I,action:"noPermission"===n&&d?{label:g.permissionAction,onPress:d}:void 0})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"box-none",style:[v.bar,{paddingBottom:Math.max(p.bottom,x.space.md)}],children:[R&&q?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:v.message,children:B}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:v.actions,children:[D?(0,_jsxRuntime.jsx)(_index5.IconButton,{icon:s?"flash":"flash-slash",variant:"glass",size:"lg",active:s,haptic:m,accessibilityLabel:s?g.torchOff:g.torchOn,onPress:()=>o?.(!s)}):null,c?(0,_jsxRuntime.jsx)(_index3.Button,{label:g.gallery,leftIcon:"gallery",variant:U,tone:"neutral",size:"lg",haptic:m,onPress:c}):null,l?(0,_jsxRuntime.jsx)(_index3.Button,{label:g.manualEntry,leftIcon:"keyboard",variant:U,tone:"neutral",size:"lg",haptic:m,onPress:l}):null]})]})]})});ScannerOverlay.displayName="ScannerOverlay";const buildStyles=e=>_reactNative.StyleSheet.create({root:{flex:1,overflow:"hidden"},scrim:{position:"absolute",backgroundColor:e.colors.scrim},mark:{position:"absolute"},message:{alignItems:"center",paddingHorizontal:e.space.xl},pill:{paddingHorizontal:e.space.md,paddingVertical:e.space.xs,borderRadius:e.radius.pill,..._corners.smoothCorners},panel:{..._reactNative.StyleSheet.absoluteFill,justifyContent:"center"},bar:{position:"absolute",left:0,right:0,bottom:0,flexDirection:"column",alignItems:"center",justifyContent:"center",gap:e.space.sm,paddingHorizontal:e.space.md},actions:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"center",gap:e.space.sm}});var _default=exports.default=ScannerOverlay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Screen=Screen;var _react=require("react"),_reactNative=require("react-native"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeReanimated=require("react-native-reanimated"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useRefreshControl=require("../../hooks/useRefreshControl.js"),_index=require("../../theme/index.js"),_index2=require("../AppBar/index.js"),_index3=require("../AsyncBlock/index.js"),_index4=require("../EmptyState/index.js"),_index5=require("../KeyboardAwareScrollView/index.js"),_index6=require("../KeyboardToolbar/index.js"),_index7=require("../PagedListFooter/index.js"),_ScrollHost=require("./ScrollHost.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{};function renderFooter(e){return(0,_react.isValidElement)(e)?e:e?(0,_react.createElement)(e):null}const topPaddingOf=e=>{const t=_reactNative.StyleSheet.flatten(e),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Screen=Screen;var _react=require("react"),_reactNative=require("react-native"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeReanimated=require("react-native-reanimated"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useRefreshControl=require("../../hooks/useRefreshControl.js"),_index=require("../../theme/index.js"),_index2=require("../AppBar/index.js"),_index3=require("../AsyncBlock/index.js"),_index4=require("../EmptyState/index.js"),_index5=require("../KeyboardAwareScrollView/index.js"),_index6=require("../KeyboardToolbar/index.js"),_index7=require("../PagedListFooter/index.js"),_ScrollHost=require("./ScrollHost.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_EDGES=["top","bottom"],SCROLL_EVENT_THROTTLE=16,noop=()=>{};function renderFooter(e){return(0,_react.isValidElement)(e)?e:e?(0,_react.createElement)(e):null}const topPaddingOf=e=>{const t=_reactNative.StyleSheet.flatten(e),r=t?.paddingTop??t?.paddingVertical??t?.padding;return"number"==typeof r?r:0},buildStyles=e=>_reactNative.StyleSheet.create({flex:{flex:1},root:{flex:1,backgroundColor:e.colors.bg},overlay:{position:"absolute",top:0,left:0,right:0},headerRaised:{zIndex:1},footer:{backgroundColor:e.colors.bg,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:e.colors.border}});function Screen(e){const{title:t,subtitle:r,largeTitle:o=!0,headerShadowOnScroll:n,onBack:a,rightActions:i,leading:l,trailing:s,children:c,onRefresh:d,refreshing:u=!1,footer:_,scroll:f=!0,list:h,edges:m=DEFAULT_EDGES,keyboardToolbar:p=!0,bottomInset:x=0,gutter:v,floatingAction:g,scrollRef:S,onScroll:y,contentContainerStyle:R,testID:b}=e,j=(0,_index.useTheme)(),C=v??void 0===h,E=j.space[j.components.screen.gutter],T=C?E:0,L=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),N=(0,_react.useMemo)(()=>buildStyles(j),[j]),[k]=(0,_react.useState)(()=>new _reactNative.Animated.Value(0)),[O,A]=(0,_react.useState)(0),[V,q]=(0,_react.useState)(0),w=void 0!==a,B=(0,_react.useRef)(a);B.current=a;const F=Boolean(t||r||a||l||s||i?.length),M=o&&void 0!==t,H=M&&(void 0!==h||f),P=H?O:0,z=F&&!H&&(n??j.settings.components.screen?.headerShadowOnScroll??!0),[D,K]=(0,_react.useState)(!1),I=(0,_react.useRef)(z);I.current=z;const headerGap=e=>e>0?e:F?j.space.lg:0,W=void 0!==_,{refreshControl:G}=(0,_useRefreshControl.useRefreshControl)({onRefresh:d??noop,refreshing:u}),U=d?(0,_react.cloneElement)(G,{progressViewOffset:P}):void 0,Y=(0,_reactNativeReanimated.useSharedValue)(0),J=(0,_reactNativeReanimated.useSharedValue)(0),Q=(0,_reactNativeReanimated.useSharedValue)(0),X=(0,_reactNativeReanimated.useSharedValue)(0),Z=(0,_react.useRef)(null),$=(0,_react.useRef)(0),ee=(0,_react.useRef)(0),te=(0,_react.useMemo)(()=>({top:Y,bottom:J,offset:Q,maxOffset:X,scrollTo:e=>{const t=Z.current;t instanceof _reactNative.FlatList?t.scrollToOffset({offset:e,animated:!1}):t?.scrollTo({y:e,animated:!1})}}),[Y,J,Q,X]),re=(0,_react.useCallback)(e=>{Z.current=e,"function"==typeof S?S(e):S&&(S.current=e)},[S]),oe=(0,_react.useCallback)(()=>{X.value=Math.max(0,$.current-ee.current)},[X]),ne=(0,_react.useRef)(y);ne.current=y;const ae=(0,_react.useMemo)(()=>_reactNative.Animated.event([{nativeEvent:{contentOffset:{y:k}}}],{useNativeDriver:!1,listener:e=>{if(Q.value=e.nativeEvent.contentOffset.y,I.current){const t=e.nativeEvent.contentOffset.y>0;K(e=>e===t?e:t)}ne.current?.(e)}}),[k,Q]),ie=(0,_react.useCallback)(e=>{const{height:t}=e.nativeEvent.layout;A(e=>Math.max(e,t))},[]),le=(0,_react.useCallback)(e=>{q(e.nativeEvent.layout.height)},[]);(0,_react.useEffect)(()=>{if(!w)return;const e=_reactNative.BackHandler.addEventListener("hardwareBackPress",()=>(B.current?.(),!0));return()=>e.remove()},[w]);const se=m.includes("left")?L.left:0,ce=m.includes("right")?L.right:0,de=m.includes("bottom")?L.bottom:0,ue=m.includes("top")&&!F?L.top:0,fe=j.space[j.components["floating-action-button"]["bottom-offset"]],he=g?.props.bottomOffset??fe,me=g?(0,_index.resolveFloatingActionButtonSize)(j,g.props.size??"md").diameter+he+j.space.lg:0,pe=W?Math.max(0,V-L.bottom):x,xe=g?(0,_react.cloneElement)(g,{bottomOffset:he+pe,position:g.props.position??"bottomRight"}):null,ve=W?me:Math.max(de,g?me+L.bottom:0),ge=x+ve-(W?0:de),Se=m.filter(e=>"top"!==e&&!("bottom"===e&&W)),ye=F?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H?N.overlay:z?N.headerRaised:void 0,onLayout:H?ie:void 0,children:(0,_jsxRuntime.jsx)(_index2.AppBar,{title:t,subtitle:r,variant:M?"large":"default",scrollY:H?k:void 0,elevated:z&&D,onBack:a,rightActions:i,leading:l,trailing:s,gutter:E})}):null,Re=(0,_react.useCallback)(()=>{const e=Z.current?.getNativeScrollRef();e&&e.measureInWindow((e,t,r,o)=>{ee.current=o,Y.value=t+P,J.value=t+o,oe()})},[P,Y,J,oe]);(0,_react.useEffect)(()=>{Re()},[Re]);const be=(0,_react.useCallback)((e,t)=>{$.current=t,oe()},[oe]);let je;if(void 0!==h){const{state:e,paging:t,...r}=h,o=topPaddingOf([r.contentContainerStyle,R]),handleEndReached=e=>{t?.hasMore&&!t.loadingMore&&null==t.errorMore&&t.loadMore(),r.onEndReached?.(e)},n=(0,_jsxRuntime.jsx)(_reactNative.FlatList,{keyboardShouldPersistTaps:"handled",onEndReachedThreshold:t?.5:void 0,...r,ref:re,refreshControl:U,onScroll:ae,onLayout:e=>{Re(),r.onLayout?.(e)},onContentSizeChange:(e,t)=>{be(e,t),r.onContentSizeChange?.(e,t)},onEndReached:t?handleEndReached:r.onEndReached,ListEmptyComponent:e?.empty?(0,_jsxRuntime.jsx)(_index4.EmptyState,{...e.empty}):void 0,ListFooterComponent:t||r.ListFooterComponent?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[renderFooter(r.ListFooterComponent),t?(0,_jsxRuntime.jsx)(_index7.PagedListFooter,{paging:t}):null]}):void 0,scrollEventThrottle:SCROLL_EVENT_THROTTLE,style:N.flex,contentContainerStyle:[{paddingTop:P,paddingLeft:se+T,paddingRight:ce+T},{paddingBottom:x+ve},r.contentContainerStyle,R,{paddingTop:P+headerGap(o)}]});je=(0,_jsxRuntime.jsx)(_ScrollHost.ScrollHostContext.Provider,{value:te,children:e?(0,_jsxRuntime.jsx)(_index3.AsyncBlock,{loading:e.loading,error:e.error,errorTitle:e.errorTitle,onRetry:e.onRetry,skeleton:e.skeleton,style:[N.flex,{paddingTop:P+headerGap(o)}],children:n}):n})}else je=f?(0,_jsxRuntime.jsx)(_ScrollHost.ScrollHostContext.Provider,{value:te,children:(0,_jsxRuntime.jsxs)(_index5.KeyboardAwareScrollView,{ref:re,refreshControl:U,onScroll:ae,scrollEventThrottle:SCROLL_EVENT_THROTTLE,onLayout:Re,onContentSizeChange:be,safeAreaEdges:Se,style:N.flex,contentContainerStyle:[{paddingHorizontal:T},R,{paddingTop:P+headerGap(topPaddingOf(R))}],children:[c,ge>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:ge}}):null]})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[N.flex,{paddingLeft:se+T,paddingRight:ce+T,paddingBottom:x+ve},R],children:c});const Ce=W?(0,_jsxRuntime.jsx)(_reactNativeKeyboardController.KeyboardStickyView,{onLayout:le,style:[N.footer,{paddingLeft:se+E,paddingRight:ce+E,paddingBottom:de+x}],children:_}):null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{testID:b,style:[N.root,{paddingTop:ue}],children:[H?null:ye,je,Ce,xe,void 0!==h?c:null,H?ye:null,p?(0,_jsxRuntime.jsx)(_index6.KeyboardToolbar,{}):null]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SegmentedControl=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../FieldBase/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("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=exports.SegmentedControl=(0,_react.forwardRef)((e,t)=>{const{segments:r,label:i,helperText:n,error:l,value:s,defaultValue:a,onChange:o,size:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SegmentedControl=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../FieldBase/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("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=exports.SegmentedControl=(0,_react.forwardRef)((e,t)=>{const{segments:r,label:i,helperText:n,error:l,value:s,defaultValue:a,onChange:o,size:c="md",fullWidth:d=!0,disabled:u=!1,tone:m="primary",variant:x="segmented",radius:g,labelLines:h=1,haptic:_,accessibilityLabel:p,style:v,containerStyle:b,segmentStyle:f,selectedIndicatorStyle:y,textStyle:S,labelStyle:j,testID:w}=e;(0,_warnInvalidValue.warnInvalidValue)("SegmentedControl","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("SegmentedControl","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("SegmentedControl","variant",e.variant,["underline","pills","segmented"]);const[I,C]=(0,_index.useControllableState)({value:s,defaultValue:a??r[0]?.value,onChange:o}),R=(0,_index2.useTheme)(),V=R.components["segmented-control"],q=(0,_react.useMemo)(()=>buildStyles(R),[R]),k=(0,_react.useMemo)(()=>(0,_index2.resolveSegmentedControlSize)(R,c),[R,c]),F=h>=2?2:1,L=F>1,N="segmented"===x,z="underline"===x,M="pills"===x,T=N?R.space[V["track-padding"]]:0,E=Math.ceil(1.25*k.text)*(F-1),A=V["underline-height"],D=R.space[V["pill-inset"]],H="number"==typeof g?g:g?R.radius[g]:void 0,B=H??R.radius.md,W=void 0===H?R.radius.sm:Math.max(H-T,0),P=H??R.radius.pill,O=H??R.radius.none,[G,X]=(0,_react.useState)([]),J=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,K=Math.max(0,r.findIndex(e=>e.value===I)),Q=G[K],U=Q?.x,Y=(0,_react.useCallback)(e=>{const t=R.motion.spring.snappy,r=_reactNative.Animated.spring(J,{toValue:e,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:!0});return r.start(),r},[R.motion.spring.snappy,J]);(0,_react.useEffect)(()=>{X(e=>e.length===r.length||0===e.length?e:[])},[r.length]);const Z=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(void 0===U)return;const e=null!==Z.current&&Z.current!==K;if(Z.current=K,!e)return void J.setValue(U);const t=Y(U);return()=>t.stop()},[K,U,Y,J]);const $=(0,_react.useCallback)((e,t)=>{const{x:r,width:i}=t.nativeEvent.layout;X(t=>{const n=t[e];if(n&&n.x===r&&n.width===i)return t;const l=t.slice();return l[e]={x:r,width:i},l})},[]),ee=(0,_react.useCallback)(e=>{if(u)return;if(e.value===I)return;const t=(0,_index3.resolveHaptic)(_,"selection");t&&(0,_index3.triggerHaptic)(t),C(e.value)},[u,C,I,_]),te=N?R.colors.surface:M?R.colors["primary-soft"]:R.colors.primary,re=N?W:M?P:O,ie=activeInkFor(R,m),ne=R.colors["bg-muted"],le=(0,_SquircleFill.useSquircle)(N,B),se=!0===l||(0,_index4.hasFieldText)(l),ae=se&&!u,oe=R.colors["field-border-error"],ce=R.size.border,de=(0,_index4.hasFieldText)(i),ue=se?l:n,me=(0,_index4.hasFieldText)(ue),xe=p??("string"==typeof i?i:void 0),ge=(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,accessibilityRole:"radiogroup",accessibilityLabel:xe,testID:w,style:[q.track,{...L?{minHeight:k.height+E}:{height:k.height},opacity:u?.55:1,alignSelf:d?"stretch":"flex-start"},N?{borderRadius:B,..._corners.smoothCorners,backgroundColor:le.active?"transparent":ne,padding:T}:z?{borderBottomColor:ae?oe:R.colors["border-subtle"],borderBottomWidth:_reactNative.StyleSheet.hairlineWidth}:null,b,v],onLayout:le.onLayout,children:[le.active&&le.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:le.size.width,height:le.size.height,radius:B,fill:ne,stroke:ae?oe:void 0,strokeWidth:ce}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:q.row,children:[Q?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[q.thumb,N?L?{top:0,bottom:0}:{top:0,height:k.height-2*T}:M?{top:D,bottom:D,left:D}:{bottom:0,height:A},{width:M?Math.max(Q.width-2*D,0):Q.width,borderRadius:re,..._corners.smoothCorners,backgroundColor:te,transform:[{translateX:J}]},y]}):null,r.map((e,t)=>{const r=e.value===I,i=r?ie:R.colors["text-subtle"],n=(0,_slotIcon.renderSlotIcon)(e.icon,{color:i,size:k.icon,selected:r,disabled:u});return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>ee(e),onLayout:e=>$(t,e),disabled:u,accessibilityRole:"radio",accessibilityLabel:e.label,accessibilityState:{checked:r,selected:r,disabled:u},"aria-checked":r,"aria-disabled":u,style:({pressed:e})=>[q.segment,L?q.segmentMultiline:null,{paddingHorizontal:k["padding-x"],opacity:e&&!r?.7:1},f],children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:q.segmentIcon,children:n}):null,(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:r?"semibold":"medium",style:[q.segmentLabel,L?q.segmentLabelMultiline:null,{color:i,fontSize:k.text},S,j],numberOfLines:F,children:e.label})]},String(e.value))})]}),!ae||z||le.active?null:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{borderWidth:ce,borderColor:oe,borderRadius:N?B:P,..._corners.smoothCorners}]})]});return de||me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{alignSelf:d?"stretch":"flex-start"},children:[de?(0,_jsxRuntime.jsx)(_index4.FieldLabel,{size:c,children:i}):null,ge,me?(0,_jsxRuntime.jsx)(_index4.FieldMessage,{size:c,text:ue,error:se}):null]}):ge});SegmentedControl.displayName="SegmentedControl";const buildStyles=e=>_reactNative.StyleSheet.create({track:{flexDirection:"row",alignItems:"stretch",position:"relative"},row:{flex:1,flexDirection:"row",alignItems:"stretch",position:"relative",overflow:"hidden"},thumb:{position:"absolute",left:0},segment:{flexGrow:1,flexShrink:1,flexBasis:"auto",flexDirection:"row",alignItems:"center",justifyContent:"center"},segmentIcon:{marginRight:e.space.xs},segmentMultiline:{paddingVertical:e.space.xs},segmentLabel:{includeFontPadding:!1},segmentLabelMultiline:{flexShrink:1,textAlign:"center"}});var _default=exports.default=SegmentedControl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Wheel=exports.WHEEL_VISIBLE_ITEMS=exports.WHEEL_CENTER_OFFSET=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const WHEEL_VISIBLE_ITEMS=exports.WHEEL_VISIBLE_ITEMS=5,WHEEL_CENTER_OFFSET=exports.WHEEL_CENTER_OFFSET=Math.floor(WHEEL_VISIBLE_ITEMS/2),HAPTIC_DEBOUNCE_MS=35,WEB_SETTLE_MS=120,SCALE_STOPS=[-2,-1,0,1,2],WheelRow=(0,_react.memo)(({label:e,index:t,scrollY:a,itemHeight:n,selected:r,theme:i,reducedMotion:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Wheel=exports.WHEEL_VISIBLE_ITEMS=exports.WHEEL_CENTER_OFFSET=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const WHEEL_VISIBLE_ITEMS=exports.WHEEL_VISIBLE_ITEMS=5,WHEEL_CENTER_OFFSET=exports.WHEEL_CENTER_OFFSET=Math.floor(WHEEL_VISIBLE_ITEMS/2),HAPTIC_DEBOUNCE_MS=35,WEB_SETTLE_MS=120,SCALE_STOPS=[-2,-1,0,1,2],WheelRow=(0,_react.memo)(({label:e,index:t,scrollY:a,itemHeight:n,selected:r,theme:i,reducedMotion:c,onPress:s,editor:l})=>{const{opacity:o,scale:u}=(0,_react.useMemo)(()=>{const e=_reactNative.Animated.subtract(_reactNative.Animated.divide(a,n),t);return{opacity:e.interpolate({inputRange:SCALE_STOPS,outputRange:[.3,.6,1,.6,.3],extrapolate:"clamp"}),scale:e.interpolate({inputRange:SCALE_STOPS,outputRange:[.85,.95,1.05,.95,.85],extrapolate:"clamp"})}},[a,n,t]),d=(0,_jsxRuntime.jsx)(_index2.Text,{variant:"h3",weight:r?"semibold":"medium",color:r?"primary":"secondary",numberOfLines:1,maxFontSizeMultiplier:1.5,style:{letterSpacing:i["letter-spacing"].normal},children:e});return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.row,{height:n},c?{opacity:o}:{opacity:o,transform:[{scale:u}]}],accessible:!1,importantForAccessibility:"no",children:l??(s?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{focusable:!1,accessible:!1,onPress:()=>s(t),style:styles.rowPress,children:d}):d)})}),Wheel=({label:e,items:t,selectedIndex:a,onIndexChange:n,itemHeight:r,width:i,theme:c,haptic:s,disabled:l,reducedMotion:o,typeable:u,testID:d})=>{const m="web"===_reactNative.Platform.OS,[_,b]=(0,_react.useState)(null),x=(0,_react.useRef)(!1),h=(0,_react.useRef)(null),E=(0,_react.useRef)((0,_index.createAnimatedValue)(a*r)).current,y=(0,_react.useRef)(a*r),p=(0,_react.useRef)(a*r),f=(0,_react.useRef)(a),v=(0,_react.useRef)(0),S=(0,_react.useRef)(null),T=(0,_react.useRef)(()=>{}),g=t.length-1;(0,_react.useEffect)(()=>{f.current=a;const e=a*r;if(p.current===e)return;if(p.current=e,Math.abs(y.current-e)<1)return;y.current=e,m||(0,_index.setNativeValue)(E,e);const t=requestAnimationFrame(()=>{h.current?.scrollTo({y:e,animated:!1})});return()=>cancelAnimationFrame(t)},[a,r,E,m]),(0,_react.useEffect)(()=>{const e=y.current,t=requestAnimationFrame(()=>{h.current?.scrollTo({y:e,animated:!1})});return()=>cancelAnimationFrame(t)},[]),(0,_react.useEffect)(()=>()=>{S.current&&clearTimeout(S.current)},[]);const M=(0,_react.useCallback)((e,r)=>{if(!(e===a||e<0||e>g)){if("accessibility"===r){const e=(0,_hapticUtils.resolveHaptic)(s,"denseTick");e&&(0,_hapticUtils.triggerHaptic)(e)}if("keyboard"!==r){const a=t[e];a&&(0,_announce.announce)(a.accessibilityLabel??a.label)}n(e)}},[a,g,t,s,n]),R=(0,_react.useCallback)(()=>{!l&&u&&(x.current=!0,b(String(t[a]?.value??"")))},[l,u,t,a]),I=(0,_react.useCallback)(e=>{if(!x.current)return;x.current=!1,b(null);const a=e.trim();if(!/^\d+$/.test(a))return;const n=Number(a),r=t.findIndex(e=>e.value===n);r>=0&&M(r,"keyboard")},[t,M]);T.current=()=>{S.current=null;const e=Math.max(0,Math.min(g,Math.round(y.current/r))),t=e*r;Math.abs(y.current-t)>=1&&h.current?.scrollTo({y:t,animated:!o}),M(e,"scroll")};const j=(0,_react.useMemo)(()=>_reactNative.Animated.event([{nativeEvent:{contentOffset:{y:E}}}],{useNativeDriver:!m,listener:e=>{const t=e.nativeEvent.contentOffset.y;y.current=t;const a=Math.round(t/r);if(a!==f.current&&a>=0&&a<=g){const e=Date.now();if(e-v.current>=35){const t=(0,_hapticUtils.resolveHaptic)(s,"denseTick");t&&(0,_hapticUtils.triggerHaptic)(t),v.current=e}f.current=a}m&&(S.current&&clearTimeout(S.current),S.current=setTimeout(()=>T.current(),120))}}),[E,r,g,s,m]),L=(0,_react.useCallback)(e=>{const t=e.nativeEvent.contentOffset.y;M(Math.max(0,Math.min(g,Math.round(t/r))),"scroll")},[M,g,r]),w=(0,_react.useCallback)(e=>{if(l)return;const t=e.nativeEvent.actionName;"increment"===t?M(Math.min(g,a+1),"accessibility"):"decrement"===t&&M(Math.max(0,a-1),"accessibility")},[l,M,g,a]),A=(0,_react.useCallback)(e=>{l||h.current?.scrollTo({y:e*r,animated:!o})},[l,r,o]),C=(0,_react.useCallback)(({item:t,index:n})=>{const i=n===a,s=i&&null!==_;return(0,_jsxRuntime.jsx)(WheelRow,{label:t.label,index:n,scrollY:E,itemHeight:r,selected:i,theme:c,reducedMotion:o,onPress:i&&u?R:m?A:void 0,editor:s?(0,_jsxRuntime.jsx)(_reactNative.TextInput,{autoFocus:!0,selectTextOnFocus:!0,keyboardType:"number-pad",returnKeyType:"done",accessibilityLabel:e,value:_,onChangeText:b,onSubmitEditing:()=>I(_),onBlur:()=>I(_),style:{width:"100%",padding:c.space.none,textAlign:"center",fontSize:c.text.xl.size,color:c.colors["text-body"],fontWeight:c.weight.semibold,letterSpacing:c["letter-spacing"].normal}}):void 0})},[E,r,a,c,o,m,A,u,R,_,I,e]),N=(0,_react.useCallback)((e,t)=>`${String(e.value)}-${t}`,[]),F=t[a]?t[a].accessibilityLabel??t[a].label:"",H=m?{focusable:!0,role:"spinbutton","aria-label":e,"aria-valuetext":F,"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":g,"aria-disabled":l,onKeyDown:e=>{if(l)return;const t={ArrowDown:Math.min(g,a+1),PageDown:Math.min(g,a+1),ArrowUp:Math.max(0,a-1),PageUp:Math.max(0,a-1),Home:0,End:g}[e.key];void 0!==t&&(e.preventDefault?.(),M(t,"keyboard"))}}:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[void 0===i?styles.columnFlex:{width:i},{height:r*WHEEL_VISIBLE_ITEMS},styles.column,l?styles.disabled:null],testID:d,...H,children:[m?null:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:styles.a11yLayer,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:e,accessibilityValue:{text:F},accessibilityState:{disabled:Boolean(l)},"aria-disabled":Boolean(l),accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:w}),(0,_jsxRuntime.jsx)(_reactNative.Animated.ScrollView,{ref:h,showsVerticalScrollIndicator:!1,snapToInterval:r,snapToAlignment:"start",decelerationRate:"fast",bounces:!1,scrollEnabled:!l,nestedScrollEnabled:!0,scrollEventThrottle:16,onScroll:j,onMomentumScrollEnd:L,contentOffset:{x:0,y:a*r},contentContainerStyle:{paddingVertical:r*WHEEL_CENTER_OFFSET},style:[styles.list,{height:r*WHEEL_VISIBLE_ITEMS}],importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:t.map((e,t)=>(0,_jsxRuntime.jsx)(_react.Fragment,{children:C({item:e,index:t})},N(e,t)))})]})};exports.Wheel=Wheel;const styles=_reactNative.StyleSheet.create({column:{overflow:"hidden"},columnFlex:{flex:1},disabled:{opacity:.5},list:{flexGrow:0},row:{alignItems:"center",justifyContent:"center"},rowPress:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",flex:1},a11yLayer:{..._reactNative.StyleSheet.absoluteFill,zIndex:2}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NavigationScreen=NavigationScreen;var _bottomTabs=require("@react-navigation/bottom-tabs"),_native=require("@react-navigation/native"),_react=require("react"),_index=require("../components/Screen/index.js"),_index2=require("../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");const TAB_EDGES=["top"];function NavigationScreen({kind:e="pushed",appBar:t=!0,onBack:i,...n}){const o=(0,_native.useNavigation)(),r=(0,_react.useContext)(_bottomTabs.BottomTabBarHeightContext),a=!0===(0,_index2.useTheme)().settings.components.screen?.tabBarFloats,s=t?n:{...n,title:void 0,subtitle:void 0,leading:void 0,rightActions:void 0};return"tab"===e?(0,_jsxRuntime.jsx)(_index.Screen,{...s,largeTitle:!
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NavigationScreen=NavigationScreen;var _bottomTabs=require("@react-navigation/bottom-tabs"),_native=require("@react-navigation/native"),_react=require("react"),_index=require("../components/Screen/index.js"),_index2=require("../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");const TAB_EDGES=["top"];function NavigationScreen({kind:e="pushed",appBar:t=!0,onBack:i,...n}){const o=(0,_native.useNavigation)(),r=(0,_react.useContext)(_bottomTabs.BottomTabBarHeightContext),a=!0===(0,_index2.useTheme)().settings.components.screen?.tabBarFloats,s=t?n:{...n,title:void 0,subtitle:void 0,leading:void 0,trailing:void 0,rightActions:void 0};return"tab"===e?(0,_jsxRuntime.jsx)(_index.Screen,{...s,largeTitle:!1,edges:TAB_EDGES,bottomInset:a?r??0:0}):(0,_jsxRuntime.jsx)(_index.Screen,{...s,largeTitle:!1,onBack:"root"!==e&&t?i??o.goBack:void 0})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.NetworkStatusBanner=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../hooks/usePresenceMotion.js"),_index=require("../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");const NetworkStatusBanner=({message:e="You are offline. Some features may be unavailable.",
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.NetworkStatusBanner=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../hooks/usePresenceMotion.js"),_index=require("../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");const NetworkStatusBanner=({message:e="You are offline. Some features may be unavailable.",restoredMessage:t="You are back online.",restoredDuration:a=2e3,position:r="top",style:o,disabled:n=!1,safeArea:i=!0})=>{const s=(0,_index.useTheme)(),u=(0,_usePresenceMotion.usePresenceMotion)(),c=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),l=i?"top"===r?c.top:c.bottom:0,[d,f]=(0,_react.useState)(0),m=d>0?d:56+l,{isConnected:_,isInternetReachable:p}=(0,_mobileCore.useNetworkStatus)(),v=!(n||_&&!1!==p),[b,x]=(0,_react.useState)("hidden"),[N,g]=(0,_react.useState)("offline");(0,_react.useEffect)(()=>{"hidden"!==b&&g(b)},[b]),(0,_react.useEffect)(()=>{x(v?"offline":n?"hidden":e=>"offline"===e?"restored":e)},[v,n]),(0,_react.useEffect)(()=>{if("restored"!==b)return;const e=setTimeout(()=>x("hidden"),a);return()=>clearTimeout(e)},[b,a]);const S="hidden"!==b,h="restored"===b||"hidden"===b&&"restored"===N,y=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current,A=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current,w=u.duration("default");(0,_react.useEffect)(()=>{_reactNative.Animated.parallel([_reactNative.Animated.timing(y,{toValue:S?1:0,duration:s.motion.duration.default,useNativeDriver:!0}),_reactNative.Animated.timing(A,{toValue:S?1:0,duration:w,useNativeDriver:!0})]).start()},[S,y,A,s.motion.duration.default,w]);const R=(0,_react.useMemo)(()=>buildStyles(s),[s]),j=y.interpolate({inputRange:[0,1],outputRange:u.range("top"===r?-m:m,0)});return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:S?"auto":"none",accessibilityRole:"alert",accessibilityLiveRegion:S?"polite":"none",onLayout:e=>f(e.nativeEvent.layout.height),style:[R.container,"top"===r?R.top:R.bottom,"top"===r?{paddingTop:s.space.sm+l}:{paddingBottom:s.space.sm+l},{backgroundColor:h?s.colors["online-fill"]:s.colors["offline-fill"],opacity:A,transform:[{translateY:j}]},o],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:h?s.colors["on-success"]:s.colors["on-danger"],fontSize:s.text.sm.size,...(0,_index.fontFor)(s,"semibold"),textAlign:"center"},numberOfLines:2,children:h?t:e})})};exports.NetworkStatusBanner=NetworkStatusBanner;const buildStyles=e=>_reactNative.StyleSheet.create({container:{position:"absolute",left:0,right:0,paddingVertical:e.space.sm,paddingHorizontal:e.space.lg,zIndex:1e3,elevation:8},top:{top:0},bottom:{bottom:0}});var _default=exports.default=NetworkStatusBanner;
|