@webority/mobile-ui 0.7.4 → 0.8.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.
Files changed (47) hide show
  1. package/lib/commonjs/components/AppIcon/defaultIcons.js +1 -1
  2. package/lib/commonjs/components/FieldBase/FieldBase.js +1 -1
  3. package/lib/commonjs/components/Input/Input.js +1 -1
  4. package/lib/commonjs/components/Notation/Notation.js +1 -1
  5. package/lib/commonjs/components/NumberInput/NumberInput.js +1 -1
  6. package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
  7. package/lib/commonjs/components/OptionSheet/OptionSheet.js +1 -1
  8. package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +1 -1
  9. package/lib/commonjs/components/Select/Select.js +1 -1
  10. package/lib/commonjs/components/SliderField/SliderField.js +1 -1
  11. package/lib/commonjs/components/SquircleFill/SquircleFill.js +1 -1
  12. package/lib/commonjs/theme/tokens.js +1 -1
  13. package/lib/module/components/AppIcon/defaultIcons.js +1 -1
  14. package/lib/module/components/FieldBase/FieldBase.js +1 -1
  15. package/lib/module/components/Input/Input.js +1 -1
  16. package/lib/module/components/Notation/Notation.js +1 -1
  17. package/lib/module/components/NumberInput/NumberInput.js +1 -1
  18. package/lib/module/components/OTPInput/OTPInput.js +1 -1
  19. package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
  20. package/lib/module/components/PickerTrigger/PickerTrigger.js +1 -1
  21. package/lib/module/components/Select/Select.js +1 -1
  22. package/lib/module/components/SliderField/SliderField.js +1 -1
  23. package/lib/module/components/SquircleFill/SquircleFill.js +1 -1
  24. package/lib/module/theme/tokens.js +1 -1
  25. package/lib/typescript/commonjs/components/AppIcon/defaultIcons.d.ts +3 -3
  26. package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +1 -1
  27. package/lib/typescript/commonjs/components/Input/Input.d.ts +5 -2
  28. package/lib/typescript/commonjs/components/Notation/Notation.d.ts +14 -3
  29. package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +4 -1
  30. package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +6 -1
  31. package/lib/typescript/commonjs/components/OptionSheet/OptionSheet.d.ts +7 -6
  32. package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +5 -2
  33. package/lib/typescript/commonjs/components/Select/Select.d.ts +5 -2
  34. package/lib/typescript/commonjs/components/SliderField/SliderField.d.ts +4 -1
  35. package/lib/typescript/commonjs/theme/types.d.ts +23 -0
  36. package/lib/typescript/module/components/AppIcon/defaultIcons.d.ts +3 -3
  37. package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +1 -1
  38. package/lib/typescript/module/components/Input/Input.d.ts +5 -2
  39. package/lib/typescript/module/components/Notation/Notation.d.ts +14 -3
  40. package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +4 -1
  41. package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +6 -1
  42. package/lib/typescript/module/components/OptionSheet/OptionSheet.d.ts +7 -6
  43. package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +5 -2
  44. package/lib/typescript/module/components/Select/Select.d.ts +5 -2
  45. package/lib/typescript/module/components/SliderField/SliderField.d.ts +4 -1
  46. package/lib/typescript/module/theme/types.d.ts +23 -0
  47. package/package.json +12 -13
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultIcons=void 0;var _AppIcon=require("./AppIcon.js"),_jsxRuntime=require("react/jsx-runtime");const defaultIcons=exports.defaultIcons={search:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"search",size:e,color:o}),close:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"x",size:e,color:o}),eye:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"eye",size:e,color:o}),eyeOff:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"eye-off",size:e,color:o}),attachment:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"file-plus-2",size:e,color:o}),error:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"alert-circle",size:e,color:o}),chevronDown:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-down",size:e,color:o}),chevronRight:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-right",size:e,color:o})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultIcons=void 0;var _AppIcon=require("./AppIcon.js"),_jsxRuntime=require("react/jsx-runtime");const defaultIcons=exports.defaultIcons={search:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"search",size:e,color:o}),close:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"x",size:e,color:o}),eye:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"eye",size:e,color:o}),eyeOff:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"eye-off",size:e,color:o}),attachment:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"file-plus-2",size:e,color:o}),error:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"alert-circle",size:e,color:o}),chevronDown:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-down",size:e,color:o}),chevronRight:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-right",size:e,color:o}),selectedTick:({size:e,color:o})=>(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"tick-circle",variant:"bulk",size:e,color:o})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveVariantColors=exports.resolveFieldTextStyle=exports.resolveFieldSize=exports.pickRepresentativeBorderColor=exports.hasFieldText=exports.fieldTextAsString=exports.default=exports.RequiredPlaceholder=exports.RequiredMark=exports.FieldMessage=exports.FieldLabel=exports.FieldErrorGlyph=exports.FieldBase=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,l,n={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return n;if(i=t?o:r){if(i.has(e))return i.get(e);i.set(e,n)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((l=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(l.get||l.set)?i(n,t,l):n[t]=e[t]);return n})(e,t)}const expandColorSides=e=>"string"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??"transparent",right:e.right??"transparent",bottom:e.bottom??"transparent",left:e.left??"transparent"},expandWidthSides=e=>"number"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0},pickRepresentativeBorderColor=e=>{for(const t of["bottom","top","left","right"]){const r=e[t];if(r&&"transparent"!==r)return r}return e.bottom};exports.pickRepresentativeBorderColor=pickRepresentativeBorderColor;const resolveFieldTextStyle=(e,t={})=>{const{disabled:r=!1}=t,o=e.components.field,i=e.colors.field;return{color:r?o?.disabledTextColor??i.textDisabled:o?.textColor??i.text,placeholderColor:o?.placeholderColor??(r?i.placeholderDisabled:i.placeholder),weightStyle:o?.fontWeight?{fontWeight:o.fontWeight}:(0,_index.fontFor)(e,"normal")}};exports.resolveFieldTextStyle=resolveFieldTextStyle;const RequiredMark=()=>{const e=(0,_index.useTheme)(),t=e.components.field;return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:t?.requiredMarkerColor??e.colors.error},children:` ${t?.requiredMarker??"*"}`})};exports.RequiredMark=RequiredMark;const RequiredPlaceholder=({text:e,color:t,fontSize:r,weightStyle:o,align:i="center",paddingTop:l,textAlign:n})=>(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{justifyContent:"top"===i?"flex-start":"center",paddingTop:l}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{accessible:!1,numberOfLines:1,style:{color:t,fontSize:r,...o,includeFontPadding:!1,textAlign:n},children:[e,(0,_jsxRuntime.jsx)(RequiredMark,{})]})});exports.RequiredPlaceholder=RequiredPlaceholder;const FieldErrorGlyph=({size:e,color:t})=>{const r=(0,_index.useTheme)(),o=r.icons?.error??_defaultIcons.defaultIcons.error;return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:o({size:e,color:t})})};exports.FieldErrorGlyph=FieldErrorGlyph;const hasFieldText=e=>null!=e&&!1!==e&&!0!==e&&""!==e;exports.hasFieldText=hasFieldText;const fieldTextAsString=e=>"string"==typeof e?e:void 0;exports.fieldTextAsString=fieldTextAsString;const FieldLabel=({children:e,size:t="md",required:r=!1,help:o,color:i,style:l})=>{const n=(0,_index.useTheme)(),s=resolveFieldSize(n,t),a=hasFieldText(o),d=(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[familyStyles.label,{color:i??n.colors.field.label,fontSize:s.labelFontSize,...(0,_index.fontFor)(n,"semibold"),marginBottom:a?0:s.labelGap},a?familyStyles.labelShrink:null,l],children:[e,r?(0,_jsxRuntime.jsx)(RequiredMark,{}):null]});return a?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[familyStyles.labelRow,{marginBottom:s.labelGap}],children:[d,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[familyStyles.help,{marginLeft:n.spacing.xs}],children:o})]}):d};exports.FieldLabel=FieldLabel;const FieldMessage=({text:e,error:t=!1,size:r="md",style:o})=>{const i=(0,_index.useTheme)(),l=resolveFieldSize(i,r);if(!hasFieldText(e))return null;const n=t?i.colors.field.message:i.colors.text.secondary;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[familyStyles.messageRow,{marginTop:l.messageGap,columnGap:i.spacing.xs+2}],accessibilityLiveRegion:t?"polite":"none",children:[t?(0,_jsxRuntime.jsx)(FieldErrorGlyph,{size:l.messageFontSize,color:n}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[familyStyles.messageText,{color:n,fontSize:l.messageFontSize,...(0,_index.fontFor)(i,"normal")},o],children:e})]})};exports.FieldMessage=FieldMessage;const familyStyles=_reactNative.StyleSheet.create({label:{includeFontPadding:!1},labelShrink:{flexShrink:1},labelRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0,alignItems:"center",justifyContent:"center"},messageRow:{flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1}}),resolveFieldSize=(e,t)=>{const r=e.components.field?.[t],o=DEFAULT_SIZES[t];return{paddingHorizontal:r?.paddingHorizontal??o.paddingHorizontal,paddingVertical:r?.paddingVertical??o.paddingVertical,minHeight:r?.minHeight??o.minHeight,fontSize:r?.fontSize??o.fontSize,borderRadius:r?.borderRadius??o.borderRadius,iconSize:r?.iconSize??o.iconSize,labelFontSize:r?.labelFontSize??o.labelFontSize,labelGap:r?.labelGap??o.labelGap,messageFontSize:r?.messageFontSize??o.messageFontSize,messageGap:r?.messageGap??o.messageGap}};exports.resolveFieldSize=resolveFieldSize;const DEFAULT_SIZES={sm:{paddingHorizontal:12,paddingVertical:10,minHeight:38,fontSize:13,borderRadius:10,iconSize:14,labelFontSize:11,labelGap:4,messageFontSize:11,messageGap:2},md:{paddingHorizontal:14,paddingVertical:13,minHeight:44,fontSize:14,borderRadius:10,iconSize:16,labelFontSize:12,labelGap:4,messageFontSize:12,messageGap:2},lg:{paddingHorizontal:16,paddingVertical:15,minHeight:52,fontSize:16,borderRadius:10,iconSize:18,labelFontSize:13,labelGap:4,messageFontSize:13,messageGap:2}},resolveVariantColors=(e,t,r)=>{const o=e.components.field?.[t],i=e.colors.field;let l,n,s,a,d;"outlined"===t?(l=i.background,n=i.backgroundFocused,s=i.backgroundDisabled,a=i.border,d=e.colors.border.width):"underline"===t?(l="transparent",n=void 0,s="transparent",a={bottom:i.border},d={bottom:e.colors.border.width}):(l=i.background,n=void 0,s=i.backgroundDisabled,a="transparent",d=0);const wrapToIdleShape=e=>"string"==typeof a?e:{bottom:e},c=expandColorSides(r?.borderIdle??o?.borderIdle??a),u=expandColorSides(r?.borderFocused??o?.borderFocused??wrapToIdleShape(i.borderFocused)),b=expandColorSides(r?.borderError??o?.borderError??wrapToIdleShape(i.borderError)),p=expandColorSides(r?.borderDisabled??o?.borderDisabled??a),g=expandWidthSides(r?.borderWidth??o?.borderWidth??d);return{backgroundIdleEmpty:r?.backgroundIdleEmpty??o?.backgroundIdleEmpty??l,backgroundIdleFilled:r?.backgroundIdleFilled??o?.backgroundIdleFilled??r?.backgroundIdleEmpty??o?.backgroundIdleEmpty??l,backgroundFocused:r?.backgroundFocused??o?.backgroundFocused??n,backgroundError:r?.backgroundError??o?.backgroundError??void 0,backgroundDisabled:r?.backgroundDisabled??o?.backgroundDisabled??s,borderIdle:c,borderFocused:u,borderError:b,borderDisabled:p,borderWidth:g,borderFocusedRepresentative:pickRepresentativeBorderColor(u)}};exports.resolveVariantColors=resolveVariantColors;const FieldBase=e=>{const{size:t="md",variant:r,focused:o=!1,disabled:i=!1,error:l=!1,filled:n=!1,leading:s,leadingDivider:a=!1,trailing:d,slotAlign:c="center",slotLineHeight:u,topNotch:b,children:p,onPress:g,pressFeedback:m=!0,minHeight:h,maxHeight:x,width:f,height:S,paddingHorizontal:y,paddingLeft:_,paddingRight:R,paddingVertical:F,borderRadius:v,borderTopLeftRadius:z,borderTopRightRadius:j,borderBottomLeftRadius:k,borderBottomRightRadius:C,borderWidth:T,borderTopWidth:w,borderRightWidth:I,borderBottomWidth:q,borderLeftWidth:E,gap:V,fillOverrides:L,style:W,testID:H,accessibilityRole:D,accessibilityLabel:N,accessibilityState:B,accessibilityHint:M}=e,G=(0,_index.useTheme)(),P=(0,_react.useMemo)(()=>buildStyles(),[]),A=r??G.components.field?.defaultVariant??"outlined",O=resolveFieldSize(G,t),U=(0,_react.useMemo)(()=>resolveVariantColors(G,A,L),[G,A,L]),Z=l?2:o?1:0,$=(0,_react.useRef)((0,_index.createAnimatedValue)(Z)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing($,{toValue:Z,duration:G.motion.duration.fast,easing:_reactNative.Easing.bezier(...G.motion.easing.standard),useNativeDriver:!1});return e.start(),()=>e.stop()},[Z,$,G.motion.duration.fast,G.motion.easing.standard]);const J=[0,1,2],K=n?U.backgroundIdleFilled:U.backgroundIdleEmpty,Q=U.backgroundFocused??K,X=U.backgroundError??K,Y=i?U.backgroundDisabled:$.interpolate({inputRange:J,outputRange:[K,Q,X]}),ee=U.borderIdle,te=U.borderFocused,re=U.borderError,oe={top:w,right:I,bottom:q,left:E},ie={top:oe.top??T??U.borderWidth.top,right:oe.right??T??U.borderWidth.right,bottom:oe.bottom??T??U.borderWidth.bottom,left:oe.left??T??U.borderWidth.left},le={minHeight:S??h??O.minHeight,maxHeight:x,paddingHorizontal:y??O.paddingHorizontal,paddingVertical:F??O.paddingVertical,paddingLeft:_??y??O.paddingHorizontal,paddingRight:R??y??O.paddingHorizontal,backgroundColor:Y,columnGap:V??G.spacing.md,alignItems:"top"===c?"flex-start":"center"},ne="underline"===A,se=ne?0:v??O.borderRadius,ae=ne?{tl:0,tr:0,bl:0,br:0}:{tl:z??se,tr:j??se,bl:k??se,br:C??se};le.borderTopLeftRadius=ae.tl,le.borderTopRightRadius=ae.tr,le.borderBottomLeftRadius=ae.bl,le.borderBottomRightRadius=ae.br,le.borderCurve=_corners.smoothCorners.borderCurve,le.borderTopWidth=ie.top,le.borderRightWidth=ie.right,le.borderBottomWidth=ie.bottom,le.borderLeftWidth=ie.left;const sideColor=e=>$.interpolate({inputRange:J,outputRange:[ee[e],te[e],re[e]]}),sameOnEverySide=e=>e.top===e.right&&e.top===e.bottom&&e.top===e.left,de=!ne&&ae.tl===ae.tr&&ae.tl===ae.bl&&ae.tl===ae.br&&sameOnEverySide(ie)&&sameOnEverySide(ee)&&sameOnEverySide(te)&&sameOnEverySide(re)&&sameOnEverySide(U.borderDisabled),ce=(0,_SquircleFill.useSquircle)(de,ae.tl);if(ce.active)le.backgroundColor="transparent",le.borderTopColor="transparent",le.borderRightColor="transparent",le.borderBottomColor="transparent",le.borderLeftColor="transparent";else if(i){const e=U.borderDisabled;le.borderTopColor=e.top,le.borderRightColor=e.right,le.borderBottomColor=e.bottom,le.borderLeftColor=e.left}else le.borderTopColor=sideColor("top"),le.borderRightColor=sideColor("right"),le.borderBottomColor=sideColor("bottom"),le.borderLeftColor=sideColor("left");const ue=i?U.borderDisabled.top:sideColor("top"),be=(0,_react.useRef)(Z);be.current=Z,(0,_react.useEffect)(()=>{$.setValue(be.current)},[U,$]),void 0!==f&&(le.width=f),void 0!==S&&(le.height=S);const pe={disabled:i,...B},ge="top"===c,me=ge?{alignSelf:"flex-start",marginTop:Math.max(0,((u??O.iconSize)-O.iconSize)/2)}:null,he=S??h??O.minHeight,xe=(()=>{if(!b)return 0;const e=Math.min(ae.tl,he/2),t=b.left;return e<=0||t>=e?0:Math.ceil(e-Math.sqrt(e*e-(e-t)*(e-t)))})(),fe=b&&ie.top>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:{position:"absolute",top:-ie.top,left:b.left-ie.left,width:b.width,height:ie.top+xe,backgroundColor:Y}}):null,renderInner=e=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[ce.active&&ce.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ce.size.width,height:ce.size.height,radius:ae.tl,fill:e&&!i?G.colors.surface.pressed:Y,stroke:ue,strokeWidth:ie.top,outset:ie.top}):null,fe,null!=s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[P.slot,me],children:s}):null,null!=s&&a?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[P.divider,me,{height:O.iconSize,backgroundColor:G.colors.field.border}]}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[P.content,ge?P.contentTop:null],children:p}),null!=d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[P.slot,me],children:d}):null]}),Se=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{onLayout:ce.onLayout,style:[P.box,le,W],accessibilityRole:D,accessibilityLabel:N,accessibilityHint:M,accessibilityState:pe,testID:H,children:renderInner(!1)});return g&&!m?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:g,disabled:i,accessible:!1,children:Se}):g?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:g,disabled:i,accessibilityRole:D??"button",accessibilityLabel:N,accessibilityHint:M,accessibilityState:pe,testID:H,children:({pressed:e})=>(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{onLayout:ce.onLayout,style:[P.box,le,!e||i||ce.active?null:{backgroundColor:G.colors.surface.pressed},W],children:renderInner(e)})}):Se};exports.FieldBase=FieldBase,FieldBase.displayName="FieldBase";const buildStyles=()=>_reactNative.StyleSheet.create({box:{flexDirection:"row",alignItems:"center",overflow:"visible"},slot:{alignItems:"center",justifyContent:"center"},divider:{width:1,alignSelf:"center"},content:{flex:1,flexDirection:"row",alignItems:"center"},contentTop:{alignItems:"flex-start"}});var _default=exports.default=FieldBase;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveVariantColors=exports.resolveFieldTextStyle=exports.resolveFieldSize=exports.pickRepresentativeBorderColor=exports.hasFieldText=exports.fieldTextAsString=exports.default=exports.RequiredPlaceholder=exports.RequiredMark=exports.FieldMessage=exports.FieldLabel=exports.FieldErrorGlyph=exports.FieldBase=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_Notation=require("../Notation/Notation.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_jsxRuntime=require("react/jsx-runtime");const expandColorSides=e=>"string"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??"transparent",right:e.right??"transparent",bottom:e.bottom??"transparent",left:e.left??"transparent"},expandWidthSides=e=>"number"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0},pickRepresentativeBorderColor=e=>{for(const t of["bottom","top","left","right"]){const r=e[t];if(r&&"transparent"!==r)return r}return e.bottom};exports.pickRepresentativeBorderColor=pickRepresentativeBorderColor;const resolveFieldTextStyle=(e,t={})=>{const{disabled:r=!1}=t,o=e.components.field,i=e.colors.field;return{color:r?o?.disabledTextColor??i.textDisabled:o?.textColor??i.text,placeholderColor:o?.placeholderColor??(r?i.placeholderDisabled:i.placeholder),weightStyle:o?.fontWeight?{fontWeight:o.fontWeight}:(0,_index.fontFor)(e,"normal")}};exports.resolveFieldTextStyle=resolveFieldTextStyle;const RequiredMark=()=>{const e=(0,_index.useTheme)(),t=e.components.field;return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:t?.requiredMarkerColor??e.colors.error},children:` ${t?.requiredMarker??"*"}`})};exports.RequiredMark=RequiredMark;const RequiredPlaceholder=({text:e,color:t,fontSize:r,weightStyle:o,align:i="center",paddingTop:l,textAlign:s})=>(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{justifyContent:"top"===i?"flex-start":"center",paddingTop:l}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{accessible:!1,numberOfLines:1,style:{color:t,fontSize:r,...o,includeFontPadding:!1,textAlign:s},children:[e,(0,_jsxRuntime.jsx)(RequiredMark,{})]})});exports.RequiredPlaceholder=RequiredPlaceholder;const FieldErrorGlyph=({size:e,color:t})=>{const r=(0,_index.useTheme)(),o=r.icons?.error??_defaultIcons.defaultIcons.error;return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:o({size:e,color:t})})};exports.FieldErrorGlyph=FieldErrorGlyph;const hasFieldText=e=>null!=e&&!1!==e&&!0!==e&&""!==e;exports.hasFieldText=hasFieldText;const fieldTextAsString=e=>"string"==typeof e?e:void 0;exports.fieldTextAsString=fieldTextAsString;const FieldLabel=({children:e,size:t="md",required:r=!1,help:o,color:i,style:l})=>{const s=(0,_index.useTheme)(),n=resolveFieldSize(s,t),a=hasFieldText(o),d=_reactNative.StyleSheet.flatten(l),c=d?.fontSize??n.labelFontSize,u=d?.color??i??s.colors.field.label,b=(0,_react.useMemo)(()=>({fontSize:c,color:u}),[c,u]),p=(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[familyStyles.label,{color:i??s.colors.field.label,fontSize:n.labelFontSize,...(0,_index.fontFor)(s,"semibold"),marginBottom:a?0:n.labelGap},a?familyStyles.labelShrink:null,l],children:[(0,_jsxRuntime.jsx)(_Notation.NotationInkContext.Provider,{value:b,children:e}),r?(0,_jsxRuntime.jsx)(RequiredMark,{}):null]});return a?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[familyStyles.labelRow,{marginBottom:n.labelGap}],children:[p,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[familyStyles.help,{marginLeft:s.spacing.xs}],children:o})]}):p};exports.FieldLabel=FieldLabel;const FieldMessage=({text:e,error:t=!1,size:r="md",style:o})=>{const i=(0,_index.useTheme)(),l=resolveFieldSize(i,r);if(!hasFieldText(e))return null;const s=t?i.colors.field.message:i.colors.text.secondary;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[familyStyles.messageRow,{marginTop:l.messageGap,columnGap:i.spacing.xs+2}],accessibilityLiveRegion:t?"polite":"none",children:[t?(0,_jsxRuntime.jsx)(FieldErrorGlyph,{size:l.messageFontSize,color:s}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[familyStyles.messageText,{color:s,fontSize:l.messageFontSize,...(0,_index.fontFor)(i,"normal")},o],children:e})]})};exports.FieldMessage=FieldMessage;const familyStyles=_reactNative.StyleSheet.create({label:{includeFontPadding:!1},labelShrink:{flexShrink:1},labelRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0,alignItems:"center",justifyContent:"center"},messageRow:{flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1}}),resolveFieldSize=(e,t)=>{const r=e.components.field?.[t],o=DEFAULT_SIZES[t];return{paddingHorizontal:r?.paddingHorizontal??o.paddingHorizontal,paddingVertical:r?.paddingVertical??o.paddingVertical,minHeight:r?.minHeight??o.minHeight,fontSize:r?.fontSize??o.fontSize,borderRadius:r?.borderRadius??o.borderRadius,iconSize:r?.iconSize??o.iconSize,labelFontSize:r?.labelFontSize??o.labelFontSize,labelGap:r?.labelGap??o.labelGap,messageFontSize:r?.messageFontSize??o.messageFontSize,messageGap:r?.messageGap??o.messageGap}};exports.resolveFieldSize=resolveFieldSize;const DEFAULT_SIZES={sm:{paddingHorizontal:12,paddingVertical:10,minHeight:38,fontSize:13,borderRadius:10,iconSize:14,labelFontSize:11,labelGap:4,messageFontSize:11,messageGap:2},md:{paddingHorizontal:14,paddingVertical:13,minHeight:44,fontSize:14,borderRadius:10,iconSize:16,labelFontSize:12,labelGap:4,messageFontSize:12,messageGap:2},lg:{paddingHorizontal:16,paddingVertical:15,minHeight:52,fontSize:16,borderRadius:10,iconSize:18,labelFontSize:13,labelGap:4,messageFontSize:13,messageGap:2}},resolveVariantColors=(e,t,r)=>{const o=e.components.field?.[t],i=e.colors.field;let l,s,n,a,d;"outlined"===t?(l=i.background,s=i.backgroundFocused,n=i.backgroundDisabled,a=i.border,d=e.colors.border.width):"underline"===t?(l="transparent",s=void 0,n="transparent",a={bottom:i.border},d={bottom:e.colors.border.width}):(l=i.background,s=void 0,n=i.backgroundDisabled,a="transparent",d=0);const wrapToIdleShape=e=>"string"==typeof a?e:{bottom:e},c=expandColorSides(r?.borderIdle??o?.borderIdle??a),u=expandColorSides(r?.borderFocused??o?.borderFocused??wrapToIdleShape(i.borderFocused)),b=expandColorSides(r?.borderError??o?.borderError??wrapToIdleShape(i.borderError)),p=expandColorSides(r?.borderDisabled??o?.borderDisabled??a),g=expandWidthSides(r?.borderWidth??o?.borderWidth??d);return{backgroundIdleEmpty:r?.backgroundIdleEmpty??o?.backgroundIdleEmpty??l,backgroundIdleFilled:r?.backgroundIdleFilled??o?.backgroundIdleFilled??r?.backgroundIdleEmpty??o?.backgroundIdleEmpty??l,backgroundFocused:r?.backgroundFocused??o?.backgroundFocused??s,backgroundError:r?.backgroundError??o?.backgroundError??void 0,backgroundDisabled:r?.backgroundDisabled??o?.backgroundDisabled??n,borderIdle:c,borderFocused:u,borderError:b,borderDisabled:p,borderWidth:g,borderFocusedRepresentative:pickRepresentativeBorderColor(u)}};exports.resolveVariantColors=resolveVariantColors;const FieldBase=e=>{const{size:t="md",variant:r,focused:o=!1,disabled:i=!1,error:l=!1,filled:s=!1,leading:n,leadingDivider:a=!1,trailing:d,slotAlign:c="center",slotLineHeight:u,topNotch:b,children:p,onPress:g,pressFeedback:m=!0,minHeight:h,maxHeight:x,width:f,height:S,paddingHorizontal:F,paddingLeft:R,paddingRight:_,paddingVertical:y,borderRadius:v,borderTopLeftRadius:z,borderTopRightRadius:j,borderBottomLeftRadius:k,borderBottomRightRadius:C,borderWidth:T,borderTopWidth:I,borderRightWidth:N,borderBottomWidth:w,borderLeftWidth:E,gap:q,fillOverrides:V,style:L,testID:H,accessibilityRole:D,accessibilityLabel:B,accessibilityState:G,accessibilityHint:W}=e,M=(0,_index.useTheme)(),A=(0,_react.useMemo)(()=>buildStyles(),[]),P=r??M.components.field?.defaultVariant??"outlined",O=resolveFieldSize(M,t),U=(0,_react.useMemo)(()=>resolveVariantColors(M,P,V),[M,P,V]),Z=l?2:o?1:0,$=(0,_react.useRef)((0,_index.createAnimatedValue)(Z)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing($,{toValue:Z,duration:M.motion.duration.fast,easing:_reactNative.Easing.bezier(...M.motion.easing.standard),useNativeDriver:!1});return e.start(),()=>e.stop()},[Z,$,M.motion.duration.fast,M.motion.easing.standard]);const J=[0,1,2],K=s?U.backgroundIdleFilled:U.backgroundIdleEmpty,Q=U.backgroundFocused??K,X=U.backgroundError??K,Y=i?U.backgroundDisabled:$.interpolate({inputRange:J,outputRange:[K,Q,X]}),ee=U.borderIdle,te=U.borderFocused,re=U.borderError,oe={top:I,right:N,bottom:w,left:E},ie={top:oe.top??T??U.borderWidth.top,right:oe.right??T??U.borderWidth.right,bottom:oe.bottom??T??U.borderWidth.bottom,left:oe.left??T??U.borderWidth.left},le={minHeight:S??h??O.minHeight,maxHeight:x,paddingHorizontal:F??O.paddingHorizontal,paddingVertical:y??O.paddingVertical,paddingLeft:R??F??O.paddingHorizontal,paddingRight:_??F??O.paddingHorizontal,backgroundColor:Y,columnGap:q??M.spacing.md,alignItems:"top"===c?"flex-start":"center"},se="underline"===P,ne=se?0:v??O.borderRadius,ae=se?{tl:0,tr:0,bl:0,br:0}:{tl:z??ne,tr:j??ne,bl:k??ne,br:C??ne};le.borderTopLeftRadius=ae.tl,le.borderTopRightRadius=ae.tr,le.borderBottomLeftRadius=ae.bl,le.borderBottomRightRadius=ae.br,le.borderCurve=_corners.smoothCorners.borderCurve,le.borderTopWidth=ie.top,le.borderRightWidth=ie.right,le.borderBottomWidth=ie.bottom,le.borderLeftWidth=ie.left;const sideColor=e=>$.interpolate({inputRange:J,outputRange:[ee[e],te[e],re[e]]}),sameOnEverySide=e=>e.top===e.right&&e.top===e.bottom&&e.top===e.left,de=!se&&ae.tl===ae.tr&&ae.tl===ae.bl&&ae.tl===ae.br&&sameOnEverySide(ie)&&sameOnEverySide(ee)&&sameOnEverySide(te)&&sameOnEverySide(re)&&sameOnEverySide(U.borderDisabled),ce=(0,_SquircleFill.useSquircle)(de,ae.tl);if(ce.active)le.backgroundColor="transparent",le.borderTopColor="transparent",le.borderRightColor="transparent",le.borderBottomColor="transparent",le.borderLeftColor="transparent";else if(i){const e=U.borderDisabled;le.borderTopColor=e.top,le.borderRightColor=e.right,le.borderBottomColor=e.bottom,le.borderLeftColor=e.left}else le.borderTopColor=sideColor("top"),le.borderRightColor=sideColor("right"),le.borderBottomColor=sideColor("bottom"),le.borderLeftColor=sideColor("left");const ue=i?U.borderDisabled.top:sideColor("top"),be=(0,_react.useRef)(Z);be.current=Z,(0,_react.useEffect)(()=>{$.setValue(be.current)},[U,$]),void 0!==f&&(le.width=f),void 0!==S&&(le.height=S);const pe={disabled:i,...G},ge="top"===c,me=ge?{alignSelf:"flex-start",marginTop:Math.max(0,((u??O.iconSize)-O.iconSize)/2)}:null,he=S??h??O.minHeight,xe=(()=>{if(!b)return 0;const e=Math.min(ae.tl,he/2),t=b.left;return e<=0||t>=e?0:Math.ceil(e-Math.sqrt(e*e-(e-t)*(e-t)))})(),fe=b&&ie.top>0?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:{position:"absolute",top:-ie.top,left:b.left-ie.left,width:b.width,height:ie.top+xe,backgroundColor:Y}}):null,renderInner=e=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[ce.active&&ce.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:ce.size.width,height:ce.size.height,radius:ae.tl,fill:e&&!i?M.colors.surface.pressed:Y,stroke:ue,strokeWidth:ie.top,outset:ie.top}):null,fe,null!=n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[A.slot,me],children:n}):null,null!=n&&a?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[A.divider,me,{height:O.iconSize,backgroundColor:M.colors.field.border}]}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[A.content,ge?A.contentTop:null],children:p}),null!=d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[A.slot,me],children:d}):null]}),Se=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{onLayout:ce.onLayout,style:[A.box,le,L],accessibilityRole:D,accessibilityLabel:B,accessibilityHint:W,accessibilityState:pe,testID:H,children:renderInner(!1)});return g&&!m?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:g,disabled:i,accessible:!1,children:Se}):g?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:g,disabled:i,accessibilityRole:D??"button",accessibilityLabel:B,accessibilityHint:W,accessibilityState:pe,testID:H,children:({pressed:e})=>(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{onLayout:ce.onLayout,style:[A.box,le,!e||i||ce.active?null:{backgroundColor:M.colors.surface.pressed},L],children:renderInner(e)})}):Se};exports.FieldBase=FieldBase,FieldBase.displayName="FieldBase";const buildStyles=()=>_reactNative.StyleSheet.create({box:{flexDirection:"row",alignItems:"center",overflow:"visible"},slot:{alignItems:"center",justifyContent:"center"},divider:{width:1,alignSelf:"center"},content:{flex:1,flexDirection:"row",alignItems:"center"},contentTop:{alignItems:"flex-start"}});var _default=exports.default=FieldBase;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Input=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.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"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var i=new WeakMap,n=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var r,a,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(r=t?n:i){if(r.has(e))return r.get(e);r.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((a=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?r(o,t,a):o[t]=e[t]);return o})(e,t)}const multilineMinHeightMap={sm:72,md:92,lg:110},Input=exports.Input=(0,_react.forwardRef)((e,t)=>{const{label:i,help:n,placeholder:r,value:a,onChangeText:o,error:l,helperText:s,type:d="input",secureTextEntry:c=!1,showPasswordToggle:u=!1,disabled:p=!1,multiline:f=!1,leftIcon:x,rightIcon:g,unit:_,unitStyle:m,prefix:v,prefixStyle:h,readOnly:y=!1,action:b,actionStyle:j,size:R="md",variant:S,labelMode:F,required:w=!1,maxLength:N,showCounter:I=!0,textAlign:z,format:T,parse:V,style:k,containerStyle:B,inputStyle:A,labelStyle:q,messageStyle:D,borderRadius:C,onFocus:L,onBlur:M,accessibilityLabel:P,testID:H,editable:O,...E}=e,W=(0,_index2.useTheme)(),G=(0,_react.useMemo)(()=>buildStyles(W),[W]),$=(0,_FieldBase.resolveFieldSize)(W,R),X=multilineMinHeightMap[R],J=Math.round(1.4*$.fontSize),K=S??W.components.input?.defaultVariant??W.components.field?.defaultVariant??"outlined",Q=F??W.components.input?.defaultLabelMode??"top",[U,Y]=(0,_react.useState)(!1),[Z,ee]=(0,_react.useState)(!1),te="password"===d||u||c,ie="password"===d||u,ne="textarea"===d||f,re=ne?Math.round(.1*$.fontSize):0,ae="string"==typeof a&&a.length>0,oe=(0,_FieldBase.hasFieldText)(l),le=(0,_FieldBase.hasFieldText)(s),se=(0,_FieldBase.hasFieldText)(i),de=(0,_FieldBase.hasFieldText)(v),ce=!p&&!1!==O,ue=U||ae||de,pe=(0,_react.useRef)(null),fe=(0,_react.useMemo)(()=>(0,_index3.mergeRefs)(pe,t),[t]),xe=(0,_react.useCallback)(()=>{ce&&pe.current?.focus()},[ce]),ge=se&&"float"===Q,_e=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,me=(0,_react.useRef)((0,_index2.createAnimatedValue)(oe||le?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(me,{toValue:oe||le?1:0,duration:W.motion.duration.fast,easing:_reactNative.Easing.bezier(...W.motion.easing.standard),useNativeDriver:!0});return e.start(),()=>e.stop()},[oe,le,me,W.motion.duration.fast,W.motion.easing.standard]);const ve=(0,_index.useReducedMotion)(),he=W.components.input?.shakeOnError??!1,ye=(0,_react.useRef)(oe);(0,_react.useEffect)(()=>{if(!he)return void(ye.current=oe);let e;return oe&&!ye.current&&(ve||((0,_index2.setNativeValue)(_e,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(_e,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(_e,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(_e,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(_e,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(_e,{toValue:0,duration:100,useNativeDriver:!0})]),e.start()),(0,_index3.triggerHaptic)("notificationError")),ye.current=oe,()=>e?.stop()},[oe,_e,he,ve]);const be=(0,_react.useCallback)(e=>{Y(!0),L?.(e)},[L]),je=(0,_react.useCallback)(e=>{Y(!1),M?.(e)},[M]),Re=(0,_react.useCallback)(()=>{(0,_index3.triggerHaptic)("selection"),ee(e=>!e)},[]),Se=(0,_react.useMemo)(()=>{const e=W.components.input?.fillColors?.[K];if(!e)return;const t={};return void 0!==e.idleEmpty&&(t.backgroundIdleEmpty=e.idleEmpty),void 0!==e.idleFilled&&(t.backgroundIdleFilled=e.idleFilled),void 0!==e.focus&&(t.backgroundFocused=e.focus),void 0!==e.error&&(t.backgroundError=e.error),void 0!==e.disabled&&(t.backgroundDisabled=e.disabled),Object.keys(t).length>0?t:void 0},[W.components.input?.fillColors,K]),Fe=W.colors.field.caret,we=C??W.components.input?.borderRadius,Ne=W.components.input?.tintLabelOnFocus??!1,Ie=U&&Ne?W.colors.field.borderFocused:W.colors.field.label,ze=_e.interpolate({inputRange:[-1,0,1],outputRange:[-6,0,6]}),Te=Boolean(g)||Boolean(_)||ie,Ve="underline"===K,ke=x?$.iconSize+W.spacing.md+1+W.spacing.md:0,Be=(0,_useFloatingLabel.useFloatingLabel)({label:i,enabled:ge,floated:ue,required:w,variant:K,sizeTokens:$,leadingOffset:ke,trailingOffset:Te?$.iconSize+W.spacing.sm:0,textAlign:z,paddingLeft:Ve?0:$.paddingHorizontal,lineHeight:ne?J:void 0,restNudge:re,floatTrim:ne?2:0,color:Ie,style:q}),Ae=(0,_FieldBase.resolveFieldTextStyle)(W,{disabled:p}),qe=Ae.color,De=Ae.placeholderColor,Ce=w&&!se&&!ae&&"string"==typeof r&&r.length>0,Le=oe?l:s,Me=oe||le,Pe=I&&"number"==typeof N&&"string"==typeof a?`${a.length} / ${N}`:null,He=oe?W.colors.field.message:W.colors.text.secondary,Oe=P??(0,_FieldBase.fieldTextAsString)(i)??r,Ee=W.colors.field,We=p?Ee.iconDisabled:U?Ee.iconFocused:Ee.icon,Ge={focused:U,disabled:p,error:oe,color:We,size:$.iconSize},renderSlot=e=>(0,_slotIcon.renderSlotIcon)(e,Ge),$e=(()=>{if(ie){const e=(Z?W.icons?.eyeOff:W.icons?.eye)??(Z?_defaultIcons.defaultIcons.eyeOff:_defaultIcons.defaultIcons.eye);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Re,disabled:!ce,hitSlop:8,accessibilityRole:"button",accessibilityLabel:Z?"Hide password":"Show password",children:e({size:$.iconSize,color:We})})}const e=_?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[G.unit,{fontSize:$.fontSize,color:De},m],children:_}):null,t=g?(0,_jsxRuntime.jsx)(_reactNative.View,{children:renderSlot(g)}):null;return e&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:G.trailingRow,children:[e,t]}):e??t})(),Xe=x?(0,_jsxRuntime.jsx)(_reactNative.View,{children:renderSlot(x)}):null,Je=de?"string"==typeof v||"number"==typeof v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[G.prefix,{fontSize:$.fontSize,color:De,marginRight:W.spacing.xs,lineHeight:ne?J:void 0,paddingTop:ne?re:void 0},h],children:v}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[G.prefixNode,{marginRight:W.spacing.xs,minHeight:ne?J:void 0,justifyContent:"center",paddingTop:ne?re:void 0}],children:v}):null,Ke=b?(0,_jsxRuntime.jsx)(_index4.Button,{variant:b.variant??"outline",tone:b.tone??"primary",size:R,title:b.label,leftIcon:b.icon,loading:b.loading,disabled:p||b.disabled,onPress:b.onPress,pressAnimation:!1,testID:b.testID,style:[G.action,{minHeight:$.minHeight,alignSelf:ne?"flex-start":"stretch"},j]}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[G.container,{transform:[{translateX:ze}]},k],children:[se&&!ge?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:R,required:w,help:n,color:Ie,style:q,children:i}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[G.fieldRow,{columnGap:W.spacing.sm,alignItems:ne?"flex-start":"stretch"}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:G.fieldWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:R,variant:K,focused:U,disabled:p,error:oe,filled:ae,minHeight:ne?X:void 0,borderRadius:we,fillOverrides:Se,leading:Xe,leadingDivider:null!=x,paddingLeft:Ve?0:void 0,trailing:$e,slotAlign:ne?"top":"center",slotLineHeight:ne?J:void 0,topNotch:Be.topNotch,onPress:xe,pressFeedback:!1,style:B,children:[Je,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:G.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:fe,style:[G.input,{color:qe,fontSize:$.fontSize,...Ae.weightStyle,paddingLeft:Ve?0:void 0,minHeight:ne?X-2*$.paddingVertical:void 0,lineHeight:ne?J:void 0,paddingTop:ne?re:void 0,textAlignVertical:ne?"top":"center"},A],textAlign:z,placeholder:ge&&!ue||Ce?void 0:r,placeholderTextColor:De,value:T&&null!=a?T(a):a,onChangeText:e=>{o&&o(V?V(e):e)},onFocus:be,onBlur:je,editable:ce,readOnly:y,secureTextEntry:te&&!Z,multiline:ne,autoCapitalize:te?"none":void 0,autoCorrect:!te&&void 0,maxLength:N,selectionColor:Fe,accessibilityLabel:Oe,accessibilityState:{disabled:p},testID:H,...E}),Ce?(0,_jsxRuntime.jsx)(_FieldBase.RequiredPlaceholder,{text:r,color:De,fontSize:$.fontSize,weightStyle:Ae.weightStyle,align:ne?"top":"center",paddingTop:ne?re:void 0,textAlign:z}):null]})]}),Be.node]}),Ke]}),Me||Pe?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[G.footerRow,{marginTop:$.messageGap}],children:[Me?(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[G.messageRow,{columnGap:W.spacing.xs+2,opacity:me}],accessibilityLiveRegion:oe?"polite":"none",children:[oe?(0,_jsxRuntime.jsx)(_FieldBase.FieldErrorGlyph,{size:$.messageFontSize,color:He}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[G.messageText,{color:He,fontSize:$.messageFontSize,...(0,_index2.fontFor)(W,"normal")},D],children:Le})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:G.footerSpacer}),Pe?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[G.counterText,{color:W.colors.text.tertiary,fontSize:$.messageFontSize,...(0,_index2.fontFor)(W,"normal")}],children:Pe}):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:0,margin:0,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:8},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:8},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=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"),_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"),_jsxRuntime=require("react/jsx-runtime");const multilineMinHeightMap={sm:72,md:92,lg:110},Input=exports.Input=(0,_react.forwardRef)((e,t)=>{const{label:i,help:n,placeholder:a,value:r,onChangeText:o,error:l,helperText:s,type:d="input",secureTextEntry:c=!1,showPasswordToggle:u=!1,disabled:p=!1,multiline:x=!1,leftIcon:f,rightIcon:g,unit:m,unitStyle:_,prefix:v,prefixStyle:h,readOnly:y=!1,action:b,actionStyle:j,size:S="md",variant:F,labelMode:R,required:N=!1,maxLength:w,showCounter:I=!0,textAlign:z,format:T,parse:V,style:B,containerStyle:A,inputStyle:k,labelStyle:C,messageStyle:D,borderRadius:L,onFocus:q,onBlur:H,accessibilityLabel:M,testID:P,editable:E,...O}=e,G=(0,_index2.useTheme)(),W=(0,_react.useMemo)(()=>buildStyles(G),[G]),$=(0,_FieldBase.resolveFieldSize)(G,S),X=multilineMinHeightMap[S],J=Math.round(1.4*$.fontSize),K=F??G.components.input?.defaultVariant??G.components.field?.defaultVariant??"outlined",Q=R??G.components.input?.defaultLabelMode??"top",[U,Y]=(0,_react.useState)(!1),[Z,ee]=(0,_react.useState)(!1),te="password"===d||u||c,ie="password"===d||u,ne="textarea"===d||x,ae=ne?Math.round(.1*$.fontSize):0,re="string"==typeof r&&r.length>0,oe=(0,_FieldBase.hasFieldText)(l),le=!0===l||oe,se=(0,_FieldBase.hasFieldText)(s),de=oe||!le&&se,ce=(0,_FieldBase.hasFieldText)(i),ue=(0,_FieldBase.hasFieldText)(v),pe=!p&&!1!==E,xe=U||re||ue,fe=(0,_react.useRef)(null),ge=(0,_react.useMemo)(()=>(0,_index3.mergeRefs)(fe,t),[t]),me=(0,_react.useCallback)(()=>{pe&&fe.current?.focus()},[pe]),_e=ce&&"float"===Q,ve=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,he=(0,_react.useRef)((0,_index2.createAnimatedValue)(de?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(he,{toValue:de?1:0,duration:G.motion.duration.fast,easing:_reactNative.Easing.bezier(...G.motion.easing.standard),useNativeDriver:!0});return e.start(),()=>e.stop()},[de,he,G.motion.duration.fast,G.motion.easing.standard]);const ye=(0,_index.useReducedMotion)(),be=G.components.input?.shakeOnError??!1,je=(0,_react.useRef)(le);(0,_react.useEffect)(()=>{if(!be)return void(je.current=le);let e;return le&&!je.current&&(ye||((0,_index2.setNativeValue)(ve,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(ve,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(ve,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(ve,{toValue:1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(ve,{toValue:-1,duration:50,useNativeDriver:!0}),_reactNative.Animated.timing(ve,{toValue:0,duration:100,useNativeDriver:!0})]),e.start()),(0,_index3.triggerHaptic)("notificationError")),je.current=le,()=>e?.stop()},[le,ve,be,ye]);const Se=(0,_react.useCallback)(e=>{Y(!0),q?.(e)},[q]),Fe=(0,_react.useCallback)(e=>{Y(!1),H?.(e)},[H]),Re=(0,_react.useCallback)(()=>{(0,_index3.triggerHaptic)("selection"),ee(e=>!e)},[]),Ne=(0,_react.useMemo)(()=>{const e=G.components.input?.fillColors?.[K];if(!e)return;const t={};return void 0!==e.idleEmpty&&(t.backgroundIdleEmpty=e.idleEmpty),void 0!==e.idleFilled&&(t.backgroundIdleFilled=e.idleFilled),void 0!==e.focus&&(t.backgroundFocused=e.focus),void 0!==e.error&&(t.backgroundError=e.error),void 0!==e.disabled&&(t.backgroundDisabled=e.disabled),Object.keys(t).length>0?t:void 0},[G.components.input?.fillColors,K]),we=G.colors.field.caret,Ie=L??G.components.input?.borderRadius,ze=G.components.input?.tintLabelOnFocus??!1,Te=U&&ze?G.colors.field.borderFocused:G.colors.field.label,Ve=ve.interpolate({inputRange:[-1,0,1],outputRange:[-6,0,6]}),Be=Boolean(g)||Boolean(m)||ie,Ae="underline"===K,ke=f?$.iconSize+G.spacing.md+1+G.spacing.md:0,Ce=(0,_useFloatingLabel.useFloatingLabel)({label:i,enabled:_e,floated:xe,required:N,variant:K,sizeTokens:$,leadingOffset:ke,trailingOffset:Be?$.iconSize+G.spacing.sm:0,textAlign:z,paddingLeft:Ae?0:$.paddingHorizontal,lineHeight:ne?J:void 0,restNudge:ae,floatTrim:ne?2:0,color:Te,style:C}),De=(0,_FieldBase.resolveFieldTextStyle)(G,{disabled:p}),Le=De.color,qe=De.placeholderColor,He=N&&!ce&&!re&&"string"==typeof a&&a.length>0,Me=le?l:s,Pe=I&&"number"==typeof w&&"string"==typeof r?`${r.length} / ${w}`:null,Ee=le?G.colors.field.message:G.colors.text.secondary,Oe=M??(0,_FieldBase.fieldTextAsString)(i)??a,Ge=G.colors.field,We=p?Ge.iconDisabled:U?Ge.iconFocused:Ge.icon,$e={focused:U,disabled:p,error:le,color:We,size:$.iconSize},renderSlot=e=>(0,_slotIcon.renderSlotIcon)(e,$e),Xe=(()=>{if(ie){const e=(Z?G.icons?.eyeOff:G.icons?.eye)??(Z?_defaultIcons.defaultIcons.eyeOff:_defaultIcons.defaultIcons.eye);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Re,disabled:!pe,hitSlop:8,accessibilityRole:"button",accessibilityLabel:Z?"Hide password":"Show password",children:e({size:$.iconSize,color:We})})}const e=m?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[W.unit,{fontSize:$.fontSize,color:qe},_],children:m}):null,t=g?(0,_jsxRuntime.jsx)(_reactNative.View,{children:renderSlot(g)}):null;return e&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:W.trailingRow,children:[e,t]}):e??t})(),Je=f?(0,_jsxRuntime.jsx)(_reactNative.View,{children:renderSlot(f)}):null,Ke=ue?"string"==typeof v||"number"==typeof v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[W.prefix,{fontSize:$.fontSize,color:qe,marginRight:G.spacing.xs,lineHeight:ne?J:void 0,paddingTop:ne?ae:void 0},h],children:v}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[W.prefixNode,{marginRight:G.spacing.xs,minHeight:ne?J:void 0,justifyContent:"center",paddingTop:ne?ae:void 0}],children:v}):null,Qe=b?(0,_jsxRuntime.jsx)(_index4.Button,{variant:b.variant??"outline",tone:b.tone??"primary",size:S,title:b.label,leftIcon:b.icon,loading:b.loading,disabled:p||b.disabled,onPress:b.onPress,pressAnimation:!1,testID:b.testID,style:[W.action,{minHeight:$.minHeight,alignSelf:ne?"flex-start":"stretch"},j]}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[W.container,{transform:[{translateX:Ve}]},B],children:[ce&&!_e?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:S,required:N,help:n,color:Te,style:C,children:i}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[W.fieldRow,{columnGap:G.spacing.sm,alignItems:ne?"flex-start":"stretch"}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:W.fieldWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:S,variant:K,focused:U,disabled:p,error:le,filled:re,minHeight:ne?X:void 0,borderRadius:Ie,fillOverrides:Ne,leading:Je,leadingDivider:null!=f,paddingLeft:Ae?0:void 0,trailing:Xe,slotAlign:ne?"top":"center",slotLineHeight:ne?J:void 0,topNotch:Ce.topNotch,onPress:me,pressFeedback:!1,style:A,children:[Ke,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:W.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:ge,style:[W.input,{color:Le,fontSize:$.fontSize,...De.weightStyle,paddingLeft:Ae?0:void 0,minHeight:ne?X-2*$.paddingVertical:void 0,lineHeight:ne?J:void 0,paddingTop:ne?ae:void 0,textAlignVertical:ne?"top":"center"},k],textAlign:z,placeholder:_e&&!xe||He?void 0:a,placeholderTextColor:qe,value:T&&null!=r?T(r):r,onChangeText:e=>{o&&o(V?V(e):e)},onFocus:Se,onBlur:Fe,editable:pe,readOnly:y,secureTextEntry:te&&!Z,multiline:ne,autoCapitalize:te?"none":void 0,autoCorrect:!te&&void 0,maxLength:w,selectionColor:we,accessibilityLabel:Oe,accessibilityState:{disabled:p},testID:P,...O}),He?(0,_jsxRuntime.jsx)(_FieldBase.RequiredPlaceholder,{text:a,color:qe,fontSize:$.fontSize,weightStyle:De.weightStyle,align:ne?"top":"center",paddingTop:ne?ae:void 0,textAlign:z}):null]})]}),Ce.node]}),Qe]}),de||Pe?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[W.footerRow,{marginTop:$.messageGap}],children:[de?(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[W.messageRow,{columnGap:G.spacing.xs+2,opacity:he}],accessibilityLiveRegion:le?"polite":"none",children:[le?(0,_jsxRuntime.jsx)(_FieldBase.FieldErrorGlyph,{size:$.messageFontSize,color:Ee}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[W.messageText,{color:Ee,fontSize:$.messageFontSize,...(0,_index2.fontFor)(G,"normal")},D],children:Me})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:W.footerSpacer}),Pe?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[W.counterText,{color:G.colors.text.tertiary,fontSize:$.messageFontSize,...(0,_index2.fontFor)(G,"normal")}],children:Pe}):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:0,margin:0,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:8},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:8},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.sym=exports.parseNotation=exports.default=exports.Notation=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_Text=require("../Text/Text.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap,n=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,s,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(i=t?n:r){if(i.has(e))return i.get(e);i.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((s=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(s.get||s.set)?i(o,t,s):o[t]=e[t]);return o})(e,t)}const SUBSCRIPTED=/(?<![A-Za-z0-9_])([A-Za-z])_([A-Za-z0-9]+)(?![A-Za-z0-9_])/g,parseNotation=e=>{const t=String(e??""),r=[];let n=0;for(const e of t.matchAll(SUBSCRIPTED)){const i=e.index??0;i>n&&r.push({text:t.slice(n,i)}),r.push({text:e[1],sub:e[2]}),n=i+e[0].length}return n<t.length&&r.push({text:t.slice(n)}),r};exports.parseNotation=parseNotation;const SUB_DROP=.4,Subscript=({children:e,color:t})=>{const r=(0,_index.useTheme)(),n=Math.round(.75*r.typography.fontSize.sm);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{transform:[{translateY:Math.round(.4*n)}]},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:r.maxFontSizeMultiplier,style:[styles.sub,{fontSize:n,lineHeight:n,color:t??r.colors.text.primary,...(0,_index.fontFor)(r,"normal")}],children:e})})},renderNotation=(e,t)=>parseNotation(e).map((e,r)=>e.sub?(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[e.text,(0,_jsxRuntime.jsx)(Subscript,{color:t,children:e.sub})]},r):(0,_jsxRuntime.jsx)(_react.Fragment,{children:e.text},r)),Notation=({text:e,base:t,sub:r,desc:n,color:i,testID:s})=>null!=t?(0,_jsxRuntime.jsxs)(_Text.Text,{testID:s,children:[t,r?(0,_jsxRuntime.jsx)(Subscript,{color:i,children:r}):null,n?` ${n}`:null]}):(0,_jsxRuntime.jsx)(_reactNative.Text,{testID:s,children:"string"==typeof e||null==e?renderNotation(e??"",i):e.map((e,t)=>"string"==typeof e?(0,_jsxRuntime.jsx)(_react.Fragment,{children:renderNotation(e,i)},t):(0,_jsxRuntime.jsx)(_react.Fragment,{children:e.verbatim},t))});exports.Notation=Notation;const sym=(e,t,r,n)=>(0,_jsxRuntime.jsx)(Notation,{base:e,sub:t,desc:r,color:n});exports.sym=sym;const styles=_reactNative.StyleSheet.create({sub:{includeFontPadding:!1}});var _default=exports.default=Notation;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sym=exports.parseNotation=exports.default=exports.NotationInkContext=exports.Notation=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_jsxRuntime=require("react/jsx-runtime");const SUBSCRIPTED=/(?<![A-Za-z0-9_])([A-Za-z])_([A-Za-z0-9]+)(?![A-Za-z0-9_])/g,parseNotation=t=>{const e=String(t??""),n=[];let r=0;for(const t of e.matchAll(SUBSCRIPTED)){const o=t.index??0;o>r&&n.push({text:e.slice(r,o)}),n.push({text:t[1],sub:t[2]}),r=o+t[0].length}return r<e.length&&n.push({text:e.slice(r)}),n};exports.parseNotation=parseNotation;const SUB_DROP=.4,NotationInkContext=exports.NotationInkContext=(0,_react.createContext)(null),Subscript=({children:t,color:e})=>{const n=(0,_index.useTheme)(),r=(0,_react.useContext)(NotationInkContext),o=Math.round(.75*(r?.fontSize??n.typography.fontSize.sm));return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{transform:[{translateY:Math.round(.4*o)}]},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{maxFontSizeMultiplier:n.maxFontSizeMultiplier,style:[styles.sub,{fontSize:o,lineHeight:o,color:e??r?.color??n.colors.text.primary,...(0,_index.fontFor)(n,"normal")}],children:t})})},renderNotation=(t,e)=>parseNotation(t).map((t,n)=>t.sub?(0,_jsxRuntime.jsxs)(_react.Fragment,{children:[t.text,(0,_jsxRuntime.jsx)(Subscript,{color:e,children:t.sub})]},n):(0,_jsxRuntime.jsx)(_react.Fragment,{children:t.text},n)),Notation=({text:t,base:e,sub:n,desc:r,color:o,testID:s})=>null!=e?(0,_jsxRuntime.jsxs)(_reactNative.Text,{testID:s,children:[e,n?(0,_jsxRuntime.jsx)(Subscript,{color:o,children:n}):null,r?` ${r}`:null]}):(0,_jsxRuntime.jsx)(_reactNative.Text,{testID:s,children:"string"==typeof t||null==t?renderNotation(t??"",o):t.map((t,e)=>"string"==typeof t?(0,_jsxRuntime.jsx)(_react.Fragment,{children:renderNotation(t,o)},e):(0,_jsxRuntime.jsx)(_react.Fragment,{children:t.verbatim},e))});exports.Notation=Notation;const sym=(t,e,n,r)=>(0,_jsxRuntime.jsx)(Notation,{base:t,sub:e,desc:n,color:r});exports.sym=sym;const styles=_reactNative.StyleSheet.create({sub:{includeFontPadding:!1}});var _default=exports.default=Notation;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.NumberInput=void 0;var _react=_interopRequireWildcard(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"),_FieldBase=require("../FieldBase/FieldBase.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var i=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,a,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=t?r:i){if(n.has(e))return n.get(e);n.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((a=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?n(s,t,a):s[t]=e[t]);return s})(e,t)}const DEFAULT_LONG_PRESS_DELAY=500,DEFAULT_LONG_PRESS_INTERVAL=80,roundToPrecision=(e,t)=>{if(!Number.isFinite(e))return 0;if(t<=0)return Math.round(e);const i=Math.pow(10,t);return Math.round(e*i)/i},clamp=(e,t,i)=>e<t?t:e>i?i:e,formatValue=(e,t,i)=>Number.isFinite(e)?t&&i>0?e.toFixed(i):String(Math.trunc(e)):"",sanitizeTyped=(e,t)=>{if(!e)return"";let i=e.replace(/[^0-9.-]/g,"");if(i=i.replace(/(?!^)-/g,""),t){const e=i.indexOf(".");-1!==e&&(i=i.slice(0,e+1)+i.slice(e+1).replace(/\./g,""))}else i=i.replace(/\./g,"");return i},NumberInput=exports.NumberInput=(0,_react.forwardRef)((e,t)=>{const{value:i,defaultValue:r,onChange:n,min:a=Number.NEGATIVE_INFINITY,max:s=Number.POSITIVE_INFINITY,step:l=1,allowDecimal:c=!1,precision:o=0,label:u,help:d,helperText:_,error:b,disabled:p=!1,size:m="md",variant:x="inline",unit:f,haptic:y,accessibilityLabel:h,style:g,containerStyle:j,inputStyle:N,buttonStyle:F,unitStyle:S,labelStyle:v,textInputProps:I,testID:T}=e,[R,C]=(0,_index.useControllableState)({value:i,defaultValue:r??e.min??0,onChange:n}),P=(0,_index2.useTheme)(),w=(0,_FieldBase.resolveFieldSize)(P,m),z=(0,_FieldBase.resolveFieldTextStyle)(P,{disabled:p}),k=(0,_react.useMemo)(()=>buildStyles(P),[P]),B=P.components.numberInput?.longPressDelayMs??500,V=P.components.numberInput?.longPressIntervalMs??80,L=(0,_react.useRef)(null),[D,E]=(0,_react.useState)(formatValue(R,c,o)),[M,q]=(0,_react.useState)(!1),[O,A]=(0,_react.useState)(!1),W=(0,_react.useCallback)(()=>{p||L.current?.focus()},[p]),H=(0,_react.useRef)(null),G=(0,_react.useRef)(null),Y=(0,_react.useCallback)(()=>{null!==H.current&&(clearTimeout(H.current),H.current=null),null!==G.current&&(clearInterval(G.current),G.current=null)},[]);(0,_react.useEffect)(()=>Y,[Y]),(0,_react.useEffect)(()=>{M||E(formatValue(R,c,o))},[R,c,o,M]);const U=R<=a,$=R>=s,J=!p,K=(0,_react.useCallback)(e=>{const t=roundToPrecision(e,c?o:0),i=clamp(t,a,s);i!==R&&C(i)},[c,s,a,C,o,R]),Q=(0,_react.useCallback)(()=>{if(!J||U)return;const e=(0,_index3.resolveHaptic)(y,"selection");e&&(0,_index3.triggerHaptic)(e),K(R-l)},[U,J,y,K,l,R]),X=(0,_react.useCallback)(()=>{if(!J||$)return;const e=(0,_index3.resolveHaptic)(y,"selection");e&&(0,_index3.triggerHaptic)(e),K(R+l)},[$,J,y,K,l,R]);_react.default.useImperativeHandle(t,()=>({focus:()=>L.current?.focus(),blur:()=>L.current?.blur(),clear:()=>{E(""),Number.isFinite(a)&&a>0?C(a):C(0<a?a:0>s?s:0)}}),[s,a,C]);const Z=(0,_react.useCallback)(e=>{J&&(Y(),H.current=setTimeout(()=>{G.current=setInterval(()=>{"inc"===e?X():Q()},V)},B))},[Y,Q,X,J,B,V]),ee=(0,_react.useCallback)(e=>{const t=sanitizeTyped(e,c);E(t);const i=Number(t);""!==t&&"-"!==t&&"."!==t&&Number.isFinite(i)&&i>=a&&i<=s&&i!==R&&C(roundToPrecision(i,c?o:0))},[c,s,a,C,o,R]),te=(0,_react.useCallback)(()=>{q(!1),A(!1);const e=Number(D);if(""===D||!Number.isFinite(e))return void E(formatValue(R,c,o));const t=roundToPrecision(e,c?o:0),i=clamp(t,a,s);i!==R&&C(i),E(formatValue(i,c,o))},[c,D,s,a,C,o,R]),ie=(0,_react.useCallback)(()=>{q(!0),A(!0)},[]),re=U||p?P.colors.text.disabled:P.colors.text.primary,ne=$||p?P.colors.text.disabled:P.colors.text.primary,ae=w.iconSize+8,renderStepper=(e,t,i,r,n,a)=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:t,onLongPress:()=>Z(e),onPressOut:Y,delayLongPress:B,disabled:i,accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{disabled:i},style:({pressed:e})=>[{width:ae,height:ae,alignItems:"center",justifyContent:"center",borderRadius:ae/2,..._corners.smoothCorners},e&&!i?{backgroundColor:P.colors.surface.pressed}:null,F],testID:`${T??"numberinput"}-${"inc"===e?"plus":"minus"}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{fontSize:w.iconSize,color:n,fontWeight:P.typography.fontWeight.semibold,lineHeight:w.iconSize+2},children:a})}),se=h??(0,_FieldBase.fieldTextAsString)(u)??"Number input",le=(0,_jsxRuntime.jsx)(_FieldBase.FieldBase,{size:m,disabled:p,error:(0,_FieldBase.hasFieldText)(b),filled:!0,focused:O,onPress:W,pressFeedback:!1,leading:renderStepper("dec",Q,U||p,"Decrease",re,"−"),trailing:renderStepper("inc",X,$||p,"Increase",ne,"+"),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:k.inputRow,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:L,value:D,onChangeText:ee,onFocus:ie,onBlur:te,editable:!p,keyboardType:c?"decimal-pad":"number-pad",selectTextOnFocus:!0,accessibilityRole:"adjustable",accessibilityLabel:se,accessibilityValue:{now:Number.isFinite(R)?R:0},accessibilityState:{disabled:p},accessibilityActions:[{name:"increment",label:"Increase"},{name:"decrement",label:"Decrease"}],onAccessibilityAction:e=>{"increment"===e.nativeEvent.actionName&&X(),"decrement"===e.nativeEvent.actionName&&Q()},style:[k.input,{fontSize:w.fontSize,color:z.color,...z.weightStyle},N],...I}),f?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[k.unit,{fontSize:w.fontSize,color:z.placeholderColor},S],children:f}):null]})}),ce=(0,_FieldBase.hasFieldText)(u)?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:m,help:d,style:v,children:u}):null,oe=(0,_jsxRuntime.jsx)(_FieldBase.FieldMessage,{size:m,error:(0,_FieldBase.hasFieldText)(b),text:(0,_FieldBase.hasFieldText)(b)?b:_});return"horizontal"===x?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[k.horizontalContainer,g,j],testID:T,accessibilityState:{disabled:p},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:k.horizontalLabelWrap,children:ce}),(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[le,oe]})]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[g,j],testID:T,accessibilityState:{disabled:p},children:[ce,le,oe]})});NumberInput.displayName="NumberInput";const buildStyles=e=>_reactNative.StyleSheet.create({inputRow:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},input:{flex:1,textAlign:"center",padding:0,margin:0,includeFontPadding:!1},unit:{marginLeft:4},label:{marginBottom:6},helper:{marginTop:6},horizontalContainer:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},horizontalLabelWrap:{flexShrink:1,paddingRight:12}});var _default=exports.default=NumberInput;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.NumberInput=void 0;var _react=_interopRequireWildcard(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"),_FieldBase=require("../FieldBase/FieldBase.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var i=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,a,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(n=t?r:i){if(n.has(e))return n.get(e);n.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((a=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?n(s,t,a):s[t]=e[t]);return s})(e,t)}const DEFAULT_LONG_PRESS_DELAY=500,DEFAULT_LONG_PRESS_INTERVAL=80,roundToPrecision=(e,t)=>{if(!Number.isFinite(e))return 0;if(t<=0)return Math.round(e);const i=10**t;return Math.round(e*i)/i},clamp=(e,t,i)=>e<t?t:e>i?i:e,formatValue=(e,t,i)=>Number.isFinite(e)?t&&i>0?e.toFixed(i):String(Math.trunc(e)):"",sanitizeTyped=(e,t)=>{if(!e)return"";let i=e.replace(/[^0-9.-]/g,"");if(i=i.replace(/(?!^)-/g,""),t){const e=i.indexOf(".");-1!==e&&(i=i.slice(0,e+1)+i.slice(e+1).replace(/\./g,""))}else i=i.replace(/\./g,"");return i},NumberInput=exports.NumberInput=(0,_react.forwardRef)((e,t)=>{const{value:i,defaultValue:r,onChange:n,min:a=Number.NEGATIVE_INFINITY,max:s=Number.POSITIVE_INFINITY,step:l=1,allowDecimal:c=!1,precision:u=0,label:o,help:d,helperText:_,error:b,disabled:p=!1,size:m="md",variant:f="inline",unit:x,haptic:y,accessibilityLabel:h,style:g,containerStyle:j,inputStyle:N,buttonStyle:S,unitStyle:v,labelStyle:F,textInputProps:I,testID:R}=e,[T,C]=(0,_index.useControllableState)({value:i,defaultValue:r??e.min??0,onChange:n}),P=(0,_index2.useTheme)(),z=(0,_FieldBase.resolveFieldSize)(P,m),w=(0,_FieldBase.resolveFieldTextStyle)(P,{disabled:p}),k=(0,_react.useMemo)(()=>buildStyles(P),[P]),V=P.components.numberInput?.longPressDelayMs??500,L=P.components.numberInput?.longPressIntervalMs??80,B=(0,_react.useRef)(null),[D,E]=(0,_react.useState)(formatValue(T,c,u)),[M,q]=(0,_react.useState)(!1),[O,A]=(0,_react.useState)(!1),W=(0,_react.useCallback)(()=>{p||B.current?.focus()},[p]),H=(0,_react.useRef)(null),G=(0,_react.useRef)(null),Y=(0,_react.useCallback)(()=>{null!==H.current&&(clearTimeout(H.current),H.current=null),null!==G.current&&(clearInterval(G.current),G.current=null)},[]);(0,_react.useEffect)(()=>Y,[Y]),(0,_react.useEffect)(()=>{M||E(formatValue(T,c,u))},[T,c,u,M]);const U=T<=a,$=T>=s,J=!p,K=(0,_react.useCallback)(e=>{const t=roundToPrecision(e,c?u:0),i=clamp(t,a,s);i!==T&&C(i)},[c,s,a,C,u,T]),Q=(0,_react.useCallback)(()=>{if(!J||U)return;const e=(0,_index3.resolveHaptic)(y,"selection");e&&(0,_index3.triggerHaptic)(e),K(T-l)},[U,J,y,K,l,T]),X=(0,_react.useCallback)(()=>{if(!J||$)return;const e=(0,_index3.resolveHaptic)(y,"selection");e&&(0,_index3.triggerHaptic)(e),K(T+l)},[$,J,y,K,l,T]);_react.default.useImperativeHandle(t,()=>({focus:()=>B.current?.focus(),blur:()=>B.current?.blur(),clear:()=>{E(""),Number.isFinite(a)&&a>0?C(a):C(0<a?a:0>s?s:0)}}),[s,a,C]);const Z=(0,_react.useCallback)(e=>{J&&(Y(),H.current=setTimeout(()=>{G.current=setInterval(()=>{"inc"===e?X():Q()},L)},V))},[Y,Q,X,J,V,L]),ee=(0,_react.useCallback)(e=>{const t=sanitizeTyped(e,c);E(t);const i=Number(t);""!==t&&"-"!==t&&"."!==t&&Number.isFinite(i)&&i>=a&&i<=s&&i!==T&&C(roundToPrecision(i,c?u:0))},[c,s,a,C,u,T]),te=(0,_react.useCallback)(()=>{q(!1),A(!1);const e=Number(D);if(""===D||!Number.isFinite(e))return void E(formatValue(T,c,u));const t=roundToPrecision(e,c?u:0),i=clamp(t,a,s);i!==T&&C(i),E(formatValue(i,c,u))},[c,D,s,a,C,u,T]),ie=(0,_react.useCallback)(()=>{q(!0),A(!0)},[]),re=U||p?P.colors.text.disabled:P.colors.text.primary,ne=$||p?P.colors.text.disabled:P.colors.text.primary,ae=z.iconSize+8,renderStepper=(e,t,i,r,n,a)=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:t,onLongPress:()=>Z(e),onPressOut:Y,delayLongPress:V,disabled:i,accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{disabled:i},style:({pressed:e})=>[{width:ae,height:ae,alignItems:"center",justifyContent:"center",borderRadius:ae/2,..._corners.smoothCorners},e&&!i?{backgroundColor:P.colors.surface.pressed}:null,S],testID:`${R??"numberinput"}-${"inc"===e?"plus":"minus"}`,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{fontSize:z.iconSize,color:n,fontWeight:P.typography.fontWeight.semibold,lineHeight:z.iconSize+2},children:a})}),se=h??(0,_FieldBase.fieldTextAsString)(o)??"Number input",le=!0===b||(0,_FieldBase.hasFieldText)(b),ce=(0,_jsxRuntime.jsx)(_FieldBase.FieldBase,{size:m,disabled:p,error:le,filled:!0,focused:O,onPress:W,pressFeedback:!1,leading:renderStepper("dec",Q,U||p,"Decrease",re,"−"),trailing:renderStepper("inc",X,$||p,"Increase",ne,"+"),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:k.inputRow,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:B,value:D,onChangeText:ee,onFocus:ie,onBlur:te,editable:!p,keyboardType:c?"decimal-pad":"number-pad",selectTextOnFocus:!0,accessibilityRole:"adjustable",accessibilityLabel:se,accessibilityValue:{now:Number.isFinite(T)?T:0},accessibilityState:{disabled:p},accessibilityActions:[{name:"increment",label:"Increase"},{name:"decrement",label:"Decrease"}],onAccessibilityAction:e=>{"increment"===e.nativeEvent.actionName&&X(),"decrement"===e.nativeEvent.actionName&&Q()},style:[k.input,{fontSize:z.fontSize,color:w.color,...w.weightStyle},N],...I}),x?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[k.unit,{fontSize:z.fontSize,color:w.placeholderColor},v],children:x}):null]})}),ue=(0,_FieldBase.hasFieldText)(o)?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:m,help:d,style:F,children:o}):null,oe=(0,_jsxRuntime.jsx)(_FieldBase.FieldMessage,{size:m,error:le,text:le?b:_});return"horizontal"===f?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[k.horizontalContainer,g,j],testID:R,accessibilityState:{disabled:p},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:k.horizontalLabelWrap,children:ue}),(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[ce,oe]})]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[g,j],testID:R,accessibilityState:{disabled:p},children:[ue,ce,oe]})});NumberInput.displayName="NumberInput";const buildStyles=e=>_reactNative.StyleSheet.create({inputRow:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},input:{flex:1,textAlign:"center",padding:0,margin:0,includeFontPadding:!1},unit:{marginLeft:4},label:{marginBottom:6},helper:{marginTop:6},horizontalContainer:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},horizontalLabelWrap:{flexShrink:1,paddingRight:12}});var _default=exports.default=NumberInput;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.OTPInput=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"),_FieldBase=require("../FieldBase/FieldBase.js"),_jsxRuntime=require("react/jsx-runtime");const sizeMap={sm:{cell:36,fontSize:16,borderRadius:8,gap:8},md:{cell:48,fontSize:20,borderRadius:10,gap:10},lg:{cell:56,fontSize:24,borderRadius:12,gap:12}},sanitizeChar=(e,t)=>e?"number-pad"===t?e.replace(/\D/g,""):e:"",OTPInput=exports.OTPInput=(0,_react.forwardRef)((e,t)=>{const{value:r,defaultValue:i,onChange:n,onComplete:a,length:s=6,keyboardType:o="number-pad",autoFocus:l=!1,autoFocusDelay:c=0,disabled:u=!1,error:d,size:_="md",secure:p=!1,haptic:m,accessibilityLabel:f,style:g,cellStyle:x,textStyle:h,testID:v}=e,[b,y]=(0,_index.useControllableState)({value:r,defaultValue:i??"",onChange:n}),j=(0,_index2.useTheme)(),N=(0,_react.useMemo)(()=>buildStyles(j),[j]),R={...sizeMap[_],...j.components.otpInput?.[_]??{}},T=(0,_react.useRef)([]),[C,S]=(0,_react.useState)(-1),k=(0,_react.useRef)(null),z=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,V=(0,_react.useRef)(new Map),I=(0,_react.useMemo)(()=>{const e=V.current,t=[];for(let r=0;r<s;r+=1){let i=e.get(r);i||(i=new _reactNative.Animated.Value(0),e.set(r,i)),t.push(i)}for(const t of Array.from(e.keys()))t>=s&&e.delete(t);return t},[s]),w=(0,_react.useRef)(-1),E=j.components.otpInput?.shakeOnError??!1,A=(0,_index.useReducedMotion)(),F=Boolean(d),O="string"==typeof d?d:void 0;(0,_react.useEffect)(()=>{let e;return null===k.current||!F||k.current||(!1!==m&&(0,_index3.triggerHaptic)("notificationError"),E&&!A&&((0,_index2.setNativeValue)(z,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(z,{toValue:1,duration:j.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0}),_reactNative.Animated.timing(z,{toValue:-1,duration:j.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0}),_reactNative.Animated.timing(z,{toValue:1,duration:j.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0}),_reactNative.Animated.timing(z,{toValue:0,duration:j.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0})]),e.start())),k.current=F,()=>e?.stop()},[F,z,E,m,A,j.motion.duration.instant]),(0,_react.useEffect)(()=>{const e=w.current;if(w.current=C,e===C)return;if(-1===e&&-1===C)return;const t=[];return I.forEach((r,i)=>{const n=i===C?1:0;if(i!==C&&i!==e)return;const a=_reactNative.Animated.timing(r,{toValue:n,duration:j.motion.duration.fast,easing:_reactNative.Easing.bezier(...j.motion.easing.standard),useNativeDriver:!0});a.start(),t.push(a)}),()=>t.forEach(e=>e.stop())},[C,I,j]);const D=(0,_react.useCallback)(e=>{const t=T.current[e];t&&t.focus()},[]);(0,_react.useImperativeHandle)(t,()=>({focus:()=>D(0),blur:()=>{const e=T.current[C>=0?C:0];e?.blur()},clear:()=>{y(""),D(0)}}),[D,C,y]),(0,_react.useEffect)(()=>{if(l&&!u){const e=setTimeout(()=>D(0),c);return()=>clearTimeout(e)}},[l,c,u,D]);const M=(0,_react.useMemo)(()=>{const e=new Array(s).fill("");for(let t=0;t<Math.min(b.length,s);t+=1)e[t]=b[t]??"";return e},[b,s]),P=(0,_react.useCallback)(e=>{const t=e.slice(0,s);t!==b&&(y(t),t.length===s&&a&&a(t))},[s,y,a,b]),q=(0,_react.useCallback)((e,t)=>{const r=t.replace(/\u200B/g,""),i=sanitizeChar(r,o);if(!i){const t=M.slice(),r=(t[e]??"").length>0;if(t[e]="",P(t.join("").slice(0,s)),!r&&e>0){const t=M.slice();t[e-1]="",P(t.join("")),D(e-1)}return}const n=M[e]??"",a=n&&i.length>s&&i.startsWith(n)?i.slice(n.length):i;if(a.length>=s){const t=a.slice(0,s),r=b.length;if(P(t),t.length!==r){const e=(0,_index3.resolveHaptic)(m,"selection");e&&(0,_index3.triggerHaptic)(e)}return void T.current[e]?.blur()}const l=M.slice();let c=e;for(let e=0;e<i.length&&c<s;e+=1)l[c]=i[e]??"",c+=1;const u=l.join("").slice(0,s),d=b.length;if(P(u),u.length!==d){const e=(0,_index3.resolveHaptic)(m,"selection");e&&(0,_index3.triggerHaptic)(e)}const _=Math.min(c,s-1);c>=s?T.current[e]?.blur():D(_)},[M,D,o,s,m,P,b]),B=(0,_react.useCallback)((e,t)=>{if("Backspace"!==t.nativeEvent.key)return;if(0===(M[e]??"").length){if(e>0){const t=M.slice();t[e-1]="",P(t.join("")),D(e-1)}}else{const t=M.slice();t[e]="",P(t.join(""))}},[M,D,P]),H=(0,_react.useCallback)(e=>{S(e)},[]),L=(0,_react.useCallback)(()=>{S(-1)},[]),W=(0,_react.useCallback)(()=>{if(u)return;const e=M.findIndex(e=>""===e);D(-1===e?s-1:e)},[M,u,D,s]),$=f??`Enter ${s}-digit code`,G=z.interpolate({inputRange:[-1,1],outputRange:[-6,6]});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:g,accessible:!0,accessibilityRole:"none",accessibilityLabel:$,accessibilityValue:{text:r},accessibilityState:{disabled:u},testID:v,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:W,disabled:u,accessible:!1,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[N.row,{columnGap:R.gap,transform:[{translateX:G}]}],children:M.map((e,t)=>{const r=C===t,i=e.length>0,n=F?j.colors.border.error:j.colors.border.focus,a=I[t];if(!a)return null;const l=p&&i?"●":e;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:N.cellWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:_,width:R.cell,height:R.cell,borderRadius:R.borderRadius,borderWidth:1.5,focused:r,error:F,filled:i,disabled:u,paddingHorizontal:0,paddingVertical:0,gap:0,style:x,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:e=>{T.current[t]=e},value:(p&&i?"":e)||"​",onChangeText:e=>q(t,e),onKeyPress:e=>B(t,e),onFocus:()=>H(t),onBlur:L,keyboardType:o,editable:!u,selectTextOnFocus:!0,caretHidden:i,maxLength:s+1,textContentType:"oneTimeCode",autoComplete:0===t?"sms-otp":"off",importantForAutofill:0===t?"yes":"no",style:[N.input,{fontSize:R.fontSize,color:j.colors.text.primary,...(0,_index2.fontFor)(j,"semibold")},h]}),p&&i?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:N.maskOverlay,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{fontSize:R.fontSize,color:j.colors.text.primary,...(0,_index2.fontFor)(j,"semibold")},h],children:l})}):null]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[N.underline,{backgroundColor:n,opacity:a}]})]},`otp-cell-${t}`)})})}),O?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[N.errorText,{color:j.colors.error,fontSize:j.typography.fontSize.sm}],accessibilityLiveRegion:"polite",children:O}):null]})});OTPInput.displayName="OTPInput";const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},cellWrapper:{alignItems:"center"},input:{width:"100%",height:"100%",textAlign:"center",padding:0},maskOverlay:{..._reactNative.StyleSheet.absoluteFill,alignItems:"center",justifyContent:"center"},underline:{marginTop:4,height:2,width:"60%",borderRadius:1,..._corners.smoothCorners},errorText:{marginTop:6}});var _default=exports.default=OTPInput;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.OTPInput=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"),_FieldBase=require("../FieldBase/FieldBase.js"),_jsxRuntime=require("react/jsx-runtime");const sizeMap={sm:{cell:36,fontSize:16,borderRadius:8,gap:8},md:{cell:48,fontSize:20,borderRadius:10,gap:10},lg:{cell:56,fontSize:24,borderRadius:12,gap:12}},sanitizeChar=(e,t)=>e?"number-pad"===t?e.replace(/\D/g,""):e:"",OTPInput=exports.OTPInput=(0,_react.forwardRef)((e,t)=>{const{value:i,defaultValue:r,onChange:n,onComplete:a,length:s=6,keyboardType:o="number-pad",autoFocus:l=!1,autoFocusDelay:c=0,disabled:u=!1,error:d,size:_="md",secure:m=!1,haptic:p,accessibilityLabel:f,style:g,cellStyle:x,textStyle:h,testID:v}=e,[b,y]=(0,_index.useControllableState)({value:i,defaultValue:r??"",onChange:n}),j=(0,_index2.useTheme)(),N=(0,_react.useMemo)(()=>buildStyles(j),[j]),R={...sizeMap[_],...j.components.otpInput?.[_]??{}},C=(0,_react.useRef)([]),[T,S]=(0,_react.useState)(-1),k=(0,_react.useRef)(null),F=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,V=(0,_react.useRef)(new Map),z=(0,_react.useMemo)(()=>{const e=V.current,t=[];for(let i=0;i<s;i+=1){let r=e.get(i);r||(r=new _reactNative.Animated.Value(0),e.set(i,r)),t.push(r)}for(const t of Array.from(e.keys()))t>=s&&e.delete(t);return t},[s]),I=(0,_react.useRef)(-1),w=j.components.otpInput?.shakeOnError??!1,E=(0,_index.useReducedMotion)(),A=!0===d||(0,_FieldBase.hasFieldText)(d);(0,_react.useEffect)(()=>{let e;return null===k.current||!A||k.current||(!1!==p&&(0,_index3.triggerHaptic)("notificationError"),w&&!E&&((0,_index2.setNativeValue)(F,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(F,{toValue:1,duration:j.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0}),_reactNative.Animated.timing(F,{toValue:-1,duration:j.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0}),_reactNative.Animated.timing(F,{toValue:1,duration:j.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0}),_reactNative.Animated.timing(F,{toValue:0,duration:j.motion.duration.instant,easing:_reactNative.Easing.linear,useNativeDriver:!0})]),e.start())),k.current=A,()=>e?.stop()},[A,F,w,p,E,j.motion.duration.instant]),(0,_react.useEffect)(()=>{const e=I.current;if(I.current=T,e===T)return;if(-1===e&&-1===T)return;const t=[];return z.forEach((i,r)=>{const n=r===T?1:0;if(r!==T&&r!==e)return;const a=_reactNative.Animated.timing(i,{toValue:n,duration:j.motion.duration.fast,easing:_reactNative.Easing.bezier(...j.motion.easing.standard),useNativeDriver:!0});a.start(),t.push(a)}),()=>t.forEach(e=>e.stop())},[T,z,j]);const M=(0,_react.useCallback)(e=>{const t=C.current[e];t&&t.focus()},[]);(0,_react.useImperativeHandle)(t,()=>({focus:()=>M(0),blur:()=>{const e=C.current[T>=0?T:0];e?.blur()},clear:()=>{y(""),M(0)}}),[M,T,y]),(0,_react.useEffect)(()=>{if(l&&!u){const e=setTimeout(()=>M(0),c);return()=>clearTimeout(e)}},[l,c,u,M]);const O=(0,_react.useMemo)(()=>{const e=new Array(s).fill("");for(let t=0;t<Math.min(b.length,s);t+=1)e[t]=b[t]??"";return e},[b,s]),B=(0,_react.useCallback)(e=>{const t=e.slice(0,s);t!==b&&(y(t),t.length===s&&a&&a(t))},[s,y,a,b]),D=(0,_react.useCallback)((e,t)=>{const i=t.replace(/\u200B/g,""),r=sanitizeChar(i,o);if(!r){const t=O.slice(),i=(t[e]??"").length>0;if(t[e]="",B(t.join("").slice(0,s)),!i&&e>0){const t=O.slice();t[e-1]="",B(t.join("")),M(e-1)}return}const n=O[e]??"",a=n&&r.length>s&&r.startsWith(n)?r.slice(n.length):r;if(a.length>=s){const t=a.slice(0,s),i=b.length;if(B(t),t.length!==i){const e=(0,_index3.resolveHaptic)(p,"selection");e&&(0,_index3.triggerHaptic)(e)}return void C.current[e]?.blur()}const l=O.slice();let c=e;for(let e=0;e<r.length&&c<s;e+=1)l[c]=r[e]??"",c+=1;const u=l.join("").slice(0,s),d=b.length;if(B(u),u.length!==d){const e=(0,_index3.resolveHaptic)(p,"selection");e&&(0,_index3.triggerHaptic)(e)}const _=Math.min(c,s-1);c>=s?C.current[e]?.blur():M(_)},[O,M,o,s,p,B,b]),P=(0,_react.useCallback)((e,t)=>{if("Backspace"!==t.nativeEvent.key)return;if(0===(O[e]??"").length){if(e>0){const t=O.slice();t[e-1]="",B(t.join("")),M(e-1)}}else{const t=O.slice();t[e]="",B(t.join(""))}},[O,M,B]),q=(0,_react.useCallback)(e=>{S(e)},[]),H=(0,_react.useCallback)(()=>{S(-1)},[]),W=(0,_react.useCallback)(()=>{if(u)return;const e=O.findIndex(e=>""===e);M(-1===e?s-1:e)},[O,u,M,s]),L=f??`Enter ${s}-digit code`,$=F.interpolate({inputRange:[-1,1],outputRange:[-6,6]});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:g,accessible:!0,accessibilityRole:"none",accessibilityLabel:L,accessibilityValue:{text:i},accessibilityState:{disabled:u},testID:v,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:W,disabled:u,accessible:!1,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[N.row,{columnGap:R.gap,transform:[{translateX:$}]}],children:O.map((e,t)=>{const i=T===t,r=e.length>0,n=A?j.colors.border.error:j.colors.border.focus,a=z[t];if(!a)return null;const l=m&&r?"●":e;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:N.cellWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:_,width:R.cell,height:R.cell,borderRadius:R.borderRadius,borderWidth:1.5,focused:i,error:A,filled:r,disabled:u,paddingHorizontal:0,paddingVertical:0,gap:0,style:x,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:e=>{C.current[t]=e},value:(m&&r?"":e)||"​",onChangeText:e=>D(t,e),onKeyPress:e=>P(t,e),onFocus:()=>q(t),onBlur:H,keyboardType:o,editable:!u,selectTextOnFocus:!0,caretHidden:r,maxLength:s+1,textContentType:"oneTimeCode",autoComplete:0===t?"sms-otp":"off",importantForAutofill:0===t?"yes":"no",style:[N.input,{fontSize:R.fontSize,color:j.colors.text.primary,...(0,_index2.fontFor)(j,"semibold")},h]}),m&&r?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:N.maskOverlay,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{fontSize:R.fontSize,color:j.colors.text.primary,...(0,_index2.fontFor)(j,"semibold")},h],children:l})}):null]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[N.underline,{backgroundColor:n,opacity:a}]})]},`otp-cell-${t}`)})})}),(0,_jsxRuntime.jsx)(_FieldBase.FieldMessage,{size:_,error:!0,text:d})]})});OTPInput.displayName="OTPInput";const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},cellWrapper:{alignItems:"center"},input:{width:"100%",height:"100%",textAlign:"center",padding:0},maskOverlay:{..._reactNative.StyleSheet.absoluteFill,alignItems:"center",justifyContent:"center"},underline:{marginTop:4,height:2,width:"60%",borderRadius:1,..._corners.smoothCorners}});var _default=exports.default=OTPInput;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.OptionSheet=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useDragToDismiss=require("../../hooks/useDragToDismiss.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap,i=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var o,a,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(o=t?i:r){if(o.has(e))return o.get(e);o.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?o(s,t,a):s[t]=e[t]);return s})(e,t)}const SEARCH_ICON_SIZE=18,OptionSheet=e=>{const{open:t,onClose:r,onAfterClose:i,title:o,options:a,sections:s,renderSectionHeader:n,renderOption:l,alphabetIndex:c=!1,searchPlaceholder:d="Search…",emptyText:u="No options",labelOf:p,getValue:m,disabledOf:h,destructiveOf:g,descriptionOf:_,iconOf:x,isSelected:y,onSelect:f,multi:b=!1,searchable:v=!1,searchSelectionColor:j,accessibilityLabel:R,optionStyle:S,selectedOptionStyle:N,optionTextStyle:T,selectedOptionTextStyle:C,testID:w}=e,k=(0,_index.useTheme)(),V=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),I=(0,_react.useMemo)(()=>buildStyles(k),[k]),[P,D]=(0,_react.useState)(""),W=_reactNative.Dimensions.get("window").height,z=Math.round(.7*W),[L,H]=(0,_react.useState)(t),O=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,M=(0,_react.useRef)((0,_index.createAnimatedValue)(z)).current,A=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,B=(0,_react.useMemo)(()=>_reactNative.Animated.add(M,A),[M,A]);(0,_react.useEffect)(()=>{t&&H(!0)},[t]);const q=(0,_react.useRef)(i);q.current=i;const E=(0,_react.useRef)(L);(0,_react.useEffect)(()=>{E.current&&!L&&"ios"!==_reactNative.Platform.OS&&q.current?.(),E.current=L},[L]),(0,_react.useEffect)(()=>{if(!L)return;t&&(0,_index.setNativeValue)(A,0);const e=t?_reactNative.Animated.parallel([_reactNative.Animated.timing(O,{toValue:1,duration:k.motion.duration.fast,easing:_reactNative.Easing.bezier(...k.motion.easing.standard),useNativeDriver:!1}),_reactNative.Animated.spring(M,{toValue:0,damping:k.motion.spring.snappy.damping,stiffness:k.motion.spring.snappy.stiffness,mass:k.motion.spring.snappy.mass,useNativeDriver:!0})]):_reactNative.Animated.parallel([_reactNative.Animated.timing(O,{toValue:0,duration:k.motion.duration.fast,easing:_reactNative.Easing.bezier(...k.motion.easing.standard),useNativeDriver:!1}),_reactNative.Animated.timing(M,{toValue:z,duration:k.motion.duration.fast,easing:_reactNative.Easing.bezier(...k.motion.easing.accelerate),useNativeDriver:!0})]);return e.start(({finished:e})=>{e&&!t&&H(!1)}),()=>e.stop()},[t,L,O,M,A,z,k.motion.duration.fast,k.motion.easing.standard,k.motion.easing.accelerate,k.motion.spring.snappy]);const{handleGesture:F}=(0,_useDragToDismiss.useDragToDismiss)({drag:A,travel:z,onDismiss:r}),G=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Native(),[]),[$,K]=(0,_react.useState)(0),J=(0,_reactNativeKeyboardController.useKeyboardState)(e=>e.height),U=L?Math.max(0,Math.round(J)):0,Y=Math.max(V.top,_reactNative.StatusBar.currentHeight??0)+k.spacing.sm,Z=U>0,Q=Z?Math.max(0,Math.min(z,($>0?$:W)-U-Y)):z;(0,_react.useEffect)(()=>{t||D("")},[t]);const X=(0,_react.useMemo)(()=>{const e=v?P.trim().toLowerCase():"",matches=t=>0===e.length||p(t).toLowerCase().includes(e)||(_(t)??"").toLowerCase().includes(e);if(!s)return a.filter(matches).map(e=>({kind:"option",option:e}));const t=[];return s.forEach((e,r)=>{const i=e.options.filter(matches);if(0!==i.length){t.push({kind:"header",title:e.title});for(const e of i)t.push({kind:"option",option:e,section:r})}}),t},[v,P,a,s,p,_]),ee=(0,_react.useCallback)(()=>{r()},[r]),te=(0,_react.useRef)(null),re=(0,_react.useMemo)(()=>{const e=new Map;if(!c)return e;let t=0;if(s)for(let e=X.length-1;e>=0;e-=1)if("header"===X[e].kind){t=e+1;break}for(let r=t;r<X.length;r+=1){const t=X[r];if("option"!==t.kind)continue;const i=p(t.option).trim().charAt(0).toUpperCase(),o=/^[A-Z]$/.test(i)?i:"#";e.has(o)||e.set(o,r)}return e},[c,X,s,p]),ie=c&&re.size>0&&0===P.trim().length,oe=(0,_react.useMemo)(()=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ",...re.has("#")?["#"]:[]],[re]),ae=(0,_react.useCallback)(e=>{const t=re.get(e);void 0!==t&&te.current?.scrollToIndex({index:t,animated:!0,viewPosition:0})},[re]),se=(0,_react.useRef)(null),ne=(0,_react.useCallback)(()=>{null!==se.current&&(clearTimeout(se.current),se.current=null)},[]),le=(0,_react.useCallback)(e=>{te.current?.scrollToOffset({offset:e.averageItemLength*e.index,animated:!1}),ne(),se.current=setTimeout(()=>{se.current=null,te.current?.scrollToIndex({index:e.index,animated:!0,viewPosition:0})},50)},[ne]);(0,_react.useEffect)(()=>(L||ne(),ne),[L,ne]);return(0,_jsxRuntime.jsx)(_reactNative.Modal,{visible:L,transparent:!0,animationType:"none",onRequestClose:ee,onDismiss:()=>q.current?.(),statusBarTranslucent:!0,navigationBarTranslucent:!0,children:(0,_jsxRuntime.jsxs)(_reactNativeGestureHandler.GestureHandlerRootView,{collapsable:!1,onLayout:e=>K(e.nativeEvent.layout.height),style:[_reactNative.StyleSheet.absoluteFill,{backgroundColor:k.colors.background.overlay}],children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_reactNative.StyleSheet.absoluteFill,onPress:ee,accessibilityRole:"button",accessibilityLabel:"Close picker"}),(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{testID:w,accessibilityViewIsModal:!0,accessibilityLabel:R??o??"Options",style:[I.sheet,{maxHeight:Q,bottom:U,paddingBottom:Z?16:V.bottom+16,backgroundColor:k.colors.background.elevated,borderTopLeftRadius:k.radius.xl,borderTopRightRadius:k.radius.xl,..._corners.smoothCorners,transform:[{translateY:B}],...k.shadows.xl}],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:F,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:I.sheetHandleRow,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[I.sheetHandle,{backgroundColor:k.components.select?.handleColor??k.components.bottomSheet?.handleColor??k.colors.border.primary}]})}),o?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[I.sheetTitle,{color:k.colors.text.primary,fontSize:k.typography.fontSize.lg,fontWeight:k.typography.fontWeight.semibold,paddingHorizontal:k.spacing.lg,marginBottom:k.spacing.sm}],children:o}):null]})}),v?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[I.searchWrap,{marginHorizontal:k.spacing.lg,marginBottom:k.spacing.sm}],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[I.searchBox,{backgroundColor:k.colors.background.secondary,borderColor:k.colors.border.primary,borderRadius:k.radius.md,..._corners.smoothCorners,paddingHorizontal:k.spacing.md,gap:k.spacing.sm}],children:[(k.icons?.search??_defaultIcons.defaultIcons.search)({size:18,color:k.colors.text.tertiary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{value:P,onChangeText:D,placeholder:d,placeholderTextColor:k.colors.text.tertiary,selectionColor:j??k.colors.border.focus,accessibilityLabel:"Search options",style:[I.searchInput,{color:k.colors.text.primary,fontSize:k.typography.fontSize.base,paddingVertical:k.spacing.sm}]}),P.length>0?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>D(""),hitSlop:8,accessibilityRole:"button",accessibilityLabel:"Clear search",children:(k.icons?.close??_defaultIcons.defaultIcons.close)({size:18,color:k.colors.text.secondary})}):null]})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[I.listWrap,ie?I.listRow:null],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:G,children:(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:te,data:X,keyExtractor:e=>"header"===e.kind?`h:${e.title}`:`o:${e.section??""}:${String(m(e.option))}`,renderItem:({item:e})=>{if("header"===e.kind)return(0,_jsxRuntime.jsx)(_reactNative.View,{accessible:!0,accessibilityRole:"header",style:[I.sectionHeader,{paddingHorizontal:k.spacing.lg,paddingTop:k.spacing.md}],children:n?n(e.title):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[I.sectionTitle,{color:k.colors.text.tertiary,fontSize:k.typography.fontSize.xs,fontWeight:k.typography.fontWeight.semibold}],children:e.title.toUpperCase()})});const t=e.option,r=p(t),i=m(t),o=_(t),a=x(t),s=y(i),c=h(t),d=g?.(t)??!1;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>f(t),disabled:c,android_ripple:{color:k.colors.surface.pressed,borderless:!1},accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{selected:s,disabled:c},style:({pressed:e})=>[I.optionRow,{backgroundColor:s?k.colors.surface.selected:e?k.colors.surface.pressed:"transparent",opacity:c?.5:1,paddingHorizontal:k.spacing.lg,paddingVertical:k.spacing.md},S,s?N:null],children:[l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:I.optionTextWrap,children:l(t,{selected:s,disabled:c})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:I.optionIcon,children:a}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:I.optionTextWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[I.optionLabel,{color:d?k.colors.error:s?k.colors.primary:k.colors.text.primary,fontSize:k.typography.fontSize.base,fontWeight:s?k.typography.fontWeight.semibold:k.typography.fontWeight.medium},T,s?C:null],numberOfLines:1,children:r}),o?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[I.optionDescription,{color:k.colors.text.tertiary,fontSize:k.typography.fontSize.sm}],numberOfLines:2,children:o}):null]})]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[I.checkbox,{borderColor:s?k.colors.primary:k.colors.border.primary,backgroundColor:s?k.colors.primary:"transparent"}],children:s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:I.checkboxTick}):null}):s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[I.singleSelectedDot,{backgroundColor:k.colors.primary}]}):null]})},onScrollToIndexFailed:le,overScrollMode:"never",bounces:!1,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:!ie,style:ie?I.listBesideRail:null,ListEmptyComponent:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[I.empty,{color:k.colors.text.tertiary,fontSize:k.typography.fontSize.sm,paddingVertical:k.spacing.xl}],children:u})})}),ie?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[I.rail,{paddingRight:k.spacing.xs}],accessibilityRole:"list",accessibilityLabel:"Jump to letter",testID:"option-sheet-alphabet",children:oe.map(e=>{const t=re.has(e);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>ae(e),disabled:!t,hitSlop:{left:8,right:8},accessibilityRole:"button",accessibilityLabel:`Jump to ${e}`,accessibilityState:{disabled:!t},style:I.railLetter,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[I.railLetterText,{color:t?k.colors.primary:k.colors.text.tertiary,fontSize:k.typography.fontSize.xs,fontWeight:k.typography.fontWeight.semibold,opacity:t?1:.45}],children:e})},e)})}):null]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[I.sheetFooter,{borderTopColor:k.colors.border.secondary,paddingHorizontal:k.spacing.lg,paddingVertical:k.spacing.md}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:ee,accessibilityRole:"button",accessibilityLabel:"Done",style:({pressed:e})=>[I.doneButton,{backgroundColor:e?k.colors.primaryPressed:k.colors.primary,borderRadius:k.radius.md,..._corners.smoothCorners,paddingVertical:k.spacing.sm,paddingHorizontal:k.spacing.lg}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:k.colors.onPrimary,fontSize:k.typography.fontSize.base,fontWeight:k.typography.fontWeight.semibold},children:"Done"})})}):null]}),(0,_jsxRuntime.jsx)(_ToastProvider.ToastHost,{})]})})};exports.OptionSheet=OptionSheet,OptionSheet.displayName="OptionSheet";const buildStyles=e=>_reactNative.StyleSheet.create({sheet:{position:"absolute",left:0,right:0,bottom:0,paddingBottom:16,overflow:"hidden"},sheetHandleRow:{alignItems:"center",paddingTop:10,paddingBottom:8},sheetHandle:{width:36,height:4,borderRadius:2,..._corners.smoothCorners},sheetTitle:{includeFontPadding:!1},searchWrap:{width:"auto"},searchBox:{flexDirection:"row",alignItems:"center",borderWidth:1},searchInput:{flex:1,includeFontPadding:!1},optionRow:{flexDirection:"row",alignItems:"center"},sectionHeader:{paddingBottom:4},listWrap:{flexShrink:1},listRow:{flexDirection:"row"},listBesideRail:{flex:1},rail:{justifyContent:"space-between",alignItems:"center",alignSelf:"stretch",paddingVertical:4},railLetter:{paddingHorizontal:4,minHeight:14,justifyContent:"center"},railLetterText:{includeFontPadding:!1,lineHeight:14},sectionTitle:{includeFontPadding:!1,letterSpacing:.6},optionIcon:{marginRight:12},optionTextWrap:{flex:1},optionLabel:{includeFontPadding:!1},optionDescription:{includeFontPadding:!1,marginTop:2},checkbox:{width:22,height:22,borderRadius:6,..._corners.smoothCorners,borderWidth:2,alignItems:"center",justifyContent:"center",marginLeft:12},checkboxTick:{width:10,height:6,borderLeftWidth:2,borderBottomWidth:2,borderColor:e.colors.onPrimary,transform:[{rotate:"-45deg"},{translateY:-1}]},singleSelectedDot:{width:8,height:8,borderRadius:4,..._corners.smoothCorners,marginLeft:12},empty:{textAlign:"center"},sheetFooter:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,alignItems:"flex-end"},doneButton:{alignSelf:"flex-end"}});var _default=exports.default=OptionSheet;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.OptionSheet=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useDragToDismiss=require("../../hooks/useDragToDismiss.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_ToastProvider=require("../Toast/ToastProvider.js"),_jsxRuntime=require("react/jsx-runtime");const SEARCH_ICON_SIZE=18,OptionSheet=e=>{const{open:t,onClose:i,onAfterClose:r,title:o,options:a,sections:s,renderSectionHeader:n,renderOption:l,alphabetIndex:c=!1,searchPlaceholder:d="Search…",emptyText:u="No options",labelOf:p,getValue:m,disabledOf:h,destructiveOf:g,descriptionOf:x,iconOf:_,isSelected:y,onSelect:f,multi:b=!1,searchable:v=!1,searchSelectionColor:j,accessibilityLabel:R,optionStyle:S,selectedOptionStyle:N,optionTextStyle:T,selectedOptionTextStyle:C,testID:w}=e,k=(0,_index.useTheme)(),I=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),V=(0,_react.useMemo)(()=>buildStyles(k),[k]),[z,D]=(0,_react.useState)(""),L=_reactNative.Dimensions.get("window").height,P=Math.round(.7*L),[H,W]=(0,_react.useState)(t),O=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,A=(0,_react.useRef)((0,_index.createAnimatedValue)(P)).current,M=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,B=(0,_react.useMemo)(()=>_reactNative.Animated.add(A,M),[A,M]);(0,_react.useEffect)(()=>{t&&W(!0)},[t]);const E=(0,_react.useRef)(r);E.current=r;const F=(0,_react.useRef)(H);(0,_react.useEffect)(()=>{F.current&&!H&&"ios"!==_reactNative.Platform.OS&&E.current?.(),F.current=H},[H]),(0,_react.useEffect)(()=>{if(!H)return;t&&(0,_index.setNativeValue)(M,0);const e=t?_reactNative.Animated.parallel([_reactNative.Animated.timing(O,{toValue:1,duration:k.motion.duration.fast,easing:_reactNative.Easing.bezier(...k.motion.easing.standard),useNativeDriver:!1}),_reactNative.Animated.spring(A,{toValue:0,damping:k.motion.spring.snappy.damping,stiffness:k.motion.spring.snappy.stiffness,mass:k.motion.spring.snappy.mass,useNativeDriver:!0})]):_reactNative.Animated.parallel([_reactNative.Animated.timing(O,{toValue:0,duration:k.motion.duration.fast,easing:_reactNative.Easing.bezier(...k.motion.easing.standard),useNativeDriver:!1}),_reactNative.Animated.timing(A,{toValue:P,duration:k.motion.duration.fast,easing:_reactNative.Easing.bezier(...k.motion.easing.accelerate),useNativeDriver:!0})]);return e.start(({finished:e})=>{e&&!t&&W(!1)}),()=>e.stop()},[t,H,O,A,M,P,k.motion.duration.fast,k.motion.easing.standard,k.motion.easing.accelerate,k.motion.spring.snappy]);const{handleGesture:q}=(0,_useDragToDismiss.useDragToDismiss)({drag:M,travel:P,onDismiss:i}),G=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Native(),[]),[$,K]=(0,_react.useState)(0),J=(0,_reactNativeKeyboardController.useKeyboardState)(e=>e.height),U=H?Math.max(0,Math.round(J)):0,Y=Math.max(I.top,_reactNative.StatusBar.currentHeight??0)+k.spacing.sm,Z=U>0,Q=Z?Math.max(0,Math.min(P,($>0?$:L)-U-Y)):P;(0,_react.useEffect)(()=>{t||D("")},[t]);const X=(0,_react.useMemo)(()=>{const e=v?z.trim().toLowerCase():"",matches=t=>0===e.length||p(t).toLowerCase().includes(e)||(x(t)??"").toLowerCase().includes(e);if(!s)return a.filter(matches).map(e=>({kind:"option",option:e}));const t=[];return s.forEach((e,i)=>{const r=e.options.filter(matches);if(0!==r.length){t.push({kind:"header",title:e.title});for(const e of r)t.push({kind:"option",option:e,section:i})}}),t},[v,z,a,s,p,x]),ee=(0,_react.useCallback)(()=>{i()},[i]),te=(0,_react.useRef)(null),ie=(0,_react.useMemo)(()=>{const e=new Map;if(!c)return e;let t=0;if(s)for(let e=X.length-1;e>=0;e-=1)if("header"===X[e].kind){t=e+1;break}for(let i=t;i<X.length;i+=1){const t=X[i];if("option"!==t.kind)continue;const r=p(t.option).trim().charAt(0).toUpperCase(),o=/^[A-Z]$/.test(r)?r:"#";e.has(o)||e.set(o,i)}return e},[c,X,s,p]),re=c&&ie.size>0&&0===z.trim().length,oe=(0,_react.useMemo)(()=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ",...ie.has("#")?["#"]:[]],[ie]),ae=(0,_react.useCallback)(e=>{const t=ie.get(e);void 0!==t&&te.current?.scrollToIndex({index:t,animated:!0,viewPosition:0})},[ie]),se=(0,_react.useRef)(null),ne=(0,_react.useCallback)(()=>{null!==se.current&&(clearTimeout(se.current),se.current=null)},[]),le=(0,_react.useCallback)(e=>{te.current?.scrollToOffset({offset:e.averageItemLength*e.index,animated:!1}),ne(),se.current=setTimeout(()=>{se.current=null,te.current?.scrollToIndex({index:e.index,animated:!0,viewPosition:0})},50)},[ne]);(0,_react.useEffect)(()=>(H||ne(),ne),[H,ne]);return(0,_jsxRuntime.jsx)(_reactNative.Modal,{visible:H,transparent:!0,animationType:"none",onRequestClose:ee,onDismiss:()=>E.current?.(),statusBarTranslucent:!0,navigationBarTranslucent:!0,children:(0,_jsxRuntime.jsxs)(_reactNativeGestureHandler.GestureHandlerRootView,{collapsable:!1,onLayout:e=>K(e.nativeEvent.layout.height),style:[_reactNative.StyleSheet.absoluteFill,{backgroundColor:k.colors.background.overlay}],children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_reactNative.StyleSheet.absoluteFill,onPress:ee,accessibilityRole:"button",accessibilityLabel:"Close picker"}),(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{testID:w,accessibilityViewIsModal:!0,accessibilityLabel:R??o??"Options",style:[V.sheet,{maxHeight:Q,bottom:U,paddingBottom:Z?16:I.bottom+16,backgroundColor:k.colors.background.elevated,borderTopLeftRadius:k.radius.xl,borderTopRightRadius:k.radius.xl,..._corners.smoothCorners,transform:[{translateY:B}],...k.shadows.xl}],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:q,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:V.sheetHandleRow,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.sheetHandle,{backgroundColor:k.components.select?.handleColor??k.components.bottomSheet?.handleColor??k.colors.border.primary}]})}),o?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[V.sheetTitle,{color:k.colors.text.primary,fontSize:k.typography.fontSize.lg,fontWeight:k.typography.fontWeight.semibold,paddingHorizontal:k.spacing.lg,marginBottom:k.spacing.sm}],children:o}):null]})}),v?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.searchWrap,{marginHorizontal:k.spacing.lg,marginBottom:k.spacing.sm}],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[V.searchBox,{backgroundColor:k.colors.background.secondary,borderColor:k.colors.border.primary,borderRadius:k.radius.md,..._corners.smoothCorners,paddingHorizontal:k.spacing.md,gap:k.spacing.sm}],children:[(k.icons?.search??_defaultIcons.defaultIcons.search)({size:18,color:k.colors.text.tertiary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{value:z,onChangeText:D,placeholder:d,placeholderTextColor:k.colors.text.tertiary,selectionColor:j??k.colors.border.focus,accessibilityLabel:"Search options",style:[V.searchInput,{color:k.colors.text.primary,fontSize:k.typography.fontSize.base,paddingVertical:k.spacing.sm}]}),z.length>0?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>D(""),hitSlop:8,accessibilityRole:"button",accessibilityLabel:"Clear search",children:(k.icons?.close??_defaultIcons.defaultIcons.close)({size:18,color:k.colors.text.secondary})}):null]})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[V.listWrap,re?V.listRow:null],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:G,children:(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:te,data:X,keyExtractor:e=>"header"===e.kind?`h:${e.title}`:`o:${e.section??""}:${String(m(e.option))}`,renderItem:({item:e})=>{if("header"===e.kind)return(0,_jsxRuntime.jsx)(_reactNative.View,{accessible:!0,accessibilityRole:"header",style:[V.sectionHeader,{paddingHorizontal:k.spacing.lg,paddingTop:k.spacing.md}],children:n?n(e.title):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[V.sectionTitle,{color:k.colors.text.tertiary,fontSize:k.typography.fontSize.xs,fontWeight:k.typography.fontWeight.semibold}],children:e.title.toUpperCase()})});const t=e.option,i=p(t),r=m(t),o=x(t),a=_(t),s=y(r),c=h(t),d=g?.(t)??!1;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>f(t),disabled:c,android_ripple:{color:k.colors.surface.pressed,borderless:!1},accessibilityRole:"button",accessibilityLabel:i,accessibilityState:{selected:s,disabled:c},style:({pressed:e})=>[V.optionRow,{backgroundColor:s?k.colors.surface.selected:e?k.colors.surface.pressed:"transparent",opacity:c?.5:1,paddingHorizontal:k.spacing.lg,paddingVertical:k.spacing.md},S,s?N:null],children:[l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:V.optionTextWrap,children:l(t,{selected:s,disabled:c})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:V.optionIcon,children:a}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:V.optionTextWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[V.optionLabel,{color:d?k.colors.error:s?k.colors.primary:k.colors.text.primary,fontSize:k.typography.fontSize.base,fontWeight:s?k.typography.fontWeight.semibold:k.typography.fontWeight.medium},T,s?C:null],children:i}),o?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[V.optionDescription,{color:k.colors.text.tertiary,fontSize:k.typography.fontSize.sm}],numberOfLines:2,children:o}):null]})]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.checkbox,{borderColor:s?k.colors.primary:k.colors.border.primary,backgroundColor:s?k.colors.primary:"transparent"}],children:s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:V.checkboxTick}):null}):s?"icon"===k.components.optionSheet?.selectedMarker?(0,_jsxRuntime.jsx)(_reactNative.View,{style:V.singleSelectedIcon,children:(k.icons?.selectedTick??_defaultIcons.defaultIcons.selectedTick)({size:20,color:k.colors.primary})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.singleSelectedDot,{backgroundColor:k.colors.primary}]}):null]})},onScrollToIndexFailed:le,overScrollMode:"never",bounces:!1,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:!re,style:re?V.listBesideRail:null,ListEmptyComponent:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[V.empty,{color:k.colors.text.tertiary,fontSize:k.typography.fontSize.sm,paddingVertical:k.spacing.xl}],children:u})})}),re?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.rail,{paddingRight:k.spacing.xs}],accessibilityRole:"list",accessibilityLabel:"Jump to letter",testID:"option-sheet-alphabet",children:oe.map(e=>{const t=ie.has(e);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>ae(e),disabled:!t,hitSlop:{left:8,right:8},accessibilityRole:"button",accessibilityLabel:`Jump to ${e}`,accessibilityState:{disabled:!t},style:V.railLetter,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[V.railLetterText,{color:t?k.colors.primary:k.colors.text.tertiary,fontSize:k.typography.fontSize.xs,fontWeight:k.typography.fontWeight.semibold,opacity:t?1:.45}],children:e})},e)})}):null]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.sheetFooter,{borderTopColor:k.colors.border.secondary,paddingHorizontal:k.spacing.lg,paddingVertical:k.spacing.md}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:ee,accessibilityRole:"button",accessibilityLabel:"Done",style:({pressed:e})=>[V.doneButton,{backgroundColor:e?k.colors.primaryPressed:k.colors.primary,borderRadius:k.radius.md,..._corners.smoothCorners,paddingVertical:k.spacing.sm,paddingHorizontal:k.spacing.lg}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:k.colors.onPrimary,fontSize:k.typography.fontSize.base,fontWeight:k.typography.fontWeight.semibold},children:"Done"})})}):null]}),(0,_jsxRuntime.jsx)(_ToastProvider.ToastHost,{})]})})};exports.OptionSheet=OptionSheet,OptionSheet.displayName="OptionSheet";const buildStyles=e=>_reactNative.StyleSheet.create({sheet:{position:"absolute",left:0,right:0,bottom:0,paddingBottom:16,overflow:"hidden"},sheetHandleRow:{alignItems:"center",paddingTop:10,paddingBottom:8},sheetHandle:{width:36,height:4,borderRadius:2,..._corners.smoothCorners},sheetTitle:{includeFontPadding:!1},searchWrap:{width:"auto"},searchBox:{flexDirection:"row",alignItems:"center",borderWidth:1},searchInput:{flex:1,includeFontPadding:!1},optionRow:{flexDirection:"row",alignItems:"center"},sectionHeader:{paddingBottom:4},listWrap:{flexShrink:1},listRow:{flexDirection:"row"},listBesideRail:{flex:1},rail:{justifyContent:"space-between",alignItems:"center",alignSelf:"stretch",paddingVertical:4},railLetter:{paddingHorizontal:4,minHeight:14,justifyContent:"center"},railLetterText:{includeFontPadding:!1,lineHeight:14},sectionTitle:{includeFontPadding:!1,letterSpacing:.6},optionIcon:{marginRight:12},optionTextWrap:{flex:1},optionLabel:{includeFontPadding:!1},optionDescription:{includeFontPadding:!1,marginTop:2},checkbox:{width:22,height:22,borderRadius:6,..._corners.smoothCorners,borderWidth:2,alignItems:"center",justifyContent:"center",marginLeft:12},checkboxTick:{width:10,height:6,borderLeftWidth:2,borderBottomWidth:2,borderColor:e.colors.onPrimary,transform:[{rotate:"-45deg"},{translateY:-1}]},singleSelectedDot:{width:8,height:8,borderRadius:4,..._corners.smoothCorners,marginLeft:12},singleSelectedIcon:{marginLeft:12},empty:{textAlign:"center"},sheetFooter:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,alignItems:"flex-end"},doneButton:{alignSelf:"flex-end"}});var _default=exports.default=OptionSheet;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.PickerTrigger=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../FieldBase/index.js"),_Chevron=require("../FieldBase/Chevron.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,i){if("function"==typeof WeakMap)var t=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,i){if(!i&&e&&e.__esModule)return e;var l,n,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(l=i?r:t){if(l.has(e))return l.get(e);l.set(e,s)}for(const i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((n=(l=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,i))&&(n.get||n.set)?l(s,i,n):s[i]=e[i]);return s})(e,i)}const PickerTrigger=exports.PickerTrigger=(0,_react.forwardRef)((e,i)=>{const{value:t,placeholder:r,label:l,help:n,helperText:s,error:a,required:o=!1,onPress:d,clearable:c=!1,onClear:u,leadingIcon:x,trailing:_,disabled:g=!1,size:y="md",variant:f,style:b,triggerStyle:p,valueStyle:j,labelStyle:v,messageStyle:h,accessibilityLabel:m,testID:S}=e,R=(0,_index.useTheme)(),P=(0,_react.useMemo)(()=>buildStyles(R),[R]),T=(0,_index2.resolveFieldSize)(R,y),q=(0,_index2.resolveFieldTextStyle)(R,{disabled:g}),w="string"==typeof t&&t.length>0,z=(0,_index2.hasFieldText)(a),F=(0,_index2.hasFieldText)(l),k=w?t:r??"Select…",M=w?q.color:q.placeholderColor,N=w?`${(0,_index2.fieldTextAsString)(l)??"Selection"}: ${t}`:r??"No selection",C=m??N,O={disabled:g},W=void 0===_,L=c&&w&&!g;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[P.root,b],testID:S,children:[F?(0,_jsxRuntime.jsx)(_index2.FieldLabel,{size:y,required:o,help:n,style:v,children:l}):null,(0,_jsxRuntime.jsx)(_index2.FieldBase,{size:y,variant:f,disabled:g,error:z,filled:w,onPress:d,leading:x,trailing:L||W||null!==_?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:P.trailingRow,children:[L?(0,_jsxRuntime.jsx)(_reactNative.Text,{onPress:()=>{g||u?.()},accessibilityRole:"button",accessibilityLabel:"Clear",style:{fontSize:T.iconSize,color:R.colors.text.secondary,paddingHorizontal:4},children:"×"}):null,void 0!==_?_:W?(0,_jsxRuntime.jsx)(_Chevron.Chevron,{size:T.iconSize,color:g?R.colors.text.disabled:R.colors.text.tertiary}):null]}):null,accessibilityLabel:C,accessibilityState:O,accessibilityRole:"button",style:p,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{numberOfLines:1,style:[P.valueText,{color:M,fontSize:T.fontSize,...q.weightStyle},j],children:[k,w||!o||F?null:(0,_jsxRuntime.jsx)(_index2.RequiredMark,{})]})}),(0,_jsxRuntime.jsx)(_index2.FieldMessage,{size:y,error:z,text:z?a:s,style:h})]})});PickerTrigger.displayName="PickerTrigger";const buildStyles=e=>_reactNative.StyleSheet.create({root:{width:"100%"},label:{includeFontPadding:!1},valueText:{flex:1,includeFontPadding:!1},message:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center"}});var _default=exports.default=PickerTrigger;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.PickerTrigger=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../FieldBase/index.js"),_Chevron=require("../FieldBase/Chevron.js"),_jsxRuntime=require("react/jsx-runtime");const PickerTrigger=exports.PickerTrigger=(0,_react.forwardRef)((e,i)=>{const{value:t,placeholder:r,label:l,help:s,helperText:n,error:a,required:d=!1,onPress:o,clearable:c=!1,onClear:x,leadingIcon:u,trailing:_,disabled:g=!1,size:y="md",variant:b,style:v,triggerStyle:j,valueStyle:h,labelStyle:m,messageStyle:S,accessibilityLabel:R,testID:T}=e,f=(0,_index.useTheme)(),p=(0,_react.useMemo)(()=>buildStyles(f),[f]),P=(0,_index2.resolveFieldSize)(f,y),z=(0,_index2.resolveFieldTextStyle)(f,{disabled:g}),F="string"==typeof t&&t.length>0,q=!0===a||(0,_index2.hasFieldText)(a),w=(0,_index2.hasFieldText)(l),N=F?t:r??"Select…",k=F?z.color:z.placeholderColor,C=F?`${(0,_index2.fieldTextAsString)(l)??"Selection"}: ${t}`:r??"No selection",L=R??C,I={disabled:g},M=void 0===_,B=c&&F&&!g;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[p.root,v],testID:T,children:[w?(0,_jsxRuntime.jsx)(_index2.FieldLabel,{size:y,required:d,help:s,style:m,children:l}):null,(0,_jsxRuntime.jsx)(_index2.FieldBase,{size:y,variant:b,disabled:g,error:q,filled:F,onPress:o,leading:u,trailing:B||M||null!==_?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:p.trailingRow,children:[B?(0,_jsxRuntime.jsx)(_reactNative.Text,{onPress:()=>{g||x?.()},accessibilityRole:"button",accessibilityLabel:"Clear",style:{fontSize:P.iconSize,color:f.colors.text.secondary,paddingHorizontal:4},children:"×"}):null,void 0!==_?_:M?(0,_jsxRuntime.jsx)(_Chevron.Chevron,{size:P.iconSize,color:g?f.colors.text.disabled:f.colors.text.tertiary}):null]}):null,accessibilityLabel:L,accessibilityState:I,accessibilityRole:"button",style:j,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{numberOfLines:1,style:[p.valueText,{color:k,fontSize:P.fontSize,...z.weightStyle},h],children:[N,F||!d||w?null:(0,_jsxRuntime.jsx)(_index2.RequiredMark,{})]})}),(0,_jsxRuntime.jsx)(_index2.FieldMessage,{size:y,error:q,text:q?a:n,style:S})]})});PickerTrigger.displayName="PickerTrigger";const buildStyles=e=>_reactNative.StyleSheet.create({root:{width:"100%"},label:{includeFontPadding:!1},valueText:{flex:1,includeFontPadding:!1},message:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center"}});var _default=exports.default=PickerTrigger;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Select=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_Chevron=require("../FieldBase/Chevron.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var i=new WeakMap,l=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var r,n,o={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return o;if(r=t?l:i){if(r.has(e))return r.get(e);r.set(e,o)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((n=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(n.get||n.set)?r(o,t,n):o[t]=e[t]);return o})(e,t)}const sameSelectValue=(e,t)=>String(e)===String(t),containsValue=(e,t)=>e.some(e=>sameSelectValue(e,t)),Select=exports.Select=(0,_react.forwardRef)((e,t)=>{const{options:i,getOptionLabel:l,getOptionValue:r,getOptionDisabled:n,getOptionDescription:o,getOptionIcon:s,placeholder:a,searchable:c=!1,haptic:d,label:u,help:p,title:_,required:x=!1,error:f,helperText:b,prefix:h,numberOfLines:g=1,disabled:S=!1,size:v="md",variant:m,leftIcon:y,rightIcon:j,chevronColor:F,chevronSize:O,borderRadius:R,accessibilityLabel:C,labelStyle:k,style:V,triggerStyle:z,textStyle:B,optionStyle:T,selectedOptionStyle:q,optionTextStyle:I,selectedOptionTextStyle:N,testID:w}=e,M=!0===e.multi,H=(0,_react.useCallback)(e=>l?l(e):e.label??"",[l]),L=(0,_react.useCallback)(e=>r?r(e):e.value,[r]),P=(0,_react.useCallback)(e=>n?n(e):!0===e.disabled,[n]),D=(0,_react.useCallback)(e=>o?o(e):e.description,[o]),W=(0,_react.useCallback)(e=>s?s(e):e.icon,[s]),E=(0,_index.useTheme)(),A=(0,_react.useMemo)(()=>buildStyles(E),[E]),$=(0,_FieldBase.resolveFieldSize)(E,v),G=(0,_FieldBase.resolveFieldTextStyle)(E,{disabled:S}),J=m??E.components.select?.defaultVariant??E.components.field?.defaultVariant??"outlined",K=(0,_react.useMemo)(()=>{const e=E.components.select?.fillColors?.[J];if(!e)return;const t={};return void 0!==e.idleEmpty&&(t.backgroundIdleEmpty=e.idleEmpty),void 0!==e.idleFilled&&(t.backgroundIdleFilled=e.idleFilled),void 0!==e.focus&&(t.backgroundFocused=e.focus),void 0!==e.error&&(t.backgroundError=e.error),void 0!==e.disabled&&(t.backgroundDisabled=e.disabled),Object.keys(t).length>0?t:void 0},[E.components.select?.fillColors,J]),Q=R??E.components.select?.borderRadius,[U,X]=(0,_react.useState)(!1),Y=(0,_react.useCallback)(t=>{if(M){const i=e.value??[];return containsValue(i,t)}return null!=e.value&&sameSelectValue(e.value,t)},[M,e.value]),Z=(0,_react.useMemo)(()=>{if(M){const t=e.value??[];return i.filter(e=>containsValue(t,L(e)))}const t=e.value;if(null==t)return[];const l=i.find(e=>sameSelectValue(L(e),t));return l?[l]:[]},[M,i,e.value,L]),ee=(0,_react.useCallback)(()=>{if(S)return;const e=(0,_index2.resolveHaptic)(d,"selection");e&&(0,_index2.triggerHaptic)(e),X(!0)},[S,d]),te=(0,_react.useCallback)(()=>{X(!1)},[]),ie=(0,_react.useCallback)(t=>{if(P(t))return;const i=L(t),l=(0,_index2.resolveHaptic)(d,"selection");if(l&&(0,_index2.triggerHaptic)(l),M){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()},[M,e,te,P,L,d]),le=0===Z.length?a??"Select…":Z.map(e=>H(e)).join(", "),re=0===Z.length,ne=(0,_FieldBase.hasFieldText)(f),oe=(0,_FieldBase.hasFieldText)(u),se=(0,_FieldBase.fieldTextAsString)(u),ae=Math.round(1.4*$.fontSize),ce={color:S?E.colors.field.iconDisabled:U?E.colors.field.iconFocused:E.colors.field.icon,size:$.iconSize,disabled:S,focused:U,error:ne},de=0===Z.length?a??"No selection":`Selected: ${Z.map(e=>H(e)).join(", ")}`,ue=C??`${se??"Select"}. ${de}`;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[A.container,V],testID:w,children:[oe?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:v,required:x,help:p,style:k,children:u}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,collapsable:!1,children:(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:v,variant:J,disabled:S,error:ne,filled:Z.length>0,onPress:ee,borderRadius:Q,fillOverrides:K,paddingHorizontal:"underline"===J?0:void 0,accessibilityRole:"button",accessibilityLabel:ue,accessibilityState:{disabled:S,expanded:U},style:z,slotAlign:1===g?"center":"top",slotLineHeight:1===g?void 0:ae,leading:y?(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_slotIcon.renderSlotIcon)(y,ce)}):null,trailing:j?(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_slotIcon.renderSlotIcon)(j,ce)}):(0,_jsxRuntime.jsx)(_Chevron.Chevron,{color:F??(S?E.colors.text.disabled:E.colors.text.tertiary),size:O??$.iconSize,open:U,style:A.chevron}),children:[(0,_FieldBase.hasFieldText)(h)?"string"==typeof h||"number"==typeof h?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[A.prefix,{color:G.placeholderColor,fontSize:$.fontSize,lineHeight:1===g?void 0:ae,marginRight:E.spacing.xs}],children:h}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[A.prefixNode,{minHeight:1===g?void 0:ae,justifyContent:"center",marginRight:E.spacing.xs}],children:h}):null,(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[A.triggerText,{color:re?G.placeholderColor:G.color,fontSize:$.fontSize,lineHeight:1===g?void 0:ae,...G.weightStyle},B],numberOfLines:g,children:[le,re&&x&&!oe?(0,_jsxRuntime.jsx)(_FieldBase.RequiredMark,{}):null]})]})}),(0,_jsxRuntime.jsx)(_FieldBase.FieldMessage,{size:v,error:ne,text:ne?f:b}),(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:U,onClose:te,title:_??se,accessibilityLabel:se??(oe?_:void 0)??a??"Options",options:i,labelOf:H,getValue:L,disabledOf:P,descriptionOf:D,iconOf:W,isSelected:Y,onSelect:ie,multi:M,searchable:c,optionStyle:T,selectedOptionStyle:q,optionTextStyle:I,selectedOptionTextStyle:N,searchSelectionColor:(0,_FieldBase.resolveVariantColors)(E,J,K).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:8}});var _default=exports.default=Select;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Select=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_Chevron=require("../FieldBase/Chevron.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_jsxRuntime=require("react/jsx-runtime");const sameSelectValue=(e,t)=>String(e)===String(t),containsValue=(e,t)=>e.some(e=>sameSelectValue(e,t)),Select=exports.Select=(0,_react.forwardRef)((e,t)=>{const{options:i,getOptionLabel:l,getOptionValue:r,getOptionDisabled:n,getOptionDescription:o,getOptionIcon:s,placeholder:a,searchable:c=!1,haptic:d,label:u,help:x,title:p,required:_=!1,error:b,helperText:h,prefix:S,numberOfLines:f=1,disabled:g=!1,size:v="md",variant:m,leftIcon:j,rightIcon:y,chevronColor:F,chevronSize:C,borderRadius:O,accessibilityLabel:R,labelStyle:V,style:k,triggerStyle:z,textStyle:B,optionStyle:T,selectedOptionStyle:I,optionTextStyle:N,selectedOptionTextStyle:q,testID:H}=e,L=!0===e.multi,w=(0,_react.useCallback)(e=>l?l(e):e.label??"",[l]),M=(0,_react.useCallback)(e=>r?r(e):e.value,[r]),D=(0,_react.useCallback)(e=>n?n(e):!0===e.disabled,[n]),P=(0,_react.useCallback)(e=>o?o(e):e.description,[o]),E=(0,_react.useCallback)(e=>s?s(e):e.icon,[s]),A=(0,_index.useTheme)(),$=(0,_react.useMemo)(()=>buildStyles(A),[A]),G=(0,_FieldBase.resolveFieldSize)(A,v),J=(0,_FieldBase.resolveFieldTextStyle)(A,{disabled:g}),K=m??A.components.select?.defaultVariant??A.components.field?.defaultVariant??"outlined",Q=(0,_react.useMemo)(()=>{const e=A.components.select?.fillColors?.[K];if(!e)return;const t={};return void 0!==e.idleEmpty&&(t.backgroundIdleEmpty=e.idleEmpty),void 0!==e.idleFilled&&(t.backgroundIdleFilled=e.idleFilled),void 0!==e.focus&&(t.backgroundFocused=e.focus),void 0!==e.error&&(t.backgroundError=e.error),void 0!==e.disabled&&(t.backgroundDisabled=e.disabled),Object.keys(t).length>0?t:void 0},[A.components.select?.fillColors,K]),U=O??A.components.select?.borderRadius,[W,X]=(0,_react.useState)(!1),Y=(0,_react.useCallback)(t=>{if(L){const i=e.value??[];return containsValue(i,t)}return null!=e.value&&sameSelectValue(e.value,t)},[L,e.value]),Z=(0,_react.useMemo)(()=>{if(L){const t=e.value??[];return i.filter(e=>containsValue(t,M(e)))}const t=e.value;if(null==t)return[];const l=i.find(e=>sameSelectValue(M(e),t));return l?[l]:[]},[L,i,e.value,M]),ee=(0,_react.useCallback)(()=>{if(g)return;const e=(0,_index2.resolveHaptic)(d,"selection");e&&(0,_index2.triggerHaptic)(e),X(!0)},[g,d]),te=(0,_react.useCallback)(()=>{X(!1)},[]),ie=(0,_react.useCallback)(t=>{if(D(t))return;const i=M(t),l=(0,_index2.resolveHaptic)(d,"selection");if(l&&(0,_index2.triggerHaptic)(l),L){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()},[L,e,te,D,M,d]),le=0===Z.length?a??"Select…":Z.map(e=>w(e)).join(", "),re=0===Z.length,ne=!0===b||(0,_FieldBase.hasFieldText)(b),oe=(0,_FieldBase.hasFieldText)(u),se=(0,_FieldBase.fieldTextAsString)(u),ae=Math.round(1.4*G.fontSize),ce={color:g?A.colors.field.iconDisabled:W?A.colors.field.iconFocused:A.colors.field.icon,size:G.iconSize,disabled:g,focused:W,error:ne},de=0===Z.length?a??"No selection":`Selected: ${Z.map(e=>w(e)).join(", ")}`,ue=R??`${se??"Select"}. ${de}`;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.container,k],testID:H,children:[oe?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:v,required:_,help:x,style:V,children:u}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,collapsable:!1,children:(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:v,variant:K,disabled:g,error:ne,filled:Z.length>0,onPress:ee,borderRadius:U,fillOverrides:Q,paddingHorizontal:"underline"===K?0:void 0,accessibilityRole:"button",accessibilityLabel:ue,accessibilityState:{disabled:g,expanded:W},style:z,slotAlign:1===f?"center":"top",slotLineHeight:1===f?void 0:ae,leading:j?(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_slotIcon.renderSlotIcon)(j,ce)}):null,trailing:y?(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_slotIcon.renderSlotIcon)(y,ce)}):(0,_jsxRuntime.jsx)(_Chevron.Chevron,{color:F??(g?A.colors.text.disabled:A.colors.text.tertiary),size:C??G.iconSize,open:W,style:$.chevron}),children:[(0,_FieldBase.hasFieldText)(S)?"string"==typeof S||"number"==typeof S?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{color:J.placeholderColor,fontSize:G.fontSize,lineHeight:1===f?void 0:ae,marginRight:A.spacing.xs}],children:S}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[$.prefixNode,{minHeight:1===f?void 0:ae,justifyContent:"center",marginRight:A.spacing.xs}],children:S}):null,(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[$.triggerText,{color:re?J.placeholderColor:J.color,fontSize:G.fontSize,lineHeight:1===f?void 0:ae,...J.weightStyle},B],numberOfLines:f,children:[le,re&&_&&!oe?(0,_jsxRuntime.jsx)(_FieldBase.RequiredMark,{}):null]})]})}),(0,_jsxRuntime.jsx)(_FieldBase.FieldMessage,{size:v,error:ne,text:ne?b:h}),(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:W,onClose:te,title:p??se,accessibilityLabel:se??(oe?p:void 0)??a??"Options",options:i,labelOf:w,getValue:M,disabledOf:D,descriptionOf:P,iconOf:E,isSelected:Y,onSelect:ie,multi:L,searchable:c,optionStyle:T,selectedOptionStyle:I,optionTextStyle:N,selectedOptionTextStyle:q,searchSelectionColor:(0,_FieldBase.resolveVariantColors)(A,K,Q).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:8}});var _default=exports.default=Select;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SliderField=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../AppIcon/index.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_index4=require("../IconButton/index.js"),_index5=require("../Slider/index.js"),_valueText=require("../Slider/valueText.js"),_index6=require("../Tooltip/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INPUT_WIDTH=72,defaultFormatValue=e=>String(e),stepDecimals=e=>String(e).split(".")[1]?.length??0,ValueBox=({draft:e,error:t,disabled:i,width:l,accessibilityLabel:s,style:a,testID:n})=>{const r=(0,_index2.useTheme)(),o=(0,_FieldBase.resolveFieldSize)(r,"sm"),d=(0,_FieldBase.resolveFieldTextStyle)(r,{disabled:i}),u=(0,_react.useRef)(null),c=(0,_react.useCallback)(()=>{i||u.current?.focus()},[i]);return(0,_jsxRuntime.jsx)(_FieldBase.FieldBase,{size:"sm",focused:e.editing,disabled:i,error:t,filled:!0,width:l,onPress:c,pressFeedback:!1,paddingHorizontal:r.spacing.sm,gap:r.spacing.xs,trailing:t?(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"info-circle",size:o.iconSize,color:r.colors.error}):void 0,style:a,children:(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:u,style:[styles.boxInput,{color:d.color,fontSize:o.fontSize,...d.weightStyle}],value:e.text,onChangeText:e.onChangeText,onFocus:e.onFocus,onBlur:e.onBlur,onSubmitEditing:e.onBlur,editable:!i,keyboardType:"decimal-pad",returnKeyType:"done",textAlign:"center",selectionColor:r.colors.primary,accessibilityLabel:s,accessibilityState:{disabled:i},testID:n})})},SliderField=exports.SliderField=(0,_react.forwardRef)((e,t)=>{const{label:i,unit:l,info:s,required:a=!1,helperText:n,error:r,min:o=0,max:d=100,step:u=1,disabled:c=!1,tone:x="primary",size:_,variant:m,haptic:p,showBubble:b=!0,showBounds:h=!0,showInput:j=!1,showStepper:y=!1,startIcon:v,endIcon:g,startLabel:f,endLabel:S,formatValue:I=defaultFormatValue,parseInput:T,animationDuration:R,inputWidth:w=DEFAULT_INPUT_WIDTH,accessibilityLabel:F,style:B,labelStyle:z,boundStyle:V,sliderStyle:D,inputStyle:L,testID:N}=e,q=(0,_index2.useTheme)(),C=(0,_react.useMemo)(()=>buildStyles(q),[q]),$=R??q.motion.duration.fast,A=!0===e.range,W=(0,_FieldBase.hasFieldText)(r),P=stepDecimals(u),[M,k]=(0,_index.useControllableState)({value:e.value,defaultValue:e.defaultValue??(A?[o,d]:o),onChange:e.onChange}),[H,U]=A?M:[M,d],E=(0,_valueText.clampValue)(Math.min(H,U),o,d),K=(0,_valueText.clampValue)(Math.max(H,U),o,d),O=(0,_valueText.useValueDraft)({value:E,min:o,max:d,step:u,format:I,parse:T,onChange:e=>k(A?[Math.min(e,K),K]:e)}),G=(0,_valueText.useValueDraft)({value:K,min:o,max:d,step:u,format:I,parse:T,onChange:e=>k([E,Math.max(e,E)])}),stepBy=e=>{const t=(0,_valueText.snapValue)(E+e*u,o,d,u);t!==E&&k(t)},J={color:c?q.colors.text.disabled:q.colors.text.secondary,size:q.components.field?.md?.iconSize??18,disabled:c},Q=[C.bubbleText,{color:(0,_valueText.sliderToneInk)(q,x),fontWeight:q.typography.fontWeight.semibold}],boundText=e=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[C.bound,{color:c?q.colors.text.disabled:q.colors.text.secondary},V],children:e}),X={min:o,max:d,step:u,disabled:c,tone:x,size:_,variant:m,haptic:p,showLabel:!!b&&"always",renderLabel:b?e=>(0,_jsxRuntime.jsx)(_valueText.CountingText,{value:e,format:I,decimals:P,duration:$,style:Q,testID:N&&!A?`${N}-bubble`:void 0}):void 0,accessibilityLabel:F??i,style:D,testID:N?`${N}-slider`:void 0};return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,style:[C.container,B],testID:N,children:[i?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:C.labelRow,children:[(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{required:a,style:z,children:i}),l?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[C.unit,{color:q.colors.text.tertiary}],children:l}):null,s?(0,_jsxRuntime.jsx)(_index6.Tooltip,{content:s,trigger:"press",placement:"top",children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:`About ${i}`,hitSlop:8,style:C.infoButton,children:(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"info-circle",variant:"bold",size:16,color:q.colors.text.tertiary})})}):null]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[C.row,b?C.rowWithBubble:null],children:[v?(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_index3.renderSlotIcon)(v,J)}):null,y&&!A?(0,_jsxRuntime.jsx)(_index4.IconButton,{icon:e=>(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"minus",size:e.size,color:e.color}),onPress:()=>stepBy(-1),accessibilityLabel:"Decrease",variant:"ghost",tone:"neutral",size:"sm",disabled:c||E<=o,haptic:p,testID:N?`${N}-minus`:void 0}):null,A&&j?(0,_jsxRuntime.jsx)(ValueBox,{draft:O,error:W,disabled:c,width:w,accessibilityLabel:`${i??"Value"} low`,style:L,testID:N?`${N}-input-low`:void 0}):h?boundText(f??I(o)):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:C.sliderWrap,children:A?(0,_jsxRuntime.jsx)(_index5.Slider,{...X,range:!0,value:[E,K],onChange:k}):(0,_jsxRuntime.jsx)(_index5.Slider,{...X,value:E,onChange:k})}),A&&j?(0,_jsxRuntime.jsx)(ValueBox,{draft:G,error:W,disabled:c,width:w,accessibilityLabel:`${i??"Value"} high`,style:L,testID:N?`${N}-input-high`:void 0}):h?boundText(S??I(d)):null,y&&!A?(0,_jsxRuntime.jsx)(_index4.IconButton,{icon:e=>(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"add",size:e.size,color:e.color}),onPress:()=>stepBy(1),accessibilityLabel:"Increase",variant:"ghost",tone:"neutral",size:"sm",disabled:c||E>=d,haptic:p,testID:N?`${N}-plus`:void 0}):null,g?(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_index3.renderSlotIcon)(g,J)}):null,!A&&j?(0,_jsxRuntime.jsx)(ValueBox,{draft:O,error:W,disabled:c,width:w,accessibilityLabel:`${i??"Value"} value`,style:L,testID:N?`${N}-input`:void 0}):null]}),(0,_jsxRuntime.jsx)(_FieldBase.FieldMessage,{text:W?r:n,error:W})]})});SliderField.displayName="SliderField";const styles=_reactNative.StyleSheet.create({boxInput:{flex:1,padding:0,margin:0,includeFontPadding:!1}}),buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},labelRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.xs},unit:{fontSize:e.typography.fontSize.xs},infoButton:{marginLeft:e.spacing.xxs},row:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm},rowWithBubble:{marginTop:e.spacing.lg},sliderWrap:{flex:1,paddingHorizontal:10},bound:{fontSize:e.typography.fontSize.sm,fontVariant:["tabular-nums"]},bubbleText:{fontSize:e.typography.fontSize.xs,fontVariant:["tabular-nums"]}});var _default=exports.default=SliderField;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.SliderField=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../AppIcon/index.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_index4=require("../IconButton/index.js"),_index5=require("../Slider/index.js"),_valueText=require("../Slider/valueText.js"),_index6=require("../Tooltip/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INPUT_WIDTH=72,defaultFormatValue=e=>String(e),stepDecimals=e=>String(e).split(".")[1]?.length??0,ValueBox=({draft:e,error:t,disabled:i,width:l,accessibilityLabel:s,style:a,testID:n})=>{const r=(0,_index2.useTheme)(),o=(0,_FieldBase.resolveFieldSize)(r,"sm"),d=(0,_FieldBase.resolveFieldTextStyle)(r,{disabled:i}),u=(0,_react.useRef)(null),c=(0,_react.useCallback)(()=>{i||u.current?.focus()},[i]);return(0,_jsxRuntime.jsx)(_FieldBase.FieldBase,{size:"sm",focused:e.editing,disabled:i,error:t,filled:!0,width:l,onPress:c,pressFeedback:!1,paddingHorizontal:r.spacing.sm,gap:r.spacing.xs,trailing:t?(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"info-circle",size:o.iconSize,color:r.colors.error}):void 0,style:a,children:(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:u,style:[styles.boxInput,{color:d.color,fontSize:o.fontSize,...d.weightStyle}],value:e.text,onChangeText:e.onChangeText,onFocus:e.onFocus,onBlur:e.onBlur,onSubmitEditing:e.onBlur,editable:!i,keyboardType:"decimal-pad",returnKeyType:"done",textAlign:"center",selectionColor:r.colors.primary,accessibilityLabel:s,accessibilityState:{disabled:i},testID:n})})},SliderField=exports.SliderField=(0,_react.forwardRef)((e,t)=>{const{label:i,unit:l,info:s,required:a=!1,helperText:n,error:r,min:o=0,max:d=100,step:u=1,disabled:c=!1,tone:x="primary",size:_,variant:m,haptic:p,showBubble:b=!0,showBounds:h=!0,showInput:j=!1,showStepper:y=!1,startIcon:v,endIcon:g,startLabel:f,endLabel:S,formatValue:I=defaultFormatValue,parseInput:T,animationDuration:R,inputWidth:w=DEFAULT_INPUT_WIDTH,accessibilityLabel:F,style:B,labelStyle:z,boundStyle:V,sliderStyle:D,inputStyle:L,testID:N}=e,q=(0,_index2.useTheme)(),C=(0,_react.useMemo)(()=>buildStyles(q),[q]),$=R??q.motion.duration.fast,A=!0===e.range,W=!0===r||(0,_FieldBase.hasFieldText)(r),P=stepDecimals(u),[M,k]=(0,_index.useControllableState)({value:e.value,defaultValue:e.defaultValue??(A?[o,d]:o),onChange:e.onChange}),[H,U]=A?M:[M,d],E=(0,_valueText.clampValue)(Math.min(H,U),o,d),K=(0,_valueText.clampValue)(Math.max(H,U),o,d),O=(0,_valueText.useValueDraft)({value:E,min:o,max:d,step:u,format:I,parse:T,onChange:e=>k(A?[Math.min(e,K),K]:e)}),G=(0,_valueText.useValueDraft)({value:K,min:o,max:d,step:u,format:I,parse:T,onChange:e=>k([E,Math.max(e,E)])}),stepBy=e=>{const t=(0,_valueText.snapValue)(E+e*u,o,d,u);t!==E&&k(t)},J={color:c?q.colors.text.disabled:q.colors.text.secondary,size:q.components.field?.md?.iconSize??18,disabled:c},Q=[C.bubbleText,{color:(0,_valueText.sliderToneInk)(q,x),fontWeight:q.typography.fontWeight.semibold}],boundText=e=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[C.bound,{color:c?q.colors.text.disabled:q.colors.text.secondary},V],children:e}),X={min:o,max:d,step:u,disabled:c,tone:x,size:_,variant:m,haptic:p,showLabel:!!b&&"always",renderLabel:b?e=>(0,_jsxRuntime.jsx)(_valueText.CountingText,{value:e,format:I,decimals:P,duration:$,style:Q,testID:N&&!A?`${N}-bubble`:void 0}):void 0,accessibilityLabel:F??i,style:D,testID:N?`${N}-slider`:void 0};return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,style:[C.container,B],testID:N,children:[i?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:C.labelRow,children:[(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{required:a,style:z,children:i}),l?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[C.unit,{color:q.colors.text.tertiary}],children:l}):null,s?(0,_jsxRuntime.jsx)(_index6.Tooltip,{content:s,trigger:"press",placement:"top",children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:`About ${i}`,hitSlop:8,style:C.infoButton,children:(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"info-circle",variant:"bold",size:16,color:q.colors.text.tertiary})})}):null]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[C.row,b?C.rowWithBubble:null],children:[v?(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_index3.renderSlotIcon)(v,J)}):null,y&&!A?(0,_jsxRuntime.jsx)(_index4.IconButton,{icon:e=>(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"minus",size:e.size,color:e.color}),onPress:()=>stepBy(-1),accessibilityLabel:"Decrease",variant:"ghost",tone:"neutral",size:"sm",disabled:c||E<=o,haptic:p,testID:N?`${N}-minus`:void 0}):null,A&&j?(0,_jsxRuntime.jsx)(ValueBox,{draft:O,error:W,disabled:c,width:w,accessibilityLabel:`${i??"Value"} low`,style:L,testID:N?`${N}-input-low`:void 0}):h?boundText(f??I(o)):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:C.sliderWrap,children:A?(0,_jsxRuntime.jsx)(_index5.Slider,{...X,range:!0,value:[E,K],onChange:k}):(0,_jsxRuntime.jsx)(_index5.Slider,{...X,value:E,onChange:k})}),A&&j?(0,_jsxRuntime.jsx)(ValueBox,{draft:G,error:W,disabled:c,width:w,accessibilityLabel:`${i??"Value"} high`,style:L,testID:N?`${N}-input-high`:void 0}):h?boundText(S??I(d)):null,y&&!A?(0,_jsxRuntime.jsx)(_index4.IconButton,{icon:e=>(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"add",size:e.size,color:e.color}),onPress:()=>stepBy(1),accessibilityLabel:"Increase",variant:"ghost",tone:"neutral",size:"sm",disabled:c||E>=d,haptic:p,testID:N?`${N}-plus`:void 0}):null,g?(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_index3.renderSlotIcon)(g,J)}):null,!A&&j?(0,_jsxRuntime.jsx)(ValueBox,{draft:O,error:W,disabled:c,width:w,accessibilityLabel:`${i??"Value"} value`,style:L,testID:N?`${N}-input`:void 0}):null]}),(0,_jsxRuntime.jsx)(_FieldBase.FieldMessage,{text:W?r:n,error:W})]})});SliderField.displayName="SliderField";const styles=_reactNative.StyleSheet.create({boxInput:{flex:1,padding:0,margin:0,includeFontPadding:!1}}),buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},labelRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.xs},unit:{fontSize:e.typography.fontSize.xs},infoButton:{marginLeft:e.spacing.xxs},row:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm},rowWithBubble:{marginTop:e.spacing.lg},sliderWrap:{flex:1,paddingHorizontal:10},bound:{fontSize:e.typography.fontSize.sm,fontVariant:["tabular-nums"]},bubbleText:{fontSize:e.typography.fontSize.xs,fontVariant:["tabular-nums"]}});var _default=exports.default=SliderField;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SquircleFill=SquircleFill,exports.useSquircle=useSquircle;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_squircle=require("../../utils/squircle.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var i=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var a,l,n={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return n;if(a=t?r:i){if(a.has(e))return a.get(e);a.set(e,n)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((l=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(l.get||l.set)?a(n,t,l):n[t]=e[t]);return n})(e,t)}const AnimatedPath=_reactNative.Animated.createAnimatedComponent(_reactNativeSvg.Path);function SquircleFill({width:e,height:t,radius:i,fill:r,stroke:a,strokeWidth:l=0,outset:n=0,testID:u}){const s=l>0&&void 0!==a&&"transparent"!==a,o=s?l/2:0,c=(0,_squircle.squirclePath)({width:e,height:t,radius:i,inset:o});return(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[styles.overlay,n?{top:-n,left:-n,right:-n,bottom:-n}:null],testID:u,children:(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:e,height:t,viewBox:`0 0 ${e} ${t}`,children:(0,_jsxRuntime.jsx)(AnimatedPath,{d:c,fill:r,stroke:s?a:void 0,strokeWidth:s?l:void 0})})})}function useSquircle(e,t,i){const[r,a]=(0,_react.useState)(null),l=e&&"android"===_reactNative.Platform.OS;return{onLayout:(0,_react.useCallback)(e=>{if(l){const{width:t,height:i}=e.nativeEvent.layout;a(e=>e&&e.width===t&&e.height===i?e:{width:t,height:i})}i?.(e)},[l,i]),size:r,active:l&&null!==r&&(0,_squircle.squircleApplies)(r.width,r.height,t)}}SquircleFill.displayName="SquircleFill";const styles=_reactNative.StyleSheet.create({overlay:{position:"absolute",top:0,left:0,right:0,bottom:0}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SquircleFill=SquircleFill,exports.useSquircle=useSquircle;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_index=require("../../theme/index.js"),_squircle=require("../../utils/squircle.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var i=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,a,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(n=t?r:i){if(n.has(e))return n.get(e);n.set(e,l)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((a=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?n(l,t,a):l[t]=e[t]);return l})(e,t)}const AnimatedPath=_reactNative.Animated.createAnimatedComponent(_reactNativeSvg.Path);function SquircleFill({width:e,height:t,radius:i,fill:r,stroke:n,strokeWidth:a=0,outset:l=0,testID:o}){const u=a>0&&void 0!==n&&"transparent"!==n,s=u?a/2:0,c=(0,_index.useTheme)().cornerSmoothing,d=(0,_squircle.squirclePath)({width:e,height:t,radius:i,inset:s,smoothing:c});return(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[styles.overlay,l?{top:-l,left:-l,right:-l,bottom:-l}:null],testID:o,children:(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:e,height:t,viewBox:`0 0 ${e} ${t}`,children:(0,_jsxRuntime.jsx)(AnimatedPath,{d:d,fill:r,stroke:u?n:void 0,strokeWidth:u?a:void 0})})})}function useSquircle(e,t,i){const[r,n]=(0,_react.useState)(null),a=e&&"android"===_reactNative.Platform.OS;return{onLayout:(0,_react.useCallback)(e=>{if(a){const{width:t,height:i}=e.nativeEvent.layout;n(e=>e&&e.width===t&&e.height===i?e:{width:t,height:i})}i?.(e)},[a,i]),size:r,active:a&&null!==r&&(0,_squircle.squircleApplies)(r.width,r.height,t)}}SquircleFill.displayName="SquircleFill";const styles=_reactNative.StyleSheet.create({overlay:{position:"absolute",top:0,left:0,right:0,bottom:0}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.lightTheme=exports.darkTheme=void 0;const typography={fontSize:{xs:11,sm:13,base:15,lg:17,xl:20,"2xl":24,"3xl":30,"4xl":36},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:1.2,normal:1.4,relaxed:1.6},letterSpacing:{tight:-.2,normal:0,wide:.4}},spacing={none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius={none:0,xs:4,sm:6,md:10,lg:14,xl:20,"2xl":28,full:9999},FIELD_RADIUS=10,fieldSizes={sm:{paddingHorizontal:12,paddingVertical:10,minHeight:38,fontSize:13,borderRadius:10,iconSize:14,labelFontSize:11,labelGap:4,messageFontSize:11,messageGap:2},md:{paddingHorizontal:14,paddingVertical:13,minHeight:44,fontSize:14,borderRadius:10,iconSize:16,labelFontSize:12,labelGap:4,messageFontSize:12,messageGap:2},lg:{paddingHorizontal:16,paddingVertical:15,minHeight:52,fontSize:16,borderRadius:10,iconSize:18,labelFontSize:13,labelGap:4,messageFontSize:13,messageGap:2}},components={button:{xs:{paddingHorizontal:10,paddingVertical:4,minHeight:28,fontSize:12,borderRadius:8},sm:{paddingHorizontal:12,paddingVertical:6,minHeight:34,fontSize:14,borderRadius:10},md:{paddingHorizontal:16,paddingVertical:9,minHeight:42,fontSize:16,borderRadius:12},lg:{paddingHorizontal:20,paddingVertical:12,minHeight:50,fontSize:18,borderRadius:14},xl:{paddingHorizontal:24,paddingVertical:14,minHeight:58,fontSize:20,borderRadius:16}},input:{sm:{...fieldSizes.sm,multilineMinHeight:72},md:{...fieldSizes.md,multilineMinHeight:92},lg:{...fieldSizes.lg,multilineMinHeight:110}},searchBar:{sm:{borderRadius:radius.full},md:{borderRadius:radius.full},lg:{borderRadius:radius.full}},emptyState:{sm:{iconSize:48,titleFontSize:"lg",descriptionFontSize:"sm",paddingVertical:"lg"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl"}},field:{defaultVariant:"outlined",sm:fieldSizes.sm,md:fieldSizes.md,lg:fieldSizes.lg},listItem:{sm:{paddingVertical:"sm",titleFontSize:"sm",subtitleFontSize:"xs",minHeight:44},md:{paddingVertical:"md",titleFontSize:"base",subtitleFontSize:"sm",minHeight:56},lg:{paddingVertical:"lg",titleFontSize:"lg",subtitleFontSize:"sm",minHeight:72}},badge:{sm:{fontSize:10,minWidth:16,height:16,paddingHorizontal:5,dotSize:8},md:{fontSize:11,minWidth:20,height:20,paddingHorizontal:6,dotSize:10},borderWidth:1.5,anchorOffset:4},chip:{sm:{paddingHorizontal:10,paddingVertical:4,fontSize:12,minHeight:26,closeSize:16,closeFontSize:12,gap:6},md:{paddingHorizontal:12,paddingVertical:6,fontSize:13,minHeight:32,closeSize:18,closeFontSize:13,gap:8}},checkbox:{sm:{boxSize:16},md:{boxSize:20},lg:{boxSize:24},labelGap:10},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},labelGap:10},switch:{sm:{trackWidth:42,trackHeight:26,thumbSize:22,padding:2},md:{trackWidth:51,trackHeight:31,thumbSize:27,padding:2},lg:{trackWidth:60,trackHeight:36,thumbSize:32,padding:2},thumbColor:"#FFFFFF"},otpInput:{sm:{cell:36,fontSize:16,borderRadius:8,gap:8},md:{cell:48,fontSize:20,borderRadius:10,gap:10},lg:{cell:56,fontSize:24,borderRadius:12,gap:12}},dialog:{iconWrapperSize:48,iconWrapperBorderRadius:24,actionButtonMinHeight:44},toast:{iconCircleSize:28,iconCircleBorderRadius:14,iconGlyphFontSize:16,tintBarWidth:4},formField:{inlineLabelWidth:"35%"}},motion={duration:{instant:80,fast:160,normal:240,slow:360,slower:500},easing:{standard:[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]},spring:{gentle:{damping:26,stiffness:240,mass:.9},bouncy:{damping:16,stiffness:200,mass:.7},snappy:{damping:20,stiffness:300,mass:.7}}},lightShadows={none:{},xs:{shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.04,shadowRadius:2,elevation:1},sm:{shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.06,shadowRadius:4,elevation:2},md:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.08,shadowRadius:8,elevation:4},lg:{shadowColor:"#000",shadowOffset:{width:0,height:8},shadowOpacity:.1,shadowRadius:16,elevation:8},xl:{shadowColor:"#000",shadowOffset:{width:0,height:12},shadowOpacity:.14,shadowRadius:24,elevation:12},"2xl":{shadowColor:"#000",shadowOffset:{width:0,height:20},shadowOpacity:.18,shadowRadius:32,elevation:20}},darkShadows={none:{},xs:{shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.3,shadowRadius:2,elevation:1},sm:{shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.4,shadowRadius:4,elevation:2},md:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.5,shadowRadius:8,elevation:4},lg:{shadowColor:"#000",shadowOffset:{width:0,height:8},shadowOpacity:.55,shadowRadius:16,elevation:8},xl:{shadowColor:"#000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12},"2xl":{shadowColor:"#000",shadowOffset:{width:0,height:20},shadowOpacity:.7,shadowRadius:32,elevation:20}},lightTheme=exports.lightTheme={mode:"light",colors:{primary:"#5B5BD6",primaryHover:"#4F4FBF",primaryPressed:"#4040A8",primaryMuted:"#EEEEFC",secondary:"#F4F4F8",secondaryHover:"#E9E9F0",success:"#1FAD66",warning:"#F59E0B",error:"#E5484D",info:"#3B82F6",onPrimary:"#FFFFFF",onSecondary:"#0F0F1A",onSuccess:"#FFFFFF",onWarning:"#0F0F1A",onError:"#FFFFFF",onInfo:"#FFFFFF",onOverlay:"#FFFFFF",text:{primary:"#0F0F1A",secondary:"#52525B",tertiary:"#8B8B95",inverse:"#FFFFFF",strong:"#252F4A",disabled:"#B4B4BB",link:"#5B5BD6"},background:{primary:"#FFFFFF",secondary:"#F8F8FB",tertiary:"#F1F1F5",elevated:"#FFFFFF",overlay:"rgba(15, 15, 26, 0.5)",inverse:"#0F0F1A"},border:{primary:"#E5E5EC",secondary:"#EFEFF3",focus:"#5B5BD6",error:"#E5484D",width:1},field:{background:"#F9FBFC",backgroundFocused:"#FFFFFF",backgroundDisabled:"#F5F6FA",border:"#EBEDF3",borderFocused:"#BED2F9",borderError:"#FDBFCE",label:"#242F4A",text:"#252F4A",textDisabled:"#C4CADA",placeholder:"#99A1B7",placeholderDisabled:"#C4CADA",icon:"#99A1B7",iconFocused:"#4B5675",iconDisabled:"#C4CADA",caret:"#5B8DEE",message:"#E82545"},surface:{pressed:"rgba(15, 15, 26, 0.06)",hovered:"rgba(15, 15, 26, 0.04)",selected:"rgba(91, 91, 214, 0.1)",disabled:"#F1F1F5"},glass:{fill:"rgba(255, 255, 255, 0.28)",border:"rgba(255, 255, 255, 0.45)",on:"#0F0F1A",badge:"#FFFFFF"},skeleton:{background:"#EBEDF3",highlight:"#F5F6FA"},avatarPalette:["#5B5BD6","#0A7979","#A45A05","#CD226E","#2462EB","#7C3AED","#047C57","#D42222"]},typography:typography,spacing:spacing,radius:radius,shadows:lightShadows,motion:motion,components:components,gradients:{}},darkTheme=exports.darkTheme={mode:"dark",colors:{primary:"#7C7CE8",primaryHover:"#9292EE",primaryPressed:"#A8A8F2",primaryMuted:"#1F1F3D",secondary:"#1F1F26",secondaryHover:"#2A2A33",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA",onPrimary:"#0F0F1A",onSecondary:"#FAFAFA",onSuccess:"#0F0F1A",onWarning:"#0F0F1A",onError:"#0F0F1A",onInfo:"#0F0F1A",onOverlay:"#FFFFFF",text:{primary:"#FAFAFA",secondary:"#B4B4BB",tertiary:"#71717A",inverse:"#0F0F1A",strong:"#E2E2E2",disabled:"#52525B",link:"#9292EE"},background:{primary:"#0B0B12",secondary:"#13131C",tertiary:"#1C1C26",elevated:"#1C1C26",overlay:"rgba(0, 0, 0, 0.65)",inverse:"#FAFAFA"},border:{primary:"#27272F",secondary:"#1C1C26",focus:"#7C7CE8",error:"#F87171",width:1},field:{background:"#13131C",backgroundFocused:"#0B0B12",backgroundDisabled:"#1C1C26",border:"#27272F",borderFocused:"#3D5FB0",borderError:"#8A2F42",label:"#E4E6EE",text:"#FAFAFA",textDisabled:"#52525B",placeholder:"#71717A",placeholderDisabled:"#52525B",icon:"#8B8B95",iconFocused:"#D4D4DB",iconDisabled:"#52525B",caret:"#7C9EF0",message:"#F87171"},surface:{pressed:"rgba(255, 255, 255, 0.08)",hovered:"rgba(255, 255, 255, 0.05)",selected:"rgba(124, 124, 232, 0.18)",disabled:"#1C1C26"},glass:{fill:"rgba(255, 255, 255, 0.28)",border:"rgba(255, 255, 255, 0.45)",on:"#0F0F1A",badge:"#FFFFFF"},skeleton:{background:"#1C1C26",highlight:"#27272F"},avatarPalette:["#8B8BEE","#2DD4BF","#FCD34D","#F472B6","#60A5FA","#A78BFA","#34D399","#F87171"]},typography:typography,spacing:spacing,radius:radius,shadows:darkShadows,motion:motion,components:components,gradients:{}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.lightTheme=exports.darkTheme=void 0;var _squircle=require("../utils/squircle.js");const typography={fontSize:{xs:11,sm:13,base:15,lg:17,xl:20,"2xl":24,"3xl":30,"4xl":36},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:1.2,normal:1.4,relaxed:1.6},letterSpacing:{tight:-.2,normal:0,wide:.4}},spacing={none:0,xxs:2,xs:4,sm:8,md:12,lg:16,xl:24,"2xl":32,"3xl":48,"4xl":64},radius={none:0,xs:4,sm:6,md:10,lg:14,xl:20,"2xl":28,full:9999},FIELD_RADIUS=10,fieldSizes={sm:{paddingHorizontal:12,paddingVertical:10,minHeight:38,fontSize:13,borderRadius:10,iconSize:14,labelFontSize:11,labelGap:4,messageFontSize:11,messageGap:2},md:{paddingHorizontal:14,paddingVertical:13,minHeight:44,fontSize:14,borderRadius:10,iconSize:16,labelFontSize:12,labelGap:4,messageFontSize:12,messageGap:2},lg:{paddingHorizontal:16,paddingVertical:15,minHeight:52,fontSize:16,borderRadius:10,iconSize:18,labelFontSize:13,labelGap:4,messageFontSize:13,messageGap:2}},components={button:{xs:{paddingHorizontal:10,paddingVertical:4,minHeight:28,fontSize:12,borderRadius:8},sm:{paddingHorizontal:12,paddingVertical:6,minHeight:34,fontSize:14,borderRadius:10},md:{paddingHorizontal:16,paddingVertical:9,minHeight:42,fontSize:16,borderRadius:12},lg:{paddingHorizontal:20,paddingVertical:12,minHeight:50,fontSize:18,borderRadius:14},xl:{paddingHorizontal:24,paddingVertical:14,minHeight:58,fontSize:20,borderRadius:16}},input:{sm:{...fieldSizes.sm,multilineMinHeight:72},md:{...fieldSizes.md,multilineMinHeight:92},lg:{...fieldSizes.lg,multilineMinHeight:110}},searchBar:{sm:{borderRadius:radius.full},md:{borderRadius:radius.full},lg:{borderRadius:radius.full}},emptyState:{sm:{iconSize:48,titleFontSize:"lg",descriptionFontSize:"sm",paddingVertical:"lg"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl"}},field:{defaultVariant:"outlined",sm:fieldSizes.sm,md:fieldSizes.md,lg:fieldSizes.lg},listItem:{sm:{paddingVertical:"sm",titleFontSize:"sm",subtitleFontSize:"xs",minHeight:44},md:{paddingVertical:"md",titleFontSize:"base",subtitleFontSize:"sm",minHeight:56},lg:{paddingVertical:"lg",titleFontSize:"lg",subtitleFontSize:"sm",minHeight:72}},badge:{sm:{fontSize:10,minWidth:16,height:16,paddingHorizontal:5,dotSize:8},md:{fontSize:11,minWidth:20,height:20,paddingHorizontal:6,dotSize:10},borderWidth:1.5,anchorOffset:4},chip:{sm:{paddingHorizontal:10,paddingVertical:4,fontSize:12,minHeight:26,closeSize:16,closeFontSize:12,gap:6},md:{paddingHorizontal:12,paddingVertical:6,fontSize:13,minHeight:32,closeSize:18,closeFontSize:13,gap:8}},checkbox:{sm:{boxSize:16},md:{boxSize:20},lg:{boxSize:24},labelGap:10},radio:{sm:{outer:16,inner:8},md:{outer:20,inner:10},lg:{outer:24,inner:12},labelGap:10},switch:{sm:{trackWidth:42,trackHeight:26,thumbSize:22,padding:2},md:{trackWidth:51,trackHeight:31,thumbSize:27,padding:2},lg:{trackWidth:60,trackHeight:36,thumbSize:32,padding:2},thumbColor:"#FFFFFF"},otpInput:{sm:{cell:36,fontSize:16,borderRadius:8,gap:8},md:{cell:48,fontSize:20,borderRadius:10,gap:10},lg:{cell:56,fontSize:24,borderRadius:12,gap:12}},dialog:{iconWrapperSize:48,iconWrapperBorderRadius:24,actionButtonMinHeight:44},toast:{iconCircleSize:28,iconCircleBorderRadius:14,iconGlyphFontSize:16,tintBarWidth:4},formField:{inlineLabelWidth:"35%"}},motion={duration:{instant:80,fast:160,normal:240,slow:360,slower:500},easing:{standard:[.4,0,.2,1],accelerate:[.4,0,1,1],decelerate:[0,0,.2,1],sharp:[.4,0,.6,1]},spring:{gentle:{damping:26,stiffness:240,mass:.9},bouncy:{damping:16,stiffness:200,mass:.7},snappy:{damping:20,stiffness:300,mass:.7}}},lightShadows={none:{},xs:{shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.04,shadowRadius:2,elevation:1},sm:{shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.06,shadowRadius:4,elevation:2},md:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.08,shadowRadius:8,elevation:4},lg:{shadowColor:"#000",shadowOffset:{width:0,height:8},shadowOpacity:.1,shadowRadius:16,elevation:8},xl:{shadowColor:"#000",shadowOffset:{width:0,height:12},shadowOpacity:.14,shadowRadius:24,elevation:12},"2xl":{shadowColor:"#000",shadowOffset:{width:0,height:20},shadowOpacity:.18,shadowRadius:32,elevation:20}},darkShadows={none:{},xs:{shadowColor:"#000",shadowOffset:{width:0,height:1},shadowOpacity:.3,shadowRadius:2,elevation:1},sm:{shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.4,shadowRadius:4,elevation:2},md:{shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.5,shadowRadius:8,elevation:4},lg:{shadowColor:"#000",shadowOffset:{width:0,height:8},shadowOpacity:.55,shadowRadius:16,elevation:8},xl:{shadowColor:"#000",shadowOffset:{width:0,height:12},shadowOpacity:.6,shadowRadius:24,elevation:12},"2xl":{shadowColor:"#000",shadowOffset:{width:0,height:20},shadowOpacity:.7,shadowRadius:32,elevation:20}},lightTheme=exports.lightTheme={mode:"light",colors:{primary:"#5B5BD6",primaryHover:"#4F4FBF",primaryPressed:"#4040A8",primaryMuted:"#EEEEFC",secondary:"#F4F4F8",secondaryHover:"#E9E9F0",success:"#1FAD66",warning:"#F59E0B",error:"#E5484D",info:"#3B82F6",onPrimary:"#FFFFFF",onSecondary:"#0F0F1A",onSuccess:"#FFFFFF",onWarning:"#0F0F1A",onError:"#FFFFFF",onInfo:"#FFFFFF",onOverlay:"#FFFFFF",text:{primary:"#0F0F1A",secondary:"#52525B",tertiary:"#8B8B95",inverse:"#FFFFFF",strong:"#252F4A",disabled:"#B4B4BB",link:"#5B5BD6"},background:{primary:"#FFFFFF",secondary:"#F8F8FB",tertiary:"#F1F1F5",elevated:"#FFFFFF",overlay:"rgba(15, 15, 26, 0.5)",inverse:"#0F0F1A"},border:{primary:"#E5E5EC",secondary:"#EFEFF3",focus:"#5B5BD6",error:"#E5484D",width:1},field:{background:"#F9FBFC",backgroundFocused:"#FFFFFF",backgroundDisabled:"#F5F6FA",border:"#EBEDF3",borderFocused:"#BED2F9",borderError:"#FDBFCE",label:"#242F4A",text:"#252F4A",textDisabled:"#C4CADA",placeholder:"#99A1B7",placeholderDisabled:"#C4CADA",icon:"#99A1B7",iconFocused:"#4B5675",iconDisabled:"#C4CADA",caret:"#5B8DEE",message:"#E82545"},surface:{pressed:"rgba(15, 15, 26, 0.06)",hovered:"rgba(15, 15, 26, 0.04)",selected:"rgba(91, 91, 214, 0.1)",disabled:"#F1F1F5"},glass:{fill:"rgba(255, 255, 255, 0.28)",border:"rgba(255, 255, 255, 0.45)",on:"#0F0F1A",badge:"#FFFFFF"},skeleton:{background:"#EBEDF3",highlight:"#F5F6FA"},avatarPalette:["#5B5BD6","#0A7979","#A45A05","#CD226E","#2462EB","#7C3AED","#047C57","#D42222"]},typography:typography,spacing:spacing,radius:radius,cornerSmoothing:_squircle.SQUIRCLE_SMOOTHING,shadows:lightShadows,motion:motion,components:components,gradients:{}},darkTheme=exports.darkTheme={mode:"dark",colors:{primary:"#7C7CE8",primaryHover:"#9292EE",primaryPressed:"#A8A8F2",primaryMuted:"#1F1F3D",secondary:"#1F1F26",secondaryHover:"#2A2A33",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA",onPrimary:"#0F0F1A",onSecondary:"#FAFAFA",onSuccess:"#0F0F1A",onWarning:"#0F0F1A",onError:"#0F0F1A",onInfo:"#0F0F1A",onOverlay:"#FFFFFF",text:{primary:"#FAFAFA",secondary:"#B4B4BB",tertiary:"#71717A",inverse:"#0F0F1A",strong:"#E2E2E2",disabled:"#52525B",link:"#9292EE"},background:{primary:"#0B0B12",secondary:"#13131C",tertiary:"#1C1C26",elevated:"#1C1C26",overlay:"rgba(0, 0, 0, 0.65)",inverse:"#FAFAFA"},border:{primary:"#27272F",secondary:"#1C1C26",focus:"#7C7CE8",error:"#F87171",width:1},field:{background:"#13131C",backgroundFocused:"#0B0B12",backgroundDisabled:"#1C1C26",border:"#27272F",borderFocused:"#3D5FB0",borderError:"#8A2F42",label:"#E4E6EE",text:"#FAFAFA",textDisabled:"#52525B",placeholder:"#71717A",placeholderDisabled:"#52525B",icon:"#8B8B95",iconFocused:"#D4D4DB",iconDisabled:"#52525B",caret:"#7C9EF0",message:"#F87171"},surface:{pressed:"rgba(255, 255, 255, 0.08)",hovered:"rgba(255, 255, 255, 0.05)",selected:"rgba(124, 124, 232, 0.18)",disabled:"#1C1C26"},glass:{fill:"rgba(255, 255, 255, 0.28)",border:"rgba(255, 255, 255, 0.45)",on:"#0F0F1A",badge:"#FFFFFF"},skeleton:{background:"#1C1C26",highlight:"#27272F"},avatarPalette:["#8B8BEE","#2DD4BF","#FCD34D","#F472B6","#60A5FA","#A78BFA","#34D399","#F87171"]},typography:typography,spacing:spacing,radius:radius,cornerSmoothing:_squircle.SQUIRCLE_SMOOTHING,shadows:darkShadows,motion:motion,components:components,gradients:{}};
@@ -1 +1 @@
1
- "use strict";import{AppIcon}from"./AppIcon.js";import{jsx as _jsx}from"react/jsx-runtime";export const defaultIcons={search:({size:o,color:e})=>_jsx(AppIcon,{name:"search",size:o,color:e}),close:({size:o,color:e})=>_jsx(AppIcon,{name:"x",size:o,color:e}),eye:({size:o,color:e})=>_jsx(AppIcon,{name:"eye",size:o,color:e}),eyeOff:({size:o,color:e})=>_jsx(AppIcon,{name:"eye-off",size:o,color:e}),attachment:({size:o,color:e})=>_jsx(AppIcon,{name:"file-plus-2",size:o,color:e}),error:({size:o,color:e})=>_jsx(AppIcon,{name:"alert-circle",size:o,color:e}),chevronDown:({size:o,color:e})=>_jsx(AppIcon,{name:"chevron-down",size:o,color:e}),chevronRight:({size:o,color:e})=>_jsx(AppIcon,{name:"chevron-right",size:o,color:e})};
1
+ "use strict";import{AppIcon}from"./AppIcon.js";import{jsx as _jsx}from"react/jsx-runtime";export const defaultIcons={search:({size:o,color:e})=>_jsx(AppIcon,{name:"search",size:o,color:e}),close:({size:o,color:e})=>_jsx(AppIcon,{name:"x",size:o,color:e}),eye:({size:o,color:e})=>_jsx(AppIcon,{name:"eye",size:o,color:e}),eyeOff:({size:o,color:e})=>_jsx(AppIcon,{name:"eye-off",size:o,color:e}),attachment:({size:o,color:e})=>_jsx(AppIcon,{name:"file-plus-2",size:o,color:e}),error:({size:o,color:e})=>_jsx(AppIcon,{name:"alert-circle",size:o,color:e}),chevronDown:({size:o,color:e})=>_jsx(AppIcon,{name:"chevron-down",size:o,color:e}),chevronRight:({size:o,color:e})=>_jsx(AppIcon,{name:"chevron-right",size:o,color:e}),selectedTick:({size:o,color:e})=>_jsx(AppIcon,{name:"tick-circle",variant:"bulk",size:o,color:e})};
@@ -1 +1 @@
1
- "use strict";import React,{useEffect,useMemo,useRef}from"react";import{Animated,Easing,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{defaultIcons}from"../AppIcon/defaultIcons.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const expandColorSides=e=>"string"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??"transparent",right:e.right??"transparent",bottom:e.bottom??"transparent",left:e.left??"transparent"},expandWidthSides=e=>"number"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0};export const pickRepresentativeBorderColor=e=>{for(const t of["bottom","top","left","right"]){const o=e[t];if(o&&"transparent"!==o)return o}return e.bottom};export const resolveFieldTextStyle=(e,t={})=>{const{disabled:o=!1}=t,r=e.components.field,i=e.colors.field;return{color:o?r?.disabledTextColor??i.textDisabled:r?.textColor??i.text,placeholderColor:r?.placeholderColor??(o?i.placeholderDisabled:i.placeholder),weightStyle:r?.fontWeight?{fontWeight:r.fontWeight}:fontFor(e,"normal")}};export const RequiredMark=()=>{const e=useTheme(),t=e.components.field;return _jsx(Text,{style:{color:t?.requiredMarkerColor??e.colors.error},children:` ${t?.requiredMarker??"*"}`})};export const RequiredPlaceholder=({text:e,color:t,fontSize:o,weightStyle:r,align:i="center",paddingTop:l,textAlign:n})=>_jsx(View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{justifyContent:"top"===i?"flex-start":"center",paddingTop:l}],children:_jsxs(Text,{accessible:!1,numberOfLines:1,style:{color:t,fontSize:o,...r,includeFontPadding:!1,textAlign:n},children:[e,_jsx(RequiredMark,{})]})});export const FieldErrorGlyph=({size:e,color:t})=>{const o=useTheme(),r=o.icons?.error??defaultIcons.error;return _jsx(_Fragment,{children:r({size:e,color:t})})};export const hasFieldText=e=>null!=e&&!1!==e&&!0!==e&&""!==e;export const fieldTextAsString=e=>"string"==typeof e?e:void 0;export const FieldLabel=({children:e,size:t="md",required:o=!1,help:r,color:i,style:l})=>{const n=useTheme(),s=resolveFieldSize(n,t),d=hasFieldText(r),a=_jsxs(Text,{style:[familyStyles.label,{color:i??n.colors.field.label,fontSize:s.labelFontSize,...fontFor(n,"semibold"),marginBottom:d?0:s.labelGap},d?familyStyles.labelShrink:null,l],children:[e,o?_jsx(RequiredMark,{}):null]});return d?_jsxs(View,{style:[familyStyles.labelRow,{marginBottom:s.labelGap}],children:[a,_jsx(View,{style:[familyStyles.help,{marginLeft:n.spacing.xs}],children:r})]}):a};export const FieldMessage=({text:e,error:t=!1,size:o="md",style:r})=>{const i=useTheme(),l=resolveFieldSize(i,o);if(!hasFieldText(e))return null;const n=t?i.colors.field.message:i.colors.text.secondary;return _jsxs(View,{style:[familyStyles.messageRow,{marginTop:l.messageGap,columnGap:i.spacing.xs+2}],accessibilityLiveRegion:t?"polite":"none",children:[t?_jsx(FieldErrorGlyph,{size:l.messageFontSize,color:n}):null,_jsx(Text,{style:[familyStyles.messageText,{color:n,fontSize:l.messageFontSize,...fontFor(i,"normal")},r],children:e})]})};const familyStyles=StyleSheet.create({label:{includeFontPadding:!1},labelShrink:{flexShrink:1},labelRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0,alignItems:"center",justifyContent:"center"},messageRow:{flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1}});export const resolveFieldSize=(e,t)=>{const o=e.components.field?.[t],r=DEFAULT_SIZES[t];return{paddingHorizontal:o?.paddingHorizontal??r.paddingHorizontal,paddingVertical:o?.paddingVertical??r.paddingVertical,minHeight:o?.minHeight??r.minHeight,fontSize:o?.fontSize??r.fontSize,borderRadius:o?.borderRadius??r.borderRadius,iconSize:o?.iconSize??r.iconSize,labelFontSize:o?.labelFontSize??r.labelFontSize,labelGap:o?.labelGap??r.labelGap,messageFontSize:o?.messageFontSize??r.messageFontSize,messageGap:o?.messageGap??r.messageGap}};const DEFAULT_SIZES={sm:{paddingHorizontal:12,paddingVertical:10,minHeight:38,fontSize:13,borderRadius:10,iconSize:14,labelFontSize:11,labelGap:4,messageFontSize:11,messageGap:2},md:{paddingHorizontal:14,paddingVertical:13,minHeight:44,fontSize:14,borderRadius:10,iconSize:16,labelFontSize:12,labelGap:4,messageFontSize:12,messageGap:2},lg:{paddingHorizontal:16,paddingVertical:15,minHeight:52,fontSize:16,borderRadius:10,iconSize:18,labelFontSize:13,labelGap:4,messageFontSize:13,messageGap:2}};export const resolveVariantColors=(e,t,o)=>{const r=e.components.field?.[t],i=e.colors.field;let l,n,s,d,a;"outlined"===t?(l=i.background,n=i.backgroundFocused,s=i.backgroundDisabled,d=i.border,a=e.colors.border.width):"underline"===t?(l="transparent",n=void 0,s="transparent",d={bottom:i.border},a={bottom:e.colors.border.width}):(l=i.background,n=void 0,s=i.backgroundDisabled,d="transparent",a=0);const wrapToIdleShape=e=>"string"==typeof d?e:{bottom:e},c=expandColorSides(o?.borderIdle??r?.borderIdle??d),b=expandColorSides(o?.borderFocused??r?.borderFocused??wrapToIdleShape(i.borderFocused)),p=expandColorSides(o?.borderError??r?.borderError??wrapToIdleShape(i.borderError)),g=expandColorSides(o?.borderDisabled??r?.borderDisabled??d),u=expandWidthSides(o?.borderWidth??r?.borderWidth??a);return{backgroundIdleEmpty:o?.backgroundIdleEmpty??r?.backgroundIdleEmpty??l,backgroundIdleFilled:o?.backgroundIdleFilled??r?.backgroundIdleFilled??o?.backgroundIdleEmpty??r?.backgroundIdleEmpty??l,backgroundFocused:o?.backgroundFocused??r?.backgroundFocused??n,backgroundError:o?.backgroundError??r?.backgroundError??void 0,backgroundDisabled:o?.backgroundDisabled??r?.backgroundDisabled??s,borderIdle:c,borderFocused:b,borderError:p,borderDisabled:g,borderWidth:u,borderFocusedRepresentative:pickRepresentativeBorderColor(b)}};export const FieldBase=e=>{const{size:t="md",variant:o,focused:r=!1,disabled:i=!1,error:l=!1,filled:n=!1,leading:s,leadingDivider:d=!1,trailing:a,slotAlign:c="center",slotLineHeight:b,topNotch:p,children:g,onPress:u,pressFeedback:m=!0,minHeight:h,maxHeight:f,width:x,height:S,paddingHorizontal:y,paddingLeft:F,paddingRight:z,paddingVertical:R,borderRadius:k,borderTopLeftRadius:C,borderTopRightRadius:T,borderBottomLeftRadius:j,borderBottomRightRadius:v,borderWidth:w,borderTopWidth:I,borderRightWidth:_,borderBottomWidth:E,borderLeftWidth:V,gap:H,fillOverrides:D,style:L,testID:W,accessibilityRole:G,accessibilityLabel:B,accessibilityState:q,accessibilityHint:A}=e,M=useTheme(),P=useMemo(()=>buildStyles(),[]),N=o??M.components.field?.defaultVariant??"outlined",O=resolveFieldSize(M,t),U=useMemo(()=>resolveVariantColors(M,N,D),[M,N,D]),Z=l?2:r?1:0,$=useRef(createAnimatedValue(Z)).current;useEffect(()=>{const e=Animated.timing($,{toValue:Z,duration:M.motion.duration.fast,easing:Easing.bezier(...M.motion.easing.standard),useNativeDriver:!1});return e.start(),()=>e.stop()},[Z,$,M.motion.duration.fast,M.motion.easing.standard]);const J=[0,1,2],K=n?U.backgroundIdleFilled:U.backgroundIdleEmpty,Q=U.backgroundFocused??K,X=U.backgroundError??K,Y=i?U.backgroundDisabled:$.interpolate({inputRange:J,outputRange:[K,Q,X]}),ee=U.borderIdle,te=U.borderFocused,oe=U.borderError,re={top:I,right:_,bottom:E,left:V},ie={top:re.top??w??U.borderWidth.top,right:re.right??w??U.borderWidth.right,bottom:re.bottom??w??U.borderWidth.bottom,left:re.left??w??U.borderWidth.left},le={minHeight:S??h??O.minHeight,maxHeight:f,paddingHorizontal:y??O.paddingHorizontal,paddingVertical:R??O.paddingVertical,paddingLeft:F??y??O.paddingHorizontal,paddingRight:z??y??O.paddingHorizontal,backgroundColor:Y,columnGap:H??M.spacing.md,alignItems:"top"===c?"flex-start":"center"},ne="underline"===N,se=ne?0:k??O.borderRadius,de=ne?{tl:0,tr:0,bl:0,br:0}:{tl:C??se,tr:T??se,bl:j??se,br:v??se};le.borderTopLeftRadius=de.tl,le.borderTopRightRadius=de.tr,le.borderBottomLeftRadius=de.bl,le.borderBottomRightRadius=de.br,le.borderCurve=smoothCorners.borderCurve,le.borderTopWidth=ie.top,le.borderRightWidth=ie.right,le.borderBottomWidth=ie.bottom,le.borderLeftWidth=ie.left;const sideColor=e=>$.interpolate({inputRange:J,outputRange:[ee[e],te[e],oe[e]]}),sameOnEverySide=e=>e.top===e.right&&e.top===e.bottom&&e.top===e.left,ae=!ne&&de.tl===de.tr&&de.tl===de.bl&&de.tl===de.br&&sameOnEverySide(ie)&&sameOnEverySide(ee)&&sameOnEverySide(te)&&sameOnEverySide(oe)&&sameOnEverySide(U.borderDisabled),ce=useSquircle(ae,de.tl);if(ce.active)le.backgroundColor="transparent",le.borderTopColor="transparent",le.borderRightColor="transparent",le.borderBottomColor="transparent",le.borderLeftColor="transparent";else if(i){const e=U.borderDisabled;le.borderTopColor=e.top,le.borderRightColor=e.right,le.borderBottomColor=e.bottom,le.borderLeftColor=e.left}else le.borderTopColor=sideColor("top"),le.borderRightColor=sideColor("right"),le.borderBottomColor=sideColor("bottom"),le.borderLeftColor=sideColor("left");const be=i?U.borderDisabled.top:sideColor("top"),pe=useRef(Z);pe.current=Z,useEffect(()=>{$.setValue(pe.current)},[U,$]),void 0!==x&&(le.width=x),void 0!==S&&(le.height=S);const ge={disabled:i,...q},ue="top"===c,me=ue?{alignSelf:"flex-start",marginTop:Math.max(0,((b??O.iconSize)-O.iconSize)/2)}:null,he=S??h??O.minHeight,fe=(()=>{if(!p)return 0;const e=Math.min(de.tl,he/2),t=p.left;return e<=0||t>=e?0:Math.ceil(e-Math.sqrt(e*e-(e-t)*(e-t)))})(),xe=p&&ie.top>0?_jsx(Animated.View,{pointerEvents:"none",style:{position:"absolute",top:-ie.top,left:p.left-ie.left,width:p.width,height:ie.top+fe,backgroundColor:Y}}):null,renderInner=e=>_jsxs(_Fragment,{children:[ce.active&&ce.size?_jsx(SquircleFill,{width:ce.size.width,height:ce.size.height,radius:de.tl,fill:e&&!i?M.colors.surface.pressed:Y,stroke:be,strokeWidth:ie.top,outset:ie.top}):null,xe,null!=s?_jsx(View,{style:[P.slot,me],children:s}):null,null!=s&&d?_jsx(View,{pointerEvents:"none",style:[P.divider,me,{height:O.iconSize,backgroundColor:M.colors.field.border}]}):null,_jsx(View,{style:[P.content,ue?P.contentTop:null],children:g}),null!=a?_jsx(View,{style:[P.slot,me],children:a}):null]}),Se=_jsx(Animated.View,{onLayout:ce.onLayout,style:[P.box,le,L],accessibilityRole:G,accessibilityLabel:B,accessibilityHint:A,accessibilityState:ge,testID:W,children:renderInner(!1)});return u&&!m?_jsx(Pressable,{onPress:u,disabled:i,accessible:!1,children:Se}):u?_jsx(Pressable,{onPress:u,disabled:i,accessibilityRole:G??"button",accessibilityLabel:B,accessibilityHint:A,accessibilityState:ge,testID:W,children:({pressed:e})=>_jsx(Animated.View,{onLayout:ce.onLayout,style:[P.box,le,!e||i||ce.active?null:{backgroundColor:M.colors.surface.pressed},L],children:renderInner(e)})}):Se};FieldBase.displayName="FieldBase";const buildStyles=()=>StyleSheet.create({box:{flexDirection:"row",alignItems:"center",overflow:"visible"},slot:{alignItems:"center",justifyContent:"center"},divider:{width:1,alignSelf:"center"},content:{flex:1,flexDirection:"row",alignItems:"center"},contentTop:{alignItems:"flex-start"}});export default FieldBase;
1
+ "use strict";import{useEffect,useMemo,useRef}from"react";import{Animated,Easing,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{defaultIcons}from"../AppIcon/defaultIcons.js";import{NotationInkContext}from"../Notation/Notation.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const expandColorSides=e=>"string"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??"transparent",right:e.right??"transparent",bottom:e.bottom??"transparent",left:e.left??"transparent"},expandWidthSides=e=>"number"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0};export const pickRepresentativeBorderColor=e=>{for(const t of["bottom","top","left","right"]){const o=e[t];if(o&&"transparent"!==o)return o}return e.bottom};export const resolveFieldTextStyle=(e,t={})=>{const{disabled:o=!1}=t,r=e.components.field,i=e.colors.field;return{color:o?r?.disabledTextColor??i.textDisabled:r?.textColor??i.text,placeholderColor:r?.placeholderColor??(o?i.placeholderDisabled:i.placeholder),weightStyle:r?.fontWeight?{fontWeight:r.fontWeight}:fontFor(e,"normal")}};export const RequiredMark=()=>{const e=useTheme(),t=e.components.field;return _jsx(Text,{style:{color:t?.requiredMarkerColor??e.colors.error},children:` ${t?.requiredMarker??"*"}`})};export const RequiredPlaceholder=({text:e,color:t,fontSize:o,weightStyle:r,align:i="center",paddingTop:l,textAlign:n})=>_jsx(View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{justifyContent:"top"===i?"flex-start":"center",paddingTop:l}],children:_jsxs(Text,{accessible:!1,numberOfLines:1,style:{color:t,fontSize:o,...r,includeFontPadding:!1,textAlign:n},children:[e,_jsx(RequiredMark,{})]})});export const FieldErrorGlyph=({size:e,color:t})=>{const o=useTheme(),r=o.icons?.error??defaultIcons.error;return _jsx(_Fragment,{children:r({size:e,color:t})})};export const hasFieldText=e=>null!=e&&!1!==e&&!0!==e&&""!==e;export const fieldTextAsString=e=>"string"==typeof e?e:void 0;export const FieldLabel=({children:e,size:t="md",required:o=!1,help:r,color:i,style:l})=>{const n=useTheme(),s=resolveFieldSize(n,t),d=hasFieldText(r),a=StyleSheet.flatten(l),c=a?.fontSize??s.labelFontSize,b=a?.color??i??n.colors.field.label,p=useMemo(()=>({fontSize:c,color:b}),[c,b]),g=_jsxs(Text,{style:[familyStyles.label,{color:i??n.colors.field.label,fontSize:s.labelFontSize,...fontFor(n,"semibold"),marginBottom:d?0:s.labelGap},d?familyStyles.labelShrink:null,l],children:[_jsx(NotationInkContext.Provider,{value:p,children:e}),o?_jsx(RequiredMark,{}):null]});return d?_jsxs(View,{style:[familyStyles.labelRow,{marginBottom:s.labelGap}],children:[g,_jsx(View,{style:[familyStyles.help,{marginLeft:n.spacing.xs}],children:r})]}):g};export const FieldMessage=({text:e,error:t=!1,size:o="md",style:r})=>{const i=useTheme(),l=resolveFieldSize(i,o);if(!hasFieldText(e))return null;const n=t?i.colors.field.message:i.colors.text.secondary;return _jsxs(View,{style:[familyStyles.messageRow,{marginTop:l.messageGap,columnGap:i.spacing.xs+2}],accessibilityLiveRegion:t?"polite":"none",children:[t?_jsx(FieldErrorGlyph,{size:l.messageFontSize,color:n}):null,_jsx(Text,{style:[familyStyles.messageText,{color:n,fontSize:l.messageFontSize,...fontFor(i,"normal")},r],children:e})]})};const familyStyles=StyleSheet.create({label:{includeFontPadding:!1},labelShrink:{flexShrink:1},labelRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0,alignItems:"center",justifyContent:"center"},messageRow:{flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1}});export const resolveFieldSize=(e,t)=>{const o=e.components.field?.[t],r=DEFAULT_SIZES[t];return{paddingHorizontal:o?.paddingHorizontal??r.paddingHorizontal,paddingVertical:o?.paddingVertical??r.paddingVertical,minHeight:o?.minHeight??r.minHeight,fontSize:o?.fontSize??r.fontSize,borderRadius:o?.borderRadius??r.borderRadius,iconSize:o?.iconSize??r.iconSize,labelFontSize:o?.labelFontSize??r.labelFontSize,labelGap:o?.labelGap??r.labelGap,messageFontSize:o?.messageFontSize??r.messageFontSize,messageGap:o?.messageGap??r.messageGap}};const DEFAULT_SIZES={sm:{paddingHorizontal:12,paddingVertical:10,minHeight:38,fontSize:13,borderRadius:10,iconSize:14,labelFontSize:11,labelGap:4,messageFontSize:11,messageGap:2},md:{paddingHorizontal:14,paddingVertical:13,minHeight:44,fontSize:14,borderRadius:10,iconSize:16,labelFontSize:12,labelGap:4,messageFontSize:12,messageGap:2},lg:{paddingHorizontal:16,paddingVertical:15,minHeight:52,fontSize:16,borderRadius:10,iconSize:18,labelFontSize:13,labelGap:4,messageFontSize:13,messageGap:2}};export const resolveVariantColors=(e,t,o)=>{const r=e.components.field?.[t],i=e.colors.field;let l,n,s,d,a;"outlined"===t?(l=i.background,n=i.backgroundFocused,s=i.backgroundDisabled,d=i.border,a=e.colors.border.width):"underline"===t?(l="transparent",n=void 0,s="transparent",d={bottom:i.border},a={bottom:e.colors.border.width}):(l=i.background,n=void 0,s=i.backgroundDisabled,d="transparent",a=0);const wrapToIdleShape=e=>"string"==typeof d?e:{bottom:e},c=expandColorSides(o?.borderIdle??r?.borderIdle??d),b=expandColorSides(o?.borderFocused??r?.borderFocused??wrapToIdleShape(i.borderFocused)),p=expandColorSides(o?.borderError??r?.borderError??wrapToIdleShape(i.borderError)),g=expandColorSides(o?.borderDisabled??r?.borderDisabled??d),u=expandWidthSides(o?.borderWidth??r?.borderWidth??a);return{backgroundIdleEmpty:o?.backgroundIdleEmpty??r?.backgroundIdleEmpty??l,backgroundIdleFilled:o?.backgroundIdleFilled??r?.backgroundIdleFilled??o?.backgroundIdleEmpty??r?.backgroundIdleEmpty??l,backgroundFocused:o?.backgroundFocused??r?.backgroundFocused??n,backgroundError:o?.backgroundError??r?.backgroundError??void 0,backgroundDisabled:o?.backgroundDisabled??r?.backgroundDisabled??s,borderIdle:c,borderFocused:b,borderError:p,borderDisabled:g,borderWidth:u,borderFocusedRepresentative:pickRepresentativeBorderColor(b)}};export const FieldBase=e=>{const{size:t="md",variant:o,focused:r=!1,disabled:i=!1,error:l=!1,filled:n=!1,leading:s,leadingDivider:d=!1,trailing:a,slotAlign:c="center",slotLineHeight:b,topNotch:p,children:g,onPress:u,pressFeedback:m=!0,minHeight:h,maxHeight:f,width:x,height:S,paddingHorizontal:y,paddingLeft:F,paddingRight:z,paddingVertical:k,borderRadius:R,borderTopLeftRadius:C,borderTopRightRadius:j,borderBottomLeftRadius:v,borderBottomRightRadius:T,borderWidth:I,borderTopWidth:w,borderRightWidth:_,borderBottomWidth:E,borderLeftWidth:V,gap:H,fillOverrides:D,style:L,testID:W,accessibilityRole:G,accessibilityLabel:B,accessibilityState:q,accessibilityHint:A}=e,M=useTheme(),P=useMemo(()=>buildStyles(),[]),N=o??M.components.field?.defaultVariant??"outlined",O=resolveFieldSize(M,t),U=useMemo(()=>resolveVariantColors(M,N,D),[M,N,D]),Z=l?2:r?1:0,$=useRef(createAnimatedValue(Z)).current;useEffect(()=>{const e=Animated.timing($,{toValue:Z,duration:M.motion.duration.fast,easing:Easing.bezier(...M.motion.easing.standard),useNativeDriver:!1});return e.start(),()=>e.stop()},[Z,$,M.motion.duration.fast,M.motion.easing.standard]);const J=[0,1,2],K=n?U.backgroundIdleFilled:U.backgroundIdleEmpty,Q=U.backgroundFocused??K,X=U.backgroundError??K,Y=i?U.backgroundDisabled:$.interpolate({inputRange:J,outputRange:[K,Q,X]}),ee=U.borderIdle,te=U.borderFocused,oe=U.borderError,re={top:w,right:_,bottom:E,left:V},ie={top:re.top??I??U.borderWidth.top,right:re.right??I??U.borderWidth.right,bottom:re.bottom??I??U.borderWidth.bottom,left:re.left??I??U.borderWidth.left},le={minHeight:S??h??O.minHeight,maxHeight:f,paddingHorizontal:y??O.paddingHorizontal,paddingVertical:k??O.paddingVertical,paddingLeft:F??y??O.paddingHorizontal,paddingRight:z??y??O.paddingHorizontal,backgroundColor:Y,columnGap:H??M.spacing.md,alignItems:"top"===c?"flex-start":"center"},ne="underline"===N,se=ne?0:R??O.borderRadius,de=ne?{tl:0,tr:0,bl:0,br:0}:{tl:C??se,tr:j??se,bl:v??se,br:T??se};le.borderTopLeftRadius=de.tl,le.borderTopRightRadius=de.tr,le.borderBottomLeftRadius=de.bl,le.borderBottomRightRadius=de.br,le.borderCurve=smoothCorners.borderCurve,le.borderTopWidth=ie.top,le.borderRightWidth=ie.right,le.borderBottomWidth=ie.bottom,le.borderLeftWidth=ie.left;const sideColor=e=>$.interpolate({inputRange:J,outputRange:[ee[e],te[e],oe[e]]}),sameOnEverySide=e=>e.top===e.right&&e.top===e.bottom&&e.top===e.left,ae=!ne&&de.tl===de.tr&&de.tl===de.bl&&de.tl===de.br&&sameOnEverySide(ie)&&sameOnEverySide(ee)&&sameOnEverySide(te)&&sameOnEverySide(oe)&&sameOnEverySide(U.borderDisabled),ce=useSquircle(ae,de.tl);if(ce.active)le.backgroundColor="transparent",le.borderTopColor="transparent",le.borderRightColor="transparent",le.borderBottomColor="transparent",le.borderLeftColor="transparent";else if(i){const e=U.borderDisabled;le.borderTopColor=e.top,le.borderRightColor=e.right,le.borderBottomColor=e.bottom,le.borderLeftColor=e.left}else le.borderTopColor=sideColor("top"),le.borderRightColor=sideColor("right"),le.borderBottomColor=sideColor("bottom"),le.borderLeftColor=sideColor("left");const be=i?U.borderDisabled.top:sideColor("top"),pe=useRef(Z);pe.current=Z,useEffect(()=>{$.setValue(pe.current)},[U,$]),void 0!==x&&(le.width=x),void 0!==S&&(le.height=S);const ge={disabled:i,...q},ue="top"===c,me=ue?{alignSelf:"flex-start",marginTop:Math.max(0,((b??O.iconSize)-O.iconSize)/2)}:null,he=S??h??O.minHeight,fe=(()=>{if(!p)return 0;const e=Math.min(de.tl,he/2),t=p.left;return e<=0||t>=e?0:Math.ceil(e-Math.sqrt(e*e-(e-t)*(e-t)))})(),xe=p&&ie.top>0?_jsx(Animated.View,{pointerEvents:"none",style:{position:"absolute",top:-ie.top,left:p.left-ie.left,width:p.width,height:ie.top+fe,backgroundColor:Y}}):null,renderInner=e=>_jsxs(_Fragment,{children:[ce.active&&ce.size?_jsx(SquircleFill,{width:ce.size.width,height:ce.size.height,radius:de.tl,fill:e&&!i?M.colors.surface.pressed:Y,stroke:be,strokeWidth:ie.top,outset:ie.top}):null,xe,null!=s?_jsx(View,{style:[P.slot,me],children:s}):null,null!=s&&d?_jsx(View,{pointerEvents:"none",style:[P.divider,me,{height:O.iconSize,backgroundColor:M.colors.field.border}]}):null,_jsx(View,{style:[P.content,ue?P.contentTop:null],children:g}),null!=a?_jsx(View,{style:[P.slot,me],children:a}):null]}),Se=_jsx(Animated.View,{onLayout:ce.onLayout,style:[P.box,le,L],accessibilityRole:G,accessibilityLabel:B,accessibilityHint:A,accessibilityState:ge,testID:W,children:renderInner(!1)});return u&&!m?_jsx(Pressable,{onPress:u,disabled:i,accessible:!1,children:Se}):u?_jsx(Pressable,{onPress:u,disabled:i,accessibilityRole:G??"button",accessibilityLabel:B,accessibilityHint:A,accessibilityState:ge,testID:W,children:({pressed:e})=>_jsx(Animated.View,{onLayout:ce.onLayout,style:[P.box,le,!e||i||ce.active?null:{backgroundColor:M.colors.surface.pressed},L],children:renderInner(e)})}):Se};FieldBase.displayName="FieldBase";const buildStyles=()=>StyleSheet.create({box:{flexDirection:"row",alignItems:"center",overflow:"visible"},slot:{alignItems:"center",justifyContent:"center"},divider:{width:1,alignSelf:"center"},content:{flex:1,flexDirection:"row",alignItems:"center"},contentTop:{alignItems:"flex-start"}});export default FieldBase;