@webority/mobile-ui 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Banner/Banner.js +1 -1
- package/lib/commonjs/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/commonjs/components/StatusBadge/StatusBadge.js +1 -1
- package/lib/commonjs/theme/tokens.js +1 -1
- package/lib/module/components/Banner/Banner.js +1 -1
- package/lib/module/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/module/components/StatusBadge/StatusBadge.js +1 -1
- package/lib/module/theme/tokens.js +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +2 -0
- package/lib/typescript/module/theme/types.d.ts +2 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Banner=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_index2=require("../Skeleton/index.js"),_jsxRuntime=require("react/jsx-runtime");const Banner=exports.Banner=(0,_react.forwardRef)((e,t)=>{const{title:n,message:r,variant:i="info",icon:o,actions:s,dismissible:a=!1,onDismiss:c,haptic:l,visible:d=!0,animateMount:u=!0,loading:m=!1,accessibilityRole:p="alert",accessibilityLabel:g,style:x,containerStyle:h,iconCircleStyle:y,tintBarStyle:_,closeButtonStyle:b,actionButtonStyle:f,testID:j}=e,R=(0,_index.useTheme)(),v=(0,_react.useMemo)(()=>buildStyles(R),[R]),w=(0,_react.useMemo)(()=>tintFor(R,i),[R,i]),S=(0,_react.useRef)((0,_index.createAnimatedValue)(u&&d?-20:0)).current,B=(0,_react.useRef)((0,_index.createAnimatedValue)(u&&d?0:d?1:0)).current,[N,k]=(0,_react.useState)(d),C=(0,_react.useRef)(!0);if((0,_react.useEffect)(()=>{if(C.current&&(C.current=!1,!u))return;let e;return d?(k(!0),e=_reactNative.Animated.parallel([_reactNative.Animated.timing(S,{toValue:0,duration:R.motion.duration.normal,useNativeDriver:!0}),_reactNative.Animated.timing(B,{toValue:1,duration:R.motion.duration.normal,useNativeDriver:!0})]),e.start()):N&&(e=_reactNative.Animated.parallel([_reactNative.Animated.timing(S,{toValue:-20,duration:R.motion.duration.fast,useNativeDriver:!0}),_reactNative.Animated.timing(B,{toValue:0,duration:R.motion.duration.fast,useNativeDriver:!0})]),e.start(()=>{k(!1)})),()=>e?.stop()},[d]),!N)return null;const V=n??" ",T="string"==typeof r?r??" ":"",z="alert"===p?"error"===i?"assertive":"polite":"none",H=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{ref:t,accessibilityRole:p,accessibilityLiveRegion:z,accessibilityLabel:g,testID:j,style:[v.container,{backgroundColor:R.colors.background.secondary,borderRadius:R.radius.md,..._corners.smoothCorners,padding:R.spacing.md,opacity:B,transform:[{translateY:S}]},x,h],children:[(R.components.banner?.tintBarWidth??0)>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.tintBar,{backgroundColor:w.bar},_]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:v.row,children:[!1===o?null:o?(0,_jsxRuntime.jsx)(_reactNative.View,{style:v.iconWrap,children:o}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.iconCircle,{backgroundColor:w.bar+"22"},y],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[v.iconGlyph,{color:w.ink}],accessible:!1,children:w.glyph})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:v.textBlock,children:[n||m?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:R.colors.text.primary,fontSize:R.typography.fontSize.base,...(0,_index.fontFor)(R,"semibold"),lineHeight:20},numberOfLines:2,children:V}):null,"string"==typeof r||m?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:R.colors.text.secondary,fontSize:R.typography.fontSize.sm,...(0,_index.fontFor)(R,"normal"),lineHeight:18,marginTop:n?2:0},children:T||" "}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginTop:n?2:0},children:r})]}),a?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:"Dismiss banner",onPress:()=>{const e=(0,_hapticUtils.resolveHaptic)(l,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),c?.()},hitSlop:8,style:({pressed:e})=>[v.closeBtn,{backgroundColor:e?R.colors.surface.pressed:"transparent"},b],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:R.colors.text.secondary,fontSize:R.components.banner?.closeGlyphFontSize??18,fontWeight:R.typography.fontWeight.bold,lineHeight:18},accessible:!1,children:"×"})}):null]}),s&&s.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:v.actionsRow,children:s.map((e,t)=>{const n=e.tone??"primary",r=e.variant??"ghost",i="danger"===n?R.colors.error:"neutral"===n?R.colors.text.secondary:w.glyphColor,o="danger"===n?R.colors.toneText.error:"neutral"===n?R.colors.text.secondary:w.ink,s="danger"===n?R.colors.onError:"neutral"===n?R.colors.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Banner=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_index2=require("../Skeleton/index.js"),_jsxRuntime=require("react/jsx-runtime");const Banner=exports.Banner=(0,_react.forwardRef)((e,t)=>{const{title:n,message:r,variant:i="info",icon:o,actions:s,dismissible:a=!1,onDismiss:c,haptic:l,visible:d=!0,animateMount:u=!0,loading:m=!1,accessibilityRole:p="alert",accessibilityLabel:g,style:x,containerStyle:h,iconCircleStyle:y,tintBarStyle:_,closeButtonStyle:b,actionButtonStyle:f,testID:j}=e,R=(0,_index.useTheme)(),v=(0,_react.useMemo)(()=>buildStyles(R),[R]),w=(0,_react.useMemo)(()=>tintFor(R,i),[R,i]),S=(0,_react.useRef)((0,_index.createAnimatedValue)(u&&d?-20:0)).current,B=(0,_react.useRef)((0,_index.createAnimatedValue)(u&&d?0:d?1:0)).current,[N,k]=(0,_react.useState)(d),C=(0,_react.useRef)(!0);if((0,_react.useEffect)(()=>{if(C.current&&(C.current=!1,!u))return;let e;return d?(k(!0),e=_reactNative.Animated.parallel([_reactNative.Animated.timing(S,{toValue:0,duration:R.motion.duration.normal,useNativeDriver:!0}),_reactNative.Animated.timing(B,{toValue:1,duration:R.motion.duration.normal,useNativeDriver:!0})]),e.start()):N&&(e=_reactNative.Animated.parallel([_reactNative.Animated.timing(S,{toValue:-20,duration:R.motion.duration.fast,useNativeDriver:!0}),_reactNative.Animated.timing(B,{toValue:0,duration:R.motion.duration.fast,useNativeDriver:!0})]),e.start(()=>{k(!1)})),()=>e?.stop()},[d]),!N)return null;const V=n??" ",T="string"==typeof r?r??" ":"",z="alert"===p?"error"===i?"assertive":"polite":"none",H=(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{ref:t,accessibilityRole:p,accessibilityLiveRegion:z,accessibilityLabel:g,testID:j,style:[v.container,{backgroundColor:R.colors.background.secondary,borderRadius:R.radius.md,..._corners.smoothCorners,padding:R.spacing.md,opacity:B,transform:[{translateY:S}]},x,h],children:[(R.components.banner?.tintBarWidth??0)>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.tintBar,{backgroundColor:w.bar},_]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:v.row,children:[!1===o?null:o?(0,_jsxRuntime.jsx)(_reactNative.View,{style:v.iconWrap,children:o}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[v.iconCircle,{backgroundColor:w.bar+"22"},y],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[v.iconGlyph,{color:w.ink}],accessible:!1,children:w.glyph})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:v.textBlock,children:[n||m?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:R.colors.text.primary,fontSize:R.typography.fontSize.base,...(0,_index.fontFor)(R,"semibold"),lineHeight:20},numberOfLines:2,children:V}):null,"string"==typeof r||m?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:R.colors.text.secondary,fontSize:R.typography.fontSize.sm,...(0,_index.fontFor)(R,"normal"),lineHeight:18,marginTop:n?2:0},children:T||" "}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginTop:n?2:0},children:r})]}),a?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:"Dismiss banner",onPress:()=>{const e=(0,_hapticUtils.resolveHaptic)(l,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),c?.()},hitSlop:8,style:({pressed:e})=>[v.closeBtn,{backgroundColor:e?R.colors.surface.pressed:"transparent"},b],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:R.colors.text.secondary,fontSize:R.components.banner?.closeGlyphFontSize??18,fontWeight:R.typography.fontWeight.bold,lineHeight:18},accessible:!1,children:"×"})}):null]}),s&&s.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:v.actionsRow,children:s.map((e,t)=>{const n=e.tone??"primary",r=e.variant??"ghost",i="danger"===n?R.colors.error:"neutral"===n?R.colors.text.secondary:w.glyphColor,o="danger"===n?R.colors.toneText.error:"neutral"===n?R.colors.text.secondary:w.ink,s="danger"===n?R.colors.onError:"neutral"===n?R.colors.onNeutral:w.on,a="solid"===r;return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{const t=(0,_hapticUtils.resolveHaptic)(l,"selection");t&&(0,_hapticUtils.triggerHaptic)(t),e.onPress()},style:({pressed:t})=>[v.actionBtn,"md"===e.size&&v.actionBtnMd,"outline"===r&&{borderWidth:1,borderColor:o},{backgroundColor:a?i:t?R.colors.surface.pressed:"transparent",opacity:a&&t?.85:1},f],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{color:a?s:o,fontSize:R.typography.fontSize.sm,textAlign:"center",...(0,_index.fontFor)(R,"semibold")},children:e.label})},`${e.label}-${t}`)})}):null]});return m?(0,_jsxRuntime.jsx)(BannerSkeleton,{...e}):H});Banner.displayName="Banner";const BannerSkeleton=({title:e,actions:t,icon:n,containerStyle:r,style:i})=>{const o=(0,_index.useTheme)(),s=!1!==n;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{flexDirection:"row",alignItems:"flex-start",backgroundColor:o.colors.background.elevated,borderRadius:o.radius.md,..._corners.smoothCorners,padding:o.spacing.md,borderWidth:1,borderColor:o.colors.border.primary},r,i],accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:o.spacing.sm},children:(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"circle",width:32,height:32})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},children:[void 0!==e?(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"55%",height:16,style:{marginBottom:o.spacing.xs}}):null,(0,_jsxRuntime.jsx)(_index2.SkeletonText,{lines:2,fontSize:13,lastLineWidth:"70%"}),t&&t.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",marginTop:o.spacing.sm},children:t.map((e,t)=>(0,_jsxRuntime.jsx)(_index2.Skeleton,{width:72,height:28,shape:"rounded",style:{marginRight:o.spacing.sm}},`sk-banner-action-${t}`))}):null]})]})};BannerSkeleton.displayName="BannerSkeleton",Banner.Skeleton=BannerSkeleton;const tintFor=(e,t)=>{switch(t){case"success":return{bar:e.colors.success,glyphColor:e.colors.success,ink:e.colors.toneText.success,on:e.colors.onSuccess,glyph:"✓"};case"warning":return{bar:e.colors.warning,glyphColor:e.colors.warning,ink:e.colors.toneText.warning,on:e.colors.onWarning,glyph:"⚠"};case"error":return{bar:e.colors.error,glyphColor:e.colors.error,ink:e.colors.toneText.error,on:e.colors.onError,glyph:"✗"};case"neutral":return{bar:e.colors.text.tertiary,glyphColor:e.colors.text.secondary,ink:e.colors.text.secondary,on:e.colors.onNeutral,glyph:"i"};default:return{bar:e.colors.primary,glyphColor:e.colors.primary,ink:e.colors.toneText.primary,on:e.colors.onPrimary,glyph:"i"}}},buildStyles=e=>{const t=e.components.banner?.iconCircleSize??28,n=e.components.banner?.closeButtonSize??28;return _reactNative.StyleSheet.create({container:{overflow:"hidden",paddingLeft:e.components.banner?.containerPaddingLeft??e.spacing.md},tintBar:{position:"absolute",left:0,top:0,bottom:0,width:e.components.banner?.tintBarWidth??0},row:{flexDirection:"row",alignItems:"flex-start"},iconWrap:{marginRight:e.components.banner?.iconGap??e.spacing.sm},iconCircle:{width:t,height:t,borderRadius:e.components.banner?.iconCircleRadius??t/2,..._corners.smoothCorners,alignItems:"center",justifyContent:"center",marginRight:e.components.banner?.iconGap??e.spacing.sm},iconGlyph:{fontSize:e.components.banner?.iconGlyphFontSize??15,fontWeight:"700",lineHeight:e.components.banner?.iconGlyphLineHeight??17},textBlock:{flex:1,paddingRight:e.components.banner?.textBlockPaddingRight??e.spacing.xs},closeBtn:{width:n,height:n,borderRadius:e.components.banner?.closeButtonRadius??n/2,..._corners.smoothCorners,alignItems:"center",justifyContent:"center",marginLeft:e.components.banner?.closeButtonMarginLeft??e.spacing.xxs??4},actionsRow:{flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-end",marginTop:e.components.banner?.actionsRowMarginTop??e.spacing.xs,columnGap:e.components.banner?.actionsRowGap??e.spacing.xs,rowGap:e.components.banner?.actionsRowGap??e.spacing.xs},actionBtn:{paddingHorizontal:e.components.banner?.actionButtonPaddingHorizontal??e.spacing.sm,paddingVertical:e.components.banner?.actionButtonPaddingVertical??6,borderRadius:e.components.banner?.actionButtonRadius??e.radius.sm,..._corners.smoothCorners,maxWidth:"100%",alignItems:"center",justifyContent:"center"},actionBtnMd:{minHeight:44,paddingHorizontal:e.spacing.md}})};var _default=exports.default=Banner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ProfilePicker=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_index3=require("../AppIcon/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Avatar/index.js"),_index5=require("../FieldBase/index.js"),_FilePicker=require("../FilePicker/FilePicker.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_index6=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_LABELS={pick:"Change profile photo",remove:"Remove photo",sheetTitle:"Change photo",errorTooLarge:e=>`The photo is larger than ${e} MB.`,errorWrongType:"That file is not a supported image."},DEFAULT_ACCEPT=["image/*"],SHEET_ICON_SIZE=20,SOFT_FILL_OPACITY=.14,SIZE_PX={sm:72,md:120,lg:160},clamp=(e,r,t)=>Math.min(t,Math.max(r,e)),toneFor=(e,r)=>{switch(r){case"success":return{base:e.colors.success,on:e.colors.onSuccess};case"warning":return{base:e.colors.warning,on:e.colors.onWarning};case"error":return{base:e.colors.error,on:e.colors.onError};case"info":return{base:e.colors.info,on:e.colors.onInfo};case"neutral":return{base:e.colors.text.secondary,on:e.colors.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ProfilePicker=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_index3=require("../AppIcon/index.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Avatar/index.js"),_index5=require("../FieldBase/index.js"),_FilePicker=require("../FilePicker/FilePicker.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_index6=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_LABELS={pick:"Change profile photo",remove:"Remove photo",sheetTitle:"Change photo",errorTooLarge:e=>`The photo is larger than ${e} MB.`,errorWrongType:"That file is not a supported image."},DEFAULT_ACCEPT=["image/*"],SHEET_ICON_SIZE=20,SOFT_FILL_OPACITY=.14,SIZE_PX={sm:72,md:120,lg:160},clamp=(e,r,t)=>Math.min(t,Math.max(r,e)),toneFor=(e,r)=>{switch(r){case"success":return{base:e.colors.success,on:e.colors.onSuccess};case"warning":return{base:e.colors.warning,on:e.colors.onWarning};case"error":return{base:e.colors.error,on:e.colors.onError};case"info":return{base:e.colors.info,on:e.colors.onInfo};case"neutral":return{base:e.colors.text.secondary,on:e.colors.onNeutral};default:return{base:e.colors.primary,on:e.colors.onPrimary}}},badgeLookFor=(e,r,t,o)=>{const i=toneFor(e,r),n=o?.badgeColor??i.base,s=e.colors.background.primary,l="neutral"===r&&void 0===o?.badgeColor;let a;switch(t){case"soft":a={fill:l?e.colors.background.tertiary:(0,_color.blendOf)(n,.14,s,e.colors.background.secondary),ring:s,icon:n};break;case"outline":a={fill:s,ring:l?e.colors.border.primary:n,icon:n};break;default:a={fill:n,ring:s,icon:i.on}}return o?.badgeIconColor?{...a,icon:o.badgeIconColor}:a},resolveRadius=(e,r)=>"circle"===e?r/2:"rounded"===e?Math.max(6,Math.round(.22*r)):0,REMOVE_VALUE="__profile-picker-remove__",ProfilePicker=exports.ProfilePicker=(0,_react.forwardRef)((e,r)=>{const{value:t,name:o,sources:i,onPick:n,onRemove:s,loading:l=!1,disabled:a=!1,accept:c=DEFAULT_ACCEPT,maxSizeMB:u,size:d="md",shape:_="circle",badgeIcon:m="camera",tone:x,variant:p,avatarTone:b,avatarBackgroundColor:g,avatarColor:h,label:y,required:f=!1,helperText:v,error:j,layout:k="stacked",title:C,subtitle:S,ImageComponent:R,labels:I,haptic:T,onError:P,accessibilityLabel:F,style:E,testID:w}=e,A=(0,_index.useTheme)(),L=A.components.profilePicker,M=x??L?.defaultTone??"primary",O=p??L?.defaultVariant??"solid",q=(0,_react.useMemo)(()=>badgeLookFor(A,M,O,L),[A,M,O,L]),N=b??L?.defaultAvatarTone,z=(0,_react.useMemo)(()=>{const e=N?(0,_index4.avatarToneColors)(A,N):null;return{background:g??e?.background??A.colors.background.tertiary,icon:h??e?.color??A.colors.text.tertiary}},[A,N,g,h]),V=(0,_react.useMemo)(()=>({...DEFAULT_LABELS,...I}),[I]),[D,B]=(0,_react.useState)(null),[H,U]=(0,_react.useState)(null),[W,$]=(0,_react.useState)(!1),[Z,G]=(0,_react.useState)(t);t!==Z&&(G(t),B(null));const X=l||a,Q=D??t??null,Y=j??H??void 0,J=!X&&(null!==D||Boolean(t)&&Boolean(s)),K=i.length>0||J,ee="number"==typeof d?d:SIZE_PX[d],re=resolveRadius(_,ee),te=re*(1-Math.SQRT1_2),oe=clamp(Math.round(.28*ee),24,44),ie=te-oe/2,ne=Math.max(0,-ie),se=(0,_react.useCallback)(e=>{U(e),P?.(e),!1!==T&&(0,_index2.triggerHaptic)("notificationError")},[P,T]),le=(0,_react.useCallback)(async e=>{let r;try{r=await e.pick()}catch(e){return void se(e instanceof Error?e.message:String(e))}const t=r?.[0];if(!t)return;if("number"==typeof u&&"number"==typeof t.size&&t.size>1024*u*1024)return void se(V.errorTooLarge(u));if(t.type&&!(0,_FilePicker.matchesAccept)(t.type,c))return void se(V.errorWrongType);U(null),B(t.uri);const o=(0,_index2.resolveHaptic)(T,"selection");o&&(0,_index2.triggerHaptic)(o),n?.(t)},[u,c,V,T,n,se]),ae=(0,_react.useCallback)(()=>{X||(de.current=null,1!==i.length||J?(i.length>0||J)&&$(!0):le(i[0]))},[X,i,J,le]),ce=(0,_react.useCallback)(()=>{B(null),U(null);const e=(0,_index2.resolveHaptic)(T,"selection");e&&(0,_index2.triggerHaptic)(e),s?.()},[T,s]),ue=(0,_react.useMemo)(()=>{const e=i.map(e=>({kind:"source",source:e}));return J&&e.push({kind:"remove"}),e},[i,J]),de=(0,_react.useRef)(null),me=(0,_react.useCallback)(e=>{de.current||($(!1),"remove"===e.kind?ce():de.current=e.source)},[ce]),xe=(0,_react.useCallback)(()=>{const e=de.current;de.current=null,e&&le(e)},[le]),pe=w??"profile-picker",be=F??(K?V.pick:o),ge=(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.fill,{width:ee,height:ee,borderRadius:re,..._corners.smoothCorners,backgroundColor:z.background}],children:(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"user",size:Math.round(.45*ee),color:z.icon})}),he=(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:ee,height:ee,marginBottom:ne,marginRight:ne},children:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:ae,disabled:X||!K,accessibilityRole:K?"button":"image",accessibilityLabel:be,accessibilityHint:(0,_index5.fieldTextAsString)(Y),accessibilityState:K?{disabled:X,busy:l}:{busy:l},"aria-disabled":K?X:void 0,"aria-busy":l,testID:`${pe}-button`,style:({pressed:e})=>[{width:ee,height:ee,borderRadius:re,..._corners.smoothCorners},{opacity:a?.55:e?.85:1}],children:[Q||o?(0,_jsxRuntime.jsx)(_index4.Avatar,{source:Q?{uri:Q}:void 0,name:o,size:ee,shape:_,tone:N,backgroundColor:g,color:h,ImageComponent:R,accessibilityLabel:be},Q??"initials"):ge,l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.fill,styles.overlay,{borderRadius:re,..._corners.smoothCorners,backgroundColor:A.colors.background.overlay}],testID:`${pe}-loading`,children:(0,_jsxRuntime.jsx)(_index6.Spinner,{size:ee>=100?"md":"sm",color:A.colors.onPrimary})}):null,!a&&K?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",testID:`${pe}-badge`,style:[styles.badge,{width:oe,height:oe,borderRadius:oe/2,..._corners.smoothCorners,right:ie,bottom:ie,backgroundColor:q.fill,borderColor:q.ring}],children:(0,_slotIcon.renderSlotIcon)(m,{color:q.icon,size:Math.round(.55*oe),disabled:!1})}):null]})}),ye="stacked"!==k?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.meta,"profile"===k?styles.metaCentred:null],children:[C?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.title,"profile"===k?styles.textCentred:null,{color:A.colors.text.primary,fontSize:A.typography.fontSize.base,...(0,_index.fontFor)(A,"semibold")}],children:C}):null,S?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.subtitle,"profile"===k?styles.textCentred:null,{color:A.colors.text.secondary,fontSize:A.typography.fontSize.sm,...(0,_index.fontFor)(A,"normal")}],children:S}):null,(0,_jsxRuntime.jsx)(_index5.FieldMessage,{text:Y??v,error:(0,_index5.hasFieldText)(Y)})]}):(0,_jsxRuntime.jsx)(_index5.FieldMessage,{text:Y??v,error:(0,_index5.hasFieldText)(Y)});return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:r,style:E,testID:w,children:[y?(0,_jsxRuntime.jsx)(_index5.FieldLabel,{required:f,children:y}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:"inline"===k?[styles.row,{columnGap:A.spacing.md}]:["profile"===k?styles.columnCentred:styles.column,{rowGap:A.spacing.xs}],children:[he,ye]}),(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:W,onClose:()=>$(!1),onAfterClose:xe,title:V.sheetTitle,options:ue,labelOf:e=>{const r=e;return"remove"===r.kind?V.remove:r.source.label},getValue:e=>{const r=e;return"remove"===r.kind?REMOVE_VALUE:r.source.key},disabledOf:()=>!1,destructiveOf:e=>"remove"===e.kind,descriptionOf:e=>{const r=e;return"remove"===r.kind?void 0:r.source.description},iconOf:e=>{const r=e;return"remove"===r.kind?(0,_jsxRuntime.jsx)(_index3.AppIcon,{name:"trash",size:20,color:A.colors.toneText.error}):r.source.icon},isSelected:()=>!1,onSelect:e=>me(e)})]})});ProfilePicker.displayName="ProfilePicker";const styles=_reactNative.StyleSheet.create({fill:{alignItems:"center",justifyContent:"center",overflow:"hidden"},overlay:{..._reactNative.StyleSheet.absoluteFill},badge:{position:"absolute",alignItems:"center",justifyContent:"center",borderWidth:2},row:{flexDirection:"row",alignItems:"center"},column:{alignItems:"flex-start"},columnCentred:{alignItems:"center"},meta:{flexShrink:1},metaCentred:{alignItems:"center"},title:{includeFontPadding:!1},subtitle:{includeFontPadding:!1,marginTop:2},textCentred:{textAlign:"center"}});var _default=exports.default=ProfilePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.StatusBadge=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_index2=require("../Skeleton/index.js"),_jsxRuntime=require("react/jsx-runtime");const sizeMap={sm:{height:22,paddingH:8,fontSize:11,dot:5,gap:5},md:{height:24,paddingH:10,fontSize:12,dot:6,gap:6}},SOFT_FILL_OPACITY=.14,SOFT_BORDER_OPACITY=.4,BORDER_WIDTH=1,toneFor=(e,t)=>{const{toneText:r}=e.colors;switch(t){case"success":return{base:e.colors.success,on:e.colors.onSuccess,ink:r.success};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,ink:r.warning};case"error":return{base:e.colors.error,on:e.colors.onError,ink:r.error};case"info":return{base:e.colors.info,on:e.colors.onInfo,ink:r.info};case"primary":return{base:e.colors.primary,on:e.colors.onPrimary,ink:r.primary};default:return{base:e.colors.text.secondary,on:e.colors.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.StatusBadge=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_index2=require("../Skeleton/index.js"),_jsxRuntime=require("react/jsx-runtime");const sizeMap={sm:{height:22,paddingH:8,fontSize:11,dot:5,gap:5},md:{height:24,paddingH:10,fontSize:12,dot:6,gap:6}},SOFT_FILL_OPACITY=.14,SOFT_BORDER_OPACITY=.4,BORDER_WIDTH=1,toneFor=(e,t)=>{const{toneText:r}=e.colors;switch(t){case"success":return{base:e.colors.success,on:e.colors.onSuccess,ink:r.success};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,ink:r.warning};case"error":return{base:e.colors.error,on:e.colors.onError,ink:r.error};case"info":return{base:e.colors.info,on:e.colors.onInfo,ink:r.info};case"primary":return{base:e.colors.primary,on:e.colors.onPrimary,ink:r.primary};default:return{base:e.colors.text.secondary,on:e.colors.onNeutral,ink:e.colors.text.secondary}}},isHex=e=>"string"==typeof e&&/^#[0-9a-f]{6}$/i.test(e),paletteFor=(e,t,r,o)=>{const s=isHex(o),{base:a,on:n,ink:i}=s?{base:o,on:e.colors.text.inverse,ink:o}:toneFor(e,t),l=!s&&"neutral"===t,c=l?e.colors.background.tertiary:(0,_color.tintOf)(a,.14,e.colors.background.secondary),d=l?e.colors.border.primary:(0,_color.tintOf)(a,.4,a);switch(r){case"solid":return{fill:a,border:a,text:n,dot:n};case"outline":return{fill:"transparent",border:l?d:a,text:i,dot:a};default:return{fill:c,border:d,text:i,dot:a}}},StatusBadge=exports.StatusBadge=(0,_react.forwardRef)((e,t)=>{const{label:r,tone:o="neutral",variant:s="soft",size:a="md",dot:n=!1,color:i,loading:l=!1,accessibilityLabel:c,style:d,textStyle:u,testID:g}=e,x=(0,_index.useTheme)(),b=sizeMap[a],f=(0,_react.useMemo)(()=>paletteFor(x,o,s,i),[x,o,s,i]);return l?(0,_jsxRuntime.jsx)(StatusBadgeSkeleton,{...e}):(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,accessible:!0,accessibilityRole:"text",accessibilityLabel:c??r,testID:g,style:[styles.base,{minHeight:b.height,paddingHorizontal:b.paddingH,borderRadius:x.radius.full,..._corners.smoothCorners,backgroundColor:f.fill,borderColor:f.border,borderWidth:1},d],children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"status-badge-dot",style:{width:b.dot,height:b.dot,borderRadius:b.dot/2,marginRight:b.gap,backgroundColor:f.dot}}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.label,{color:f.text,fontSize:b.fontSize,...(0,_index.fontFor)(x,"semibold")},u],numberOfLines:1,maxFontSizeMultiplier:x.maxFontSizeMultiplier,children:r})]})});StatusBadge.displayName="StatusBadge";const StatusBadgeSkeleton=({label:e,size:t="md",dot:r,style:o})=>{const s=sizeMap[t],a=Math.max(32,Math.min(120,6.5*(e??"").length))+2*s.paddingH+(r?s.dot+s.gap:0);return(0,_jsxRuntime.jsx)(_index2.Skeleton,{width:a,height:s.height,radius:s.height/2,style:[styles.skeleton,o]})};StatusBadgeSkeleton.displayName="StatusBadgeSkeleton",StatusBadge.Skeleton=StatusBadgeSkeleton;const styles=_reactNative.StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},skeleton:{alignSelf:"flex-start"}});var _default=exports.default=StatusBadge;
|
|
@@ -1 +1 @@
|
|
|
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",titleGap:"md",descriptionGap:"xs"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl",titleGap:"md",descriptionGap:"xs"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl",titleGap:"md",descriptionGap:"xs"}},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:0},banner:{tintBarWidth:0},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:"#18864F",warning:"#F59E0B",error:"#E12C32",info:"#1B6EF5",onPrimary:"#FFFFFF",onSecondary:"#0F0F1A",onSuccess:"#FFFFFF",onWarning:"#0F0F1A",onError:"#FFFFFF",onInfo:"#FFFFFF",onOverlay:"#FFFFFF",toneText:{primary:"#4F4FD3",success:"#147042",warning:"#8F5C06",error:"#BC1B20",info:"#0958D9"},text:{primary:"#0F0F1A",secondary:"#52525B",tertiary:"#62626B",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:"#626D8B",placeholderDisabled:"#C4CADA",icon:"#7A849F",iconFocused:"#4B5675",iconDisabled:"#C4CADA",caret:"#5B8DEE",message:"#D81736"},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",toneText:{primary:"#8989EA",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},text:{primary:"#FAFAFA",secondary:"#B4B4BB",tertiary:"#919199",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:"#84848D",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
|
+
"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",titleGap:"md",descriptionGap:"xs"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl",titleGap:"md",descriptionGap:"xs"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl",titleGap:"md",descriptionGap:"xs"}},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:0},banner:{tintBarWidth:0},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:"#18864F",warning:"#F59E0B",error:"#E12C32",info:"#1B6EF5",onPrimary:"#FFFFFF",onNeutral:"#FFFFFF",onSecondary:"#0F0F1A",onSuccess:"#FFFFFF",onWarning:"#0F0F1A",onError:"#FFFFFF",onInfo:"#FFFFFF",onOverlay:"#FFFFFF",toneText:{primary:"#4F4FD3",success:"#147042",warning:"#8F5C06",error:"#BC1B20",info:"#0958D9"},text:{primary:"#0F0F1A",secondary:"#52525B",tertiary:"#62626B",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:"#626D8B",placeholderDisabled:"#C4CADA",icon:"#7A849F",iconFocused:"#4B5675",iconDisabled:"#C4CADA",caret:"#5B8DEE",message:"#D81736"},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",onNeutral:"#0F0F1A",onSecondary:"#FAFAFA",onSuccess:"#0F0F1A",onWarning:"#0F0F1A",onError:"#0F0F1A",onInfo:"#0F0F1A",onOverlay:"#FFFFFF",toneText:{primary:"#8989EA",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},text:{primary:"#FAFAFA",secondary:"#B4B4BB",tertiary:"#919199",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:"#84848D",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{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{Skeleton,SkeletonText}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const Banner=forwardRef((e,n)=>{const{title:t,message:o,variant:r="info",icon:i,actions:s,dismissible:a=!1,onDismiss:l,haptic:c,visible:d=!0,animateMount:p=!0,loading:m=!1,accessibilityRole:u="alert",accessibilityLabel:g,style:h,containerStyle:y,iconCircleStyle:b,tintBarStyle:x,closeButtonStyle:f,actionButtonStyle:S,testID:w}=e,j=useTheme(),B=useMemo(()=>buildStyles(j),[j]),k=useMemo(()=>tintFor(j,r),[j,r]),R=useRef(createAnimatedValue(p&&d?-20:0)).current,C=useRef(createAnimatedValue(p&&d?0:d?1:0)).current,[_,
|
|
1
|
+
"use strict";import{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{Skeleton,SkeletonText}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const Banner=forwardRef((e,n)=>{const{title:t,message:o,variant:r="info",icon:i,actions:s,dismissible:a=!1,onDismiss:l,haptic:c,visible:d=!0,animateMount:p=!0,loading:m=!1,accessibilityRole:u="alert",accessibilityLabel:g,style:h,containerStyle:y,iconCircleStyle:b,tintBarStyle:x,closeButtonStyle:f,actionButtonStyle:S,testID:w}=e,j=useTheme(),B=useMemo(()=>buildStyles(j),[j]),k=useMemo(()=>tintFor(j,r),[j,r]),R=useRef(createAnimatedValue(p&&d?-20:0)).current,C=useRef(createAnimatedValue(p&&d?0:d?1:0)).current,[_,T]=useState(d),V=useRef(!0);if(useEffect(()=>{if(V.current&&(V.current=!1,!p))return;let e;return d?(T(!0),e=Animated.parallel([Animated.timing(R,{toValue:0,duration:j.motion.duration.normal,useNativeDriver:!0}),Animated.timing(C,{toValue:1,duration:j.motion.duration.normal,useNativeDriver:!0})]),e.start()):_&&(e=Animated.parallel([Animated.timing(R,{toValue:-20,duration:j.motion.duration.fast,useNativeDriver:!0}),Animated.timing(C,{toValue:0,duration:j.motion.duration.fast,useNativeDriver:!0})]),e.start(()=>{T(!1)})),()=>e?.stop()},[d]),!_)return null;const v=t??" ",z="string"==typeof o?o??" ":"",H="alert"===u?"error"===r?"assertive":"polite":"none",W=_jsxs(Animated.View,{ref:n,accessibilityRole:u,accessibilityLiveRegion:H,accessibilityLabel:g,testID:w,style:[B.container,{backgroundColor:j.colors.background.secondary,borderRadius:j.radius.md,...smoothCorners,padding:j.spacing.md,opacity:C,transform:[{translateY:R}]},h,y],children:[(j.components.banner?.tintBarWidth??0)>0?_jsx(View,{style:[B.tintBar,{backgroundColor:k.bar},x]}):null,_jsxs(View,{style:B.row,children:[!1===i?null:_jsx(View,i?{style:B.iconWrap,children:i}:{style:[B.iconCircle,{backgroundColor:k.bar+"22"},b],children:_jsx(Text,{style:[B.iconGlyph,{color:k.ink}],accessible:!1,children:k.glyph})}),_jsxs(View,{style:B.textBlock,children:[t||m?_jsx(Text,{style:{color:j.colors.text.primary,fontSize:j.typography.fontSize.base,...fontFor(j,"semibold"),lineHeight:20},numberOfLines:2,children:v}):null,"string"==typeof o||m?_jsx(Text,{style:{color:j.colors.text.secondary,fontSize:j.typography.fontSize.sm,...fontFor(j,"normal"),lineHeight:18,marginTop:t?2:0},children:z||" "}):_jsx(View,{style:{marginTop:t?2:0},children:o})]}),a?_jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:"Dismiss banner",onPress:()=>{const e=resolveHaptic(c,"selection");e&&triggerHaptic(e),l?.()},hitSlop:8,style:({pressed:e})=>[B.closeBtn,{backgroundColor:e?j.colors.surface.pressed:"transparent"},f],children:_jsx(Text,{style:{color:j.colors.text.secondary,fontSize:j.components.banner?.closeGlyphFontSize??18,fontWeight:j.typography.fontWeight.bold,lineHeight:18},accessible:!1,children:"×"})}):null]}),s&&s.length>0?_jsx(View,{style:B.actionsRow,children:s.map((e,n)=>{const t=e.tone??"primary",o=e.variant??"ghost",r="danger"===t?j.colors.error:"neutral"===t?j.colors.text.secondary:k.glyphColor,i="danger"===t?j.colors.toneText.error:"neutral"===t?j.colors.text.secondary:k.ink,s="danger"===t?j.colors.onError:"neutral"===t?j.colors.onNeutral:k.on,a="solid"===o;return _jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{const n=resolveHaptic(c,"selection");n&&triggerHaptic(n),e.onPress()},style:({pressed:n})=>[B.actionBtn,"md"===e.size&&B.actionBtnMd,"outline"===o&&{borderWidth:1,borderColor:i},{backgroundColor:a?r:n?j.colors.surface.pressed:"transparent",opacity:a&&n?.85:1},S],children:_jsx(Text,{style:{color:a?s:i,fontSize:j.typography.fontSize.sm,textAlign:"center",...fontFor(j,"semibold")},children:e.label})},`${e.label}-${n}`)})}):null]});return m?_jsx(BannerSkeleton,{...e}):W});Banner.displayName="Banner";const BannerSkeleton=({title:e,actions:n,icon:t,containerStyle:o,style:r})=>{const i=useTheme(),s=!1!==t;return _jsxs(View,{style:[{flexDirection:"row",alignItems:"flex-start",backgroundColor:i.colors.background.elevated,borderRadius:i.radius.md,...smoothCorners,padding:i.spacing.md,borderWidth:1,borderColor:i.colors.border.primary},o,r],accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[s?_jsx(View,{style:{marginRight:i.spacing.sm},children:_jsx(Skeleton,{shape:"circle",width:32,height:32})}):null,_jsxs(View,{style:{flex:1},children:[void 0!==e?_jsx(Skeleton,{shape:"text",width:"55%",height:16,style:{marginBottom:i.spacing.xs}}):null,_jsx(SkeletonText,{lines:2,fontSize:13,lastLineWidth:"70%"}),n&&n.length>0?_jsx(View,{style:{flexDirection:"row",marginTop:i.spacing.sm},children:n.map((e,n)=>_jsx(Skeleton,{width:72,height:28,shape:"rounded",style:{marginRight:i.spacing.sm}},`sk-banner-action-${n}`))}):null]})]})};BannerSkeleton.displayName="BannerSkeleton",Banner.Skeleton=BannerSkeleton;const tintFor=(e,n)=>{switch(n){case"success":return{bar:e.colors.success,glyphColor:e.colors.success,ink:e.colors.toneText.success,on:e.colors.onSuccess,glyph:"✓"};case"warning":return{bar:e.colors.warning,glyphColor:e.colors.warning,ink:e.colors.toneText.warning,on:e.colors.onWarning,glyph:"⚠"};case"error":return{bar:e.colors.error,glyphColor:e.colors.error,ink:e.colors.toneText.error,on:e.colors.onError,glyph:"✗"};case"neutral":return{bar:e.colors.text.tertiary,glyphColor:e.colors.text.secondary,ink:e.colors.text.secondary,on:e.colors.onNeutral,glyph:"i"};default:return{bar:e.colors.primary,glyphColor:e.colors.primary,ink:e.colors.toneText.primary,on:e.colors.onPrimary,glyph:"i"}}},buildStyles=e=>{const n=e.components.banner?.iconCircleSize??28,t=e.components.banner?.closeButtonSize??28;return StyleSheet.create({container:{overflow:"hidden",paddingLeft:e.components.banner?.containerPaddingLeft??e.spacing.md},tintBar:{position:"absolute",left:0,top:0,bottom:0,width:e.components.banner?.tintBarWidth??0},row:{flexDirection:"row",alignItems:"flex-start"},iconWrap:{marginRight:e.components.banner?.iconGap??e.spacing.sm},iconCircle:{width:n,height:n,borderRadius:e.components.banner?.iconCircleRadius??n/2,...smoothCorners,alignItems:"center",justifyContent:"center",marginRight:e.components.banner?.iconGap??e.spacing.sm},iconGlyph:{fontSize:e.components.banner?.iconGlyphFontSize??15,fontWeight:"700",lineHeight:e.components.banner?.iconGlyphLineHeight??17},textBlock:{flex:1,paddingRight:e.components.banner?.textBlockPaddingRight??e.spacing.xs},closeBtn:{width:t,height:t,borderRadius:e.components.banner?.closeButtonRadius??t/2,...smoothCorners,alignItems:"center",justifyContent:"center",marginLeft:e.components.banner?.closeButtonMarginLeft??e.spacing.xxs??4},actionsRow:{flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-end",marginTop:e.components.banner?.actionsRowMarginTop??e.spacing.xs,columnGap:e.components.banner?.actionsRowGap??e.spacing.xs,rowGap:e.components.banner?.actionsRowGap??e.spacing.xs},actionBtn:{paddingHorizontal:e.components.banner?.actionButtonPaddingHorizontal??e.spacing.sm,paddingVertical:e.components.banner?.actionButtonPaddingVertical??6,borderRadius:e.components.banner?.actionButtonRadius??e.radius.sm,...smoothCorners,maxWidth:"100%",alignItems:"center",justifyContent:"center"},actionBtnMd:{minHeight:44,paddingHorizontal:e.spacing.md}})};export{Banner};export default Banner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useMemo,useRef,useState}from"react";import{Pressable,StyleSheet,Text,View}from"react-native";import{fontFor,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{blendOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{AppIcon}from"../AppIcon/index.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Avatar,avatarToneColors}from"../Avatar/index.js";import{FieldLabel,FieldMessage,fieldTextAsString,hasFieldText}from"../FieldBase/index.js";import{matchesAccept}from"../FilePicker/FilePicker.js";import{OptionSheet}from"../OptionSheet/OptionSheet.js";import{Spinner}from"../Spinner/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_LABELS={pick:"Change profile photo",remove:"Remove photo",sheetTitle:"Change photo",errorTooLarge:e=>`The photo is larger than ${e} MB.`,errorWrongType:"That file is not a supported image."},DEFAULT_ACCEPT=["image/*"],SHEET_ICON_SIZE=20,SOFT_FILL_OPACITY=.14,SIZE_PX={sm:72,md:120,lg:160},clamp=(e,r,o)=>Math.min(o,Math.max(r,e)),toneFor=(e,r)=>{switch(r){case"success":return{base:e.colors.success,on:e.colors.onSuccess};case"warning":return{base:e.colors.warning,on:e.colors.onWarning};case"error":return{base:e.colors.error,on:e.colors.onError};case"info":return{base:e.colors.info,on:e.colors.onInfo};case"neutral":return{base:e.colors.text.secondary,on:e.colors.
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useMemo,useRef,useState}from"react";import{Pressable,StyleSheet,Text,View}from"react-native";import{fontFor,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{blendOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{AppIcon}from"../AppIcon/index.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Avatar,avatarToneColors}from"../Avatar/index.js";import{FieldLabel,FieldMessage,fieldTextAsString,hasFieldText}from"../FieldBase/index.js";import{matchesAccept}from"../FilePicker/FilePicker.js";import{OptionSheet}from"../OptionSheet/OptionSheet.js";import{Spinner}from"../Spinner/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_LABELS={pick:"Change profile photo",remove:"Remove photo",sheetTitle:"Change photo",errorTooLarge:e=>`The photo is larger than ${e} MB.`,errorWrongType:"That file is not a supported image."},DEFAULT_ACCEPT=["image/*"],SHEET_ICON_SIZE=20,SOFT_FILL_OPACITY=.14,SIZE_PX={sm:72,md:120,lg:160},clamp=(e,r,o)=>Math.min(o,Math.max(r,e)),toneFor=(e,r)=>{switch(r){case"success":return{base:e.colors.success,on:e.colors.onSuccess};case"warning":return{base:e.colors.warning,on:e.colors.onWarning};case"error":return{base:e.colors.error,on:e.colors.onError};case"info":return{base:e.colors.info,on:e.colors.onInfo};case"neutral":return{base:e.colors.text.secondary,on:e.colors.onNeutral};default:return{base:e.colors.primary,on:e.colors.onPrimary}}},badgeLookFor=(e,r,o,t)=>{const s=toneFor(e,r),n=t?.badgeColor??s.base,i=e.colors.background.primary,l="neutral"===r&&void 0===t?.badgeColor;let a;switch(o){case"soft":a={fill:l?e.colors.background.tertiary:blendOf(n,.14,i,e.colors.background.secondary),ring:i,icon:n};break;case"outline":a={fill:i,ring:l?e.colors.border.primary:n,icon:n};break;default:a={fill:n,ring:i,icon:s.on}}return t?.badgeIconColor?{...a,icon:t.badgeIconColor}:a},resolveRadius=(e,r)=>"circle"===e?r/2:"rounded"===e?Math.max(6,Math.round(.22*r)):0,REMOVE_VALUE="__profile-picker-remove__",ProfilePicker=forwardRef((e,r)=>{const{value:o,name:t,sources:s,onPick:n,onRemove:i,loading:l=!1,disabled:a=!1,accept:c=DEFAULT_ACCEPT,maxSizeMB:d,size:u="md",shape:m="circle",badgeIcon:p="camera",tone:b,variant:g,avatarTone:f,avatarBackgroundColor:h,avatarColor:y,label:x,required:k=!1,helperText:C,error:v,layout:S="stacked",title:_,subtitle:j,ImageComponent:T,labels:I,haptic:F,onError:A,accessibilityLabel:P,style:w,testID:E}=e,L=useTheme(),M=L.components.profilePicker,R=b??M?.defaultTone??"primary",O=g??M?.defaultVariant??"solid",V=useMemo(()=>badgeLookFor(L,R,O,M),[L,R,O,M]),z=f??M?.defaultAvatarTone,D=useMemo(()=>{const e=z?avatarToneColors(L,z):null;return{background:h??e?.background??L.colors.background.tertiary,icon:y??e?.color??L.colors.text.tertiary}},[L,z,h,y]),B=useMemo(()=>({...DEFAULT_LABELS,...I}),[I]),[H,U]=useState(null),[W,$]=useState(null),[N,Z]=useState(!1),[q,G]=useState(o);o!==q&&(G(o),U(null));const X=l||a,Q=H??o??null,Y=v??W??void 0,J=!X&&(null!==H||Boolean(o)&&Boolean(i)),K=s.length>0||J,ee="number"==typeof u?u:SIZE_PX[u],re=resolveRadius(m,ee),oe=re*(1-Math.SQRT1_2),te=clamp(Math.round(.28*ee),24,44),se=oe-te/2,ne=Math.max(0,-se),ie=useCallback(e=>{$(e),A?.(e),!1!==F&&triggerHaptic("notificationError")},[A,F]),le=useCallback(async e=>{let r;try{r=await e.pick()}catch(e){return void ie(e instanceof Error?e.message:String(e))}const o=r?.[0];if(!o)return;if("number"==typeof d&&"number"==typeof o.size&&o.size>1024*d*1024)return void ie(B.errorTooLarge(d));if(o.type&&!matchesAccept(o.type,c))return void ie(B.errorWrongType);$(null),U(o.uri);const t=resolveHaptic(F,"selection");t&&triggerHaptic(t),n?.(o)},[d,c,B,F,n,ie]),ae=useCallback(()=>{X||(ue.current=null,1!==s.length||J?(s.length>0||J)&&Z(!0):le(s[0]))},[X,s,J,le]),ce=useCallback(()=>{U(null),$(null);const e=resolveHaptic(F,"selection");e&&triggerHaptic(e),i?.()},[F,i]),de=useMemo(()=>{const e=s.map(e=>({kind:"source",source:e}));return J&&e.push({kind:"remove"}),e},[s,J]),ue=useRef(null),me=useCallback(e=>{ue.current||(Z(!1),"remove"===e.kind?ce():ue.current=e.source)},[ce]),pe=useCallback(()=>{const e=ue.current;ue.current=null,e&&le(e)},[le]),be=E??"profile-picker",ge=P??(K?B.pick:t),fe=_jsx(View,{style:[styles.fill,{width:ee,height:ee,borderRadius:re,...smoothCorners,backgroundColor:D.background}],children:_jsx(AppIcon,{name:"user",size:Math.round(.45*ee),color:D.icon})}),he=_jsx(View,{style:{width:ee,height:ee,marginBottom:ne,marginRight:ne},children:_jsxs(Pressable,{onPress:ae,disabled:X||!K,accessibilityRole:K?"button":"image",accessibilityLabel:ge,accessibilityHint:fieldTextAsString(Y),accessibilityState:K?{disabled:X,busy:l}:{busy:l},"aria-disabled":K?X:void 0,"aria-busy":l,testID:`${be}-button`,style:({pressed:e})=>[{width:ee,height:ee,borderRadius:re,...smoothCorners},{opacity:a?.55:e?.85:1}],children:[Q||t?_jsx(Avatar,{source:Q?{uri:Q}:void 0,name:t,size:ee,shape:m,tone:z,backgroundColor:h,color:y,ImageComponent:T,accessibilityLabel:ge},Q??"initials"):fe,l?_jsx(View,{style:[styles.fill,styles.overlay,{borderRadius:re,...smoothCorners,backgroundColor:L.colors.background.overlay}],testID:`${be}-loading`,children:_jsx(Spinner,{size:ee>=100?"md":"sm",color:L.colors.onPrimary})}):null,!a&&K?_jsx(View,{pointerEvents:"none",testID:`${be}-badge`,style:[styles.badge,{width:te,height:te,borderRadius:te/2,...smoothCorners,right:se,bottom:se,backgroundColor:V.fill,borderColor:V.ring}],children:renderSlotIcon(p,{color:V.icon,size:Math.round(.55*te),disabled:!1})}):null]})}),ye="stacked"!==S?_jsxs(View,{style:[styles.meta,"profile"===S?styles.metaCentred:null],children:[_?_jsx(Text,{style:[styles.title,"profile"===S?styles.textCentred:null,{color:L.colors.text.primary,fontSize:L.typography.fontSize.base,...fontFor(L,"semibold")}],children:_}):null,j?_jsx(Text,{style:[styles.subtitle,"profile"===S?styles.textCentred:null,{color:L.colors.text.secondary,fontSize:L.typography.fontSize.sm,...fontFor(L,"normal")}],children:j}):null,_jsx(FieldMessage,{text:Y??C,error:hasFieldText(Y)})]}):_jsx(FieldMessage,{text:Y??C,error:hasFieldText(Y)});return _jsxs(View,{ref:r,style:w,testID:E,children:[x?_jsx(FieldLabel,{required:k,children:x}):null,_jsxs(View,{style:"inline"===S?[styles.row,{columnGap:L.spacing.md}]:["profile"===S?styles.columnCentred:styles.column,{rowGap:L.spacing.xs}],children:[he,ye]}),_jsx(OptionSheet,{open:N,onClose:()=>Z(!1),onAfterClose:pe,title:B.sheetTitle,options:de,labelOf:e=>{const r=e;return"remove"===r.kind?B.remove:r.source.label},getValue:e=>{const r=e;return"remove"===r.kind?REMOVE_VALUE:r.source.key},disabledOf:()=>!1,destructiveOf:e=>"remove"===e.kind,descriptionOf:e=>{const r=e;return"remove"===r.kind?void 0:r.source.description},iconOf:e=>{const r=e;return"remove"===r.kind?_jsx(AppIcon,{name:"trash",size:20,color:L.colors.toneText.error}):r.source.icon},isSelected:()=>!1,onSelect:e=>me(e)})]})});ProfilePicker.displayName="ProfilePicker";const styles=StyleSheet.create({fill:{alignItems:"center",justifyContent:"center",overflow:"hidden"},overlay:{...StyleSheet.absoluteFill},badge:{position:"absolute",alignItems:"center",justifyContent:"center",borderWidth:2},row:{flexDirection:"row",alignItems:"center"},column:{alignItems:"flex-start"},columnCentred:{alignItems:"center"},meta:{flexShrink:1},metaCentred:{alignItems:"center"},title:{includeFontPadding:!1},subtitle:{includeFontPadding:!1,marginTop:2},textCentred:{textAlign:"center"}});export{ProfilePicker};export default ProfilePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useMemo}from"react";import{StyleSheet,Text,View}from"react-native";import{fontFor,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const sizeMap={sm:{height:22,paddingH:8,fontSize:11,dot:5,gap:5},md:{height:24,paddingH:10,fontSize:12,dot:6,gap:6}},SOFT_FILL_OPACITY=.14,SOFT_BORDER_OPACITY=.4,BORDER_WIDTH=1,toneFor=(e,t)=>{const{toneText:o}=e.colors;switch(t){case"success":return{base:e.colors.success,on:e.colors.onSuccess,ink:o.success};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,ink:o.warning};case"error":return{base:e.colors.error,on:e.colors.onError,ink:o.error};case"info":return{base:e.colors.info,on:e.colors.onInfo,ink:o.info};case"primary":return{base:e.colors.primary,on:e.colors.onPrimary,ink:o.primary};default:return{base:e.colors.text.secondary,on:e.colors.
|
|
1
|
+
"use strict";import{forwardRef,useMemo}from"react";import{StyleSheet,Text,View}from"react-native";import{fontFor,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const sizeMap={sm:{height:22,paddingH:8,fontSize:11,dot:5,gap:5},md:{height:24,paddingH:10,fontSize:12,dot:6,gap:6}},SOFT_FILL_OPACITY=.14,SOFT_BORDER_OPACITY=.4,BORDER_WIDTH=1,toneFor=(e,t)=>{const{toneText:o}=e.colors;switch(t){case"success":return{base:e.colors.success,on:e.colors.onSuccess,ink:o.success};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,ink:o.warning};case"error":return{base:e.colors.error,on:e.colors.onError,ink:o.error};case"info":return{base:e.colors.info,on:e.colors.onInfo,ink:o.info};case"primary":return{base:e.colors.primary,on:e.colors.onPrimary,ink:o.primary};default:return{base:e.colors.text.secondary,on:e.colors.onNeutral,ink:e.colors.text.secondary}}},isHex=e=>"string"==typeof e&&/^#[0-9a-f]{6}$/i.test(e),paletteFor=(e,t,o,r)=>{const s=isHex(r),{base:n,on:a,ink:i}=s?{base:r,on:e.colors.text.inverse,ink:r}:toneFor(e,t),l=!s&&"neutral"===t,d=l?e.colors.background.tertiary:tintOf(n,.14,e.colors.background.secondary),c=l?e.colors.border.primary:tintOf(n,.4,n);switch(o){case"solid":return{fill:n,border:n,text:a,dot:a};case"outline":return{fill:"transparent",border:l?c:n,text:i,dot:n};default:return{fill:d,border:c,text:i,dot:n}}},StatusBadge=forwardRef((e,t)=>{const{label:o,tone:r="neutral",variant:s="soft",size:n="md",dot:a=!1,color:i,loading:l=!1,accessibilityLabel:d,style:c,textStyle:u,testID:g}=e,f=useTheme(),m=sizeMap[n],b=useMemo(()=>paletteFor(f,r,s,i),[f,r,s,i]);return l?_jsx(StatusBadgeSkeleton,{...e}):_jsxs(View,{ref:t,accessible:!0,accessibilityRole:"text",accessibilityLabel:d??o,testID:g,style:[styles.base,{minHeight:m.height,paddingHorizontal:m.paddingH,borderRadius:f.radius.full,...smoothCorners,backgroundColor:b.fill,borderColor:b.border,borderWidth:1},c],children:[a?_jsx(View,{testID:"status-badge-dot",style:{width:m.dot,height:m.dot,borderRadius:m.dot/2,marginRight:m.gap,backgroundColor:b.dot}}):null,_jsx(Text,{style:[styles.label,{color:b.text,fontSize:m.fontSize,...fontFor(f,"semibold")},u],numberOfLines:1,maxFontSizeMultiplier:f.maxFontSizeMultiplier,children:o})]})});StatusBadge.displayName="StatusBadge";const StatusBadgeSkeleton=({label:e,size:t="md",dot:o,style:r})=>{const s=sizeMap[t],n=Math.max(32,Math.min(120,6.5*(e??"").length))+2*s.paddingH+(o?s.dot+s.gap:0);return _jsx(Skeleton,{width:n,height:s.height,radius:s.height/2,style:[styles.skeleton,r]})};StatusBadgeSkeleton.displayName="StatusBadgeSkeleton",StatusBadge.Skeleton=StatusBadgeSkeleton;const styles=StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},skeleton:{alignSelf:"flex-start"}});export{StatusBadge};export default StatusBadge;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{SQUIRCLE_SMOOTHING}from"../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",titleGap:"md",descriptionGap:"xs"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl",titleGap:"md",descriptionGap:"xs"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl",titleGap:"md",descriptionGap:"xs"}},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:0},banner:{tintBarWidth:0},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}};export const lightTheme={mode:"light",colors:{primary:"#5B5BD6",primaryHover:"#4F4FBF",primaryPressed:"#4040A8",primaryMuted:"#EEEEFC",secondary:"#F4F4F8",secondaryHover:"#E9E9F0",success:"#18864F",warning:"#F59E0B",error:"#E12C32",info:"#1B6EF5",onPrimary:"#FFFFFF",onSecondary:"#0F0F1A",onSuccess:"#FFFFFF",onWarning:"#0F0F1A",onError:"#FFFFFF",onInfo:"#FFFFFF",onOverlay:"#FFFFFF",toneText:{primary:"#4F4FD3",success:"#147042",warning:"#8F5C06",error:"#BC1B20",info:"#0958D9"},text:{primary:"#0F0F1A",secondary:"#52525B",tertiary:"#62626B",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:"#626D8B",placeholderDisabled:"#C4CADA",icon:"#7A849F",iconFocused:"#4B5675",iconDisabled:"#C4CADA",caret:"#5B8DEE",message:"#D81736"},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_SMOOTHING,shadows:lightShadows,motion:motion,components:components,gradients:{}};export const 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",toneText:{primary:"#8989EA",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},text:{primary:"#FAFAFA",secondary:"#B4B4BB",tertiary:"#919199",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:"#84848D",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_SMOOTHING,shadows:darkShadows,motion:motion,components:components,gradients:{}};
|
|
1
|
+
"use strict";import{SQUIRCLE_SMOOTHING}from"../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",titleGap:"md",descriptionGap:"xs"},md:{iconSize:64,titleFontSize:"xl",descriptionFontSize:"base",paddingVertical:"xl",titleGap:"md",descriptionGap:"xs"},lg:{iconSize:80,titleFontSize:"2xl",descriptionFontSize:"base",paddingVertical:"2xl",titleGap:"md",descriptionGap:"xs"}},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:0},banner:{tintBarWidth:0},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}};export const lightTheme={mode:"light",colors:{primary:"#5B5BD6",primaryHover:"#4F4FBF",primaryPressed:"#4040A8",primaryMuted:"#EEEEFC",secondary:"#F4F4F8",secondaryHover:"#E9E9F0",success:"#18864F",warning:"#F59E0B",error:"#E12C32",info:"#1B6EF5",onPrimary:"#FFFFFF",onNeutral:"#FFFFFF",onSecondary:"#0F0F1A",onSuccess:"#FFFFFF",onWarning:"#0F0F1A",onError:"#FFFFFF",onInfo:"#FFFFFF",onOverlay:"#FFFFFF",toneText:{primary:"#4F4FD3",success:"#147042",warning:"#8F5C06",error:"#BC1B20",info:"#0958D9"},text:{primary:"#0F0F1A",secondary:"#52525B",tertiary:"#62626B",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:"#626D8B",placeholderDisabled:"#C4CADA",icon:"#7A849F",iconFocused:"#4B5675",iconDisabled:"#C4CADA",caret:"#5B8DEE",message:"#D81736"},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_SMOOTHING,shadows:lightShadows,motion:motion,components:components,gradients:{}};export const 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",onNeutral:"#0F0F1A",onSecondary:"#FAFAFA",onSuccess:"#0F0F1A",onWarning:"#0F0F1A",onError:"#0F0F1A",onInfo:"#0F0F1A",onOverlay:"#FFFFFF",toneText:{primary:"#8989EA",success:"#30C780",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},text:{primary:"#FAFAFA",secondary:"#B4B4BB",tertiary:"#919199",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:"#84848D",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_SMOOTHING,shadows:darkShadows,motion:motion,components:components,gradients:{}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Beautiful, animated, accessible React Native components, theme and form engine for Webority projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@webority/mobile-core": ">=0.
|
|
63
|
+
"@webority/mobile-core": ">=0.15.0 <0.16.0",
|
|
64
64
|
"expo": ">=57.0.0",
|
|
65
65
|
"expo-file-system": ">=57.0.0",
|
|
66
66
|
"expo-haptics": ">=57.0.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
]
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@webority/mobile-core": "0.
|
|
110
|
+
"@webority/mobile-core": "0.15.0"
|
|
111
111
|
},
|
|
112
112
|
"scripts": {
|
|
113
113
|
"build": "bob build && node ../../scripts/minify-lib.mjs",
|