@webority/mobile-ui 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/BarChart/BarChart.js +1 -0
- package/lib/commonjs/components/BarChart/index.js +1 -0
- package/lib/commonjs/components/BarChart/scale.js +1 -0
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/commonjs/components/BottomNavigation/useScreenReaderEnabled.js +1 -0
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/commonjs/components/BottomSheet/index.js +1 -1
- package/lib/commonjs/components/BottomSheet/useSheetSwap.js +1 -0
- package/lib/commonjs/components/Card/Card.js +1 -1
- package/lib/commonjs/components/Composer/Composer.js +1 -0
- package/lib/commonjs/components/Composer/index.js +1 -0
- package/lib/commonjs/components/DateSeparator/DateSeparator.js +1 -0
- package/lib/commonjs/components/DateSeparator/index.js +1 -0
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +1 -1
- package/lib/commonjs/components/Input/Input.js +1 -1
- package/lib/commonjs/components/ListItem/ListItem.js +1 -1
- package/lib/commonjs/components/Menu/Menu.js +1 -0
- package/lib/commonjs/components/Menu/MenuSurface.js +1 -0
- package/lib/commonjs/components/Menu/focusHost.js +1 -0
- package/lib/commonjs/components/Menu/index.js +1 -0
- package/lib/commonjs/components/Menu/menuModel.js +1 -0
- package/lib/commonjs/components/Menu/useContextMenu.js +1 -0
- package/lib/commonjs/components/Menu/webOnly.js +1 -0
- package/lib/commonjs/components/MessageBubble/MessageBubble.js +1 -0
- package/lib/commonjs/components/MessageBubble/index.js +1 -0
- package/lib/commonjs/components/MessageList/MessageList.js +1 -0
- package/lib/commonjs/components/MessageList/index.js +1 -0
- package/lib/commonjs/components/OnboardingPager/OnboardingPager.js +1 -0
- package/lib/commonjs/components/OnboardingPager/index.js +1 -0
- package/lib/commonjs/components/PaymentResult/PaymentResult.js +1 -0
- package/lib/commonjs/components/PaymentResult/index.js +1 -0
- package/lib/commonjs/components/ScannerOverlay/ScannerOverlay.js +1 -0
- package/lib/commonjs/components/ScannerOverlay/index.js +1 -0
- package/lib/commonjs/components/SearchBar/SearchBar.js +1 -1
- package/lib/commonjs/components/SearchBar/SearchPanel.js +1 -0
- package/lib/commonjs/components/SearchBar/highlight.js +1 -0
- package/lib/commonjs/components/SearchBar/index.js +1 -1
- package/lib/commonjs/components/SearchBar/useRecentSearches.js +1 -0
- package/lib/commonjs/components/Select/Select.js +1 -1
- package/lib/commonjs/components/SignaturePad/SignaturePad.js +1 -0
- package/lib/commonjs/components/SignaturePad/index.js +1 -0
- package/lib/commonjs/components/SignaturePad/signatureGeometry.js +1 -0
- package/lib/commonjs/components/SignaturePad/writePng.js +1 -0
- package/lib/commonjs/components/SignaturePad/writePng.web.js +1 -0
- package/lib/commonjs/components/Sparkline/Sparkline.js +1 -0
- package/lib/commonjs/components/Sparkline/geometry.js +1 -0
- package/lib/commonjs/components/Sparkline/index.js +1 -0
- package/lib/commonjs/components/Spinner/Spinner.js +1 -1
- package/lib/commonjs/components/StatTile/StatTile.js +1 -1
- package/lib/commonjs/components/TimePicker/TimePicker.js +1 -1
- package/lib/commonjs/components/Toast/Toast.js +1 -1
- package/lib/commonjs/components/Toast/ToastProvider.js +1 -1
- package/lib/commonjs/components/Tooltip/RichTooltipBody.js +1 -0
- package/lib/commonjs/components/Tooltip/Tooltip.js +1 -1
- package/lib/commonjs/components/Tooltip/tooltipPosition.js +1 -0
- package/lib/commonjs/components/TypingIndicator/TypingIndicator.js +1 -0
- package/lib/commonjs/components/TypingIndicator/index.js +1 -0
- package/lib/commonjs/components/WheelPicker/Wheel.js +1 -0
- package/lib/commonjs/components/WheelPicker/WheelPicker.js +1 -0
- package/lib/commonjs/components/WheelPicker/index.js +1 -0
- package/lib/commonjs/components/index.js +1 -1
- package/lib/commonjs/hooks/index.js +1 -1
- package/lib/commonjs/hooks/useRefreshControl.js +1 -0
- package/lib/commonjs/hooks/useScrollDirection.js +1 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/utils/announce.js +1 -0
- package/lib/commonjs/utils/hapticUtils.js +1 -1
- package/lib/commonjs/utils/index.js +1 -1
- package/lib/commonjs/utils/placement.js +1 -0
- package/lib/module/components/BarChart/BarChart.js +1 -0
- package/lib/module/components/BarChart/index.js +1 -0
- package/lib/module/components/BarChart/scale.js +1 -0
- package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
- package/lib/module/components/BottomNavigation/useScreenReaderEnabled.js +1 -0
- package/lib/module/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/module/components/BottomSheet/index.js +1 -1
- package/lib/module/components/BottomSheet/useSheetSwap.js +1 -0
- package/lib/module/components/Card/Card.js +1 -1
- package/lib/module/components/Composer/Composer.js +1 -0
- package/lib/module/components/Composer/index.js +1 -0
- package/lib/module/components/DateSeparator/DateSeparator.js +1 -0
- package/lib/module/components/DateSeparator/index.js +1 -0
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +1 -1
- package/lib/module/components/Input/Input.js +1 -1
- package/lib/module/components/ListItem/ListItem.js +1 -1
- package/lib/module/components/Menu/Menu.js +1 -0
- package/lib/module/components/Menu/MenuSurface.js +1 -0
- package/lib/module/components/Menu/focusHost.js +1 -0
- package/lib/module/components/Menu/index.js +1 -0
- package/lib/module/components/Menu/menuModel.js +1 -0
- package/lib/module/components/Menu/useContextMenu.js +1 -0
- package/lib/module/components/Menu/webOnly.js +1 -0
- package/lib/module/components/MessageBubble/MessageBubble.js +1 -0
- package/lib/module/components/MessageBubble/index.js +1 -0
- package/lib/module/components/MessageList/MessageList.js +1 -0
- package/lib/module/components/MessageList/index.js +1 -0
- package/lib/module/components/OnboardingPager/OnboardingPager.js +1 -0
- package/lib/module/components/OnboardingPager/index.js +1 -0
- package/lib/module/components/PaymentResult/PaymentResult.js +1 -0
- package/lib/module/components/PaymentResult/index.js +1 -0
- package/lib/module/components/ScannerOverlay/ScannerOverlay.js +1 -0
- package/lib/module/components/ScannerOverlay/index.js +1 -0
- package/lib/module/components/SearchBar/SearchBar.js +1 -1
- package/lib/module/components/SearchBar/SearchPanel.js +1 -0
- package/lib/module/components/SearchBar/highlight.js +1 -0
- package/lib/module/components/SearchBar/index.js +1 -1
- package/lib/module/components/SearchBar/useRecentSearches.js +1 -0
- package/lib/module/components/Select/Select.js +1 -1
- package/lib/module/components/SignaturePad/SignaturePad.js +1 -0
- package/lib/module/components/SignaturePad/index.js +1 -0
- package/lib/module/components/SignaturePad/signatureGeometry.js +1 -0
- package/lib/module/components/SignaturePad/writePng.js +1 -0
- package/lib/module/components/SignaturePad/writePng.web.js +1 -0
- package/lib/module/components/Sparkline/Sparkline.js +1 -0
- package/lib/module/components/Sparkline/geometry.js +1 -0
- package/lib/module/components/Sparkline/index.js +1 -0
- package/lib/module/components/Spinner/Spinner.js +1 -1
- package/lib/module/components/StatTile/StatTile.js +1 -1
- package/lib/module/components/TimePicker/TimePicker.js +1 -1
- package/lib/module/components/Toast/Toast.js +1 -1
- package/lib/module/components/Toast/ToastProvider.js +1 -1
- package/lib/module/components/Tooltip/RichTooltipBody.js +1 -0
- package/lib/module/components/Tooltip/Tooltip.js +1 -1
- package/lib/module/components/Tooltip/tooltipPosition.js +1 -0
- package/lib/module/components/TypingIndicator/TypingIndicator.js +1 -0
- package/lib/module/components/TypingIndicator/index.js +1 -0
- package/lib/module/components/WheelPicker/Wheel.js +1 -0
- package/lib/module/components/WheelPicker/WheelPicker.js +1 -0
- package/lib/module/components/WheelPicker/index.js +1 -0
- package/lib/module/components/index.js +1 -1
- package/lib/module/hooks/index.js +1 -1
- package/lib/module/hooks/useRefreshControl.js +1 -0
- package/lib/module/hooks/useScrollDirection.js +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/utils/announce.js +1 -0
- package/lib/module/utils/hapticUtils.js +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/placement.js +1 -0
- package/lib/typescript/commonjs/components/BarChart/BarChart.d.ts +62 -0
- package/lib/typescript/commonjs/components/BarChart/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/BarChart/scale.d.ts +15 -0
- package/lib/typescript/commonjs/components/BottomNavigation/BottomNavigation.d.ts +32 -0
- package/lib/typescript/commonjs/components/BottomNavigation/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/BottomNavigation/useScreenReaderEnabled.d.ts +8 -0
- package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +34 -3
- package/lib/typescript/commonjs/components/BottomSheet/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/BottomSheet/useSheetSwap.d.ts +24 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +9 -0
- package/lib/typescript/commonjs/components/Composer/Composer.d.ts +61 -0
- package/lib/typescript/commonjs/components/Composer/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/DateSeparator/DateSeparator.d.ts +37 -0
- package/lib/typescript/commonjs/components/DateSeparator/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +3 -1
- package/lib/typescript/commonjs/components/Input/Input.d.ts +2 -2
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +9 -0
- package/lib/typescript/commonjs/components/Menu/Menu.d.ts +46 -0
- package/lib/typescript/commonjs/components/Menu/MenuSurface.d.ts +30 -0
- package/lib/typescript/commonjs/components/Menu/focusHost.d.ts +9 -0
- package/lib/typescript/commonjs/components/Menu/index.d.ts +5 -0
- package/lib/typescript/commonjs/components/Menu/menuModel.d.ts +68 -0
- package/lib/typescript/commonjs/components/Menu/useContextMenu.d.ts +58 -0
- package/lib/typescript/commonjs/components/Menu/webOnly.d.ts +7 -0
- package/lib/typescript/commonjs/components/MessageBubble/MessageBubble.d.ts +87 -0
- package/lib/typescript/commonjs/components/MessageBubble/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/MessageList/MessageList.d.ts +68 -0
- package/lib/typescript/commonjs/components/MessageList/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/OnboardingPager/OnboardingPager.d.ts +53 -0
- package/lib/typescript/commonjs/components/OnboardingPager/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/PaymentResult/PaymentResult.d.ts +71 -0
- package/lib/typescript/commonjs/components/PaymentResult/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ScannerOverlay/ScannerOverlay.d.ts +74 -0
- package/lib/typescript/commonjs/components/ScannerOverlay/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/SearchBar/SearchBar.d.ts +35 -0
- package/lib/typescript/commonjs/components/SearchBar/SearchPanel.d.ts +49 -0
- package/lib/typescript/commonjs/components/SearchBar/highlight.d.ts +14 -0
- package/lib/typescript/commonjs/components/SearchBar/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/SearchBar/useRecentSearches.d.ts +24 -0
- package/lib/typescript/commonjs/components/Select/Select.d.ts +2 -1
- package/lib/typescript/commonjs/components/SignaturePad/SignaturePad.d.ts +94 -0
- package/lib/typescript/commonjs/components/SignaturePad/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/SignaturePad/signatureGeometry.d.ts +36 -0
- package/lib/typescript/commonjs/components/SignaturePad/writePng.d.ts +7 -0
- package/lib/typescript/commonjs/components/SignaturePad/writePng.web.d.ts +3 -0
- package/lib/typescript/commonjs/components/Sparkline/Sparkline.d.ts +41 -0
- package/lib/typescript/commonjs/components/Sparkline/geometry.d.ts +20 -0
- package/lib/typescript/commonjs/components/Sparkline/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Spinner/Spinner.d.ts +7 -1
- package/lib/typescript/commonjs/components/StatTile/StatTile.d.ts +24 -1
- package/lib/typescript/commonjs/components/StatTile/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +21 -0
- package/lib/typescript/commonjs/components/Toast/ToastProvider.d.ts +21 -0
- package/lib/typescript/commonjs/components/Toast/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/Tooltip/RichTooltipBody.d.ts +27 -0
- package/lib/typescript/commonjs/components/Tooltip/Tooltip.d.ts +24 -0
- package/lib/typescript/commonjs/components/Tooltip/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/Tooltip/tooltipPosition.d.ts +35 -0
- package/lib/typescript/commonjs/components/TypingIndicator/TypingIndicator.d.ts +21 -0
- package/lib/typescript/commonjs/components/TypingIndicator/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/WheelPicker/Wheel.d.ts +34 -0
- package/lib/typescript/commonjs/components/WheelPicker/WheelPicker.d.ts +73 -0
- package/lib/typescript/commonjs/components/WheelPicker/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/index.d.ts +34 -8
- package/lib/typescript/commonjs/hooks/index.d.ts +4 -0
- package/lib/typescript/commonjs/hooks/useRefreshControl.d.ts +75 -0
- package/lib/typescript/commonjs/hooks/useScrollDirection.d.ts +21 -0
- package/lib/typescript/commonjs/index.d.ts +4 -4
- package/lib/typescript/commonjs/utils/announce.d.ts +14 -0
- package/lib/typescript/commonjs/utils/hapticUtils.d.ts +1 -1
- package/lib/typescript/commonjs/utils/index.d.ts +2 -0
- package/lib/typescript/commonjs/utils/placement.d.ts +55 -0
- package/lib/typescript/module/components/BarChart/BarChart.d.ts +62 -0
- package/lib/typescript/module/components/BarChart/index.d.ts +3 -0
- package/lib/typescript/module/components/BarChart/scale.d.ts +15 -0
- package/lib/typescript/module/components/BottomNavigation/BottomNavigation.d.ts +32 -0
- package/lib/typescript/module/components/BottomNavigation/index.d.ts +1 -1
- package/lib/typescript/module/components/BottomNavigation/useScreenReaderEnabled.d.ts +8 -0
- package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +34 -3
- package/lib/typescript/module/components/BottomSheet/index.d.ts +2 -0
- package/lib/typescript/module/components/BottomSheet/useSheetSwap.d.ts +24 -0
- package/lib/typescript/module/components/Card/Card.d.ts +9 -0
- package/lib/typescript/module/components/Composer/Composer.d.ts +61 -0
- package/lib/typescript/module/components/Composer/index.d.ts +3 -0
- package/lib/typescript/module/components/DateSeparator/DateSeparator.d.ts +37 -0
- package/lib/typescript/module/components/DateSeparator/index.d.ts +3 -0
- package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +3 -1
- package/lib/typescript/module/components/Input/Input.d.ts +2 -2
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +9 -0
- package/lib/typescript/module/components/Menu/Menu.d.ts +46 -0
- package/lib/typescript/module/components/Menu/MenuSurface.d.ts +30 -0
- package/lib/typescript/module/components/Menu/focusHost.d.ts +9 -0
- package/lib/typescript/module/components/Menu/index.d.ts +5 -0
- package/lib/typescript/module/components/Menu/menuModel.d.ts +68 -0
- package/lib/typescript/module/components/Menu/useContextMenu.d.ts +58 -0
- package/lib/typescript/module/components/Menu/webOnly.d.ts +7 -0
- package/lib/typescript/module/components/MessageBubble/MessageBubble.d.ts +87 -0
- package/lib/typescript/module/components/MessageBubble/index.d.ts +3 -0
- package/lib/typescript/module/components/MessageList/MessageList.d.ts +68 -0
- package/lib/typescript/module/components/MessageList/index.d.ts +3 -0
- package/lib/typescript/module/components/OnboardingPager/OnboardingPager.d.ts +53 -0
- package/lib/typescript/module/components/OnboardingPager/index.d.ts +3 -0
- package/lib/typescript/module/components/PaymentResult/PaymentResult.d.ts +71 -0
- package/lib/typescript/module/components/PaymentResult/index.d.ts +3 -0
- package/lib/typescript/module/components/ScannerOverlay/ScannerOverlay.d.ts +74 -0
- package/lib/typescript/module/components/ScannerOverlay/index.d.ts +3 -0
- package/lib/typescript/module/components/SearchBar/SearchBar.d.ts +35 -0
- package/lib/typescript/module/components/SearchBar/SearchPanel.d.ts +49 -0
- package/lib/typescript/module/components/SearchBar/highlight.d.ts +14 -0
- package/lib/typescript/module/components/SearchBar/index.d.ts +3 -0
- package/lib/typescript/module/components/SearchBar/useRecentSearches.d.ts +24 -0
- package/lib/typescript/module/components/Select/Select.d.ts +2 -1
- package/lib/typescript/module/components/SignaturePad/SignaturePad.d.ts +94 -0
- package/lib/typescript/module/components/SignaturePad/index.d.ts +4 -0
- package/lib/typescript/module/components/SignaturePad/signatureGeometry.d.ts +36 -0
- package/lib/typescript/module/components/SignaturePad/writePng.d.ts +7 -0
- package/lib/typescript/module/components/SignaturePad/writePng.web.d.ts +3 -0
- package/lib/typescript/module/components/Sparkline/Sparkline.d.ts +41 -0
- package/lib/typescript/module/components/Sparkline/geometry.d.ts +20 -0
- package/lib/typescript/module/components/Sparkline/index.d.ts +3 -0
- package/lib/typescript/module/components/Spinner/Spinner.d.ts +7 -1
- package/lib/typescript/module/components/StatTile/StatTile.d.ts +24 -1
- package/lib/typescript/module/components/StatTile/index.d.ts +1 -1
- package/lib/typescript/module/components/Toast/Toast.d.ts +21 -0
- package/lib/typescript/module/components/Toast/ToastProvider.d.ts +21 -0
- package/lib/typescript/module/components/Toast/index.d.ts +1 -1
- package/lib/typescript/module/components/Tooltip/RichTooltipBody.d.ts +27 -0
- package/lib/typescript/module/components/Tooltip/Tooltip.d.ts +24 -0
- package/lib/typescript/module/components/Tooltip/index.d.ts +1 -1
- package/lib/typescript/module/components/Tooltip/tooltipPosition.d.ts +35 -0
- package/lib/typescript/module/components/TypingIndicator/TypingIndicator.d.ts +21 -0
- package/lib/typescript/module/components/TypingIndicator/index.d.ts +3 -0
- package/lib/typescript/module/components/WheelPicker/Wheel.d.ts +34 -0
- package/lib/typescript/module/components/WheelPicker/WheelPicker.d.ts +73 -0
- package/lib/typescript/module/components/WheelPicker/index.d.ts +3 -0
- package/lib/typescript/module/components/index.d.ts +34 -8
- package/lib/typescript/module/hooks/index.d.ts +4 -0
- package/lib/typescript/module/hooks/useRefreshControl.d.ts +75 -0
- package/lib/typescript/module/hooks/useScrollDirection.d.ts +21 -0
- package/lib/typescript/module/index.d.ts +4 -4
- package/lib/typescript/module/utils/announce.d.ts +14 -0
- package/lib/typescript/module/utils/hapticUtils.d.ts +1 -1
- package/lib/typescript/module/utils/index.d.ts +2 -0
- package/lib/typescript/module/utils/placement.d.ts +55 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useEffect,useMemo,useRef}from"react";import{Animated,Easing,PanResponder,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,setNativeValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_SWIPE_DISMISS_THRESHOLD=80,DEFAULT_SWIPE_VELOCITY_THRESHOLD=.5,DEFAULT_STACK_OFFSET=8,DEFAULT_STACK_SCALE_STEP=.04,DEFAULT_AUTO_DISMISS_MS=3e3,Toast=({toast:e,index:t,onDismiss:
|
|
1
|
+
"use strict";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,PanResponder,Platform,Pressable,StyleSheet,Text,View}from"react-native";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{createAnimatedValue,fontFor,setNativeValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_SWIPE_DISMISS_THRESHOLD=80,DEFAULT_SWIPE_VELOCITY_THRESHOLD=.5,DEFAULT_STACK_OFFSET=8,DEFAULT_STACK_SCALE_STEP=.04,DEFAULT_AUTO_DISMISS_MS=3e3,WEB_ACTION_MIN_DURATION_MS=8e3,COUNTDOWN_BAR_HEIGHT=3,ACTION_HIT_SLOP={top:8,bottom:8,left:8,right:8},DISMISS_ACTIONS=[{name:"dismiss",label:"Dismiss"}],Toast=({toast:e,index:t,onDismiss:n,shownAt:i,runtime:s})=>{const a=useTheme(),o=e.variant??"default",r=e.position??"bottom",l=useMemo(()=>buildStyles(a),[a]),c=useMemo(()=>tintFor(a,o),[a,o]),u=useMemo(()=>inkFor(a,o),[a,o]),d=a.components.toast,m=d?.iconCircleSize??28,p=d?.iconCircleBorderRadius??14,g=d?.iconGlyphFontSize??16,f=d?.tintBarWidth??0,h=d?.swipeDismissThreshold??80,b=d?.swipeVelocityThreshold??.5,S=d?.stackOffset??8,y=d?.stackScaleStep??.04,A=d?.stackMinScale??.9,x=d?.defaultDurationMs??3e3,w=d?.enableSwipeDismiss??!0,v=d?.enterSpringDamping??18,T=d?.enterSpringStiffness??180,M=d?.enterSpringMass??1,_="top"===r?-120:120,D=useRef(createAnimatedValue(_)).current,R=useRef(createAnimatedValue(0)).current,C=useRef(createAnimatedValue(0)).current,V=useRef(!1),E="top"===r?t*S:-t*S,I=Math.max(1-t*y,A),N=useRef(createAnimatedValue(E)).current;useEffect(()=>{setNativeValue(N,E)},[E,N]);const k=useMemo(()=>Animated.add(D,N),[D,N]),j=useReducedMotion(),O=void 0!==e.action,P=e.duration??x,L=P>0&&O&&"web"===Platform.OS?Math.max(P,8e3):P,F=L<=0||O&&!0===s?.screenReaderOn,B=!0===e.countdown&&!F,H=useRef(createAnimatedValue(1)).current,z=useRef({initialised:!1,timer:null,remaining:0,startedAt:0}),U=useRef({touch:!1,pan:!1,hover:!1}),G=useRef(()=>{}),W=useRef({id:e.id,totalMs:L,shownAt:i,runtime:s,persistent:F,animateBar:!1});W.current={id:e.id,totalMs:L,shownAt:i,runtime:s,persistent:F,animateBar:B&&!j};const $=useCallback(()=>{const e=z.current,t=W.current,n=U.current;if(!e.initialised){e.initialised=!0;const n=t.runtime?.readRemaining(t.id),i=void 0===t.shownAt?0:Date.now()-t.shownAt;e.remaining=n??(t.totalMs>0?Math.max(t.totalMs-i,0):0),t.totalMs>0&&e.remaining<t.totalMs&&setNativeValue(H,e.remaining/t.totalMs)}const i=!(t.persistent||V.current||n.touch||n.pan||n.hover);i&&null===e.timer?(e.startedAt=Date.now(),e.timer=setTimeout(()=>{e.timer=null,e.remaining=0,G.current()},e.remaining),t.animateBar&&Animated.timing(H,{toValue:0,duration:e.remaining,easing:Easing.linear,useNativeDriver:!0}).start()):i||null===e.timer||(clearTimeout(e.timer),e.timer=null,e.remaining=Math.max(e.remaining-(Date.now()-e.startedAt),0),H.stopAnimation())},[H]),dismiss=()=>{V.current||(V.current=!0,$(),Animated.parallel([Animated.timing(C,{toValue:0,duration:a.motion.duration.fast,easing:Easing.bezier(...a.motion.easing.accelerate),useNativeDriver:!0}),Animated.timing(D,{toValue:_,duration:a.motion.duration.fast,easing:Easing.bezier(...a.motion.easing.accelerate),useNativeDriver:!0})]).start(()=>n(e.id)))};G.current=dismiss,useEffect(()=>{const e=Animated.parallel([Animated.spring(D,{toValue:0,damping:v,stiffness:T,mass:M,useNativeDriver:!0}),Animated.timing(C,{toValue:1,duration:a.motion.duration.fast,useNativeDriver:!0})]);return e.start(),()=>e.stop()},[]),useEffect(()=>{$()},[F,$]),useEffect(()=>()=>{const e=z.current,t=W.current;null!==e.timer&&(clearTimeout(e.timer),e.timer=null,e.remaining=Math.max(e.remaining-(Date.now()-e.startedAt),0)),H.stopAnimation(),e.initialised&&t.totalMs>0&&!V.current&&t.runtime?.writeRemaining(t.id,e.remaining)},[H]);const K=useCallback((e,t)=>{U.current[e]=t,$()},[$]),X=useCallback(()=>K("touch",!0),[K]),Y=useCallback(e=>K("touch",(e.nativeEvent.touches?.length??0)>0),[K]),q=useCallback(()=>K("hover",!0),[K]),J=useCallback(()=>K("hover",!1),[K]),Q=useMemo(()=>PanResponder.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>Math.abs(t.dy)&&Math.abs(t.dx)>6,onPanResponderGrant:()=>K("pan",!0),onPanResponderMove:(e,t)=>{setNativeValue(R,t.dx);const n=1-.7*Math.min(Math.abs(t.dx)/200,1);setNativeValue(C,n)},onPanResponderTerminate:()=>{K("pan",!1),Animated.parallel([Animated.spring(R,{toValue:0,damping:a.motion.spring.snappy.damping,stiffness:a.motion.spring.snappy.stiffness,mass:a.motion.spring.snappy.mass,useNativeDriver:!0}),Animated.timing(C,{toValue:1,duration:a.motion.duration.fast,useNativeDriver:!0})]).start()},onPanResponderRelease:(t,i)=>{if(Math.abs(i.dx)>h||Math.abs(i.vx)>b){const t=i.dx>=0?1:-1;V.current=!0,K("pan",!1),Animated.parallel([Animated.timing(R,{toValue:500*t,duration:a.motion.duration.fast,useNativeDriver:!0}),Animated.timing(C,{toValue:0,duration:a.motion.duration.fast,useNativeDriver:!0})]).start(()=>n(e.id))}else K("pan",!1),Animated.parallel([Animated.spring(R,{toValue:0,useNativeDriver:!0}),Animated.spring(C,{toValue:1,useNativeDriver:!0})]).start()}}),[R,C,K,h,b,a.motion.duration.fast,a.motion.spring.snappy.damping,a.motion.spring.snappy.stiffness,a.motion.spring.snappy.mass,n,e.id]),Z={accessibilityActions:DISMISS_ACTIONS,onAccessibilityAction:e=>{"dismiss"===e.nativeEvent.actionName&&dismiss()}},[ee,te]=useState(0),ne=useMemo(()=>H.interpolate({inputRange:[0,1],outputRange:[-ee,0]}),[H,ee]),ie=e.description?`${e.message}. ${e.description}`:e.message,se=e.action&&B?`${e.action.label}, ${Math.ceil(L/1e3)} seconds`:e.action?.label;return _jsxs(Animated.View,{...w?Q.panHandlers:{},...O?{}:{accessible:!0,...Z},..."web"===Platform.OS?{onPointerEnter:q,onPointerLeave:J}:{},onTouchStart:X,onTouchEnd:Y,onTouchCancel:Y,accessibilityLabel:ie,testID:e.testID,style:[l.container,{backgroundColor:a.colors.background.elevated,borderRadius:a.radius.lg,...smoothCorners,padding:a.spacing.md,...a.shadows.md,shadowColor:a.shadows.md.shadowColor,opacity:C,transform:[{translateY:k},{translateX:R},{scale:I}]},e.style,e.containerStyle],children:[f>0?_jsx(View,{style:[l.tintBar,{width:f,backgroundColor:c}]}):null,_jsxs(View,{style:l.row,children:[(()=>{if(e.icon)return e.icon;const t=defaultGlyph(o);return t?_jsx(View,{style:[l.iconCircle,{width:m,height:m,borderRadius:p,...smoothCorners,backgroundColor:c+"22"},e.iconCircleStyle],children:_jsx(Text,{style:[l.iconGlyph,{color:u,fontSize:g}],accessible:!1,children:t})}):null})(),_jsxs(View,{style:l.textBlock,children:[_jsx(Text,{style:[l.message,{color:a.colors.text.primary,fontSize:a.typography.fontSize.base,...fontFor(a,"semibold")},e.textStyle,e.messageStyle],numberOfLines:2,children:e.message}),e.description?_jsx(Text,{style:[l.description,{color:a.colors.text.secondary,fontSize:a.typography.fontSize.sm}],numberOfLines:3,children:e.description}):null]}),e.action?_jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:se,hitSlop:ACTION_HIT_SLOP,...Z,onPress:()=>{e.action?.onPress(),dismiss()},style:({pressed:t})=>[l.actionBtn,{backgroundColor:t?a.colors.surface.pressed:"transparent"},e.actionButtonStyle],children:_jsx(Text,{style:{color:c,fontSize:a.typography.fontSize.sm,...fontFor(a,"semibold")},numberOfLines:1,children:e.action.label})}):null]}),B?_jsxs(View,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onLayout:e=>te(e.nativeEvent.layout.width),testID:"toast-countdown",style:[l.countdownTrack,{backgroundColor:c+"22"}],children:[j?_jsx(View,{style:[l.countdownFill,{backgroundColor:c}]}):null,!j&&ee>0?_jsx(Animated.View,{style:[l.countdownFill,{backgroundColor:c,transform:[{translateX:ne}]}]}):null]}):null]})},tintFor=(e,t)=>{switch(t){case"success":return e.colors.success;case"error":return e.colors.error;case"warning":return e.colors.warning;case"info":return e.colors.info;default:return e.colors.text.primary}},inkFor=(e,t)=>{switch(t){case"success":return e.colors.toneText.success;case"error":return e.colors.toneText.error;case"warning":return e.colors.toneText.warning;case"info":return e.colors.toneText.info;default:return e.colors.text.primary}},defaultGlyph=e=>{switch(e){case"success":return"✓";case"error":return"×";case"warning":return"!";case"info":return"i";default:return""}},buildStyles=e=>StyleSheet.create({container:{overflow:"hidden",marginVertical:4},tintBar:{position:"absolute",left:0,top:0,bottom:0},row:{flexDirection:"row",alignItems:"center",paddingLeft:8},iconCircle:{alignItems:"center",justifyContent:"center",marginRight:12},iconGlyph:{fontWeight:"700",lineHeight:18},textBlock:{flex:1,paddingRight:8},message:{lineHeight:20},description:{marginTop:2,lineHeight:18},countdownTrack:{position:"absolute",left:0,right:0,bottom:0,height:3,overflow:"hidden"},countdownFill:{position:"absolute",left:0,right:0,top:0,bottom:0},actionBtn:{paddingHorizontal:10,paddingVertical:6,borderRadius:8,...smoothCorners,marginLeft:8}});export{Toast};export default Toast;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{createContext,useCallback,useContext,useEffect,useMemo,useRef,useState}from"react";import{StyleSheet,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useTheme}from"../../theme/index.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import Toast from"./Toast.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const MAX_VISIBLE=3,ToastContext=createContext(null),ToastHostContext=createContext(null);let nextId=0;const makeId=()=>(nextId+=1,`toast-${Date.now().toString(36)}-${nextId.toString(36)}`),defaultHaptic=
|
|
1
|
+
"use strict";import{createContext,useCallback,useContext,useEffect,useMemo,useRef,useState}from"react";import{AccessibilityInfo,Platform,StyleSheet,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useTheme}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import Toast from"./Toast.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const MAX_VISIBLE=3,UNDO_DEFAULT_DURATION_MS=6e3,UNDO_MIN_DURATION_MS=6e3,ToastContext=createContext(null),ToastHostContext=createContext(null);let nextId=0;const makeId=()=>(nextId+=1,`toast-${Date.now().toString(36)}-${nextId.toString(36)}`),defaultHaptic=e=>{switch(e){case"error":return"notificationError";case"success":return"notificationSuccess";case"warning":return"notificationWarning";default:return"selection"}},resolveHaptics=(e,t)=>{if(!1===e)return!1;const o=e?.[t??"default"];return void 0===o?defaultHaptic(t):o};let nextHostId=0;const makeHostId=()=>(nextHostId+=1,nextHostId),useScreenReaderEnabled=()=>{const[e,t]=useState(!1);return useEffect(()=>{if("web"===Platform.OS)return;let e=!0;AccessibilityInfo.isScreenReaderEnabled().then(o=>{e&&t(o)});const o=AccessibilityInfo.addEventListener("screenReaderChanged",t);return()=>{e=!1,o.remove()}},[]),e};let providerCount=0,activeApi=null;const setActiveApi=e=>{activeApi=e},getActiveApi=()=>activeApi;export const ToastProvider=({children:e,maxVisible:t=3,topOffset:o,bottomOffset:s,defaultDuration:r,haptics:n})=>{const a=useRef({defaultDuration:r,haptics:n});a.current={defaultDuration:r,haptics:n};const[i,u]=useState([]),[c,d]=useState([]),l=useScreenReaderEnabled(),f=useRef(new Map),p=useRef(new Map);useEffect(()=>{const e=new Set(i.map(e=>e.id));for(const[t,o]of[...f.current])e.has(t)||(f.current.delete(t),o());for(const t of[...p.current.keys()])e.has(t)||p.current.delete(t)},[i]),useEffect(()=>{const e=f.current;return()=>{for(const[t,o]of[...e])e.delete(t),o()}},[]);const m=useMemo(()=>({screenReaderOn:l,readRemaining:e=>p.current.get(e),writeRemaining:(e,t)=>{p.current.set(e,t)}}),[l]),h=useCallback(e=>{u(t=>t.filter(t=>t.id!==e))},[]),x=useCallback(()=>{u([])},[]),v=useCallback(e=>{const o=makeId(),{defaultDuration:s,haptics:r}=a.current,n={...e,duration:e.duration??s,id:o,shownAt:Date.now()},i=void 0!==e.haptic?e.haptic:resolveHaptics(r,e.variant);return!1!==i&&triggerHaptic(i),announce(e.description?`${e.message}. ${e.description}`:e.message,{polite:"error"!==e.variant}),u(o=>{const s=[...void 0===e.key?o:o.filter(t=>t.key!==e.key),n];return s.length>t?s.slice(s.length-t):s}),o},[t]),g=useCallback((e,t)=>{const{onUndo:o,onCommit:s,undoLabel:r,duration:n,...a}=t,i={id:""},u=v({...a,message:e,duration:0===n?0:Math.max(n??6e3,6e3),countdown:!0,action:{label:r??"Undo",onPress:()=>{f.current.delete(i.id),o()}}});return i.id=u,s&&f.current.set(u,s),u},[v]),w=useMemo(()=>({show:v,undo:g,hide:h,hideAll:x}),[v,g,h,x]);useEffect(()=>(providerCount+=1,setActiveApi(w),()=>{providerCount-=1,providerCount<=0&&(providerCount=0,setActiveApi(null))}),[w]);const b=useCallback(e=>{d(t=>[...t,e])},[]),_=useCallback(e=>{d(t=>t.filter(t=>t!==e))},[]),y=c.length>0?c[c.length-1]:null,A=useMemo(()=>({register:b,unregister:_,activeHostId:y,queue:i,hide:h,topOffset:o,bottomOffset:s,runtime:m}),[b,_,y,i,h,o,s,m]);return _jsx(ToastContext.Provider,{value:w,children:_jsxs(ToastHostContext.Provider,{value:A,children:[e,null===y?_jsx(ToastLayers,{queue:i,onDismiss:h,topOffset:o,bottomOffset:s,runtime:m}):null]})})};let warnedHost=!1;const warnHostWithoutProvider=()=>{warnedHost||(warnedHost=!0,"undefined"!=typeof __DEV__&&__DEV__&&console.warn("[toast] <ToastHost /> rendered outside a <ToastProvider />; it renders nothing. Mount a provider near your app root."))};export const ToastHost=()=>{const e=useContext(ToastHostContext),[t]=useState(makeHostId),o=e?.register,s=e?.unregister;return useEffect(()=>{if(o&&s)return o(t),()=>s(t);warnHostWithoutProvider()},[o,s,t]),e&&e.activeHostId===t?_jsx(ToastLayers,{queue:e.queue,onDismiss:e.hide,topOffset:e.topOffset,bottomOffset:e.bottomOffset,runtime:e.runtime}):null};const ToastLayers=({queue:e,onDismiss:t,topOffset:o,bottomOffset:s,runtime:r})=>{const n=useTheme(),a=useSafeAreaInsets(),i=useMemo(()=>buildStyles(),[]),u=e.filter(e=>"top"===(e.position??"bottom")),c=e.filter(e=>"bottom"===(e.position??"bottom"));return _jsxs(_Fragment,{children:[_jsx(View,{testID:"toast-layer-top",pointerEvents:"box-none",style:[i.layer,i.top,{top:(o??a.top)+n.spacing.sm,paddingHorizontal:n.spacing.md}],children:u.map((e,o)=>_jsx(Toast,{toast:e,index:u.length-1-o,shownAt:e.shownAt,runtime:r,onDismiss:t},e.id))}),_jsx(View,{testID:"toast-layer-bottom",pointerEvents:"box-none",style:[i.layer,i.bottom,{bottom:(s??a.bottom)+n.spacing.sm,paddingHorizontal:n.spacing.md}],children:c.map((e,o)=>_jsx(Toast,{toast:e,index:c.length-1-o,shownAt:e.shownAt,runtime:r,onDismiss:t},e.id))})]})};export const useToast=()=>{const e=useContext(ToastContext);if(!e)throw new Error("useToast must be used within a <ToastProvider>.");return e};let warned=!1;const warnNoProvider=()=>{warned||(warned=!0,"undefined"!=typeof __DEV__&&__DEV__&&console.warn("[toast] No <ToastProvider /> mounted; toast() calls are no-ops. Mount a provider near your app root."))},proxy=e=>{const t=getActiveApi();return t?e(t):(warnNoProvider(),"")};export const toast={show:e=>proxy(t=>t.show(e)),undo:(e,t)=>proxy(o=>o.undo(e,t)),success:(e,t)=>proxy(o=>o.show({...t,message:e,variant:"success"})),error:(e,t)=>proxy(o=>o.show({...t,message:e,variant:"error"})),warning:(e,t)=>proxy(o=>o.show({...t,message:e,variant:"warning"})),info:(e,t)=>proxy(o=>o.show({...t,message:e,variant:"info"})),hideAll:()=>{const e=getActiveApi();e?e.hideAll():warnNoProvider()}};const buildStyles=()=>StyleSheet.create({layer:{position:"absolute",left:0,right:0},top:{alignItems:"stretch"},bottom:{alignItems:"stretch"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{useMemo}from"react";import{StyleSheet,View}from"react-native";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{Button}from"../Button/index.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const RichTooltipBody=({title:e,content:t,action:s,onAction:o,focusRef:i,actionRef:r,messageStyle:n})=>{const a=useTheme(),l=useMemo(()=>buildStyles(a),[a]);return _jsxs(View,{style:l.card,children:[e?_jsx(Text,{ref:i,variant:"label",weight:"semibold",accessibilityRole:"header",children:e}):null,"string"==typeof t?_jsx(Text,{ref:e?void 0:i,variant:"bodySmall",color:"secondary",style:n,children:t}):t,s?_jsx(View,{style:l.actions,children:_jsx(Button,{ref:r,title:s.label,variant:"ghost",size:"sm",accessibilityLabel:s.accessibilityLabel,onPress:o})}):null]})};const buildStyles=e=>StyleSheet.create({card:{gap:e.spacing.xs,paddingHorizontal:e.spacing.md,paddingTop:e.spacing.md,paddingBottom:e.spacing.sm,backgroundColor:e.colors.background.elevated,borderRadius:e.radius.md,...smoothCorners,...e.shadows.lg},actions:{flexDirection:"row",justifyContent:"flex-end",marginTop:e.spacing.xs}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import React,{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,
|
|
1
|
+
"use strict";import React,{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,Modal,Platform,Pressable,StyleSheet,Text,useWindowDimensions,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{mergeRefs}from"../../utils/mergeRefs.js";import{claimAnchoredSurface}from"../../utils/placement.js";import{FOCUS_DELAY_MS,focusHost}from"../Menu/focusHost.js";import{ToastHost}from"../Toast/ToastProvider.js";import{RichTooltipBody}from"./RichTooltipBody.js";import{resolveTooltipPosition}from"./tooltipPosition.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const DEFAULT_TOOLTIP_GAP=8,DEFAULT_SCREEN_PADDING=8,DEFAULT_PRESS_AUTO_HIDE_MS=4e3,DEFAULT_ARROW_HALF_WIDTH=4,DEFAULT_ARROW_HEIGHT=6,DEFAULT_ARROW_CORNER_PADDING=12,DEFAULT_MAX_WIDTH=240,RICH_MAX_WIDTH=280,DEFAULT_LINE_HEIGHT=18,Tooltip=e=>{const{content:t,children:r,variant:o="plain",title:s,action:i,placement:n="auto",visible:a,onVisibleChange:l,hideOnContentPress:u=!0,maxWidth:c,showArrow:m=!0,accessibilityLabel:d,style:f,containerStyle:p,arrowStyle:h,messageStyle:g,closeLabel:b="Close tooltip",testID:y}=e,T="rich"===o,_=e.trigger??(T?"press":"longPress"),R=useTheme(),A=useSafeAreaInsets(),S=useWindowDimensions(),w=useMemo(()=>buildStyles(R),[R]),x=R.components.tooltip,v=x?.gap??8,C=x?.screenPadding??8,D=x?.pressAutoHideMs??4e3,E=x?.arrowHalfWidth??4,P=x?.arrowHeight??6,j=x?.arrowCornerPadding??12,L=x?.lineHeight??18,H=c??(T?280:x?.maxWidth??240),F="press"===_&&!T,W=x?.enableScaleAnimation??!1,I=x?.exitDurationMs??150,M="manual"===_||"boolean"==typeof a,[O,V]=useState(!1),k=M?Boolean(a):O,[U,N]=useState(null),[B,z]=useState({width:0,height:0}),G=useRef(null),X=useRef(null),Y=useRef(null),q=useRef(null),J=useRef(null),K=useRef(!1),Q=useRef(!1),Z=useRef(createAnimatedValue(k?1:W?.85:1)).current,$=useRef(createAnimatedValue(k?1:0)).current,ee=useRef(null),te=useRef(!1),re=useCallback(e=>{M||V(e),l?.(e)},[M,l]),oe=useCallback(()=>{G.current&&G.current.measureInWindow((e,t,r,o)=>{N({x:e,y:t,width:r,height:o})})},[]),se=useCallback(e=>{oe(),re(!0)},[oe,re]),ie=useCallback(()=>{re(!1)},[re]),ne=useRef(ie);ne.current=ie;const ae=useCallback(()=>{if(!K.current)return;K.current=!1;const e=J.current;J.current=null,e?e():T&&focusHost(X.current??G.current)},[T]);useEffect(()=>{if(k)return Q.current=!0,K.current=!1,claimAnchoredSurface(()=>ne.current());Q.current&&(Q.current=!1,K.current=!0,"ios"!==Platform.OS&&ae())},[k]);const le=useCallback(()=>{J.current=i?.onPress??null,ie()},[i,ie]);useEffect(()=>{if(!te.current)return te.current=!0,k&&(oe(),F&&(ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{ie()},D))),()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)};let e;if(k){oe();const t=[Animated.timing($,{toValue:1,duration:R.motion.duration.fast,useNativeDriver:!0})];W&&t.push(Animated.spring(Z,{toValue:1,damping:R.motion.spring.snappy.damping,stiffness:R.motion.spring.snappy.stiffness,mass:R.motion.spring.snappy.mass,useNativeDriver:!0})),e=Animated.parallel(t),e.start(),F&&(ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{ie()},D))}else{const t=[Animated.timing($,{toValue:0,duration:I,easing:Easing.bezier(...R.motion.easing.accelerate),useNativeDriver:!0})];W&&t.push(Animated.timing(Z,{toValue:.85,duration:I,easing:Easing.bezier(...R.motion.easing.accelerate),useNativeDriver:!0})),e=Animated.parallel(t),e.start(),ee.current&&(clearTimeout(ee.current),ee.current=null)}return()=>{e?.stop(),ee.current&&(clearTimeout(ee.current),ee.current=null)}},[k]);const handleContentLayout=e=>{const{width:t,height:r}=e.nativeEvent.layout;t===B.width&&r===B.height||z({width:t,height:r})},ue=useMemo(()=>resolveTooltipPosition({anchor:U,size:B,placement:n,rich:T,viewport:{width:S.width,height:S.height,insets:A},maxWidth:H,gap:v,padding:C,arrowCornerPadding:j}),[U,B,n,T,S.width,S.height,A,H,v,C,j]),ce=k&&null!==U&&B.width>0;useEffect(()=>{if(!T||!ce)return;const e="web"===Platform.OS?q:Y,t=setTimeout(()=>focusHost(e.current),FOCUS_DELAY_MS);return()=>clearTimeout(t)},[T,ce]);const me=r.props,de=useMemo(()=>mergeRefs(me.ref,X),[me.ref]),fe={};"longPress"!==_||me.contextMenu?"press"===_&&(fe.onPress=e=>{me.onPress?.(e),se(e)}):(fe.onLongPress=se,fe.accessibilityHint="Long press for more info"),T&&(fe.ref=de);const pe=React.cloneElement(r,fe),he=d??("string"==typeof t?t:"Tooltip"),ge=useMemo(()=>{if(!m)return null;const e=T?R.colors.background.elevated:R.colors.background.inverse,t={position:"absolute",width:0,height:0,backgroundColor:"transparent",borderStyle:"solid",borderLeftWidth:E,borderRightWidth:E,borderBottomWidth:P,borderTopWidth:0,borderLeftColor:"transparent",borderRightColor:"transparent",borderTopColor:"transparent",borderBottomColor:e};return"top"===ue.placement?{...t,bottom:-P,left:ue.arrowOffset-E,transform:[{rotate:"180deg"}]}:"bottom"===ue.placement?{...t,top:-P,left:ue.arrowOffset-E}:"left"===ue.placement?{...t,right:-P,top:ue.arrowOffset-E,transform:[{rotate:"90deg"}]}:{...t,left:-P,top:ue.arrowOffset-E,transform:[{rotate:"-90deg"}]}},[m,ue,R,T,E,P]),be={position:"absolute",top:ue.top,left:ue.left,maxWidth:H,opacity:ce?$:0,transform:[{scale:Z}]},ye=ge?_jsx(View,{style:[ge,h],pointerEvents:"none"}):null;return _jsxs(_Fragment,{children:[_jsx(View,{ref:G,collapsable:!1,onLayout:oe,testID:y,children:pe}),_jsxs(Modal,{visible:k,transparent:!0,statusBarTranslucent:!0,presentationStyle:"overFullScreen",animationType:"none",onRequestClose:ie,onDismiss:ae,children:[T?_jsxs(_Fragment,{children:[_jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:u?ie:void 0,accessibilityLabel:b,accessibilityRole:"button"}),k?_jsxs(Animated.View,{onLayout:handleContentLayout,style:[be,f,p],children:[_jsx(RichTooltipBody,{title:s,content:t,action:i,onAction:le,focusRef:Y,actionRef:q,messageStyle:g}),ye]}):null]}):_jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:u?ie:void 0,accessibilityLabel:b,accessibilityRole:"button",children:k?_jsxs(Animated.View,{accessibilityRole:"tooltip",accessibilityLiveRegion:"polite",accessibilityLabel:he,onLayout:handleContentLayout,style:[be,f,p],children:[_jsx(View,{style:[w.tooltip,{backgroundColor:R.colors.background.inverse,borderRadius:R.radius.md,...smoothCorners,paddingHorizontal:R.spacing.md,paddingVertical:R.spacing.sm,...R.shadows.lg,shadowColor:R.shadows.lg.shadowColor}],children:"string"==typeof t?_jsx(Text,{style:[{color:R.colors.text.inverse,fontSize:R.typography.fontSize.sm,lineHeight:L},g],children:t}):t}),ye]}):null}),_jsx(ToastHost,{})]})]})},buildStyles=e=>StyleSheet.create({tooltip:{overflow:"hidden"}});export{Tooltip};export default Tooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{arrowOffset,computePlacement}from"../../utils/placement.js";const clamp=(t,e,o)=>Math.max(e,Math.min(t,o)),roomiestSide=(t,e)=>{const o={top:t.y,bottom:e.height-(t.y+t.height),left:t.x,right:e.width-(t.x+t.width)},r=Math.max(o.top,o.bottom,o.left,o.right);return r===o.bottom?"bottom":r===o.top?"top":r===o.right?"right":"left"};export const resolveTooltipPosition=t=>{const{anchor:e,size:o,placement:r,rich:i,viewport:a,maxWidth:h,gap:m,padding:n}=t;if(!e)return{top:n,left:n,placement:"bottom",arrowOffset:0};const{insets:p}=a,l=o.width||Math.min(h,a.width-2*n),c=o.height||0,f=p.top+n,s=a.height-p.bottom-n-c;let g;if(g=i?"top"===r||"bottom"===r?r:"auto":"auto"===r?roomiestSide(e,a):r,"left"!==g&&"right"!==g){const o=computePlacement(e,{width:l,height:c},a,g,{gap:m,margin:n}),r=e.x+e.width/2;return{top:clamp(o.y,f,s),left:o.x,placement:o.placement,arrowOffset:arrowOffset(r,o.x,l,t.arrowCornerPadding)}}const d="left"===g?e.x-l-m:e.x+e.width+m,w=a.width-p.right-n-l,x=clamp(d,p.left+n,w),u=clamp(e.y+e.height/2-c/2,f,s),b=e.y+e.height/2;return{top:u,left:x,placement:g,arrowOffset:arrowOffset(b,u,c,t.arrowCornerPadding)}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{useEffect,useMemo}from"react";import{StyleSheet,View}from"react-native";import Animated,{cancelAnimation,useAnimatedStyle,useSharedValue,withDelay,withRepeat,withSequence,withTiming}from"react-native-reanimated";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const DOT=6,DIM=.3,PULSE_MS=400,STAGGER_MS=160,STILL_OPACITY=[1,.65,.3],Dot=({index:e,still:t,colour:i})=>{const s=useSharedValue(.3);useEffect(()=>{if(!t)return s.value=withDelay(160*e,withRepeat(withSequence(withTiming(1,{duration:400}),withTiming(.3,{duration:400})),-1)),()=>cancelAnimation(s)},[t,e,s]);const o=useAnimatedStyle(()=>({opacity:s.value}));return _jsx(Animated.View,{style:[styles.dot,{backgroundColor:i},t?{opacity:STILL_OPACITY[e]}:o]})};export const TypingIndicator=({label:e,accessibilityLabel:t,bubble:i=!0,style:s,testID:o})=>{const r=useTheme(),a=useMemo(()=>buildStyles(r),[r]),n=useReducedMotion(),l=r.colors.text.tertiary;return _jsxs(View,{style:[a.root,i?a.bubble:null,s],accessible:!0,accessibilityRole:"progressbar",accessibilityLabel:e??t??"Typing",accessibilityState:{busy:!0},"aria-busy":!0,testID:o,children:[_jsx(View,{style:a.dots,children:[0,1,2].map(e=>_jsx(Dot,{index:e,still:n,colour:l},e))}),e?_jsx(Text,{variant:"bodySmall",color:"secondary",children:e}):null]})};const styles=StyleSheet.create({dot:{width:6,height:6,borderRadius:3,...smoothCorners}}),buildStyles=e=>StyleSheet.create({root:{flexDirection:"row",alignItems:"center",alignSelf:"flex-start",gap:e.spacing.sm,marginTop:e.spacing.sm},bubble:{backgroundColor:e.colors.background.secondary,borderRadius:e.radius.xl,...smoothCorners,paddingHorizontal:e.spacing.md,paddingVertical:e.spacing.sm+e.spacing.xs},dots:{flexDirection:"row",alignItems:"center",gap:e.spacing.xs}});export default TypingIndicator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{default,TypingIndicator}from"./TypingIndicator.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{memo,useCallback,useEffect,useMemo,useRef}from"react";import{Animated,Platform,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,setNativeValue}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const WHEEL_VISIBLE_ITEMS=5;export const WHEEL_CENTER_OFFSET=Math.floor(2.5);const HAPTIC_DEBOUNCE_MS=35,WEB_SETTLE_MS=120,SCALE_STOPS=[-2,-1,0,1,2],WheelRow=memo(({label:e,index:t,scrollY:n,itemHeight:a,selected:s,theme:i,reducedMotion:r,onPress:l})=>{const{opacity:o,scale:c}=useMemo(()=>{const e=Animated.subtract(Animated.divide(n,a),t);return{opacity:e.interpolate({inputRange:SCALE_STOPS,outputRange:[.3,.6,1,.6,.3],extrapolate:"clamp"}),scale:e.interpolate({inputRange:SCALE_STOPS,outputRange:[.85,.95,1.05,.95,.85],extrapolate:"clamp"})}},[n,a,t]),u=_jsx(Text,{numberOfLines:1,maxFontSizeMultiplier:1.5,style:{fontSize:i.typography.fontSize.xl,color:s?i.colors.text.primary:i.colors.text.secondary,fontWeight:s?i.typography.fontWeight.semibold:i.typography.fontWeight.medium,letterSpacing:i.typography.letterSpacing.normal},children:e});return _jsx(Animated.View,{style:[styles.row,{height:a},r?{opacity:o}:{opacity:o,transform:[{scale:c}]}],accessible:!1,importantForAccessibility:"no",children:l?_jsx(Pressable,{focusable:!1,accessible:!1,onPress:()=>l(t),style:styles.rowPress,children:u}):u})});export const Wheel=({label:e,items:t,selectedIndex:n,onIndexChange:a,itemHeight:s,width:i,theme:r,haptic:l,disabled:o,reducedMotion:c,testID:u})=>{const m="web"===Platform.OS,d=useRef(null),f=useRef(createAnimatedValue(n*s)).current,y=useRef(n*s),h=useRef(n*s),b=useRef(n),p=useRef(0),x=useRef(null),g=useRef(()=>{}),S=r.components.timePicker?.hapticDebounceMs??35,E=t.length-1;useEffect(()=>{b.current=n;const e=n*s;if(h.current===e)return;if(h.current=e,Math.abs(y.current-e)<1)return;y.current=e,m||setNativeValue(f,e);const t=requestAnimationFrame(()=>{d.current?.scrollToOffset({offset:e,animated:!1})});return()=>cancelAnimationFrame(t)},[n,s,f,m]),useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]);const v=useCallback((e,s)=>{if(!(e===n||e<0||e>E)){if("accessibility"===s){const e=resolveHaptic(l,"denseTick");e&&triggerHaptic(e)}if("keyboard"!==s){const n=t[e];n&&announce(n.accessibilityLabel??n.label)}a(e)}},[n,E,t,l,a]);g.current=()=>{x.current=null;const e=Math.max(0,Math.min(E,Math.round(y.current/s))),t=e*s;Math.abs(y.current-t)>=1&&d.current?.scrollToOffset({offset:t,animated:!c}),v(e,"scroll")};const M=useMemo(()=>Animated.event([{nativeEvent:{contentOffset:{y:f}}}],{useNativeDriver:!m,listener:e=>{const t=e.nativeEvent.contentOffset.y;y.current=t;const n=Math.round(t/s);if(n!==b.current&&n>=0&&n<=E){const e=Date.now();if(e-p.current>=S){const t=resolveHaptic(l,"denseTick");t&&triggerHaptic(t),p.current=e}b.current=n}m&&(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>g.current(),120))}}),[f,s,E,l,S,m]),T=useCallback(e=>{const t=e.nativeEvent.contentOffset.y;v(Math.max(0,Math.min(E,Math.round(t/s))),"scroll")},[v,E,s]),w=useCallback(e=>{if(o)return;const t=e.nativeEvent.actionName;"increment"===t?v(Math.min(E,n+1),"accessibility"):"decrement"===t&&v(Math.max(0,n-1),"accessibility")},[o,v,E,n]),A=useCallback(e=>{o||d.current?.scrollToOffset({offset:e*s,animated:!c})},[o,s,c]),_=useCallback(({item:e,index:t})=>_jsx(WheelRow,{label:e.label,index:t,scrollY:f,itemHeight:s,selected:t===n,theme:r,reducedMotion:c,onPress:m?A:void 0}),[f,s,n,r,c,m,A]),C=useCallback((e,t)=>`${String(e.value)}-${t}`,[]),R=useCallback((e,t)=>({length:s,offset:s*t,index:t}),[s]),j=t[n]?t[n].accessibilityLabel??t[n].label:"",I=m?{focusable:!0,role:"spinbutton","aria-label":e,"aria-valuetext":j,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":E,"aria-disabled":o,onKeyDown:e=>{if(o)return;const t={ArrowDown:Math.min(E,n+1),PageDown:Math.min(E,n+1),ArrowUp:Math.max(0,n-1),PageUp:Math.max(0,n-1),Home:0,End:E}[e.key];void 0!==t&&(e.preventDefault?.(),v(t,"keyboard"))}}:void 0;return _jsxs(View,{style:[void 0===i?styles.columnFlex:{width:i},{height:5*s},styles.column,o?styles.disabled:null],testID:u,...I,children:[m?null:_jsx(View,{pointerEvents:"none",style:styles.a11yLayer,accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:e,accessibilityValue:{text:j},accessibilityState:{disabled:Boolean(o)},"aria-disabled":Boolean(o),accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:w}),_jsx(Animated.FlatList,{ref:d,data:t,keyExtractor:C,renderItem:_,getItemLayout:R,showsVerticalScrollIndicator:!1,snapToInterval:s,snapToAlignment:"start",decelerationRate:"fast",bounces:!1,scrollEnabled:!o,nestedScrollEnabled:!0,scrollEventThrottle:16,onScroll:M,onMomentumScrollEnd:T,contentContainerStyle:{paddingVertical:s*WHEEL_CENTER_OFFSET},initialScrollIndex:n,style:[styles.list,{height:5*s}],importantForAccessibility:"no-hide-descendants","aria-hidden":!0})]})};const styles=StyleSheet.create({column:{overflow:"hidden"},columnFlex:{flex:1},disabled:{opacity:.5},list:{flexGrow:0},row:{alignItems:"center",justifyContent:"center"},rowPress:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",flex:1},a11yLayer:{...StyleSheet.absoluteFill,zIndex:2}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{Fragment,useCallback,useMemo}from"react";import{StyleSheet,Text,useWindowDimensions,View}from"react-native";import{useReducedMotion}from"../../hooks/useReducedMotion.js";import{useTheme}from"../../theme/index.js";import{WHEEL_CENTER_OFFSET,WHEEL_VISIBLE_ITEMS,Wheel}from"./Wheel.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const BASE_ITEM_HEIGHT=40,MAX_FONT_SCALE=1.5,DEFAULT_COLUMN_WIDTH=64,MAX_DURATION_MINUTES=1439,range=(e,t,i=1)=>{const o=[];for(let n=e;n<=t;n+=i)o.push(n);return o},plural=(e,t,i)=>`${e} ${1===e?t:i}`,toItem=e=>"object"==typeof e?e:{value:e,label:String(e)},WheelPicker=e=>{const{haptic:t,disabled:i,testID:o,style:n}=e,s=useTheme(),a=useReducedMotion(),{fontScale:l}=useWindowDimensions(),r=Math.min(Math.max(l,1),1.5),u=Math.round(40*r),m=useMemo(()=>buildStyles(s,u),[s,u]),d="list"===e.mode?e.items:void 0,h=useMemo(()=>d?.map(toItem),[d]),c="duration"===e.mode?e.minuteStep??1:1,p="duration"===e.mode?Math.max(0,Math.min(1439,Math.floor(e.maxMinutes??1/0))):0,b=Math.floor(p/60),y="duration"===e.mode?e.labels:void 0,M=y?.hours??"Hours",f=y?.minutes??"Minutes",x=y?.hourUnit??"hr",g=y?.minuteUnit??"min",S=useCallback(e=>{const t=e===b?p%60:59;return Math.floor(t/c)*c},[b,p,c]),_="duration"===e.mode?e.value:0,E=useMemo(()=>{const e=Number.isFinite(_)?_:0,t=Math.max(0,Math.min(p,e)),i=Math.floor(t/60),o=Math.round(t%60/c)*c;return{hour:i,minute:Math.min(S(i),o)}},[_,p,c,S]),I=useMemo(()=>"duration"===e.mode?range(0,b).map(e=>({value:e,label:String(e),accessibilityLabel:plural(e,"hour","hours")})):[],[e.mode,b]),j=S(E.hour),v=useMemo(()=>"duration"===e.mode?range(0,j,c).map(e=>({value:e,label:String(e).padStart(2,"0"),accessibilityLabel:plural(e,"minute","minutes")})):[],[e.mode,j,c]),T=useMemo(()=>"list"===e.mode?[{key:"list",label:e.label??"Value",items:h??[],value:e.value??"",width:e.width}]:"duration"===e.mode?[{key:"hours",label:M,items:I,value:E.hour,unit:x,gapAfter:s.spacing.md},{key:"minutes",label:f,items:v,value:E.minute,unit:g}]:e.columns,[e,h,I,v,E,M,f,x,g,s.spacing.md]),{onChange:W}=e,w=useCallback((t,i)=>{const o=t.items[i];if(o&&W)if("list"===e.mode)W(o.value);else if("duration"===e.mode){const e=Number(o.value),i=W;"hours"===t.key?i(60*e+Math.min(E.minute,S(e))):i(60*E.hour+e)}else W(t.key,o.value)},[W,e.mode,E,S]);return _jsxs(View,{style:[m.wheels,n],testID:o,children:[_jsxs(View,{pointerEvents:"none",style:m.selectionBand,children:[_jsx(View,{style:m.bandLine}),_jsx(View,{style:m.bandLine})]}),T.map(o=>{if(0===o.items.length)return null;const n=o.items.findIndex(e=>e.value===o.value);return _jsxs(Fragment,{children:[_jsx(Wheel,{label:o.label,items:o.items,selectedIndex:Math.max(0,n),onIndexChange:e=>w(o,e),itemHeight:u,width:o.width??("list"===e.mode?void 0:64),theme:s,haptic:t,disabled:i,reducedMotion:a,testID:o.testID}),o.unit?_jsx(Text,{style:m.unit,maxFontSizeMultiplier:1.5,numberOfLines:1,accessible:!1,importantForAccessibility:"no","aria-hidden":!0,children:o.unit}):null,o.separator?_jsx(Text,{style:m.separator,maxFontSizeMultiplier:1.5,accessible:!1,importantForAccessibility:"no","aria-hidden":!0,children:o.separator}):null,o.gapAfter?_jsx(View,{style:{width:o.gapAfter}}):null]},o.key)})]})},buildStyles=(e,t)=>StyleSheet.create({wheels:{flexDirection:"row",alignItems:"center",justifyContent:"center",height:t*WHEEL_VISIBLE_ITEMS,position:"relative"},selectionBand:{position:"absolute",left:0,right:0,top:t*WHEEL_CENTER_OFFSET,height:t,justifyContent:"space-between"},bandLine:{height:2*StyleSheet.hairlineWidth,backgroundColor:e.colors.primary,opacity:.85},separator:{fontSize:e.typography.fontSize["2xl"],fontWeight:e.typography.fontWeight.bold,color:e.colors.text.primary,paddingHorizontal:e.spacing.xs},unit:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.secondary,paddingLeft:e.spacing.xs}});export{WheelPicker};export default WheelPicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{default,WheelPicker}from"./WheelPicker.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{Accordion,AccordionGroup}from"./Accordion/index.js";export{AmountSlider}from"./AmountSlider/index.js";export{AnimatePresence}from"./AnimatePresence/index.js";export{AppBar}from"./AppBar/index.js";export{AsyncBlock}from"./AsyncBlock/index.js";export{AuthedImage,authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./AuthedImage/index.js";export{Autocomplete}from"./Autocomplete/index.js";export{Avatar,AvatarGroup}from"./Avatar/index.js";export{Badge}from"./Badge/index.js";export{Banner}from"./Banner/index.js";export{BottomNavigation}from"./BottomNavigation/index.js";export{BottomSheet,useBottomSheet}from"./BottomSheet/index.js";export{Box,Row,Spacer,Stack}from"./Box/index.js";export{Button}from"./Button/index.js";export{Calendar}from"./Calendar/index.js";export{Card}from"./Card/index.js";export{Carousel}from"./Carousel/index.js";export{Checkbox}from"./Checkbox/index.js";export{Chip}from"./Chip/index.js";export{ChoiceGroup}from"./ChoiceGroup/index.js";export{Confetti}from"./Confetti/index.js";export{DatePicker}from"./DatePicker/index.js";export{DateRangePicker}from"./DateRangePicker/index.js";export{cleanDecimalText,DecimalInput,parseDecimalText}from"./DecimalInput/index.js";export{Descriptions}from"./Descriptions/index.js";export{Dialog}from"./Dialog/index.js";export{Divider}from"./Divider/index.js";export{Drawer}from"./Drawer/index.js";export{EmptyState}from"./EmptyState/index.js";export{ErrorBoundary,useErrorHandler,withErrorBoundary}from"./ErrorBoundary/index.js";export{FilePicker,formatFileSize}from"./FilePicker/index.js";export{FileViewer}from"./FileViewer/index.js";export{FloatingActionButton,FloatingActionButtonGroup}from"./FloatingActionButton/index.js";export{ForceUpdateDialog}from"./ForceUpdateDialog/index.js";export{FormField}from"./FormField/index.js";export{IconBadge}from"./IconBadge/index.js";export{IconButton}from"./IconButton/index.js";export{ImageGallery}from"./ImageGallery/index.js";export{InlineSelect}from"./InlineSelect/index.js";export{Input}from"./Input/index.js";export{KeyboardAwareScrollView}from"./KeyboardAwareScrollView/index.js";export{KeyboardToolbar}from"./KeyboardToolbar/index.js";export{ListItem}from"./ListItem/index.js";export{LoaderOverlay,loader,useLoader}from"./LoaderOverlay/index.js";export{Markdown}from"./Markdown/index.js";export{MODAL_DISMISS_GRACE_MS,Modal}from"./Modal/index.js";export{Notation,parseNotation,sym}from"./Notation/index.js";export{NumberInput}from"./NumberInput/index.js";export{OptionSheet}from"./OptionSheet/index.js";export{OTPInput}from"./OTPInput/index.js";export{ALL_CALLING_CODES,DEFAULT_CALLING_CODES,formatE164,PhoneNumberInput,parseE164}from"./PhoneNumberInput/index.js";export{PickerTrigger}from"./PickerTrigger/index.js";export{ProfileCompletion}from"./ProfileCompletion/index.js";export{ProfilePicker}from"./ProfilePicker/index.js";export{ProgressBar}from"./ProgressBar/index.js";export{ProgressRing}from"./ProgressRing/index.js";export{Radio,RadioDot,RadioGroup}from"./Radio/index.js";export{Rating}from"./Rating/index.js";export{Repeater}from"./Repeater/index.js";export{applyMarkdownAction,RichTextEditor}from"./RichTextEditor/index.js";export{SearchBar}from"./SearchBar/index.js";export{SectionHeader}from"./SectionHeader/index.js";export{SegmentedControl}from"./SegmentedControl/index.js";export{Select}from"./Select/index.js";export{Skeleton,SkeletonCircle,SkeletonClockProvider,SkeletonContent,SkeletonList,SkeletonProvider,SkeletonSkip,SkeletonText,useReduceMotion,useSkeletonClock,useSkeletonDefaults}from"./Skeleton/index.js";export{Slider}from"./Slider/index.js";export{SliderField}from"./SliderField/index.js";export{SlideToConfirm}from"./SlideToConfirm/index.js";export{Spinner}from"./Spinner/index.js";export{StatTile}from"./StatTile/index.js";export{StatusBadge}from"./StatusBadge/index.js";export{Stepper}from"./Stepper/index.js";export{Swipeable}from"./Swipeable/index.js";export{Switch}from"./Switch/index.js";export{Tabs}from"./Tabs/index.js";export{TagInput}from"./TagInput/index.js";export{Text}from"./Text/index.js";export{Timeline}from"./Timeline/index.js";export{TimePicker}from"./TimePicker/index.js";export{Toast,ToastHost,ToastProvider,toast,useToast}from"./Toast/index.js";export{Tooltip}from"./Tooltip/index.js";export{Tour}from"./Tour/index.js";export{ZoomableImage}from"./ZoomableImage/index.js";
|
|
1
|
+
"use strict";export{Accordion,AccordionGroup}from"./Accordion/index.js";export{AmountSlider}from"./AmountSlider/index.js";export{AnimatePresence}from"./AnimatePresence/index.js";export{AppBar}from"./AppBar/index.js";export{AsyncBlock}from"./AsyncBlock/index.js";export{AuthedImage,authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./AuthedImage/index.js";export{Autocomplete}from"./Autocomplete/index.js";export{Avatar,AvatarGroup}from"./Avatar/index.js";export{Badge}from"./Badge/index.js";export{Banner}from"./Banner/index.js";export{BarChart}from"./BarChart/index.js";export{BottomNavigation}from"./BottomNavigation/index.js";export{BottomSheet,useBottomSheet,useSheetSwap}from"./BottomSheet/index.js";export{Box,Row,Spacer,Stack}from"./Box/index.js";export{Button}from"./Button/index.js";export{Calendar}from"./Calendar/index.js";export{Card}from"./Card/index.js";export{Carousel}from"./Carousel/index.js";export{Checkbox}from"./Checkbox/index.js";export{Chip}from"./Chip/index.js";export{ChoiceGroup}from"./ChoiceGroup/index.js";export{Composer}from"./Composer/index.js";export{Confetti}from"./Confetti/index.js";export{DatePicker}from"./DatePicker/index.js";export{DateRangePicker}from"./DateRangePicker/index.js";export{DateSeparator,DEFAULT_DATE_SEPARATOR_LABELS,dayLabel}from"./DateSeparator/index.js";export{cleanDecimalText,DecimalInput,parseDecimalText}from"./DecimalInput/index.js";export{Descriptions}from"./Descriptions/index.js";export{Dialog}from"./Dialog/index.js";export{Divider}from"./Divider/index.js";export{Drawer}from"./Drawer/index.js";export{EmptyState}from"./EmptyState/index.js";export{ErrorBoundary,useErrorHandler,withErrorBoundary}from"./ErrorBoundary/index.js";export{FilePicker,formatFileSize}from"./FilePicker/index.js";export{FileViewer}from"./FileViewer/index.js";export{FloatingActionButton,FloatingActionButtonGroup}from"./FloatingActionButton/index.js";export{ForceUpdateDialog}from"./ForceUpdateDialog/index.js";export{FormField}from"./FormField/index.js";export{IconBadge}from"./IconBadge/index.js";export{IconButton}from"./IconButton/index.js";export{ImageGallery}from"./ImageGallery/index.js";export{InlineSelect}from"./InlineSelect/index.js";export{Input}from"./Input/index.js";export{KeyboardAwareScrollView}from"./KeyboardAwareScrollView/index.js";export{KeyboardToolbar}from"./KeyboardToolbar/index.js";export{ListItem}from"./ListItem/index.js";export{LoaderOverlay,loader,useLoader}from"./LoaderOverlay/index.js";export{Markdown}from"./Markdown/index.js";export{Menu}from"./Menu/index.js";export{DEFAULT_MESSAGE_BUBBLE_LABELS,MessageBubble}from"./MessageBubble/index.js";export{DEFAULT_MESSAGE_LIST_LABELS,MessageList}from"./MessageList/index.js";export{MODAL_DISMISS_GRACE_MS,Modal}from"./Modal/index.js";export{Notation,parseNotation,sym}from"./Notation/index.js";export{NumberInput}from"./NumberInput/index.js";export{OnboardingPager}from"./OnboardingPager/index.js";export{OptionSheet}from"./OptionSheet/index.js";export{OTPInput}from"./OTPInput/index.js";export{PaymentResult}from"./PaymentResult/index.js";export{ALL_CALLING_CODES,DEFAULT_CALLING_CODES,formatE164,PhoneNumberInput,parseE164}from"./PhoneNumberInput/index.js";export{PickerTrigger}from"./PickerTrigger/index.js";export{ProfileCompletion}from"./ProfileCompletion/index.js";export{ProfilePicker}from"./ProfilePicker/index.js";export{ProgressBar}from"./ProgressBar/index.js";export{ProgressRing}from"./ProgressRing/index.js";export{Radio,RadioDot,RadioGroup}from"./Radio/index.js";export{Rating}from"./Rating/index.js";export{Repeater}from"./Repeater/index.js";export{applyMarkdownAction,RichTextEditor}from"./RichTextEditor/index.js";export{ScannerOverlay}from"./ScannerOverlay/index.js";export{SearchBar,useRecentSearches}from"./SearchBar/index.js";export{SectionHeader}from"./SectionHeader/index.js";export{SegmentedControl}from"./SegmentedControl/index.js";export{Select}from"./Select/index.js";export{SignaturePad}from"./SignaturePad/index.js";export{Skeleton,SkeletonCircle,SkeletonClockProvider,SkeletonContent,SkeletonList,SkeletonProvider,SkeletonSkip,SkeletonText,useReduceMotion,useSkeletonClock,useSkeletonDefaults}from"./Skeleton/index.js";export{Slider}from"./Slider/index.js";export{SliderField}from"./SliderField/index.js";export{SlideToConfirm}from"./SlideToConfirm/index.js";export{Sparkline}from"./Sparkline/index.js";export{Spinner}from"./Spinner/index.js";export{StatTile}from"./StatTile/index.js";export{StatusBadge}from"./StatusBadge/index.js";export{Stepper}from"./Stepper/index.js";export{Swipeable}from"./Swipeable/index.js";export{Switch}from"./Switch/index.js";export{Tabs}from"./Tabs/index.js";export{TagInput}from"./TagInput/index.js";export{Text}from"./Text/index.js";export{Timeline}from"./Timeline/index.js";export{TimePicker}from"./TimePicker/index.js";export{Toast,ToastHost,ToastProvider,toast,useToast}from"./Toast/index.js";export{Tooltip}from"./Tooltip/index.js";export{Tour}from"./Tour/index.js";export{TypingIndicator}from"./TypingIndicator/index.js";export{WheelPicker}from"./WheelPicker/index.js";export{ZoomableImage}from"./ZoomableImage/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{useControllableState}from"./useControllableState.js";export{useDebounce}from"./useDebounce.js";export{createDragToDismissController,DRAG_DISMISS_DISTANCE,DRAG_DISMISS_VELOCITY,useDragToDismiss}from"./useDragToDismiss.js";export{FLICK_TOLERANCE,useFlickGuard}from"./useFlickGuard.js";export{PRESS_ANIMATION_PRESETS,usePressAnimation}from"./usePressAnimation.js";export{useReducedMotion}from"./useReducedMotion.js";export{useToggle}from"./useToggle.js";
|
|
1
|
+
"use strict";export{useControllableState}from"./useControllableState.js";export{useDebounce}from"./useDebounce.js";export{createDragToDismissController,DRAG_DISMISS_DISTANCE,DRAG_DISMISS_VELOCITY,useDragToDismiss}from"./useDragToDismiss.js";export{FLICK_TOLERANCE,useFlickGuard}from"./useFlickGuard.js";export{PRESS_ANIMATION_PRESETS,usePressAnimation}from"./usePressAnimation.js";export{useReducedMotion}from"./useReducedMotion.js";export{useRefreshControl}from"./useRefreshControl.js";export{useScrollDirection}from"./useScrollDirection.js";export{useToggle}from"./useToggle.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{Logger}from"@webority/mobile-core";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Platform,RefreshControl}from"react-native";import{useTheme}from"../theme/index.js";import{announce}from"../utils/announce.js";import{resolveHaptic,triggerHaptic}from"../utils/hapticUtils.js";import{jsx as _jsx}from"react/jsx-runtime";const DEFAULT_MIN_VISIBLE_MS=400;export const useRefreshControl=e=>{const{onRefresh:r,refreshing:t=!1,haptic:o,title:s,minVisibleMs:n=DEFAULT_MIN_VISIBLE_MS,labels:c}=e,i=useTheme(),[u,a]=useState(!1),l=useRef(!1),f=useRef(!0),m=useRef(null),h=useRef(r);h.current=r;const p=useRef(c);p.current=c;const g=useRef(n);g.current=n,useEffect(()=>(f.current=!0,()=>{f.current=!1,m.current?.release()}),[]);const b=useCallback(e=>new Promise(r=>{if(e<=0)return void r();const t=setTimeout(()=>{m.current=null,r()},e);m.current={release:()=>{clearTimeout(t),m.current=null,r()}}}),[]),d=useCallback(async e=>{if(l.current)return;l.current=!0,a(!0);const r=Date.now();e&&announce(p.current?.refreshing??"Refreshing");let t=!1;try{await h.current()}catch(e){t=!0,Logger.error("[@webority/mobile-ui] useRefreshControl: onRefresh failed.",e)}f.current&&await b(g.current-(Date.now()-r)),l.current=!1,f.current&&(a(!1),e&&!t&&announce(p.current?.refreshed??"Updated"))},[b]),R="android"===Platform.OS?"gestureStart":null,C=void 0===o?R:resolveHaptic(o,"gestureStart"),y=useCallback(()=>{l.current||(C&&triggerHaptic(C),d(!1))},[C,d]),v=useCallback(()=>d(!0),[d]),S=useMemo(()=>({accessibilityActions:[{name:"refresh",label:c?.refresh??"Refresh"}],onAccessibilityAction:e=>{"refresh"===e.nativeEvent.actionName&&d(!0)}}),[c?.refresh,d]),k=u||t;return{refreshControl:useMemo(()=>_jsx(RefreshControl,{refreshing:k,onRefresh:y,tintColor:i.colors.primary,colors:[i.colors.primary],progressBackgroundColor:i.colors.background.elevated,title:s,titleColor:i.colors.text.secondary}),[k,y,s,i.colors.primary,i.colors.background.elevated,i.colors.text.secondary]),refreshing:k,refresh:v,accessibilityProps:S}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{useCallback,useRef,useState}from"react";const DEFAULT_THRESHOLD=8;export const useScrollDirection=e=>{const t=e?.threshold??8,[r,n]=useState("idle"),u=useRef(0),c=useRef(0),s=useRef("idle"),a=useCallback(e=>{s.current!==e&&(s.current=e,n(e))},[]);return{direction:r,onScroll:useCallback(e=>{const{contentOffset:r,contentSize:n,layoutMeasurement:s}=e.nativeEvent,i=n&&s?Math.max(0,n.height-s.height):Number.POSITIVE_INFINITY,o=Math.min(Math.max(r.y,0),i),l=o-u.current;if(u.current=o,o<=0)return c.current=0,void a("idle");0!==l&&(Math.sign(l)!==Math.sign(c.current)&&(c.current=0),c.current+=l,Math.abs(c.current)>=t&&a(c.current>0?"down":"up"))},[t,a])}};
|
package/lib/module/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export*from"./components/index.js";export{APP_ICON_SIZES,AppIcon,CURATED_ICON_NAMES,defaultIcons,ICON_NAMES,ICONSAX_SUFFIX,renderSlotIcon}from"./components/AppIcon/index.js";export{deletePath,Form,getPath,HookFormField,isFieldFilled,rules,setPath,useField,useFieldArray,useForm,useFormCompletion,useFormContext,useHookFormField,useOptionalFormContext}from"./form/index.js";export{FLICK_TOLERANCE,PRESS_ANIMATION_PRESETS,useControllableState,useDebounce,useFlickGuard,usePressAnimation,useReducedMotion,useToggle}from"./hooks/index.js";export{initUI}from"./initUI.js";export{NetworkStatusBanner}from"./network/index.js";export{darkTheme,getColorMode,getTheme,lightTheme,mergeTheme,resetTheme,setColorMode,setTheme,subscribeTheme,ThemeProvider,useTheme,useThemeMode}from"./theme/index.js";export{Breakpoints,configureFeedback,feedback,hapticForIntent,isFeedbackEnabled,isScreenSize,isTablet,Margin,Padding,Responsive,ScreenDimensions,Spacing,SQUIRCLE_MIN_RADIUS,SQUIRCLE_SMOOTHING,setHapticImplementation,shadowStyle,smoothCorners,squircleApplies,squircleHostRadius,squirclePath,triggerHaptic,useScreenDimensions,warnUnknownProps}from"./utils/index.js";
|
|
1
|
+
"use strict";export*from"./components/index.js";export{APP_ICON_SIZES,AppIcon,CURATED_ICON_NAMES,defaultIcons,ICON_NAMES,ICONSAX_SUFFIX,renderSlotIcon}from"./components/AppIcon/index.js";export{deletePath,Form,getPath,HookFormField,isFieldFilled,rules,setPath,useField,useFieldArray,useForm,useFormCompletion,useFormContext,useHookFormField,useOptionalFormContext}from"./form/index.js";export{FLICK_TOLERANCE,PRESS_ANIMATION_PRESETS,useControllableState,useDebounce,useFlickGuard,usePressAnimation,useReducedMotion,useRefreshControl,useScrollDirection,useToggle}from"./hooks/index.js";export{initUI}from"./initUI.js";export{NetworkStatusBanner}from"./network/index.js";export{darkTheme,getColorMode,getTheme,lightTheme,mergeTheme,resetTheme,setColorMode,setTheme,subscribeTheme,ThemeProvider,useTheme,useThemeMode}from"./theme/index.js";export{announce,Breakpoints,configureFeedback,feedback,hapticForIntent,isFeedbackEnabled,isScreenSize,isTablet,Margin,Padding,Responsive,ScreenDimensions,Spacing,SQUIRCLE_MIN_RADIUS,SQUIRCLE_SMOOTHING,setHapticImplementation,shadowStyle,smoothCorners,squircleApplies,squircleHostRadius,squirclePath,triggerHaptic,useScreenDimensions,warnUnknownProps}from"./utils/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{AccessibilityInfo,Platform}from"react-native";let webRegions=null;const webRegion=e=>{if("undefined"==typeof document)return null;if(!webRegions||!webRegions.polite.isConnected){const make=e=>{const t=document.createElement("div");return t.setAttribute("aria-live",e),t.setAttribute("aria-atomic","true"),t.setAttribute("role","assertive"===e?"alert":"status"),Object.assign(t.style,{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"}),document.body.appendChild(t),t};webRegions={polite:make("polite"),assertive:make("assertive")}}return e?webRegions.polite:webRegions.assertive};export const announce=(e,t)=>{if(!e)return;const i=!1!==t?.polite;if("web"===Platform.OS){const t=webRegion(i);return void(t&&(t.textContent="",setTimeout(()=>{t.textContent=e},50)))}"ios"!==Platform.OS?AccessibilityInfo.announceForAccessibility(e):AccessibilityInfo.announceForAccessibilityWithOptions(e,i?{queue:!0}:{queue:!1,priority:"high"})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import*as Haptics from"expo-haptics";import{Platform,Vibration}from"react-native";let hapticImpl=null;const fallback=t=>{if("android"===Platform.OS){const i={selection:5,impactLight:10,impactMedium:20,impactHeavy:30,notificationSuccess:15,notificationWarning:25,notificationError:40};try{Vibration.vibrate(i[t]??10)}catch{}}},EXPO_HANDLERS={selection:()=>Haptics.selectionAsync(),impactLight:()=>Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light),impactMedium:()=>Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium),impactHeavy:()=>Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy),notificationSuccess:()=>Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success),notificationWarning:()=>Haptics.notificationAsync(Haptics.NotificationFeedbackType.Warning),notificationError:()=>Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error)};export const triggerHaptic=(t="selection")=>{if(hapticImpl)try{return void hapticImpl(t)}catch{}const i=EXPO_HANDLERS[t];i
|
|
1
|
+
"use strict";import*as Haptics from"expo-haptics";import{Platform,Vibration}from"react-native";let hapticImpl=null;const fallback=t=>{if("android"===Platform.OS){const i={selection:5,impactLight:10,impactMedium:20,impactHeavy:30,notificationSuccess:15,notificationWarning:25,notificationError:40,longPress:20,tick:5,denseTick:3,confirm:15,reject:40,gestureStart:10};try{Vibration.vibrate(i[t]??10)}catch{}}},EXPO_HANDLERS={selection:()=>Haptics.selectionAsync(),impactLight:()=>Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light),impactMedium:()=>Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium),impactHeavy:()=>Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy),notificationSuccess:()=>Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success),notificationWarning:()=>Haptics.notificationAsync(Haptics.NotificationFeedbackType.Warning),notificationError:()=>Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error),longPress:()=>Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium),tick:()=>Haptics.selectionAsync(),denseTick:()=>Haptics.selectionAsync(),confirm:()=>Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success),reject:()=>Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error),gestureStart:()=>Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)},ANDROID_HAPTICS={longPress:"Long_Press",tick:"Segment_Tick",denseTick:"Segment_Frequent_Tick",confirm:"Confirm",reject:"Reject",gestureStart:"Gesture_Start"},androidHandler=t=>{const i=ANDROID_HAPTICS[t];return"android"===Platform.OS&&i&&"function"==typeof Haptics.performAndroidHapticsAsync&&Haptics.AndroidHaptics?.[i]?()=>Haptics.performAndroidHapticsAsync(Haptics.AndroidHaptics[i]):null};export const triggerHaptic=(t="selection")=>{if(hapticImpl)try{return void hapticImpl(t)}catch{}const i=androidHandler(t)??EXPO_HANDLERS[t];if(i)try{i().catch(()=>fallback(t))}catch{fallback(t)}else fallback(t)};export const setHapticImplementation=t=>{hapticImpl=t};export const resolveHaptic=(t,i)=>!1===t?null:t??i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{blendOf,tintOf}from"./color.js";export{smoothCorners}from"./corners.js";export{configureFeedback,feedback,hapticForIntent,isFeedbackEnabled}from"./feedback.js";export{resolveHaptic,setHapticImplementation,triggerHaptic}from"./hapticUtils.js";export{mergeRefs}from"./mergeRefs.js";export{Breakpoints,isScreenSize,isTablet,Responsive,ScreenDimensions,useScreenDimensions}from"./responsive.js";export{shadowStyle}from"./shadows.js";export{Margin,Padding,Spacing}from"./spacing.js";export{SQUIRCLE_MIN_RADIUS,SQUIRCLE_SMOOTHING,squircleApplies,squircleHostRadius,squirclePath}from"./squircle.js";export{warnUnknownProps}from"./warnUnknownProps.js";
|
|
1
|
+
"use strict";export{announce}from"./announce.js";export{blendOf,tintOf}from"./color.js";export{smoothCorners}from"./corners.js";export{configureFeedback,feedback,hapticForIntent,isFeedbackEnabled}from"./feedback.js";export{resolveHaptic,setHapticImplementation,triggerHaptic}from"./hapticUtils.js";export{mergeRefs}from"./mergeRefs.js";export{Breakpoints,isScreenSize,isTablet,Responsive,ScreenDimensions,useScreenDimensions}from"./responsive.js";export{shadowStyle}from"./shadows.js";export{Margin,Padding,Spacing}from"./spacing.js";export{SQUIRCLE_MIN_RADIUS,SQUIRCLE_SMOOTHING,squircleApplies,squircleHostRadius,squirclePath}from"./squircle.js";export{warnUnknownProps}from"./warnUnknownProps.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export const PLACEMENT_GAP=8;export const PLACEMENT_MARGIN=8;export const placementRoom=(t,e,o)=>{const n=o?.gap??8,r=o?.margin??8,a=e.insets.top+r,s=e.height-e.insets.bottom-r;return{above:Math.max(0,t.y-n-a),below:Math.max(0,s-(t.y+t.height+n))}};const resolveSide=(t,e,o)=>{const n=e<=o.above,r=e<=o.below;return"top"===t?n||!r&&o.above>=o.below?"top":"bottom":"bottom"===t?r||!n&&o.below>o.above?"bottom":"top":o.below>=o.above?"bottom":"top"};export const computePlacement=(t,e,o,n,r)=>{const a=r?.gap??8,s=r?.margin??8,h=r?.align??"center",i=placementRoom(t,o,r),c=resolveSide(n,e.height,i),m=o.insets.top+s,l=o.height-o.insets.bottom-s,p="bottom"===c?Math.max(m,t.y+t.height+a):Math.min(l-e.height,t.y-a-e.height),b=o.insets.left+s,x=o.width-o.insets.right-s,u="start"===h?t.x:"end"===h?t.x+t.width-e.width:t.x+t.width/2-e.width/2;return{x:Math.max(b,Math.min(u,x-e.width)),y:p,placement:c}};export const arrowOffset=(t,e,o,n)=>{const r=Math.max(n,o-n);return Math.max(n,Math.min(t-e,r))};let current=null;export const claimAnchoredSurface=t=>{const e=current,o={close:t};return current=o,e&&e.close(),()=>{current===o&&(current=null)}};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BarChart: a simple vertical bar chart for a dashboard.
|
|
3
|
+
*
|
|
4
|
+
* Zero is always on the axis, so a bar's length is its value. The point of the
|
|
5
|
+
* chart is readable without touching it: bars carry their value when there are
|
|
6
|
+
* few of them, and a summary line names the main message. Touching it adds
|
|
7
|
+
* detail: a tap picks a bar, and dragging along the plot picks the bar under
|
|
8
|
+
* the finger with one haptic tick per bar crossed. The picked bar's label and
|
|
9
|
+
* value are written above the plot.
|
|
10
|
+
*
|
|
11
|
+
* A screen reader gets one adjustable element: swipe up or down to move from
|
|
12
|
+
* bar to bar, each one read as "label, value". Bars are Views, not SVG, so the
|
|
13
|
+
* labels follow the app's font scale and nothing is drawn in a fixed pixel box.
|
|
14
|
+
*
|
|
15
|
+
* Values may be negative; the zero line then sits inside the plot.
|
|
16
|
+
*/
|
|
17
|
+
import type { View as RNView, StyleProp, ViewStyle } from 'react-native';
|
|
18
|
+
import type { HapticType } from '../../utils';
|
|
19
|
+
export type BarChartTone = 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
20
|
+
export interface BarChartDatum {
|
|
21
|
+
/** The full name of the bar, read aloud and written in the callout: "Mon 06-Oct-2026". */
|
|
22
|
+
label: string;
|
|
23
|
+
/** The bar's value. A value that is not a finite number draws as zero. */
|
|
24
|
+
value: number;
|
|
25
|
+
/** A shorter label drawn under the bar: "Mon". Default `label`. */
|
|
26
|
+
axisLabel?: string;
|
|
27
|
+
/** Replaces the spoken text of the bar. Default `"label, value"`. */
|
|
28
|
+
accessibilityLabel?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface BarChartProps {
|
|
31
|
+
data: ReadonlyArray<BarChartDatum>;
|
|
32
|
+
/** Colour of the bars. Default `'primary'`. Drawn in the tone's text ink so it holds 3:1 on the page in light and dark. */
|
|
33
|
+
tone?: BarChartTone;
|
|
34
|
+
/** Bar colour override; wins over `tone`. */
|
|
35
|
+
color?: string;
|
|
36
|
+
/** Height of the plot in points. Default `160`. */
|
|
37
|
+
height?: number;
|
|
38
|
+
/** What the chart shows, read first by a screen reader: "Approvals per day". */
|
|
39
|
+
label?: string;
|
|
40
|
+
/** The main message in a sentence, visible while no bar is picked: "Approvals peaked on Thursday". Default: the highest bar. */
|
|
41
|
+
summary?: string;
|
|
42
|
+
/** Write a value in full, for the callout and the spoken text. Default: the house number format (Indian grouping). */
|
|
43
|
+
formatValue?: (value: number) => string;
|
|
44
|
+
/** Write a value short, for the axis and the figures on the bars. Default: compact Indian form (1.5L, 2.3Cr). */
|
|
45
|
+
formatTick?: (value: number) => string;
|
|
46
|
+
/** Draw each bar's value on it. Default: when there are 7 bars or fewer. */
|
|
47
|
+
showValues?: boolean;
|
|
48
|
+
/** Picked bar (controlled); `null` for none. */
|
|
49
|
+
selection?: number | null;
|
|
50
|
+
/** Picked bar when uncontrolled. Default none. */
|
|
51
|
+
defaultSelection?: number | null;
|
|
52
|
+
/** Called when a bar is picked, or `null` when the picked bar is tapped again. */
|
|
53
|
+
onSelect?: (index: number | null) => void;
|
|
54
|
+
/** Haptic tick for each bar a drag crosses and for a tap. `false` turns it off. Default `'tick'`. */
|
|
55
|
+
haptic?: HapticType | false;
|
|
56
|
+
style?: StyleProp<ViewStyle>;
|
|
57
|
+
testID?: string;
|
|
58
|
+
}
|
|
59
|
+
declare const BarChart: import("react").ForwardRefExoticComponent<BarChartProps & import("react").RefAttributes<RNView>>;
|
|
60
|
+
export { BarChart };
|
|
61
|
+
export default BarChart;
|
|
62
|
+
//# sourceMappingURL=BarChart.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface BarScale {
|
|
2
|
+
/** Lowest value on the axis; never above zero. */
|
|
3
|
+
min: number;
|
|
4
|
+
/** Highest value on the axis; never below zero. */
|
|
5
|
+
max: number;
|
|
6
|
+
/** Axis ticks from `min` to `max`, on round steps (1, 2 or 5 times a power of ten). */
|
|
7
|
+
ticks: number[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The axis of a bar chart: zero is always on it (a bar's length is its value),
|
|
11
|
+
* the other end rounds up to a familiar step (0, 5, 10 ...), and values that
|
|
12
|
+
* are not finite numbers are ignored.
|
|
13
|
+
*/
|
|
14
|
+
export declare const barScale: (values: ReadonlyArray<number>, targetTicks?: number) => BarScale;
|
|
15
|
+
//# sourceMappingURL=scale.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { View as RNView, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
import type { ScrollDirection } from '../../hooks/useScrollDirection';
|
|
3
4
|
import type { ShadowScale } from '../../theme/types';
|
|
4
5
|
import type { HapticType } from '../../utils';
|
|
5
6
|
import type { SlotIcon, SlotIconState } from '../AppIcon';
|
|
@@ -114,6 +115,11 @@ export interface BottomNavigationCenterAction {
|
|
|
114
115
|
haptic?: HapticType | false;
|
|
115
116
|
testID?: string;
|
|
116
117
|
}
|
|
118
|
+
/** What the bar tells a function `accessory` when it draws. */
|
|
119
|
+
export interface BottomNavigationAccessoryState {
|
|
120
|
+
/** True while the bar is minimised: the accessory sits inline beside the tabs. */
|
|
121
|
+
minimized: boolean;
|
|
122
|
+
}
|
|
117
123
|
export interface BottomNavigationProps {
|
|
118
124
|
tabs: TabConfig[];
|
|
119
125
|
/** A pressable button in the middle of the bar, between the tabs. */
|
|
@@ -200,6 +206,32 @@ export interface BottomNavigationProps {
|
|
|
200
206
|
* Off unless set.
|
|
201
207
|
*/
|
|
202
208
|
border?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Opt in to minimising the bar while the person scrolls down: the labels go
|
|
211
|
+
* and the bar shrinks to its icons (it never hides), and it restores on
|
|
212
|
+
* scroll up, on reaching the top, or on a tap on a tab. Needs
|
|
213
|
+
* `scrollDirection` from the scroll view's `useScrollDirection`. Stays
|
|
214
|
+
* expanded while a screen reader is on, and snaps with no animation under
|
|
215
|
+
* Reduce Motion. Off by default.
|
|
216
|
+
*/
|
|
217
|
+
minimizeOnScroll?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* The scroll view's direction, from `useScrollDirection().direction`. Only
|
|
220
|
+
* read while `minimizeOnScroll` is set: `down` minimises, `up` and `idle`
|
|
221
|
+
* (at the top) restore. Default `idle`. A tap on a tab restores the bar
|
|
222
|
+
* until the direction next changes, so keep one hook per screen: sharing one
|
|
223
|
+
* across tab screens leaves `down` unchanged when the person returns to
|
|
224
|
+
* the top of another.
|
|
225
|
+
*/
|
|
226
|
+
scrollDirection?: ScrollDirection;
|
|
227
|
+
/**
|
|
228
|
+
* A compact strip tied to the bar, such as a "clocked in" status. Expanded,
|
|
229
|
+
* it sits above the tabs across the bar's width; minimised, it moves inline
|
|
230
|
+
* to the left of the tabs, so keep it small there. Pass a function to draw
|
|
231
|
+
* a smaller version when `minimized`. Drawn whether or not
|
|
232
|
+
* `minimizeOnScroll` is set; `testID` gives it `${testID}-accessory`.
|
|
233
|
+
*/
|
|
234
|
+
accessory?: React.ReactNode | ((state: BottomNavigationAccessoryState) => React.ReactNode);
|
|
203
235
|
style?: StyleProp<ViewStyle>;
|
|
204
236
|
/** Style applied to the active indicator of every variant (pill, line, bubble or expanded pill). */
|
|
205
237
|
indicatorStyle?: StyleProp<ViewStyle>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { BottomNavigationCenterAction, BottomNavigationElevation, BottomNavigationIndicatorPosition, BottomNavigationIndicatorRadius, BottomNavigationProps, BottomNavigationRadius, BottomNavigationVariant, TabBadge, TabConfig, TabIcon, TabIconProps } from './BottomNavigation';
|
|
1
|
+
export type { BottomNavigationAccessoryState, BottomNavigationCenterAction, BottomNavigationElevation, BottomNavigationIndicatorPosition, BottomNavigationIndicatorRadius, BottomNavigationProps, BottomNavigationRadius, BottomNavigationVariant, TabBadge, TabConfig, TabIcon, TabIconProps } from './BottomNavigation';
|
|
2
2
|
export { BottomNavigation, default } from './BottomNavigation';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether VoiceOver or TalkBack is running. Subscribes only while `active`, so
|
|
3
|
+
* a bar that never minimises keeps no listener. Always false on web: React
|
|
4
|
+
* Native Web's `isScreenReaderEnabled` resolves `true` unconditionally and
|
|
5
|
+
* fires no change event, so it cannot tell a reader from none.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useScreenReaderEnabled: (active: boolean) => boolean;
|
|
8
|
+
//# sourceMappingURL=useScreenReaderEnabled.d.ts.map
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* ref.current?.expand(); // open at first snap point (or `index` prop)
|
|
15
15
|
* ref.current?.expand(2); // open at specific index
|
|
16
16
|
* ref.current?.collapse(); // animate to smallest snap point
|
|
17
|
-
* ref.current?.close(); // dismiss
|
|
17
|
+
* ref.current?.close(); // dismiss (never asks `confirmDismiss`)
|
|
18
|
+
* ref.current?.requestClose(); // dismiss the way a drag or the scrim would: asks first
|
|
18
19
|
*/
|
|
19
20
|
import type React from 'react';
|
|
20
21
|
import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';
|
|
@@ -49,6 +50,23 @@ export interface BottomSheetProps {
|
|
|
49
50
|
onAfterClose?: () => void;
|
|
50
51
|
enablePanDownToClose?: boolean;
|
|
51
52
|
enableBackdropPress?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Asked before the user dismisses the sheet: a handle drag past the close
|
|
55
|
+
* threshold or a fast swipe down, a tap on the scrim, hardware Back (Android)
|
|
56
|
+
* and Escape (web), and `requestClose()`. Return `true` (or resolve `true`)
|
|
57
|
+
* to let it close, `false` to keep it open. A refused drag springs back to
|
|
58
|
+
* the snap point it started from, and `onChange(-1)` does not fire.
|
|
59
|
+
*
|
|
60
|
+
* Show the question with a `Dialog` or `OptionSheet` rendered inside this
|
|
61
|
+
* sheet's children (a second native modal beside the sheet's own does not
|
|
62
|
+
* present on iOS), and resolve a Promise from its buttons. While a Promise
|
|
63
|
+
* is pending, further dismissals are ignored, so it must settle. A rejected
|
|
64
|
+
* Promise leaves the sheet open and surfaces as an unhandled rejection.
|
|
65
|
+
*
|
|
66
|
+
* `ref.close()`, `useBottomSheet().close` and a controlled `index={-1}` are
|
|
67
|
+
* the app's own decision (a Save button, say) and never ask.
|
|
68
|
+
*/
|
|
69
|
+
confirmDismiss?: () => boolean | Promise<boolean>;
|
|
52
70
|
/**
|
|
53
71
|
* Wrap `children` in a vertical ScrollView sized to the space between header
|
|
54
72
|
* and footer. Off by default; a plain View then holds the content. The sheet
|
|
@@ -130,7 +148,19 @@ export interface BottomSheetProps {
|
|
|
130
148
|
export interface BottomSheetRef {
|
|
131
149
|
expand: (index?: number) => void;
|
|
132
150
|
collapse: () => void;
|
|
133
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Closes without asking `confirmDismiss`. Resolves once the close has
|
|
153
|
+
* finished (when `onAfterClose` fires); resolves at once on a sheet that is
|
|
154
|
+
* not open, and when a reopen overtakes the close or the sheet unmounts.
|
|
155
|
+
*/
|
|
156
|
+
close: () => Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Closes the way a drag or the scrim would: asks `confirmDismiss` first.
|
|
159
|
+
* Resolves `true` once the sheet has closed (or was not open), `false` when
|
|
160
|
+
* the dismissal was refused, ignored while another is being decided, or
|
|
161
|
+
* overtaken by a reopen or unmount.
|
|
162
|
+
*/
|
|
163
|
+
requestClose: () => Promise<boolean>;
|
|
134
164
|
}
|
|
135
165
|
/**
|
|
136
166
|
* State + actions exposed to anything rendered inside a `<BottomSheet>` —
|
|
@@ -148,7 +178,8 @@ export interface BottomSheetContextValue {
|
|
|
148
178
|
snapPoints: number[];
|
|
149
179
|
expand: (index?: number) => void;
|
|
150
180
|
collapse: () => void;
|
|
151
|
-
close: () => void
|
|
181
|
+
close: () => Promise<void>;
|
|
182
|
+
requestClose: () => Promise<boolean>;
|
|
152
183
|
}
|
|
153
184
|
/**
|
|
154
185
|
* Access the enclosing `<BottomSheet>`'s state and imperative actions.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export type { BottomSheetContextValue, BottomSheetPresentation, BottomSheetProps, BottomSheetRef, SnapPoint } from './BottomSheet';
|
|
2
2
|
export { BottomSheet, default, useBottomSheet } from './BottomSheet';
|
|
3
|
+
export type { SheetSwap, SheetSwapOptions } from './useSheetSwap';
|
|
4
|
+
export { useSheetSwap } from './useSheetSwap';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { BottomSheetRef } from './BottomSheet';
|
|
3
|
+
export interface SheetSwapOptions {
|
|
4
|
+
/** Snap index the next sheet opens at. Defaults to its first snap point. */
|
|
5
|
+
index?: number;
|
|
6
|
+
/** Ask the first sheet's `confirmDismiss` before closing it. Off by default (the app chose to swap). */
|
|
7
|
+
confirm?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type SheetSwap = (from: RefObject<BottomSheetRef | null>, to: RefObject<BottomSheetRef | null>, options?: SheetSwapOptions) => Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Replaces one bottom sheet with another: closes `from`, waits until it is
|
|
12
|
+
* fully gone (on iOS, until its native modal window is dismissed, which UIKit
|
|
13
|
+
* needs before it presents another), then opens `to`. One sheet is on screen
|
|
14
|
+
* at a time and there is no window where both are mounted.
|
|
15
|
+
*
|
|
16
|
+
* Resolves `true` once `to` has been asked to open, `false` when nothing was
|
|
17
|
+
* swapped: the close was refused or overtaken by a reopen (`confirm: true`),
|
|
18
|
+
* the component unmounted, `to` is not mounted, or another swap is running.
|
|
19
|
+
*
|
|
20
|
+
* const swap = useSheetSwap();
|
|
21
|
+
* swap(listRef, detailRef, { index: 1 });
|
|
22
|
+
*/
|
|
23
|
+
export declare const useSheetSwap: () => SheetSwap;
|
|
24
|
+
//# sourceMappingURL=useSheetSwap.d.ts.map
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { GestureResponderEvent, ImageSourcePropType, PressableProps, View as RNView, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { ColorPalette, GradientDefinition } from '../../theme/types';
|
|
4
4
|
import type { HapticType } from '../../utils/hapticUtils';
|
|
5
|
+
import type { ContextMenuConfig } from '../Menu/useContextMenu';
|
|
5
6
|
export type CardVariant = 'elevated' | 'outlined' | 'filled' | 'flat';
|
|
6
7
|
/** A text action in the card header, drawn with a 44 pt hit target. */
|
|
7
8
|
export interface CardTextAction {
|
|
@@ -71,6 +72,14 @@ export interface CardProps extends Omit<PressableProps, 'style' | 'children'> {
|
|
|
71
72
|
onPress?: (event: GestureResponderEvent) => void;
|
|
72
73
|
/** Haptic feedback for interactions. Pass false to disable; pass a HapticType to override the default. */
|
|
73
74
|
haptic?: HapticType | false;
|
|
75
|
+
/**
|
|
76
|
+
* A long-press menu. Long press (right-click or Shift+F10 on the web) lifts
|
|
77
|
+
* the card over a dimmed screen with the menu beside it, and every item is
|
|
78
|
+
* also a screen reader action on the card. Unavailable items are hidden
|
|
79
|
+
* unless `unavailable: 'disable'`. The menu takes the long press: an
|
|
80
|
+
* `onLongPress` passed beside it is not called.
|
|
81
|
+
*/
|
|
82
|
+
contextMenu?: ContextMenuConfig;
|
|
74
83
|
accessibilityLabel?: string;
|
|
75
84
|
style?: StyleProp<ViewStyle>;
|
|
76
85
|
/** Alias for `style` — applied to the outer card element. */
|