@webority/mobile-ui 0.133.0 → 0.134.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 +2162 -2048
- package/dist/canvas-kit/manifest.json +2 -2
- package/dist/canvas-kit/release.json +6 -6
- package/lib/commonjs/components/AppIcon/slotIcon.js +1 -1
- package/lib/commonjs/components/Banner/Banner.js +1 -1
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/commonjs/components/Button/Button.js +1 -1
- package/lib/commonjs/components/Card/Card.js +1 -1
- package/lib/commonjs/components/Chip/Chip.js +1 -1
- package/lib/commonjs/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/commonjs/components/DateSeparator/DateSeparator.js +1 -1
- package/lib/commonjs/components/Dialog/OverlayActions.js +1 -1
- package/lib/commonjs/components/IconButton/IconButton.js +1 -1
- package/lib/commonjs/components/Input/Input.js +1 -1
- package/lib/commonjs/components/Menu/MenuSurface.js +1 -1
- package/lib/commonjs/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/commonjs/components/SearchBar/SearchBar.js +1 -1
- package/lib/commonjs/components/SearchBar/SearchPanel.js +1 -1
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/commonjs/components/Select/Select.js +1 -1
- package/lib/commonjs/components/StatTile/StatTile.js +1 -1
- package/lib/commonjs/components/Swipeable/Swipeable.js +1 -1
- package/lib/commonjs/components/Tabs/Tabs.js +1 -1
- package/lib/module/components/AppIcon/slotIcon.js +1 -1
- package/lib/module/components/Banner/Banner.js +1 -1
- package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/module/components/Button/Button.js +1 -1
- package/lib/module/components/Card/Card.js +1 -1
- package/lib/module/components/Chip/Chip.js +1 -1
- package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/module/components/DateSeparator/DateSeparator.js +1 -1
- package/lib/module/components/Dialog/OverlayActions.js +1 -1
- package/lib/module/components/IconButton/IconButton.js +1 -1
- package/lib/module/components/Input/Input.js +1 -1
- package/lib/module/components/Menu/MenuSurface.js +1 -1
- package/lib/module/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/module/components/SearchBar/SearchBar.js +1 -1
- package/lib/module/components/SearchBar/SearchPanel.js +1 -1
- package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
- package/lib/module/components/Select/Select.js +1 -1
- package/lib/module/components/StatTile/StatTile.js +1 -1
- package/lib/module/components/Swipeable/Swipeable.js +1 -1
- package/lib/module/components/Tabs/Tabs.js +1 -1
- package/lib/typescript/commonjs/components/AppIcon/slotIcon.d.ts +8 -0
- package/lib/typescript/commonjs/components/DateSeparator/DateSeparator.d.ts +2 -3
- package/lib/typescript/module/components/AppIcon/slotIcon.d.ts +8 -0
- package/lib/typescript/module/components/DateSeparator/DateSeparator.d.ts +2 -3
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Logger}from"@webority/mobile-core";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,ScrollView,StyleSheet,View}from"react-native";import{createAnimatedValue,resolveSegmentedControlSize,resolveTabsSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Badge}from"../Badge/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const Tabs=forwardRef((e,t)=>{const{tabs:i,activeKey:a,onChange:r,variant:n="underline",radius:s,size:l="md",scrollable:o=!1,align:d="left",style:c,tabStyle:u,tabLabelStyle:m,tabIconStyle:p,tabBadgeStyle:b,dividerStyle:g,indicatorStyle:f,progress:h,pages:y,haptic:x,accessibilityLabel:v,testID:S}=e;warnInvalidValue("Tabs","variant",e.variant,["underline","pills","segmented"]),warnInvalidValue("Tabs","size",e.size,["sm","md","lg"]),warnInvalidValue("Tabs","align",e.align,["left","center"]);const w=useTheme(),j=useMemo(()=>buildStyles(w),[w]),V=w.components.tabs,T=useMemo(()=>resolveTabsSize(w,l),[w,l]),_=o?T["scrollable-padding-x"]:T["padding-x"],k=T["padding-y"],I=T.text,R=w.space[V["icon-gap"]],z=T.icon,C=V["underline-height"],E=w.space[V["pill-inset"]],
|
|
1
|
+
"use strict";import{Logger}from"@webority/mobile-core";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,ScrollView,StyleSheet,View}from"react-native";import{createAnimatedValue,resolveSegmentedControlSize,resolveTabsSize,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{warnInvalidValue}from"../../utils/warnInvalidValue.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Badge}from"../Badge/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const Tabs=forwardRef((e,t)=>{const{tabs:i,activeKey:a,onChange:r,variant:n="underline",radius:s,size:l="md",scrollable:o=!1,align:d="left",style:c,tabStyle:u,tabLabelStyle:m,tabIconStyle:p,tabBadgeStyle:b,dividerStyle:g,indicatorStyle:f,progress:h,pages:y,haptic:x,accessibilityLabel:v,testID:S}=e;warnInvalidValue("Tabs","variant",e.variant,["underline","pills","segmented"]),warnInvalidValue("Tabs","size",e.size,["sm","md","lg"]),warnInvalidValue("Tabs","align",e.align,["left","center"]);const w=useTheme(),j=useMemo(()=>buildStyles(w),[w]),V=w.components.tabs,T=useMemo(()=>resolveTabsSize(w,l),[w,l]),_=o?T["scrollable-padding-x"]:T["padding-x"],k=T["padding-y"],I=T.text,R=w.space[V["icon-gap"]],z=T.icon,C=V["underline-height"],E=w.space[V["pill-inset"]],A=V["disabled-opacity"],L=w.space[V["badge-gap"]],F="segmented"===n,M=useMemo(()=>resolveSegmentedControlSize(w,l),[w,l]),H=w.space[V["track-padding"]],D="number"==typeof s?s:s?w.radius[s]:void 0,B=D??w.radius.md,P=void 0===D?w.radius.sm:Math.max(D-H,0),q=D??w.radius.pill,N=D??w.radius.none,O=w.colors["bg-muted"],W=useSquircle(F,B),[$,U]=useState({}),K=useRef(createAnimatedValue(0)).current,X=useRef(createAnimatedValue(0)).current,[G,J]=useState(0),Q=useRef(createAnimatedValue(0)).current,Y=useRef(null),Z=useRef(0),ee=$[a],te=Math.max(0,i.findIndex(e=>e.key===a)),ie=useMemo(()=>y&&G>0?Q.interpolate({inputRange:[0,G],outputRange:[0,1]}):void 0,[y,G,Q])??h,ae=i.every(e=>void 0!==$[e.key]),re=void 0!==ie&&ae&&i.length>1,ne=useMemo(()=>re&&ie?ie.interpolate({inputRange:i.map((e,t)=>t),outputRange:i.map(e=>$[e.key].x),extrapolate:"clamp"}):null,[re,ie,i,$]),se=useMemo(()=>re&&ie?ie.interpolate({inputRange:i.map((e,t)=>t),outputRange:i.map(e=>$[e.key].width),extrapolate:"clamp"}):null,[re,ie,i,$]),le=useRef(null);useEffect(()=>{if(!ee)return;if(re)return;const e=null!==le.current&&le.current!==a;if(le.current=a,!e)return K.setValue(ee.x),void X.setValue(ee.width);const t=w.motion.spring.snappy,i=Animated.parallel([Animated.spring(K,{toValue:ee.x,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:!1}),Animated.spring(X,{toValue:ee.width,damping:t.damping,stiffness:t.stiffness,mass:t.mass,overshootClamping:!0,useNativeDriver:!1})]);return i.start(),()=>i.stop()},[ee,a,K,X,w.motion.spring.snappy,re]),useEffect(()=>{y&&0!==G&&Z.current!==te&&(Z.current=te,Y.current?.scrollTo({x:te*G,animated:!0}))},[y,G,te]);const oe=y?.length;useEffect(()=>{__DEV__&&void 0!==oe&&oe!==i.length&&Logger.warn(`[@webority/mobile-ui] Tabs pages has ${oe} entries for ${i.length} tabs; each tab needs one page.`)},[oe,i.length]);const de=useCallback(e=>t=>{const{x:i,width:a}=t.nativeEvent.layout;U(t=>{const r=t[e];return r&&r.x===i&&r.width===a?t:{...t,[e]:{x:i,width:a}}})},[]),ce=useCallback(e=>{if(e.disabled)return;if(e.key===a)return;const t=resolveHaptic(x,"selection");t&&triggerHaptic(t),r(e.key)},[a,r,x]),ue="pills"===n,me=_jsx(Animated.View,{pointerEvents:"none",style:[F?j.indicatorThumb:ue?j.indicatorPill:j.indicatorUnderline,F?null:ue?{top:E,bottom:E}:{height:C},{width:se??X,transform:[{translateX:ne??K}],backgroundColor:F?w.colors.surface:ue?w.colors["primary-soft"]:w.colors.primary,borderRadius:F?P:ue?q:N,...smoothCorners},f]}),renderTabs=()=>i.map(e=>{const t=e.key===a,i=!0===e.disabled,r=t?w.colors.primary:w.colors["text-subtle"],n=renderSlotIcon(e.icon,{color:r,size:z,focused:t,disabled:i});return _jsxs(Pressable,{onPress:()=>ce(e),onLayout:de(e.key),disabled:i,accessibilityRole:"tab",accessibilityLabel:e.label,accessibilityState:{selected:t,disabled:i},"aria-selected":t,"aria-disabled":i,android_ripple:F?void 0:{color:w.colors["surface-pressed"],borderless:!1},style:({pressed:e})=>[j.tab,o?null:j.tabFlex,F?{paddingHorizontal:M["padding-x"],height:M.height-2*H}:{paddingHorizontal:_,paddingVertical:k},{opacity:i?A:e&&F&&!t?.7:1,backgroundColor:e&&!F?w.colors["surface-pressed"]:"transparent"},u],children:[n?_jsx(View,{style:[j.tabIcon,{marginRight:R},p],accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:n}):null,_jsx(Text,{variant:"label",weight:t?"semibold":"medium",color:t?"brand":"tertiary",style:[j.tabLabel,{fontSize:F?M.text:I},m],numberOfLines:1,children:e.label}),void 0!==e.badge&&null!==e.badge?_jsx(Badge,{value:String(e.badge),tone:"primary",fill:"soft",accessible:!1,style:{marginLeft:L},badgeStyle:[j.tabBadge,b]}):null]},e.key)}),pe={flexDirection:"row",alignItems:"stretch",justifyContent:o?"flex-start":"center"===d?"center":"flex-start",position:"relative",overflow:"hidden"},be=_jsxs(_Fragment,F?{children:[me,renderTabs()]}:{children:[renderTabs(),me]}),ge=_jsxs(View,{ref:t,style:[j.container,{borderBottomColor:w.colors["border-subtle"],borderBottomWidth:"underline"===n?StyleSheet.hairlineWidth:0},"underline"===n?g:null,F?{padding:H,borderRadius:B,...smoothCorners,backgroundColor:W.active?"transparent":O}:null,c],onLayout:W.onLayout,accessibilityRole:"tablist",accessibilityLabel:v,testID:S,children:[W.active&&W.size?_jsx(SquircleFill,{width:W.size.width,height:W.size.height,radius:B,fill:O}):null,o?_jsx(ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:[pe],keyboardShouldPersistTaps:"handled",children:be}):_jsx(View,{style:pe,children:be})]});return y?_jsxs(View,{style:j.root,children:[ge,_jsx(Animated.ScrollView,{ref:Y,horizontal:!0,pagingEnabled:!0,showsHorizontalScrollIndicator:!1,scrollEventThrottle:16,onLayout:e=>J(Math.round(e.nativeEvent.layout.width)),onScroll:Animated.event([{nativeEvent:{contentOffset:{x:Q}}}],{useNativeDriver:!1}),onMomentumScrollEnd:e=>{if(0===G)return;const t=Math.round(e.nativeEvent.contentOffset.x/G),n=i[t];n?.disabled?Y.current?.scrollTo({x:te*G,animated:!0}):(Z.current=t,n&&n.key!==a&&r(n.key))},style:j.pager,testID:S?`${S}-pages`:void 0,children:i.map((e,t)=>_jsx(View,{style:{width:G},accessibilityElementsHidden:t!==te,importantForAccessibility:t===te?"auto":"no-hide-descendants",children:y[t]},e.key))})]}):ge});Tabs.displayName="Tabs";const buildStyles=e=>StyleSheet.create({root:{flex:1},pager:{flex:1},container:{width:"100%",position:"relative"},tab:{flexDirection:"row",alignItems:"center",justifyContent:"center"},tabFlex:{flex:1},tabIcon:{},tabLabel:{includeFontPadding:!1,flexShrink:1},tabBadge:{minWidth:18,minHeight:0},indicatorUnderline:{position:"absolute",left:0,bottom:0},indicatorPill:{position:"absolute",left:0,zIndex:-1},indicatorThumb:{position:"absolute",left:0,top:0,bottom:0}});export{Tabs};export default Tabs;
|
|
@@ -43,4 +43,12 @@ export type SlotIcon<S extends SlotIconState = SlotIconState> = AppIconName | Sl
|
|
|
43
43
|
* sets no variant of its own; a ref's own `variant` always wins.
|
|
44
44
|
*/
|
|
45
45
|
export declare function renderSlotIcon<S extends SlotIconState>(icon: SlotIcon<S> | undefined, state: S, defaultVariant?: IconVariant): React.ReactNode;
|
|
46
|
+
/** True when the slot holds a library icon (a name or a `{ name }` ref), which is decoration beside the control's own label. */
|
|
47
|
+
export declare const isDecorativeSlotIcon: (icon: unknown) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Wrap a rendered slot for a labelled control: a library icon is hidden from screen readers, because the control's
|
|
50
|
+
* label already names it; a node or a render function is the consumer's own content (a picker, a clear button) and
|
|
51
|
+
* stays reachable.
|
|
52
|
+
*/
|
|
53
|
+
export declare function slotIconView<S extends SlotIconState>(icon: SlotIcon<S>, content: React.ReactNode): React.ReactNode;
|
|
46
54
|
//# sourceMappingURL=slotIcon.d.ts.map
|
|
@@ -28,9 +28,8 @@ export declare const dayLabel: (date: DateValue, options?: {
|
|
|
28
28
|
labels?: Partial<DateSeparatorLabels>;
|
|
29
29
|
}) => string;
|
|
30
30
|
/**
|
|
31
|
-
* A centred day name between two hairlines, for a message list.
|
|
32
|
-
*
|
|
33
|
-
* day. With `label` and `emphasis` it draws an unread divider instead.
|
|
31
|
+
* A centred day name between two hairlines, for a message list. With `label`
|
|
32
|
+
* and `emphasis` it draws an unread divider instead.
|
|
34
33
|
*/
|
|
35
34
|
export declare const DateSeparator: React.FC<DateSeparatorProps>;
|
|
36
35
|
export default DateSeparator;
|
|
@@ -43,4 +43,12 @@ export type SlotIcon<S extends SlotIconState = SlotIconState> = AppIconName | Sl
|
|
|
43
43
|
* sets no variant of its own; a ref's own `variant` always wins.
|
|
44
44
|
*/
|
|
45
45
|
export declare function renderSlotIcon<S extends SlotIconState>(icon: SlotIcon<S> | undefined, state: S, defaultVariant?: IconVariant): React.ReactNode;
|
|
46
|
+
/** True when the slot holds a library icon (a name or a `{ name }` ref), which is decoration beside the control's own label. */
|
|
47
|
+
export declare const isDecorativeSlotIcon: (icon: unknown) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Wrap a rendered slot for a labelled control: a library icon is hidden from screen readers, because the control's
|
|
50
|
+
* label already names it; a node or a render function is the consumer's own content (a picker, a clear button) and
|
|
51
|
+
* stays reachable.
|
|
52
|
+
*/
|
|
53
|
+
export declare function slotIconView<S extends SlotIconState>(icon: SlotIcon<S>, content: React.ReactNode): React.ReactNode;
|
|
46
54
|
//# sourceMappingURL=slotIcon.d.ts.map
|
|
@@ -28,9 +28,8 @@ export declare const dayLabel: (date: DateValue, options?: {
|
|
|
28
28
|
labels?: Partial<DateSeparatorLabels>;
|
|
29
29
|
}) => string;
|
|
30
30
|
/**
|
|
31
|
-
* A centred day name between two hairlines, for a message list.
|
|
32
|
-
*
|
|
33
|
-
* day. With `label` and `emphasis` it draws an unread divider instead.
|
|
31
|
+
* A centred day name between two hairlines, for a message list. With `label`
|
|
32
|
+
* and `emphasis` it draws an unread divider instead.
|
|
34
33
|
*/
|
|
35
34
|
export declare const DateSeparator: React.FC<DateSeparatorProps>;
|
|
36
35
|
export default DateSeparator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.134.0",
|
|
4
4
|
"description": "Beautiful, animated, accessible React Native components, theme and form engine for Webority projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -115,13 +115,13 @@
|
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@webority/markdown-core": "0.
|
|
118
|
+
"@webority/markdown-core": "0.134.0"
|
|
119
119
|
},
|
|
120
120
|
"peerDependencies": {
|
|
121
121
|
"@react-navigation/bottom-tabs": ">=7.0.0",
|
|
122
122
|
"@react-navigation/native": ">=7.0.0",
|
|
123
|
-
"@webority/canvas-kit": "0.
|
|
124
|
-
"@webority/mobile-core": "0.
|
|
123
|
+
"@webority/canvas-kit": "0.134.0",
|
|
124
|
+
"@webority/mobile-core": "0.134.0",
|
|
125
125
|
"expo": ">=57.0.0",
|
|
126
126
|
"expo-file-system": ">=57.0.0",
|
|
127
127
|
"expo-haptics": ">=57.0.0",
|
|
@@ -185,10 +185,10 @@
|
|
|
185
185
|
"@types/node": "25.6.0",
|
|
186
186
|
"@types/react": "19.2.18",
|
|
187
187
|
"@types/react-test-renderer": "19.1.0",
|
|
188
|
-
"@webority/canvas-kit": "0.
|
|
189
|
-
"@webority/mobile-core": "0.
|
|
188
|
+
"@webority/canvas-kit": "0.134.0",
|
|
189
|
+
"@webority/mobile-core": "0.134.0",
|
|
190
190
|
"@webority/mobile-dev": "0.0.0",
|
|
191
|
-
"@webority/tokens": "0.
|
|
191
|
+
"@webority/tokens": "0.134.0",
|
|
192
192
|
"expo": "57.0.31",
|
|
193
193
|
"expo-file-system": "57.0.7",
|
|
194
194
|
"expo-haptics": "57.0.3",
|