@webority/mobile-ui 0.107.0 → 0.108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas-kit/kit.js +4678 -4676
- package/dist/canvas-kit/manifest.json +7 -1
- package/dist/canvas-kit/release.json +6 -6
- package/lib/commonjs/components/Box/Box.js +1 -1
- package/lib/commonjs/components/Button/Button.js +1 -1
- package/lib/commonjs/components/Card/Card.js +1 -1
- package/lib/commonjs/components/EmptyState/EmptyState.js +1 -1
- package/lib/commonjs/components/FieldBase/FieldBase.js +1 -1
- package/lib/commonjs/components/ListItem/ListItem.js +1 -1
- package/lib/commonjs/components/Select/Select.js +1 -1
- package/lib/commonjs/components/SquircleFill/SquircleFill.js +1 -1
- package/lib/commonjs/components/SquircleView/SquircleView.js +1 -1
- package/lib/module/components/Box/Box.js +1 -1
- package/lib/module/components/Button/Button.js +1 -1
- package/lib/module/components/Card/Card.js +1 -1
- package/lib/module/components/EmptyState/EmptyState.js +1 -1
- package/lib/module/components/FieldBase/FieldBase.js +1 -1
- package/lib/module/components/ListItem/ListItem.js +1 -1
- package/lib/module/components/Select/Select.js +1 -1
- package/lib/module/components/SquircleFill/SquircleFill.js +1 -1
- package/lib/module/components/SquircleView/SquircleView.js +1 -1
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +6 -0
- package/lib/typescript/commonjs/components/ProfilePicker/ProfilePicker.d.ts +1 -1
- package/lib/typescript/commonjs/components/Select/Select.d.ts +4 -0
- package/lib/typescript/commonjs/components/SquircleFill/SquircleFill.d.ts +1 -8
- package/lib/typescript/commonjs/navigation/NavigationScreen.d.ts +3 -0
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +6 -0
- package/lib/typescript/module/components/ProfilePicker/ProfilePicker.d.ts +1 -1
- package/lib/typescript/module/components/Select/Select.d.ts +4 -0
- package/lib/typescript/module/components/SquircleFill/SquircleFill.d.ts +1 -8
- package/lib/typescript/module/navigation/NavigationScreen.d.ts +3 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useEffect,useMemo,useRef}from"react";import{Animated,Easing,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,resolveFieldSize,useTheme}from"../../theme/index.js";import{ariaFromState}from"../../utils/ariaState.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{defaultIcons}from"../AppIcon/defaultIcons.js";import{NotationInkContext,useNotationInk}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;return{color:o?e.colors["field-text-disabled"]:e.colors["field-text"],placeholderColor:o?e.colors["field-placeholder-disabled"]:e.colors["field-placeholder"],weightStyle:fontFor(e,"normal")}};export const RequiredMark=()=>{const e=useTheme();return _jsx(Text,{style:{color:e.colors["danger-text"]},children:` ${e.settings.components.field?.requiredMarker??"*"}`})};export const RequiredPlaceholder=({text:e,color:t,fontSize:o,weightStyle:r,align:i="center",paddingTop:l,textAlign:s})=>_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:s},children:[e,_jsx(RequiredMark,{})]})});export const FieldErrorGlyph=({size:e,color:t})=>{const o=useTheme().settings.icons.error??defaultIcons.error;return _jsx(_Fragment,{children:o({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 s=useTheme(),n=resolveFieldSize(s,t),a=hasFieldText(r),d=useNotationInk(l,n["label-text"],i??s.colors["field-label"]),c=_jsxs(Text,{style:[familyStyles.label,{color:i??s.colors["field-label"],fontSize:n["label-text"],...fontFor(s,"semibold"),marginBottom:a?s.space.none:n["label-gap"]},a?familyStyles.labelShrink:null,l],children:[_jsx(NotationInkContext.Provider,{value:d,children:e}),o?_jsx(RequiredMark,{}):null]});return a?_jsxs(View,{style:[familyStyles.labelRow,{marginBottom:n["label-gap"]}],children:[c,_jsx(View,{style:[familyStyles.help,{marginLeft:s.space.xs}],children:r})]}):c};export const FieldMessage=({text:e,error:t=!1,size:o="md",style:r})=>{const i=useTheme(),l=resolveFieldSize(i,o),s=t?i.colors["field-message"]:i.colors["text-muted"],n=useNotationInk(r,l["message-text"],s);return hasFieldText(e)?_jsxs(View,{style:[familyStyles.messageRow,{marginTop:l["message-gap"],columnGap:i.space.xs}],accessibilityLiveRegion:t?"polite":"none",children:[t?_jsx(FieldErrorGlyph,{size:l["message-text"],color:s}):null,_jsx(Text,{style:[familyStyles.messageText,{color:s,fontSize:l["message-text"],...fontFor(i,"normal")},r],children:_jsx(NotationInkContext.Provider,{value:n,children:e})})]}):null};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 resolveVariantColors=(e,t)=>{let o,r,i,l,s;"outline"===t?(o=e.colors["field-bg"],r=e.colors["field-bg-focus"],i=e.colors["field-bg-disabled"],l=e.colors["field-border"],s=e.size.border):"underline"===t?(o="transparent",r=void 0,i="transparent",l={bottom:e.colors["field-border"]},s={bottom:e.size.border}):(o=e.colors["field-bg"],r=void 0,i=e.colors["field-bg-disabled"],l="transparent",s=0);const wrapToIdleShape=e=>"string"==typeof l?e:{bottom:e},n=expandColorSides(l),a=expandColorSides(wrapToIdleShape(e.colors["field-border-focus"]));return{backgroundIdleEmpty:o,backgroundIdleFilled:o,backgroundFocused:r,backgroundError:void 0,backgroundDisabled:i,borderIdle:n,borderFocused:a,borderError:expandColorSides(wrapToIdleShape(e.colors["field-border-error"])),borderDisabled:expandColorSides(l),borderWidth:expandWidthSides(s),borderFocusedRepresentative:pickRepresentativeBorderColor(a)}};export const FieldBase=e=>{warnInvalidValue("FieldBase","variant",e.variant,["outline","filled","underline"]),warnInvalidValue("FieldBase","size",e.size,["sm","md","lg"]);const{size:t="md",variant:o,focused:r=!1,disabled:i=!1,error:l=!1,filled:s=!1,leading:n,leadingDivider:a=!1,trailing:d,slotAlign:c="center",slotLineHeight:b,topNotch:u,children:p,onPress:m,pressFeedback:g=!0,minHeight:f,maxHeight:h,width:x,height:y,paddingHorizontal:S,paddingLeft:F,paddingRight:v,paddingVertical:R,borderRadius:j,borderTopLeftRadius:C,borderTopRightRadius:k,borderBottomLeftRadius:w,borderBottomRightRadius:T,borderWidth:I,borderTopWidth:_,borderRightWidth:V,borderBottomWidth:z,borderLeftWidth:L,gap:B,style:W,testID:E,accessibilityRole:D,accessibilityLabel:q,accessibilityState:A,accessibilityHint:M}=e,P=useTheme(),N=useMemo(()=>buildStyles(),[]),H=o??P.settings.components.field?.defaultVariant??"outline",G=resolveFieldSize(P,t),O=useMemo(()=>resolveVariantColors(P,H),[P,H]),$=l?2:r?1:0,J=useRef(createAnimatedValue($)).current;useEffect(()=>{const e=Animated.timing(J,{toValue:$,duration:P.motion.duration.fast,easing:Easing.bezier(...P.motion.ease["in-out"]),useNativeDriver:!1});return e.start(),()=>e.stop()},[$,J,P.motion.duration.fast,P.motion.ease["in-out"]]);const K=[0,1,2],Q=s?O.backgroundIdleFilled:O.backgroundIdleEmpty,U=O.backgroundFocused??Q,X=O.backgroundError??Q,Y=i?O.backgroundDisabled:J.interpolate({inputRange:K,outputRange:[Q,U,X]}),Z=O.borderIdle,ee=O.borderFocused,te=O.borderError,oe={top:_,right:V,bottom:z,left:L},re={top:oe.top??I??O.borderWidth.top,right:oe.right??I??O.borderWidth.right,bottom:oe.bottom??I??O.borderWidth.bottom,left:oe.left??I??O.borderWidth.left},ie={minHeight:y??f??G["min-height"],maxHeight:h,paddingHorizontal:S??G["padding-x"],paddingVertical:R??G["padding-y"],paddingLeft:F??S??G["padding-x"],paddingRight:v??S??G["padding-x"],backgroundColor:Y,columnGap:B??P.space.md,alignItems:"top"===c?"flex-start":"center"},le="underline"===H,se=le?P.radius.none:j??G.radius,ne=le?{tl:P.radius.none,tr:P.radius.none,bl:P.radius.none,br:P.radius.none}:{tl:C??se,tr:k??se,bl:w??se,br:T??se};ie.borderTopLeftRadius=ne.tl,ie.borderTopRightRadius=ne.tr,ie.borderBottomLeftRadius=ne.bl,ie.borderBottomRightRadius=ne.br,ie.borderCurve=smoothCorners.borderCurve,ie.borderTopWidth=re.top,ie.borderRightWidth=re.right,ie.borderBottomWidth=re.bottom,ie.borderLeftWidth=re.left;const sideColor=e=>J.interpolate({inputRange:K,outputRange:[Z[e],ee[e],te[e]]}),sameOnEverySide=e=>e.top===e.right&&e.top===e.bottom&&e.top===e.left,ae=!le&&ne.tl===ne.tr&&ne.tl===ne.bl&&ne.tl===ne.br&&sameOnEverySide(re)&&sameOnEverySide(Z)&&sameOnEverySide(ee)&&sameOnEverySide(te)&&sameOnEverySide(O.borderDisabled),de=useSquircle(ae,ne.tl);if(de.active)ie.backgroundColor="transparent",ie.borderTopColor="transparent",ie.borderRightColor="transparent",ie.borderBottomColor="transparent",ie.borderLeftColor="transparent";else if(i){const e=O.borderDisabled;ie.borderTopColor=e.top,ie.borderRightColor=e.right,ie.borderBottomColor=e.bottom,ie.borderLeftColor=e.left}else ie.borderTopColor=sideColor("top"),ie.borderRightColor=sideColor("right"),ie.borderBottomColor=sideColor("bottom"),ie.borderLeftColor=sideColor("left");const ce=i?O.borderDisabled.top:sideColor("top"),be=useRef($);be.current=$,useEffect(()=>{J.setValue(be.current)},[O,J]),void 0!==x&&(ie.width=x),void 0!==y&&(ie.height=y);const ue={disabled:i,...A},pe="top"===c,me=pe?{alignSelf:"flex-start",marginTop:Math.max(0,((b??G.icon)-G.icon)/2)}:null,ge=y??f??G["min-height"],fe=(()=>{if(!u)return 0;const e=Math.min(ne.tl,ge/2),t=u.left;return e<=0||t>=e?0:Math.ceil(e-Math.sqrt(e*e-(e-t)*(e-t)))})(),he=u&&re.top>0?_jsx(Animated.View,{pointerEvents:"none",style:{position:"absolute",top:-re.top,left:u.left-re.left,width:u.width,height:re.top+fe,backgroundColor:Y}}):null,renderInner=e=>_jsxs(_Fragment,{children:[de.active&&de.size?_jsx(SquircleFill,{width:de.size.width,height:de.size.height,radius:ne.tl,fill:e&&!i?P.colors["surface-pressed"]:Y,stroke:ce,strokeWidth:re.top,outset:re.top}):null,he,null!=n?_jsx(View,{style:[N.slot,me],children:n}):null,null!=n&&a?_jsx(View,{pointerEvents:"none",style:[N.divider,me,{height:G.icon,backgroundColor:P.colors["field-border"]}]}):null,_jsx(View,{style:[N.content,pe?N.contentTop:null],children:p}),null!=d?_jsx(View,{style:[N.slot,me],children:d}):null]}),xe=_jsx(Animated.View,{onLayout:de.onLayout,style:[N.box,ie,W],accessibilityRole:D,accessibilityLabel:q,accessibilityHint:M,accessibilityState:ue,...ariaFromState(ue),testID:E,children:renderInner(!1)});return m&&!g?_jsx(Pressable,{onPress:m,disabled:i,accessible:!1,children:xe}):m?_jsx(Pressable,{onPress:m,disabled:i,accessibilityRole:D??"button",accessibilityLabel:q,accessibilityHint:M,accessibilityState:ue,...ariaFromState(ue),testID:E,children:({pressed:e})=>_jsx(Animated.View,{onLayout:de.onLayout,style:[N.box,ie,!e||i||de.active?null:{backgroundColor:P.colors["surface-pressed"]},W],children:renderInner(e)})}):xe};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,resolveFieldSize,useTheme}from"../../theme/index.js";import{ariaFromState}from"../../utils/ariaState.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{defaultIcons}from"../AppIcon/defaultIcons.js";import{NotationInkContext,useNotationInk}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;return{color:o?e.colors["field-text-disabled"]:e.colors["field-text"],placeholderColor:o?e.colors["field-placeholder-disabled"]:e.colors["field-placeholder"],weightStyle:fontFor(e,"normal")}};export const RequiredMark=()=>{const e=useTheme();return _jsx(Text,{style:{color:e.colors["danger-text"]},children:` ${e.settings.components.field?.requiredMarker??"*"}`})};export const RequiredPlaceholder=({text:e,color:t,fontSize:o,weightStyle:r,align:i="center",paddingTop:l,textAlign:s})=>_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:s},children:[e,_jsx(RequiredMark,{})]})});export const FieldErrorGlyph=({size:e,color:t})=>{const o=useTheme().settings.icons.error??defaultIcons.error;return _jsx(_Fragment,{children:o({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 s=useTheme(),n=resolveFieldSize(s,t),a=hasFieldText(r),d=useNotationInk(l,n["label-text"],i??s.colors["field-label"]),c=_jsxs(Text,{style:[familyStyles.label,{color:i??s.colors["field-label"],fontSize:n["label-text"],...fontFor(s,"semibold"),marginBottom:a?s.space.none:n["label-gap"]},a?familyStyles.labelShrink:null,l],children:[_jsx(NotationInkContext.Provider,{value:d,children:e}),o?_jsx(RequiredMark,{}):null]});return a?_jsxs(View,{style:[familyStyles.labelRow,{marginBottom:n["label-gap"]}],children:[c,_jsx(View,{style:[familyStyles.help,{marginLeft:s.space.xs}],children:r})]}):c};export const FieldMessage=({text:e,error:t=!1,size:o="md",style:r})=>{const i=useTheme(),l=resolveFieldSize(i,o),s=t?i.colors["field-message"]:i.colors["text-muted"],n=useNotationInk(r,l["message-text"],s);return hasFieldText(e)?_jsxs(View,{style:[familyStyles.messageRow,{marginTop:l["message-gap"],columnGap:i.space.xs}],accessibilityLiveRegion:t?"polite":"none",children:[t?_jsx(FieldErrorGlyph,{size:l["message-text"],color:s}):null,_jsx(Text,{style:[familyStyles.messageText,{color:s,fontSize:l["message-text"],...fontFor(i,"normal")},r],children:_jsx(NotationInkContext.Provider,{value:n,children:e})})]}):null};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 resolveVariantColors=(e,t)=>{let o,r,i,l,s;"outline"===t?(o=e.colors["field-bg"],r=e.colors["field-bg-focus"],i=e.colors["field-bg-disabled"],l=e.colors["field-border"],s=e.size.border):"underline"===t?(o="transparent",r=void 0,i="transparent",l={bottom:e.colors["field-border"]},s={bottom:e.size.border}):(o=e.colors["field-bg"],r=void 0,i=e.colors["field-bg-disabled"],l="transparent",s=0);const wrapToIdleShape=e=>"string"==typeof l?e:{bottom:e},n=expandColorSides(l),a=expandColorSides(wrapToIdleShape(e.colors["field-border-focus"]));return{backgroundIdleEmpty:o,backgroundIdleFilled:o,backgroundFocused:r,backgroundError:void 0,backgroundDisabled:i,borderIdle:n,borderFocused:a,borderError:expandColorSides(wrapToIdleShape(e.colors["field-border-error"])),borderDisabled:expandColorSides(l),borderWidth:expandWidthSides(s),borderFocusedRepresentative:pickRepresentativeBorderColor(a)}};export const FieldBase=e=>{warnInvalidValue("FieldBase","variant",e.variant,["outline","filled","underline"]),warnInvalidValue("FieldBase","size",e.size,["sm","md","lg"]);const{size:t="md",variant:o,focused:r=!1,disabled:i=!1,error:l=!1,filled:s=!1,leading:n,leadingDivider:a=!1,trailing:d,slotAlign:c="center",slotLineHeight:b,topNotch:u,children:p,onPress:m,pressFeedback:g=!0,minHeight:f,maxHeight:h,width:x,height:y,paddingHorizontal:S,paddingLeft:F,paddingRight:v,paddingVertical:R,borderRadius:j,borderTopLeftRadius:C,borderTopRightRadius:k,borderBottomLeftRadius:w,borderBottomRightRadius:T,borderWidth:I,borderTopWidth:_,borderRightWidth:V,borderBottomWidth:z,borderLeftWidth:L,gap:B,style:W,testID:E,accessibilityRole:D,accessibilityLabel:q,accessibilityState:A,accessibilityHint:M}=e,P=useTheme(),N=useMemo(()=>buildStyles(),[]),H=o??P.settings.components.field?.defaultVariant??"outline",G=resolveFieldSize(P,t),O=useMemo(()=>resolveVariantColors(P,H),[P,H]),$=l?2:r?1:0,J=useRef(createAnimatedValue($)).current;useEffect(()=>{const e=Animated.timing(J,{toValue:$,duration:P.motion.duration.fast,easing:Easing.bezier(...P.motion.ease["in-out"]),useNativeDriver:!1});return e.start(),()=>e.stop()},[$,J,P.motion.duration.fast,P.motion.ease["in-out"]]);const K=[0,1,2],Q=s?O.backgroundIdleFilled:O.backgroundIdleEmpty,U=O.backgroundFocused??Q,X=O.backgroundError??Q,Y=i?O.backgroundDisabled:J.interpolate({inputRange:K,outputRange:[Q,U,X]}),Z=O.borderIdle,ee=O.borderFocused,te=O.borderError,oe={top:_,right:V,bottom:z,left:L},re={top:oe.top??I??O.borderWidth.top,right:oe.right??I??O.borderWidth.right,bottom:oe.bottom??I??O.borderWidth.bottom,left:oe.left??I??O.borderWidth.left},ie={minHeight:y??f??G["min-height"],maxHeight:h,paddingHorizontal:S??G["padding-x"],paddingVertical:R??G["padding-y"],paddingLeft:F??S??G["padding-x"],paddingRight:v??S??G["padding-x"],backgroundColor:Y,columnGap:B??P.space.md,alignItems:"top"===c?"flex-start":"center"},le="underline"===H,se=le?P.radius.none:j??G.radius,ne=le?{tl:P.radius.none,tr:P.radius.none,bl:P.radius.none,br:P.radius.none}:{tl:C??se,tr:k??se,bl:w??se,br:T??se};ie.borderTopLeftRadius=ne.tl,ie.borderTopRightRadius=ne.tr,ie.borderBottomLeftRadius=ne.bl,ie.borderBottomRightRadius=ne.br,ie.borderCurve=smoothCorners.borderCurve,ie.borderTopWidth=re.top,ie.borderRightWidth=re.right,ie.borderBottomWidth=re.bottom,ie.borderLeftWidth=re.left;const sideColor=e=>J.interpolate({inputRange:K,outputRange:[Z[e],ee[e],te[e]]}),sameOnEverySide=e=>e.top===e.right&&e.top===e.bottom&&e.top===e.left,ae=!le&&ne.tl===ne.tr&&ne.tl===ne.bl&&ne.tl===ne.br&&sameOnEverySide(re)&&sameOnEverySide(Z)&&sameOnEverySide(ee)&&sameOnEverySide(te)&&sameOnEverySide(O.borderDisabled),de=useSquircle(ae,ne.tl);if(de.active)ie.backgroundColor="transparent",ie.borderTopColor="transparent",ie.borderRightColor="transparent",ie.borderBottomColor="transparent",ie.borderLeftColor="transparent";else if(i){const e=O.borderDisabled;ie.borderTopColor=e.top,ie.borderRightColor=e.right,ie.borderBottomColor=e.bottom,ie.borderLeftColor=e.left}else ie.borderTopColor=sideColor("top"),ie.borderRightColor=sideColor("right"),ie.borderBottomColor=sideColor("bottom"),ie.borderLeftColor=sideColor("left");const ce=i?O.borderDisabled.top:sideColor("top"),be=useRef($);be.current=$,useEffect(()=>{J.setValue(be.current)},[O,J]),void 0!==x&&(ie.width=x),void 0!==y&&(ie.height=y);const ue={disabled:i,...A},pe="top"===c,me=pe?{alignSelf:"flex-start",marginTop:Math.max(0,((b??G.icon)-G.icon)/2)}:null,ge=y??f??G["min-height"],fe=(()=>{if(!u)return 0;const e=Math.min(ne.tl,ge/2),t=u.left;return e<=0||t>=e?0:Math.ceil(e-Math.sqrt(e*e-(e-t)*(e-t)))})(),he=u&&re.top>0?_jsx(Animated.View,{pointerEvents:"none",style:{position:"absolute",top:-re.top,left:u.left-re.left,width:u.width,height:re.top+fe,backgroundColor:Y}}):null,renderInner=e=>_jsxs(_Fragment,{children:[de.active&&de.size?_jsx(SquircleFill,{width:de.size.width,height:de.size.height,radius:ne.tl,fill:e&&!i?P.colors["surface-pressed"]:Y,stroke:ce,strokeWidth:re.top}):null,he,null!=n?_jsx(View,{style:[N.slot,me],children:n}):null,null!=n&&a?_jsx(View,{pointerEvents:"none",style:[N.divider,me,{height:G.icon,backgroundColor:P.colors["field-border"]}]}):null,_jsx(View,{style:[N.content,pe?N.contentTop:null],children:p}),null!=d?_jsx(View,{style:[N.slot,me],children:d}):null]}),xe=_jsx(Animated.View,{onLayout:de.onLayout,style:[N.box,ie,W],accessibilityRole:D,accessibilityLabel:q,accessibilityHint:M,accessibilityState:ue,...ariaFromState(ue),testID:E,children:renderInner(!1)});return m&&!g?_jsx(Pressable,{onPress:m,disabled:i,accessible:!1,children:xe}):m?_jsx(Pressable,{onPress:m,disabled:i,accessibilityRole:D??"button",accessibilityLabel:q,accessibilityHint:M,accessibilityState:ue,...ariaFromState(ue),testID:E,children:({pressed:e})=>_jsx(Animated.View,{onLayout:de.onLayout,style:[N.box,ie,!e||i||de.active?null:{backgroundColor:P.colors["surface-pressed"]},W],children:renderInner(e)})}):xe};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 +1 @@
|
|
|
1
|
-
"use strict";import React,{forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,Text,useWindowDimensions,View}from"react-native";import Svg,{Path}from"react-native-svg";import{useFlickGuard}from"../../hooks/useFlickGuard.js";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,resolveCheckboxSize,resolveListItemSize,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{mergeRefs}from"../../utils/mergeRefs.js";import{themeStyles}from"../../utils/themeStyles.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{defaultIcons}from"../AppIcon/defaultIcons.js";import{Button}from"../Button/index.js";import{IconBadge}from"../IconBadge/index.js";import{useContextMenu}from"../Menu/useContextMenu.js";import{Skeleton}from"../Skeleton/index.js";import{Swipeable}from"../Swipeable/index.js";import{Fragment as _Fragment,jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const Chevron=({color:e})=>{const t=useTheme();return _jsx(_Fragment,{children:(t.settings.icons.chevronRight??defaultIcons.chevronRight)({size:20,color:e})})},BADGE_SIZE={sm:"sm",md:"md",lg:"lg"},RIGHT_BELOW_FONT_SCALE=1.2,SelectionBox=({checked:e,disabled:t})=>{const i=useTheme(),s=resolveCheckboxSize(i,"md")["box-size"],o=Math.round(.72*s);return _jsx(View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{width:s,height:s,alignItems:"center",justifyContent:"center",borderWidth:i.size.border,borderRadius:i.radius.sm,...smoothCorners,borderColor:e?i.colors.primary:i.colors.border,backgroundColor:e?i.colors.primary:t?i.colors["surface-disabled"]:"transparent"},children:e?_jsx(Svg,{width:o,height:o,viewBox:"0 0 24 24",children:_jsx(Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:i.colors["on-primary"],strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}):null})},isActionList=e=>Array.isArray(e)&&e.length>0&&e.every(e=>null!=e&&"object"==typeof e&&!React.isValidElement(e)&&"label"in e),renderActions=e=>isActionList(e)?e.map(e=>_jsx(Button,{size:"sm",variant:e.variant??"outline",tone:e.tone,leftIcon:e.icon,disabled:e.disabled,testID:e.testID,label:e.label,onPress:e.onPress},e.label)):e,ListItem=React.memo(forwardRef((e,t)=>{const{title:i,loading:s=!1,subtitle:o,description:l,children:r,titleLines:n=1,subtitleLines:a=1,left:
|
|
1
|
+
"use strict";import React,{forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,Text,useWindowDimensions,View}from"react-native";import Svg,{Path}from"react-native-svg";import{useFlickGuard}from"../../hooks/useFlickGuard.js";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,resolveCheckboxSize,resolveListItemSize,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{mergeRefs}from"../../utils/mergeRefs.js";import{themeStyles}from"../../utils/themeStyles.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{defaultIcons}from"../AppIcon/defaultIcons.js";import{Button}from"../Button/index.js";import{IconBadge}from"../IconBadge/index.js";import{useContextMenu}from"../Menu/useContextMenu.js";import{Skeleton}from"../Skeleton/index.js";import{Swipeable}from"../Swipeable/index.js";import{Fragment as _Fragment,jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const Chevron=({color:e})=>{const t=useTheme();return _jsx(_Fragment,{children:(t.settings.icons.chevronRight??defaultIcons.chevronRight)({size:20,color:e})})},BADGE_SIZE={sm:"sm",md:"md",lg:"lg"},RIGHT_BELOW_FONT_SCALE=1.2,SelectionBox=({checked:e,disabled:t})=>{const i=useTheme(),s=resolveCheckboxSize(i,"md")["box-size"],o=Math.round(.72*s);return _jsx(View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{width:s,height:s,alignItems:"center",justifyContent:"center",borderWidth:i.size.border,borderRadius:i.radius.sm,...smoothCorners,borderColor:e?i.colors.primary:i.colors.border,backgroundColor:e?i.colors.primary:t?i.colors["surface-disabled"]:"transparent"},children:e?_jsx(Svg,{width:o,height:o,viewBox:"0 0 24 24",children:_jsx(Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:i.colors["on-primary"],strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}):null})},isActionList=e=>Array.isArray(e)&&e.length>0&&e.every(e=>null!=e&&"object"==typeof e&&!React.isValidElement(e)&&"label"in e),renderActions=e=>isActionList(e)?e.map(e=>_jsx(Button,{size:"sm",variant:e.variant??"outline",tone:e.tone,leftIcon:e.icon,disabled:e.disabled,testID:e.testID,label:e.label,onPress:e.onPress},e.label)):e,ListItem=React.memo(forwardRef((e,t)=>{const{title:i,loading:s=!1,subtitle:o,description:l,children:r,titleLines:n=1,subtitleLines:a=1,left:d,icon:c,iconTone:m="primary",right:h,rightPlacement:u="auto",selectable:p=!1,checked:x=!1,onCheckedChange:g,actions:b,onPress:f,haptic:y,selected:j=!1,expanded:S,disabled:w=!1,size:I="md",divider:_=!1,chevron:v=!1,leftActions:L,rightActions:k,contextMenu:V,accessibilityLabel:C,accessibilityHint:A,style:R,containerStyle:z,titleStyle:B,subtitleStyle:P,descriptionStyle:T,leftSlotStyle:D,rightSlotStyle:F,testID:H}=e;warnInvalidValue("ListItem","size",e.size,["sm","md","lg"]),warnInvalidValue("ListItem","iconTone",e.iconTone,["primary","success","warning","danger","info","neutral"]),warnInvalidValue("ListItem","rightPlacement",e.rightPlacement,["auto","side","below"]);const M=useTheme(),W=useMemo(()=>resolveListItemSize(M,I),[M,I]),E=stylesFor(M),{fontScale:O}=useWindowDimensions(),G=!!h&&("below"===u||"auto"===u&&O>1.2),N=useContextMenu(w?void 0:V,{haptic:y||!1,testID:H}),Z=useMemo(()=>mergeRefs(t,N.hostRef),[t,N.hostRef]),U=p||!!f,q=U||N.enabled,J=q&&!w,{style:K,pressIn:Q,pressOut:X}=usePressAnimation({enabled:J}),Y=useFlickGuard(),$=C??("string"==typeof i?i:void 0),isText=e=>"string"==typeof e||"number"==typeof e,ee=d??(void 0===c?null:_jsx(IconBadge,{icon:c,tone:m,size:BADGE_SIZE[I]})),te=p?_jsxs(View,{style:E.selectionLead,children:[_jsx(SelectionBox,{checked:x,disabled:w}),ee?_jsx(View,{style:E.selectionLeadContent,children:ee}):null]}):ee,ie=null!=b&&!1!==b&&!(Array.isArray(b)&&0===b.length),se=_&&!ie,oe=_jsxs(View,{style:[E.row,{paddingVertical:W["padding-y"],minHeight:W["min-height"],backgroundColor:j?M.colors["surface-selected"]:"transparent"},se?E.divider:null,w?E.disabled:null,z],children:[te?_jsx(View,{style:[E.leftSlot,D],children:te}):null,_jsxs(View,{style:E.middle,children:[null==i||isText(i)?_jsx(Text,{style:[E.title,{fontSize:W["title-text"],...fontFor(M,"medium"),color:w?M.colors["text-disabled"]:M.colors["text-body"]},B],numberOfLines:n,children:i??" "}):i,null==o||""===o?null:isText(o)?_jsx(Text,{style:[E.subtitle,{fontSize:W["subtitle-text"],color:w?M.colors["text-disabled"]:M.colors["text-muted"]},P],numberOfLines:a,children:o}):o,l?_jsx(Text,{style:[E.description,{fontSize:W["subtitle-text"],color:w?M.colors["text-disabled"]:M.colors["text-subtle"]},T],numberOfLines:2,children:l}):null,null!=r&&!1!==r?_jsx(View,{style:E.body,children:r}):null,G?_jsx(View,{style:[E.rightBelow,F],children:h}):null]}),h&&!G||v?_jsxs(View,{style:[E.rightSlot,G?null:F],children:[G?null:h,v?_jsx(View,{style:h&&!G?E.chevronWithRight:null,children:_jsx(Chevron,{color:w?M.colors["text-disabled"]:M.colors["text-subtle"]})}):null]}):null]}),le=q?_jsx(Pressable,{ref:Z,onPress:e=>{J&&U&&!Y.isFlick(e)&&(y&&triggerHaptic(y),p?g?.(!x):f?.(e))},onPressIn:e=>{Y.onPressIn(e),Q()},onPressOut:X,disabled:!J,accessibilityRole:p?"checkbox":f?"button":void 0,accessibilityLabel:$,accessibilityHint:A,accessibilityState:p?{checked:x,disabled:!J,expanded:S}:{selected:j,disabled:!J,expanded:S},"aria-disabled":!J,"aria-expanded":S,...p?{"aria-checked":x}:{"aria-selected":j},testID:H,android_ripple:{color:M.colors["surface-pressed"],borderless:!1},style:({pressed:e})=>[R,e?E.pressed:null],...N.hostProps,children:_jsx(Animated.View,{style:K,children:oe})}):_jsx(View,{ref:t,accessibilityRole:"none",accessibilityLabel:$,accessibilityHint:A,accessibilityState:{selected:j,disabled:w},"aria-selected":j,"aria-disabled":w,testID:H,style:R,children:oe}),re=L&&L.length>0||k&&k.length>0,ne=ie?_jsxs(View,{style:[j?{backgroundColor:M.colors["surface-selected"]}:null,_?E.divider:null],children:[le,_jsx(View,{style:E.actions,children:renderActions(b)})]}):le,ae=re?_jsx(Swipeable,{leftActions:L,rightActions:k,accessibilityLabel:$,children:ne}):ne;return s?_jsx(ListItemSkeleton,{...e}):N.enabled?_jsxs(_Fragment,{children:[ae,N.renderSurface(_jsx(View,{style:E.preview,children:oe}))]}):ae}));ListItem.displayName="ListItem";const ListItemSkeleton=({subtitle:e,description:t,left:i,icon:s,right:o,chevron:l,size:r="md",containerStyle:n,style:a})=>{const d=useTheme(),c=resolveListItemSize(d,r),m=Math.round(1.15*c["title-text"]),h=Math.round(1.15*c["subtitle-text"]);return _jsxs(View,{style:[{flexDirection:"row",alignItems:"center",paddingHorizontal:d.space.md,paddingVertical:c["padding-y"],minHeight:c["min-height"]},n,a],children:[void 0!==i||void 0!==s?_jsx(View,{style:{marginRight:d.space.sm},children:_jsx(Skeleton,{shape:"circle",width:40,height:40})}):null,_jsxs(View,{style:{flex:1},children:[_jsx(Skeleton,{shape:"text",width:"70%",height:m,style:{marginBottom:d.space.xs}}),void 0!==e?_jsx(Skeleton,{shape:"text",width:"50%",height:h,style:void 0!==t?{marginBottom:d.space.xs}:void 0}):null,void 0!==t?_jsx(Skeleton,{shape:"text",width:"85%",height:h}):null]}),void 0!==o||l?_jsx(View,{style:{marginLeft:d.space.sm},children:_jsx(Skeleton,{width:20,height:20,radius:"sm"})}):null]})};ListItemSkeleton.displayName="ListItemSkeleton",ListItem.Skeleton=ListItemSkeleton;const buildStyles=e=>StyleSheet.create({row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.md},divider:{borderBottomWidth:StyleSheet.hairlineWidth,borderBottomColor:e.colors.border},pressed:{backgroundColor:e.colors["surface-pressed"]},disabled:{opacity:.55},leftSlot:{marginRight:e.space.md,alignItems:"center",justifyContent:"center"},middle:{flex:1,flexDirection:"column",justifyContent:"center"},selectionLead:{flexDirection:"row",alignItems:"center"},selectionLeadContent:{marginLeft:e.space.sm},body:{marginTop:e.space.xs},rightBelow:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",marginTop:e.space.xs},rightSlot:{marginLeft:e.space.md,alignItems:"center",justifyContent:"center",flexDirection:"row"},actions:{flexDirection:"row",flexWrap:"wrap",gap:e.space.sm,paddingHorizontal:e.space.md,paddingBottom:e.space.md},chevronWithRight:{marginLeft:e.space.xs},preview:{flex:1,backgroundColor:e.colors.surface,borderRadius:e.radius.md,...smoothCorners,overflow:"hidden"},title:{letterSpacing:e["letter-spacing"].normal},subtitle:{marginTop:e.space.xxs,...fontFor(e,"normal")},description:{marginTop:e.space.xxs,...fontFor(e,"normal")}}),stylesFor=themeStyles(buildStyles);export{ListItem};export default ListItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useMemo,useState}from"react";import{StyleSheet,View}from"react-native";import{resolveFieldSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Chevron}from"../FieldBase/Chevron.js";import{FieldBase,FieldLabel,FieldMessage,fieldTextAsString,hasFieldText,RequiredMark,resolveFieldTextStyle,resolveVariantColors}from"../FieldBase/FieldBase.js";import{NotationInkContext}from"../Notation/Notation.js";import{OptionSheet}from"../OptionSheet/OptionSheet.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_SELECT_LABELS={placeholder:"Select…",noSelection:"No selection",selected:e=>`Selected: ${e}`,fallbackName:"Select",sheetName:"Options"};const sameSelectValue=(e,t)=>String(e)===String(t),containsValue=(e,t)=>e.some(e=>sameSelectValue(e,t)),Select=forwardRef((e,t)=>{warnInvalidValue("Select","size",e.size,["sm","md","lg"]),warnInvalidValue("Select","variant",e.variant,["outline","filled","underline"]);const{options:l,getOptionLabel:i,getOptionValue:o,isOptionDisabled:
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useMemo,useState}from"react";import{StyleSheet,View}from"react-native";import{resolveFieldSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Chevron}from"../FieldBase/Chevron.js";import{FieldBase,FieldLabel,FieldMessage,fieldTextAsString,hasFieldText,RequiredMark,resolveFieldTextStyle,resolveVariantColors}from"../FieldBase/FieldBase.js";import{NotationInkContext}from"../Notation/Notation.js";import{DEFAULT_OPTION_SHEET_LABELS,OptionSheet}from"../OptionSheet/OptionSheet.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_SELECT_LABELS={placeholder:"Select…",noSelection:"No selection",selected:e=>`Selected: ${e}`,fallbackName:"Select",sheetName:"Options",searchPlaceholder:DEFAULT_OPTION_SHEET_LABELS.searchPlaceholder,empty:DEFAULT_OPTION_SHEET_LABELS.empty};const sameSelectValue=(e,t)=>String(e)===String(t),containsValue=(e,t)=>e.some(e=>sameSelectValue(e,t)),Select=forwardRef((e,t)=>{warnInvalidValue("Select","size",e.size,["sm","md","lg"]),warnInvalidValue("Select","variant",e.variant,["outline","filled","underline"]);const{options:l,getOptionLabel:i,getOptionValue:o,isOptionDisabled:r,getOptionDescription:n,getOptionIcon:s,placeholder:a,onVisibleChange:c,searchable:d=!1,haptic:p,labels:u,label:h,help:x,title:S,required:m=!1,error:f,helperText:b,prefix:g,numberOfLines:v=1,disabled:y=!1,size:T="md",variant:C,leftIcon:j,rightIcon:L,chevronColor:_,chevronSize:F,borderRadius:O,accessibilityLabel:V,labelStyle:E,style:I,triggerStyle:k,textStyle:z,optionStyle:A,selectedOptionStyle:H,optionTextStyle:N,selectedOptionTextStyle:w,testID:P}=e,D=!0===e.multi,B=u?{...DEFAULT_SELECT_LABELS,...u}:DEFAULT_SELECT_LABELS,R=useCallback(e=>i?i(e):e.label??"",[i]),M=useCallback(e=>o?o(e):e.value,[o]),U=useCallback(e=>r?r(e):!0===e.disabled,[r]),q=useCallback(e=>n?n(e):e.description,[n]),$=useCallback(e=>s?s(e):e.icon,[s]),G=useTheme(),J=useMemo(()=>buildStyles(G),[G]),K=resolveFieldSize(G,T),Q=resolveFieldTextStyle(G,{disabled:y}),W=C??G.settings.components.select?.defaultVariant??G.settings.components.field?.defaultVariant??"outline",X=O??K.radius,[Y,Z]=useState(!1),ee=useMemo(()=>{if(D){const t=e.value??[];return l.filter(e=>containsValue(t,M(e)))}const t=e.value;if(null==t)return[];const i=l.find(e=>sameSelectValue(M(e),t));return i?[i]:[]},[D,l,e.value,M]),te=useCallback(()=>{if(y)return;const e=resolveHaptic(p,"selection");e&&triggerHaptic(e),Z(!0)},[y,p]),le=useCallback(()=>{Z(!1)},[]),ie=useCallback(t=>{if(U(t))return;const l=M(t),i=resolveHaptic(p,"selection");if(i&&triggerHaptic(i),D){const t=e.value??[],i=containsValue(t,l)?t.filter(e=>!sameSelectValue(e,l)):[...t,l];return void e.onChange(i)}e.onChange(l),le()},[D,e,le,U,M,p]),oe=0===ee.length?a??B.placeholder:ee.map(e=>R(e)).join(", "),re=0===ee.length,ne=!0===f||hasFieldText(f),se=hasFieldText(h),ae=fieldTextAsString(h),ce=Math.round(1.4*K.text),de=useMemo(()=>({fontSize:K.text,color:Q.placeholderColor}),[K.text,Q.placeholderColor]),pe={color:y?G.colors["field-icon-disabled"]:Y?G.colors["field-icon-focus"]:G.colors["field-icon"],size:K.icon,disabled:y,focused:Y,error:ne},ue=0===ee.length?a??B.noSelection:B.selected(ee.map(e=>R(e)).join(", ")),he=V??`${ae??B.fallbackName}. ${ue}`;return _jsxs(View,{style:[J.container,I],testID:P,children:[se?_jsx(FieldLabel,{size:T,required:m,help:x,style:E,children:h}):null,_jsx(View,{ref:t,collapsable:!1,children:_jsxs(FieldBase,{size:T,variant:W,disabled:y,error:ne,filled:ee.length>0,onPress:te,borderRadius:X,paddingHorizontal:"underline"===W?G.space.none:void 0,accessibilityRole:"button",accessibilityLabel:he,accessibilityState:{disabled:y,expanded:Y},"aria-disabled":y,"aria-expanded":Y,style:k,slotAlign:1===v?"center":"top",slotLineHeight:1===v?void 0:ce,leading:j?_jsx(View,{children:renderSlotIcon(j,pe)}):null,trailing:L?_jsx(View,{children:renderSlotIcon(L,pe)}):_jsx(Chevron,{color:_??(y?G.colors["text-disabled"]:G.colors["text-subtle"]),size:F??K.icon,open:Y,style:J.chevron}),children:[hasFieldText(g)?"string"==typeof g||"number"==typeof g?_jsx(Text,{variant:"body",style:[J.prefix,{color:Q.placeholderColor,fontSize:K.text,lineHeight:1===v?void 0:ce,marginRight:G.space.xs}],children:g}):_jsx(View,{style:[J.prefixNode,{minHeight:1===v?void 0:ce,justifyContent:"center",marginRight:G.space.xs}],children:_jsx(Text,{variant:"body",style:[J.prefix,{color:Q.placeholderColor,fontSize:K.text,lineHeight:1===v?void 0:ce}],children:_jsx(NotationInkContext.Provider,{value:de,children:g})})}):null,_jsxs(Text,{variant:"body",style:[J.triggerText,{color:re?Q.placeholderColor:Q.color,fontSize:K.text,lineHeight:1===v?void 0:ce,...Q.weightStyle},z],numberOfLines:v,children:[oe,re&&m&&!se?_jsx(RequiredMark,{}):null]})]})}),_jsx(FieldMessage,{size:T,error:ne,text:ne?f:b}),_jsx(OptionSheet,{visible:Y,onClose:le,onVisibleChange:c,haptic:p,title:S??ae,accessibilityLabel:ae??(se?S:void 0)??a??B.sheetName,options:l,getOptionLabel:R,getOptionValue:M,isOptionDisabled:U,getOptionDescription:q,getOptionIcon:$,value:e.value,onChange:(e,t)=>ie(t),multi:D,searchable:d,labels:{searchPlaceholder:B.searchPlaceholder,empty:B.empty},optionStyle:A,selectedOptionStyle:H,optionTextStyle:N,selectedOptionTextStyle:w,searchSelectionColor:resolveVariantColors(G,W).borderFocusedRepresentative})]})});Select.displayName="Select";const buildStyles=e=>StyleSheet.create({container:{width:"100%"},label:{includeFontPadding:!1},triggerText:{flex:1,includeFontPadding:!1},errorText:{includeFontPadding:!1},prefix:{flexShrink:0,includeFontPadding:!1},prefixNode:{flexShrink:0},chevron:{marginLeft:e.space.sm}});export{Select};export default Select;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback,useState}from"react";import{Animated,Platform,StyleSheet,View}from"react-native";import Svg,{Path}from"react-native-svg";import{useTheme}from"../../theme/index.js";import{squircleApplies,squirclePath}from"../../utils/squircle.js";import{jsx as _jsx}from"react/jsx-runtime";const AnimatedPath=Animated.createAnimatedComponent(Path);export function SquircleFill({width:t,height:e,radius:i,fill:
|
|
1
|
+
"use strict";import{useCallback,useState}from"react";import{Animated,Platform,StyleSheet,View}from"react-native";import Svg,{Path}from"react-native-svg";import{useTheme}from"../../theme/index.js";import{squircleApplies,squirclePath}from"../../utils/squircle.js";import{jsx as _jsx}from"react/jsx-runtime";const AnimatedPath=Animated.createAnimatedComponent(Path);export function SquircleFill({width:t,height:e,radius:i,fill:r,stroke:s,strokeWidth:o=0,testID:l}){const a=o>0&&void 0!==s&&"transparent"!==s,n=a?o/2:0,h=useTheme().cornerSmoothing,u=squirclePath({width:t,height:e,radius:i,inset:n,smoothing:h});return _jsx(View,{pointerEvents:"none",style:styles.overlay,testID:l,children:_jsx(Svg,{width:t,height:e,viewBox:`0 0 ${t} ${e}`,children:_jsx(AnimatedPath,{d:u,fill:r,stroke:a?s:void 0,strokeWidth:a?o:void 0})})})}SquircleFill.displayName="SquircleFill";export function useSquircle(t,e,i){const[r,s]=useState(null),o=t&&"android"===Platform.OS;return{onLayout:useCallback(t=>{if(o){const{width:e,height:i}=t.nativeEvent.layout;s(t=>t&&t.width===e&&t.height===i?t:{width:e,height:i})}i?.(t)},[o,i]),size:r,active:o&&null!==r&&squircleApplies(r.width,r.height,e)}}const styles=StyleSheet.create({overlay:{position:"absolute",top:0,left:0,right:0,bottom:0}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef}from"react";import{StyleSheet,View}from"react-native";import{smoothCorners}from"../../utils/corners.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const PER_EDGE_KEYS=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderTopStartRadius","borderTopEndRadius","borderBottomStartRadius","borderBottomEndRadius","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStartWidth","borderEndWidth","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderStartColor","borderEndColor"],readShape=r=>{const{borderRadius:e,backgroundColor:o,borderColor:t,borderWidth:i=0,borderStyle:d}=r;if("number"!=typeof e||e<=0||"hidden"===r.overflow||(r.elevation??0)>0||void 0!==d&&"solid"!==d||PER_EDGE_KEYS.some(e=>void 0!==r[e]))return null;const s="string"==typeof o&&"transparent"!==o,l=i>0&&"string"==typeof t&&"transparent"!==t;return void 0!==o&&"string"!=typeof o||i>0&&void 0!==t&&"string"!=typeof t||!s&&!l?null:{radius:e,fill:s?o:"transparent",stroke:l?t:void 0,strokeWidth:l?i:0
|
|
1
|
+
"use strict";import{forwardRef}from"react";import{StyleSheet,View}from"react-native";import{smoothCorners}from"../../utils/corners.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const PER_EDGE_KEYS=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderTopStartRadius","borderTopEndRadius","borderBottomStartRadius","borderBottomEndRadius","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStartWidth","borderEndWidth","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderStartColor","borderEndColor"],readShape=r=>{const{borderRadius:e,backgroundColor:o,borderColor:t,borderWidth:i=0,borderStyle:d}=r;if("number"!=typeof e||e<=0||"hidden"===r.overflow||(r.elevation??0)>0||void 0!==d&&"solid"!==d||PER_EDGE_KEYS.some(e=>void 0!==r[e]))return null;const s="string"==typeof o&&"transparent"!==o,l=i>0&&"string"==typeof t&&"transparent"!==t;return void 0!==o&&"string"!=typeof o||i>0&&void 0!==t&&"string"!=typeof t||!s&&!l?null:{radius:e,fill:s?o:"transparent",stroke:l?t:void 0,strokeWidth:l?i:0}},SquircleView=forwardRef(({style:r,children:e,onLayout:o,...t},i)=>{const d=StyleSheet.flatten(r)??{},s=readShape(d),l="number"==typeof d.borderRadius?d.borderRadius:0,a=useSquircle(l>0,l,o),n=a.active?a.size:null,u=null!==s&&null!==n;return _jsxs(View,{ref:i,...t,onLayout:a.onLayout,style:[l>0?smoothCorners:null,r,u?styles.hostTransparent:null],children:[s&&n?_jsx(SquircleFill,{width:n.width,height:n.height,radius:s.radius,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth}):null,e]})});SquircleView.displayName="SquircleView";const styles=StyleSheet.create({hostTransparent:{backgroundColor:"transparent",borderColor:"transparent"}});export{SquircleView};export default SquircleView;
|
|
@@ -86,6 +86,12 @@ export interface ListItemProps {
|
|
|
86
86
|
/** Haptic feedback for interactions. Off unless a HapticType is passed. */
|
|
87
87
|
haptic?: HapticType | false;
|
|
88
88
|
selected?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Open or closed state of a disclosure row (one that shows or hides content
|
|
91
|
+
* below it). Announced to screen readers as expanded or collapsed; unset for
|
|
92
|
+
* a row that discloses nothing.
|
|
93
|
+
*/
|
|
94
|
+
expanded?: boolean;
|
|
89
95
|
disabled?: boolean;
|
|
90
96
|
size?: ListItemSize;
|
|
91
97
|
divider?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ProfilePicker — a round profile photo with a camera badge at its
|
|
3
3
|
* bottom-right; tapping it picks a new photo. The mobile counterpart of
|
|
4
|
-
* webority-ui's
|
|
4
|
+
* webority-ui's AppImagePicker.
|
|
5
5
|
*
|
|
6
6
|
* Native picking stays in the app, exactly as in FilePicker: `sources` are
|
|
7
7
|
* the same `FilePickerSource` adapters (`pick(): Promise<PickedFile[]>`),
|
|
@@ -20,6 +20,10 @@ export interface SelectLabels {
|
|
|
20
20
|
selected: (summary: string) => string;
|
|
21
21
|
fallbackName: string;
|
|
22
22
|
sheetName: string;
|
|
23
|
+
/** Placeholder of the sheet's search box when `searchable`. */
|
|
24
|
+
searchPlaceholder: string;
|
|
25
|
+
/** Shown in the sheet when no option matches the search. */
|
|
26
|
+
empty: string;
|
|
23
27
|
}
|
|
24
28
|
export declare const DEFAULT_SELECT_LABELS: SelectLabels;
|
|
25
29
|
interface BaseSelectProps<T = SelectOption> {
|
|
@@ -33,16 +33,9 @@ export interface SquircleFillProps {
|
|
|
33
33
|
stroke?: SquircleColor;
|
|
34
34
|
/** Border width; the path is inset by half of it so the outer edge meets the host's bounds. */
|
|
35
35
|
strokeWidth?: number;
|
|
36
|
-
/**
|
|
37
|
-
* The host's native border width. Absolute children sit inside a native
|
|
38
|
-
* border, so the overlay is pulled outward by this much to cover the
|
|
39
|
-
* whole border box. Hosts keep their native width (painted transparent)
|
|
40
|
-
* so their layout does not move by a pixel when the overlay takes over.
|
|
41
|
-
*/
|
|
42
|
-
outset?: number;
|
|
43
36
|
testID?: string;
|
|
44
37
|
}
|
|
45
|
-
export declare function SquircleFill({ width, height, radius, fill, stroke, strokeWidth,
|
|
38
|
+
export declare function SquircleFill({ width, height, radius, fill, stroke, strokeWidth, testID }: SquircleFillProps): import("react").JSX.Element;
|
|
46
39
|
export declare namespace SquircleFill {
|
|
47
40
|
var displayName: string;
|
|
48
41
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
+
import type { SafeAreaEdge } from "../components/KeyboardAwareScrollView/KeyboardAwareScrollView";
|
|
2
3
|
import { type ScreenProps } from "../components/Screen";
|
|
3
4
|
/**
|
|
4
5
|
* "pushed" (default): back arrow that runs `onBack` or navigation.goBack(); "tab": large title, no back arrow, top edge only,
|
|
@@ -7,6 +8,8 @@ import { type ScreenProps } from "../components/Screen";
|
|
|
7
8
|
export type NavigationScreenKind = "pushed" | "tab" | "root";
|
|
8
9
|
export interface NavigationScreenProps<ItemT = unknown> extends Omit<ScreenProps<ItemT>, "largeTitle" | "edges" | "bottomInset"> {
|
|
9
10
|
kind?: NavigationScreenKind;
|
|
11
|
+
/** Safe-area edges of a "pushed" or "root" screen, as on Screen; a "tab" screen always uses the top edge only. */
|
|
12
|
+
edges?: SafeAreaEdge[];
|
|
10
13
|
}
|
|
11
14
|
export declare function NavigationScreen<ItemT = unknown>({ kind, onBack, ...rest }: NavigationScreenProps<ItemT>): React.ReactElement;
|
|
12
15
|
//# sourceMappingURL=NavigationScreen.d.ts.map
|
|
@@ -86,6 +86,12 @@ export interface ListItemProps {
|
|
|
86
86
|
/** Haptic feedback for interactions. Off unless a HapticType is passed. */
|
|
87
87
|
haptic?: HapticType | false;
|
|
88
88
|
selected?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Open or closed state of a disclosure row (one that shows or hides content
|
|
91
|
+
* below it). Announced to screen readers as expanded or collapsed; unset for
|
|
92
|
+
* a row that discloses nothing.
|
|
93
|
+
*/
|
|
94
|
+
expanded?: boolean;
|
|
89
95
|
disabled?: boolean;
|
|
90
96
|
size?: ListItemSize;
|
|
91
97
|
divider?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ProfilePicker — a round profile photo with a camera badge at its
|
|
3
3
|
* bottom-right; tapping it picks a new photo. The mobile counterpart of
|
|
4
|
-
* webority-ui's
|
|
4
|
+
* webority-ui's AppImagePicker.
|
|
5
5
|
*
|
|
6
6
|
* Native picking stays in the app, exactly as in FilePicker: `sources` are
|
|
7
7
|
* the same `FilePickerSource` adapters (`pick(): Promise<PickedFile[]>`),
|
|
@@ -20,6 +20,10 @@ export interface SelectLabels {
|
|
|
20
20
|
selected: (summary: string) => string;
|
|
21
21
|
fallbackName: string;
|
|
22
22
|
sheetName: string;
|
|
23
|
+
/** Placeholder of the sheet's search box when `searchable`. */
|
|
24
|
+
searchPlaceholder: string;
|
|
25
|
+
/** Shown in the sheet when no option matches the search. */
|
|
26
|
+
empty: string;
|
|
23
27
|
}
|
|
24
28
|
export declare const DEFAULT_SELECT_LABELS: SelectLabels;
|
|
25
29
|
interface BaseSelectProps<T = SelectOption> {
|
|
@@ -33,16 +33,9 @@ export interface SquircleFillProps {
|
|
|
33
33
|
stroke?: SquircleColor;
|
|
34
34
|
/** Border width; the path is inset by half of it so the outer edge meets the host's bounds. */
|
|
35
35
|
strokeWidth?: number;
|
|
36
|
-
/**
|
|
37
|
-
* The host's native border width. Absolute children sit inside a native
|
|
38
|
-
* border, so the overlay is pulled outward by this much to cover the
|
|
39
|
-
* whole border box. Hosts keep their native width (painted transparent)
|
|
40
|
-
* so their layout does not move by a pixel when the overlay takes over.
|
|
41
|
-
*/
|
|
42
|
-
outset?: number;
|
|
43
36
|
testID?: string;
|
|
44
37
|
}
|
|
45
|
-
export declare function SquircleFill({ width, height, radius, fill, stroke, strokeWidth,
|
|
38
|
+
export declare function SquircleFill({ width, height, radius, fill, stroke, strokeWidth, testID }: SquircleFillProps): import("react").JSX.Element;
|
|
46
39
|
export declare namespace SquircleFill {
|
|
47
40
|
var displayName: string;
|
|
48
41
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
+
import type { SafeAreaEdge } from "../components/KeyboardAwareScrollView/KeyboardAwareScrollView.js";
|
|
2
3
|
import { type ScreenProps } from "../components/Screen/index.js";
|
|
3
4
|
/**
|
|
4
5
|
* "pushed" (default): back arrow that runs `onBack` or navigation.goBack(); "tab": large title, no back arrow, top edge only,
|
|
@@ -7,6 +8,8 @@ import { type ScreenProps } from "../components/Screen/index.js";
|
|
|
7
8
|
export type NavigationScreenKind = "pushed" | "tab" | "root";
|
|
8
9
|
export interface NavigationScreenProps<ItemT = unknown> extends Omit<ScreenProps<ItemT>, "largeTitle" | "edges" | "bottomInset"> {
|
|
9
10
|
kind?: NavigationScreenKind;
|
|
11
|
+
/** Safe-area edges of a "pushed" or "root" screen, as on Screen; a "tab" screen always uses the top edge only. */
|
|
12
|
+
edges?: SafeAreaEdge[];
|
|
10
13
|
}
|
|
11
14
|
export declare function NavigationScreen<ItemT = unknown>({ kind, onBack, ...rest }: NavigationScreenProps<ItemT>): React.ReactElement;
|
|
12
15
|
//# sourceMappingURL=NavigationScreen.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.108.0",
|
|
4
4
|
"description": "Beautiful, animated, accessible React Native components, theme and form engine for Webority projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"react-native-safe-area-context": ">=5.4.0",
|
|
101
101
|
"react-native-svg": ">=15.0.0",
|
|
102
102
|
"react-native-worklets": ">=0.10.0",
|
|
103
|
-
"@webority/canvas-kit": "0.
|
|
104
|
-
"@webority/mobile-core": "0.
|
|
103
|
+
"@webority/canvas-kit": "0.108.0",
|
|
104
|
+
"@webority/mobile-core": "0.108.0"
|
|
105
105
|
},
|
|
106
106
|
"peerDependenciesMeta": {
|
|
107
107
|
"@react-navigation/bottom-tabs": {
|
|
@@ -170,10 +170,10 @@
|
|
|
170
170
|
"react-test-renderer": "19.2.8",
|
|
171
171
|
"rimraf": "6.1.3",
|
|
172
172
|
"typescript": "5.9.3",
|
|
173
|
-
"@webority/
|
|
174
|
-
"@webority/mobile-
|
|
175
|
-
"@webority/tokens": "0.
|
|
176
|
-
"@webority/
|
|
173
|
+
"@webority/mobile-core": "0.108.0",
|
|
174
|
+
"@webority/mobile-dev": "0.0.0",
|
|
175
|
+
"@webority/tokens": "0.108.0",
|
|
176
|
+
"@webority/canvas-kit": "0.108.0"
|
|
177
177
|
},
|
|
178
178
|
"scripts": {
|
|
179
179
|
"build": "bob build && node ../mobile-dev/scripts/minify-lib.mjs && node -e \"require('node:fs').rmSync('dist/canvas-kit',{recursive:true,force:true})\" && node ../canvas-kit/dist/cli.js build --config canvas-kit.json --out dist/canvas-kit",
|