@webority/mobile-ui 0.133.0 → 0.134.1
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 +2196 -2074
- package/dist/canvas-kit/manifest.json +2 -2
- package/dist/canvas-kit/release.json +6 -6
- package/lib/commonjs/components/AppIcon/slotIcon.js +1 -1
- package/lib/commonjs/components/Banner/Banner.js +1 -1
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/commonjs/components/Button/Button.js +1 -1
- package/lib/commonjs/components/Card/Card.js +1 -1
- package/lib/commonjs/components/Chip/Chip.js +1 -1
- package/lib/commonjs/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +1 -1
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +1 -1
- package/lib/commonjs/components/DateSeparator/DateSeparator.js +1 -1
- package/lib/commonjs/components/Dialog/OverlayActions.js +1 -1
- package/lib/commonjs/components/IconButton/IconButton.js +1 -1
- package/lib/commonjs/components/Input/Input.js +1 -1
- package/lib/commonjs/components/Menu/MenuSurface.js +1 -1
- package/lib/commonjs/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/commonjs/components/SearchBar/SearchBar.js +1 -1
- package/lib/commonjs/components/SearchBar/SearchPanel.js +1 -1
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/commonjs/components/Select/Select.js +1 -1
- package/lib/commonjs/components/StatTile/StatTile.js +1 -1
- package/lib/commonjs/components/Swipeable/Swipeable.js +1 -1
- package/lib/commonjs/components/Tabs/Tabs.js +1 -1
- package/lib/module/components/AppIcon/slotIcon.js +1 -1
- package/lib/module/components/Banner/Banner.js +1 -1
- package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/module/components/Button/Button.js +1 -1
- package/lib/module/components/Card/Card.js +1 -1
- package/lib/module/components/Chip/Chip.js +1 -1
- package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +1 -1
- package/lib/module/components/DateRangePicker/DateRangePicker.js +1 -1
- package/lib/module/components/DateSeparator/DateSeparator.js +1 -1
- package/lib/module/components/Dialog/OverlayActions.js +1 -1
- package/lib/module/components/IconButton/IconButton.js +1 -1
- package/lib/module/components/Input/Input.js +1 -1
- package/lib/module/components/Menu/MenuSurface.js +1 -1
- package/lib/module/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/module/components/SearchBar/SearchBar.js +1 -1
- package/lib/module/components/SearchBar/SearchPanel.js +1 -1
- package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/module/components/Select/Select.js +1 -1
- package/lib/module/components/StatTile/StatTile.js +1 -1
- package/lib/module/components/Swipeable/Swipeable.js +1 -1
- package/lib/module/components/Tabs/Tabs.js +1 -1
- package/lib/typescript/commonjs/components/AppIcon/slotIcon.d.ts +8 -0
- package/lib/typescript/commonjs/components/DateSeparator/DateSeparator.d.ts +2 -3
- package/lib/typescript/module/components/AppIcon/slotIcon.d.ts +8 -0
- package/lib/typescript/module/components/DateSeparator/DateSeparator.d.ts +2 -3
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.IconButton=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_ariaState=require("../../utils/ariaState.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const GLASS_RIM_WIDTH=1,HIT_SLOP=6,SOFT_FILL_OPACITY=.14,SIZE_MAP={sm:{diameter:32,icon:16},md:{diameter:40,icon:20},lg:{diameter:48,icon:24}},toneFor=(e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.IconButton=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_ariaState=require("../../utils/ariaState.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const GLASS_RIM_WIDTH=1,HIT_SLOP=6,SOFT_FILL_OPACITY=.14,SIZE_MAP={sm:{diameter:32,icon:16},md:{diameter:40,icon:20},lg:{diameter:48,icon:24}},toneFor=(e,s)=>{switch(s){case"success":return{base:e.colors.success,outline:e.colors.success,on:e.colors["on-success"],fg:e.colors["success-text"]};case"warning":return{base:e.colors.warning,outline:e.colors.warning,on:e.colors["on-warning"],fg:e.colors["warning-text"]};case"danger":return{base:e.colors.danger,outline:e.colors.danger,on:e.colors["on-danger"],fg:e.colors["danger-text"]};case"info":return{base:e.colors.info,outline:e.colors.info,on:e.colors["on-info"],fg:e.colors["info-text"]};case"neutral":return{base:e.colors["bg-muted"],outline:e.colors.border,on:e.colors["text-body"],fg:e.colors["text-body"]};default:return{base:e.colors.primary,outline:e.colors.primary,on:e.colors["on-primary"],fg:e.colors.primary}}},IconButton=exports.IconButton=(0,_react.forwardRef)((e,s)=>{const{icon:o,iconVariant:r,onPress:t,accessibilityLabel:n,accessibilityHint:i,accessibilityState:a,tone:l="primary",variant:c="solid",size:d="md",shape:u="circle",active:b=!1,disabled:_=!1,loading:I=!1,haptic:m,style:g,testID:p}=e;(0,_warnInvalidValue.warnInvalidValue)("IconButton","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","variant",e.variant,["solid","soft","outline","ghost","glass"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","shape",e.shape,["circle","rounded"]),(0,_warnInvalidValue.warnInvalidValue)("IconButton","iconVariant",e.iconVariant,["linear","bold","broken","bulk","outline","twotone"]);const x=(0,_index.useTheme)(),f=SIZE_MAP[d],y=_||I,{style:v,pressIn:h,pressOut:w}=(0,_usePressAnimation.usePressAnimation)({scaleTo:.92,enabled:!y}),{base:S,outline:j,on:V,fg:P}=toneFor(x,l),q=b?"solid":c,A=b||!0===a?.selected,B={...a,disabled:y,selected:A};let R="transparent",H="transparent",O=0,z=y?x.colors["text-disabled"]:P;"solid"===q?(R=y?x.colors["surface-disabled"]:S,z=y?x.colors["text-disabled"]:V):"soft"===q?R=y?x.colors["surface-disabled"]:(0,_color.tintOf)(S,.14,x.colors["bg-subtle"]):"outline"===q?(H=y?x.colors.border:j,O=x.size.border):"glass"===q&&(R=x.colors["glass-fill"],H=x.colors["glass-border"],O=1,z=y?x.colors["text-disabled"]:x.colors["on-glass"]);const C={color:z,size:f.icon,disabled:y},F="circle"===u?f.diameter/2:x.radius.md;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:s,onPress:e=>{if(y)return;const s=(0,_index2.resolveHaptic)(m,"selection");s&&(0,_index2.triggerHaptic)(s),t?.(e)},onPressIn:h,onPressOut:w,disabled:y,accessibilityRole:"button",accessibilityLabel:n,accessibilityHint:i,accessibilityState:B,...(0,_ariaState.ariaFromState)(B),"aria-disabled":y,"aria-selected":A,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),testID:p,style:({pressed:e})=>[styles.base,{width:f.diameter,height:f.diameter,borderRadius:F,..._corners.smoothCorners,backgroundColor:R,borderColor:H,borderWidth:O,opacity:e&&"solid"!==q?.7:1},g],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.content,v],accessibilityElementsHidden:!I,importantForAccessibility:I?"auto":"no-hide-descendants","aria-hidden":!I,children:I?(0,_jsxRuntime.jsx)(_index3.Spinner,{size:"sm",color:z}):(0,_slotIcon.renderSlotIcon)(o,C,r)})})});IconButton.displayName="IconButton";const styles=_reactNative.StyleSheet.create({base:{alignItems:"center",justifyContent:"center"},content:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=IconButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Input=exports.DEFAULT_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"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Button/index.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INPUT_LABELS=exports.DEFAULT_INPUT_LABELS={showPassword:"Show password",hidePassword:"Hide password"},Input=exports.Input=(0,_react.forwardRef)((e,t)=>{const{label:i,help:n,placeholder:a,value:l,onChangeText:s,error:r,helperText:o,type:d="input",secureTextEntry:c=!1,showPasswordToggle:u=!1,disabled:x=!1,multiline:p=!1,leftIcon:_,rightIcon:f,unit:m,unitStyle:g,prefix:v,prefixStyle:h,readOnly:y=!1,action:j,actionStyle:b,size:I="md",variant:w,labelMode:S,required:R=!1,maxLength:N,showCounter:T=!0,textAlign:F,format:V,parse:A,style:L,containerStyle:B,inputStyle:P,labelStyle:k,messageStyle:z,radius:q,onFocus:D,onBlur:C,accessibilityLabel:E,labels:H,testID:M,editable:O,...U}=e;(0,_warnInvalidValue.warnInvalidValue)("Input","variant",w,["outline","filled","underline"]),(0,_warnInvalidValue.warnInvalidValue)("Input","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("Input","labelMode",S,["float","top"]),(0,_warnInvalidValue.warnInvalidValue)("Input","type",e.type,["input","password","textarea"]);const G=(0,_react.useMemo)(()=>({...DEFAULT_INPUT_LABELS,...H}),[H]),W=(0,_index2.useTheme)(),$=(0,_react.useMemo)(()=>buildStyles(W),[W]),X=(0,_index2.resolveFieldSize)(W,I),J=W.components.input[I]["multiline-min-height"],K=Math.round(X.text*W.leading.body),Q=w??W.settings.components.input?.defaultVariant??W.settings.components.field?.defaultVariant??"outline",Y=S??W.settings.components.input?.defaultLabelMode??"top",[Z,ee]=(0,_react.useState)(!1),[te,ie]=(0,_react.useState)(!1),ne="password"===d||u||c,ae="password"===d||u,le="textarea"===d||p,se=le?Math.round(.1*X.text):0,re="string"==typeof l&&l.length>0,oe=(0,_FieldBase.hasFieldText)(r),de=!0===r||oe,ce=(0,_FieldBase.hasFieldText)(o),ue=oe||!de&&ce,xe=(0,_FieldBase.hasFieldText)(i),pe=(0,_FieldBase.hasFieldText)(v),fe=!x&&!1!==O,me=Z||re||pe,ge=(0,_react.useRef)(null),ve=(0,_react.useMemo)(()=>(0,_index3.mergeRefs)(ge,t),[t]),he=(0,_react.useCallback)(()=>{fe&&ge.current?.focus()},[fe]),ye=xe&&"float"===Y,je=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,be=(0,_react.useRef)((0,_index2.createAnimatedValue)(ue?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(be,{toValue:ue?1:0,duration:W.motion.duration.fast,easing:_reactNative.Easing.bezier(...W.motion.ease["in-out"]),useNativeDriver:!0});return e.start(),()=>e.stop()},[ue,be,W.motion.duration.fast,W.motion.ease["in-out"]]);const Ie=(0,_index.useReducedMotion)(),we=W.settings.components.input?.shakeOnError??!1,Se=(0,_react.useRef)(de);(0,_react.useEffect)(()=>{if(!we)return void(Se.current=de);let e;return de&&!Se.current&&(Ie||((0,_index2.setNativeValue)(je,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:0,duration:100,useNativeDriver:!0})]),e.start()),(0,_index3.triggerHaptic)("notificationError")),Se.current=de,()=>e?.stop()},[de,je,we,Ie]);const Re=(0,_react.useCallback)(e=>{ee(!0),D?.(e)},[D]),Ne=(0,_react.useCallback)(e=>{ee(!1),C?.(e)},[C]),Te=(0,_react.useCallback)(()=>{(0,_index3.triggerHaptic)("selection"),ie(e=>!e)},[]),Fe=W.colors["field-caret"],Ve=W.settings.components.input?.tintLabelOnFocus??!1,Ae=Z&&Ve?W.colors["field-border-focus"]:W.colors["field-label"],Le=je.interpolate({inputRange:[-1,0,1],outputRange:[-6,0,6]}),Be=Boolean(f)||Boolean(m)||ae,Pe="underline"===Q,ke=_?X.icon+W.space.md+1+W.space.md:0,ze=(0,_useFloatingLabel.useFloatingLabel)({label:i,enabled:ye,floated:me,required:R,variant:Q,sizeTokens:X,leadingOffset:ke,trailingOffset:Be?X.icon+W.space.sm:0,textAlign:F,paddingLeft:Pe?W.space.none:X["padding-x"],lineHeight:le?K:void 0,restNudge:se,floatTrim:le?2:0,color:Ae,style:k}),qe=(0,_FieldBase.resolveFieldTextStyle)(W,{disabled:x}),De=qe.color,Ce=qe.placeholderColor,Ee=R&&!xe&&!re&&"string"==typeof a&&a.length>0,He=de?r:o,Me=T&&"number"==typeof N&&"string"==typeof l?`${l.length} / ${N}`:null,Oe=de?W.colors["field-message"]:W.colors["text-muted"],Ue=(0,_textInk.useTextInk)(z,X["message-text"],Oe),Ge=E??(0,_FieldBase.fieldTextAsString)(i)??a,We=x?W.colors["field-icon-disabled"]:Z?W.colors["field-icon-focus"]:W.colors["field-icon"],$e={focused:Z,disabled:x,error:de,color:We,size:X.icon},renderSlot=e=>(0,_slotIcon.renderSlotIcon)(e,$e),Xe=(()=>{if(ae){const e=(te?W.settings.icons.eyeOff:W.settings.icons.eye)??(te?_defaultIcons.defaultIcons.eyeOff:_defaultIcons.defaultIcons.eye);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Te,disabled:!fe,hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:te?G.hidePassword:G.showPassword,children:e({size:X.icon,color:We})})}const e=m?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.unit,{fontSize:X.text,color:Ce},g],children:m}):null,t=f?(0,_jsxRuntime.jsx)(_reactNative.View,{children:renderSlot(f)}):null;return e&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.trailingRow,children:[e,t]}):e??t})(),Je=_?(0,_jsxRuntime.jsx)(_reactNative.View,{children:renderSlot(_)}):null,Ke=_reactNative.StyleSheet.flatten(h),Qe=Ke?.fontSize??X.text,Ye=Ke?.color??Ce,Ze=(0,_react.useMemo)(()=>({fontSize:Qe,color:Ye}),[Qe,Ye]),et=pe?"string"==typeof v||"number"==typeof v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,marginRight:W.space.xs,lineHeight:le?K:void 0,paddingTop:le?se:void 0},h],children:v}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[$.prefixNode,{marginRight:W.space.xs,minHeight:le?K:void 0,justifyContent:"center",paddingTop:le?se:void 0}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,lineHeight:le?K:void 0},h],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ze,children:v})})}):null,tt=j?(0,_jsxRuntime.jsx)(_index4.Button,{variant:j.variant??"outline",tone:j.tone??"primary",size:I,label:j.label,leftIcon:j.icon,loading:j.loading,disabled:x||j.disabled,onPress:j.onPress,pressAnimation:!1,testID:j.testID,style:[$.action,{minHeight:X["min-height"],alignSelf:le?"flex-start":"stretch"},b]}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.container,{transform:[{translateX:Le}]},L],children:[xe&&!ye?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:I,required:R,help:n,color:Ae,style:k,children:i}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.fieldRow,{columnGap:W.space.sm,alignItems:le?"flex-start":"stretch"}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.fieldWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:I,variant:Q,focused:Z,disabled:x,error:de,filled:re,minHeight:le?J:void 0,radius:q,leading:Je,leadingDivider:null!=_,paddingLeft:Pe?W.space.none:void 0,trailing:Xe,slotAlign:le?"top":"center",slotLineHeight:le?K:void 0,topNotch:ze.topNotch,onPress:he,pressFeedback:!1,style:B,children:[et,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:ve,style:[$.input,{color:De,fontSize:X.text,...qe.weightStyle,paddingLeft:Pe?W.space.none:void 0,minHeight:le?J-2*X["padding-y"]:void 0,lineHeight:le?K:void 0,paddingTop:le?se:void 0,textAlignVertical:le?"top":"center"},P],textAlign:F,placeholder:ye&&!me||Ee?void 0:a,placeholderTextColor:Ce,value:V&&null!=l?V(l):l,onChangeText:e=>{s&&s(A?A(e):e)},onFocus:Re,onBlur:Ne,editable:fe,readOnly:y,secureTextEntry:ne&&!te,multiline:le,autoCapitalize:ne?"none":void 0,autoCorrect:!ne&&void 0,maxLength:N,selectionColor:Fe,accessibilityLabel:Ge,accessibilityState:{disabled:x},"aria-disabled":x,testID:M,...U}),Ee?(0,_jsxRuntime.jsx)(_FieldBase.RequiredPlaceholder,{text:a,color:Ce,fontSize:X.text,weightStyle:qe.weightStyle,align:le?"top":"center",paddingTop:le?se:void 0,textAlign:F}):null]})]}),ze.node]}),tt]}),ue||Me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.footerRow,{marginTop:X["message-gap"]}],children:[ue?(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.messageRow,{columnGap:W.space.xs,opacity:be}],accessibilityLiveRegion:de?"polite":"none",children:[de?(0,_jsxRuntime.jsx)(_FieldBase.FieldErrorGlyph,{size:X["message-text"],color:Oe}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.messageText,{color:Oe,fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")},z],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ue,children:He})})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:$.footerSpacer}),Me?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.counterText,{color:W.colors["text-subtle"],fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")}],children:Me}):null]}):null]})});Input.displayName="Input";const buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},fieldRow:{flexDirection:"row"},fieldWrapper:{position:"relative",overflow:"visible",flex:1},action:{flexShrink:0},input:{padding:e.space.none,margin:e.space.none,includeFontPadding:!1},prefix:{flexShrink:0,includeFontPadding:!1},prefixNode:{flexShrink:0},inputWrap:{flex:1,alignSelf:"stretch",justifyContent:"center"},unit:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center",columnGap:e.space.sm},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:e.space.sm},footerSpacer:{flex:1},messageRow:{flex:1,flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1},counterText:{flexShrink:0,includeFontPadding:!1}});var _default=exports.default=Input;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Input=exports.DEFAULT_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"),_hitSlop=require("../../utils/hitSlop.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Button/index.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INPUT_LABELS=exports.DEFAULT_INPUT_LABELS={showPassword:"Show password",hidePassword:"Hide password"},Input=exports.Input=(0,_react.forwardRef)((e,t)=>{const{label:i,help:n,placeholder:a,value:l,onChangeText:s,error:r,helperText:o,type:d="input",secureTextEntry:c=!1,showPasswordToggle:u=!1,disabled:x=!1,multiline:p=!1,leftIcon:_,rightIcon:f,unit:g,unitStyle:m,prefix:v,prefixStyle:h,readOnly:y=!1,action:j,actionStyle:I,size:b="md",variant:w,labelMode:S,required:R=!1,maxLength:N,showCounter:T=!0,textAlign:F,format:V,parse:A,style:L,containerStyle:B,inputStyle:P,labelStyle:k,messageStyle:z,radius:q,onFocus:D,onBlur:C,accessibilityLabel:E,labels:H,testID:M,editable:O,...U}=e;(0,_warnInvalidValue.warnInvalidValue)("Input","variant",w,["outline","filled","underline"]),(0,_warnInvalidValue.warnInvalidValue)("Input","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("Input","labelMode",S,["float","top"]),(0,_warnInvalidValue.warnInvalidValue)("Input","type",e.type,["input","password","textarea"]);const G=(0,_react.useMemo)(()=>({...DEFAULT_INPUT_LABELS,...H}),[H]),W=(0,_index2.useTheme)(),$=(0,_react.useMemo)(()=>buildStyles(W),[W]),X=(0,_index2.resolveFieldSize)(W,b),J=W.components.input[b]["multiline-min-height"],K=Math.round(X.text*W.leading.body),Q=w??W.settings.components.input?.defaultVariant??W.settings.components.field?.defaultVariant??"outline",Y=S??W.settings.components.input?.defaultLabelMode??"top",[Z,ee]=(0,_react.useState)(!1),[te,ie]=(0,_react.useState)(!1),ne="password"===d||u||c,ae="password"===d||u,le="textarea"===d||p,se=le?Math.round(.1*X.text):0,re="string"==typeof l&&l.length>0,oe=(0,_FieldBase.hasFieldText)(r),de=!0===r||oe,ce=(0,_FieldBase.hasFieldText)(o),ue=oe||!de&&ce,xe=(0,_FieldBase.hasFieldText)(i),pe=(0,_FieldBase.hasFieldText)(v),fe=!x&&!1!==O,ge=Z||re||pe,me=(0,_react.useRef)(null),ve=(0,_react.useMemo)(()=>(0,_index3.mergeRefs)(me,t),[t]),he=(0,_react.useCallback)(()=>{fe&&me.current?.focus()},[fe]),ye=xe&&"float"===Y,je=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,Ie=(0,_react.useRef)((0,_index2.createAnimatedValue)(ue?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(Ie,{toValue:ue?1:0,duration:W.motion.duration.fast,easing:_reactNative.Easing.bezier(...W.motion.ease["in-out"]),useNativeDriver:!0});return e.start(),()=>e.stop()},[ue,Ie,W.motion.duration.fast,W.motion.ease["in-out"]]);const be=(0,_index.useReducedMotion)(),we=W.settings.components.input?.shakeOnError??!1,Se=(0,_react.useRef)(de);(0,_react.useEffect)(()=>{if(!we)return void(Se.current=de);let e;return de&&!Se.current&&(be||((0,_index2.setNativeValue)(je,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(je,{toValue:0,duration:100,useNativeDriver:!0})]),e.start()),(0,_index3.triggerHaptic)("notificationError")),Se.current=de,()=>e?.stop()},[de,je,we,be]);const Re=(0,_react.useCallback)(e=>{ee(!0),D?.(e)},[D]),Ne=(0,_react.useCallback)(e=>{ee(!1),C?.(e)},[C]),Te=(0,_react.useCallback)(()=>{(0,_index3.triggerHaptic)("selection"),ie(e=>!e)},[]),Fe=W.colors["field-caret"],Ve=W.settings.components.input?.tintLabelOnFocus??!1,Ae=Z&&Ve?W.colors["field-border-focus"]:W.colors["field-label"],Le=je.interpolate({inputRange:[-1,0,1],outputRange:[-6,0,6]}),Be=Boolean(f)||Boolean(g)||ae,Pe="underline"===Q,ke=_?X.icon+W.space.md+1+W.space.md:0,ze=(0,_useFloatingLabel.useFloatingLabel)({label:i,enabled:ye,floated:ge,required:R,variant:Q,sizeTokens:X,leadingOffset:ke,trailingOffset:Be?X.icon+W.space.sm:0,textAlign:F,paddingLeft:Pe?W.space.none:X["padding-x"],lineHeight:le?K:void 0,restNudge:se,floatTrim:le?2:0,color:Ae,style:k}),qe=(0,_FieldBase.resolveFieldTextStyle)(W,{disabled:x}),De=qe.color,Ce=qe.placeholderColor,Ee=R&&!xe&&!re&&"string"==typeof a&&a.length>0,He=de?r:o,Me=T&&"number"==typeof N&&"string"==typeof l?`${l.length} / ${N}`:null,Oe=de?W.colors["field-message"]:W.colors["text-muted"],Ue=(0,_textInk.useTextInk)(z,X["message-text"],Oe),Ge=E??(0,_FieldBase.fieldTextAsString)(i)??a,We=x?W.colors["field-icon-disabled"]:Z?W.colors["field-icon-focus"]:W.colors["field-icon"],$e={focused:Z,disabled:x,error:de,color:We,size:X.icon},renderSlot=e=>(0,_slotIcon.renderSlotIcon)(e,$e),Xe=(()=>{if(ae){const e=(te?W.settings.icons.eyeOff:W.settings.icons.eye)??(te?_defaultIcons.defaultIcons.eyeOff:_defaultIcons.defaultIcons.eye);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Te,disabled:!fe,hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:te?G.hidePassword:G.showPassword,children:e({size:X.icon,color:We})})}const e=g?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.unit,{fontSize:X.text,color:Ce},m],children:g}):null,t=f?(0,_slotIcon.slotIconView)(f,renderSlot(f)):null;return e&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.trailingRow,children:[e,t]}):e??t})(),Je=_?(0,_slotIcon.slotIconView)(_,renderSlot(_)):null,Ke=_reactNative.StyleSheet.flatten(h),Qe=Ke?.fontSize??X.text,Ye=Ke?.color??Ce,Ze=(0,_react.useMemo)(()=>({fontSize:Qe,color:Ye}),[Qe,Ye]),et=pe?"string"==typeof v||"number"==typeof v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,marginRight:W.space.xs,lineHeight:le?K:void 0,paddingTop:le?se:void 0},h],children:v}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[$.prefixNode,{marginRight:W.space.xs,minHeight:le?K:void 0,justifyContent:"center",paddingTop:le?se:void 0}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,lineHeight:le?K:void 0},h],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ze,children:v})})}):null,tt=j?(0,_jsxRuntime.jsx)(_index4.Button,{variant:j.variant??"outline",tone:j.tone??"primary",size:b,label:j.label,leftIcon:j.icon,loading:j.loading,disabled:x||j.disabled,onPress:j.onPress,pressAnimation:!1,testID:j.testID,style:[$.action,{minHeight:X["min-height"],alignSelf:le?"flex-start":"stretch"},I]}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.container,{transform:[{translateX:Le}]},L],children:[xe&&!ye?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:b,required:R,help:n,color:Ae,style:k,children:i}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.fieldRow,{columnGap:W.space.sm,alignItems:le?"flex-start":"stretch"}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.fieldWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:b,variant:Q,focused:Z,disabled:x,error:de,filled:re,minHeight:le?J:void 0,radius:q,leading:Je,leadingDivider:null!=_,paddingLeft:Pe?W.space.none:void 0,trailing:Xe,slotAlign:le?"top":"center",slotLineHeight:le?K:void 0,topNotch:ze.topNotch,onPress:he,pressFeedback:!1,style:B,children:[et,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:ve,style:[$.input,{color:De,fontSize:X.text,...qe.weightStyle,paddingLeft:Pe?W.space.none:void 0,minHeight:le?J-2*X["padding-y"]:void 0,lineHeight:le?K:void 0,paddingTop:le?se:void 0,textAlignVertical:le?"top":"center"},P],textAlign:F,placeholder:ye&&!ge||Ee?void 0:a,placeholderTextColor:Ce,value:V&&null!=l?V(l):l,onChangeText:e=>{s&&s(A?A(e):e)},onFocus:Re,onBlur:Ne,editable:fe,readOnly:y,secureTextEntry:ne&&!te,multiline:le,autoCapitalize:ne?"none":void 0,autoCorrect:!ne&&void 0,maxLength:N,selectionColor:Fe,accessibilityLabel:Ge,accessibilityState:{disabled:x},"aria-disabled":x,testID:M,...U}),Ee?(0,_jsxRuntime.jsx)(_FieldBase.RequiredPlaceholder,{text:a,color:Ce,fontSize:X.text,weightStyle:qe.weightStyle,align:le?"top":"center",paddingTop:le?se:void 0,textAlign:F}):null]})]}),ze.node]}),tt]}),ue||Me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.footerRow,{marginTop:X["message-gap"]}],children:[ue?(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.messageRow,{columnGap:W.space.xs,opacity:Ie}],accessibilityLiveRegion:de?"polite":"none",children:[de?(0,_jsxRuntime.jsx)(_FieldBase.FieldErrorGlyph,{size:X["message-text"],color:Oe}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.messageText,{color:Oe,fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")},z],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ue,children:He})})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:$.footerSpacer}),Me?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.counterText,{color:W.colors["text-subtle"],fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")}],children:Me}):null]}):null]})});Input.displayName="Input";const buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},fieldRow:{flexDirection:"row"},fieldWrapper:{position:"relative",overflow:"visible",flex:1},action:{flexShrink:0},input:{padding:e.space.none,margin:e.space.none,includeFontPadding:!1},prefix:{flexShrink:0,includeFontPadding:!1},prefixNode:{flexShrink:0},inputWrap:{flex:1,alignSelf:"stretch",justifyContent:"center"},unit:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center",columnGap:e.space.sm},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:e.space.sm},footerSpacer:{flex:1},messageRow:{flex:1,flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1},counterText:{flexShrink:0,includeFontPadding:!1}});var _default=exports.default=Input;
|
|
@@ -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),[C,E]=(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),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?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||!C)return null;const e=i.x+i.width/2>F.width/2?"end":"start";return(0,_placement.computePlacement)(i,C,F,o,{align:e})},[i,C,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;E(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,_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,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"),_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 +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"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.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),n=i.base,o=e.colors.bg,s="neutral"===r;let a;switch(t){case"soft":a={fill:s?e.colors["bg-muted"]:(0,_color.blendOf)(n,.14,o,e.colors["bg-subtle"]),ring:o,icon:n};break;case"outline":a={fill:o,ring:s?e.colors.border:n,icon:n};break;default:a={fill:n,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:n,onPick:o,onRemove:s,loading:a=!1,disabled:l=!1,accept:c=DEFAULT_ACCEPT,maxSizeMB:
|
|
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"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.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),n=i.base,o=e.colors.bg,s="neutral"===r;let a;switch(t){case"soft":a={fill:s?e.colors["bg-muted"]:(0,_color.blendOf)(n,.14,o,e.colors["bg-subtle"]),ring:o,icon:n};break;case"outline":a={fill:o,ring:s?e.colors.border:n,icon:n};break;default:a={fill:n,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:n,onPick:o,onRemove:s,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:v,required:f=!1,helperText:y,error:j,layout:k="stacked",title:I,subtitle:P,ImageComponent:C,labels:R,haptic:E,onError:w,accessibilityLabel:S,style:T,testID:F}=e;(0,_warnInvalidValue.warnInvalidValue)("ProfilePicker","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("ProfilePicker","shape",e.shape,["circle","rounded","square"]),(0,_warnInvalidValue.warnInvalidValue)("ProfilePicker","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("ProfilePicker","variant",e.variant,["solid","soft","outline"]),(0,_warnInvalidValue.warnInvalidValue)("ProfilePicker","layout",e.layout,["stacked","inline","profile"]);const L=(0,_index.useTheme)(),A=L.settings.components["profile-picker"],V=x??A?.defaultTone??"primary",O=p??A?.defaultVariant??"solid",q=(0,_react.useMemo)(()=>badgeLookFor(L,V,O),[L,V,O]),M=g??A?.defaultAvatarTone,D=(0,_react.useMemo)(()=>({...DEFAULT_PROFILE_PICKER_LABELS,...R}),[R]),[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(s)),J=n.length>0||Y,ee=SIZE_PX[u],re=resolveRadius(_,ee),te=re*(1-Math.SQRT1_2),ie=clamp(Math.round(.28*ee),24,44),ne=te-ie/2,oe=Math.max(0,-ne),se=(0,_react.useCallback)(e=>{H(e),w?.(e),!1!==E&&(0,_index2.triggerHaptic)("notificationError")},[w,E]),ae=(0,_react.useCallback)(async e=>{let r;try{r=await e.pick()}catch(e){return void se(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 se(D.errorTooLarge(d));if(t.type&&!(0,_FilePicker.matchesAccept)(t.type,c))return void se(D.errorWrongType);H(null),B(t.uri);const i=(0,_index2.resolveHaptic)(E,"selection");i&&(0,_index2.triggerHaptic)(i),o?.(t)},[d,c,D,E,o,se]),le=(0,_react.useCallback)(()=>{Z||(ue.current=null,1!==n.length||Y?(n.length>0||Y)&&K(!0):ae(n[0]))},[Z,n,Y,ae]),ce=(0,_react.useCallback)(()=>{B(null),H(null);const e=(0,_index2.resolveHaptic)(E,"selection");e&&(0,_index2.triggerHaptic)(e),s?.()},[E,s]),de=(0,_react.useMemo)(()=>{const e=n.map(e=>({kind:"source",source:e}));return Y&&e.push({kind:"remove"}),e},[n,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:C,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:ne,bottom:ne,backgroundColor:q.fill,borderColor:q.ring}],children:(0,_slotIcon.renderSlotIcon)(m,{color:q.icon,size:Math.round(.55*ie),disabled:!1})}):null]})}),ve="stacked"!==k?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.meta,"profile"===k?styles.metaCentred:null],children:[I?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",weight:"semibold",style:[styles.title,"profile"===k?styles.textCentred:null],children:I}):null,P?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"bodySmall",color:"secondary",style:[styles.subtitle,"profile"===k?styles.textCentred:null,{marginTop:L.space.xxs}],children:P}):null,(0,_jsxRuntime.jsx)(_index5.FieldMessage,{text:Q??y,error:(0,_index5.hasFieldText)(Q)})]}):(0,_jsxRuntime.jsx)(_index5.FieldMessage,{text:Q??y,error:(0,_index5.hasFieldText)(Q)});return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:r,style:T,testID:F,children:[v?(0,_jsxRuntime.jsx)(_index5.FieldLabel,{required:f,children:v}):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,ve]}),(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:U,haptic:E,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.SearchBar=exports.DEFAULT_SEARCH_BAR_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_useControllableState=require("../../hooks/useControllableState.js"),_useDebounce=require("../../hooks/useDebounce.js"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_mergeRefs=require("../../utils/mergeRefs.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_SearchPanel=require("./SearchPanel.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_SEARCH_BAR_LABELS=exports.DEFAULT_SEARCH_BAR_LABELS=Object.freeze({placeholder:"Search…",recents:"Recent searches",clearAll:"Clear all",clearAllRecents:"Clear all recent searches",searchAgain:"Searches again",removeRecent:e=>`Remove ${e} from recent searches`,scope:"Search scope",clearSearch:"Clear search",searching:e=>`Searching ${e}`,suggestionCount:e=>1===e?"1 suggestion":`${e} suggestions`,removed:e=>`Removed ${e}`,recentsCleared:"Recent searches cleared"}),DEFAULT_PANEL_ROWS=8,HOLD_RELEASE_MS=50,SearchBar=exports.SearchBar=(0,_react.forwardRef)((e,a)=>{const{value:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SearchBar=exports.DEFAULT_SEARCH_BAR_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_useControllableState=require("../../hooks/useControllableState.js"),_useDebounce=require("../../hooks/useDebounce.js"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_mergeRefs=require("../../utils/mergeRefs.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_SearchPanel=require("./SearchPanel.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_SEARCH_BAR_LABELS=exports.DEFAULT_SEARCH_BAR_LABELS=Object.freeze({placeholder:"Search…",recents:"Recent searches",clearAll:"Clear all",clearAllRecents:"Clear all recent searches",searchAgain:"Searches again",removeRecent:e=>`Remove ${e} from recent searches`,scope:"Search scope",clearSearch:"Clear search",searching:e=>`Searching ${e}`,suggestionCount:e=>1===e?"1 suggestion":`${e} suggestions`,removed:e=>`Removed ${e}`,recentsCleared:"Recent searches cleared"}),DEFAULT_PANEL_ROWS=8,HOLD_RELEASE_MS=50,SearchBar=exports.SearchBar=(0,_react.forwardRef)((e,a)=>{const{value:t,onChangeText:l,onSubmit:s,onFocus:r,onBlur:n,placeholder:c,autoFocus:i=!1,disabled:o=!1,onClear:u,leftIcon:d,debounceMs:_,size:h="md",variant:b,radius:p,label:S,labelMode:g="top",labelStyle:v,scopes:f,scope:m,onScopeChange:x,recents:R,maxRecents:C=DEFAULT_PANEL_ROWS,onSelectRecent:j,onRemove:F,onClearRecents:B,suggestions:L,maxSuggestions:y=DEFAULT_PANEL_ROWS,onSelect:A,haptic:E,labels:I,style:k,inputStyle:w,accessibilityLabel:q,testID:T,...V}=e;(0,_warnInvalidValue.warnInvalidValue)("SearchBar","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("SearchBar","variant",e.variant,["outline","filled","underline"]),(0,_warnInvalidValue.warnInvalidValue)("SearchBar","labelMode",e.labelMode,["top","float"]);const D=(0,_index.useTheme)(),H=(0,_react.useMemo)(()=>({...DEFAULT_SEARCH_BAR_LABELS,...I}),[I]),N=c??H.placeholder,P=b??D.settings.components["search-bar"]?.defaultVariant??D.settings.components.field?.defaultVariant??"filled",z="underline"===P,U=(0,_index.resolveFieldSize)(D,h),M=p??D.components["search-bar"][h].radius,O=(0,_FieldBase.resolveFieldTextStyle)(D,{disabled:o}),W=(0,_react.useRef)(null),$=(0,_react.useMemo)(()=>(0,_mergeRefs.mergeRefs)(W,a),[a]),K=(0,_react.useCallback)(()=>{o||W.current?.focus()},[o]),G=(0,_react.useMemo)(()=>buildStyles(D),[D]),J="string"==typeof t?t:"",[Q,X]=(0,_react.useState)(!1),Y=(0,_react.useCallback)(e=>{X(!0),r?.(e)},[r]),Z=(0,_react.useCallback)(e=>{X(!1),n?.(e)},[n]),[ee,ae]=(0,_react.useState)(J),te=(0,_useDebounce.useDebounce)(ee,_??0);(0,_react.useEffect)(()=>{void 0!==_&&J!==ee&&ae(J)},[J,_]);const le=(0,_react.useRef)(J);(0,_react.useEffect)(()=>{void 0!==_&&te!==le.current&&(le.current=te,l(te))},[te,_,l]);const se=(0,_react.useCallback)(e=>{void 0===_?l(e):ae(e)},[_,l]),re=(0,_react.useCallback)(()=>{const e=(0,_hapticUtils.resolveHaptic)(E,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),void 0!==_&&(ae(""),le.current=""),l(""),u?.()},[E,_,l,u]),ne=(0,_react.useCallback)(()=>{s?.(void 0!==_?ee:J)},[s,_,ee,J]),ce=void 0!==_?ee:J,ie=ce.length>0,[oe,ue]=(0,_useControllableState.useControllableState)({value:m,defaultValue:f?.[0]?.value??"",onChange:x}),de=(0,_react.useCallback)(e=>{ue(e);const a=f?.find(a=>a.value===e)?.label;a&&(0,_announce.announce)(H.searching(a))},[f,ue,H]),[he,be]=(0,_react.useState)(!1),pe=(0,_react.useRef)(null),Se=(0,_react.useCallback)(()=>{pe.current&&(clearTimeout(pe.current),pe.current=null)},[]),ge=(0,_react.useCallback)(()=>{Se(),be(!0)},[Se]),ve=(0,_react.useCallback)(()=>{Se(),pe.current=setTimeout(()=>be(!1),50)},[Se]);(0,_react.useEffect)(()=>Se,[Se]);const fe=!o&&(Q||he),me=(0,_react.useMemo)(()=>(R??[]).slice(0,C),[R,C]),xe=(0,_react.useMemo)(()=>(L??[]).slice(0,y).map(_SearchPanel.normalizeSuggestion),[L,y]),Re=fe&&!ie&&me.length>0,Ce=fe&&ie&&xe.length>0,je=Ce?xe.length:0,Fe=je>0?H.suggestionCount(je):"";(0,_react.useEffect)(()=>{Fe&&(0,_announce.announce)(Fe)},[Fe]);const Be=(0,_react.useCallback)(()=>{const e=(0,_hapticUtils.resolveHaptic)(E,"selection");e&&(0,_hapticUtils.triggerHaptic)(e)},[E]),Le=(0,_react.useCallback)(e=>{Be(),W.current?.blur(),be(!1),j?.(e)},[Be,j]),ye=(0,_react.useCallback)(e=>{Be(),W.current?.blur(),be(!1),A?.(e)},[Be,A]),Ae=(0,_react.useCallback)(e=>{Be(),F?.(e),(0,_announce.announce)(H.removed(e)),K()},[Be,F,K,H]),Ee=(0,_react.useCallback)(()=>{Be(),B?.(),(0,_announce.announce)(H.recentsCleared),K()},[Be,B,K,H]),Ie={size:U.icon,color:o?D.colors["text-disabled"]:D.colors["text-subtle"],disabled:o},ke=d?(0,_slotIcon.renderSlotIcon)(d,Ie):(D.settings.icons.search??_defaultIcons.defaultIcons.search)(Ie),we=(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:ke}),qe=Boolean(S)&&"float"===g,Te=(0,_useFloatingLabel.useFloatingLabel)({label:S,enabled:qe,floated:Q||ie,variant:P,sizeTokens:U,leadingOffset:U.icon+D.space.md,trailingOffset:ie?U.icon+D.space.md:0,paddingLeft:z?D.space.none:U["padding-x"],color:D.colors["field-label"],style:v}),Ve=ie&&!o?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:re,hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:H.clearSearch,children:(D.settings.icons.close??_defaultIcons.defaultIcons.close)({size:U.icon,color:D.colors["text-muted"]})}):null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:k,testID:T,children:[S&&!qe?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:h,style:v,children:S}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:G.root,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:G.fieldWrap,children:[(0,_jsxRuntime.jsx)(_FieldBase.FieldBase,{size:h,variant:P,focused:Q,disabled:o,filled:ie,minHeight:U["min-height"],paddingHorizontal:z?D.space.none:U["padding-x"],radius:M,leading:we,trailing:Ve,topNotch:Te.topNotch,onPress:K,pressFeedback:!1,accessibilityRole:"search",accessibilityLabel:q??N,children:(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:$,style:[G.input,{fontSize:U.text,color:O.color,...O.weightStyle},w],value:ce,onChangeText:se,onSubmitEditing:ne,onFocus:Y,onBlur:Z,placeholder:!qe||Q||ie?N:void 0,placeholderTextColor:O.placeholderColor,autoFocus:i,editable:!o,returnKeyType:"search",selectionColor:(0,_FieldBase.resolveVariantColors)(D,P).borderFocusedRepresentative,accessibilityLabel:q??N,accessibilityState:{disabled:o},"aria-disabled":o,...V})}),Te.node]})}),f&&f.length>0?(0,_jsxRuntime.jsx)(_SearchPanel.SearchScopeBar,{scopes:f,scope:oe||(f[0]?.value??""),disabled:o,haptic:E,labels:H,onChange:de}):null,Re?(0,_jsxRuntime.jsx)(_SearchPanel.SearchRecents,{recents:me,labels:H,onSelect:Le,onRemove:F?Ae:void 0,onClear:B?Ee:void 0,onHold:ge,onRelease:ve}):null,Ce?(0,_jsxRuntime.jsx)(_SearchPanel.SearchSuggestions,{suggestions:xe,query:ce,onSelect:ye,onHold:ge,onRelease:ve}):null]})});SearchBar.displayName="SearchBar";const buildStyles=e=>_reactNative.StyleSheet.create({root:{flexDirection:"row",alignItems:"center",width:"100%",position:"relative",overflow:"visible"},fieldWrap:{flex:1,position:"relative",overflow:"visible"},input:{flex:1,padding:e.space.none,margin:e.space.none,includeFontPadding:!1}});var _default=exports.default=SearchBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeSuggestion=exports.SearchSuggestions=exports.SearchScopeBar=exports.SearchRecents=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../AppIcon/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Chip/index.js"),_index4=require("../Text/index.js"),_highlight=require("./highlight.js"),_jsxRuntime=require("react/jsx-runtime");const TOUCH=44,ICON=18,normalizeSuggestion=e=>"string"==typeof e?{text:e}:e;exports.normalizeSuggestion=normalizeSuggestion;const SearchScopeBar=({scopes:e,scope:s,disabled:t,haptic:i,labels:n,onChange:r})=>{const o=(0,_index.useTheme)(),l=(0,_react.useMemo)(()=>buildStyles(o),[o]);return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",contentContainerStyle:l.scopes,accessibilityLabel:n.scope,children:e.map(e=>(0,_jsxRuntime.jsx)(_index3.Chip,{label:e.label,selected:e.value===s,disabled:t,haptic:i,onPress:()=>r(e.value),containerStyle:l.scopeChip},e.value))})};exports.SearchScopeBar=SearchScopeBar;const SearchRecents=({recents:e,labels:s,onSelect:t,onRemove:i,onClear:n,onHold:r,onRelease:o})=>{const l=(0,_index.useTheme)(),c=(0,_react.useMemo)(()=>buildStyles(l),[l]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:c.list,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:c.header,children:[(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",accessibilityRole:"header",style:c.headerTitle,children:s.recents}),n?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:n,onPressIn:r,onPressOut:o,accessibilityRole:"button",accessibilityLabel:s.clearAllRecents,style:c.clearAll,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",color:"link",children:s.clearAll})}):null]}),e.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:c.row,children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>t(e),onPressIn:r,onPressOut:o,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:s.searchAgain,android_ripple:{color:l.colors["surface-pressed"]},style:({pressed:e})=>[c.rowMain,e?{backgroundColor:l.colors["surface-pressed"]}:null],children:[(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"history",size:18,color:l.colors["text-subtle"]}),(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",numberOfLines:1,style:c.rowText,children:e})]}),i?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i(e),onPressIn:r,onPressOut:o,accessibilityRole:"button",accessibilityLabel:s.removeRecent(e),style:c.remove,children:(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"x",size:18,color:l.colors["text-muted"]})}):null]},e))]})};exports.SearchRecents=SearchRecents;const SuggestionRow=(0,_react.memo)(({item:e,query:s,onSelect:t,onHold:i,onRelease:n,theme:r,styles:o})=>{const l=(0,_highlight.splitHighlight)(e.text,s),c=e.icon?(0,_slotIcon.renderSlotIcon)(e.icon,{size:18,color:r.colors["text-subtle"],disabled:!1}):(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"search",size:18,color:r.colors["text-subtle"]});return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>t(e),onPressIn:i,onPressOut:n,accessibilityRole:"button",accessibilityLabel:e.subtitle?`${e.text}, ${e.subtitle}`:e.text,android_ripple:{color:r.colors["surface-pressed"]},style:({pressed:e})=>[o.rowMain,o.suggestion,e?{backgroundColor:r.colors["surface-pressed"]}:null],children:[c,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:o.rowText,children:[(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",color:"secondary",numberOfLines:1,children:l.map(e=>(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",color:"secondary",style:e.match?o.match:void 0,children:e.text},e.start))}),e.subtitle?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",numberOfLines:1,children:e.subtitle}):null]})]})});SuggestionRow.displayName="SuggestionRow";const SearchSuggestions=({suggestions:e,query:s,onSelect:t,onHold:i,onRelease:n})=>{const r=(0,_index.useTheme)(),o=(0,_react.useMemo)(()=>buildStyles(r),[r]);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:o.list,children:e.map(e=>(0,_jsxRuntime.jsx)(SuggestionRow,{item:e,query:s,onSelect:t,onHold:i,onRelease:n,theme:r,styles:o},e.id??e.text))})};exports.SearchSuggestions=SearchSuggestions;const buildStyles=e=>({..._reactNative.StyleSheet.create({scopes:{flexDirection:"row",alignItems:"center",gap:e.space.sm,paddingTop:e.space.sm},scopeChip:{minHeight:44},list:{width:"100%",paddingTop:e.space.xs},header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",minHeight:44,paddingHorizontal:e.space.xs},headerTitle:{flex:1},clearAll:{minHeight:44,minWidth:44,justifyContent:"center",alignItems:"flex-end"},row:{flexDirection:"row",alignItems:"center"},rowMain:{flex:1,flexDirection:"row",alignItems:"center",gap:e.space.md,minHeight:44,paddingHorizontal:e.space.xs},suggestion:{paddingVertical:e.space.xs},rowText:{flex:1},remove:{width:44,height:44,alignItems:"center",justifyContent:"center"}}),match:{...(0,_index.fontFor)(e,"bold"),color:e.colors["text-body"]}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeSuggestion=exports.SearchSuggestions=exports.SearchScopeBar=exports.SearchRecents=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../AppIcon/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Chip/index.js"),_index4=require("../Text/index.js"),_highlight=require("./highlight.js"),_jsxRuntime=require("react/jsx-runtime");const TOUCH=44,ICON=18,normalizeSuggestion=e=>"string"==typeof e?{text:e}:e;exports.normalizeSuggestion=normalizeSuggestion;const SearchScopeBar=({scopes:e,scope:s,disabled:t,haptic:i,labels:n,onChange:r})=>{const o=(0,_index.useTheme)(),l=(0,_react.useMemo)(()=>buildStyles(o),[o]);return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,keyboardShouldPersistTaps:"handled",contentContainerStyle:l.scopes,accessibilityLabel:n.scope,children:e.map(e=>(0,_jsxRuntime.jsx)(_index3.Chip,{label:e.label,selected:e.value===s,disabled:t,haptic:i,onPress:()=>r(e.value),containerStyle:l.scopeChip},e.value))})};exports.SearchScopeBar=SearchScopeBar;const SearchRecents=({recents:e,labels:s,onSelect:t,onRemove:i,onClear:n,onHold:r,onRelease:o})=>{const l=(0,_index.useTheme)(),c=(0,_react.useMemo)(()=>buildStyles(l),[l]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:c.list,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:c.header,children:[(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",accessibilityRole:"header",style:c.headerTitle,children:s.recents}),n?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:n,onPressIn:r,onPressOut:o,accessibilityRole:"button",accessibilityLabel:s.clearAllRecents,style:c.clearAll,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",color:"link",children:s.clearAll})}):null]}),e.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:c.row,children:[(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>t(e),onPressIn:r,onPressOut:o,accessibilityRole:"button",accessibilityLabel:e,accessibilityHint:s.searchAgain,android_ripple:{color:l.colors["surface-pressed"]},style:({pressed:e})=>[c.rowMain,e?{backgroundColor:l.colors["surface-pressed"]}:null],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"history",size:18,color:l.colors["text-subtle"]})}),(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",numberOfLines:1,style:c.rowText,children:e})]}),i?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i(e),onPressIn:r,onPressOut:o,accessibilityRole:"button",accessibilityLabel:s.removeRecent(e),style:c.remove,children:(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"x",size:18,color:l.colors["text-muted"]})})}):null]},e))]})};exports.SearchRecents=SearchRecents;const SuggestionRow=(0,_react.memo)(({item:e,query:s,onSelect:t,onHold:i,onRelease:n,theme:r,styles:o})=>{const l=(0,_highlight.splitHighlight)(e.text,s),c=e.icon?(0,_slotIcon.renderSlotIcon)(e.icon,{size:18,color:r.colors["text-subtle"],disabled:!1}):(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:"search",size:18,color:r.colors["text-subtle"]});return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>t(e),onPressIn:i,onPressOut:n,accessibilityRole:"button",accessibilityLabel:e.subtitle?`${e.text}, ${e.subtitle}`:e.text,android_ripple:{color:r.colors["surface-pressed"]},style:({pressed:e})=>[o.rowMain,o.suggestion,e?{backgroundColor:r.colors["surface-pressed"]}:null],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:c}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:o.rowText,children:[(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",color:"secondary",numberOfLines:1,children:l.map(e=>(0,_jsxRuntime.jsx)(_index4.Text,{variant:"body",color:"secondary",style:e.match?o.match:void 0,children:e.text},e.start))}),e.subtitle?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",numberOfLines:1,children:e.subtitle}):null]})]})});SuggestionRow.displayName="SuggestionRow";const SearchSuggestions=({suggestions:e,query:s,onSelect:t,onHold:i,onRelease:n})=>{const r=(0,_index.useTheme)(),o=(0,_react.useMemo)(()=>buildStyles(r),[r]);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:o.list,children:e.map(e=>(0,_jsxRuntime.jsx)(SuggestionRow,{item:e,query:s,onSelect:t,onHold:i,onRelease:n,theme:r,styles:o},e.id??e.text))})};exports.SearchSuggestions=SearchSuggestions;const buildStyles=e=>({..._reactNative.StyleSheet.create({scopes:{flexDirection:"row",alignItems:"center",gap:e.space.sm,paddingTop:e.space.sm},scopeChip:{minHeight:44},list:{width:"100%",paddingTop:e.space.xs},header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",minHeight:44,paddingHorizontal:e.space.xs},headerTitle:{flex:1},clearAll:{minHeight:44,minWidth:44,justifyContent:"center",alignItems:"flex-end"},row:{flexDirection:"row",alignItems:"center"},rowMain:{flex:1,flexDirection:"row",alignItems:"center",gap:e.space.md,minHeight:44,paddingHorizontal:e.space.xs},suggestion:{paddingVertical:e.space.xs},rowText:{flex:1},remove:{width:44,height:44,alignItems:"center",justifyContent:"center"}}),match:{...(0,_index.fontFor)(e,"bold"),color:e.colors["text-body"]}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SegmentedControl=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../FieldBase/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const LABEL_LINE_HEIGHT_RATIO=1.25,activeInkFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"neutral":return e.colors["text-body"];case"success":return e.colors["success-text"];case"warning":return e.colors["warning-text"];case"danger":return e.colors["danger-text"];default:return e.colors["info-text"]}},SegmentedControl=exports.SegmentedControl=(0,_react.forwardRef)((e,t)=>{const{segments:i,label:r,helperText:n,error:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SegmentedControl=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../FieldBase/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const LABEL_LINE_HEIGHT_RATIO=1.25,activeInkFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"neutral":return e.colors["text-body"];case"success":return e.colors["success-text"];case"warning":return e.colors["warning-text"];case"danger":return e.colors["danger-text"];default:return e.colors["info-text"]}},SegmentedControl=exports.SegmentedControl=(0,_react.forwardRef)((e,t)=>{const{segments:i,label:r,helperText:n,error:s,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,_warnInvalidValue.warnInvalidValue)("SegmentedControl","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("SegmentedControl","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("SegmentedControl","variant",e.variant,["underline","pills","segmented"]);const[I,C]=(0,_index.useControllableState)({value:l,defaultValue:a??i[0]?.value,onChange:o}),R=(0,_index2.useTheme)(),V=R.components["segmented-control"],q=(0,_react.useMemo)(()=>buildStyles(R),[R]),k=(0,_react.useMemo)(()=>(0,_index2.resolveSegmentedControlSize)(R,d),[R,d]),F=g>=2?2:1,L=F>1,N="segmented"===x,z="underline"===x,M="pills"===x,E=N?R.space[V["track-padding"]]:0,T=Math.ceil(1.25*k.text)*(F-1),A=V["underline-height"],H=R.space[V["pill-inset"]],D="number"==typeof h?h:h?R.radius[h]:void 0,B=D??R.radius.md,W=void 0===D?R.radius.sm:Math.max(D-E,0),P=D??R.radius.pill,O=D??R.radius.none,[G,X]=(0,_react.useState)([]),J=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,K=Math.max(0,i.findIndex(e=>e.value===I)),Q=G[K],U=Q?.x,Y=(0,_react.useCallback)(e=>{const t=R.motion.spring.snappy,i=_reactNative.Animated.spring(J,{toValue:e,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:!0});return i.start(),i},[R.motion.spring.snappy,J]);(0,_react.useEffect)(()=>{X(e=>e.length===i.length||0===e.length?e:[])},[i.length]);const Z=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(void 0===U)return;const e=null!==Z.current&&Z.current!==K;if(Z.current=K,!e)return void J.setValue(U);const t=Y(U);return()=>t.stop()},[K,U,Y,J]);const $=(0,_react.useCallback)((e,t)=>{const{x:i,width:r}=t.nativeEvent.layout;X(t=>{const n=t[e];if(n&&n.x===i&&n.width===r)return t;const s=t.slice();return s[e]={x:i,width:r},s})},[]),ee=(0,_react.useCallback)(e=>{if(u)return;if(e.value===I)return;const t=(0,_index3.resolveHaptic)(_,"selection");t&&(0,_index3.triggerHaptic)(t),C(e.value)},[u,C,I,_]),te=N?R.colors.thumb:M?R.colors["primary-soft"]:R.colors.primary,ie=N?W:M?P:O,re=activeInkFor(R,m),ne=R.colors["bg-muted"],se=(0,_SquircleFill.useSquircle)(N,B),le=!0===s||(0,_index4.hasFieldText)(s),ae=le&&!u,oe=R.colors["field-border-error"],de=R.size.border,ce=(0,_index4.hasFieldText)(r),ue=le?s:n,me=(0,_index4.hasFieldText)(ue),xe=b??("string"==typeof r?r:void 0),he=(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,accessibilityRole:"radiogroup",accessibilityLabel:xe,testID:w,style:[q.track,{...L?{minHeight:k.height+T}:{height:k.height},opacity:u?.55:1,alignSelf:c?"stretch":"flex-start"},N?{borderRadius:B,..._corners.smoothCorners,backgroundColor:se.active?"transparent":ne,padding:E}:z?{borderBottomColor:ae?oe:R.colors["border-subtle"],borderBottomWidth:_reactNative.StyleSheet.hairlineWidth}:null,v,p],onLayout:se.onLayout,children:[se.active&&se.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:se.size.width,height:se.size.height,radius:B,fill:ne,stroke:ae?oe:void 0,strokeWidth:de}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:q.row,children:[Q?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[q.thumb,N?L?{top:0,bottom:0}:{top:0,height:k.height-2*E}:M?{top:H,bottom:H,left:H}:{bottom:0,height:A},{width:M?Math.max(Q.width-2*H,0):Q.width,borderRadius:ie,..._corners.smoothCorners,backgroundColor:te,transform:[{translateX:J}]},y]}):null,i.map((e,t)=>{const i=e.value===I,r=i?re:R.colors["text-subtle"],n=(0,_slotIcon.renderSlotIcon)(e.icon,{color:r,size:k.icon,selected:i,disabled:u});return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>ee(e),onLayout:e=>$(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})=>[q.segment,L?q.segmentMultiline:null,{paddingHorizontal:k["padding-x"],opacity:e&&!i?.7:1},f],children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:q.segmentIcon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:n}):null,(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:i?"semibold":"medium",style:[q.segmentLabel,L?q.segmentLabelMultiline:null,{color:r,fontSize:k.text},S,j],numberOfLines:F,children:e.label})]},String(e.value))})]}),!ae||z||se.active?null:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{borderWidth:de,borderColor:oe,borderRadius:N?B:P,..._corners.smoothCorners}]})]});return ce||me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{alignSelf:c?"stretch":"flex-start"},children:[ce?(0,_jsxRuntime.jsx)(_index4.FieldLabel,{size:d,children:r}):null,he,me?(0,_jsxRuntime.jsx)(_index4.FieldMessage,{size:d,text:ue,error:le}):null]}):he});SegmentedControl.displayName="SegmentedControl";const buildStyles=e=>_reactNative.StyleSheet.create({track:{flexDirection:"row",alignItems:"stretch",position:"relative"},row:{flex:1,flexDirection:"row",alignItems:"stretch",position:"relative",overflow:"hidden"},thumb:{position:"absolute",left:0},segment:{flexGrow:1,flexShrink:1,flexBasis:"auto",flexDirection:"row",alignItems:"center",justifyContent:"center"},segmentIcon:{marginRight:e.space.xs},segmentMultiline:{paddingVertical:e.space.xs},segmentLabel:{includeFontPadding:!1},segmentLabelMultiline:{flexShrink:1,textAlign:"center"}});var _default=exports.default=SegmentedControl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Select=exports.DEFAULT_SELECT_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_Chevron=require("../FieldBase/Chevron.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_index3=require("../Text/index.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_SELECT_LABELS=exports.DEFAULT_SELECT_LABELS={placeholder:"Select…",noSelection:"No selection",selected:e=>`Selected: ${e}`,fallbackName:"Select",sheetName:"Options",searchPlaceholder:_OptionSheet.DEFAULT_OPTION_SHEET_LABELS.searchPlaceholder,empty:_OptionSheet.DEFAULT_OPTION_SHEET_LABELS.empty},sameSelectValue=(e,t)=>String(e)===String(t),containsValue=(e,t)=>e.some(e=>sameSelectValue(e,t)),Select=exports.Select=(0,_react.forwardRef)((e,t)=>{(0,_warnInvalidValue.warnInvalidValue)("Select","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("Select","variant",e.variant,["outline","filled","underline"]);const{options:i,getOptionLabel:l,getOptionValue:n,isOptionDisabled:a,getOptionDescription:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Select=exports.DEFAULT_SELECT_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_Chevron=require("../FieldBase/Chevron.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_index3=require("../Text/index.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_SELECT_LABELS=exports.DEFAULT_SELECT_LABELS={placeholder:"Select…",noSelection:"No selection",selected:e=>`Selected: ${e}`,fallbackName:"Select",sheetName:"Options",searchPlaceholder:_OptionSheet.DEFAULT_OPTION_SHEET_LABELS.searchPlaceholder,empty:_OptionSheet.DEFAULT_OPTION_SHEET_LABELS.empty},sameSelectValue=(e,t)=>String(e)===String(t),containsValue=(e,t)=>e.some(e=>sameSelectValue(e,t)),Select=exports.Select=(0,_react.forwardRef)((e,t)=>{(0,_warnInvalidValue.warnInvalidValue)("Select","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("Select","variant",e.variant,["outline","filled","underline"]);const{options:i,getOptionLabel:l,getOptionValue:n,isOptionDisabled:a,getOptionDescription:o,getOptionIcon:r,placeholder:s,onOpenChange:c,searchable:d=!1,haptic:u,labels:x,label:_,help:p,title:h,required:S=!1,error:g,helperText:v,prefix:b,numberOfLines:m=1,disabled:f=!1,size:y="md",variant:j,leftIcon:L,rightIcon:T,chevronColor:F,chevronSize:C,radius:O,accessibilityLabel:I,labelStyle:E,style:V,triggerStyle:B,textStyle:R,optionStyle:k,selectedOptionStyle:A,optionTextStyle:q,selectedOptionTextStyle:z,testID:N}=e,w=!0===e.multi,D=x?{...DEFAULT_SELECT_LABELS,...x}:DEFAULT_SELECT_LABELS,P=(0,_react.useCallback)(e=>l?l(e):e.label??"",[l]),H=(0,_react.useCallback)(e=>n?n(e):e.value,[n]),M=(0,_react.useCallback)(e=>a?a(e):!0===e.disabled,[a]),U=(0,_react.useCallback)(e=>o?o(e):e.description,[o]),$=(0,_react.useCallback)(e=>r?r(e):e.icon,[r]),G=(0,_index.useTheme)(),J=(0,_react.useMemo)(()=>buildStyles(G),[G]),K=(0,_index.resolveFieldSize)(G,y),Q=(0,_FieldBase.resolveFieldTextStyle)(G,{disabled:f}),W=j??G.settings.components.select?.defaultVariant??G.settings.components.field?.defaultVariant??"outline",[X,Y]=(0,_react.useState)(!1),Z=(0,_react.useMemo)(()=>{if(w){const t=e.value??[];return i.filter(e=>containsValue(t,H(e)))}const t=e.value;if(null==t)return[];const l=i.find(e=>sameSelectValue(H(e),t));return l?[l]:[]},[w,i,e.value,H]),ee=(0,_react.useCallback)(()=>{if(f)return;const e=(0,_index2.resolveHaptic)(u,"selection");e&&(0,_index2.triggerHaptic)(e),Y(!0)},[f,u]),te=(0,_react.useCallback)(()=>{Y(!1)},[]),ie=(0,_react.useCallback)(t=>{if(M(t))return;const i=H(t),l=(0,_index2.resolveHaptic)(u,"selection");if(l&&(0,_index2.triggerHaptic)(l),w){const t=e.value??[],l=containsValue(t,i)?t.filter(e=>!sameSelectValue(e,i)):[...t,i];return void e.onChange(l)}e.onChange(i),te()},[w,e,te,M,H,u]),le=0===Z.length?s??D.placeholder:Z.map(e=>P(e)).join(", "),ne=0===Z.length,ae=!0===g||(0,_FieldBase.hasFieldText)(g),oe=(0,_FieldBase.hasFieldText)(_),re=(0,_FieldBase.fieldTextAsString)(_),se=Math.round(1.4*K.text),ce=(0,_react.useMemo)(()=>({fontSize:K.text,color:Q.placeholderColor}),[K.text,Q.placeholderColor]),de={color:f?G.colors["field-icon-disabled"]:X?G.colors["field-icon-focus"]:G.colors["field-icon"],size:K.icon,disabled:f,focused:X,error:ae},ue=0===Z.length?s??D.noSelection:D.selected(Z.map(e=>P(e)).join(", ")),xe=I??`${re??D.fallbackName}. ${ue}`;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[J.container,V],testID:N,children:[oe?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:y,required:S,help:p,style:E,children:_}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,collapsable:!1,children:(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:y,variant:W,disabled:f,error:ae,filled:Z.length>0,onPress:ee,radius:O,paddingHorizontal:"underline"===W?G.space.none:void 0,accessibilityRole:"button",accessibilityLabel:xe,accessibilityState:{disabled:f,expanded:X},"aria-disabled":f,"aria-expanded":X,style:B,slotAlign:1===m?"center":"top",slotLineHeight:1===m?void 0:se,leading:L?(0,_slotIcon.slotIconView)(L,(0,_slotIcon.renderSlotIcon)(L,de)):null,trailing:T?(0,_slotIcon.slotIconView)(T,(0,_slotIcon.renderSlotIcon)(T,de)):(0,_jsxRuntime.jsx)(_Chevron.Chevron,{color:F??(f?G.colors["text-disabled"]:G.colors["text-subtle"]),size:C??K.icon,open:X,style:J.chevron}),children:[(0,_FieldBase.hasFieldText)(b)?"string"==typeof b||"number"==typeof b?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",style:[J.prefix,{color:Q.placeholderColor,fontSize:K.text,lineHeight:1===m?void 0:se,marginRight:G.space.xs}],children:b}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[J.prefixNode,{minHeight:1===m?void 0:se,justifyContent:"center",marginRight:G.space.xs}],children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",style:[J.prefix,{color:Q.placeholderColor,fontSize:K.text,lineHeight:1===m?void 0:se}],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:ce,children:b})})}):null,(0,_jsxRuntime.jsxs)(_index3.Text,{variant:"body",style:[J.triggerText,{color:ne?Q.placeholderColor:Q.color,fontSize:K.text,lineHeight:1===m?void 0:se,...Q.weightStyle},R],numberOfLines:m,children:[le,ne&&S&&!oe?(0,_jsxRuntime.jsx)(_FieldBase.RequiredMark,{}):null]})]})}),(0,_jsxRuntime.jsx)(_FieldBase.FieldMessage,{size:y,error:ae,text:ae?g:v}),(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:X,onClose:te,onOpenChange:c,haptic:u,title:h??re,accessibilityLabel:re??(oe?h:void 0)??s??D.sheetName,options:i,getOptionLabel:P,getOptionValue:H,isOptionDisabled:M,getOptionDescription:U,getOptionIcon:$,value:e.value,onChange:(e,t)=>ie(t),multi:w,searchable:d,labels:{searchPlaceholder:D.searchPlaceholder,empty:D.empty},optionStyle:k,selectedOptionStyle:A,optionTextStyle:q,selectedOptionTextStyle:z,searchSelectionColor:(0,_FieldBase.resolveVariantColors)(G,W).borderFocusedRepresentative})]})});Select.displayName="Select";const buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},label:{includeFontPadding:!1},triggerText:{flex:1,includeFontPadding:!1},errorText:{includeFontPadding:!1},prefix:{flexShrink:0,includeFontPadding:!1},prefixNode:{flexShrink:0},chevron:{marginLeft:e.space.sm}});var _default=exports.default=Select;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.StatTile=exports.DEFAULT_STAT_TILE_LABELS=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_index2=require("../AppIcon/index.js"),_index3=require("../Card/index.js"),_index4=require("../IconBadge/index.js"),_index5=require("../Skeleton/index.js"),_index6=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_STAT_TILE_LABELS=exports.DEFAULT_STAT_TILE_LABELS=Object.freeze({trendUp:"up",trendDown:"down",trendFlat:"no change"}),isText=e=>"string"==typeof e||"number"==typeof e,TREND_ICON={up:"arrow-up",down:"arrow-down",flat:"minus"},TREND_SIGN={up:"+",down:"-",flat:""},percentText=e=>(0,_mobileCore.formatPercent)(Math.abs(e),{scale:"percent",maximumFractionDigits:1}),trendFigure=e=>"number"==typeof e.value?`${TREND_SIGN[e.direction]}${percentText(e.value)}`:e.value,trendSpoken=(e,t)=>{const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.StatTile=exports.DEFAULT_STAT_TILE_LABELS=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_index2=require("../AppIcon/index.js"),_index3=require("../Card/index.js"),_index4=require("../IconBadge/index.js"),_index5=require("../Skeleton/index.js"),_index6=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_STAT_TILE_LABELS=exports.DEFAULT_STAT_TILE_LABELS=Object.freeze({trendUp:"up",trendDown:"down",trendFlat:"no change"}),isText=e=>"string"==typeof e||"number"==typeof e,TREND_ICON={up:"arrow-up",down:"arrow-down",flat:"minus"},TREND_SIGN={up:"+",down:"-",flat:""},percentText=e=>(0,_mobileCore.formatPercent)(Math.abs(e),{scale:"percent",maximumFractionDigits:1}),trendFigure=e=>"number"==typeof e.value?`${TREND_SIGN[e.direction]}${percentText(e.value)}`:e.value,trendSpoken=(e,t)=>{const i=[{up:t.trendUp,down:t.trendDown,flat:t.trendFlat}[e.direction]];return"flat"!==e.direction&&i.push("number"==typeof e.value?percentText(e.value):e.value),e.period&&i.push(e.period),i.join(" ")},StatTile=exports.StatTile=(0,_react.forwardRef)((e,t)=>{const{label:i,value:n,icon:r,iconVariant:a,tone:s="primary",caption:l,trend:o,sparkline:d,onPress:c,loading:x=!1,accessibilityLabel:u,labels:_,style:p,testID:m}=e,j=(0,_index.useTheme)();(0,_warnInvalidValue.warnInvalidValue)("StatTile","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_warnInvalidValue.warnInvalidValue)("StatTile","trend.direction",o?.direction,["up","down","flat"]),(0,_warnInvalidValue.warnInvalidValue)("StatTile","trend.goodWhen",o?.goodWhen,["up","down"]);const T=(0,_react.useMemo)(()=>({...DEFAULT_STAT_TILE_LABELS,..._}),[_]),h=o?`, ${trendSpoken(o,T)}`:"",v=isText(i)?`${i}, `:"",w=u??(isText(n)?`${v}${n}${h}`:void 0),y=!!o&&o.direction===(o.goodWhen??"up"),f=o&&"flat"!==o.direction?y?"success":"danger":"secondary",S="secondary"===f?j.colors["text-muted"]:j.colors[`${f}-text`];return x?(0,_jsxRuntime.jsx)(_index3.Card,{ref:t,variant:"outline",style:p,testID:m,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.row,{columnGap:j.space.md}],children:[void 0===r?null:(0,_jsxRuntime.jsx)(_index5.Skeleton,{shape:"circle",width:40,height:40}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.text,children:[(0,_jsxRuntime.jsx)(_index5.Skeleton,{shape:"text",width:"50%",height:12}),(0,_jsxRuntime.jsx)(_index5.Skeleton,{shape:"text",width:"35%",height:24,style:{marginTop:j.space.xs}})]})]})}):(0,_jsxRuntime.jsx)(_index3.Card,{ref:t,variant:"outline",onPress:c,accessibilityLabel:w,style:p,testID:m,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.row,{columnGap:j.space.md}],children:[void 0===r?null:(0,_jsxRuntime.jsx)(_index4.IconBadge,{icon:r,iconVariant:a,tone:s}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.text,children:[(0,_jsxRuntime.jsx)(_index6.Text,{variant:"caption",color:"secondary",numberOfLines:1,children:i}),isText(n)?(0,_jsxRuntime.jsx)(_index6.Text,{variant:"h3",numberOfLines:1,children:n}):n,o?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.trend,{columnGap:j.space.xxs}],testID:m?`${m}-trend`:void 0,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_jsxRuntime.jsx)(_index2.AppIcon,{name:TREND_ICON[o.direction],size:"xs",color:S})}),(0,_jsxRuntime.jsxs)(_index6.Text,{variant:"caption",color:f,numberOfLines:2,style:styles.text,children:[trendFigure(o),o.period?(0,_jsxRuntime.jsx)(_index6.Text,{variant:"caption",color:"tertiary",children:` ${o.period}`}):null]})]}):null,null==l||""===l?null:isText(l)?(0,_jsxRuntime.jsx)(_index6.Text,{variant:"caption",color:"tertiary",numberOfLines:1,children:l}):l,null==d?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginTop:j.space.sm},children:d})]})]})})});StatTile.displayName="StatTile";const styles=_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},text:{flex:1,minWidth:0},trend:{flexDirection:"row",alignItems:"center"}});var _default=exports.default=StatTile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Swipeable=void 0;var cache,_react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var a,n,i=Object.defineProperty,r={__proto__:null,default:e};if(Object(e)!==e)return r;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,r)}for(n in e)"default"!==n&&{}.hasOwnProperty.call(e,n)&&((a=i&&Object.getOwnPropertyDescriptor(e,n))&&(a.get||a.set)?i(r,n,a):r[n]=e[n]);return r}const SPRING_CONFIG={damping:22,stiffness:260,mass:1},DRAG_ACTIVATION_OFFSET=10,RUBBER_BAND_FACTOR=.35,FAIL_OFFSET_Y=15,ACTION_ICON_SIZE=20,toneToBg=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;default:return e.colors.neutral}},toneToOnColor=(e,t)=>{switch(t){case"primary":return e.colors["on-primary"];case"success":return e.colors["on-success"];case"warning":return e.colors["on-warning"];case"danger":return e.colors["on-danger"];case"info":return e.colors["on-info"];default:return e.colors["on-neutral"]}},Swipeable=e=>{const{children:t,leftActions:a,rightActions:n,threshold:i,fullSwipeThreshold:r,onSwipeOpen:s,onSwipeClose:c,disabled:o=!1,haptic:l,containerStyle:u,contentStyle:d,actionStyle:_,accessibilityLabel:m,testID:v}=e,h=(0,_index.useTheme)(),p=i??80,w=r??200,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Swipeable=void 0;var cache,_react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var a,n,i=Object.defineProperty,r={__proto__:null,default:e};if(Object(e)!==e)return r;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,r)}for(n in e)"default"!==n&&{}.hasOwnProperty.call(e,n)&&((a=i&&Object.getOwnPropertyDescriptor(e,n))&&(a.get||a.set)?i(r,n,a):r[n]=e[n]);return r}const SPRING_CONFIG={damping:22,stiffness:260,mass:1},DRAG_ACTIVATION_OFFSET=10,RUBBER_BAND_FACTOR=.35,FAIL_OFFSET_Y=15,ACTION_ICON_SIZE=20,toneToBg=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;default:return e.colors.neutral}},toneToOnColor=(e,t)=>{switch(t){case"primary":return e.colors["on-primary"];case"success":return e.colors["on-success"];case"warning":return e.colors["on-warning"];case"danger":return e.colors["on-danger"];case"info":return e.colors["on-info"];default:return e.colors["on-neutral"]}},Swipeable=e=>{const{children:t,leftActions:a,rightActions:n,threshold:i,fullSwipeThreshold:r,onSwipeOpen:s,onSwipeClose:c,disabled:o=!1,haptic:l,containerStyle:u,contentStyle:d,actionStyle:_,accessibilityLabel:m,testID:v}=e,h=(0,_index.useTheme)(),p=i??80,w=r??200,b=(0,_react.useMemo)(()=>buildStyles(h),[h]),S=(0,_react.useMemo)(()=>buildActionStyles(h),[h]),f=!!a&&a.length>0,N=!!n&&n.length>0,R=_reactNative.Dimensions.get("window").width,x=f?p*(a?.length??0):0,y=N?p*(n?.length??0):0,g=(0,_reactNativeReanimated.useSharedValue)(0),I=(0,_reactNativeReanimated.useSharedValue)(0),j=(0,_react.useRef)(null);(0,_react.useEffect)(()=>()=>{(0,_reactNativeReanimated.cancelAnimation)(g),(0,_reactNativeReanimated.cancelAnimation)(I)},[g,I]);const O=(0,_react.useCallback)(e=>{j.current!==e&&(j.current=e,s?.(e))},[s]),C=(0,_react.useCallback)(()=>{null!==j.current&&(j.current=null,c?.())},[c]),A=(0,_react.useCallback)(e=>{const t="left"===e?a:n,i=t?.[0];i&&(!1!==l&&(0,_index2.triggerHaptic)("notificationSuccess"),i.onPress(),g.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),j.current=null,c?.())},[a,n,g,c,l]),G=(0,_react.useCallback)(()=>{g.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),C()},[g,C]),P=(0,_react.useCallback)(e=>{const t=(0,_index2.resolveHaptic)(l,"selection");t&&(0,_index2.triggerHaptic)(t),e.onPress(),G()},[G,l]),k=(0,_react.useMemo)(()=>{const e=x,t=y,a=w,n=-w,i=R,r=-R,s=p,c=f,l=N;return _reactNativeGestureHandler.Gesture.Pan().enabled(!o).withTestId(v?`${v}-gesture`:"swipeable-gesture").activeOffsetX([-10,10]).failOffsetY([-15,15]).onStart(()=>{"worklet";I.value=g.value}).onUpdate(a=>{"worklet";const n=I.value+a.translationX;g.value=n>0&&!c||n<0&&!l?0:n>e&&c?e+.35*(n-e):n<-t&&l?.35*(n+t)-t:n}).onEnd(()=>{"worklet";const o=g.value;return c&&o>=a?(g.value=(0,_reactNativeReanimated.withSpring)(i,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(A)("left")):l&&o<=n?(g.value=(0,_reactNativeReanimated.withSpring)(r,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(A)("right")):c&&o>=s?(g.value=(0,_reactNativeReanimated.withSpring)(e,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(O)("left")):l&&o<=-s?(g.value=(0,_reactNativeReanimated.withSpring)(-t,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(O)("right")):(g.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),void(0,_reactNativeReanimated.runOnJS)(C)())})},[o,I,A,w,f,N,x,C,O,y,R,p,g,v]),T=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:g.value}]}),[g]),F=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:x>0?Math.min(1,Math.max(0,g.value/x)):0}),[x,g]),V=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({opacity:y>0?Math.min(1,Math.max(0,-g.value/y)):0}),[y,g]),q=(0,_react.useMemo)(()=>{const e=[];return a?.forEach(t=>{e.push({name:t.key,label:t.label})}),n?.forEach(t=>{e.push({name:t.key,label:t.label})}),e},[a,n]),E=(0,_react.useCallback)(e=>{const t=e.nativeEvent.actionName,i=[...a??[],...n??[]].find(e=>e.key===t);i&&(!1!==l&&(0,_index2.triggerHaptic)("selection"),i.onPress())},[a,n,l]);return f||N?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[b.root,u],testID:v,accessibilityLabel:m,accessibilityActions:q,onAccessibilityAction:E,children:[f?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[b.actionsRow,b.actionsLeft,{width:x},_,F],pointerEvents:"box-none",children:a?.map(e=>(0,_jsxRuntime.jsx)(ActionButton,{action:e,theme:h,actionStyles:S,width:p,onPress:P},e.key))}):null,N?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[b.actionsRow,b.actionsRight,{width:y},_,V],pointerEvents:"box-none",children:n?.map(e=>(0,_jsxRuntime.jsx)(ActionButton,{action:e,theme:h,actionStyles:S,width:p,onPress:P},e.key))}):null,(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:k,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[b.content,d,T],children:t})})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:u,testID:v,children:t})};exports.Swipeable=Swipeable,Swipeable.displayName="Swipeable";const ActionButton=({action:e,theme:t,actionStyles:a,width:n,onPress:i})=>{(0,_warnInvalidValue.warnInvalidValue)("Swipeable","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const r=e.tone??"neutral",s=toneToBg(t,r),c=(0,_slotIcon.renderSlotIcon)(e.icon,{color:toneToOnColor(t,r),size:20,disabled:!1});return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>i(e),accessibilityRole:"button",accessibilityLabel:e.label,style:[a.button,{width:n,backgroundColor:s,paddingHorizontal:t.space.sm}],children:[c?(0,_jsxRuntime.jsx)(_reactNative.View,{style:a.icon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:c}):null,(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",weight:"semibold",style:[a.label,{color:toneToOnColor(t,r)}],numberOfLines:1,children:e.label})]})},buildActionStyles=e=>_reactNative.StyleSheet.create({button:{flexGrow:0,flexShrink:0,alignItems:"center",justifyContent:"center"},icon:{marginBottom:e.space.xxs},label:{textAlign:"center"}}),buildStyles=e=>_reactNative.StyleSheet.create({root:{position:"relative",overflow:"hidden"},content:{backgroundColor:"transparent"},actionsRow:{position:"absolute",top:0,bottom:0,flexDirection:"row"},actionsLeft:{left:0},actionsRight:{right:0,justifyContent:"flex-end"}});var _default=exports.default=Swipeable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Tabs=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Badge/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const Tabs=exports.Tabs=(0,_react.forwardRef)((e,t)=>{const{tabs:i,activeKey:a,onChange:r,variant:n="underline",radius:s,size:l="md",scrollable:o=!1,align:d="left",style:c,tabStyle:u,tabLabelStyle:m,tabIconStyle:b,tabBadgeStyle:p,dividerStyle:_,indicatorStyle:x,progress:g,pages:h,haptic:v,accessibilityLabel:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Tabs=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Badge/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const Tabs=exports.Tabs=(0,_react.forwardRef)((e,t)=>{const{tabs:i,activeKey:a,onChange:r,variant:n="underline",radius:s,size:l="md",scrollable:o=!1,align:d="left",style:c,tabStyle:u,tabLabelStyle:m,tabIconStyle:b,tabBadgeStyle:p,dividerStyle:_,indicatorStyle:x,progress:g,pages:h,haptic:v,accessibilityLabel:y,testID:f}=e;(0,_warnInvalidValue.warnInvalidValue)("Tabs","variant",e.variant,["underline","pills","segmented"]),(0,_warnInvalidValue.warnInvalidValue)("Tabs","size",e.size,["sm","md","lg"]),(0,_warnInvalidValue.warnInvalidValue)("Tabs","align",e.align,["left","center"]);const j=(0,_index.useTheme)(),w=(0,_react.useMemo)(()=>buildStyles(j),[j]),S=j.components.tabs,R=(0,_react.useMemo)(()=>(0,_index.resolveTabsSize)(j,l),[j,l]),I=o?R["scrollable-padding-x"]:R["padding-x"],V=R["padding-y"],k=R.text,N=j.space[S["icon-gap"]],T=R.icon,q=S["underline-height"],z=j.space[S["pill-inset"]],C=S["disabled-opacity"],E=j.space[S["badge-gap"]],F="segmented"===n,L=(0,_react.useMemo)(()=>(0,_index.resolveSegmentedControlSize)(j,l),[j,l]),A=j.space[S["track-padding"]],M="number"==typeof s?s:s?j.radius[s]:void 0,D=M??j.radius.md,H=void 0===M?j.radius.sm:Math.max(M-A,0),B=M??j.radius.pill,P=M??j.radius.none,O=j.colors["bg-muted"],W=(0,_SquircleFill.useSquircle)(F,D),[$,U]=(0,_react.useState)({}),K=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,X=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,[G,J]=(0,_react.useState)(0),Q=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,Y=(0,_react.useRef)(null),Z=(0,_react.useRef)(0),ee=$[a],te=Math.max(0,i.findIndex(e=>e.key===a)),ie=(0,_react.useMemo)(()=>h&&G>0?Q.interpolate({inputRange:[0,G],outputRange:[0,1]}):void 0,[h,G,Q])??g,ae=i.every(e=>void 0!==$[e.key]),re=void 0!==ie&&ae&&i.length>1,ne=(0,_react.useMemo)(()=>re&&ie?ie.interpolate({inputRange:i.map((e,t)=>t),outputRange:i.map(e=>$[e.key].x),extrapolate:"clamp"}):null,[re,ie,i,$]),se=(0,_react.useMemo)(()=>re&&ie?ie.interpolate({inputRange:i.map((e,t)=>t),outputRange:i.map(e=>$[e.key].width),extrapolate:"clamp"}):null,[re,ie,i,$]),le=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(!ee)return;if(re)return;const e=null!==le.current&&le.current!==a;if(le.current=a,!e)return K.setValue(ee.x),void X.setValue(ee.width);const t=j.motion.spring.snappy,i=_reactNative.Animated.parallel([_reactNative.Animated.spring(K,{toValue:ee.x,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:!1}),_reactNative.Animated.spring(X,{toValue:ee.width,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:!1})]);return i.start(),()=>i.stop()},[ee,a,K,X,j.motion.spring.snappy,re]),(0,_react.useEffect)(()=>{h&&0!==G&&Z.current!==te&&(Z.current=te,Y.current?.scrollTo({x:te*G,animated:!0}))},[h,G,te]);const oe=h?.length;(0,_react.useEffect)(()=>{__DEV__&&void 0!==oe&&oe!==i.length&&_mobileCore.Logger.warn(`[@webority/mobile-ui] Tabs pages has ${oe} entries for ${i.length} tabs; each tab needs one page.`)},[oe,i.length]);const de=(0,_react.useCallback)(e=>t=>{const{x:i,width:a}=t.nativeEvent.layout;U(t=>{const r=t[e];return r&&r.x===i&&r.width===a?t:{...t,[e]:{x:i,width:a}}})},[]),ce=(0,_react.useCallback)(e=>{if(e.disabled)return;if(e.key===a)return;const t=(0,_index2.resolveHaptic)(v,"selection");t&&(0,_index2.triggerHaptic)(t),r(e.key)},[a,r,v]),ue="pills"===n,me=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[F?w.indicatorThumb:ue?w.indicatorPill:w.indicatorUnderline,F?null:ue?{top:z,bottom:z}:{height:q},{width:se??X,transform:[{translateX:ne??K}],backgroundColor:F?j.colors.surface:ue?j.colors["primary-soft"]:j.colors.primary,borderRadius:F?H:ue?B:P,..._corners.smoothCorners},x]}),renderTabs=()=>i.map(e=>{const t=e.key===a,i=!0===e.disabled,r=t?j.colors.primary:j.colors["text-subtle"],n=(0,_slotIcon.renderSlotIcon)(e.icon,{color:r,size:T,focused:t,disabled:i});return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>ce(e),onLayout:de(e.key),disabled:i,accessibilityRole:"tab",accessibilityLabel:e.label,accessibilityState:{selected:t,disabled:i},"aria-selected":t,"aria-disabled":i,android_ripple:F?void 0:{color:j.colors["surface-pressed"],borderless:!1},style:({pressed:e})=>[w.tab,o?null:w.tabFlex,F?{paddingHorizontal:L["padding-x"],height:L.height-2*A}:{paddingHorizontal:I,paddingVertical:V},{opacity:i?C:e&&F&&!t?.7:1,backgroundColor:e&&!F?j.colors["surface-pressed"]:"transparent"},u],children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[w.tabIcon,{marginRight:N},b],accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:n}):null,(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:t?"semibold":"medium",color:t?"brand":"tertiary",style:[w.tabLabel,{fontSize:F?L.text:k},m],numberOfLines:1,children:e.label}),void 0!==e.badge&&null!==e.badge?(0,_jsxRuntime.jsx)(_index3.Badge,{value:String(e.badge),tone:"primary",fill:"soft",accessible:!1,style:{marginLeft:E},badgeStyle:[w.tabBadge,p]}):null]},e.key)}),be={flexDirection:"row",alignItems:"stretch",justifyContent:o?"flex-start":"center"===d?"center":"flex-start",position:"relative",overflow:"hidden"},pe=F?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[me,renderTabs()]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[renderTabs(),me]}),xe=(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,style:[w.container,{borderBottomColor:j.colors["border-subtle"],borderBottomWidth:"underline"===n?_reactNative.StyleSheet.hairlineWidth:0},"underline"===n?_:null,F?{padding:A,borderRadius:D,..._corners.smoothCorners,backgroundColor:W.active?"transparent":O}:null,c],onLayout:W.onLayout,accessibilityRole:"tablist",accessibilityLabel:y,testID:f,children:[W.active&&W.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:W.size.width,height:W.size.height,radius:D,fill:O}):null,o?(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:[be],keyboardShouldPersistTaps:"handled",children:pe}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:be,children:pe})]});return h?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:w.root,children:[xe,(0,_jsxRuntime.jsx)(_reactNative.Animated.ScrollView,{ref:Y,horizontal:!0,pagingEnabled:!0,showsHorizontalScrollIndicator:!1,scrollEventThrottle:16,onLayout:e=>J(Math.round(e.nativeEvent.layout.width)),onScroll:_reactNative.Animated.event([{nativeEvent:{contentOffset:{x:Q}}}],{useNativeDriver:!1}),onMomentumScrollEnd:e=>{if(0===G)return;const t=Math.round(e.nativeEvent.contentOffset.x/G),n=i[t];n?.disabled?Y.current?.scrollTo({x:te*G,animated:!0}):(Z.current=t,n&&n.key!==a&&r(n.key))},style:w.pager,testID:f?`${f}-pages`:void 0,children:i.map((e,t)=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:G},accessibilityElementsHidden:t!==te,importantForAccessibility:t===te?"auto":"no-hide-descendants",children:h[t]},e.key))})]}):xe});Tabs.displayName="Tabs";const buildStyles=e=>_reactNative.StyleSheet.create({root:{flex:1},pager:{flex:1},container:{width:"100%",position:"relative"},tab:{flexDirection:"row",alignItems:"center",justifyContent:"center"},tabFlex:{flex:1},tabIcon:{},tabLabel:{includeFontPadding:!1,flexShrink:1},tabBadge:{minWidth:18,minHeight:0},indicatorUnderline:{position:"absolute",left:0,bottom:0},indicatorPill:{position:"absolute",left:0,zIndex:-1},indicatorThumb:{position:"absolute",left:0,top:0,bottom:0}});var _default=exports.default=Tabs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import React from"react";import{AppIcon}from"./AppIcon.js";import{jsx as _jsx}from"react/jsx-runtime";const isIconRef=
|
|
1
|
+
"use strict";import React from"react";import{View}from"react-native";import{AppIcon}from"./AppIcon.js";import{jsx as _jsx}from"react/jsx-runtime";const isIconRef=e=>"object"==typeof e&&null!==e&&!React.isValidElement(e)&&"name"in e&&"string"==typeof e.name;export function renderSlotIcon(e,o,n){return null==e||!1===e?null:"string"==typeof e?_jsx(AppIcon,{name:e,variant:n,size:o.size,color:o.color}):"function"==typeof e?e(o):isIconRef(e)?_jsx(AppIcon,{name:e.name,variant:e.variant??n,size:o.size,color:o.color}):e}export const isDecorativeSlotIcon=e=>"string"==typeof e||isIconRef(e);export function slotIconView(e,o){return isDecorativeSlotIcon(e)?_jsx(View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:o}):_jsx(View,{children:o})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{usePresenceMotion}from"../../hooks/usePresenceMotion.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{hitSlopMarker}from"../../utils/hitSlop.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{IconBadge}from"../IconBadge/index.js";import{Skeleton,SkeletonText}from"../Skeleton/index.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_BANNER_LABELS=Object.freeze({dismiss:"Dismiss banner"});const Banner=forwardRef((e,t)=>{const{title:r,message:o,tone:n="neutral",variant:s="bar",icon:i,actions:a,dismissible:l=!1,onClose:c,haptic:d,open:u=!0,animateMount:m=!0,loading:p=!1,accessibilityRole:g="alert",accessibilityLabel:h,labels:y,style:
|
|
1
|
+
"use strict";import{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{usePresenceMotion}from"../../hooks/usePresenceMotion.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{hitSlopMarker}from"../../utils/hitSlop.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{IconBadge}from"../IconBadge/index.js";import{Skeleton,SkeletonText}from"../Skeleton/index.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_BANNER_LABELS=Object.freeze({dismiss:"Dismiss banner"});const Banner=forwardRef((e,t)=>{const{title:r,message:o,tone:n="neutral",variant:s="bar",icon:i,actions:a,dismissible:l=!1,onClose:c,haptic:d,open:u=!0,animateMount:m=!0,loading:p=!1,accessibilityRole:g="alert",accessibilityLabel:h,labels:y,style:b,containerStyle:x,iconCircleStyle:f,tintBarStyle:w,closeButtonStyle:j,actionButtonStyle:S,testID:B}=e;warnInvalidValue("Banner","tone",e.tone,["primary","success","warning","danger","info","neutral"]),warnInvalidValue("Banner","variant",e.variant,["bar","wash","tint"]),warnInvalidValue("Banner","accessibilityRole",e.accessibilityRole,["alert","summary","none"]);const v=useTheme(),k=usePresenceMotion(),C=useMemo(()=>buildStyles(v),[v]),_=useMemo(()=>tintFor(v,n),[v,n]),I=useMemo(()=>({...DEFAULT_BANNER_LABELS,...y}),[y]),[R,V]=k.range(-20,0),A=useRef(createAnimatedValue(m&&u?R:0)).current,T=useRef(createAnimatedValue(m&&u?0:u?1:0)).current,[L,D]=useState(u),H=useRef(!0);if(useEffect(()=>{if(H.current&&(H.current=!1,!m))return;let e;return u?(D(!0),e=Animated.parallel([Animated.timing(A,{toValue:V,duration:v.motion.duration.default,useNativeDriver:!0}),Animated.timing(T,{toValue:1,duration:k.duration("default"),useNativeDriver:!0})]),e.start()):L&&(e=Animated.parallel([Animated.timing(A,{toValue:R,duration:v.motion.duration.fast,useNativeDriver:!0}),Animated.timing(T,{toValue:0,duration:k.duration("fast"),useNativeDriver:!0})]),e.start(()=>{D(!1)})),()=>e?.stop()},[u]),!L)return null;const E=r??" ",M="string"==typeof o?o??" ":"",N="wash"===s,z="bar"!==s,P="alert"===g?"danger"===n?"assertive":"polite":"none",W=_jsxs(Animated.View,{ref:t,accessibilityRole:g,accessibilityLiveRegion:P,accessibilityLabel:h,testID:B,style:[C.container,{backgroundColor:z?_.soft:v.colors["bg-subtle"],borderRadius:N?v.radius.sm:v.radius.md,...smoothCorners,padding:v.space.md,opacity:T,transform:[{translateY:A}]},x,b],children:[!N&&v.components.banner["tint-bar-width"]>0?_jsx(View,{style:[C.tintBar,{backgroundColor:_.bar},w]}):null,_jsxs(View,{style:[C.row,void 0===r&&C.rowCentred],children:[!1===i?null:i?_jsx(View,{style:C.iconWrap,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:renderSlotIcon(i,{color:_.ink,size:v.text.xl.size,disabled:!1})}):_jsx(IconBadge,{dimension:ICON_CIRCLE_SIZE,color:_.bar,icon:_jsx(Text,{variant:"body",weight:"bold",accessible:!1,style:[C.iconGlyph,{color:_.ink}],children:_.glyph}),style:[C.iconCircle,f]}),_jsxs(View,{style:C.textBlock,children:[r||p?_jsx(Text,{variant:"body",weight:"semibold",numberOfLines:2,style:{lineHeight:20,...N?{color:_.ink}:null},children:E}):null,"string"==typeof o||p?_jsx(Text,{variant:"bodySmall",color:"secondary",style:{lineHeight:18,marginTop:r?v.space.xxs:0},children:M||" "}):_jsx(View,{style:{marginTop:r?v.space.xxs:0},children:o})]}),l?_jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:I.dismiss,onPress:()=>{const e=resolveHaptic(d,"selection");e&&triggerHaptic(e),c?.()},hitSlop:8,...hitSlopMarker(8),style:({pressed:e})=>[C.closeBtn,{backgroundColor:e?v.colors["surface-pressed"]:"transparent"},j],children:_jsx(Text,{variant:"title",weight:"bold",color:"secondary",accessible:!1,style:{lineHeight:17},children:"×"})}):null]}),a&&a.length>0?_jsx(View,{style:C.actionsRow,children:a.map((e,t)=>{warnInvalidValue("Banner","action.tone",e.tone,["primary","success","warning","danger","info","neutral"]),warnInvalidValue("Banner","action.variant",e.variant,["solid","outline","ghost"]),warnInvalidValue("Banner","action.size",e.size,["sm","md"]);const r=e.tone??"primary",o=e.variant??"ghost",n="primary"===r?_.glyphColor:"neutral"===r?v.colors["text-muted"]:v.colors[r],s="primary"===r?_.ink:"neutral"===r?v.colors["text-muted"]:v.colors[`${r}-text`],i="primary"===r?_.on:"neutral"===r?v.colors["on-neutral-strong"]:v.colors[`on-${r}`],a="solid"===o;return _jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,testID:e.testID,onPress:()=>{const t=resolveHaptic(d,"selection");t&&triggerHaptic(t),e.onPress()},style:({pressed:t})=>[C.actionBtn,"md"===e.size&&C.actionBtnMd,"outline"===o&&{borderWidth:1,borderColor:s},{backgroundColor:a?n:t?v.colors["surface-pressed"]:"transparent",opacity:a&&t?.85:1},S],children:_jsx(Text,{variant:"bodySmall",weight:"semibold",align:"center",style:{color:a?i:s},children:e.label})},`${e.label}-${t}`)})}):null]});return p?_jsx(BannerSkeleton,{...e}):W});Banner.displayName="Banner";const BannerSkeleton=({title:e,actions:t,icon:r,containerStyle:o,style:n})=>{const s=useTheme(),i=!1!==r;return _jsxs(View,{style:[{flexDirection:"row",alignItems:"flex-start",backgroundColor:s.colors.surface,borderRadius:s.radius.md,...smoothCorners,padding:s.space.md,borderWidth:1,borderColor:s.colors.border},o,n],accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[i?_jsx(View,{style:{marginRight:s.space.sm},children:_jsx(Skeleton,{shape:"circle",width:32,height:32})}):null,_jsxs(View,{style:{flex:1},children:[void 0!==e?_jsx(Skeleton,{shape:"text",width:"55%",height:16,style:{marginBottom:s.space.xs}}):null,_jsx(SkeletonText,{lines:2,fontSize:s.text.sm.size,lastLineWidth:"70%"}),t&&t.length>0?_jsx(View,{style:{flexDirection:"row",marginTop:s.space.sm},children:t.map((e,t)=>_jsx(Skeleton,{width:72,height:28,shape:"rounded",style:{marginRight:s.space.sm}},`sk-banner-action-${t}`))}):null]})]})};BannerSkeleton.displayName="BannerSkeleton",Banner.Skeleton=BannerSkeleton;const tintFor=(e,t)=>{switch(t){case"success":return{soft:e.colors["success-soft"],bar:e.colors.success,glyphColor:e.colors.success,ink:e.colors["success-text"],on:e.colors["on-success"],glyph:"✓"};case"warning":return{soft:e.colors["warning-soft"],bar:e.colors.warning,glyphColor:e.colors.warning,ink:e.colors["warning-text"],on:e.colors["on-warning"],glyph:"⚠"};case"danger":return{soft:e.colors["danger-soft"],bar:e.colors.danger,glyphColor:e.colors.danger,ink:e.colors["danger-text"],on:e.colors["on-danger"],glyph:"✗"};case"neutral":return{soft:e.colors["bg-subtle"],bar:e.colors["text-subtle"],glyphColor:e.colors["text-muted"],ink:e.colors["text-muted"],on:e.colors["on-neutral-strong"],glyph:"i"};case"primary":return{soft:e.colors["primary-soft"],bar:e.colors.primary,glyphColor:e.colors.primary,ink:e.colors["primary-text"],on:e.colors["on-primary"],glyph:"i"};case"info":return{soft:e.colors["info-soft"],bar:e.colors.info,glyphColor:e.colors.info,ink:e.colors["info-text"],on:e.colors["on-info"],glyph:"i"};default:return tintFor(e,"neutral")}},ICON_CIRCLE_SIZE=28,buildStyles=e=>{const t=e.components.banner,r=e.space.sm;return StyleSheet.create({container:{overflow:"hidden",paddingLeft:e.space.md},tintBar:{position:"absolute",left:0,top:0,bottom:0,width:t["tint-bar-width"]},row:{flexDirection:"row",alignItems:"flex-start"},rowCentred:{alignItems:"center"},iconWrap:{marginRight:r},iconCircle:{marginRight:r},iconGlyph:{lineHeight:17},textBlock:{flex:1,paddingRight:e.space.xs},closeBtn:{width:28,height:28,borderRadius:e.radius.pill,...smoothCorners,alignItems:"center",justifyContent:"center",marginLeft:e.space.xxs},actionsRow:{flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-end",marginTop:e.space.xs,columnGap:e.space.xs,rowGap:e.space.xs},actionBtn:{paddingHorizontal:e.space.sm,paddingVertical:e.space.xs,borderRadius:e.radius.sm,...smoothCorners,maxWidth:"100%",alignItems:"center",justifyContent:"center"},actionBtnMd:{minHeight:44,paddingHorizontal:e.space.md}})};export{Banner};export default Banner;
|