@webority/mobile-ui 0.120.0 → 0.121.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 +14 -2
- package/dist/canvas-kit/manifest.json +13 -1
- package/dist/canvas-kit/release.json +6 -6
- package/lib/commonjs/components/AppBar/AppBar.js +1 -1
- package/lib/module/components/AppBar/AppBar.js +1 -1
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +12 -1
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +12 -1
- package/package.json +7 -7
package/dist/canvas-kit/kit.js
CHANGED
|
@@ -15921,7 +15921,7 @@ var Sg = (e) => R.create({
|
|
|
15921
15921
|
}),
|
|
15922
15922
|
onPress: u,
|
|
15923
15923
|
accessibilityLabel: k.back
|
|
15924
|
-
} : void 0), I = l ? void 0 : s?.[s.length - 1], L = (e) => e === void 0 ? 0 : e.label === void 0 ?
|
|
15924
|
+
} : void 0), I = l ? void 0 : s?.[s.length - 1], L = (e) => e === void 0 ? 0 : e.label === void 0 ? Math.max((44 - (e.glyphSize ?? 24)) / 2, 0) : A.space.sm, z = d === void 0 ? null : {
|
|
15925
15925
|
paddingLeft: Math.max(d - L(F), 0),
|
|
15926
15926
|
paddingRight: Math.max(d - L(I), 0)
|
|
15927
15927
|
}, B = p !== void 0, V = !!F || !!c, U = g ?? !v, ee = R.hairlineWidth, W = m(() => {
|
|
@@ -36501,7 +36501,7 @@ var PO = Pt({
|
|
|
36501
36501
|
kind: "WeborityPhone",
|
|
36502
36502
|
library: {
|
|
36503
36503
|
name: "@webority/mobile-ui",
|
|
36504
|
-
version: "0.
|
|
36504
|
+
version: "0.121.0"
|
|
36505
36505
|
},
|
|
36506
36506
|
rendererProtocolVersion: 13,
|
|
36507
36507
|
platform: "Phone",
|
|
@@ -36967,6 +36967,12 @@ var PO = Pt({
|
|
|
36967
36967
|
required: !1,
|
|
36968
36968
|
description: "Draws a small unread dot on the button."
|
|
36969
36969
|
},
|
|
36970
|
+
{
|
|
36971
|
+
name: "glyphSize",
|
|
36972
|
+
type: "number",
|
|
36973
|
+
required: !1,
|
|
36974
|
+
description: "The drawn width in points of a glyph larger than the 24 point icon, so the gutter lands on its edge."
|
|
36975
|
+
},
|
|
36970
36976
|
{
|
|
36971
36977
|
name: "icon",
|
|
36972
36978
|
type: "icon",
|
|
@@ -37005,6 +37011,12 @@ var PO = Pt({
|
|
|
37005
37011
|
required: !1,
|
|
37006
37012
|
description: "Draws a small unread dot on the button."
|
|
37007
37013
|
},
|
|
37014
|
+
{
|
|
37015
|
+
name: "glyphSize",
|
|
37016
|
+
type: "number",
|
|
37017
|
+
required: !1,
|
|
37018
|
+
description: "The drawn width in points of a glyph larger than the 24 point icon, so the gutter lands on its edge."
|
|
37019
|
+
},
|
|
37008
37020
|
{
|
|
37009
37021
|
name: "icon",
|
|
37010
37022
|
type: "icon",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"kind": "WeborityPhone",
|
|
3
3
|
"library": {
|
|
4
4
|
"name": "@webority/mobile-ui",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.121.0"
|
|
6
6
|
},
|
|
7
7
|
"rendererProtocolVersion": 13,
|
|
8
8
|
"platform": "Phone",
|
|
@@ -582,6 +582,12 @@
|
|
|
582
582
|
"required": false,
|
|
583
583
|
"description": "Draws a small unread dot on the button."
|
|
584
584
|
},
|
|
585
|
+
{
|
|
586
|
+
"name": "glyphSize",
|
|
587
|
+
"type": "number",
|
|
588
|
+
"required": false,
|
|
589
|
+
"description": "The drawn width in points of a glyph larger than the 24 point icon, so the gutter lands on its edge."
|
|
590
|
+
},
|
|
585
591
|
{
|
|
586
592
|
"name": "icon",
|
|
587
593
|
"type": "icon",
|
|
@@ -620,6 +626,12 @@
|
|
|
620
626
|
"required": false,
|
|
621
627
|
"description": "Draws a small unread dot on the button."
|
|
622
628
|
},
|
|
629
|
+
{
|
|
630
|
+
"name": "glyphSize",
|
|
631
|
+
"type": "number",
|
|
632
|
+
"required": false,
|
|
633
|
+
"description": "The drawn width in points of a glyph larger than the 24 point icon, so the gutter lands on its edge."
|
|
634
|
+
},
|
|
623
635
|
{
|
|
624
636
|
"name": "icon",
|
|
625
637
|
"type": "icon",
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-phone",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.121.0",
|
|
4
4
|
"platform": "Phone",
|
|
5
5
|
"kitModuleVersion": 2,
|
|
6
6
|
"rendererProtocolVersion": 13,
|
|
7
7
|
"library": {
|
|
8
8
|
"name": "@webority/mobile-ui",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.121.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "3cd22c7c5be7f4be794877b692f8cd4eed436aa620f5f6d5618e1ce5d3a8c895",
|
|
14
|
+
"bytes": 637513
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "0125bbd3dc7b0edf94bc768d8475da8e66b0fd5d2147a041c737455d5364ffc5",
|
|
18
|
+
"bytes": 5960353
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_APP_BAR_LABELS=exports.AppBar=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_index2=require("../Menu/index.js"),_Text=require("../Text/Text.js"),_jsxRuntime=require("react/jsx-runtime");const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4,DEFAULT_APP_BAR_LABELS=exports.DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"}),variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",alignBottom:!1,subtitleLines:1};case"large":return{height:96,titleSize:e.text["2xl"].size,titleWeight:"bold",alignBottom:!0,subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",alignBottom:!1,subtitleLines:1}}},ActionButton=(0,_react.forwardRef)(({action:e,side:t,badgeStyle:i,haptic:n,flush:a,onPress:r},l)=>{const s=(0,_index.useTheme)(),{style:o,pressIn:c,pressOut:d}=(0,_usePressAnimation.usePressAnimation)({enabled:!0}),u=(0,_react.useMemo)(()=>buildActionStyles(s),[s]),p=e.badge,m=void 0!==p&&0!==p,x=void 0!==e.label;return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:o,children:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:l,onPress:t=>{const i=(0,_hapticUtils.resolveHaptic)(n,"selection");i&&(0,_hapticUtils.triggerHaptic)(i),"onPress"in e&&e.onPress(),r?.(t)},onPressIn:c,onPressOut:d,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,android_ripple:{color:s.colors["surface-pressed"],borderless:!x},style:({pressed:e})=>[x?u.textButton:u.actionButton,a?null:"left"===t?u.actionLeft:u.actionRight,e&&!x?u.actionPressed:null,e&&x?u.textPressed:null],children:[x?(0,_jsxRuntime.jsx)(_Text.Text,{variant:"body",weight:"semibold",color:"link",numberOfLines:1,children:e.label}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:u.iconWrap,children:e.icon}),m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[u.badge,i],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_Text.Text,{variant:"caption",weight:"semibold",numberOfLines:1,style:u.badgeText,children:String(p)})}):null,e.dot?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:e.testID?`${e.testID}-dot`:"appbar-action-dot",style:u.dot,pointerEvents:"none"}):null]})})}),COLLAPSE_RANGE=60,LARGE_TITLE_SCALE_END=.71,AppBar=exports.AppBar=(0,_react.forwardRef)((e,t)=>{const{title:i,subtitle:n,titleAlignment:a="left",leftAction:r,rightActions:l,leading:s,trailing:o,onBack:c,gutter:d,titleVariant:u,titleOffset:p,height:m,divider:x,variant:g="default",transparent:h=!1,scrollY:_,style:b,containerStyle:f,titleStyle:j,subtitleStyle:A,badgeStyle:v,haptic:y,labels:R,testID:S}=e;(0,_warnInvalidValue.warnInvalidValue)("AppBar","variant",e.variant,["default","large","compact"]),(0,_warnInvalidValue.warnInvalidValue)("AppBar","titleAlignment",e.titleAlignment,["left","center"]);const B=(0,_react.useMemo)(()=>({...DEFAULT_APP_BAR_LABELS,...R}),[R]),w=(0,_index.useTheme)(),I=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),L=(0,_react.useMemo)(()=>variantSize(w,g),[w,g]),N=(0,_react.useMemo)(()=>buildStyles(w),[w]),T="large"===g&&void 0!==_,C=r??(c?{icon:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"arrow-left",size:24,color:w.colors["text-body"]}),onPress:c,accessibilityLabel:B.back}:void 0),P=o?void 0:l?.[l.length-1],opticalInset=e=>void 0===e?0:void 0!==e.label?w.space.sm:Math.max(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DEFAULT_APP_BAR_LABELS=exports.AppBar=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_warnInvalidValue=require("../../utils/warnInvalidValue.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_index2=require("../Menu/index.js"),_Text=require("../Text/Text.js"),_jsxRuntime=require("react/jsx-runtime");const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4,DEFAULT_APP_BAR_LABELS=exports.DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"}),variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",alignBottom:!1,subtitleLines:1};case"large":return{height:96,titleSize:e.text["2xl"].size,titleWeight:"bold",alignBottom:!0,subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",alignBottom:!1,subtitleLines:1}}},ActionButton=(0,_react.forwardRef)(({action:e,side:t,badgeStyle:i,haptic:n,flush:a,onPress:r},l)=>{const s=(0,_index.useTheme)(),{style:o,pressIn:c,pressOut:d}=(0,_usePressAnimation.usePressAnimation)({enabled:!0}),u=(0,_react.useMemo)(()=>buildActionStyles(s),[s]),p=e.badge,m=void 0!==p&&0!==p,x=void 0!==e.label;return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:o,children:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:l,onPress:t=>{const i=(0,_hapticUtils.resolveHaptic)(n,"selection");i&&(0,_hapticUtils.triggerHaptic)(i),"onPress"in e&&e.onPress(),r?.(t)},onPressIn:c,onPressOut:d,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,android_ripple:{color:s.colors["surface-pressed"],borderless:!x},style:({pressed:e})=>[x?u.textButton:u.actionButton,a?null:"left"===t?u.actionLeft:u.actionRight,e&&!x?u.actionPressed:null,e&&x?u.textPressed:null],children:[x?(0,_jsxRuntime.jsx)(_Text.Text,{variant:"body",weight:"semibold",color:"link",numberOfLines:1,children:e.label}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:u.iconWrap,children:e.icon}),m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[u.badge,i],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_Text.Text,{variant:"caption",weight:"semibold",numberOfLines:1,style:u.badgeText,children:String(p)})}):null,e.dot?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:e.testID?`${e.testID}-dot`:"appbar-action-dot",style:u.dot,pointerEvents:"none"}):null]})})}),COLLAPSE_RANGE=60,LARGE_TITLE_SCALE_END=.71,AppBar=exports.AppBar=(0,_react.forwardRef)((e,t)=>{const{title:i,subtitle:n,titleAlignment:a="left",leftAction:r,rightActions:l,leading:s,trailing:o,onBack:c,gutter:d,titleVariant:u,titleOffset:p,height:m,divider:x,variant:g="default",transparent:h=!1,scrollY:_,style:b,containerStyle:f,titleStyle:j,subtitleStyle:A,badgeStyle:v,haptic:y,labels:R,testID:S}=e;(0,_warnInvalidValue.warnInvalidValue)("AppBar","variant",e.variant,["default","large","compact"]),(0,_warnInvalidValue.warnInvalidValue)("AppBar","titleAlignment",e.titleAlignment,["left","center"]);const B=(0,_react.useMemo)(()=>({...DEFAULT_APP_BAR_LABELS,...R}),[R]),w=(0,_index.useTheme)(),I=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),L=(0,_react.useMemo)(()=>variantSize(w,g),[w,g]),N=(0,_react.useMemo)(()=>buildStyles(w),[w]),T="large"===g&&void 0!==_,C=r??(c?{icon:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"arrow-left",size:24,color:w.colors["text-body"]}),onPress:c,accessibilityLabel:B.back}:void 0),P=o?void 0:l?.[l.length-1],opticalInset=e=>void 0===e?0:void 0!==e.label?w.space.sm:Math.max((44-(e.glyphSize??24))/2,0),V=void 0===d?null:{paddingLeft:Math.max(d-opticalInset(C),0),paddingRight:Math.max(d-opticalInset(P),0)},E=void 0!==p,z=Boolean(C)||Boolean(s),O=x??!h,D=_reactNative.StyleSheet.hairlineWidth,W=(0,_react.useMemo)(()=>{if(!_)return null;const e={inputRange:[0,60],extrapolate:"clamp"};return{titleScale:_.interpolate({...e,outputRange:[1,.71]}),titleTranslateY:_.interpolate({...e,outputRange:[0,-20]}),titleTranslateX:_.interpolate({...e,outputRange:"center"===a?[0,0]:[0,8]}),subtitleOpacity:_.interpolate({inputRange:[0,30],outputRange:[1,0],extrapolate:"clamp"}),barHeight:_.interpolate({...e,outputRange:[96,56]}),borderOpacity:_.interpolate({...e,outputRange:[0,1]})}},[_,a]),q=T&&W?{transform:[{translateX:W.titleTranslateX},{translateY:W.titleTranslateY},{scale:W.titleScale}]}:null,k=i?u?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:q,children:(0,_jsxRuntime.jsx)(_Text.Text,{variant:u,align:"center"===a?"center":"left",accessibilityRole:"header",numberOfLines:1,style:[N.titleVariant,j],children:i})}):(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{accessibilityRole:"header",style:[N.title,{fontSize:L.titleSize,fontWeight:w.weight[L.titleWeight],textAlign:"center"===a?"center":"left"},q,j],numberOfLines:1,children:i}):null,M=n?(0,_jsxRuntime.jsx)(_reactNative.Animated.Text,{style:[N.subtitle,{textAlign:"center"===a?"center":"left"},T&&W?{opacity:W.subtitleOpacity}:null,A],numberOfLines:L.subtitleLines,children:n}):null,F=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[N.titleColumn,"center"===a?N.titleColumnCenter:null,L.alignBottom?N.titleColumnBottom:null],children:[k,M]}),H=T?_reactNative.Animated.View:_reactNative.View,U=T&&W?{height:_reactNative.Animated.add(W.barHeight,new _reactNative.Animated.Value(I.top))}:{height:(m??L.height)+I.top};return(0,_jsxRuntime.jsxs)(H,{ref:t,testID:S,style:[N.root,{paddingTop:I.top,backgroundColor:h?"transparent":w.colors.surface},U,!T&&O?{borderBottomWidth:D,borderBottomColor:w.colors.border}:null,b,f],children:[T&&W&&O?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",style:[N.animatedBorder,{backgroundColor:w.colors.border,opacity:W.borderOpacity}]}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[N.row,L.alignBottom?N.rowAlignBottom:null,V,{flex:1}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[N.sideSlot,E?N.sideSlotCompact:null],children:[C?(0,_jsxRuntime.jsx)(ActionButton,{action:C,side:"left",haptic:y,flush:E}):null,null!=s&&!1!==s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:N.slotNode,children:s}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[N.center,"center"===a?N.centerAligned:N.centerLeft,E?{paddingLeft:z?p:w.space.none,paddingRight:w.space.none}:null],children:F}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[N.sideSlot,N.sideSlotRight,E?N.sideSlotCompact:null],children:[l?.map((e,t)=>(0,_jsxRuntime.jsx)(_react.Fragment,{children:"menu"in e?(0,_jsxRuntime.jsx)(_index2.Menu,{items:e.menu,title:e.menuTitle,haptic:y,trigger:(0,_jsxRuntime.jsx)(ActionButton,{action:e,side:"right",badgeStyle:v,haptic:y,flush:E})}):(0,_jsxRuntime.jsx)(ActionButton,{action:e,side:"right",badgeStyle:v,haptic:y,flush:E})},`appbar-right-${t}`)),null!=o&&!1!==o?(0,_jsxRuntime.jsx)(_reactNative.View,{style:N.slotNode,children:o}):null]})]})]})});AppBar.displayName="AppBar";const buildStyles=e=>_reactNative.StyleSheet.create({root:{width:"100%"},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.xs},rowAlignBottom:{alignItems:"flex-end",paddingBottom:e.space.sm},sideSlot:{flexDirection:"row",alignItems:"center",minWidth:48},sideSlotRight:{justifyContent:"flex-end"},sideSlotCompact:{minWidth:0},slotNode:{flexDirection:"row",alignItems:"center"},center:{flex:1,minWidth:0,paddingHorizontal:e.space.xs},centerAligned:{alignItems:"center"},centerLeft:{alignItems:"flex-start"},titleColumn:{flexDirection:"column",maxWidth:"100%"},titleColumnCenter:{alignItems:"center"},titleColumnBottom:{justifyContent:"flex-end"},title:{color:e.colors["text-body"]},titleVariant:{includeFontPadding:!1,textAlignVertical:"center"},subtitle:{marginTop:e.space.xxs,color:e.colors["text-subtle"],fontSize:e.text.sm.size,fontWeight:e.weight.normal},animatedBorder:{position:"absolute",left:0,right:0,bottom:0,height:_reactNative.StyleSheet.hairlineWidth}}),buildActionStyles=e=>_reactNative.StyleSheet.create({actionButton:{width:44,height:44,borderRadius:e.radius.pill,..._corners.smoothCorners,alignItems:"center",justifyContent:"center"},actionLeft:{marginRight:e.space.xs},actionRight:{marginLeft:e.space.xs},actionPressed:{backgroundColor:e.colors["surface-pressed"]},textButton:{minWidth:44,minHeight:44,paddingHorizontal:e.space.sm,alignItems:"center",justifyContent:"center"},textPressed:{opacity:.6},dot:{position:"absolute",top:10,right:10,width:8,height:8,borderRadius:e.radius.pill,backgroundColor:e.colors.danger},iconWrap:{alignItems:"center",justifyContent:"center"},badge:{position:"absolute",top:4,right:4,minWidth:16,height:16,paddingHorizontal:e.space.xs,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:e.colors.danger,alignItems:"center",justifyContent:"center"},badgeText:{color:e.colors["on-danger"],fontSize:e.text.xs.size,fontWeight:e.weight.semibold,lineHeight:13}});var _default=exports.default=AppBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Fragment,forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{AppIcon}from"../AppIcon/AppIcon.js";import{Menu}from"../Menu/index.js";import{Text as ThemedText}from"../Text/Text.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4;export const DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"});const variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",alignBottom:!1,subtitleLines:1};case"large":return{height:96,titleSize:e.text["2xl"].size,titleWeight:"bold",alignBottom:!0,subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",alignBottom:!1,subtitleLines:1}}},ActionButton=forwardRef(({action:e,side:t,badgeStyle:i,haptic:n,flush:l,onPress:o},s)=>{const r=useTheme(),{style:a,pressIn:c,pressOut:d}=usePressAnimation({enabled:!0}),u=useMemo(()=>buildActionStyles(r),[r]),m=e.badge,p=void 0!==m&&0!==m,g=void 0!==e.label;return _jsx(Animated.View,{style:a,children:_jsxs(Pressable,{ref:s,onPress:t=>{const i=resolveHaptic(n,"selection");i&&triggerHaptic(i),"onPress"in e&&e.onPress(),o?.(t)},onPressIn:c,onPressOut:d,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,android_ripple:{color:r.colors["surface-pressed"],borderless:!g},style:({pressed:e})=>[g?u.textButton:u.actionButton,l?null:"left"===t?u.actionLeft:u.actionRight,e&&!g?u.actionPressed:null,e&&g?u.textPressed:null],children:[g?_jsx(ThemedText,{variant:"body",weight:"semibold",color:"link",numberOfLines:1,children:e.label}):_jsx(View,{style:u.iconWrap,children:e.icon}),p?_jsx(View,{style:[u.badge,i],pointerEvents:"none",children:_jsx(ThemedText,{variant:"caption",weight:"semibold",numberOfLines:1,style:u.badgeText,children:String(m)})}):null,e.dot?_jsx(View,{testID:e.testID?`${e.testID}-dot`:"appbar-action-dot",style:u.dot,pointerEvents:"none"}):null]})})}),COLLAPSE_RANGE=60,LARGE_TITLE_SCALE_END=.71,AppBar=forwardRef((e,t)=>{const{title:i,subtitle:n,titleAlignment:l="left",leftAction:o,rightActions:s,leading:r,trailing:a,onBack:c,gutter:d,titleVariant:u,titleOffset:m,height:p,divider:g,variant:h="default",transparent:x=!1,scrollY:f,style:b,containerStyle:y,titleStyle:A,subtitleStyle:S,badgeStyle:j,haptic:_,labels:w,testID:B}=e;warnInvalidValue("AppBar","variant",e.variant,["default","large","compact"]),warnInvalidValue("AppBar","titleAlignment",e.titleAlignment,["left","center"]);const T=useMemo(()=>({...DEFAULT_APP_BAR_LABELS,...w}),[w]),I=useTheme(),v=useSafeAreaInsets(),L=useMemo(()=>variantSize(I,h),[I,h]),C=useMemo(()=>buildStyles(I),[I]),R="large"===h&&void 0!==f,V=o??(c?{icon:_jsx(AppIcon,{name:"arrow-left",size:24,color:I.colors["text-body"]}),onPress:c,accessibilityLabel:T.back}:void 0),P=a?void 0:s?.[s.length-1],opticalInset=e=>void 0===e?0:void 0!==e.label?I.space.sm:Math.max(
|
|
1
|
+
"use strict";import{Fragment,forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{AppIcon}from"../AppIcon/AppIcon.js";import{Menu}from"../Menu/index.js";import{Text as ThemedText}from"../Text/Text.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const ACTION_BUTTON_SIZE=44,DOT_OFFSET=10,DOT_SIZE=8,BADGE_OFFSET=4;export const DEFAULT_APP_BAR_LABELS=Object.freeze({back:"Back"});const variantSize=(e,t)=>{switch(t){case"compact":return{height:44,titleSize:e.text.lg.size,titleWeight:"semibold",alignBottom:!1,subtitleLines:1};case"large":return{height:96,titleSize:e.text["2xl"].size,titleWeight:"bold",alignBottom:!0,subtitleLines:2};default:return{height:56,titleSize:e.text.lg.size,titleWeight:"semibold",alignBottom:!1,subtitleLines:1}}},ActionButton=forwardRef(({action:e,side:t,badgeStyle:i,haptic:n,flush:l,onPress:o},s)=>{const r=useTheme(),{style:a,pressIn:c,pressOut:d}=usePressAnimation({enabled:!0}),u=useMemo(()=>buildActionStyles(r),[r]),m=e.badge,p=void 0!==m&&0!==m,g=void 0!==e.label;return _jsx(Animated.View,{style:a,children:_jsxs(Pressable,{ref:s,onPress:t=>{const i=resolveHaptic(n,"selection");i&&triggerHaptic(i),"onPress"in e&&e.onPress(),o?.(t)},onPressIn:c,onPressOut:d,accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,android_ripple:{color:r.colors["surface-pressed"],borderless:!g},style:({pressed:e})=>[g?u.textButton:u.actionButton,l?null:"left"===t?u.actionLeft:u.actionRight,e&&!g?u.actionPressed:null,e&&g?u.textPressed:null],children:[g?_jsx(ThemedText,{variant:"body",weight:"semibold",color:"link",numberOfLines:1,children:e.label}):_jsx(View,{style:u.iconWrap,children:e.icon}),p?_jsx(View,{style:[u.badge,i],pointerEvents:"none",children:_jsx(ThemedText,{variant:"caption",weight:"semibold",numberOfLines:1,style:u.badgeText,children:String(m)})}):null,e.dot?_jsx(View,{testID:e.testID?`${e.testID}-dot`:"appbar-action-dot",style:u.dot,pointerEvents:"none"}):null]})})}),COLLAPSE_RANGE=60,LARGE_TITLE_SCALE_END=.71,AppBar=forwardRef((e,t)=>{const{title:i,subtitle:n,titleAlignment:l="left",leftAction:o,rightActions:s,leading:r,trailing:a,onBack:c,gutter:d,titleVariant:u,titleOffset:m,height:p,divider:g,variant:h="default",transparent:x=!1,scrollY:f,style:b,containerStyle:y,titleStyle:A,subtitleStyle:S,badgeStyle:j,haptic:_,labels:w,testID:B}=e;warnInvalidValue("AppBar","variant",e.variant,["default","large","compact"]),warnInvalidValue("AppBar","titleAlignment",e.titleAlignment,["left","center"]);const T=useMemo(()=>({...DEFAULT_APP_BAR_LABELS,...w}),[w]),I=useTheme(),v=useSafeAreaInsets(),L=useMemo(()=>variantSize(I,h),[I,h]),C=useMemo(()=>buildStyles(I),[I]),R="large"===h&&void 0!==f,V=o??(c?{icon:_jsx(AppIcon,{name:"arrow-left",size:24,color:I.colors["text-body"]}),onPress:c,accessibilityLabel:T.back}:void 0),P=a?void 0:s?.[s.length-1],opticalInset=e=>void 0===e?0:void 0!==e.label?I.space.sm:Math.max((44-(e.glyphSize??24))/2,0),z=void 0===d?null:{paddingLeft:Math.max(d-opticalInset(V),0),paddingRight:Math.max(d-opticalInset(P),0)},O=void 0!==m,E=Boolean(V)||Boolean(r),W=g??!x,D=StyleSheet.hairlineWidth,H=useMemo(()=>{if(!f)return null;const e={inputRange:[0,60],extrapolate:"clamp"};return{titleScale:f.interpolate({...e,outputRange:[1,.71]}),titleTranslateY:f.interpolate({...e,outputRange:[0,-20]}),titleTranslateX:f.interpolate({...e,outputRange:"center"===l?[0,0]:[0,8]}),subtitleOpacity:f.interpolate({inputRange:[0,30],outputRange:[1,0],extrapolate:"clamp"}),barHeight:f.interpolate({...e,outputRange:[96,56]}),borderOpacity:f.interpolate({...e,outputRange:[0,1]})}},[f,l]),M=R&&H?{transform:[{translateX:H.titleTranslateX},{translateY:H.titleTranslateY},{scale:H.titleScale}]}:null,k=i?u?_jsx(Animated.View,{style:M,children:_jsx(ThemedText,{variant:u,align:"center"===l?"center":"left",accessibilityRole:"header",numberOfLines:1,style:[C.titleVariant,A],children:i})}):_jsx(Animated.Text,{accessibilityRole:"header",style:[C.title,{fontSize:L.titleSize,fontWeight:I.weight[L.titleWeight],textAlign:"center"===l?"center":"left"},M,A],numberOfLines:1,children:i}):null,F=n?_jsx(Animated.Text,{style:[C.subtitle,{textAlign:"center"===l?"center":"left"},R&&H?{opacity:H.subtitleOpacity}:null,S],numberOfLines:L.subtitleLines,children:n}):null,N=_jsxs(View,{style:[C.titleColumn,"center"===l?C.titleColumnCenter:null,L.alignBottom?C.titleColumnBottom:null],children:[k,F]}),U=R?Animated.View:View,Y=R&&H?{height:Animated.add(H.barHeight,new Animated.Value(v.top))}:{height:(p??L.height)+v.top};return _jsxs(U,{ref:t,testID:B,style:[C.root,{paddingTop:v.top,backgroundColor:x?"transparent":I.colors.surface},Y,!R&&W?{borderBottomWidth:D,borderBottomColor:I.colors.border}:null,b,y],children:[R&&H&&W?_jsx(Animated.View,{pointerEvents:"none",style:[C.animatedBorder,{backgroundColor:I.colors.border,opacity:H.borderOpacity}]}):null,_jsxs(View,{style:[C.row,L.alignBottom?C.rowAlignBottom:null,z,{flex:1}],children:[_jsxs(View,{style:[C.sideSlot,O?C.sideSlotCompact:null],children:[V?_jsx(ActionButton,{action:V,side:"left",haptic:_,flush:O}):null,null!=r&&!1!==r?_jsx(View,{style:C.slotNode,children:r}):null]}),_jsx(View,{pointerEvents:"none",style:[C.center,"center"===l?C.centerAligned:C.centerLeft,O?{paddingLeft:E?m:I.space.none,paddingRight:I.space.none}:null],children:N}),_jsxs(View,{style:[C.sideSlot,C.sideSlotRight,O?C.sideSlotCompact:null],children:[s?.map((e,t)=>_jsx(Fragment,{children:"menu"in e?_jsx(Menu,{items:e.menu,title:e.menuTitle,haptic:_,trigger:_jsx(ActionButton,{action:e,side:"right",badgeStyle:j,haptic:_,flush:O})}):_jsx(ActionButton,{action:e,side:"right",badgeStyle:j,haptic:_,flush:O})},`appbar-right-${t}`)),null!=a&&!1!==a?_jsx(View,{style:C.slotNode,children:a}):null]})]})]})});AppBar.displayName="AppBar";const buildStyles=e=>StyleSheet.create({root:{width:"100%"},row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.xs},rowAlignBottom:{alignItems:"flex-end",paddingBottom:e.space.sm},sideSlot:{flexDirection:"row",alignItems:"center",minWidth:48},sideSlotRight:{justifyContent:"flex-end"},sideSlotCompact:{minWidth:0},slotNode:{flexDirection:"row",alignItems:"center"},center:{flex:1,minWidth:0,paddingHorizontal:e.space.xs},centerAligned:{alignItems:"center"},centerLeft:{alignItems:"flex-start"},titleColumn:{flexDirection:"column",maxWidth:"100%"},titleColumnCenter:{alignItems:"center"},titleColumnBottom:{justifyContent:"flex-end"},title:{color:e.colors["text-body"]},titleVariant:{includeFontPadding:!1,textAlignVertical:"center"},subtitle:{marginTop:e.space.xxs,color:e.colors["text-subtle"],fontSize:e.text.sm.size,fontWeight:e.weight.normal},animatedBorder:{position:"absolute",left:0,right:0,bottom:0,height:StyleSheet.hairlineWidth}}),buildActionStyles=e=>StyleSheet.create({actionButton:{width:44,height:44,borderRadius:e.radius.pill,...smoothCorners,alignItems:"center",justifyContent:"center"},actionLeft:{marginRight:e.space.xs},actionRight:{marginLeft:e.space.xs},actionPressed:{backgroundColor:e.colors["surface-pressed"]},textButton:{minWidth:44,minHeight:44,paddingHorizontal:e.space.sm,alignItems:"center",justifyContent:"center"},textPressed:{opacity:.6},dot:{position:"absolute",top:10,right:10,width:8,height:8,borderRadius:e.radius.pill,backgroundColor:e.colors.danger},iconWrap:{alignItems:"center",justifyContent:"center"},badge:{position:"absolute",top:4,right:4,minWidth:16,height:16,paddingHorizontal:e.space.xs,borderRadius:e.radius.pill,...smoothCorners,backgroundColor:e.colors.danger,alignItems:"center",justifyContent:"center"},badgeText:{color:e.colors["on-danger"],fontSize:e.text.xs.size,fontWeight:e.weight.semibold,lineHeight:13}});export{AppBar};export default AppBar;
|
|
@@ -18,6 +18,11 @@ export interface AppBarPressAction {
|
|
|
18
18
|
* `accessibilityLabel` defaults to this label. Wins over `icon` when both are set.
|
|
19
19
|
*/
|
|
20
20
|
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The drawn width in pt of a glyph larger than the 24 pt icon (an icon on its own disc, say),
|
|
23
|
+
* so the bar's gutter lands on the glyph's visible edge. Default 24.
|
|
24
|
+
*/
|
|
25
|
+
glyphSize?: number;
|
|
21
26
|
/** Draws a small unread dot on the button's corner, with no count. */
|
|
22
27
|
dot?: boolean;
|
|
23
28
|
/** A count or short text drawn on the button's corner; zero draws nothing. */
|
|
@@ -36,6 +41,11 @@ export interface AppBarMenuAction {
|
|
|
36
41
|
dot?: boolean;
|
|
37
42
|
/** A count or short text drawn on the button's corner; zero draws nothing. */
|
|
38
43
|
badge?: number | string;
|
|
44
|
+
/**
|
|
45
|
+
* The drawn width in pt of a glyph larger than the 24 pt icon (an icon on its own disc, say),
|
|
46
|
+
* so the bar's gutter lands on the glyph's visible edge. Default 24.
|
|
47
|
+
*/
|
|
48
|
+
glyphSize?: number;
|
|
39
49
|
/** The spoken label of the button, required because the button has no text of its own. */
|
|
40
50
|
accessibilityLabel: string;
|
|
41
51
|
testID?: string;
|
|
@@ -66,7 +76,8 @@ export interface AppBarProps {
|
|
|
66
76
|
/**
|
|
67
77
|
* The page gutter: the distance from the screen edge to the VISIBLE edge of the outermost
|
|
68
78
|
* glyph. The bar subtracts the empty space inside an action button (the 44 pt button minus
|
|
69
|
-
* the 24 pt
|
|
79
|
+
* the glyph, 24 pt unless the action's `glyphSize` says otherwise, halved; the text padding for
|
|
80
|
+
* a text action). A
|
|
70
81
|
* `leading` or `trailing` node is taken to draw to its own edge. Default: the bar's own
|
|
71
82
|
* `space.xs` padding.
|
|
72
83
|
*/
|
|
@@ -18,6 +18,11 @@ export interface AppBarPressAction {
|
|
|
18
18
|
* `accessibilityLabel` defaults to this label. Wins over `icon` when both are set.
|
|
19
19
|
*/
|
|
20
20
|
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The drawn width in pt of a glyph larger than the 24 pt icon (an icon on its own disc, say),
|
|
23
|
+
* so the bar's gutter lands on the glyph's visible edge. Default 24.
|
|
24
|
+
*/
|
|
25
|
+
glyphSize?: number;
|
|
21
26
|
/** Draws a small unread dot on the button's corner, with no count. */
|
|
22
27
|
dot?: boolean;
|
|
23
28
|
/** A count or short text drawn on the button's corner; zero draws nothing. */
|
|
@@ -36,6 +41,11 @@ export interface AppBarMenuAction {
|
|
|
36
41
|
dot?: boolean;
|
|
37
42
|
/** A count or short text drawn on the button's corner; zero draws nothing. */
|
|
38
43
|
badge?: number | string;
|
|
44
|
+
/**
|
|
45
|
+
* The drawn width in pt of a glyph larger than the 24 pt icon (an icon on its own disc, say),
|
|
46
|
+
* so the bar's gutter lands on the glyph's visible edge. Default 24.
|
|
47
|
+
*/
|
|
48
|
+
glyphSize?: number;
|
|
39
49
|
/** The spoken label of the button, required because the button has no text of its own. */
|
|
40
50
|
accessibilityLabel: string;
|
|
41
51
|
testID?: string;
|
|
@@ -66,7 +76,8 @@ export interface AppBarProps {
|
|
|
66
76
|
/**
|
|
67
77
|
* The page gutter: the distance from the screen edge to the VISIBLE edge of the outermost
|
|
68
78
|
* glyph. The bar subtracts the empty space inside an action button (the 44 pt button minus
|
|
69
|
-
* the 24 pt
|
|
79
|
+
* the glyph, 24 pt unless the action's `glyphSize` says otherwise, halved; the text padding for
|
|
80
|
+
* a text action). A
|
|
70
81
|
* `leading` or `trailing` node is taken to draw to its own edge. Default: the bar's own
|
|
71
82
|
* `space.xs` padding.
|
|
72
83
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.121.0",
|
|
4
4
|
"description": "Beautiful, animated, accessible React Native components, theme and form engine for Webority projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -85,13 +85,13 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@webority/markdown-core": "0.
|
|
88
|
+
"@webority/markdown-core": "0.121.0"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"@react-navigation/bottom-tabs": ">=7.0.0",
|
|
92
92
|
"@react-navigation/native": ">=7.0.0",
|
|
93
|
-
"@webority/canvas-kit": "0.
|
|
94
|
-
"@webority/mobile-core": "0.
|
|
93
|
+
"@webority/canvas-kit": "0.121.0",
|
|
94
|
+
"@webority/mobile-core": "0.121.0",
|
|
95
95
|
"expo": ">=57.0.0",
|
|
96
96
|
"expo-file-system": ">=57.0.0",
|
|
97
97
|
"expo-haptics": ">=57.0.0",
|
|
@@ -155,10 +155,10 @@
|
|
|
155
155
|
"@types/node": "25.6.0",
|
|
156
156
|
"@types/react": "19.2.18",
|
|
157
157
|
"@types/react-test-renderer": "19.1.0",
|
|
158
|
-
"@webority/canvas-kit": "0.
|
|
159
|
-
"@webority/mobile-core": "0.
|
|
158
|
+
"@webority/canvas-kit": "0.121.0",
|
|
159
|
+
"@webority/mobile-core": "0.121.0",
|
|
160
160
|
"@webority/mobile-dev": "0.0.0",
|
|
161
|
-
"@webority/tokens": "0.
|
|
161
|
+
"@webority/tokens": "0.121.0",
|
|
162
162
|
"expo": "57.0.31",
|
|
163
163
|
"expo-file-system": "57.0.7",
|
|
164
164
|
"expo-haptics": "57.0.3",
|