@webority/mobile-ui 0.146.2 → 0.147.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 +4344 -4214
- package/dist/canvas-kit/manifest.json +1 -1
- package/dist/canvas-kit/release.json +5 -5
- package/lib/commonjs/components/AuthedImage/authedImageCache.js +1 -1
- package/lib/commonjs/components/Avatar/Avatar.js +1 -1
- package/lib/commonjs/components/Badge/Badge.js +1 -1
- package/lib/commonjs/components/Banner/Banner.js +1 -1
- package/lib/commonjs/components/BarChart/BarChart.js +1 -1
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/commonjs/components/Button/Button.js +1 -1
- package/lib/commonjs/components/Calendar/Calendar.js +1 -1
- package/lib/commonjs/components/Carousel/Carousel.js +1 -1
- package/lib/commonjs/components/Checkbox/Checkbox.js +1 -1
- package/lib/commonjs/components/Confetti/Confetti.js +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +1 -1
- package/lib/commonjs/components/Drawer/Drawer.js +1 -1
- package/lib/commonjs/components/FieldBase/Chevron.js +1 -1
- package/lib/commonjs/components/FilePicker/FilePicker.js +1 -1
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +1 -1
- package/lib/commonjs/components/FormField/FormField.js +1 -1
- package/lib/commonjs/components/Input/Input.js +1 -1
- package/lib/commonjs/components/LoaderOverlay/LoaderOverlay.js +1 -1
- package/lib/commonjs/components/Menu/MenuSurface.js +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +1 -1
- package/lib/commonjs/components/Modal/Modal.js +1 -1
- package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
- package/lib/commonjs/components/OptionSheet/OptionSheet.js +1 -1
- package/lib/commonjs/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +1 -1
- package/lib/commonjs/components/Radio/RadioDot.js +1 -1
- package/lib/commonjs/components/Rating/Rating.js +1 -1
- package/lib/commonjs/components/RichTextEditor/markdownActions.js +1 -1
- package/lib/commonjs/components/ScannerOverlay/ScannerOverlay.js +1 -1
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/commonjs/components/SignaturePad/SignaturePad.js +1 -1
- package/lib/commonjs/components/SignaturePad/signatureGeometry.js +1 -1
- package/lib/commonjs/components/Skeleton/SkeletonClock.js +1 -1
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +1 -1
- package/lib/commonjs/components/Slider/valueText.js +1 -1
- package/lib/commonjs/components/Sparkline/Sparkline.js +1 -1
- package/lib/commonjs/components/Sparkline/geometry.js +1 -1
- package/lib/commonjs/components/Spinner/Spinner.js +1 -1
- package/lib/commonjs/components/Stepper/Stepper.js +1 -1
- package/lib/commonjs/components/Switch/Switch.js +1 -1
- package/lib/commonjs/components/Tabs/Tabs.js +1 -1
- package/lib/commonjs/components/TagInput/TagInput.js +1 -1
- package/lib/commonjs/components/Text/Text.js +1 -1
- package/lib/commonjs/components/Toast/Toast.js +1 -1
- package/lib/commonjs/components/Toast/ToastProvider.js +1 -1
- package/lib/commonjs/components/Tooltip/Tooltip.js +1 -1
- package/lib/commonjs/components/Tour/Tour.js +1 -1
- package/lib/commonjs/form/path.js +1 -1
- package/lib/commonjs/hooks/useDragToDismiss.js +1 -1
- package/lib/commonjs/hooks/usePressAnimation.js +1 -1
- package/lib/commonjs/network/NetworkStatusBanner.js +1 -1
- package/lib/commonjs/theme/animatedValue.js +1 -1
- package/lib/commonjs/theme/componentSizes.js +1 -1
- package/lib/commonjs/theme/merge.js +1 -1
- package/lib/commonjs/theme/toneInk.js +1 -1
- package/lib/commonjs/utils/color.js +1 -1
- package/lib/commonjs/utils/nativeDriver.js +1 -0
- package/lib/module/components/AuthedImage/authedImageCache.js +1 -1
- package/lib/module/components/Avatar/Avatar.js +1 -1
- package/lib/module/components/Badge/Badge.js +1 -1
- package/lib/module/components/Banner/Banner.js +1 -1
- package/lib/module/components/BarChart/BarChart.js +1 -1
- package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/module/components/Button/Button.js +1 -1
- package/lib/module/components/Calendar/Calendar.js +1 -1
- package/lib/module/components/Carousel/Carousel.js +1 -1
- package/lib/module/components/Checkbox/Checkbox.js +1 -1
- package/lib/module/components/Confetti/Confetti.js +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +1 -1
- package/lib/module/components/Drawer/Drawer.js +1 -1
- package/lib/module/components/FieldBase/Chevron.js +1 -1
- package/lib/module/components/FilePicker/FilePicker.js +1 -1
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +1 -1
- package/lib/module/components/FormField/FormField.js +1 -1
- package/lib/module/components/Input/Input.js +1 -1
- package/lib/module/components/LoaderOverlay/LoaderOverlay.js +1 -1
- package/lib/module/components/Menu/MenuSurface.js +1 -1
- package/lib/module/components/MessageList/MessageList.js +1 -1
- package/lib/module/components/Modal/Modal.js +1 -1
- package/lib/module/components/OTPInput/OTPInput.js +1 -1
- package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
- package/lib/module/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/module/components/ProgressBar/ProgressBar.js +1 -1
- package/lib/module/components/Radio/RadioDot.js +1 -1
- package/lib/module/components/Rating/Rating.js +1 -1
- package/lib/module/components/RichTextEditor/markdownActions.js +1 -1
- package/lib/module/components/ScannerOverlay/ScannerOverlay.js +1 -1
- package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/module/components/SignaturePad/SignaturePad.js +1 -1
- package/lib/module/components/SignaturePad/signatureGeometry.js +1 -1
- package/lib/module/components/Skeleton/SkeletonClock.js +1 -1
- package/lib/module/components/Skeleton/SkeletonContent.js +1 -1
- package/lib/module/components/Slider/valueText.js +1 -1
- package/lib/module/components/Sparkline/Sparkline.js +1 -1
- package/lib/module/components/Sparkline/geometry.js +1 -1
- package/lib/module/components/Spinner/Spinner.js +1 -1
- package/lib/module/components/Stepper/Stepper.js +1 -1
- package/lib/module/components/Switch/Switch.js +1 -1
- package/lib/module/components/Tabs/Tabs.js +1 -1
- package/lib/module/components/TagInput/TagInput.js +1 -1
- package/lib/module/components/Text/Text.js +1 -1
- package/lib/module/components/Toast/Toast.js +1 -1
- package/lib/module/components/Toast/ToastProvider.js +1 -1
- package/lib/module/components/Tooltip/Tooltip.js +1 -1
- package/lib/module/components/Tour/Tour.js +1 -1
- package/lib/module/form/path.js +1 -1
- package/lib/module/hooks/useDragToDismiss.js +1 -1
- package/lib/module/hooks/usePressAnimation.js +1 -1
- package/lib/module/network/NetworkStatusBanner.js +1 -1
- package/lib/module/theme/animatedValue.js +1 -1
- package/lib/module/theme/componentSizes.js +1 -1
- package/lib/module/theme/merge.js +1 -1
- package/lib/module/theme/toneInk.js +1 -1
- package/lib/module/utils/color.js +1 -1
- package/lib/module/utils/nativeDriver.js +1 -0
- package/lib/typescript/commonjs/theme/animatedValue.d.ts +1 -1
- package/lib/typescript/commonjs/utils/nativeDriver.d.ts +2 -0
- package/lib/typescript/module/theme/animatedValue.d.ts +1 -1
- package/lib/typescript/module/utils/nativeDriver.d.ts +2 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MenuSurface=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_placement=require("../../utils/placement.js"),_responsive=require("../../utils/responsive.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Box/index.js"),_index3=require("../Divider/index.js"),_index4=require("../ListItem/index.js"),_index5=require("../Modal/index.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_index6=require("../OptionSheet/index.js"),_index7=require("../Text/index.js"),_focusHost=require("./focusHost.js"),_menuModel=require("./menuModel.js"),_webOnly=require("./webOnly.js"),_jsxRuntime=require("react/jsx-runtime");const MENU_MIN_WIDTH=180,MENU_MAX_WIDTH=280,TOP_ACTION_MIN_HEIGHT=64,ICON_SIZE=20,PREVIEW_LIFT=1.02,BACK_KEY="__menu-back",TOP_PREFIX="__menu-top:",MenuSurface=e=>{const{open:t,anchor:i,items:s,title:n,topActions:r,placement:o,presentation:a,unavailable:c,context:l=!1,preview:u,onClose:d,restoreFocusTo:_,haptic:m,accessibilityLabel:p,labels:x,testID:b}=e,h=(0,_index.useTheme)(),f=(0,_react.useMemo)(()=>buildStyles(h),[h]),j=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),[v,y]=(0,_ModalSafeArea.useModalInsets)(),g=(0,_react.useMemo)(()=>({...j,top:v.top,bottom:v.bottom}),[j,v]),R=(0,_reactNative.useWindowDimensions)(),w=(0,_usePresenceMotion.usePresenceMotion)(),I=w.duration("fast"),A=(0,_react.useMemo)(()=>(0,_menuModel.visibleGroups)(s,c),[s,c]),k=(0,_react.useMemo)(()=>(0,_menuModel.visibleTopActions)(r,c),[r,c]),M="sheet"===a||"auto"===a&&R.width<_responsive.Breakpoints.lg&&(0,_menuModel.wantsSheet)(A,k),[N,S]=(0,_react.useState)(null),[E,C]=(0,_react.useState)(null),D=(0,_react.useRef)(d);D.current=d;const O=(0,_react.useRef)(_);O.current=_;const L=(0,_react.useRef)(null),T=(0,_react.useRef)(!1),P=(0,_react.useRef)(!1),q=(0,_react.useRef)(new Map),H=(0,_react.useRef)(null),V=(0,_react.useCallback)(()=>{if(!T.current)return;T.current=!1;const e=L.current;L.current=null,e?e():(0,_focusHost.focusHost)(O.current?.())},[]);(0,_react.useEffect)(()=>{if(t)return P.current=!0,T.current=!1,L.current=null,(0,_placement.claimAnchoredSurface)(()=>D.current());P.current&&(P.current=!1,T.current=!0,S(null),C(null))},[t]);const B=(0,_react.useCallback)(e=>{if(e.disabled)return;const t=(0,_hapticUtils.resolveHaptic)(m,"selection");t&&(0,_hapticUtils.triggerHaptic)(t),e.key!==BACK_KEY?e.submenu?S(e):(L.current=e.onPress??null,D.current()):S(null)},[m]),F=(0,_react.useMemo)(()=>({width:R.width,height:R.height,insets:g}),[R.width,R.height,g]),K=(0,_react.useMemo)(()=>{if(!i||!E)return null;const e=i.x+i.width/2>F.width/2?"end":"start";return(0,_placement.computePlacement)(i,E,F,o,{align:e})},[i,E,F,o]);let $=F.height-g.top-g.bottom-2*_placement.PLACEMENT_MARGIN;if(i&&K){const e=(0,_placement.placementRoom)(i,F);$="top"===K.placement?e.above:e.below}const z=Math.min(280,F.width-g.left-g.right-2*_placement.PLACEMENT_MARGIN),U=t&&null!==K,W=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,Y=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current;(0,_react.useEffect)(()=>{if(!U)return(0,_index.setNativeValue)(W,0),void(0,_index.setNativeValue)(Y,1);const e=[_reactNative.Animated.timing(W,{toValue:1,duration:I,easing:_reactNative.Easing.bezier(...h.motion.ease.decelerate),useNativeDriver:!0})];l&&!w.reduced&&e.push(_reactNative.Animated.spring(Y,{toValue:1.02,damping:h.motion.spring.snappy.damping,stiffness:h.motion.spring.snappy.stiffness,mass:h.motion.spring.snappy.mass,useNativeDriver:!0}));const t=_reactNative.Animated.parallel(e);return t.start(),()=>t.stop()},[U,l,w.reduced,W,Y,h.motion,I]);const G=(0,_react.useCallback)(e=>{const{width:t,height:i}=e.nativeEvent.layout;C(e=>e&&e.width===t&&e.height===i?e:{width:t,height:i})},[]),X=l&&"top"===K?.placement,Z=N?.submenu?[N.submenu]:A,J=X?[...Z].reverse().map(e=>[...e].reverse()):Z,Q=[];if(N)Q.push({key:BACK_KEY,label:N.label});else for(const e of k)Q.push({key:`${TOP_PREFIX}${e.key}`,label:e.label,item:e});for(const e of J)for(const t of e)Q.push({key:t.key,label:t.label,item:t});const ee=Q[0]?.key;(0,_react.useEffect)(()=>{if(!U||M||!ee)return;const e=setTimeout(()=>(0,_focusHost.focusHost)(q.current.get(ee)),_focusHost.FOCUS_DELAY_MS);return()=>clearTimeout(e)},[U,M,ee]);const setItemRef=e=>t=>{t?q.current.set(e,t):q.current.delete(e)},te=(0,_webOnly.webOnly)({onKeyDown:e=>{const t=e.key??e.nativeEvent?.key??"",i=Q.length,s=Q.findIndex(e=>e.key===H.current);let n=-1;if("ArrowDown"===t)n=(s+1)%i;else if("ArrowUp"===t)n=s<=0?i-1:s-1;else if("Home"===t)n=0;else if("End"===t)n=i-1;else{if("ArrowLeft"===t&&N)return e.preventDefault?.(),void S(null);if("ArrowRight"===t&&Q[s]?.item?.submenu)return e.preventDefault?.(),void B(Q[s].item);if(1===t.length&&""!==t.trim()){const e=t.toLowerCase();for(let t=1;t<=i;t+=1){const r=(s+t)%i;if(Q[r].label.toLowerCase().startsWith(e)){n=r;break}}}}n>=0&&(e.preventDefault?.(),(e=>{const t=Q[e];t&&(0,_focusHost.focusHost)(q.current.get(t.key))})(n))}});if(M){const e=N?.submenu?[{key:BACK_KEY,label:x.back,icon:"chevron-left"},...N.submenu]:[...k,...A.flat()],i=[...new Set(e.filter(e=>e.checked).map(e=>e.key))];return(0,_jsxRuntime.jsx)(_index6.OptionSheet,{open:t,onClose:d,onAfterClose:V,title:N?.label??n,options:e,getOptionLabel:e=>e.label,getOptionValue:e=>e.key,isOptionDisabled:e=>Boolean(e.disabled),destructiveOf:e=>Boolean(e.destructive),getOptionDescription:e=>e.description,getOptionIcon:e=>{const t=e;return(0,_slotIcon.renderSlotIcon)(t.icon,{color:t.destructive?h.colors["danger-text"]:h.colors["text-muted"],size:20,disabled:Boolean(t.disabled)})},value:i,onChange:(e,t)=>B(t),accessibilityLabel:p??n,testID:b?`${b}-sheet`:void 0})}const inkFor=e=>e.disabled?h.colors["text-disabled"]:e.destructive?h.colors["danger-text"]:h.colors["text-body"],inkRoleFor=e=>e.disabled?"disabled":e.destructive?"danger":"primary",ie=N?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index4.ListItem,{ref:setItemRef(BACK_KEY),variant:"menu",onPress:()=>S(null),onFocus:()=>{H.current=BACK_KEY},accessibilityLabel:`${x.back}, ${N.label}`,leading:(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.icon,children:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-left",size:20,color:h.colors["text-muted"]})}),title:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",weight:"semibold",numberOfLines:1,children:N.label})}),(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[n?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"secondary",accessibilityRole:"header",numberOfLines:2,style:f.title,children:n}):null,k.length>0?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.topRow,children:k.map(e=>{const t=`${TOP_PREFIX}${e.key}`,i=Boolean(e.disabled),s=inkFor(e);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:setItemRef(t),onPress:()=>B(e),onFocus:()=>{H.current=t},disabled:i,accessibilityRole:"menuitem",accessibilityLabel:e.accessibilityLabel??e.label,accessibilityState:{disabled:i},"aria-disabled":i,testID:e.testID,style:({pressed:e})=>[f.topAction,e?f.pressed:null],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(e.icon,{color:s,size:20,disabled:i})}),(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:inkRoleFor(e),numberOfLines:1,children:e.label})]},t)})}),(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"})]}):null]});return(0,_jsxRuntime.jsxs)(_index5.Modal,{open:t,onClose:d,presentation:"fullScreen",bare:!0,backdropOpacity:l?void 0:0,haptic:!1,labels:{close:x.close},onInsetsChange:y,onDismissed:V,testID:b?`${b}-modal`:void 0,children:[l&&u&&i?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:[f.preview,{left:i.x,top:i.y,width:i.width,height:i.height,transform:[{scale:Y}]}],children:u}):null,(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{accessibilityRole:"menu",accessibilityLabel:N?.label??p??n,onLayout:G,testID:b?`${b}-menu`:void 0,...te,style:[f.anchored,{left:K?.x??0,top:K?.y??0,maxWidth:z,opacity:U?W:0}],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.surface,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[f.clip,{maxHeight:$}],children:[ie,(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:f.scroll,bounces:!1,keyboardShouldPersistTaps:"handled",children:J.map((e,t)=>{const i=e.some(e=>null!=e.icon);return(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[t>0?(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"}):null,e.map(e=>((e,t)=>{const i=Boolean(e.disabled),s=inkFor(e),n=e.detail||e.checked||e.submenu?(0,_jsxRuntime.jsxs)(_index2.Row,{gap:"md",children:[e.detail?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"tertiary",children:e.detail}):null,e.checked?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"check",size:20,color:h.colors.primary}):null,e.submenu?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-right",size:20,color:h.colors["text-subtle"]}):null]}):void 0;return(0,_jsxRuntime.jsx)(_index4.ListItem,{ref:setItemRef(e.key),variant:"menu",onPress:()=>B(e),onFocus:()=>{H.current=e.key},disabled:i,checked:e.checked,accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,rightPlacement:"side",leading:t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.icon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(e.icon,{color:s,size:20,disabled:i})}):void 0,title:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",color:inkRoleFor(e),numberOfLines:2,children:e.label}),subtitle:e.description?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"secondary",numberOfLines:2,children:e.description}):void 0,trailing:n},e.key)})(e,i))]},e[0].key)})})]})})})]})};exports.MenuSurface=MenuSurface;const buildStyles=e=>_reactNative.StyleSheet.create({preview:{position:"absolute"},anchored:{position:"absolute",minWidth:180},surface:{backgroundColor:e.colors.surface,borderRadius:e.radius.md,..._corners.smoothCorners,...e.shadow.popover},clip:{borderRadius:e.radius.md,..._corners.smoothCorners,overflow:"hidden"},scroll:{flexGrow:0,flexShrink:1},title:{paddingHorizontal:e.space.md,paddingTop:e.space.sm,paddingBottom:e.space.xs},pressed:{backgroundColor:e.colors["surface-pressed"]},icon:{width:20,alignItems:"center"},topRow:{flexDirection:"row",padding:e.space.xs,gap:e.space.xs},topAction:{flexGrow:1,flexBasis:0,alignItems:"center",justifyContent:"center",gap:e.space.xs,minHeight:64,borderRadius:e.radius.sm,..._corners.smoothCorners}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MenuSurface=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_placement=require("../../utils/placement.js"),_responsive=require("../../utils/responsive.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Box/index.js"),_index3=require("../Divider/index.js"),_index4=require("../ListItem/index.js"),_index5=require("../Modal/index.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_index6=require("../OptionSheet/index.js"),_index7=require("../Text/index.js"),_focusHost=require("./focusHost.js"),_menuModel=require("./menuModel.js"),_webOnly=require("./webOnly.js"),_jsxRuntime=require("react/jsx-runtime");const MENU_MIN_WIDTH=180,MENU_MAX_WIDTH=280,TOP_ACTION_MIN_HEIGHT=64,ICON_SIZE=20,PREVIEW_LIFT=1.02,BACK_KEY="__menu-back",TOP_PREFIX="__menu-top:",MenuSurface=e=>{const{open:t,anchor:i,items:n,title:s,topActions:r,placement:o,presentation:a,unavailable:c,context:l=!1,preview:u,onClose:d,restoreFocusTo:_,haptic:m,accessibilityLabel:p,labels:x,testID:h}=e,b=(0,_index.useTheme)(),f=(0,_react.useMemo)(()=>buildStyles(b),[b]),v=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),[j,y]=(0,_ModalSafeArea.useModalInsets)(),g=(0,_react.useMemo)(()=>({...v,top:j.top,bottom:j.bottom}),[v,j]),R=(0,_reactNative.useWindowDimensions)(),w=(0,_usePresenceMotion.usePresenceMotion)(),I=w.duration("fast"),A=(0,_react.useMemo)(()=>(0,_menuModel.visibleGroups)(n,c),[n,c]),M=(0,_react.useMemo)(()=>(0,_menuModel.visibleTopActions)(r,c),[r,c]),k="sheet"===a||"auto"===a&&R.width<_responsive.Breakpoints.lg&&(0,_menuModel.wantsSheet)(A,M),[S,N]=(0,_react.useState)(null),[D,E]=(0,_react.useState)(null),C=(0,_react.useRef)(d);C.current=d;const O=(0,_react.useRef)(_);O.current=_;const L=(0,_react.useRef)(null),T=(0,_react.useRef)(!1),q=(0,_react.useRef)(!1),P=(0,_react.useRef)(new Map),H=(0,_react.useRef)(null),V=(0,_react.useCallback)(()=>{if(!T.current)return;T.current=!1;const e=L.current;L.current=null,e?e():(0,_focusHost.focusHost)(O.current?.())},[]);(0,_react.useEffect)(()=>{if(t)return q.current=!0,T.current=!1,L.current=null,(0,_placement.claimAnchoredSurface)(()=>C.current());q.current&&(q.current=!1,T.current=!0,N(null),E(null))},[t]);const B=(0,_react.useCallback)(e=>{if(e.disabled)return;const t=(0,_hapticUtils.resolveHaptic)(m,"selection");t&&(0,_hapticUtils.triggerHaptic)(t),e.key!==BACK_KEY?e.submenu?N(e):(L.current=e.onPress??null,C.current()):N(null)},[m]),F=(0,_react.useMemo)(()=>({width:R.width,height:R.height,insets:g}),[R.width,R.height,g]),K=(0,_react.useMemo)(()=>{if(!i||!D)return null;const e=i.x+i.width/2>F.width/2?"end":"start";return(0,_placement.computePlacement)(i,D,F,o,{align:e})},[i,D,F,o]);let $=F.height-g.top-g.bottom-2*_placement.PLACEMENT_MARGIN;if(i&&K){const e=(0,_placement.placementRoom)(i,F);$="top"===K.placement?e.above:e.below}const z=Math.min(280,F.width-g.left-g.right-2*_placement.PLACEMENT_MARGIN),U=t&&null!==K,W=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,Y=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current;(0,_react.useEffect)(()=>{if(!U)return(0,_index.setNativeValue)(W,0),void(0,_index.setNativeValue)(Y,1);const e=[_reactNative.Animated.timing(W,{toValue:1,duration:I,easing:_reactNative.Easing.bezier(...b.motion.ease.decelerate),useNativeDriver:_nativeDriver.nativeDriver})];l&&!w.reduced&&e.push(_reactNative.Animated.spring(Y,{toValue:1.02,damping:b.motion.spring.snappy.damping,stiffness:b.motion.spring.snappy.stiffness,mass:b.motion.spring.snappy.mass,useNativeDriver:_nativeDriver.nativeDriver}));const t=_reactNative.Animated.parallel(e);return t.start(),()=>t.stop()},[U,l,w.reduced,W,Y,b.motion,I]);const G=(0,_react.useCallback)(e=>{const{width:t,height:i}=e.nativeEvent.layout;E(e=>e&&e.width===t&&e.height===i?e:{width:t,height:i})},[]),X=l&&"top"===K?.placement,Z=S?.submenu?[S.submenu]:A,J=X?[...Z].reverse().map(e=>[...e].reverse()):Z,Q=[];if(S)Q.push({key:BACK_KEY,label:S.label});else for(const e of M)Q.push({key:`${TOP_PREFIX}${e.key}`,label:e.label,item:e});for(const e of J)for(const t of e)Q.push({key:t.key,label:t.label,item:t});const ee=Q[0]?.key;(0,_react.useEffect)(()=>{if(!U||k||!ee)return;const e=setTimeout(()=>(0,_focusHost.focusHost)(P.current.get(ee)),_focusHost.FOCUS_DELAY_MS);return()=>clearTimeout(e)},[U,k,ee]);const setItemRef=e=>t=>{t?P.current.set(e,t):P.current.delete(e)},te=(0,_webOnly.webOnly)({onKeyDown:e=>{const t=e.key??e.nativeEvent?.key??"",i=Q.length,n=Q.findIndex(e=>e.key===H.current),s=Q[n];let r=-1;if("ArrowDown"===t)r=(n+1)%i;else if("ArrowUp"===t)r=n<=0?i-1:n-1;else if("Home"===t)r=0;else if("End"===t)r=i-1;else{if("ArrowLeft"===t&&S)return e.preventDefault?.(),void N(null);if("ArrowRight"===t&&s?.item?.submenu)return e.preventDefault?.(),void B(s.item);if(1===t.length&&""!==t.trim()){const e=t.toLowerCase();for(let t=1;t<=i;t+=1){const s=(n+t)%i,o=Q[s];if(void 0===o)throw new Error("MenuSurface key navigation stepped outside its items.");if(o.label.toLowerCase().startsWith(e)){r=s;break}}}}r>=0&&(e.preventDefault?.(),(e=>{const t=Q[e];t&&(0,_focusHost.focusHost)(P.current.get(t.key))})(r))}});if(k){const e=S?.submenu?[{key:BACK_KEY,label:x.back,icon:"chevron-left"},...S.submenu]:[...M,...A.flat()],i=[...new Set(e.filter(e=>e.checked).map(e=>e.key))];return(0,_jsxRuntime.jsx)(_index6.OptionSheet,{open:t,onClose:d,onAfterClose:V,title:S?.label??s,options:e,getOptionLabel:e=>e.label,getOptionValue:e=>e.key,isOptionDisabled:e=>Boolean(e.disabled),destructiveOf:e=>Boolean(e.destructive),getOptionDescription:e=>e.description,getOptionIcon:e=>{const t=e;return(0,_slotIcon.renderSlotIcon)(t.icon,{color:t.destructive?b.colors["danger-text"]:b.colors["text-muted"],size:20,disabled:Boolean(t.disabled)})},value:i,onChange:(e,t)=>B(t),accessibilityLabel:p??s,testID:h?`${h}-sheet`:void 0})}const inkFor=e=>e.disabled?b.colors["text-disabled"]:e.destructive?b.colors["danger-text"]:b.colors["text-body"],inkRoleFor=e=>e.disabled?"disabled":e.destructive?"danger":"primary",ie=S?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index4.ListItem,{ref:setItemRef(BACK_KEY),variant:"menu",onPress:()=>N(null),onFocus:()=>{H.current=BACK_KEY},accessibilityLabel:`${x.back}, ${S.label}`,leading:(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.icon,children:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-left",size:20,color:b.colors["text-muted"]})}),title:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",weight:"semibold",numberOfLines:1,children:S.label})}),(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[s?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"secondary",accessibilityRole:"header",numberOfLines:2,style:f.title,children:s}):null,M.length>0?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.topRow,children:M.map(e=>{const t=`${TOP_PREFIX}${e.key}`,i=Boolean(e.disabled),n=inkFor(e);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:setItemRef(t),onPress:()=>B(e),onFocus:()=>{H.current=t},disabled:i,accessibilityRole:"menuitem",accessibilityLabel:e.accessibilityLabel??e.label,accessibilityState:{disabled:i},"aria-disabled":i,testID:e.testID,style:({pressed:e})=>[f.topAction,e?f.pressed:null],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(e.icon,{color:n,size:20,disabled:i})}),(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:inkRoleFor(e),numberOfLines:1,children:e.label})]},t)})}),(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"})]}):null]});return(0,_jsxRuntime.jsxs)(_index5.Modal,{open:t,onClose:d,presentation:"fullScreen",bare:!0,backdropOpacity:l?void 0:0,haptic:!1,labels:{close:x.close},onInsetsChange:y,onDismissed:V,testID:h?`${h}-modal`:void 0,children:[l&&u&&i?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:[f.preview,{left:i.x,top:i.y,width:i.width,height:i.height,transform:[{scale:Y}]}],children:u}):null,(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{accessibilityRole:"menu",accessibilityLabel:S?.label??p??s,onLayout:G,testID:h?`${h}-menu`:void 0,...te,style:[f.anchored,{left:K?.x??0,top:K?.y??0,maxWidth:z,opacity:U?W:0}],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.surface,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[f.clip,{maxHeight:$}],children:[ie,(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:f.scroll,bounces:!1,keyboardShouldPersistTaps:"handled",children:J.map((e,t)=>{const i=e.some(e=>null!=e.icon),[n]=e;if(void 0===n)throw new Error("MenuSurface has a group with no items to draw.");return(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[t>0?(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"}):null,e.map(e=>((e,t)=>{const i=Boolean(e.disabled),n=inkFor(e),s=e.detail||e.checked||e.submenu?(0,_jsxRuntime.jsxs)(_index2.Row,{gap:"md",children:[e.detail?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"tertiary",children:e.detail}):null,e.checked?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"check",size:20,color:b.colors.primary}):null,e.submenu?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-right",size:20,color:b.colors["text-subtle"]}):null]}):void 0;return(0,_jsxRuntime.jsx)(_index4.ListItem,{ref:setItemRef(e.key),variant:"menu",onPress:()=>B(e),onFocus:()=>{H.current=e.key},disabled:i,checked:e.checked,accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,rightPlacement:"side",leading:t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.icon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(e.icon,{color:n,size:20,disabled:i})}):void 0,title:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",color:inkRoleFor(e),numberOfLines:2,children:e.label}),subtitle:e.description?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"secondary",numberOfLines:2,children:e.description}):void 0,trailing:s},e.key)})(e,i))]},n.key)})})]})})})]})};exports.MenuSurface=MenuSurface;const buildStyles=e=>_reactNative.StyleSheet.create({preview:{position:"absolute"},anchored:{position:"absolute",minWidth:180},surface:{backgroundColor:e.colors.surface,borderRadius:e.radius.md,..._corners.smoothCorners,...e.shadow.popover},clip:{borderRadius:e.radius.md,..._corners.smoothCorners,overflow:"hidden"},scroll:{flexGrow:0,flexShrink:1},title:{paddingHorizontal:e.space.md,paddingTop:e.space.sm,paddingBottom:e.space.xs},pressed:{backgroundColor:e.colors["surface-pressed"]},icon:{width:20,alignItems:"center"},topRow:{flexDirection:"row",padding:e.space.xs,gap:e.space.xs},topAction:{flexGrow:1,flexBasis:0,alignItems:"center",justifyContent:"center",gap:e.space.xs,minHeight:64,borderRadius:e.radius.sm,..._corners.smoothCorners}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_MESSAGE_LIST_LABELS=void 0,exports.MessageList=MessageList,exports.default=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_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"),_index2=require("../Badge/index.js"),_index3=require("../DateSeparator/index.js"),_index4=require("../IconButton/index.js"),_index5=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_MESSAGE_LIST_LABELS=exports.DEFAULT_MESSAGE_LIST_LABELS=Object.freeze({today:"Today",yesterday:"Yesterday",jumpToLatest:"Jump to the latest message",newMessages:e=>1===e?"1 new message":`${e} new messages`,unread:"New messages",loadingOlder:"Loading earlier messages"}),JUMP_AT=160,FOLLOW_AT=48,KEEP_POSITION={minIndexForVisible:0,autoscrollToTopThreshold:JUMP_AT},positionOf=(e,t)=>e?t?"middle":"last":t?"first":"single";function MessageList({messages:e,keyExtractor:t,renderMessage:n,getAuthorKey:r,getDate:s,firstUnreadKey:a,onLoadOlder:o,loadingOlder:i=!1,hasOlder:l=!0,typing:c,empty:u,getAnnouncement:d,followNew:_,keyboardAware:m=!0,keyboardOffset:x,labels:p,now:f,onScroll:j,onContentSizeChange:y,contentContainerStyle:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_MESSAGE_LIST_LABELS=void 0,exports.MessageList=MessageList,exports.default=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_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"),_index2=require("../Badge/index.js"),_index3=require("../DateSeparator/index.js"),_index4=require("../IconButton/index.js"),_index5=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_MESSAGE_LIST_LABELS=exports.DEFAULT_MESSAGE_LIST_LABELS=Object.freeze({today:"Today",yesterday:"Yesterday",jumpToLatest:"Jump to the latest message",newMessages:e=>1===e?"1 new message":`${e} new messages`,unread:"New messages",loadingOlder:"Loading earlier messages"}),JUMP_AT=160,FOLLOW_AT=48,KEEP_POSITION={minIndexForVisible:0,autoscrollToTopThreshold:JUMP_AT},positionOf=(e,t)=>e?t?"middle":"last":t?"first":"single";function MessageList({messages:e,keyExtractor:t,renderMessage:n,getAuthorKey:r,getDate:s,firstUnreadKey:a,onLoadOlder:o,loadingOlder:i=!1,hasOlder:l=!0,typing:c,empty:u,getAnnouncement:d,followNew:_,keyboardAware:m=!0,keyboardOffset:x,labels:p,now:f,onScroll:j,onContentSizeChange:y,contentContainerStyle:b,style:g,testID:S,...v}){const L=(0,_index.useTheme)(),h=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),E=(0,_useReducedMotion.useReducedMotion)(),C=(0,_react.useMemo)(()=>buildStyles(L),[L]),R=(0,_react.useMemo)(()=>({...DEFAULT_MESSAGE_LIST_LABELS,...p}),[p]),T=x??h.bottom,w=(0,_react.useRef)(null),A=(0,_react.useRef)(!1),M=(0,_react.useRef)(!0),O=(0,_react.useRef)(0),[I,N]=(0,_react.useState)(!1),[k,q]=(0,_react.useState)(0),D=(0,_react.useMemo)(()=>{const n=s?e.map(e=>(0,_mobileCore.formatDate)(s(e))):null,o=r?e.map(r):null,i=void 0===a?-1:e.findIndex(e=>t(e)===a);return e.map((t,r)=>{const a=r===e.length-1,l=null!==n&&(a||n[r]!==n[r+1]),c=null!==o&&!a&&o[r+1]===o[r]&&!l&&r!==i,u=null!==o&&r>0&&o[r-1]===o[r]&&(null===n||n[r-1]===n[r])&&r-1!==i;return{groupPosition:positionOf(c,u),day:l&&s?(0,_index3.dayLabel)(s(t),{now:f,labels:R}):null,unread:r===i}})},[e,s,r,a,t,f,R]),P=(0,_react.useCallback)(()=>{M.current=!0,w.current?.scrollToOffset({offset:0,animated:!E}),q(0)},[E]),V=e[0],F=void 0===V?null:t(V),B=(0,_react.useRef)(F);(0,_react.useEffect)(()=>{const n=B.current;if(B.current=F,null===n||null===F||n===F)return;const r=e.findIndex(e=>t(e)===n);if(-1===r)return void q(0);const s=e.slice(0,r).reverse();for(const e of s){const t=d?.(e);t&&(0,_announce.announce)(t)}_&&s.some(_)?P():A.current&&q(e=>e+s.length)},[F]);const U=(0,_react.useCallback)(e=>{M.current=e.nativeEvent.contentOffset.y<=FOLLOW_AT;const t=e.nativeEvent.contentOffset.y>JUMP_AT;t!==A.current&&(A.current=t,N(t),t||q(0)),j?.(e)},[j]),K=(0,_react.useCallback)((e,t)=>{const n=t>O.current;O.current=t,n&&M.current&&w.current?.scrollToOffset({offset:0,animated:!1}),y?.(e,t)},[y]),z=(0,_react.useCallback)(()=>{l&&!i&&o?.()},[l,i,o]),G=(0,_react.useCallback)(({item:e,index:t})=>{const r=D[t];return(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[r?.day?(0,_jsxRuntime.jsx)(_index3.DateSeparator,{label:r.day}):null,r?.unread?(0,_jsxRuntime.jsx)(_index3.DateSeparator,{label:R.unread,emphasis:!0}):null,n({item:e,index:t,groupPosition:r?.groupPosition??"single"})]})},[D,R.unread,n]),J=(0,_react.useCallback)(e=>t(e),[t]),$=(0,_react.useCallback)(e=>(0,_jsxRuntime.jsx)(_reactNativeKeyboardController.KeyboardChatScrollView,{...e,inverted:!0,offset:T}),[T]),H=k>0?`${R.newMessages(k)}. ${R.jumpToLatest}`:R.jumpToLatest;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[C.root,g],children:[(0,_jsxRuntime.jsx)(_reactNative.FlatList,{keyboardShouldPersistTaps:"handled",maintainVisibleContentPosition:KEEP_POSITION,...v,ref:w,data:e,renderItem:G,keyExtractor:J,inverted:!0,onScroll:U,onContentSizeChange:K,onEndReached:o?z:void 0,ListHeaderComponent:c?(0,_jsxRuntime.jsx)(_reactNative.View,{children:c}):null,ListFooterComponent:i?(0,_jsxRuntime.jsx)(_index5.Spinner,{size:"sm",accessibilityLabel:R.loadingOlder,style:C.older}):null,ListEmptyComponent:u?(0,_jsxRuntime.jsx)(_reactNative.View,{style:C.fill,children:u}):null,renderScrollComponent:m?$:void 0,contentContainerStyle:[C.content,0===e.length?C.grow:null,b],testID:S}),I?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:C.jump,pointerEvents:"box-none",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:C.jumpDisc,children:(0,_jsxRuntime.jsx)(_index4.IconButton,{icon:"arrow-down",accessibilityLabel:H,variant:"ghost",tone:"neutral",onPress:P,testID:S?`${S}-jump`:void 0})}),k>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:C.count,pointerEvents:"none",importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,children:(0,_jsxRuntime.jsx)(_index2.Badge,{value:k,max:99,tone:"primary",size:"sm"})}):null]}):null]})}const buildStyles=e=>_reactNative.StyleSheet.create({root:{flex:1},content:{paddingHorizontal:e.space.md,paddingVertical:e.space.sm},grow:{flexGrow:1},fill:{flex:1},older:{paddingVertical:e.space.md},jump:{position:"absolute",right:e.space.md,bottom:e.space.md},jumpDisc:{borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:e.colors.surface,...e.shadow.elevated},count:{position:"absolute",top:-e.space.xs,right:-e.space.xs}});var _default=exports.default=MessageList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Modal=exports.MODAL_DISMISS_GRACE_MS=exports.DEFAULT_MODAL_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_placement=require("../../utils/placement.js"),_squircle=require("../../utils/squircle.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_MODAL_LABELS=exports.DEFAULT_MODAL_LABELS=Object.freeze({close:"Close modal"}),MODAL_PRESENTATIONS=["centered","bottom","fullScreen","anchored"],MODAL_DISMISS_GRACE_MS=exports.MODAL_DISMISS_GRACE_MS=300,SCALE_START_VALUE=.9,Modal=exports.Modal=(0,_react.forwardRef)((e,t)=>{(0,_assertValidValue.assertValidValue)("Modal","presentation",e.presentation,MODAL_PRESENTATIONS);const{open:r,onClose:a,presentation:i="centered",backdropOpacity:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Modal=exports.MODAL_DISMISS_GRACE_MS=exports.DEFAULT_MODAL_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_placement=require("../../utils/placement.js"),_squircle=require("../../utils/squircle.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_MODAL_LABELS=exports.DEFAULT_MODAL_LABELS=Object.freeze({close:"Close modal"}),MODAL_PRESENTATIONS=["centered","bottom","fullScreen","anchored"],MODAL_DISMISS_GRACE_MS=exports.MODAL_DISMISS_GRACE_MS=300,SCALE_START_VALUE=.9,Modal=exports.Modal=(0,_react.forwardRef)((e,t)=>{(0,_assertValidValue.assertValidValue)("Modal","presentation",e.presentation,MODAL_PRESENTATIONS);const{open:r,onClose:a,presentation:i="centered",backdropOpacity:n,backdropPressClose:o=!0,animationDuration:s,animateMount:c=!0,accessibilityLabel:l,hardwareBackPress:u=!0,children:d,contentStyle:m,backdropStyle:_,restoreFocusRef:p,onDismissed:f,haptic:v,labels:h,anchor:g,placement:b="auto",align:S="center",testID:A,bare:x=!1,onInsetsChange:M}=e,D=(0,_index.useTheme)(),y=(0,_react.useMemo)(()=>({...DEFAULT_MODAL_LABELS,...h}),[h]),N=(0,_usePresenceMotion.usePresenceMotion)(),[R,C]=(0,_ModalSafeArea.useModalInsets)();(0,_react.useEffect)(()=>{M?.(R)},[R,M]);const{width:j,height:w}=(0,_reactNative.useWindowDimensions)(),[E,L]=(0,_react.useState)({width:0,height:0}),V=s??N.duration("default"),T=_reactNative.Dimensions.get("window").height,q=(0,_react.useRef)(!c&&r),I=q.current,O=(0,_react.useRef)((0,_index.createAnimatedValue)(I?1:.9)).current,P=(0,_react.useRef)((0,_index.createAnimatedValue)(I?1:0)).current,F=(0,_react.useRef)((0,_index.createAnimatedValue)(I?0:T)).current,k=(0,_react.useRef)((0,_index.createAnimatedValue)(I?1:0)).current,z=(0,_react.useRef)(null),H=(0,_react.useRef)(!1),[W,U]=(0,_react.useState)(r),B=(0,_react.useMemo)(()=>buildStyles(D),[D]),G=(0,_react.useMemo)(()=>{if("anchored"!==i||void 0===g)return null;const e={width:j,height:w,insets:{top:R.top,bottom:R.bottom,left:0,right:0}},t=(0,_placement.computePlacement)(g,E,e,b,{align:S});return{...t,maxHeight:(0,_placement.placementMaxHeight)(t.placement,(0,_placement.placementRoom)(g,e))}},[i,g,E,b,S,j,w,R.top,R.bottom]),K=(0,_react.useMemo)(()=>{const e=D.colors.scrim;return"number"!=typeof n?"anchored"===i?(0,_color.transparentOf)(e):e:(0,_color.withAlpha)(e,n)??e},[D.colors.scrim,n,i]),Y=(0,_react.useMemo)(()=>k.interpolate({inputRange:[0,1],outputRange:[(0,_color.transparentOf)(K),K]}),[k,K]);(0,_react.useEffect)(()=>{r&&(_reactNative.Keyboard.dismiss(),U(!0))},[r]),(0,_react.useEffect)(()=>{const e=[];if(r&&W&&q.current)q.current=!1;else if(r&&W){const t=_reactNative.Animated.timing(k,{toValue:1,duration:N.duration("default"),useNativeDriver:!1});if(t.start(),e.push(t),N.reduced||"anchored"===i){P.setValue(0),F.setValue(0),O.setValue(1);const t=_reactNative.Animated.timing(P,{toValue:1,duration:V,useNativeDriver:_nativeDriver.nativeDriver});t.start(),e.push(t)}else if("bottom"===i){P.setValue(1);const t=_reactNative.Animated.spring(F,{toValue:0,damping:D.motion.spring.gentle.damping,stiffness:D.motion.spring.gentle.stiffness,mass:D.motion.spring.gentle.mass,useNativeDriver:_nativeDriver.nativeDriver});t.start(),e.push(t)}else{const t=_reactNative.Animated.parallel([_reactNative.Animated.spring(O,{toValue:1,damping:D.motion.spring.gentle.damping,stiffness:D.motion.spring.gentle.stiffness,mass:D.motion.spring.gentle.mass,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(P,{toValue:1,duration:V,useNativeDriver:_nativeDriver.nativeDriver})]);t.start(),e.push(t)}}else if(W){const t=N.duration("fast"),r=_reactNative.Easing.bezier(...D.motion.ease.accelerate),a=_reactNative.Animated.timing(P,{toValue:0,duration:t,easing:r,useNativeDriver:_nativeDriver.nativeDriver}),n=N.reduced||"anchored"===i?a:"bottom"===i?_reactNative.Animated.timing(F,{toValue:T,duration:t,easing:r,useNativeDriver:_nativeDriver.nativeDriver}):_reactNative.Animated.parallel([_reactNative.Animated.timing(O,{toValue:.9,duration:t,easing:r,useNativeDriver:_nativeDriver.nativeDriver}),a]),o=_reactNative.Animated.parallel([n,_reactNative.Animated.timing(k,{toValue:0,duration:N.duration("default"),useNativeDriver:!1})]);o.start(({finished:e})=>{e&&(F.setValue(T),U(!1))}),e.push(o)}return()=>e.forEach(e=>{e.stop()})},[r,W,i,V,O,P,k,F,T,D.motion.spring.gentle.damping,D.motion.spring.gentle.stiffness,D.motion.spring.gentle.mass,N,D.motion.ease.accelerate]),(0,_react.useEffect)(()=>{if("web"===_reactNative.Platform.OS)return;let e,t;return r?(e=setTimeout(()=>{z.current&&_reactNative.AccessibilityInfo.sendAccessibilityEvent(z.current,"focus")},150),H.current=!0):H.current&&(H.current=!1,p?.current&&(t=setTimeout(()=>{const e=p.current;e&&_reactNative.AccessibilityInfo.sendAccessibilityEvent(e,"focus")},V))),()=>{e&&clearTimeout(e),t&&clearTimeout(t)}},[r,V,p]);const J=(0,_react.useRef)(f);J.current=f;const Q=(0,_react.useRef)(!1);(0,_react.useEffect)(()=>{if(r)return void(Q.current=!0);if(!Q.current)return;Q.current=!1;const e=setTimeout(()=>J.current?.(),MODAL_DISMISS_GRACE_MS);return()=>clearTimeout(e)},[r]);const X=(0,_react.useCallback)(()=>{if(!o)return;const e=(0,_hapticUtils.resolveHaptic)(v,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),a()},[o,a,v]),Z=(0,_react.useCallback)(()=>{u&&a()},[u,a]),$=(0,_SquircleFill.useSquircle)(!x&&"bottom"!==i&&"fullScreen"!==i&&"anchored"!==i,D.radius.xl),ee=(0,_react.useCallback)(e=>{$.onLayout(e);const{width:t,height:r}=e.nativeEvent.layout;L(e=>e.width===t&&e.height===r?e:{width:t,height:r})},[$.onLayout]),te=(0,_react.useMemo)(()=>x?"bottom"===i?B.bottomContent:"fullScreen"===i?B.fullScreenContent:B.bareCentredContent:"anchored"===i?[B.anchoredContent,{left:G?.x,top:G?.y,maxHeight:G?.maxHeight,backgroundColor:D.colors.surface,borderRadius:D.radius.lg,..._corners.smoothCorners},D.shadow.modal]:"fullScreen"===i?[B.fullScreenContent,{backgroundColor:D.colors.surface}]:"bottom"===i?[B.bottomContent,{backgroundColor:D.colors.surface,borderTopLeftRadius:D.radius.xl,borderTopRightRadius:D.radius.xl,..._corners.smoothCorners,paddingTop:D.space.lg,paddingHorizontal:D.space.lg,paddingBottom:D.space.lg+R.bottom},D.shadow.modal]:[B.centeredContent,{backgroundColor:D.colors.surface,borderRadius:$.active&&$.size?(0,_squircle.squircleHostRadius)($.size.width,$.size.height,D.radius.xl):D.radius.xl,..._corners.smoothCorners,padding:D.space.xl},D.shadow.modal],[i,D,B,R.bottom,$.active,$.size,G,x]),re=(0,_react.useMemo)(()=>"anchored"===i?B.anchoredWrapper:"bottom"===i?B.bottomWrapper:"fullScreen"===i?B.fullScreenWrapper:B.centeredWrapper,[i,B]),ae=(0,_react.useMemo)(()=>"bottom"===i?{opacity:P,transform:[{translateY:F}]}:"fullScreen"===i||"anchored"===i?{opacity:P}:{opacity:P,transform:[{scale:O}]},[i,O,P,F]);if("anchored"===i&&void 0===g)throw new Error('[@webority/mobile-ui] Modal: presentation "anchored" needs an anchor.');if(x&&"anchored"===i)throw new Error('[@webority/mobile-ui] Modal: presentation "anchored" bare does not combine with presentation anchored.');return(0,_jsxRuntime.jsx)(_reactNative.Modal,{visible:W,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:Z,testID:A,children:(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e=>{z.current=e,"function"==typeof t?t(e):t&&(t.current=e)},style:B.root,accessible:!1,accessibilityViewIsModal:!0,accessibilityRole:"alert",accessibilityLabel:l,children:(0,_jsxRuntime.jsxs)(_ModalSafeArea.ModalSafeArea,{onInsets:C,children:[(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{collapsable:!1,style:[_reactNative.StyleSheet.absoluteFill,re,{backgroundColor:Y},_],children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_reactNative.StyleSheet.absoluteFill,onPress:X,accessibilityRole:o?"button":void 0,accessibilityLabel:o?y.close:void 0,accessible:!!o&&void 0,importantForAccessibility:o?void 0:"no",disabled:!o}),(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[te,ae,E.height>0||"anchored"!==i?null:B.unmeasured,m],onLayout:ee,pointerEvents:x&&"fullScreen"===i?"box-none":"auto",needsOffscreenAlphaCompositing:!0,children:[$.active&&$.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:$.size.width,height:$.size.height,radius:D.radius.xl,fill:D.colors.surface}):null,d]})]}),(0,_jsxRuntime.jsx)(_ToastProvider.ToastHost,{})]})})})});Modal.displayName="Modal";const buildStyles=e=>_reactNative.StyleSheet.create({root:{flex:1},centeredWrapper:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},centeredContent:{maxWidth:"90%",width:"90%"},bottomWrapper:{flex:1,justifyContent:"flex-end"},bottomContent:{width:"100%"},fullScreenWrapper:{flex:1},fullScreenContent:{flex:1},anchoredWrapper:{flex:1},anchoredContent:{position:"absolute"},unmeasured:{opacity:0},bareCentredContent:{alignSelf:"center"}});var _default=exports.default=Modal;
|
|
@@ -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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.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`}),cellAt=(e,t)=>{const i=e[t];if(void 0===i)throw new Error(`OTP cell ${t} is outside the ${e.length} cells.`);return i},sanitizeChar=(e,t)=>e?"number-pad"===t?e.replace(/\D/g,""):e:"",OTPInput=exports.OTPInput=(0,_react.forwardRef)((e,t)=>{const{value:i,defaultValue:r,onChange:a,onComplete:n,length:s=6,keyboardType:l="number-pad",autoFocus:o=!1,autoFocusDelay:c=0,disabled:u=!1,error:d,size:_="md",secure:p=!1,haptic:v,labels:m,onFocus:g,accessibilityLabel:x,style:f,cellStyle:h,textStyle:b,testID:y}=e;(0,_assertValidValue.assertValidValue)("OTPInput","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("OTPInput","keyboardType",e.keyboardType,["number-pad","default"]);const T=m?{...DEFAULT_OTP_INPUT_LABELS,...m}:DEFAULT_OTP_INPUT_LABELS,[j,N]=(0,_index.useControllableState)({value:i,defaultValue:r??"",onChange:a}),A=(0,_index2.useTheme)(),V=(0,_react.useMemo)(()=>buildStyles(A),[A]),D=(0,_index2.resolveOtpInputSize)(A,_),E=A.components["otp-input"][_].radius,P=(0,_react.useRef)([]),[F,O]=(0,_react.useState)(-1),[R,C]=(0,_react.useState)(0),I=(0,_react.useRef)(null),k=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,S=(0,_react.useRef)(new Map),w=(0,_react.useMemo)(()=>{const e=S.current,t=[];for(let i=0;i<s;i+=1){let r=e.get(i);r||(r=new _reactNative.Animated.Value(0),e.set(i,r)),t.push(r)}for(const t of Array.from(e.keys()))t>=s&&e.delete(t);return t},[s]),L=(0,_react.useRef)(-1),B=A.settings.components["otp-input"]?.shakeOnError??!1,z=(0,_index.useReducedMotion)(),q=!0===d||(0,_FieldBase.hasFieldText)(d);(0,_react.useEffect)(()=>{let e;return null===I.current||!q||I.current||(v&&(0,_index3.triggerHaptic)("notificationError"),B&&!z&&((0,_index2.setNativeValue)(k,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(k,{toValue:1,duration:A.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(k,{toValue:-1,duration:A.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(k,{toValue:1,duration:A.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(k,{toValue:0,duration:A.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:_nativeDriver.nativeDriver})]),e.start())),I.current=q,()=>e?.stop()},[q,k,B,v,z,A.motion.duration.instant]),(0,_react.useEffect)(()=>{const e=L.current;if(L.current=F,e===F)return;if(-1===e&&-1===F)return;const t=[];return w.forEach((i,r)=>{const a=r===F?1:0;if(r!==F&&r!==e)return;const n=_reactNative.Animated.timing(i,{toValue:a,duration:A.motion.duration.fast,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver});n.start(),t.push(n)}),()=>t.forEach(e=>{e.stop()})},[F,w,A]);const M=(0,_react.useCallback)(e=>{const t=P.current[e];t&&t.focus()},[]);(0,_react.useImperativeHandle)(t,()=>({focus:()=>M(0),blur:()=>{const e=P.current[F>=0?F:0];e?.blur()},clear:()=>{N(""),M(0)}}),[M,F,N]),(0,_react.useEffect)(()=>{if(o&&!u){const e=setTimeout(()=>M(0),c);return()=>clearTimeout(e)}},[o,c,u,M]);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.charAt(t);return e},[j,s]),H=(0,_react.useCallback)(e=>{const t=e.slice(0,s);t!==j&&(N(t),t.length===s&&n&&n(t))},[s,N,n,j]),W=(0,_react.useCallback)((e,t)=>{const i=t.replace(/\u200B/g,""),r=sanitizeChar(i,l);if(!r){const t=U.slice(),i=cellAt(U,e).length>0;if(t[e]="",H(t.join("").slice(0,s)),!i&&e>0){const t=U.slice();t[e-1]="",H(t.join("")),M(e-1)}return}const a=cellAt(U,e),n=a&&r.length>s&&r.startsWith(a)?r.slice(a.length):r;if(n.length>=s){const t=n.slice(0,s),i=j.length;return H(t),t.length!==i&&v&&(0,_index3.triggerHaptic)(v),void P.current[e]?.blur()}const o=U.slice();let c=e;for(let e=0;e<r.length&&c<s;e+=1)o[c]=r.charAt(e),c+=1;const u=o.join("").slice(0,s),d=j.length;H(u),u.length!==d&&v&&(0,_index3.triggerHaptic)(v);const _=Math.min(c,s-1);c>=s?P.current[e]?.blur():M(_)},[U,M,l,s,v,H,j]),$=(0,_react.useCallback)((e,t)=>{if("Backspace"!==t.nativeEvent.key)return;if(0===cellAt(U,e).length){if(e>0){const t=U.slice();t[e-1]="",H(t.join("")),M(e-1)}}else{const t=U.slice();t[e]="",H(t.join(""))}},[U,M,H]),G=(0,_react.useCallback)((e,t)=>{O(e),g?.(t)},[g]),K=(0,_react.useCallback)(()=>{O(-1)},[]),X=(0,_react.useCallback)(()=>{if(u)return;const e=U.indexOf("");M(-1===e?s-1:e)},[U,u,M,s]),J=(0,_react.useCallback)(e=>{C(e.nativeEvent.layout.width)},[]),Q=x??T.field(s),Y=R>0?Math.max(24,Math.min(D.cell,Math.floor((R-D.gap*(s-1))/s))):D.cell,Z=k.interpolate({inputRange:[-1,1],outputRange:[-6,6]});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:f,onLayout:J,accessible:!0,accessibilityRole:"none",accessibilityLabel:Q,accessibilityValue:{text:i},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:[V.row,{columnGap:D.gap,transform:[{translateX:Z}]}],children:U.map((e,t)=>{const i=F===t,r=e.length>0,a=q?A.colors["danger-border"]:A.colors["focus-ring"],n=w[t];if(!n)return null;const o=p&&r?"●":e;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:V.cellWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:_,width:Y,height:Y,radius:E,borderWidth:1.5,focused:i,error:q,filled:r,disabled:u,paddingHorizontal:A.space.none,paddingVertical:A.space.none,gap:A.space.none,style:h,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:e=>{P.current[t]=e},value:(p&&r?"":e)||"",onChangeText:e=>W(t,e),onKeyPress:e=>$(t,e),onFocus:e=>G(t,e),onBlur:K,keyboardType:l,editable:!u,selectTextOnFocus:!0,caretHidden:r,maxLength:s+1,textContentType:"oneTimeCode",autoComplete:0===t?"sms-otp":"off",importantForAutofill:0===t?"yes":"no",style:[V.input,{fontSize:D.text,color:A.colors["text-body"],...(0,_index2.fontFor)(A,"semibold")},b]}),p&&r?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:V.maskOverlay,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",weight:"semibold",style:[{fontSize:D.text},b],children:o})}):null]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[V.underline,{backgroundColor:a,opacity:n}]})]},`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_OPTION_SHEET_LABELS=void 0,exports.OptionSheet=OptionSheet,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useDragToDismiss=require("../../hooks/useDragToDismiss.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index2=require("../Modal/index.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const SEARCH_ICON_SIZE=18,DEFAULT_OPTION_SHEET_LABELS=exports.DEFAULT_OPTION_SHEET_LABELS=Object.freeze({searchPlaceholder:"Search…",empty:"No options",done:"Done",closePicker:"Close picker",fallbackName:"Options",searchOptions:"Search options",clearSearch:"Clear search",jumpToLetter:"Jump to letter",jumpTo:e=>`Jump to ${e}`}),selectOptionLabel=e=>e.label,selectOptionValue=e=>e.value,selectOptionDescription=e=>e.description,selectOptionDisabled=e=>!0===e.disabled,selectOptionIcon=e=>e.icon,hostStyle=_reactNative.StyleSheet.create({host:{padding:0,paddingTop:0,paddingHorizontal:0,paddingBottom:0,backgroundColor:"transparent",borderTopLeftRadius:0,borderTopRightRadius:0,shadowOpacity:0,elevation:0}}).host;function OptionSheetPanel(e){const{onClose:t,title:i,options:r,sections:s,renderSectionHeader:o,renderOption:a,alphabetIndex:n=!1,labels:l,getOptionLabel:c,getOptionValue:d,getOptionDescription:u,isOptionDisabled:p,getOptionIcon:h,destructiveOf:m,value:x,onChange:_,multi:b=!1,searchable:g=!1,searchSelectionColor:y,accessibilityLabel:j,optionStyle:f,selectedOptionStyle:S,optionTextStyle:R,selectedOptionTextStyle:v,testID:T}=e,w=c??selectOptionLabel,C=d??selectOptionValue,N=u??selectOptionDescription,L=p??selectOptionDisabled,O=h??selectOptionIcon,I=(0,_index.useTheme)(),k=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),D=(0,_react.useMemo)(()=>buildStyles(I),[I]),[H,V]=(0,_react.useState)(""),P=_reactNative.Dimensions.get("window").height,E=Math.round(.7*P),M=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,{handleGesture:A,opacity:B}=(0,_useDragToDismiss.useDragToDismiss)({drag:M,travel:E,onDismiss:t}),z=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Native(),[]),F=(0,_reactNativeKeyboardController.useKeyboardState)(e=>e.height),W=Math.max(0,Math.round(F)),q=Math.max(k.top,_reactNative.StatusBar.currentHeight??0)+I.space.sm,G=W>0,U=G?Math.max(0,Math.min(E,P-W-q)):E,$=(0,_react.useMemo)(()=>{const e=g?H.trim().toLowerCase():"",matches=t=>0===e.length||w(t).toLowerCase().includes(e)||(N(t)??"").toLowerCase().includes(e);if(!s)return r.filter(matches).map(e=>({kind:"option",option:e}));const t=[];return s.forEach((e,i)=>{const r=e.options.filter(matches);if(0!==r.length){t.push({kind:"header",title:e.title});for(const e of r)t.push({kind:"option",option:e,section:i})}}),t},[g,H,r,s,w,N]),K=(0,_react.useCallback)(()=>{t()},[t]),J=(0,_react.useRef)(null),Y=(0,_react.useMemo)(()=>{const e=new Map;if(!n)return e;let t=0;if(s)for(let e=$.length-1;e>=0;e-=1)if("header"===$[e].kind){t=e+1;break}for(let i=t;i<$.length;i+=1){const t=$[i];if("option"!==t.kind)continue;const r=w(t.option).trim().charAt(0).toUpperCase(),s=/^[A-Z]$/.test(r)?r:"#";e.has(s)||e.set(s,i)}return e},[n,$,s,w]),Z=n&&Y.size>0&&0===H.trim().length,Q=(0,_react.useMemo)(()=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ",...Y.has("#")?["#"]:[]],[Y]),X=(0,_react.useCallback)(e=>{const t=Y.get(e);void 0!==t&&J.current?.scrollToIndex({index:t,animated:!0,viewPosition:0})},[Y]),ee=(0,_react.useRef)(null),te=(0,_react.useCallback)(()=>{null!==ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),ie=(0,_react.useCallback)(e=>{J.current?.scrollToOffset({offset:e.averageItemLength*e.index,animated:!1}),te(),ee.current=setTimeout(()=>{ee.current=null,J.current?.scrollToIndex({index:e.index,animated:!0,viewPosition:0})},50)},[te]);(0,_react.useEffect)(()=>te,[te]);return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:D.gestureRoot,children:(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{testID:T,accessibilityViewIsModal:!0,accessibilityLabel:j??i??l.fallbackName,style:[D.sheet,{maxHeight:U,marginBottom:W,paddingBottom:G?I.space.lg:k.bottom+I.space.lg,backgroundColor:I.colors.surface,borderTopLeftRadius:I.radius.xl,borderTopRightRadius:I.radius.xl,..._corners.smoothCorners,opacity:B,transform:[{translateY:M}],...I.shadow.modal}],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:A,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.sheetHandleRow,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.sheetHandle,{backgroundColor:I.colors.border}]})}),i?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"title",style:[D.sheetTitle,{paddingHorizontal:I.space.lg,marginBottom:I.space.sm}],children:i}):null]})}),g?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.searchWrap,{marginHorizontal:I.space.lg,marginBottom:I.space.sm}],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[D.searchBox,{backgroundColor:I.colors["bg-subtle"],borderColor:I.colors.border,borderRadius:I.radius.md,..._corners.smoothCorners,paddingHorizontal:I.space.md,gap:I.space.sm}],children:[(I.settings.icons.search??_defaultIcons.defaultIcons.search)({size:18,color:I.colors["text-subtle"]}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{value:H,onChangeText:V,placeholder:l.searchPlaceholder,placeholderTextColor:I.colors["text-subtle"],selectionColor:y??I.colors["focus-ring"],accessibilityLabel:l.searchOptions,style:[D.searchInput,{color:I.colors["text-body"],fontSize:I.text.base.size,paddingVertical:I.space.sm}]}),H.length>0?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>V(""),hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:l.clearSearch,children:(I.settings.icons.close??_defaultIcons.defaultIcons.close)({size:18,color:I.colors["text-muted"]})}):null]})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[D.listWrap,Z?D.listRow:null],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:z,children:(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:J,data:$,keyExtractor:e=>"header"===e.kind?`h:${e.title}`:`o:${e.section??""}:${String(C(e.option))}`,renderItem:({item:e,index:t})=>{if("header"===e.kind)return(0,_jsxRuntime.jsx)(_reactNative.View,{accessible:!0,accessibilityRole:"header",style:[D.sectionHeader,{paddingHorizontal:I.space.lg,paddingTop:I.space.md}],children:o?o(e.title):(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",weight:"semibold",color:"tertiary",style:D.sectionTitle,children:e.title.toUpperCase()})});const i=e.option,r=w(i),s=C(i),n=N(i),l=O(i),c=(d=s,Array.isArray(x)?x.some(e=>String(e)===String(d)):null!=x&&String(x)===String(d));var d;const u=L(i),p=m?.(i)??!1;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>_(s,i),disabled:u,android_ripple:{color:I.colors["surface-pressed"],borderless:!1},accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{selected:c,disabled:u},"aria-selected":c,"aria-disabled":u,style:({pressed:e})=>[D.optionRow,{backgroundColor:c?I.colors["surface-selected"]:e?I.colors["surface-pressed"]:"transparent",opacity:u?.5:1,paddingHorizontal:I.space.lg,paddingVertical:I.space.md},f,c?S:null],children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.optionTextWrap,children:a({option:i,selected:c,disabled:u,index:t})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.optionIcon,children:l}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:D.optionTextWrap,children:[(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:c?"semibold":"medium",color:p?"danger":c?"brand":void 0,style:[D.optionLabel,R,c?v:null],children:r}),n?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",color:"tertiary",numberOfLines:2,style:D.optionDescription,children:n}):null]})]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.checkbox,{borderColor:c?I.colors.primary:I.colors.border,backgroundColor:c?I.colors.primary:"transparent"}],children:c?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.checkboxTick}):null}):c?"icon"===I.settings.components["option-sheet"]?.selectedMarker?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.singleSelectedIcon,children:(I.settings.icons.selectedTick??_defaultIcons.defaultIcons.selectedTick)({size:20,color:I.colors.primary})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.singleSelectedDot,{backgroundColor:I.colors.primary}]}):null]})},onScrollToIndexFailed:ie,overScrollMode:"never",bounces:!1,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:!Z,style:Z?D.listBesideRail:null,ListEmptyComponent:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",color:"tertiary",align:"center",style:{paddingVertical:I.space.xl},children:l.empty})})}),Z?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.rail,{paddingRight:I.space.xs}],accessibilityRole:"list",accessibilityLabel:l.jumpToLetter,testID:"option-sheet-alphabet",children:Q.map(e=>{const t=Y.has(e);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>X(e),disabled:!t,hitSlop:{left:8,right:8},...(0,_hitSlop.hitSlopMarker)({left:8,right:8}),accessibilityRole:"button",accessibilityLabel:l.jumpTo(e),accessibilityState:{disabled:!t},"aria-disabled":!t,style:D.railLetter,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",weight:"semibold",color:t?"brand":"tertiary",style:[D.railLetterText,{opacity:t?1:.45}],children:e})},e)})}):null]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.sheetFooter,{borderTopColor:I.colors["border-subtle"],paddingHorizontal:I.space.lg,paddingVertical:I.space.md}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:K,accessibilityRole:"button",accessibilityLabel:l.done,style:({pressed:e})=>[D.doneButton,{backgroundColor:e?I.colors["primary-pressed"]:I.colors.primary,borderRadius:I.radius.md,..._corners.smoothCorners,paddingVertical:I.space.sm,paddingHorizontal:I.space.lg}],children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:"semibold",style:{color:I.colors["on-primary"]},children:l.done})})}):null]})})}function OptionSheet(e){const{open:t,onOpenChange:i,onAfterClose:r,labels:s,onClose:o,haptic:a,...n}=e,l=(0,_react.useMemo)(()=>({...DEFAULT_OPTION_SHEET_LABELS,...s}),[s]),c=(0,_react.useRef)(i);c.current=i;const d=(0,_react.useRef)(!1);return(0,_react.useEffect)(()=>{d.current!==t&&(d.current=t,c.current?.(t))},[t]),(0,_jsxRuntime.jsx)(_index2.Modal,{open:t,onClose:o,presentation:"bottom",onDismissed:r,haptic:a,contentStyle:hostStyle,labels:{close:l.closePicker},accessibilityLabel:n.accessibilityLabel??n.title??l.fallbackName,children:(0,_jsxRuntime.jsx)(OptionSheetPanel,{...n,onClose:o,labels:l})})}OptionSheet.displayName="OptionSheet";const buildStyles=e=>_reactNative.StyleSheet.create({gestureRoot:{width:"100%"},sheet:{paddingBottom:e.space.lg,overflow:"hidden"},sheetHandleRow:{alignItems:"center",paddingTop:e.space.sm,paddingBottom:e.space.sm},sheetHandle:{width:36,height:4,borderRadius:e.radius.pill,..._corners.smoothCorners},sheetTitle:{includeFontPadding:!1},searchWrap:{width:"auto"},searchBox:{flexDirection:"row",alignItems:"center",borderWidth:1},searchInput:{flex:1,includeFontPadding:!1},optionRow:{flexDirection:"row",alignItems:"center"},sectionHeader:{paddingBottom:e.space.xs},listWrap:{flexShrink:1},listRow:{flexDirection:"row"},listBesideRail:{flex:1},rail:{justifyContent:"space-between",alignItems:"center",alignSelf:"stretch",paddingVertical:e.space.xs},railLetter:{paddingHorizontal:e.space.xs,minHeight:14,justifyContent:"center"},railLetterText:{includeFontPadding:!1,lineHeight:14},sectionTitle:{includeFontPadding:!1,letterSpacing:.6},optionIcon:{marginRight:e.space.md},optionTextWrap:{flex:1},optionLabel:{includeFontPadding:!1},optionDescription:{includeFontPadding:!1,marginTop:e.space.xxs},checkbox:{width:22,height:22,borderRadius:e.radius.sm,..._corners.smoothCorners,borderWidth:2,alignItems:"center",justifyContent:"center",marginLeft:e.space.md},checkboxTick:{width:10,height:6,borderLeftWidth:2,borderBottomWidth:2,borderColor:e.colors["on-primary"],transform:[{rotate:"-45deg"},{translateY:-1}]},singleSelectedDot:{width:8,height:8,borderRadius:e.radius.pill,..._corners.smoothCorners,marginLeft:e.space.md},singleSelectedIcon:{marginLeft:e.space.md},sheetFooter:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,alignItems:"flex-end"},doneButton:{alignSelf:"flex-end"}});var _default=exports.default=OptionSheet;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_OPTION_SHEET_LABELS=void 0,exports.OptionSheet=OptionSheet,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useDragToDismiss=require("../../hooks/useDragToDismiss.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index2=require("../Modal/index.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const SEARCH_ICON_SIZE=18,DEFAULT_OPTION_SHEET_LABELS=exports.DEFAULT_OPTION_SHEET_LABELS=Object.freeze({searchPlaceholder:"Search…",empty:"No options",done:"Done",closePicker:"Close picker",fallbackName:"Options",searchOptions:"Search options",clearSearch:"Clear search",jumpToLetter:"Jump to letter",jumpTo:e=>`Jump to ${e}`}),selectOptionLabel=e=>e.label,selectOptionValue=e=>e.value,selectOptionDescription=e=>e.description,selectOptionDisabled=e=>!0===e.disabled,selectOptionIcon=e=>e.icon,hostStyle=_reactNative.StyleSheet.create({host:{padding:0,paddingTop:0,paddingHorizontal:0,paddingBottom:0,backgroundColor:"transparent",borderTopLeftRadius:0,borderTopRightRadius:0,shadowOpacity:0,elevation:0}}).host;function OptionSheetPanel(e){const{onClose:t,title:i,options:r,sections:s,renderSectionHeader:o,renderOption:a,alphabetIndex:n=!1,labels:l,getOptionLabel:c,getOptionValue:d,getOptionDescription:u,isOptionDisabled:p,getOptionIcon:h,destructiveOf:m,value:x,onChange:_,multi:b=!1,searchable:g=!1,searchSelectionColor:y,accessibilityLabel:j,optionStyle:f,selectedOptionStyle:S,optionTextStyle:R,selectedOptionTextStyle:v,testID:T}=e,w=c??selectOptionLabel,C=d??selectOptionValue,N=u??selectOptionDescription,L=p??selectOptionDisabled,O=h??selectOptionIcon,I=(0,_index.useTheme)(),k=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),D=(0,_react.useMemo)(()=>buildStyles(I),[I]),[H,V]=(0,_react.useState)(""),P=_reactNative.Dimensions.get("window").height,E=Math.round(.7*P),M=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,{handleGesture:A,opacity:B}=(0,_useDragToDismiss.useDragToDismiss)({drag:M,travel:E,onDismiss:t}),z=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Native(),[]),F=(0,_reactNativeKeyboardController.useKeyboardState)(e=>e.height),W=Math.max(0,Math.round(F)),q=Math.max(k.top,_reactNative.StatusBar.currentHeight??0)+I.space.sm,G=W>0,U=G?Math.max(0,Math.min(E,P-W-q)):E,$=(0,_react.useMemo)(()=>{const e=g?H.trim().toLowerCase():"",matches=t=>0===e.length||w(t).toLowerCase().includes(e)||(N(t)??"").toLowerCase().includes(e);if(!s)return r.filter(matches).map(e=>({kind:"option",option:e}));const t=[];return s.forEach((e,i)=>{const r=e.options.filter(matches);if(0!==r.length){t.push({kind:"header",title:e.title});for(const e of r)t.push({kind:"option",option:e,section:i})}}),t},[g,H,r,s,w,N]),K=(0,_react.useCallback)(()=>{t()},[t]),J=(0,_react.useRef)(null),Y=(0,_react.useMemo)(()=>{const e=new Map;if(!n)return e;let t=0;if(s)for(const[e,i]of $.entries())"header"===i.kind&&(t=e+1);for(const[i,r]of $.entries()){if(i<t||"option"!==r.kind)continue;const s=w(r.option).trim().charAt(0).toUpperCase(),o=/^[A-Z]$/.test(s)?s:"#";e.has(o)||e.set(o,i)}return e},[n,$,s,w]),Z=n&&Y.size>0&&0===H.trim().length,Q=(0,_react.useMemo)(()=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ",...Y.has("#")?["#"]:[]],[Y]),X=(0,_react.useCallback)(e=>{const t=Y.get(e);void 0!==t&&J.current?.scrollToIndex({index:t,animated:!0,viewPosition:0})},[Y]),ee=(0,_react.useRef)(null),te=(0,_react.useCallback)(()=>{null!==ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),ie=(0,_react.useCallback)(e=>{J.current?.scrollToOffset({offset:e.averageItemLength*e.index,animated:!1}),te(),ee.current=setTimeout(()=>{ee.current=null,J.current?.scrollToIndex({index:e.index,animated:!0,viewPosition:0})},50)},[te]);(0,_react.useEffect)(()=>te,[te]);return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:D.gestureRoot,children:(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{testID:T,accessibilityViewIsModal:!0,accessibilityLabel:j??i??l.fallbackName,style:[D.sheet,{maxHeight:U,marginBottom:W,paddingBottom:G?I.space.lg:k.bottom+I.space.lg,backgroundColor:I.colors.surface,borderTopLeftRadius:I.radius.xl,borderTopRightRadius:I.radius.xl,..._corners.smoothCorners,opacity:B,transform:[{translateY:M}],...I.shadow.modal}],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:A,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.sheetHandleRow,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.sheetHandle,{backgroundColor:I.colors.border}]})}),i?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"title",style:[D.sheetTitle,{paddingHorizontal:I.space.lg,marginBottom:I.space.sm}],children:i}):null]})}),g?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.searchWrap,{marginHorizontal:I.space.lg,marginBottom:I.space.sm}],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[D.searchBox,{backgroundColor:I.colors["bg-subtle"],borderColor:I.colors.border,borderRadius:I.radius.md,..._corners.smoothCorners,paddingHorizontal:I.space.md,gap:I.space.sm}],children:[(I.settings.icons.search??_defaultIcons.defaultIcons.search)({size:18,color:I.colors["text-subtle"]}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{value:H,onChangeText:V,placeholder:l.searchPlaceholder,placeholderTextColor:I.colors["text-subtle"],selectionColor:y??I.colors["focus-ring"],accessibilityLabel:l.searchOptions,style:[D.searchInput,{color:I.colors["text-body"],fontSize:I.text.base.size,paddingVertical:I.space.sm}]}),H.length>0?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>V(""),hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:l.clearSearch,children:(I.settings.icons.close??_defaultIcons.defaultIcons.close)({size:18,color:I.colors["text-muted"]})}):null]})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[D.listWrap,Z?D.listRow:null],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:z,children:(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:J,data:$,keyExtractor:e=>"header"===e.kind?`h:${e.title}`:`o:${e.section??""}:${String(C(e.option))}`,renderItem:({item:e,index:t})=>{if("header"===e.kind)return(0,_jsxRuntime.jsx)(_reactNative.View,{accessible:!0,accessibilityRole:"header",style:[D.sectionHeader,{paddingHorizontal:I.space.lg,paddingTop:I.space.md}],children:o?o(e.title):(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",weight:"semibold",color:"tertiary",style:D.sectionTitle,children:e.title.toUpperCase()})});const i=e.option,r=w(i),s=C(i),n=N(i),l=O(i),c=(d=s,Array.isArray(x)?x.some(e=>String(e)===String(d)):null!=x&&String(x)===String(d));var d;const u=L(i),p=m?.(i)??!1;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>_(s,i),disabled:u,android_ripple:{color:I.colors["surface-pressed"],borderless:!1},accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{selected:c,disabled:u},"aria-selected":c,"aria-disabled":u,style:({pressed:e})=>[D.optionRow,{backgroundColor:c?I.colors["surface-selected"]:e?I.colors["surface-pressed"]:"transparent",opacity:u?.5:1,paddingHorizontal:I.space.lg,paddingVertical:I.space.md},f,c?S:null],children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.optionTextWrap,children:a({option:i,selected:c,disabled:u,index:t})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.optionIcon,children:l}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:D.optionTextWrap,children:[(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:c?"semibold":"medium",color:p?"danger":c?"brand":void 0,style:[D.optionLabel,R,c?v:null],children:r}),n?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",color:"tertiary",numberOfLines:2,style:D.optionDescription,children:n}):null]})]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.checkbox,{borderColor:c?I.colors.primary:I.colors.border,backgroundColor:c?I.colors.primary:"transparent"}],children:c?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.checkboxTick}):null}):c?"icon"===I.settings.components["option-sheet"]?.selectedMarker?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.singleSelectedIcon,children:(I.settings.icons.selectedTick??_defaultIcons.defaultIcons.selectedTick)({size:20,color:I.colors.primary})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.singleSelectedDot,{backgroundColor:I.colors.primary}]}):null]})},onScrollToIndexFailed:ie,overScrollMode:"never",bounces:!1,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:!Z,style:Z?D.listBesideRail:null,ListEmptyComponent:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",color:"tertiary",align:"center",style:{paddingVertical:I.space.xl},children:l.empty})})}),Z?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.rail,{paddingRight:I.space.xs}],accessibilityRole:"list",accessibilityLabel:l.jumpToLetter,testID:"option-sheet-alphabet",children:Q.map(e=>{const t=Y.has(e);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>X(e),disabled:!t,hitSlop:{left:8,right:8},...(0,_hitSlop.hitSlopMarker)({left:8,right:8}),accessibilityRole:"button",accessibilityLabel:l.jumpTo(e),accessibilityState:{disabled:!t},"aria-disabled":!t,style:D.railLetter,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",weight:"semibold",color:t?"brand":"tertiary",style:[D.railLetterText,{opacity:t?1:.45}],children:e})},e)})}):null]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.sheetFooter,{borderTopColor:I.colors["border-subtle"],paddingHorizontal:I.space.lg,paddingVertical:I.space.md}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:K,accessibilityRole:"button",accessibilityLabel:l.done,style:({pressed:e})=>[D.doneButton,{backgroundColor:e?I.colors["primary-pressed"]:I.colors.primary,borderRadius:I.radius.md,..._corners.smoothCorners,paddingVertical:I.space.sm,paddingHorizontal:I.space.lg}],children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:"semibold",style:{color:I.colors["on-primary"]},children:l.done})})}):null]})})}function OptionSheet(e){const{open:t,onOpenChange:i,onAfterClose:r,labels:s,onClose:o,haptic:a,...n}=e,l=(0,_react.useMemo)(()=>({...DEFAULT_OPTION_SHEET_LABELS,...s}),[s]),c=(0,_react.useRef)(i);c.current=i;const d=(0,_react.useRef)(!1);return(0,_react.useEffect)(()=>{d.current!==t&&(d.current=t,c.current?.(t))},[t]),(0,_jsxRuntime.jsx)(_index2.Modal,{open:t,onClose:o,presentation:"bottom",onDismissed:r,haptic:a,contentStyle:hostStyle,labels:{close:l.closePicker},accessibilityLabel:n.accessibilityLabel??n.title??l.fallbackName,children:(0,_jsxRuntime.jsx)(OptionSheetPanel,{...n,onClose:o,labels:l})})}OptionSheet.displayName="OptionSheet";const buildStyles=e=>_reactNative.StyleSheet.create({gestureRoot:{width:"100%"},sheet:{paddingBottom:e.space.lg,overflow:"hidden"},sheetHandleRow:{alignItems:"center",paddingTop:e.space.sm,paddingBottom:e.space.sm},sheetHandle:{width:36,height:4,borderRadius:e.radius.pill,..._corners.smoothCorners},sheetTitle:{includeFontPadding:!1},searchWrap:{width:"auto"},searchBox:{flexDirection:"row",alignItems:"center",borderWidth:1},searchInput:{flex:1,includeFontPadding:!1},optionRow:{flexDirection:"row",alignItems:"center"},sectionHeader:{paddingBottom:e.space.xs},listWrap:{flexShrink:1},listRow:{flexDirection:"row"},listBesideRail:{flex:1},rail:{justifyContent:"space-between",alignItems:"center",alignSelf:"stretch",paddingVertical:e.space.xs},railLetter:{paddingHorizontal:e.space.xs,minHeight:14,justifyContent:"center"},railLetterText:{includeFontPadding:!1,lineHeight:14},sectionTitle:{includeFontPadding:!1,letterSpacing:.6},optionIcon:{marginRight:e.space.md},optionTextWrap:{flex:1},optionLabel:{includeFontPadding:!1},optionDescription:{includeFontPadding:!1,marginTop:e.space.xxs},checkbox:{width:22,height:22,borderRadius:e.radius.sm,..._corners.smoothCorners,borderWidth:2,alignItems:"center",justifyContent:"center",marginLeft:e.space.md},checkboxTick:{width:10,height:6,borderLeftWidth:2,borderBottomWidth:2,borderColor:e.colors["on-primary"],transform:[{rotate:"-45deg"},{translateY:-1}]},singleSelectedDot:{width:8,height:8,borderRadius:e.radius.pill,..._corners.smoothCorners,marginLeft:e.space.md},singleSelectedIcon:{marginLeft:e.space.md},sheetFooter:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,alignItems:"flex-end"},doneButton:{alignSelf:"flex-end"}});var _default=exports.default=OptionSheet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ProfilePicker=exports.DEFAULT_PROFILE_PICKER_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_index3=require("../AppIcon/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Avatar/index.js"),_index5=require("../FieldBase/index.js"),_FilePicker=require("../FilePicker/FilePicker.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_index6=require("../Spinner/index.js"),_index7=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_PROFILE_PICKER_LABELS=exports.DEFAULT_PROFILE_PICKER_LABELS=Object.freeze({pick:"Change profile photo",remove:"Remove photo",sheetTitle:"Change photo",errorTooLarge:e=>`The photo is larger than ${e} MB.`,errorWrongType:"That file is not a supported image."}),DEFAULT_ACCEPT=["image/*"],SHEET_ICON_SIZE=20,SOFT_FILL_OPACITY=.14,SIZE_PX={sm:72,md:120,lg:160},clamp=(e,r,t)=>Math.min(t,Math.max(r,e)),toneFor=(e,r)=>{switch(r){case"success":return{base:e.colors.success,on:e.colors["on-success"]};case"warning":return{base:e.colors.warning,on:e.colors["on-warning"]};case"danger":return{base:e.colors.danger,on:e.colors["on-danger"]};case"info":return{base:e.colors.info,on:e.colors["on-info"]};case"neutral":return{base:e.colors["text-muted"],on:e.colors["on-neutral-strong"]};default:return{base:e.colors.primary,on:e.colors["on-primary"]}}},badgeLookFor=(e,r,t)=>{const i=toneFor(e,r),s=i.base,o=e.colors.bg,n="neutral"===r;let a;switch(t){case"soft":a={fill:n?e.colors["bg-muted"]:(0,_color.blendOf)(s,.14,o,e.colors["bg-subtle"]),ring:o,icon:s};break;case"outline":a={fill:o,ring:n?e.colors.border:s,icon:s};break;default:a={fill:s,ring:o,icon:i.on}}return a},resolveRadius=(e,r)=>"circle"===e?r/2:"rounded"===e?Math.max(6,Math.round(.22*r)):0,REMOVE_VALUE="__profile-picker-remove__",ProfilePicker=exports.ProfilePicker=(0,_react.forwardRef)((e,r)=>{const{value:t,name:i,sources:s,onPick:o,onRemove:n,loading:a=!1,disabled:l=!1,accept:c=DEFAULT_ACCEPT,maxSizeMB:d,size:u="md",shape:_="circle",badgeIcon:m="camera",tone:x,variant:p,avatarTone:g,avatarBackgroundColor:h,avatarColor:b,label:f,required:y=!1,helperText:v,error:j,layout:k="stacked",title:P,subtitle:C,ImageComponent:R,labels:E,haptic:I,onError:V,accessibilityLabel:S,style:T,testID:F}=e;(0,_assertValidValue.assertValidValue)("ProfilePicker","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("ProfilePicker","shape",e.shape,["circle","rounded","square"]),(0,_assertValidValue.assertValidValue)("ProfilePicker","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("ProfilePicker","variant",e.variant,["solid","soft","outline"]),(0,_assertValidValue.assertValidValue)("ProfilePicker","layout",e.layout,["stacked","inline","profile"]);const L=(0,_index.useTheme)(),A=L.settings.components["profile-picker"],w=x??A?.defaultTone??"primary",O=p??A?.defaultVariant??"solid",q=(0,_react.useMemo)(()=>badgeLookFor(L,w,O),[L,w,O]),M=g??A?.defaultAvatarTone,D=(0,_react.useMemo)(()=>({...DEFAULT_PROFILE_PICKER_LABELS,...E}),[E]),[N,B]=(0,_react.useState)(null),[z,H]=(0,_react.useState)(null),[U,K]=(0,_react.useState)(!1),[$,W]=(0,_react.useState)(t);t!==$&&(W(t),B(null));const Z=a||l,G=N??t??null,X=(0,_react.useMemo)(()=>G?{uri:G}:void 0,[G]),Q=j??z??void 0,Y=!Z&&(null!==N||Boolean(t)&&Boolean(n)),J=s.length>0||Y,ee=SIZE_PX[u],re=resolveRadius(_,ee),te=re*(1-Math.SQRT1_2),ie=clamp(Math.round(.28*ee),24,44),se=te-ie/2,oe=Math.max(0,-se),ne=(0,_react.useCallback)(e=>{H(e),V?.(e),!1!==I&&(0,_index2.triggerHaptic)("notificationError")},[V,I]),ae=(0,_react.useCallback)(async e=>{let r;try{r=await e.pick()}catch(e){return void ne(e instanceof Error?e.message:String(e))}const t=r?.[0];if(!t)return;if("number"==typeof d&&"number"==typeof t.size&&t.size>1024*d*1024)return void ne(D.errorTooLarge(d));if(t.type&&!(0,_FilePicker.matchesAccept)(t.type,c))return void ne(D.errorWrongType);H(null),B(t.uri);const i=(0,_index2.resolveHaptic)(I,"selection");i&&(0,_index2.triggerHaptic)(i),o?.(t)},[d,c,D,I,o,ne]),le=(0,_react.useCallback)(()=>{Z
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ProfilePicker=exports.DEFAULT_PROFILE_PICKER_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_index3=require("../AppIcon/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Avatar/index.js"),_index5=require("../FieldBase/index.js"),_FilePicker=require("../FilePicker/FilePicker.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_index6=require("../Spinner/index.js"),_index7=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_PROFILE_PICKER_LABELS=exports.DEFAULT_PROFILE_PICKER_LABELS=Object.freeze({pick:"Change profile photo",remove:"Remove photo",sheetTitle:"Change photo",errorTooLarge:e=>`The photo is larger than ${e} MB.`,errorWrongType:"That file is not a supported image."}),DEFAULT_ACCEPT=["image/*"],SHEET_ICON_SIZE=20,SOFT_FILL_OPACITY=.14,SIZE_PX={sm:72,md:120,lg:160},clamp=(e,r,t)=>Math.min(t,Math.max(r,e)),toneFor=(e,r)=>{switch(r){case"success":return{base:e.colors.success,on:e.colors["on-success"]};case"warning":return{base:e.colors.warning,on:e.colors["on-warning"]};case"danger":return{base:e.colors.danger,on:e.colors["on-danger"]};case"info":return{base:e.colors.info,on:e.colors["on-info"]};case"neutral":return{base:e.colors["text-muted"],on:e.colors["on-neutral-strong"]};default:return{base:e.colors.primary,on:e.colors["on-primary"]}}},badgeLookFor=(e,r,t)=>{const i=toneFor(e,r),s=i.base,o=e.colors.bg,n="neutral"===r;let a;switch(t){case"soft":a={fill:n?e.colors["bg-muted"]:(0,_color.blendOf)(s,.14,o,e.colors["bg-subtle"]),ring:o,icon:s};break;case"outline":a={fill:o,ring:n?e.colors.border:s,icon:s};break;default:a={fill:s,ring:o,icon:i.on}}return a},resolveRadius=(e,r)=>"circle"===e?r/2:"rounded"===e?Math.max(6,Math.round(.22*r)):0,REMOVE_VALUE="__profile-picker-remove__",ProfilePicker=exports.ProfilePicker=(0,_react.forwardRef)((e,r)=>{const{value:t,name:i,sources:s,onPick:o,onRemove:n,loading:a=!1,disabled:l=!1,accept:c=DEFAULT_ACCEPT,maxSizeMB:d,size:u="md",shape:_="circle",badgeIcon:m="camera",tone:x,variant:p,avatarTone:g,avatarBackgroundColor:h,avatarColor:b,label:f,required:y=!1,helperText:v,error:j,layout:k="stacked",title:P,subtitle:C,ImageComponent:R,labels:E,haptic:I,onError:V,accessibilityLabel:S,style:T,testID:F}=e;(0,_assertValidValue.assertValidValue)("ProfilePicker","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("ProfilePicker","shape",e.shape,["circle","rounded","square"]),(0,_assertValidValue.assertValidValue)("ProfilePicker","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("ProfilePicker","variant",e.variant,["solid","soft","outline"]),(0,_assertValidValue.assertValidValue)("ProfilePicker","layout",e.layout,["stacked","inline","profile"]);const L=(0,_index.useTheme)(),A=L.settings.components["profile-picker"],w=x??A?.defaultTone??"primary",O=p??A?.defaultVariant??"solid",q=(0,_react.useMemo)(()=>badgeLookFor(L,w,O),[L,w,O]),M=g??A?.defaultAvatarTone,D=(0,_react.useMemo)(()=>({...DEFAULT_PROFILE_PICKER_LABELS,...E}),[E]),[N,B]=(0,_react.useState)(null),[z,H]=(0,_react.useState)(null),[U,K]=(0,_react.useState)(!1),[$,W]=(0,_react.useState)(t);t!==$&&(W(t),B(null));const Z=a||l,G=N??t??null,X=(0,_react.useMemo)(()=>G?{uri:G}:void 0,[G]),Q=j??z??void 0,Y=!Z&&(null!==N||Boolean(t)&&Boolean(n)),J=s.length>0||Y,ee=SIZE_PX[u],re=resolveRadius(_,ee),te=re*(1-Math.SQRT1_2),ie=clamp(Math.round(.28*ee),24,44),se=te-ie/2,oe=Math.max(0,-se),ne=(0,_react.useCallback)(e=>{H(e),V?.(e),!1!==I&&(0,_index2.triggerHaptic)("notificationError")},[V,I]),ae=(0,_react.useCallback)(async e=>{let r;try{r=await e.pick()}catch(e){return void ne(e instanceof Error?e.message:String(e))}const t=r?.[0];if(!t)return;if("number"==typeof d&&"number"==typeof t.size&&t.size>1024*d*1024)return void ne(D.errorTooLarge(d));if(t.type&&!(0,_FilePicker.matchesAccept)(t.type,c))return void ne(D.errorWrongType);H(null),B(t.uri);const i=(0,_index2.resolveHaptic)(I,"selection");i&&(0,_index2.triggerHaptic)(i),o?.(t)},[d,c,D,I,o,ne]),le=(0,_react.useCallback)(()=>{if(Z)return;ue.current=null;const[e]=s;void 0===e||1!==s.length||Y?(s.length>0||Y)&&K(!0):ae(e)},[Z,s,Y,ae]),ce=(0,_react.useCallback)(()=>{B(null),H(null);const e=(0,_index2.resolveHaptic)(I,"selection");e&&(0,_index2.triggerHaptic)(e),n?.()},[I,n]),de=(0,_react.useMemo)(()=>{const e=s.map(e=>({kind:"source",source:e}));return Y&&e.push({kind:"remove"}),e},[s,Y]),ue=(0,_react.useRef)(null),me=(0,_react.useCallback)(e=>{ue.current||(K(!1),"remove"===e.kind?ce():ue.current=e.source)},[ce]),xe=(0,_react.useRef)(ae);xe.current=ae;const pe=(0,_react.useCallback)(()=>{const e=ue.current;ue.current=null,e&&xe.current(e)},[]),ge=F??"profile-picker",he=S??(J?D.pick:i),be=(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:ee,height:ee,marginBottom:oe,marginRight:oe},children:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:le,disabled:Z||!J,accessibilityRole:J?"button":"image",accessibilityLabel:he,accessibilityHint:(0,_index5.fieldTextAsString)(Q),accessibilityState:J?{disabled:Z,busy:a}:{busy:a},"aria-disabled":J?Z:void 0,"aria-busy":a,testID:`${ge}-button`,style:({pressed:e})=>[{width:ee,height:ee,borderRadius:re,..._corners.smoothCorners},{opacity:l?.55:e?.85:1}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_index4.Avatar,{dimension:ee,shape:_,name:i||void 0,source:X,ImageComponent:R,tone:M,backgroundColor:h,color:b,placeholderIcon:"user"})}),a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.fill,styles.overlay,{borderRadius:re,..._corners.smoothCorners,backgroundColor:L.colors.scrim}],testID:`${ge}-loading`,children:(0,_jsxRuntime.jsx)(_index6.Spinner,{size:ee>=100?"md":"sm",color:L.colors["on-primary"]})}):null,!l&&J?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",testID:`${ge}-badge`,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,style:[styles.badge,{width:ie,height:ie,borderRadius:L.radius.pill,..._corners.smoothCorners,right:se,bottom:se,backgroundColor:q.fill,borderColor:q.ring}],children:(0,_slotIcon.renderSlotIcon)(m,{color:q.icon,size:Math.round(.55*ie),disabled:!1})}):null]})}),fe="stacked"!==k?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.meta,"profile"===k?styles.metaCentred:null],children:[P?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",weight:"semibold",style:[styles.title,"profile"===k?styles.textCentred:null],children:P}):null,C?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"bodySmall",color:"secondary",style:[styles.subtitle,"profile"===k?styles.textCentred:null,{marginTop:L.space.xxs}],children:C}):null,(0,_jsxRuntime.jsx)(_index5.FieldMessage,{text:Q??v,error:(0,_index5.hasFieldText)(Q)})]}):(0,_jsxRuntime.jsx)(_index5.FieldMessage,{text:Q??v,error:(0,_index5.hasFieldText)(Q)});return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:r,style:T,testID:F,children:[f?(0,_jsxRuntime.jsx)(_index5.FieldLabel,{required:y,children:f}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:"inline"===k?[styles.row,{columnGap:L.space.md}]:["profile"===k?styles.columnCentred:styles.column,{rowGap:L.space.xs}],children:[be,fe]}),(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:U,haptic:I,onClose:()=>K(!1),onAfterClose:pe,title:D.sheetTitle,options:de,getOptionLabel:e=>"remove"===e.kind?D.remove:e.source.label,getOptionValue:e=>"remove"===e.kind?REMOVE_VALUE:e.source.key,destructiveOf:e=>"remove"===e.kind,getOptionDescription:e=>"remove"===e.kind?void 0:e.source.description,getOptionIcon:e=>"remove"===e.kind?(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"trash",size:20,color:L.colors["danger-text"]}):e.source.icon,onChange:(e,r)=>me(r)})]})});ProfilePicker.displayName="ProfilePicker";const styles=_reactNative.StyleSheet.create({fill:{alignItems:"center",justifyContent:"center",overflow:"hidden"},overlay:{..._reactNative.StyleSheet.absoluteFill},badge:{position:"absolute",alignItems:"center",justifyContent:"center",borderWidth:2},row:{flexDirection:"row",alignItems:"center"},column:{alignItems:"flex-start"},columnCentred:{alignItems:"center"},meta:{flexShrink:1},metaCentred:{alignItems:"center"},title:{includeFontPadding:!1},subtitle:{includeFontPadding:!1},textCentred:{textAlign:"center"}});var _default=exports.default=ProfilePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ProgressBar=exports.DEFAULT_PROGRESS_BAR_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_useReducedMotion=require("../../hooks/useReducedMotion.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_PROGRESS_BAR_LABELS=exports.DEFAULT_PROGRESS_BAR_LABELS=Object.freeze({loading:"Loading"}),toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ProgressBar=exports.DEFAULT_PROGRESS_BAR_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_useReducedMotion=require("../../hooks/useReducedMotion.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_index2=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_PROGRESS_BAR_LABELS=exports.DEFAULT_PROGRESS_BAR_LABELS=Object.freeze({loading:"Loading"}),toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;case"primary":return e.colors.primary}},DETERMINATE_ANIMATION_DURATION=400,INDETERMINATE_LOOP_DURATION=1500,INDETERMINATE_WIDTH="30%",GLOW_LOCATIONS=[0,.35,.5,.65,1],glowOf=e=>{const t=(0,_color.tintOf)(e,0,"transparent"),r=(0,_color.tintOf)(e,.6,e);return{colors:[t,r,e,r,t],locations:GLOW_LOCATIONS,start:{x:0,y:.5},end:{x:1,y:.5}}},clampProgress=e=>"number"!=typeof e||Number.isNaN(e)||e<0?0:e>1?1:e,ProgressBar=exports.ProgressBar=(0,_react.forwardRef)((e,t)=>{const r=(0,_index.useTheme)(),a=(0,_useReducedMotion.useReducedMotion)(),{progress:i,label:s,showPercent:n=!1,valueLabel:o,indeterminate:l,height:c=6,radius:u,tone:d="primary",trackColor:_,barColor:m,gradient:g,segments:x,animated:p=!0,style:y,containerStyle:R,barStyle:v,accessibilityLabel:b,labels:h,testID:f}=e;(0,_assertValidValue.assertValidValue)("ProgressBar","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const j=(0,_react.useMemo)(()=>({...DEFAULT_PROGRESS_BAR_LABELS,...h}),[h]),N=l??"number"!=typeof i,A=clampProgress(i),w=(0,_react.useRef)((0,_index.createAnimatedValue)(A)).current,E=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,S=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,V=(0,_react.useRef)(0),L=(0,_react.useMemo)(()=>buildStyles(r),[r]),O=u??r.radius.pill,T=_??r.colors["surface-disabled"],B=m??toneColor(r,d),D=(0,_react.useMemo)(()=>g?"string"==typeof g?r.settings.gradients[g]??null:g:null,[g,r.settings.gradients]),P=(0,_react.useMemo)(()=>glowOf(B),[B]),I=Array.isArray(x)&&x.length>0;(0,_react.useEffect)(()=>{N||(p?_reactNative.Animated.timing(w,{toValue:A,duration:400,easing:_reactNative.Easing.bezier(...r.motion.ease["in-out"]),useNativeDriver:!1}).start():w.setValue(A))},[p,A,w,N,r]),(0,_react.useEffect)(()=>{if(!N)return;(0,_index.setNativeValue)(E,0);const e=_reactNative.Animated.loop(_reactNative.Animated.timing(E,{toValue:1,duration:1500,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:_nativeDriver.nativeDriver}));return e.start(),()=>{e.stop()}},[N,E]);const M=w.interpolate({inputRange:[0,1],outputRange:["0%","100%"]}),C=E.interpolate({inputRange:[0,1],outputRange:[-1,1]}),q=E.interpolate({inputRange:[0,.5,1],outputRange:[.4,1,.4]}),G=n&&!N&&!I,k=null!=s||G||null!=o,F=b??("string"==typeof s?s:void 0),U=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,accessibilityRole:"progressbar",accessibilityLabel:F,accessibilityValue:N?{text:j.loading}:{min:0,max:100,now:Math.round(100*A)},testID:f,onLayout:e=>{const t=e.nativeEvent.layout.width;V.current=t,(0,_index.setNativeValue)(S,t)},style:[L.track,{height:c,borderRadius:O,..._corners.smoothCorners,backgroundColor:T},R,y],children:I?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[L.segments,{height:c}],children:(x??[]).map((e,t)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:100*clampProgress(e.value)+"%",height:c,backgroundColor:e.color??toneColor(r,e.tone??"primary")}},t))}):N?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[L.indeterminateBar,{height:c,width:a?"100%":"30%",opacity:a?q:1,transform:a?[]:[{translateX:_reactNative.Animated.multiply(C,S)}]},v],children:(0,_jsxRuntime.jsx)(_index.Gradient,{gradient:P,style:_reactNative.StyleSheet.absoluteFill})}):(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[L.determinateBar,{height:c,borderRadius:O,..._corners.smoothCorners,backgroundColor:D?"transparent":B,width:M,overflow:D?"hidden":void 0},v],children:D?(0,_jsxRuntime.jsx)(_index.Gradient,{gradient:D,style:_reactNative.StyleSheet.absoluteFill}):null})});return k?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:L.wrapper,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[L.labelRow,{marginBottom:r.space.xs}],children:["string"==typeof s||"number"==typeof s?(0,_jsxRuntime.jsx)(_index2.Text,{variant:"label",color:"primary",style:L.label,children:s}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:L.label,children:s}),null!=o?"string"==typeof o||"number"==typeof o?(0,_jsxRuntime.jsx)(_index2.Text,{variant:"label",color:"secondary",accessible:!1,importantForAccessibility:"no",children:o}):o:G?(0,_jsxRuntime.jsx)(_index2.Text,{variant:"label",color:"secondary",accessible:!1,importantForAccessibility:"no",children:`${Math.round(100*A)}%`}):null]}),U]}):U});ProgressBar.displayName="ProgressBar";const buildStyles=e=>_reactNative.StyleSheet.create({wrapper:{width:"100%"},labelRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:e.space.sm},label:{flexShrink:1},track:{width:"100%",overflow:"hidden"},determinateBar:{position:"absolute",left:0,top:0},indeterminateBar:{position:"absolute",left:0,top:0},segments:{flexDirection:"row",width:"100%"}});var _default=exports.default=ProgressBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.RadioDot=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_jsxRuntime=require("react/jsx-runtime");const RadioDot=e=>{const{selected:t,color:r,disabled:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.RadioDot=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_jsxRuntime=require("react/jsx-runtime");const RadioDot=e=>{const{selected:t,color:r,disabled:i=!1,size:o="md",style:s,dotStyle:a}=e,n=(0,_index.useTheme)(),d=(0,_react.useMemo)(()=>buildStyles(),[]),u=r??n.colors.primary;let c,l;if("number"==typeof o)c=o,l=Math.round(o/2);else{const e=(0,_index.resolveRadioSize)(n,o);c=e.outer,l=e.inner}const p=(0,_react.useRef)((0,_index.createAnimatedValue)(t?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.spring(p,{toValue:t?1:0,damping:n.motion.spring.snappy.damping,stiffness:n.motion.spring.snappy.stiffness,mass:n.motion.spring.snappy.mass,useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[t,p,n.motion.spring.snappy]);const m=p.interpolate({inputRange:[0,1],outputRange:[0,1]}),_=i?n.colors.border:t?u:n.colors.border;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[d.outer,{width:c,height:c,borderWidth:n.size.border,borderRadius:n.radius.pill,..._corners.smoothCorners,borderColor:_},s],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[{width:l,height:l,borderRadius:n.radius.pill,..._corners.smoothCorners,backgroundColor:i?n.colors["text-disabled"]:u,opacity:p,transform:[{scale:m}]},a]})})};exports.RadioDot=RadioDot,RadioDot.displayName="RadioDot";const buildStyles=()=>_reactNative.StyleSheet.create({outer:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=RadioDot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Rating=exports.DEFAULT_RATING_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_index2=require("../Skeleton/index.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const RATING_SIZES=["sm","md","lg"],RATING_TONES=["primary","success","warning","danger","info","neutral"],DEFAULT_RATING_LABELS=exports.DEFAULT_RATING_LABELS=Object.freeze({value:(e,t)=>`${e} of ${t} stars`}),sizePxMap={sm:16,md:24,lg:32},resolveSize=e=>sizePxMap[e],PULSE_SCALE=1.2,toneColorFor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Rating=exports.DEFAULT_RATING_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_index2=require("../Skeleton/index.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const RATING_SIZES=["sm","md","lg"],RATING_TONES=["primary","success","warning","danger","info","neutral"],DEFAULT_RATING_LABELS=exports.DEFAULT_RATING_LABELS=Object.freeze({value:(e,t)=>`${e} of ${t} stars`}),sizePxMap={sm:16,md:24,lg:32},resolveSize=e=>sizePxMap[e],PULSE_SCALE=1.2,toneColorFor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;case"primary":return e.colors.primary}},clampToStep=(e,t,i)=>{const a=Math.max(0,Math.min(t,e)),s=Math.round(a/i)*i;return Number(s.toFixed(2))},Star=({index:e,filled:t,size:i,filledColor:a,emptyColor:s,scale:r})=>{const n=Math.max(0,Math.min(1,t-e));return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[starStyles.starWrap,{width:i,height:i,transform:[{scale:r}]}],children:[(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",style:[starStyles.glyph,{color:s,fontSize:i,lineHeight:i}],accessible:!1,children:"☆"}),n>0?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[starStyles.fillClip,{width:i*n,height:i}],children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",style:[starStyles.glyph,{color:a,fontSize:i,lineHeight:i}],accessible:!1,children:"★"})}):null]})},Rating=exports.Rating=(0,_react.forwardRef)((e,t)=>{const{value:i,onChange:a,max:s=5,allowHalf:r=!0,readonly:n=!1,size:l="md",tone:o="warning",label:c,loading:u=!1,haptic:d,labels:m,accessibilityLabel:x,style:_,containerStyle:p,starContainerStyle:y,testID:v}=e;(0,_assertValidValue.assertValidValue)("Rating","size",e.size,RATING_SIZES),(0,_assertValidValue.assertValidValue)("Rating","tone",e.tone,RATING_TONES);const h=(0,_react.useMemo)(()=>({...DEFAULT_RATING_LABELS,...m}),[m]),g=(0,_index.useTheme)(),S=(0,_react.useMemo)(()=>buildStyles(g),[g]),f=!n&&"function"==typeof a,b=r?.5:1,R=resolveSize(l),j=toneColorFor(g,o),N=g.colors.border,w=(0,_react.useRef)(R),A=(0,_react.useCallback)(e=>{w.current=e.nativeEvent.layout.width},[]),V=(0,_react.useRef)(new Map),T=(0,_react.useMemo)(()=>{const e=V.current,t=[];for(let i=0;i<s;i+=1){let a=e.get(i);a||(a=new _reactNative.Animated.Value(1),e.set(i,a)),t.push(a)}for(const t of Array.from(e.keys()))t>=s&&e.delete(t);return t},[s]),E=g.settings.components.rating?.pulseOnPress??!1,C=(0,_react.useCallback)(e=>{const t=T[e];if(!t)throw new Error(`Rating has no star at index ${e}; the pulse index must be below max.`);_reactNative.Animated.sequence([_reactNative.Animated.timing(t,{toValue:1.2,duration:g.motion.duration.fast,easing:_reactNative.Easing.bezier(...g.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.spring(t,{toValue:1,damping:g.motion.spring.bouncy.damping,stiffness:g.motion.spring.bouncy.stiffness,mass:g.motion.spring.bouncy.mass,useNativeDriver:_nativeDriver.nativeDriver})]).start()},[g.motion,T]),L=(0,_react.useCallback)((e,t)=>{if(!f||!a)return;const i=clampToStep(e,s,b),r=(0,_hapticUtils.resolveHaptic)(d,"selection");r&&(0,_hapticUtils.triggerHaptic)(r),E&&"number"==typeof t&&C(t),a(i)},[f,a,s,b,C,d,E]),k=(0,_react.useCallback)(e=>t=>{if(!f)return;const i=w.current||R,a=t.nativeEvent.locationX??i;let s;s=r&&a<i/2?e+.5:e+1,L(s,e)},[f,R,r,L]),D=(0,_react.useCallback)(e=>{f&&("increment"===e.nativeEvent.actionName?L(i+b):"decrement"===e.nativeEvent.actionName&&L(i-b))},[f,i,b,L]),z=h.value(i,s),I=x??c??z,M=[];for(const[e,t]of T.entries()){const a=(0,_jsxRuntime.jsx)(Star,{index:e,filled:i,size:R,filledColor:j,emptyColor:N,scale:t},e);M.push(f?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:k(e),onLayout:0===e?A:void 0,hitSlop:4,...(0,_hitSlop.hitSlopMarker)(4),accessible:!1,style:S.starPress,children:a},e):(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:0===e?A:void 0,style:S.starPress,children:a},e))}const q=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[S.wrapper,p,_],ref:t,testID:v,children:[c?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",color:"secondary",style:S.label,children:c}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[S.row,y],accessible:!0,accessibilityRole:f?"adjustable":"text",accessibilityLabel:I,accessibilityValue:f?{min:0,max:s,now:i,text:z}:void 0,accessibilityActions:f?[{name:"increment"},{name:"decrement"}]:void 0,onAccessibilityAction:f?D:void 0,children:M})]});return u?(0,_jsxRuntime.jsx)(RatingSkeleton,{...e}):q});Rating.displayName="Rating";const RatingSkeleton=({max:e=5,size:t="md",label:i,containerStyle:a,starContainerStyle:s,style:r})=>{const n=(0,_index.useTheme)(),l=resolveSize(t),o=Math.max(1,e);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{alignItems:"flex-start"},a,r],accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[void 0!==i?(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:80,height:14,style:{marginBottom:n.space.xs}}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{flexDirection:"row"},s],children:Array.from({length:o}).map((e,t)=>(0,_jsxRuntime.jsx)(_index2.Skeleton,{width:l,height:l,radius:Math.round(.25*l),style:t<o-1?{marginRight:n.space.xs}:void 0},`sk-star-${t}`))})]})};RatingSkeleton.displayName="RatingSkeleton",Rating.Skeleton=RatingSkeleton;const starStyles=_reactNative.StyleSheet.create({starWrap:{position:"relative",alignItems:"flex-start",justifyContent:"center"},glyph:{textAlign:"left",includeFontPadding:!1},fillClip:{position:"absolute",top:0,left:0,overflow:"hidden"}}),buildStyles=e=>_reactNative.StyleSheet.create({wrapper:{flexDirection:"column"},row:{flexDirection:"row",alignItems:"center"},starPress:{marginRight:e.space.xs},label:{marginBottom:e.space.xs}});var _default=exports.default=Rating;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeSelection=exports.applyMarkdownAction=void 0;const INLINE_MARKERS={bold:"**",italic:"*",strikethrough:"~~",code:"`"},WHOLE_LINK=/^\[([^\]]*)\]\(([^)\s]*)\)$/,LINK_URL_PLACEHOLDER="url",BLOCK_RULES={heading1:{has:e=>/^#\s/.test(e),prefix:()=>"# "},heading2:{has:e=>/^##\s/.test(e),prefix:()=>"## "},bulletList:{has:e=>/^[-*+]\s/.test(e),prefix:()=>"- "},numberedList:{has:e=>/^\d+[.)]\s/.test(e),prefix:e=>`${e+1}. `},quote:{has:e=>/^>\s?/.test(e),prefix:()=>"> "}},ANY_BLOCK_PREFIX=/^(?:#{1,6}\s+|[-*+]\s+|\d+[.)]\s+|>\s?)/,isBlockAction=e=>e in BLOCK_RULES,clamp=(e,t)=>!Number.isFinite(e)||e<0?0:Math.min(Math.trunc(e),t),normalizeSelection=(e,t)=>{const n=clamp(e.start,t),s=clamp(e.end,t);return{start:Math.min(n,s),end:Math.max(n,s)}};exports.normalizeSelection=normalizeSelection;const caret=e=>({start:e,end:e}),applyInlineMarker=(e,t,n)=>{const{start:s,end:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeSelection=exports.applyMarkdownAction=void 0;const INLINE_MARKERS={bold:"**",italic:"*",strikethrough:"~~",code:"`"},WHOLE_LINK=/^\[([^\]]*)\]\(([^)\s]*)\)$/,LINK_URL_PLACEHOLDER="url",BLOCK_RULES={heading1:{has:e=>/^#\s/.test(e),prefix:()=>"# "},heading2:{has:e=>/^##\s/.test(e),prefix:()=>"## "},bulletList:{has:e=>/^[-*+]\s/.test(e),prefix:()=>"- "},numberedList:{has:e=>/^\d+[.)]\s/.test(e),prefix:e=>`${e+1}. `},quote:{has:e=>/^>\s?/.test(e),prefix:()=>"> "}},ANY_BLOCK_PREFIX=/^(?:#{1,6}\s+|[-*+]\s+|\d+[.)]\s+|>\s?)/,isBlockAction=e=>e in BLOCK_RULES,clamp=(e,t)=>!Number.isFinite(e)||e<0?0:Math.min(Math.trunc(e),t),normalizeSelection=(e,t)=>{const n=clamp(e.start,t),s=clamp(e.end,t);return{start:Math.min(n,s),end:Math.max(n,s)}};exports.normalizeSelection=normalizeSelection;const caret=e=>({start:e,end:e}),applyInlineMarker=(e,t,n)=>{const{start:s,end:r}=t,i=e.slice(s,r),l=n.length,a="*"===n;if(i.length>=2*l&&i.startsWith(n)&&i.endsWith(n)&&!(a&&i.startsWith("**")&&i.endsWith("**"))){const t=i.slice(l,i.length-l);return{text:e.slice(0,s)+t+e.slice(r),selection:{start:s,end:s+t.length}}}const o=e.slice(Math.max(0,s-l),s),c=e.slice(r,r+l);if(s>=l&&o===n&&c===n&&!(a&&"**"===e.slice(Math.max(0,s-2),s)))return{text:e.slice(0,s-l)+i+e.slice(r+l),selection:{start:s-l,end:r-l}};return{text:e.slice(0,s)+n+i+n+e.slice(r),selection:s===r?caret(s+l):{start:s+l,end:r+l}}},applyLink=(e,t)=>{const{start:n,end:s}=t,r=e.slice(n,s),i=WHOLE_LINK.exec(r);if(i){const t=i[1];if(void 0===t)throw new Error("WHOLE_LINK always captures the label in group 1 when it matches");return{text:e.slice(0,n)+t+e.slice(s),selection:{start:n,end:n+t.length}}}const l=`[${r}](url)`,a=e.slice(0,n)+l+e.slice(s);if(n===s)return{text:a,selection:caret(n+1)};const o=n+r.length+3;return{text:a,selection:{start:o,end:o+3}}},applyBlockPrefix=(e,t,n)=>{const s=BLOCK_RULES[n],r=e.split("\n"),i=[];let l=0;for(const e of r)i.push(l),l+=e.length+1;const lineIndexAt=e=>{let t=0;for(const[n,s]of i.entries())s<=e&&(t=n);return t},a=lineIndexAt(t.start),o=lineIndexAt(t.end),c=r.slice(a,o+1),p=c.every(e=>s.has(e)),h=c.map((e,t)=>({before:e,after:p?e.replace(ANY_BLOCK_PREFIX,""):s.prefix(t)+e.replace(ANY_BLOCK_PREFIX,"")})),d=h.map(e=>e.after),[f]=h;if(void 0===f)throw new Error("applyBlockPrefix: the selection always covers at least one line");const x=i[a];if(void 0===x)throw new Error("applyBlockPrefix: the first selected line always has an offset");const u=f.after.length-f.before.length,L=h.reduce((e,t)=>e+(t.after.length-t.before.length),0),m=[...r.slice(0,a),...d,...r.slice(o+1)].join("\n");return{text:m,selection:normalizeSelection({start:Math.max(x,t.start+u),end:t.end+L},m.length)}},applyMarkdownAction=(e,t)=>{const n=e.text??"",s=normalizeSelection(e.selection,n.length);return isBlockAction(t)?applyBlockPrefix(n,s,t):"link"===t?applyLink(n,s):applyInlineMarker(n,s,INLINE_MARKERS[t])};exports.applyMarkdownAction=applyMarkdownAction;
|
|
@@ -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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.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,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,_assertValidValue.assertValidValue)("ScannerOverlay","state",e.state,["scanning","found","invalid","noPermission","noCamera"]);const{children:i,state:n
|
|
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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_nativeDriver=require("../../utils/nativeDriver.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,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,_assertValidValue.assertValidValue)("ScannerOverlay","state",e.state,["scanning","found","invalid","noPermission","noCamera"]);const{children:i,state:n,helperText:a,labels:r,torch:s=!1,onTorchChange:o,onManualEntry:l,onGallery:c,onPermissionAction:u,frameSize:d=DEFAULT_FRAME,haptic:m,style:_,testID:h}=e,x=n??"scanning",v=(0,_index.useTheme)(),p=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),f=(0,_useReducedMotion.useReducedMotion)(),g=(0,_react.useMemo)(()=>buildStyles(v),[v]),y=(0,_react.useMemo)(()=>({...DEFAULT_SCANNER_OVERLAY_LABELS,...r}),[r]),j=a??y.hint,[b,R]=(0,_react.useState)({width:0,height:0}),[A,E]=(0,_react.useState)(0),N="scanning"===x||"found"===x||"invalid"===x,S=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current,w=v.motion.duration.slower,V=v.motion.duration.default;(0,_react.useEffect)(()=>{if(S.setValue(1),f)return;let e;return"scanning"===x&&w>0?e=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(S,{toValue:1.03,duration:2*w,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(S,{toValue:1,duration:2*w,useNativeDriver:_nativeDriver.nativeDriver})])):"found"===x&&V>0&&(S.setValue(1.08),e=_reactNative.Animated.timing(S,{toValue:1,duration:V,useNativeDriver:_nativeDriver.nativeDriver})),e?.start(),()=>e?.stop()},[x,f,w,V,S]);const C=(0,_react.useRef)(x);(0,_react.useEffect)(()=>{C.current!==x&&(C.current=x,!1!==m&&("found"===x?(0,_hapticUtils.triggerHaptic)("notificationSuccess"):"invalid"===x&&(0,_hapticUtils.triggerHaptic)("notificationError")))},[x,m]);const{found:L,invalid:M}=y,{noPermissionTitle:D,noPermissionMessage:O}=y,{noCameraTitle:P,noCameraMessage:q}=y;(0,_react.useEffect)(()=>{switch(x){case"scanning":(0,_announce.announce)(j);break;case"found":(0,_announce.announce)(L);break;case"invalid":(0,_announce.announce)(M,{polite:!1});break;case"noPermission":(0,_announce.announce)(`${D}. ${O}`);break;case"noCamera":(0,_announce.announce)(`${P}. ${q}`)}},[x,j,L,M,D,O,P,q]);const k=Math.max(240,Math.min(d,b.width-2*v.space.xl)),F=(b.width-k)/2,I=Math.max(v.space.md,(b.height-A-k)/2),B=b.width>0&&b.height>0,U={borderColor:"found"===x?v.colors.success:"invalid"===x?v.colors.danger:v.colors["on-scrim"],width:32,height:32},z="found"===x||"invalid"===x?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[g.pill,{backgroundColor:"found"===x?v.colors.success:v.colors.danger}],children:(0,_jsxRuntime.jsx)(_index6.Text,{variant:"bodySmall",weight:"semibold",align:"center",style:{color:"found"===x?v.colors["on-success"]:v.colors["on-danger"]},children:"found"===x?L:M})}):(0,_jsxRuntime.jsx)(_index6.Text,{variant:"bodySmall",align:"center",style:{color:v.colors["on-scrim"]},children:j}),H=N&&null!=o,W=N?"glass":"outline";return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,testID:h,onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;R(e=>e.width===t&&e.height===i?e:{width:t,height:i})},style:[g.root,!N&&{backgroundColor:v.colors.bg},_],children:[N?(0,_jsxRuntime.jsx)(_reactNative.View,{style:_reactNative.StyleSheet.absoluteFill,children:i}):null,N&&B?(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:[g.scrim,{left:0,right:0,top:0,height:I}]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[g.scrim,{left:0,right:0,top:I+k,bottom:0}]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[g.scrim,{left:0,width:F,top:I,height:k}]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[g.scrim,{left:F+k,right:0,top:I,height:k}]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{position:"absolute",left:F,top:I,width:k,height:k,transform:[{scale:S}]},children:CORNERS.map(e=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[g.mark,U,e.style]},e.key))})]})}):null,N?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:g.panel,children:(0,_jsxRuntime.jsx)(_index4.EmptyState,{fill:!0,icon:(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"noPermission"===x?"camera":"camera-slash",size:48,color:v.colors["text-subtle"]}),title:"noPermission"===x?D:P,description:"noPermission"===x?O:q,action:"noPermission"===x&&u?{label:y.permissionAction,onPress:u}:void 0})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"box-none",onLayout:e=>{const{height:t}=e.nativeEvent.layout;E(e=>e===t?e:t)},style:[g.bar,{paddingBottom:Math.max(p.bottom,v.space.md)}],children:[N&&B?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:g.message,children:z}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:g.actions,children:[H?(0,_jsxRuntime.jsx)(_index5.IconButton,{icon:s?"flash":"flash-slash",variant:"glass",size:"lg",active:s,haptic:m,accessibilityLabel:s?y.torchOff:y.torchOn,onPress:()=>o?.(!s)}):null,c?(0,_jsxRuntime.jsx)(_index3.Button,{label:y.gallery,leftIcon:"gallery",variant:W,tone:"neutral",size:"lg",haptic:m,onPress:c}):null,l?(0,_jsxRuntime.jsx)(_index3.Button,{label:y.manualEntry,leftIcon:"keyboard",variant:W,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.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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.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"];
|
|
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"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.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"];case"info":return e.colors["info-text"]}},SegmentedControl=exports.SegmentedControl=(0,_react.forwardRef)((e,t)=>{const{segments:i,label:r,helperText:s,error:n,value:l,defaultValue:a,onChange:o,size:d="md",fullWidth:c=!0,disabled:u=!1,tone:m="primary",variant:x="segmented",radius:h,labelLines:g=1,haptic:_,accessibilityLabel:b,style:p,containerStyle:v,segmentStyle:f,selectedIndicatorStyle:y,textStyle:S,labelStyle:j,testID:w}=e;(0,_assertValidValue.assertValidValue)("SegmentedControl","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("SegmentedControl","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("SegmentedControl","variant",e.variant,["underline","pills","segmented"]);const[V]=i;if(void 0===V)throw new Error("SegmentedControl needs at least one segment");const[C,R]=(0,_index.useControllableState)({value:l,defaultValue:a??V.value,onChange:o}),q=(0,_index2.useTheme)(),I=q.components["segmented-control"],k=(0,_react.useMemo)(()=>buildStyles(q),[q]),F=(0,_react.useMemo)(()=>(0,_index2.resolveSegmentedControlSize)(q,d),[q,d]),L=g>=2?2:1,N=L>1,z="segmented"===x,M="underline"===x,D="pills"===x,E=z?q.space[I["track-padding"]]:0,T=Math.ceil(1.25*F.text)*(L-1),A=I["underline-height"],H=q.space[I["pill-inset"]],B="number"==typeof h?h:h?q.radius[h]:void 0,W=B??q.radius.md,P=void 0===B?q.radius.sm:Math.max(B-E,0),O=B??q.radius.pill,G=B??q.radius.none,[X,J]=(0,_react.useState)([]),K=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,Q=Math.max(0,i.findIndex(e=>e.value===C)),U=X[Q],Y=U?.x,Z=(0,_react.useCallback)(e=>{const t=q.motion.spring.snappy,i=_reactNative.Animated.spring(K,{toValue:e,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:_nativeDriver.nativeDriver});return i.start(),i},[q.motion.spring.snappy,K]);(0,_react.useEffect)(()=>{J(e=>e.length===i.length||0===e.length?e:[])},[i.length]);const $=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(void 0===Y)return;const e=null!==$.current&&$.current!==Q;if($.current=Q,!e)return void K.setValue(Y);const t=Z(Y);return()=>t.stop()},[Q,Y,Z,K]);const ee=(0,_react.useCallback)((e,t)=>{const{x:i,width:r}=t.nativeEvent.layout;J(t=>{const s=t[e];if(s&&s.x===i&&s.width===r)return t;const n=t.slice();return n[e]={x:i,width:r},n})},[]),te=(0,_react.useCallback)(e=>{if(u)return;if(e.value===C)return;const t=(0,_index3.resolveHaptic)(_,"selection");t&&(0,_index3.triggerHaptic)(t),R(e.value)},[u,R,C,_]),ie=z?q.colors.thumb:D?q.colors["primary-soft"]:q.colors.primary,re=z?P:D?O:G,se=activeInkFor(q,m),ne=q.colors["bg-muted"],le=(0,_SquircleFill.useSquircle)(z,W),ae=!0===n||(0,_index4.hasFieldText)(n),oe=ae&&!u,de=q.colors["field-border-error"],ce=q.size.border,ue=(0,_index4.hasFieldText)(r),me=ae?n:s,xe=(0,_index4.hasFieldText)(me),he=b??("string"==typeof r?r:void 0),ge=(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,accessibilityRole:"radiogroup",accessibilityLabel:he,testID:w,style:[k.track,{...N?{minHeight:F.height+T}:{height:F.height},opacity:u?.55:1,alignSelf:c?"stretch":"flex-start"},z?{borderRadius:W,..._corners.smoothCorners,backgroundColor:le.active?"transparent":ne,padding:E}:M?{borderBottomColor:oe?de:q.colors["border-subtle"],borderBottomWidth:_reactNative.StyleSheet.hairlineWidth}:null,v,p],onLayout:le.onLayout,children:[le.active&&le.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:le.size.width,height:le.size.height,radius:W,fill:ne,stroke:oe?de:void 0,strokeWidth:ce}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:k.row,children:[U?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[k.thumb,z?N?{top:0,bottom:0}:{top:0,height:F.height-2*E}:D?{top:H,bottom:H,left:H}:{bottom:0,height:A},{width:D?Math.max(U.width-2*H,0):U.width,borderRadius:re,..._corners.smoothCorners,backgroundColor:ie,transform:[{translateX:K}]},y]}):null,i.map((e,t)=>{const i=e.value===C,r=i?se:q.colors["text-subtle"],s=(0,_slotIcon.renderSlotIcon)(e.icon,{color:r,size:F.icon,selected:i,disabled:u});return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>te(e),onLayout:e=>ee(t,e),disabled:u,accessibilityRole:"radio",accessibilityLabel:e.label,accessibilityState:{checked:i,selected:i,disabled:u},"aria-checked":i,"aria-disabled":u,style:({pressed:e})=>[k.segment,N?k.segmentMultiline:null,{paddingHorizontal:F["padding-x"],opacity:e&&!i?.7:1},f],children:[s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:k.segmentIcon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:s}):null,(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:i?"semibold":"medium",style:[k.segmentLabel,N?k.segmentLabelMultiline:null,{color:r,fontSize:F.text},S,j],numberOfLines:L,children:e.label})]},String(e.value))})]}),!oe||M||le.active?null:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{borderWidth:ce,borderColor:de,borderRadius:z?W:O,..._corners.smoothCorners}]})]});return ue||xe?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{alignSelf:c?"stretch":"flex-start"},children:[ue?(0,_jsxRuntime.jsx)(_index4.FieldLabel,{size:d,children:r}):null,ge,xe?(0,_jsxRuntime.jsx)(_index4.FieldMessage,{size:d,text:me,error:ae}):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;
|