@webority/mobile-ui 0.156.0 → 0.158.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/canvas-kit.json +1 -1
- package/dist/canvas-kit/kit.js +5 -5
- package/dist/canvas-kit/manifest.json +17 -12
- package/dist/canvas-kit/release.json +7 -7
- package/lib/commonjs/components/AppBar/AppBar.js +1 -1
- package/lib/commonjs/components/AppIcon/AppIcon.js +1 -1
- package/lib/commonjs/components/AppIcon/index.js +1 -1
- package/lib/commonjs/components/Banner/Banner.js +1 -1
- package/lib/commonjs/components/BarChart/BarChart.js +1 -1
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/commonjs/components/Button/Button.js +1 -1
- package/lib/commonjs/components/Button/index.js +1 -1
- package/lib/commonjs/components/Carousel/Carousel.js +1 -1
- package/lib/commonjs/components/Checkbox/Checkbox.js +1 -1
- package/lib/commonjs/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/commonjs/components/Confetti/Confetti.js +1 -1
- package/lib/commonjs/components/Drawer/Drawer.js +1 -1
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +1 -1
- package/lib/commonjs/components/NonModalBottomSheet/NonModalBottomSheet.js +1 -1
- package/lib/commonjs/components/NumberInput/NumberInput.js +1 -1
- package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
- package/lib/commonjs/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +1 -1
- package/lib/commonjs/components/Radio/Radio.js +1 -1
- package/lib/commonjs/components/Radio/RadioGroup.js +1 -1
- package/lib/commonjs/components/Rating/Rating.js +1 -1
- package/lib/commonjs/components/SearchBar/SearchBar.js +1 -1
- package/lib/commonjs/components/SearchBar/useRecentSearches.js +1 -1
- package/lib/commonjs/components/Skeleton/Skeleton.js +1 -1
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +1 -1
- package/lib/commonjs/components/Skeleton/SkeletonList.js +1 -1
- package/lib/commonjs/components/Slider/valueText.js +1 -1
- package/lib/commonjs/components/Stepper/Stepper.js +1 -1
- package/lib/commonjs/components/TagInput/TagInput.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/Tooltip/Tooltip.js +1 -1
- package/lib/commonjs/hooks/useControllableState.js +1 -1
- package/lib/commonjs/icons.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/module/components/AppBar/AppBar.js +1 -1
- package/lib/module/components/AppIcon/AppIcon.js +1 -1
- package/lib/module/components/AppIcon/index.js +1 -1
- package/lib/module/components/Banner/Banner.js +1 -1
- package/lib/module/components/BarChart/BarChart.js +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/module/components/Button/Button.js +1 -1
- package/lib/module/components/Button/index.js +1 -1
- package/lib/module/components/Carousel/Carousel.js +1 -1
- package/lib/module/components/Checkbox/Checkbox.js +1 -1
- package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/lib/module/components/Confetti/Confetti.js +1 -1
- package/lib/module/components/Drawer/Drawer.js +1 -1
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/module/components/MessageList/MessageList.js +1 -1
- package/lib/module/components/NonModalBottomSheet/NonModalBottomSheet.js +1 -1
- package/lib/module/components/NumberInput/NumberInput.js +1 -1
- package/lib/module/components/OTPInput/OTPInput.js +1 -1
- package/lib/module/components/ProfilePicker/ProfilePicker.js +1 -1
- package/lib/module/components/ProgressBar/ProgressBar.js +1 -1
- package/lib/module/components/Radio/Radio.js +1 -1
- package/lib/module/components/Radio/RadioGroup.js +1 -1
- package/lib/module/components/Rating/Rating.js +1 -1
- package/lib/module/components/SearchBar/SearchBar.js +1 -1
- package/lib/module/components/SearchBar/useRecentSearches.js +1 -1
- package/lib/module/components/Skeleton/Skeleton.js +1 -1
- package/lib/module/components/Skeleton/SkeletonContent.js +1 -1
- package/lib/module/components/Skeleton/SkeletonList.js +1 -1
- package/lib/module/components/Slider/valueText.js +1 -1
- package/lib/module/components/Stepper/Stepper.js +1 -1
- package/lib/module/components/TagInput/TagInput.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/Tooltip/Tooltip.js +1 -1
- package/lib/module/hooks/useControllableState.js +1 -1
- package/lib/module/icons.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/typescript/commonjs/components/AppIcon/AppIcon.d.ts +2 -0
- package/lib/typescript/commonjs/components/AppIcon/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/Button/Button.d.ts +4 -0
- package/lib/typescript/commonjs/components/Button/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +7 -4
- package/lib/typescript/commonjs/components/ChoiceGroup/ChoiceGroup.d.ts +14 -6
- package/lib/typescript/commonjs/components/FieldBase/ChoiceText.d.ts +6 -5
- package/lib/typescript/commonjs/components/FilePicker/FilePicker.d.ts +2 -2
- package/lib/typescript/commonjs/components/ProfilePicker/ProfilePicker.d.ts +15 -9
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +7 -4
- package/lib/typescript/commonjs/components/Radio/RadioGroup.d.ts +5 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +4 -4
- package/lib/typescript/commonjs/hooks/useControllableState.d.ts +23 -8
- package/lib/typescript/commonjs/icons.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -1
- package/lib/typescript/module/components/AppIcon/AppIcon.d.ts +2 -0
- package/lib/typescript/module/components/AppIcon/index.d.ts +1 -1
- package/lib/typescript/module/components/Button/Button.d.ts +4 -0
- package/lib/typescript/module/components/Button/index.d.ts +1 -1
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +7 -4
- package/lib/typescript/module/components/ChoiceGroup/ChoiceGroup.d.ts +14 -6
- package/lib/typescript/module/components/FieldBase/ChoiceText.d.ts +6 -5
- package/lib/typescript/module/components/FilePicker/FilePicker.d.ts +2 -2
- package/lib/typescript/module/components/ProfilePicker/ProfilePicker.d.ts +15 -9
- package/lib/typescript/module/components/Radio/Radio.d.ts +7 -4
- package/lib/typescript/module/components/Radio/RadioGroup.d.ts +5 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +4 -4
- package/lib/typescript/module/hooks/useControllableState.d.ts +23 -8
- package/lib/typescript/module/icons.d.ts +1 -1
- package/lib/typescript/module/index.d.ts +2 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,Pressable,StyleSheet,View}from"react-native";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{hitSlopMarker}from"../../utils/hitSlop.js";import{nativeDriver}from"../../utils/nativeDriver.js";import{Skeleton}from"../Skeleton/index.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_STEPPER_LABELS=Object.freeze({step:(e,t,s,i)=>`Step ${e} of ${t}, ${s}, ${i}`,statusComplete:"complete",statusActive:"active",statusUpcoming:"upcoming",progressStep:(e,t)=>`Progress: step ${e} of ${t}`,progressDone:(e,t)=>`Progress: ${e} of ${t} steps done`,captionStep:(e,t,s)=>`Step ${e} of ${t}${s?` · ${s}`:""}`,captionDone:(e,t)=>`${e} of ${t} done`});const CIRCLE_SIZE=24,SEGMENT_HEIGHT=4,PULSE_SIZE=32,PULSE_DURATION=1100,toneColorFor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;case"primary":return e.colors.primary}},toneOnColorFor=(e,t)=>{switch(t){case"success":return e.colors["on-success"];case"warning":return e.colors["on-warning"];case"danger":return e.colors["on-danger"];case"info":return e.colors["on-info"];case"neutral":return e.colors["on-neutral"];case"primary":return e.colors["on-primary"]}},statusWordFor=(e,t)=>{switch(t){case"complete":return e.statusComplete;case"active":return e.statusActive;case"upcoming":return e.statusUpcoming}},StepCircle=({index:e,step:t,status:s,toneColor:i,upcomingColor:o,upcomingFillColor:r,textOnColor:l,upcomingTextColor:n,interactive:a,canPress:c,totalSteps:p,onPress:u,pulseEnabled:d,labels:m,circleStyles:h,circleSlotStyle:g})=>{const y="active"===s,b=useTheme(),x=useRef(createAnimatedValue(1)).current,S=useRef(createAnimatedValue(.5)).current;useEffect(()=>{if(!y||!d)return x.setValue(1),void S.setValue(0);const e=Animated.loop(Animated.parallel([Animated.sequence([Animated.timing(x,{toValue:1.4,duration:1100,easing:Easing.out(Easing.ease),useNativeDriver:nativeDriver}),Animated.timing(x,{toValue:1,duration:0,useNativeDriver:nativeDriver})]),Animated.sequence([Animated.timing(S,{toValue:0,duration:1100,easing:Easing.out(Easing.ease),useNativeDriver:nativeDriver}),Animated.timing(S,{toValue:.5,duration:0,useNativeDriver:nativeDriver})])]));return e.start(),()=>e.stop()},[y,x,S,d]);const v="upcoming"===s?r:i,f="upcoming"===s?o:i,w="upcoming"===s?n:l,C="complete"===s,j=m.step(e+1,p,t.label,statusWordFor(m,s)),_=_jsxs(View,{style:h.relative,children:[y&&d?_jsx(Animated.View,{pointerEvents:"none",style:[h.pulse,{width:32,height:32,borderRadius:b.radius.pill,...smoothCorners,backgroundColor:i,opacity:S,transform:[{scale:x}]}]}):null,_jsx(View,{style:[h.circle,{width:24,height:24,borderRadius:b.radius.pill,...smoothCorners,backgroundColor:v,borderColor:f},g],children:t.icon?t.icon:_jsx(Text,C?{variant:"bodySmall",weight:"semibold",style:[h.glyph,{color:w}],children:"✓"}:{variant:"bodySmall",weight:"semibold",style:[h.glyph,{color:w}],children:e+1})})]});return a?_jsx(Pressable,{onPress:()=>u(e),disabled:!c,accessibilityRole:"button",accessibilityLabel:j,accessibilityState:{selected:y,disabled:!c},"aria-selected":y,"aria-disabled":!c,hitSlop:8,...hitSlopMarker(8),children:_}):_jsx(View,{accessibilityRole:"text",accessibilityLabel:j,accessibilityState:{selected:y},"aria-selected":y,children:_})},buildCircleStyles=()=>StyleSheet.create({relative:{alignItems:"center",justifyContent:"center"},pulse:{position:"absolute"},circle:{borderWidth:2,alignItems:"center",justifyContent:"center"},glyph:{includeFontPadding:!1}}),StepperRoot=forwardRef((e,t)=>{const{steps:s,activeStep:i,defaultActiveStep:o=0,pressMode:r="none",onStepPress:l,onActiveStepChange:n,variant:a="horizontal",tone:c="primary",formatCaption:p,showCaption:u=!0,loading:d=!1,labels:m,accessibilityLabel:h,style:g,containerStyle:y,circleStyle:b,labelStyle:x,connectorStyle:S,haptic:v,testID:f}=e;assertValidValue("Stepper","variant",e.variant,["horizontal","vertical","segmented"]),assertValidValue("Stepper","tone",e.tone,["primary","success","warning","danger","info","neutral"]),assertValidValue("Stepper","pressMode",e.pressMode,["none","back","select"]);const w=useMemo(()=>({...DEFAULT_STEPPER_LABELS,...m}),[m]),C=useTheme(),j=C.settings.components.stepper?.pulseAnimation??!1,_=resolveHaptic(v,"selection"),V=useMemo(()=>buildStyles(C),[C]),k=useMemo(()=>buildCircleStyles(),[]),R=toneColorFor(C,c),D=C.colors.border,A=C.colors.bg,E=C.colors["text-muted"],L=toneOnColorFor(C,c),T=s.length,I="none"!==r,P=void 0!==i,[F,$]=useState(o),M=P?i:F,B=null==M||M<0?null:M,statusOf=e=>null===B?"upcoming":e<B?"complete":e===B?"active":"upcoming",O=s.map((e,t)=>statusOf(t)),N=O.filter(e=>"upcoming"!==e).length,U=O.filter(e=>"complete"===e).length,canPressStatus=e=>"back"===r?"complete"===e:I,handleStepPress=e=>{if(!canPressStatus(statusOf(e)))return;_&&triggerHaptic(_),l?.(e);const t="select"===r&&e===B?null:e;P||$(t),n?.(t)},H=useRef(createAnimatedValue(N)).current,z=useRef(N);useEffect(()=>{const e=z.current;if(e===N)return;z.current=N;const t=Animated.timing(H,{toValue:N,duration:C.motion.duration.default*Math.abs(N-e),easing:Easing.linear,useNativeDriver:!1});return t.start(),()=>t.stop()},[N,H,C.motion]);const sliceOf=e=>H.interpolate({inputRange:[e,e+1],outputRange:["0%","100%"],extrapolate:"clamp"}),W=T<=1?"0%":H.interpolate({inputRange:[1,T],outputRange:["0%","100%"],extrapolate:"clamp"}),G=null!==B&&B<T?B:null,q=h??(null!==G?w.progressStep(G+1,T):w.progressDone(U,T)),[Z,J]=useState(0),K=T>0&&Z>0?Z/(2*T):0,Q=_jsx(View,{ref:t,style:[V.container,y,g],testID:f,accessibilityRole:"progressbar",accessibilityLabel:q,accessibilityValue:{min:0,max:T,now:N},children:"segmented"===a?(()=>{const e=null!==G?s[G]:void 0,t=u?p?p(G,T,e):null!==G?w.captionStep(G+1,T,e?.label):w.captionDone(U,T):"";return _jsxs(View,{children:[u?_jsx(Text,{variant:"bodySmall",style:[V.sCaption,{marginBottom:C.space.sm},x],numberOfLines:1,children:t}):null,_jsx(View,{style:V.sRow,children:s.map((e,t)=>{const s=statusOf(t),i=w.step(t+1,T,e.label,statusWordFor(w,s)),o=_jsx(View,{testID:f?`${f}-segment-${t}`:void 0,style:[V.sTrack,{backgroundColor:D},S],children:_jsx(Animated.View,{style:[V.sFill,{backgroundColor:R,width:sliceOf(t)}]})});if(I){const r=canPressStatus(s);return _jsx(Pressable,{style:V.sItem,onPress:()=>handleStepPress(t),disabled:!r,accessibilityRole:"button",accessibilityLabel:i,accessibilityState:{selected:"active"===s,disabled:!r},"aria-selected":"active"===s,"aria-disabled":!r,hitSlop:{top:12,bottom:12},...hitSlopMarker({top:12,bottom:12}),children:o},e.key)}return _jsx(View,{style:V.sItem,accessibilityRole:"text",accessibilityLabel:i,accessibilityState:{selected:"active"===s},"aria-selected":"active"===s,children:o},e.key)})})]})})():"vertical"===a?_jsx(View,{style:V.vCol,children:s.map((e,t)=>{const s=statusOf(t),i=t===T-1;return _jsxs(View,{style:V.vRow,children:[_jsxs(View,{style:V.vLeft,children:[_jsx(StepCircle,{index:t,step:e,status:s,toneColor:R,upcomingColor:D,upcomingFillColor:A,onPressColor:R,textOnColor:L,upcomingTextColor:E,interactive:I,canPress:canPressStatus(s),totalSteps:T,onPress:handleStepPress,pulseEnabled:j,labels:w,circleStyles:k,circleSlotStyle:b}),i?null:_jsxs(View,{style:[V.vConnectorContainer,S],children:[_jsx(View,{style:[V.vConnectorTrack,{backgroundColor:D}]}),_jsx(Animated.View,{style:[V.vConnectorFill,{backgroundColor:R,height:sliceOf(t+1)}]})]})]}),_jsxs(View,{style:V.vBody,children:[_jsx(Text,{variant:"body",weight:"semibold",style:[V.vLabel,{color:"upcoming"===s?C.colors["text-subtle"]:C.colors["text-body"]},x],numberOfLines:1,children:e?.label??" "}),e.description?_jsx(Text,{variant:"bodySmall",style:V.vDescription,numberOfLines:3,children:e.description}):null]})]},e.key)})}):_jsxs(View,{style:V.hRow,onLayout:e=>J(e.nativeEvent.layout.width),children:[_jsxs(View,{pointerEvents:"none",style:[V.hConnectorContainer,{left:K,right:K},S],children:[_jsx(View,{style:[V.hConnectorTrack,{backgroundColor:D}]}),_jsx(Animated.View,{style:[V.hConnectorFill,{backgroundColor:R,width:W}]})]}),s.map((e,t)=>{const s=statusOf(t);return _jsxs(View,{style:V.hStepItem,children:[_jsx(StepCircle,{index:t,step:e,status:s,toneColor:R,upcomingColor:D,upcomingFillColor:A,onPressColor:R,textOnColor:L,upcomingTextColor:E,interactive:I,canPress:canPressStatus(s),totalSteps:T,onPress:handleStepPress,pulseEnabled:j,labels:w,circleStyles:k,circleSlotStyle:b}),_jsx(Text,{variant:"caption",style:[V.hLabel,{color:"upcoming"===s?C.colors["text-subtle"]:C.colors["text-body"]},x],numberOfLines:1,children:e?.label??" "})]},e.key)})]})});return d?_jsx(StepperSkeleton,{...e}):Q});StepperRoot.displayName="Stepper";const StepperSkeleton=({steps:e,variant:t="horizontal",showCaption:s=!0,containerStyle:i,style:o,testID:r})=>{const l=useTheme(),n=useMemo(()=>buildStyles(l),[l]),a=useMemo(()=>buildSkeletonStyles(l),[l]),c=e.length||3;return"segmented"===t?_jsxs(View,{style:[n.container,i,o],testID:r,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[s?_jsx(Skeleton,{shape:"text",width:"45%",height:14,style:{marginBottom:l.space.sm}}):null,_jsx(View,{style:n.sRow,children:Array.from({length:c}).map((e,t)=>_jsx(View,{style:n.sItem,children:_jsx(Skeleton,{width:"100%",height:4,radius:"pill"})},`sk-step-${t}`))})]}):_jsx(View,"vertical"===t?{style:[n.container,i,o],testID:r,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:_jsx(View,{style:a.vCol,children:Array.from({length:c}).map((e,t)=>{const s=t===c-1;return _jsxs(View,{style:a.vRow,children:[_jsxs(View,{style:[a.vLeft,{width:32}],children:[_jsx(Skeleton,{shape:"circle",width:24,height:24}),s?null:_jsx(Skeleton,{width:2,height:36})]}),_jsxs(View,{style:a.vBody,children:[_jsx(Skeleton,{shape:"text",width:"55%",height:16,style:{marginBottom:l.space.xs}}),_jsx(Skeleton,{shape:"text",width:"80%",height:12})]})]},`sk-step-${t}`)})})}:{style:[n.container,i,o],testID:r,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:_jsxs(View,{style:n.hRow,children:[_jsx(View,{pointerEvents:"none",style:[n.hConnectorContainer,{left:50/c+"%",right:50/c+"%"}],children:_jsx(Skeleton,{width:"100%",height:2,radius:"pill"})}),Array.from({length:c}).map((e,t)=>_jsxs(View,{style:n.hStepItem,children:[_jsx(Skeleton,{shape:"circle",width:24,height:24}),_jsx(Skeleton,{shape:"text",width:"80%",height:12,style:{marginTop:l.space.xs}})]},`sk-step-${t}`))]})})};StepperSkeleton.displayName="StepperSkeleton";const Stepper=Object.assign(StepperRoot,{Skeleton:StepperSkeleton}),buildSkeletonStyles=e=>StyleSheet.create({vCol:{flexDirection:"column"},vRow:{flexDirection:"row",alignItems:"flex-start"},vLeft:{alignItems:"center"},vBody:{flex:1,paddingLeft:e.space.md,paddingBottom:e.space.lg}}),buildStyles=e=>StyleSheet.create({container:{width:"100%"},hRow:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",position:"relative"},hConnectorContainer:{position:"absolute",top:11,height:2,flexDirection:"row",alignItems:"center"},hConnectorTrack:{position:"absolute",left:0,right:0,height:2,borderRadius:e.radius.pill,...smoothCorners},hConnectorFill:{position:"absolute",left:0,height:2,borderRadius:e.radius.pill,...smoothCorners},hStepItem:{alignItems:"center",flex:1},hLabel:{marginTop:e.space.xs,textAlign:"center"},vCol:{flexDirection:"column"},vRow:{flexDirection:"row",alignItems:"flex-start"},vLeft:{alignItems:"center",alignSelf:"stretch",width:32},vConnectorContainer:{flex:1,width:2,minHeight:32,position:"relative",alignSelf:"center"},vConnectorTrack:{position:"absolute",top:0,bottom:0,width:2,borderRadius:e.radius.pill,...smoothCorners},vConnectorFill:{position:"absolute",top:0,width:2,borderRadius:e.radius.pill,...smoothCorners},vBody:{flex:1,paddingLeft:e.space.sm,paddingBottom:e.space.md},vLabel:{marginBottom:e.space.xxs},vDescription:{},sCaption:{includeFontPadding:!1},sRow:{flexDirection:"row",columnGap:e.space.xs},sItem:{flex:1},sTrack:{height:4,borderRadius:e.radius.pill,overflow:"hidden"},sFill:{height:4,borderRadius:e.radius.pill}});export{Stepper};export default Stepper;
|
|
1
|
+
"use strict";import{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,Pressable,StyleSheet,View}from"react-native";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{hitSlopMarker}from"../../utils/hitSlop.js";import{nativeDriver}from"../../utils/nativeDriver.js";import{Skeleton}from"../Skeleton/index.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_STEPPER_LABELS=Object.freeze({step:(e,t,s,i)=>`Step ${e} of ${t}, ${s}, ${i}`,statusComplete:"complete",statusActive:"active",statusUpcoming:"upcoming",progressStep:(e,t)=>`Progress: step ${e} of ${t}`,progressDone:(e,t)=>`Progress: ${e} of ${t} steps done`,captionStep:(e,t,s)=>`Step ${e} of ${t}${s?` · ${s}`:""}`,captionDone:(e,t)=>`${e} of ${t} done`});const CIRCLE_SIZE=24,SEGMENT_HEIGHT=4,PULSE_SIZE=32,PULSE_DURATION=1100,toneColorFor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors.neutral;case"primary":return e.colors.primary}},toneOnColorFor=(e,t)=>{switch(t){case"success":return e.colors["on-success"];case"warning":return e.colors["on-warning"];case"danger":return e.colors["on-danger"];case"info":return e.colors["on-info"];case"neutral":return e.colors["on-neutral"];case"primary":return e.colors["on-primary"]}},statusWordFor=(e,t)=>{switch(t){case"complete":return e.statusComplete;case"active":return e.statusActive;case"upcoming":return e.statusUpcoming}},StepCircle=({index:e,step:t,status:s,toneColor:i,upcomingColor:o,upcomingFillColor:r,textOnColor:l,upcomingTextColor:n,interactive:a,canPress:c,totalSteps:p,onPress:u,pulseEnabled:d,labels:m,circleStyles:h,circleSlotStyle:g})=>{const y="active"===s,b=useTheme(),x=useRef(createAnimatedValue(1)).current,S=useRef(createAnimatedValue(.5)).current;useEffect(()=>{if(!y||!d)return x.setValue(1),void S.setValue(0);const e=Animated.loop(Animated.parallel([Animated.sequence([Animated.timing(x,{toValue:1.4,duration:1100,easing:Easing.out(Easing.ease),useNativeDriver:nativeDriver}),Animated.timing(x,{toValue:1,duration:0,useNativeDriver:nativeDriver})]),Animated.sequence([Animated.timing(S,{toValue:0,duration:1100,easing:Easing.out(Easing.ease),useNativeDriver:nativeDriver}),Animated.timing(S,{toValue:.5,duration:0,useNativeDriver:nativeDriver})])]));return e.start(),()=>e.stop()},[y,x,S,d]);const v="upcoming"===s?r:i,w="upcoming"===s?o:i,f="upcoming"===s?n:l,C="complete"===s,j=m.step(e+1,p,t.label,statusWordFor(m,s)),_=_jsxs(View,{style:h.relative,children:[y&&d?_jsx(Animated.View,{pointerEvents:"none",style:[h.pulse,{width:32,height:32,borderRadius:b.radius.pill,...smoothCorners,backgroundColor:i,opacity:S,transform:[{scale:x}]}]}):null,_jsx(View,{style:[h.circle,{width:24,height:24,borderRadius:b.radius.pill,...smoothCorners,backgroundColor:v,borderColor:w},g],children:t.icon?t.icon:_jsx(Text,C?{variant:"bodySmall",weight:"semibold",style:[h.glyph,{color:f}],children:"✓"}:{variant:"bodySmall",weight:"semibold",style:[h.glyph,{color:f}],children:e+1})})]});return a?_jsx(Pressable,{onPress:()=>u(e),disabled:!c,accessibilityRole:"button",accessibilityLabel:j,accessibilityState:{selected:y,disabled:!c},"aria-selected":y,"aria-disabled":!c,hitSlop:8,...hitSlopMarker(8),children:_}):_jsx(View,{accessibilityRole:"text",accessibilityLabel:j,accessibilityState:{selected:y},"aria-selected":y,children:_})},buildCircleStyles=()=>StyleSheet.create({relative:{alignItems:"center",justifyContent:"center"},pulse:{position:"absolute"},circle:{borderWidth:2,alignItems:"center",justifyContent:"center"},glyph:{includeFontPadding:!1}}),StepperRoot=forwardRef((e,t)=>{const{steps:s,activeStep:i,defaultActiveStep:o=0,pressMode:r="none",onStepPress:l,onActiveStepChange:n,variant:a="horizontal",tone:c="primary",formatCaption:p,showCaption:u=!0,loading:d=!1,labels:m,accessibilityLabel:h,style:g,containerStyle:y,circleStyle:b,labelStyle:x,connectorStyle:S,haptic:v,testID:w}=e;assertValidValue("Stepper","variant",e.variant,["horizontal","vertical","segmented"]),assertValidValue("Stepper","tone",e.tone,["primary","success","warning","danger","info","neutral"]),assertValidValue("Stepper","pressMode",e.pressMode,["none","back","select"]);const f=useMemo(()=>({...DEFAULT_STEPPER_LABELS,...m}),[m]),C=useTheme(),j=C.settings.components.stepper?.pulseAnimation??!1,_=resolveHaptic(v,"selection"),V=useMemo(()=>buildStyles(C),[C]),k=useMemo(()=>buildCircleStyles(),[]),R=toneColorFor(C,c),D=C.colors.border,E=C.colors.bg,A=C.colors["text-muted"],L=toneOnColorFor(C,c),T=s.length,I="none"!==r,P=void 0!==i,[F,$]=useState(o),M=P?i:F,B=null==M||M<0?null:M,statusOf=e=>null===B?"upcoming":e<B?"complete":e===B?"active":"upcoming",O=s.map((e,t)=>statusOf(t)),N=O.filter(e=>"upcoming"!==e).length,U=O.filter(e=>"complete"===e).length,canPressStatus=e=>"back"===r?"complete"===e:I,handleStepPress=e=>{if(!canPressStatus(statusOf(e)))return;_&&triggerHaptic(_),l?.(e);const t="select"===r&&e===B?null:e;P||$(t),n?.(t)},H=useRef(createAnimatedValue(N)).current,z=useRef(N);useEffect(()=>{const e=z.current;if(e===N)return;z.current=N;const t=Animated.timing(H,{toValue:N,duration:C.motion.duration.default*Math.abs(N-e),easing:Easing.linear,useNativeDriver:!1});return t.start(),()=>t.stop()},[N,H,C.motion]);const sliceOf=e=>H.interpolate({inputRange:[e,e+1],outputRange:["0%","100%"],extrapolate:"clamp"}),W=T<=1?"0%":H.interpolate({inputRange:[1,T],outputRange:["0%","100%"],extrapolate:"clamp"}),G=null!==B&&B<T?B:null,q=h??(null!==G?f.progressStep(G+1,T):f.progressDone(U,T)),[Z,J]=useState(0),K=T>0&&Z>0?Z/(2*T):0,Q=_jsx(View,{ref:t,style:[V.container,y,g],testID:w,accessibilityRole:"progressbar",accessibilityLabel:q,accessibilityValue:{min:0,max:T,now:N},children:"segmented"===a?(()=>{const e=null!==G?s[G]:void 0,t=u?p?p(G,T,e):null!==G?f.captionStep(G+1,T,e?.label):f.captionDone(U,T):"";return _jsxs(View,{children:[u?_jsx(Text,{variant:"bodySmall",style:[V.sCaption,{marginBottom:C.space.sm},x],numberOfLines:1,children:t}):null,_jsx(View,{style:V.sRow,children:s.map((e,t)=>{const s=statusOf(t),i=f.step(t+1,T,e.label,statusWordFor(f,s)),o=_jsx(View,{testID:w?`${w}-segment-${t}`:void 0,style:[V.sTrack,{backgroundColor:D},S],children:_jsx(Animated.View,{style:[V.sFill,{backgroundColor:R,width:sliceOf(t)}]})});if(I){const r=canPressStatus(s);return _jsx(Pressable,{style:V.sItem,onPress:()=>handleStepPress(t),disabled:!r,accessibilityRole:"button",accessibilityLabel:i,accessibilityState:{selected:"active"===s,disabled:!r},"aria-selected":"active"===s,"aria-disabled":!r,hitSlop:{top:12,bottom:12},...hitSlopMarker({top:12,bottom:12}),children:o},e.key)}return _jsx(View,{style:V.sItem,accessibilityRole:"text",accessibilityLabel:i,accessibilityState:{selected:"active"===s},"aria-selected":"active"===s,children:o},e.key)})})]})})():"vertical"===a?_jsx(View,{style:V.vCol,children:s.map((e,t)=>{const s=statusOf(t),i=t===T-1;return _jsxs(View,{style:V.vRow,children:[_jsxs(View,{style:V.vLeft,children:[_jsx(StepCircle,{index:t,step:e,status:s,toneColor:R,upcomingColor:D,upcomingFillColor:E,onPressColor:R,textOnColor:L,upcomingTextColor:A,interactive:I,canPress:canPressStatus(s),totalSteps:T,onPress:handleStepPress,pulseEnabled:j,labels:f,circleStyles:k,circleSlotStyle:b}),i?null:_jsxs(View,{style:[V.vConnectorContainer,S],children:[_jsx(View,{style:[V.vConnectorTrack,{backgroundColor:D}]}),_jsx(Animated.View,{style:[V.vConnectorFill,{backgroundColor:R,height:sliceOf(t+1)}]})]})]}),_jsxs(View,{style:V.vBody,children:[_jsx(Text,{variant:"body",weight:"semibold",style:[V.vLabel,{color:"upcoming"===s?C.colors["text-subtle"]:C.colors["text-body"]},x],numberOfLines:1,children:e?.label??" "}),e.description?_jsx(Text,{variant:"bodySmall",style:V.vDescription,numberOfLines:3,children:e.description}):null]})]},e.key)})}):_jsxs(View,{style:V.hRow,onLayout:e=>J(e.nativeEvent.layout.width),children:[_jsxs(View,{pointerEvents:"none",style:[V.hConnectorContainer,{left:K,right:K},S],children:[_jsx(View,{style:[V.hConnectorTrack,{backgroundColor:D}]}),_jsx(Animated.View,{style:[V.hConnectorFill,{backgroundColor:R,width:W}]})]}),s.map((e,t)=>{const s=statusOf(t);return _jsxs(View,{style:V.hStepItem,children:[_jsx(StepCircle,{index:t,step:e,status:s,toneColor:R,upcomingColor:D,upcomingFillColor:E,onPressColor:R,textOnColor:L,upcomingTextColor:A,interactive:I,canPress:canPressStatus(s),totalSteps:T,onPress:handleStepPress,pulseEnabled:j,labels:f,circleStyles:k,circleSlotStyle:b}),_jsx(Text,{variant:"caption",style:[V.hLabel,{color:"upcoming"===s?C.colors["text-subtle"]:C.colors["text-body"]},x],numberOfLines:1,children:e?.label??" "})]},e.key)})]})});return d?_jsx(StepperSkeleton,{...e}):Q});StepperRoot.displayName="Stepper";const StepperSkeleton=({steps:e,variant:t="horizontal",showCaption:s=!0,containerStyle:i,style:o,testID:r})=>{const l=useTheme(),n=useMemo(()=>buildStyles(l),[l]),a=useMemo(()=>buildSkeletonStyles(l),[l]),c=e.length||3,p=useMemo(()=>Array.from({length:c},(e,t)=>({key:`sk-step-${t}`,index:t})),[c]);return"segmented"===t?_jsxs(View,{style:[n.container,i,o],testID:r,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[s?_jsx(Skeleton,{shape:"text",width:"45%",height:14,style:{marginBottom:l.space.sm}}):null,_jsx(View,{style:n.sRow,children:p.map(e=>_jsx(View,{style:n.sItem,children:_jsx(Skeleton,{width:"100%",height:4,radius:"pill"})},e.key))})]}):_jsx(View,"vertical"===t?{style:[n.container,i,o],testID:r,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:_jsx(View,{style:a.vCol,children:p.map(e=>{const t=e.index===c-1;return _jsxs(View,{style:a.vRow,children:[_jsxs(View,{style:[a.vLeft,{width:32}],children:[_jsx(Skeleton,{shape:"circle",width:24,height:24}),t?null:_jsx(Skeleton,{width:2,height:36})]}),_jsxs(View,{style:a.vBody,children:[_jsx(Skeleton,{shape:"text",width:"55%",height:16,style:{marginBottom:l.space.xs}}),_jsx(Skeleton,{shape:"text",width:"80%",height:12})]})]},e.key)})})}:{style:[n.container,i,o],testID:r,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:_jsxs(View,{style:n.hRow,children:[_jsx(View,{pointerEvents:"none",style:[n.hConnectorContainer,{left:50/c+"%",right:50/c+"%"}],children:_jsx(Skeleton,{width:"100%",height:2,radius:"pill"})}),p.map(e=>_jsxs(View,{style:n.hStepItem,children:[_jsx(Skeleton,{shape:"circle",width:24,height:24}),_jsx(Skeleton,{shape:"text",width:"80%",height:12,style:{marginTop:l.space.xs}})]},e.key))]})})};StepperSkeleton.displayName="StepperSkeleton";const Stepper=Object.assign(StepperRoot,{Skeleton:StepperSkeleton}),buildSkeletonStyles=e=>StyleSheet.create({vCol:{flexDirection:"column"},vRow:{flexDirection:"row",alignItems:"flex-start"},vLeft:{alignItems:"center"},vBody:{flex:1,paddingLeft:e.space.md,paddingBottom:e.space.lg}}),buildStyles=e=>StyleSheet.create({container:{width:"100%"},hRow:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",position:"relative"},hConnectorContainer:{position:"absolute",top:11,height:2,flexDirection:"row",alignItems:"center"},hConnectorTrack:{position:"absolute",left:0,right:0,height:2,borderRadius:e.radius.pill,...smoothCorners},hConnectorFill:{position:"absolute",left:0,height:2,borderRadius:e.radius.pill,...smoothCorners},hStepItem:{alignItems:"center",flex:1},hLabel:{marginTop:e.space.xs,textAlign:"center"},vCol:{flexDirection:"column"},vRow:{flexDirection:"row",alignItems:"flex-start"},vLeft:{alignItems:"center",alignSelf:"stretch",width:32},vConnectorContainer:{flex:1,width:2,minHeight:32,position:"relative",alignSelf:"center"},vConnectorTrack:{position:"absolute",top:0,bottom:0,width:2,borderRadius:e.radius.pill,...smoothCorners},vConnectorFill:{position:"absolute",top:0,width:2,borderRadius:e.radius.pill,...smoothCorners},vBody:{flex:1,paddingLeft:e.space.sm,paddingBottom:e.space.md},vLabel:{marginBottom:e.space.xxs},vDescription:{},sCaption:{includeFontPadding:!1},sRow:{flexDirection:"row",columnGap:e.space.xs},sItem:{flex:1},sTrack:{height:4,borderRadius:e.radius.pill,overflow:"hidden"},sFill:{height:4,borderRadius:e.radius.pill}});export{Stepper};export default Stepper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{forwardRef,useCallback,useMemo,useRef,useState}from"react";import{StyleSheet,TextInput,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{fontFor,useTheme}from"../../theme/index.js";import{mergeRefs,resolveHaptic,triggerHaptic}from"../../utils/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{Chip}from"../Chip/index.js";import{FieldBase,FieldLabel,FieldMessage,hasFieldText,RequiredPlaceholder}from"../FieldBase/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const TagInput=forwardRef((e,t)=>{const{value:s,defaultValue:l,onChange:
|
|
1
|
+
"use strict";import{forwardRef,useCallback,useMemo,useRef,useState}from"react";import{StyleSheet,TextInput,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{fontFor,useTheme}from"../../theme/index.js";import{mergeRefs,resolveHaptic,triggerHaptic}from"../../utils/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{Chip}from"../Chip/index.js";import{FieldBase,FieldLabel,FieldMessage,hasFieldText,RequiredPlaceholder}from"../FieldBase/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const TagInput=forwardRef((e,t)=>{const{value:s,defaultValue:l,onChange:a,placeholder:r,label:i,helperText:o,error:n,required:u,disabled:d=!1,size:c="md",variant:p,maxTags:m,unique:x=!0,transform:f,separators:g=[","],haptic:h,onFocus:b,style:j,testID:y}=e;assertValidValue("TagInput","size",e.size,["sm","md","lg"]),assertValidValue("TagInput","variant",e.variant,["outline","filled","underline"]);const v=useTheme(),C=useMemo(()=>buildStyles(v),[v]),[T,S]=useControllableState({value:s,defaultValue:l??[],onChange:a}),[F,V]=useState(""),[w,k]=useState(!1),I=useRef(null),z=useMemo(()=>mergeRefs(I,t),[t]),_=useCallback(()=>{d||I.current?.focus()},[d]),R="number"==typeof m&&T.length>=m,B=!0===n||hasFieldText(n),H=u&&!i&&0===T.length&&0===F.length&&Boolean(r),M=useCallback(e=>{const t=f?f(e.trim()):e.trim();if(!t)return;if(R)return;if(x&&T.some(e=>e.toLowerCase()===t.toLowerCase()))return void V("");S([...T,t]),V("");const s=resolveHaptic(h,"selection");s&&triggerHaptic(s)},[R,h,S,T,f,x]),q=useCallback(e=>{const t=T.filter((t,s)=>s!==e);S(t);const s=resolveHaptic(h,"selection");s&&triggerHaptic(s)},[h,S,T]),L=useCallback(e=>{const t=g.find(t=>t.length>0&&e.includes(t));t?M(e.slice(0,e.indexOf(t))):V(e)},[M,g]),D=useCallback(e=>{d||"Backspace"===e.nativeEvent.key&&""===F&&T.length>0&&q(T.length-1)},[d,F,q,T.length]),P=useMemo(()=>T.map((e,t)=>({key:`${e}-${t}`,tag:e,index:t})),[T]),$=_jsx(FieldBase,{size:c,variant:p,focused:w,disabled:d,error:B,filled:T.length>0||F.length>0,onPress:_,pressFeedback:!1,style:j,children:_jsxs(View,{style:C.wrap,children:[P.map(({key:e,tag:t,index:s})=>_jsx(Chip,{label:t,size:"sm",onRemove:d?void 0:()=>q(s),haptic:h},e)),_jsxs(View,{style:C.inputBox,children:[_jsx(TextInput,{ref:z,value:F,onChangeText:L,onKeyPress:D,onSubmitEditing:()=>M(F),onFocus:e=>{k(!0),b?.(e)},onBlur:()=>{k(!1),M(F)},editable:!d&&!R,placeholder:R||H?void 0:r,placeholderTextColor:v.colors["text-subtle"],blurOnSubmit:!1,returnKeyType:"done",accessibilityLabel:i??r,style:[C.input,{color:v.colors["text-body"],fontSize:v.text.base.size}],testID:y?`${y}-input`:void 0}),H?_jsx(RequiredPlaceholder,{text:r??"",color:v.colors["text-subtle"],fontSize:v.text.base.size,weightStyle:fontFor(v,"normal")}):null]})]})});return _jsxs(View,{testID:y,children:[i?_jsx(FieldLabel,{size:c,required:u,children:i}):null,$,_jsx(FieldMessage,{size:c,error:B,text:B?n:o})]})});TagInput.displayName="TagInput";const buildStyles=e=>StyleSheet.create({wrap:{flex:1,flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:e.space.xs,paddingVertical:e.space.xs},inputBox:{flexGrow:1,minWidth:80},input:{...fontFor(e,"normal"),padding:e.space.none}});export default TagInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback,useEffect,useMemo,useState}from"react";import{StyleSheet,View}from"react-native";import{useTheme}from"../../theme/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import Button from"../Button/Button.js";import{Modal}from"../Modal/index.js";import{PickerTrigger}from"../PickerTrigger/PickerTrigger.js";import{Text}from"../Text/index.js";import{WheelPicker}from"../WheelPicker/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export const DEFAULT_TIME_PICKER_LABELS=Object.freeze({title:"Select Time",confirm:"Confirm",cancel:"Cancel",selected:e=>`Selected ${e}`,hour:"Hour",minute:"Minute",period:"Period",hourItem:e=>`Hour ${e}`,minuteItem:e=>`${e} minutes`,cancelHint:"Dismiss without changes",confirmHint:"Confirm selected time"});const range=(e,t,i=1)=>{const r=[];for(let a=e;a<=t;a+=i)r.push(a);return r},pad2=e=>e.toString().padStart(2,"0"),to24h=(e,t,i)=>"24h"===i?e:"AM"===t?12===e?0:e:12===e?12:e+12,from24h=(e,t)=>"24h"===t?{displayHour:e,period:"AM"}:0===e?{displayHour:12,period:"AM"}:12===e?{displayHour:12,period:"PM"}:e>12?{displayHour:e-12,period:"PM"}:{displayHour:e,period:"AM"},clampMinuteToStep=(e,t)=>{const i=Math.round(e/t)*t;return Math.min(59,Math.max(0,i))},TimePicker=e=>{const{open:t,value:i,onChange:r,onClose:a,format:s="12h",minuteStep:l=1,labels:o,testID:n,style:
|
|
1
|
+
"use strict";import{useCallback,useEffect,useMemo,useState}from"react";import{StyleSheet,View}from"react-native";import{useTheme}from"../../theme/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import Button from"../Button/Button.js";import{Modal}from"../Modal/index.js";import{PickerTrigger}from"../PickerTrigger/PickerTrigger.js";import{Text}from"../Text/index.js";import{WheelPicker}from"../WheelPicker/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export const DEFAULT_TIME_PICKER_LABELS=Object.freeze({title:"Select Time",confirm:"Confirm",cancel:"Cancel",selected:e=>`Selected ${e}`,hour:"Hour",minute:"Minute",period:"Period",hourItem:e=>`Hour ${e}`,minuteItem:e=>`${e} minutes`,cancelHint:"Dismiss without changes",confirmHint:"Confirm selected time"});const range=(e,t,i=1)=>{const r=[];for(let a=e;a<=t;a+=i)r.push(a);return r},pad2=e=>e.toString().padStart(2,"0"),to24h=(e,t,i)=>"24h"===i?e:"AM"===t?12===e?0:e:12===e?12:e+12,from24h=(e,t)=>"24h"===t?{displayHour:e,period:"AM"}:0===e?{displayHour:12,period:"AM"}:12===e?{displayHour:12,period:"PM"}:e>12?{displayHour:e-12,period:"PM"}:{displayHour:e,period:"AM"},clampMinuteToStep=(e,t)=>{const i=Math.round(e/t)*t;return Math.min(59,Math.max(0,i))},TimePicker=e=>{const{open:t,value:i,onChange:r,onClose:a,format:s="12h",minuteStep:l=1,labels:o,testID:n,style:m,containerStyle:u,headerLabelStyle:c,footerButtonStyle:p,formatValue:d,haptic:h,triggerLabels:g,label:b,help:f,placeholder:y,helperText:M,error:x,required:S,disabled:k,size:T,variant:P,clearable:j,onClear:v,leftIcon:H,trailing:I,triggerStyle:_,valueStyle:C,labelStyle:D,messageStyle:V,accessibilityLabel:L}=e,B={label:b,help:f,placeholder:y,helperText:M,error:x,required:S,disabled:k,size:T,variant:P,clearable:j,onClear:v,leftIcon:H,trailing:I,triggerStyle:_,valueStyle:C,labelStyle:D,messageStyle:V,accessibilityLabel:L};assertValidValue("TimePicker","format",e.format,["12h","24h"]),assertValidValue("TimePicker","minuteStep",e.minuteStep?.toString(),["1","5","15","30"]),assertValidValue("TimePicker","size",e.size,["sm","md","lg"]),assertValidValue("TimePicker","variant",e.variant,["outline","filled","underline"]);const $=useMemo(()=>({...DEFAULT_TIME_PICKER_LABELS,...o}),[o]),w=void 0!==t,[A,F]=useState(!1),E=w?t:A,N=w?n:n?`${n}-modal`:void 0,O=useTheme(),z=useMemo(()=>buildStyles(O),[O]),W=useCallback(()=>{w?a?.():F(!1)},[w,a]),R=useMemo(()=>"24h"===s?range(0,23):range(1,12),[s]),U=useMemo(()=>range(0,59,l),[l]),q=useMemo(()=>["AM","PM"],[]),K=useMemo(()=>{const e=i&&Number.isFinite(i.hour)?i.hour:(new Date).getHours(),t=i&&Number.isFinite(i.minute)?i.minute:(new Date).getMinutes(),r=clampMinuteToStep(t,l),{displayHour:a,period:o}=from24h(e,s);return{displayHour:a,minute:r,period:o,hour24:e}},[i,s,l]),[G,J]=useState(()=>{const e=R.indexOf(K.displayHour);return Math.max(e,0)}),[Q,X]=useState(()=>{const e=U.indexOf(K.minute);return Math.max(e,0)}),[Y,Z]=useState(()=>"PM"===K.period?1:0);useEffect(()=>{if(!E)return;const e=i&&Number.isFinite(i.hour)?i.hour:(new Date).getHours(),t=i&&Number.isFinite(i.minute)?i.minute:(new Date).getMinutes(),r=clampMinuteToStep(t,l),{displayHour:a,period:o}=from24h(e,s),n=R.indexOf(a);J(Math.max(n,0));const m=U.indexOf(r);X(Math.max(m,0)),Z("PM"===o?1:0)},[E,i,s,l,R,U]);const ee=useCallback((e,t)=>{"hour"===e?J(Math.max(0,R.indexOf(Number(t)))):"minute"===e?X(Math.max(0,U.indexOf(Number(t)))):Z("PM"===t?1:0)},[R,U]),te=useCallback(()=>{!1!==h&&triggerHaptic("selection"),W()},[W,h]),ie=useCallback(()=>{const e=R[G]??0,t=q[Y]??"AM",i=to24h(e,t,s),a=U[Q]??0;!1!==h&&triggerHaptic("notificationSuccess"),r?.({hour:i,minute:a}),W()},[R,G,q,Y,U,Q,s,r,W,h]),re=useMemo(()=>{const e=R[G]??0,t=U[Q]??0;if("24h"===s)return`${pad2(e)}:${pad2(t)}`;const i=q[Y]??"AM";return`${pad2(e)}:${pad2(t)} ${i}`},[R,G,U,Q,q,Y,s]),ae=useMemo(()=>R.map(e=>({value:e,label:pad2(e),accessibilityLabel:$.hourItem(e)})),[R,$]),se=useMemo(()=>U.map(e=>({value:e,label:pad2(e),accessibilityLabel:$.minuteItem(e)})),[U,$]),le=useMemo(()=>q.map(e=>({value:e,label:e})),[q]),oe=useMemo(()=>{const e=[{key:"hour",label:$.hour,items:ae,value:R[G]??0,separator:":",testID:"time-picker-hour"},{key:"minute",label:$.minute,items:se,value:U[Q]??0,gapAfter:"12h"===s?O.space.md:void 0,testID:"time-picker-minute"}];return"12h"===s&&e.push({key:"period",label:$.period,items:le,value:q[Y]??"AM",testID:"time-picker-period"}),e},[ae,se,le,R,G,U,Q,q,Y,s,O.space.md,$]),ne=useCallback(e=>{if("24h"===s)return`${pad2(e.hour)}:${pad2(e.minute)}`;const{displayHour:t,period:i}=from24h(e.hour,"12h");return`${t}:${pad2(e.minute)} ${i}`},[s]),me=!w&&i&&Number.isFinite(i.hour)&&Number.isFinite(i.minute)?(d??ne)(i):void 0,ue=_jsxs(Modal,{open:E,onClose:W,presentation:"bottom",accessibilityLabel:$.title,haptic:h,contentStyle:[u,m],testID:N,children:[_jsx(Text,{variant:"title",align:"center",accessibilityRole:"header",style:[z.title,c],children:$.title}),_jsx(View,{style:z.summaryWrap,accessibilityLiveRegion:"polite",accessibilityLabel:$.selected(re),children:_jsx(Text,{variant:"h2",weight:"bold",color:"brand",style:z.summary,children:re})}),_jsx(WheelPicker,{columns:oe,onChange:ee,haptic:h,style:z.wheels}),_jsxs(View,{style:z.footer,children:[_jsx(Button,{label:$.cancel,haptic:!1,variant:"ghost",tone:"neutral",onPress:te,style:[z.footerBtn,p],accessibilityHint:$.cancelHint,testID:"time-picker-cancel"}),_jsx(Button,{label:$.confirm,variant:"solid",tone:"primary",haptic:!1,onPress:ie,style:[z.footerBtn,p],accessibilityHint:$.confirmHint,testID:"time-picker-confirm"})]})]});return w?ue:_jsxs(_Fragment,{children:[_jsx(PickerTrigger,{...B,labels:g,value:me,onPress:()=>F(!0),testID:n}),ue]})},buildStyles=e=>StyleSheet.create({title:{marginBottom:e.space.sm},summaryWrap:{alignItems:"center",marginBottom:e.space.md},summary:{letterSpacing:e["letter-spacing"].wide},wheels:{marginBottom:e.space.lg},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:e.space.sm},footerBtn:{paddingHorizontal:e.space.lg}});export{TimePicker};export default TimePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,PanResponder,Platform,Pressable,StyleSheet,View}from"react-native";import{usePresenceMotion}from"../../hooks/usePresenceMotion.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{smoothCorners}from"../../utils/corners.js";import{hitSlopMarker}from"../../utils/hitSlop.js";import{nativeDriver}from"../../utils/nativeDriver.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_TOAST_LABELS=Object.freeze({dismiss:"Dismiss",undo:"Undo",seconds:e=>`${e} seconds`});const SWIPE_DISMISS_THRESHOLD=80,SWIPE_VELOCITY_THRESHOLD=.5,STACK_OFFSET=8,STACK_SCALE_STEP=.04,DEFAULT_AUTO_DISMISS_MS=3e3,WEB_ACTION_MIN_DURATION_MS=8e3,COUNTDOWN_BAR_HEIGHT=3,ACTION_HIT_SLOP={top:10,bottom:10,left:10,right:10},Toast=({toast:e,index:t,onClose:i,shownAt:n,runtime:a})=>{const s=useTheme(),r=usePresenceMotion(),o=r.duration("fast");assertValidValue("Toast","tone",e.tone,["primary","success","warning","danger","info","neutral"]),assertValidValue("Toast","position",e.position,["top","bottom"]);const l=e.tone??"neutral",c=e.position??"bottom",u=a?.labels??DEFAULT_TOAST_LABELS,d=useMemo(()=>[{name:"dismiss",label:u.dismiss}],[u]),m=useMemo(()=>buildStyles(s),[s]),p=useMemo(()=>tintFor(s,l),[s,l]),g=useMemo(()=>inkFor(s,l),[s,l]),h=s.components.toast["icon-circle-size"],v=s.text[s.components.toast["icon-glyph-text"]].size,f=s.components.toast["tint-bar-width"],b=s.settings.components.toast?.defaultDurationMs??3e3,x=s.settings.components.toast?.enableSwipeDismiss??!0,A="top"===c?-120:120,y=useRef(createAnimatedValue(r.reduced?0:A)).current,w=useRef(createAnimatedValue(0)).current,D=useRef(createAnimatedValue(0)).current,S=useRef(!1),T="top"===c?8*t:8*-t,V=Math.max(1-.04*t,.9),M=useRef(createAnimatedValue(T)).current;useEffect(()=>{setNativeValue(M,T)},[T,M]);const _=useMemo(()=>Animated.add(y,M),[y,M]),R=void 0!==e.action,C=e.duration??b,E=C>0&&R&&"web"===Platform.OS?Math.max(C,8e3):C,N=E<=0||R&&!0===a?.screenReaderOn,j=!0===e.countdown&&!N,P=useRef(createAnimatedValue(1)).current,O=useRef({initialised:!1,timer:null,remaining:0,startedAt:0}),k=useRef({touch:!1,pan:!1,hover:!1}),L=useRef(()=>{}),I=useRef({id:e.id,totalMs:E,shownAt:n,runtime:a,persistent:N,animateBar:!1});I.current={id:e.id,totalMs:E,shownAt:n,runtime:a,persistent:N,animateBar:j&&!r.reduced};const B=useCallback(()=>{const e=O.current,t=I.current,i=k.current;if(!e.initialised){e.initialised=!0;const i=t.runtime?.readRemaining(t.id),n=void 0===t.shownAt?0:Date.now()-t.shownAt;e.remaining=i??(t.totalMs>0?Math.max(t.totalMs-n,0):0),t.totalMs>0&&e.remaining<t.totalMs&&setNativeValue(P,e.remaining/t.totalMs)}const n=!(t.persistent||S.current||i.touch||i.pan||i.hover);n&&null===e.timer?(e.startedAt=Date.now(),e.timer=setTimeout(()=>{e.timer=null,e.remaining=0,L.current()},e.remaining),t.animateBar&&Animated.timing(P,{toValue:0,duration:e.remaining,easing:Easing.linear,useNativeDriver:nativeDriver}).start()):n||null===e.timer||(clearTimeout(e.timer),e.timer=null,e.remaining=Math.max(e.remaining-(Date.now()-e.startedAt),0),P.stopAnimation())},[P]),dismiss=()=>{if(S.current)return;S.current=!0,B();const t=[Animated.timing(D,{toValue:0,duration:o,easing:Easing.bezier(...s.motion.ease.accelerate),useNativeDriver:nativeDriver})];r.reduced||t.push(Animated.timing(y,{toValue:A,duration:s.motion.duration.fast,easing:Easing.bezier(...s.motion.ease.accelerate),useNativeDriver:nativeDriver})),Animated.parallel(t).start(()=>i(e.id))};L.current=dismiss,useEffect(()=>{const e=r.reduced?Animated.timing(D,{toValue:1,duration:o,useNativeDriver:nativeDriver}):Animated.parallel([Animated.spring(y,{toValue:0,damping:18,stiffness:180,mass:1,useNativeDriver:nativeDriver}),Animated.timing(D,{toValue:1,duration:o,useNativeDriver:nativeDriver})]);return e.start(),()=>e.stop()},[]),useEffect(()=>{B()},[N,B]),useEffect(()=>()=>{const e=O.current,t=I.current;null!==e.timer&&(clearTimeout(e.timer),e.timer=null,e.remaining=Math.max(e.remaining-(Date.now()-e.startedAt),0)),P.stopAnimation(),e.initialised&&t.totalMs>0&&!S.current&&t.runtime?.writeRemaining(t.id,e.remaining)},[P]);const H=useCallback((e,t)=>{k.current[e]=t,B()},[B]),F=useCallback(()=>H("touch",!0),[H]),z=useCallback(e=>H("touch",(e.nativeEvent.touches?.length??0)>0),[H]),U=useCallback(()=>H("hover",!0),[H]),$=useCallback(()=>H("hover",!1),[H]),G=useMemo(()=>PanResponder.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>Math.abs(t.dy)&&Math.abs(t.dx)>6,onPanResponderGrant:()=>H("pan",!0),onPanResponderMove:(e,t)=>{setNativeValue(w,t.dx);const i=1-.7*Math.min(Math.abs(t.dx)/200,1);setNativeValue(D,i)},onPanResponderTerminate:()=>{if(H("pan",!1),r.reduced)return setNativeValue(w,0),void Animated.timing(D,{toValue:1,duration:o,useNativeDriver:nativeDriver}).start();Animated.parallel([Animated.spring(w,{toValue:0,damping:s.motion.spring.snappy.damping,stiffness:s.motion.spring.snappy.stiffness,mass:s.motion.spring.snappy.mass,useNativeDriver:nativeDriver}),Animated.timing(D,{toValue:1,duration:o,useNativeDriver:nativeDriver})]).start()},onPanResponderRelease:(t,n)=>{if(Math.abs(n.dx)>80||Math.abs(n.vx)>.5){const t=n.dx>=0?1:-1;S.current=!0,H("pan",!1);const a=[Animated.timing(D,{toValue:0,duration:o,useNativeDriver:nativeDriver})];r.reduced||a.push(Animated.timing(w,{toValue:500*t,duration:s.motion.duration.fast,useNativeDriver:nativeDriver})),Animated.parallel(a).start(()=>i(e.id))}else H("pan",!1),r.reduced?(setNativeValue(w,0),Animated.timing(D,{toValue:1,duration:o,useNativeDriver:nativeDriver}).start()):Animated.parallel([Animated.spring(w,{toValue:0,useNativeDriver:nativeDriver}),Animated.spring(D,{toValue:1,useNativeDriver:nativeDriver})]).start()}}),[w,D,H,o,r.reduced,s.motion.duration.fast,s.motion.spring.snappy.damping,s.motion.spring.snappy.stiffness,s.motion.spring.snappy.mass,i,e.id]),W={accessibilityActions:d,onAccessibilityAction:e=>{"dismiss"===e.nativeEvent.actionName&&dismiss()}},[K,X]=useState(0),Y=useMemo(()=>P.interpolate({inputRange:[0,1],outputRange:[-K,0]}),[P,K]),q=e.description?`${e.message}. ${e.description}`:e.message,J=e.action&&j?`${e.action.label}, ${u.seconds(Math.ceil(E/1e3))}`:e.action?.label;return _jsxs(Animated.View,{...x?G.panHandlers:{},...R?{}:{accessible:!0,...W},..."web"===Platform.OS?{onPointerEnter:U,onPointerLeave:$}:{},onTouchStart:F,onTouchEnd:z,onTouchCancel:z,accessibilityLabel:q,testID:e.testID,style:[m.container,{backgroundColor:s.colors.surface,borderRadius:s.radius.lg,...smoothCorners,padding:s.space.md,...s.shadow.elevated,opacity:D,transform:[{translateY:_},{translateX:w},{scale:V}]},e.style],children:[f>0?_jsx(View,{style:[m.tintBar,{width:f,backgroundColor:p}]}):null,_jsxs(View,{style:m.row,children:[(()=>{if(e.icon)return e.icon;const t=defaultGlyph(l);return t?_jsx(View,{style:[m.iconCircle,{width:h,height:h,borderRadius:s.radius.pill,...smoothCorners,backgroundColor:`${p}22`},e.iconCircleStyle],children:_jsx(Text,{variant:"body",style:[m.iconGlyph,{color:g,fontSize:v}],accessible:!1,children:t})}):null})(),_jsxs(View,{style:m.textBlock,children:[_jsx(Text,{variant:"body",weight:"semibold",style:[e.textStyle,e.messageStyle],numberOfLines:2,children:e.message}),e.description?_jsx(Text,{variant:"bodySmall",style:m.description,numberOfLines:3,children:e.description}):null]}),e.action?_jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:J,hitSlop:ACTION_HIT_SLOP,...hitSlopMarker(ACTION_HIT_SLOP),...W,onPress:()=>{e.action?.onPress(),dismiss()},style:({pressed:t})=>[m.actionBtn,{backgroundColor:t?s.colors["surface-pressed"]:"transparent"},e.actionButtonStyle],children:_jsx(Text,{variant:"bodySmall",weight:"semibold",style:{color:p},numberOfLines:1,children:e.action.label})}):null]}),j?_jsxs(View,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onLayout:e=>X(e.nativeEvent.layout.width),testID:"toast-countdown",style:[m.countdownTrack,{backgroundColor:`${p}22`}],children:[r.reduced?_jsx(View,{style:[m.countdownFill,{backgroundColor:p}]}):null,!r.reduced&&K>0?_jsx(Animated.View,{style:[m.countdownFill,{backgroundColor:p,transform:[{translateX:Y}]}]}):null]}):null]})},tintFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"success":return e.colors.success;case"danger":return e.colors.danger;case"warning":return e.colors.warning;case"info":return e.colors.info;case"neutral":return e.colors["text-body"]}},inkFor=(e,t)=>{switch(t){case"primary":return e.colors["primary-text"];case"success":return e.colors["success-text"];case"danger":return e.colors["danger-text"];case"warning":return e.colors["warning-text"];case"info":return e.colors["info-text"];case"neutral":return e.colors["text-body"]}},defaultGlyph=e=>{switch(e){case"success":return"✓";case"danger":return"×";case"warning":return"!";case"info":return"i";case"primary":case"neutral":return""}},buildStyles=e=>StyleSheet.create({container:{overflow:"hidden",marginVertical:e.space.xs},tintBar:{position:"absolute",left:0,top:0,bottom:0},row:{flexDirection:"row",alignItems:"center",paddingLeft:e.space.sm},iconCircle:{alignItems:"center",justifyContent:"center",marginRight:e.space.md},iconGlyph:{fontWeight:"700",lineHeight:Math.round(e.text[e.components.toast["icon-glyph-text"]].size*e.leading.heading)},textBlock:{flex:1,paddingRight:e.space.sm},description:{marginTop:e.space.xxs},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:e.space.sm,paddingVertical:e.space.xs,minHeight:e.components.toast["action-min-height"],borderRadius:e.radius.md,...smoothCorners,marginLeft:e.space.sm}});export{Toast};export default Toast;
|
|
1
|
+
"use strict";import{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,PanResponder,Platform,Pressable,StyleSheet,View}from"react-native";import{usePresenceMotion}from"../../hooks/usePresenceMotion.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{smoothCorners}from"../../utils/corners.js";import{hitSlopMarker}from"../../utils/hitSlop.js";import{nativeDriver}from"../../utils/nativeDriver.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const DEFAULT_TOAST_LABELS=Object.freeze({dismiss:"Dismiss",undo:"Undo",seconds:e=>`${e} seconds`});const SWIPE_DISMISS_THRESHOLD=80,SWIPE_VELOCITY_THRESHOLD=.5,STACK_OFFSET=8,STACK_SCALE_STEP=.04,DEFAULT_AUTO_DISMISS_MS=3e3,WEB_ACTION_MIN_DURATION_MS=8e3,COUNTDOWN_BAR_HEIGHT=3,ACTION_HIT_SLOP={top:10,bottom:10,left:10,right:10},Toast=({toast:e,index:t,onClose:i,shownAt:n,runtime:a})=>{const r=useTheme(),s=usePresenceMotion(),o=s.duration("fast");assertValidValue("Toast","tone",e.tone,["primary","success","warning","danger","info","neutral"]),assertValidValue("Toast","position",e.position,["top","bottom"]);const l=e.tone??"neutral",c=e.position??"bottom",u=a?.labels??DEFAULT_TOAST_LABELS,d=useMemo(()=>[{name:"dismiss",label:u.dismiss}],[u]),m=useMemo(()=>buildStyles(r),[r]),p=useMemo(()=>tintFor(r,l),[r,l]),g=useMemo(()=>inkFor(r,l),[r,l]),h=r.components.toast["icon-circle-size"],v=r.text[r.components.toast["icon-glyph-text"]].size,f=r.components.toast["tint-bar-width"],b=r.settings.components.toast?.defaultDurationMs??3e3,x=r.settings.components.toast?.enableSwipeDismiss??!0,A="top"===c?-120:120,y=useRef(createAnimatedValue(s.reduced?0:A)).current,w=useRef(createAnimatedValue(0)).current,D=useRef(createAnimatedValue(0)).current,S=useRef(!1),T="top"===c?8*t:8*-t,M=Math.max(1-.04*t,.9),V=useRef(createAnimatedValue(T)).current;useEffect(()=>{setNativeValue(V,T)},[T,V]);const _=useMemo(()=>Animated.add(y,V),[y,V]),R=void 0!==e.action,C=e.duration??b,E=C>0&&R&&"web"===Platform.OS?Math.max(C,8e3):C,N=E<=0||R&&!0===a?.screenReaderOn,j=!0===e.countdown&&!N,P=useRef(createAnimatedValue(1)).current,O=useRef({initialised:!1,timer:null,remaining:0,startedAt:0}),k=useRef({touch:!1,pan:!1,hover:!1}),L=useRef(()=>{}),I=useRef({id:e.id,totalMs:E,shownAt:n,runtime:a,persistent:N,animateBar:!1});I.current={id:e.id,totalMs:E,shownAt:n,runtime:a,persistent:N,animateBar:j&&!s.reduced};const B=useCallback(()=>{const e=O.current,t=I.current,i=k.current;if(!e.initialised){e.initialised=!0;const i=t.runtime?.readRemaining(t.id),n=void 0===t.shownAt?0:Date.now()-t.shownAt;e.remaining=i??(t.totalMs>0?Math.max(t.totalMs-n,0):0),t.totalMs>0&&e.remaining<t.totalMs&&setNativeValue(P,e.remaining/t.totalMs)}const n=!(t.persistent||S.current||i.touch||i.pan||i.hover);n&&null===e.timer?(e.startedAt=Date.now(),e.timer=setTimeout(()=>{e.timer=null,e.remaining=0,L.current()},e.remaining),t.animateBar&&Animated.timing(P,{toValue:0,duration:e.remaining,easing:Easing.linear,useNativeDriver:nativeDriver}).start()):n||null===e.timer||(clearTimeout(e.timer),e.timer=null,e.remaining=Math.max(e.remaining-(Date.now()-e.startedAt),0),P.stopAnimation())},[P]),dismiss=()=>{if(S.current)return;S.current=!0,B();const t=[Animated.timing(D,{toValue:0,duration:o,easing:Easing.bezier(...r.motion.ease.accelerate),useNativeDriver:nativeDriver})];s.reduced||t.push(Animated.timing(y,{toValue:A,duration:r.motion.duration.fast,easing:Easing.bezier(...r.motion.ease.accelerate),useNativeDriver:nativeDriver})),Animated.parallel(t).start(()=>i(e.id))};L.current=dismiss;const H=useRef({reduced:s.reduced,fadeMs:o});H.current={reduced:s.reduced,fadeMs:o},useEffect(()=>{const e=H.current,t=e.reduced?Animated.timing(D,{toValue:1,duration:e.fadeMs,useNativeDriver:nativeDriver}):Animated.parallel([Animated.spring(y,{toValue:0,damping:18,stiffness:180,mass:1,useNativeDriver:nativeDriver}),Animated.timing(D,{toValue:1,duration:e.fadeMs,useNativeDriver:nativeDriver})]);return t.start(),()=>t.stop()},[D,y]),useEffect(()=>{B()},[N,B]),useEffect(()=>()=>{const e=O.current,t=I.current;null!==e.timer&&(clearTimeout(e.timer),e.timer=null,e.remaining=Math.max(e.remaining-(Date.now()-e.startedAt),0)),P.stopAnimation(),e.initialised&&t.totalMs>0&&!S.current&&t.runtime?.writeRemaining(t.id,e.remaining)},[P]);const F=useCallback((e,t)=>{k.current[e]=t,B()},[B]),z=useCallback(()=>F("touch",!0),[F]),U=useCallback(e=>F("touch",(e.nativeEvent.touches?.length??0)>0),[F]),$=useCallback(()=>F("hover",!0),[F]),G=useCallback(()=>F("hover",!1),[F]),W=useMemo(()=>PanResponder.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>Math.abs(t.dy)&&Math.abs(t.dx)>6,onPanResponderGrant:()=>F("pan",!0),onPanResponderMove:(e,t)=>{setNativeValue(w,t.dx);const i=1-.7*Math.min(Math.abs(t.dx)/200,1);setNativeValue(D,i)},onPanResponderTerminate:()=>{if(F("pan",!1),s.reduced)return setNativeValue(w,0),void Animated.timing(D,{toValue:1,duration:o,useNativeDriver:nativeDriver}).start();Animated.parallel([Animated.spring(w,{toValue:0,damping:r.motion.spring.snappy.damping,stiffness:r.motion.spring.snappy.stiffness,mass:r.motion.spring.snappy.mass,useNativeDriver:nativeDriver}),Animated.timing(D,{toValue:1,duration:o,useNativeDriver:nativeDriver})]).start()},onPanResponderRelease:(t,n)=>{if(Math.abs(n.dx)>80||Math.abs(n.vx)>.5){const t=n.dx>=0?1:-1;S.current=!0,F("pan",!1);const a=[Animated.timing(D,{toValue:0,duration:o,useNativeDriver:nativeDriver})];s.reduced||a.push(Animated.timing(w,{toValue:500*t,duration:r.motion.duration.fast,useNativeDriver:nativeDriver})),Animated.parallel(a).start(()=>i(e.id))}else F("pan",!1),s.reduced?(setNativeValue(w,0),Animated.timing(D,{toValue:1,duration:o,useNativeDriver:nativeDriver}).start()):Animated.parallel([Animated.spring(w,{toValue:0,useNativeDriver:nativeDriver}),Animated.spring(D,{toValue:1,useNativeDriver:nativeDriver})]).start()}}),[w,D,F,o,s.reduced,r.motion.duration.fast,r.motion.spring.snappy.damping,r.motion.spring.snappy.stiffness,r.motion.spring.snappy.mass,i,e.id]),K={accessibilityActions:d,onAccessibilityAction:e=>{"dismiss"===e.nativeEvent.actionName&&dismiss()}},[X,Y]=useState(0),q=useMemo(()=>P.interpolate({inputRange:[0,1],outputRange:[-X,0]}),[P,X]),J=e.description?`${e.message}. ${e.description}`:e.message,Q=e.action&&j?`${e.action.label}, ${u.seconds(Math.ceil(E/1e3))}`:e.action?.label;return _jsxs(Animated.View,{...x?W.panHandlers:{},...R?{}:{accessible:!0,...K},..."web"===Platform.OS?{onPointerEnter:$,onPointerLeave:G}:{},onTouchStart:z,onTouchEnd:U,onTouchCancel:U,accessibilityLabel:J,testID:e.testID,style:[m.container,{backgroundColor:r.colors.surface,borderRadius:r.radius.lg,...smoothCorners,padding:r.space.md,...r.shadow.elevated,opacity:D,transform:[{translateY:_},{translateX:w},{scale:M}]},e.style],children:[f>0?_jsx(View,{style:[m.tintBar,{width:f,backgroundColor:p}]}):null,_jsxs(View,{style:m.row,children:[(()=>{if(e.icon)return e.icon;const t=defaultGlyph(l);return t?_jsx(View,{style:[m.iconCircle,{width:h,height:h,borderRadius:r.radius.pill,...smoothCorners,backgroundColor:`${p}22`},e.iconCircleStyle],children:_jsx(Text,{variant:"body",style:[m.iconGlyph,{color:g,fontSize:v}],accessible:!1,children:t})}):null})(),_jsxs(View,{style:m.textBlock,children:[_jsx(Text,{variant:"body",weight:"semibold",style:[e.textStyle,e.messageStyle],numberOfLines:2,children:e.message}),e.description?_jsx(Text,{variant:"bodySmall",style:m.description,numberOfLines:3,children:e.description}):null]}),e.action?_jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:Q,hitSlop:ACTION_HIT_SLOP,...hitSlopMarker(ACTION_HIT_SLOP),...K,onPress:()=>{e.action?.onPress(),dismiss()},style:({pressed:t})=>[m.actionBtn,{backgroundColor:t?r.colors["surface-pressed"]:"transparent"},e.actionButtonStyle],children:_jsx(Text,{variant:"bodySmall",weight:"semibold",style:{color:p},numberOfLines:1,children:e.action.label})}):null]}),j?_jsxs(View,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",onLayout:e=>Y(e.nativeEvent.layout.width),testID:"toast-countdown",style:[m.countdownTrack,{backgroundColor:`${p}22`}],children:[s.reduced?_jsx(View,{style:[m.countdownFill,{backgroundColor:p}]}):null,!s.reduced&&X>0?_jsx(Animated.View,{style:[m.countdownFill,{backgroundColor:p,transform:[{translateX:q}]}]}):null]}):null]})},tintFor=(e,t)=>{switch(t){case"primary":return e.colors.primary;case"success":return e.colors.success;case"danger":return e.colors.danger;case"warning":return e.colors.warning;case"info":return e.colors.info;case"neutral":return e.colors["text-body"]}},inkFor=(e,t)=>{switch(t){case"primary":return e.colors["primary-text"];case"success":return e.colors["success-text"];case"danger":return e.colors["danger-text"];case"warning":return e.colors["warning-text"];case"info":return e.colors["info-text"];case"neutral":return e.colors["text-body"]}},defaultGlyph=e=>{switch(e){case"success":return"✓";case"danger":return"×";case"warning":return"!";case"info":return"i";case"primary":case"neutral":return""}},buildStyles=e=>StyleSheet.create({container:{overflow:"hidden",marginVertical:e.space.xs},tintBar:{position:"absolute",left:0,top:0,bottom:0},row:{flexDirection:"row",alignItems:"center",paddingLeft:e.space.sm},iconCircle:{alignItems:"center",justifyContent:"center",marginRight:e.space.md},iconGlyph:{fontWeight:"700",lineHeight:Math.round(e.text[e.components.toast["icon-glyph-text"]].size*e.leading.heading)},textBlock:{flex:1,paddingRight:e.space.sm},description:{marginTop:e.space.xxs},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:e.space.sm,paddingVertical:e.space.xs,minHeight:e.components.toast["action-min-height"],borderRadius:e.radius.md,...smoothCorners,marginLeft:e.space.sm}});export{Toast};export default Toast;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import React,{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,Platform,StyleSheet,useWindowDimensions,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePresenceMotion}from"../../hooks/usePresenceMotion.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{smoothCorners}from"../../utils/corners.js";import{mergeRefs}from"../../utils/mergeRefs.js";import{nativeDriver}from"../../utils/nativeDriver.js";import{claimAnchoredSurface}from"../../utils/placement.js";import{FOCUS_DELAY_MS,focusHost}from"../Menu/focusHost.js";import{Modal}from"../Modal/index.js";import{useModalInsets}from"../ModalSafeArea/ModalSafeArea.js";import{Text}from"../Text/index.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";export const DEFAULT_TOOLTIP_LABELS=Object.freeze({close:"Close tooltip",longPressHint:"Long press for more info",fallbackName:"Tooltip"});const PRESS_AUTO_HIDE_MS=4e3,ARROW_HALF_WIDTH=4,ARROW_HEIGHT=6,ARROW_CORNER_PADDING=12,DEFAULT_MAX_WIDTH=240,RICH_MAX_WIDTH=280,MESSAGE_LINE_HEIGHT=18,EXIT_DURATION_MS=150,Tooltip=e=>{const{content:t,children:r,variant:o="plain",title:s,action:n,placement:i="auto",open:a,onOpenChange:l,hideOnContentPress:u=!0,maxWidth:c,showArrow:m=!0,accessibilityLabel:
|
|
1
|
+
"use strict";import React,{useCallback,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,Platform,StyleSheet,useWindowDimensions,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePresenceMotion}from"../../hooks/usePresenceMotion.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{announce}from"../../utils/announce.js";import{assertValidValue}from"../../utils/assertValidValue.js";import{smoothCorners}from"../../utils/corners.js";import{mergeRefs}from"../../utils/mergeRefs.js";import{nativeDriver}from"../../utils/nativeDriver.js";import{claimAnchoredSurface}from"../../utils/placement.js";import{FOCUS_DELAY_MS,focusHost}from"../Menu/focusHost.js";import{Modal}from"../Modal/index.js";import{useModalInsets}from"../ModalSafeArea/ModalSafeArea.js";import{Text}from"../Text/index.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";export const DEFAULT_TOOLTIP_LABELS=Object.freeze({close:"Close tooltip",longPressHint:"Long press for more info",fallbackName:"Tooltip"});const PRESS_AUTO_HIDE_MS=4e3,ARROW_HALF_WIDTH=4,ARROW_HEIGHT=6,ARROW_CORNER_PADDING=12,DEFAULT_MAX_WIDTH=240,RICH_MAX_WIDTH=280,MESSAGE_LINE_HEIGHT=18,EXIT_DURATION_MS=150,Tooltip=e=>{const{content:t,children:r,variant:o="plain",title:s,action:n,placement:i="auto",open:a,onOpenChange:l,hideOnContentPress:u=!0,maxWidth:c,showArrow:m=!0,accessibilityLabel:d,style:p,containerStyle:f,arrowStyle:h,messageStyle:g,labels:b,testID:T}=e;assertValidValue("Tooltip","variant",e.variant,["plain","rich"]),assertValidValue("Tooltip","placement",e.placement,["top","bottom","left","right","auto"]),assertValidValue("Tooltip","trigger",e.trigger,["longPress","press","manual"]);const v="rich"===o,S=e.trigger??(v?"press":"longPress"),A=useMemo(()=>({...DEFAULT_TOOLTIP_LABELS,...b}),[b]),R=useTheme(),y=usePresenceMotion(),_=useSafeAreaInsets(),[w,j]=useModalInsets(),x=useMemo(()=>({..._,top:w.top,bottom:w.bottom}),[_,w]),C=useWindowDimensions(),E=useMemo(()=>buildStyles(R),[R]),D=R.space.sm,M=R.space.sm,P=c??(v?280:240),V="press"===S&&!v,H=(R.settings.components.tooltip?.enableScaleAnimation??!1)&&!y.reduced,L="manual"===S||"boolean"==typeof a,[O,I]=useState(!1),W=L?Boolean(a):O,[k,N]=useState(null),[F,B]=useState({width:0,height:0}),U=useRef(null),z=useRef(null),G=useRef(null),X=useRef(null),Y=useRef(null),q=useRef(!1),J=useRef(!1),K=useRef(createAnimatedValue(W||!H?1:.85)).current,Q=useRef(createAnimatedValue(W?1:0)).current,Z=useRef(null),$=useRef(!1),[ee,te]=useState(W),re=useCallback(e=>{L||I(e),l?.(e)},[L,l]),oe=useCallback(()=>{U.current&&U.current.measureInWindow((e,t,r,o)=>{N({x:e,y:t,width:r,height:o})})},[]),se=useCallback(e=>{oe(),re(!0)},[oe,re]),ne=useCallback(()=>{re(!1)},[re]),ie=useRef(ne);ie.current=ne;const ae=useCallback(()=>{if(!q.current)return;q.current=!1;const e=Y.current;Y.current=null,e?e():v&&focusHost(z.current??U.current)},[v]);useEffect(()=>{if(W)return J.current=!0,q.current=!1,claimAnchoredSurface(()=>ie.current());J.current&&(J.current=!1,q.current=!0)},[W]),useEffect(()=>{W&&te(!0)},[W]);const le=useCallback(()=>{Y.current=n?.onPress??null,ne()},[n,ne]),ue=useRef({autoHide:V,scaleAnimates:H,presence:y,theme:R,handleHide:ne});ue.current={autoHide:V,scaleAnimates:H,presence:y,theme:R,handleHide:ne},useEffect(()=>{const{autoHide:e,scaleAnimates:t,presence:r,theme:o,handleHide:s}=ue.current;if(!$.current)return $.current=!0,W&&(oe(),e&&(Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{s()},4e3))),()=>{Z.current&&(clearTimeout(Z.current),Z.current=null)};let n;if(W){oe();const i=[Animated.timing(Q,{toValue:1,duration:r.duration("fast"),useNativeDriver:nativeDriver})];t?i.push(Animated.spring(K,{toValue:1,damping:o.motion.spring.snappy.damping,stiffness:o.motion.spring.snappy.stiffness,mass:o.motion.spring.snappy.mass,useNativeDriver:nativeDriver})):setNativeValue(K,1),n=Animated.parallel(i),n.start(),e&&(Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{s()},4e3))}else{const e=[Animated.timing(Q,{toValue:0,duration:r.reduced?r.duration("fast"):150,easing:Easing.bezier(...o.motion.ease.accelerate),useNativeDriver:nativeDriver})];t&&e.push(Animated.timing(K,{toValue:.85,duration:150,easing:Easing.bezier(...o.motion.ease.accelerate),useNativeDriver:nativeDriver})),n=Animated.parallel(e),n.start(({finished:e})=>{e&&te(!1)}),Z.current&&(clearTimeout(Z.current),Z.current=null)}return()=>{n?.stop(),Z.current&&(clearTimeout(Z.current),Z.current=null)}},[W,oe,Q,K]);const handleContentLayout=e=>{const{width:t,height:r}=e.nativeEvent.layout;t===F.width&&r===F.height||B({width:t,height:r})},ce=useMemo(()=>resolveTooltipPosition({anchor:k,size:F,placement:i,rich:v,viewport:{width:C.width,height:C.height,insets:x},maxWidth:P,gap:D,padding:M,arrowCornerPadding:12}),[k,F,i,v,C.width,C.height,x,P,D,M]),me=null!==k&&F.width>0,de=W&&me;useEffect(()=>{if(!v||!de)return;const e="web"===Platform.OS?X:G,t=setTimeout(()=>focusHost(e.current),FOCUS_DELAY_MS);return()=>clearTimeout(t)},[v,de]),useEffect(()=>{!v&&de&&"ios"===Platform.OS&&"string"==typeof t&&announce(t)},[v,de,t]);const pe=r.props,fe=useMemo(()=>mergeRefs(pe.ref,z),[pe.ref]),he={};"longPress"!==S||pe.contextMenu?"press"===S&&(he.onPress=e=>{pe.onPress?.(e),se(e)}):(he.onLongPress=se,he.accessibilityHint=A.longPressHint),v&&(he.ref=fe);const ge=React.cloneElement(r,he),be=d??("string"==typeof t?t:A.fallbackName),Te=useMemo(()=>{if(!m)return null;const e={position:"absolute",width:0,height:0,backgroundColor:"transparent",borderStyle:"solid",borderLeftWidth:4,borderRightWidth:4,borderBottomWidth:6,borderTopWidth:0,borderLeftColor:"transparent",borderRightColor:"transparent",borderTopColor:"transparent",borderBottomColor:v?R.colors.surface:R.colors["surface-inverse"]};return"top"===ce.placement?{...e,bottom:-6,left:ce.arrowOffset-4,transform:[{rotate:"180deg"}]}:"bottom"===ce.placement?{...e,top:-6,left:ce.arrowOffset-4}:"left"===ce.placement?{...e,right:-6,top:ce.arrowOffset-4,transform:[{rotate:"90deg"}]}:{...e,left:-6,top:ce.arrowOffset-4,transform:[{rotate:"-90deg"}]}},[m,ce,R,v]),ve={position:"absolute",top:ce.top,left:ce.left,maxWidth:P,opacity:W&&!me?0:Q,transform:[{scale:K}]},Se=Te?_jsx(View,{style:[Te,h],pointerEvents:"none"}):null;return _jsxs(_Fragment,{children:[_jsx(View,{ref:U,collapsable:!1,onLayout:oe,testID:T,children:ge}),_jsxs(Modal,{open:ee,onClose:ne,presentation:"fullScreen",bare:!0,backdropOpacity:0,backdropPressClose:u,haptic:!1,labels:{close:A.close},onInsetsChange:j,onDismissed:ae,children:[ee&&v?_jsxs(Animated.View,{onLayout:handleContentLayout,style:[ve,f,p],children:[_jsx(RichTooltipBody,{title:s,content:t,action:n,onAction:le,focusRef:G,actionRef:X,messageStyle:g}),Se]}):null,ee&&!v?_jsxs(Animated.View,{accessibilityRole:"web"===Platform.OS?"tooltip":void 0,accessibilityLiveRegion:"polite",accessibilityLabel:be,onLayout:handleContentLayout,style:[ve,f,p],children:[_jsx(View,{style:[E.tooltip,{backgroundColor:R.colors["surface-inverse"],borderRadius:R.radius.md,...smoothCorners,paddingHorizontal:R.space.md,paddingVertical:R.space.sm,...R.shadow.popover,shadowColor:R.shadow.popover.shadowColor}],children:"string"==typeof t?_jsx(Text,{variant:"bodySmall",color:"inverse",style:{lineHeight:18,...StyleSheet.flatten(g)},children:t}):t}),Se]}):null]})]})},buildStyles=e=>StyleSheet.create({tooltip:{overflow:"hidden"}});export{Tooltip};export default Tooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useCallback,useRef,useState}from"react";export function useControllableState({
|
|
1
|
+
"use strict";import{useCallback,useRef,useState}from"react";export function useControllableState(e){const{defaultValue:t,onChange:l}=e,u=useRef(e.controlled??void 0!==e.value).current,[a,o]=useState(t);let r=a;u&&(void 0!==e.controlled||void 0!==e.value)&&(r=e.value);return[r,useCallback(e=>{u||o(e),l?.(e)},[u,l])]}
|
package/lib/module/icons.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{CURATED_ICON_NAMES,defaultIcons,ICON_NAMES}from"./components/AppIcon/index.js";export{textOf}from"./theme/index.js";
|
|
1
|
+
"use strict";export{CURATED_ICON_NAMES,defaultIcons,ICON_NAMES,ICONSAX_SUFFIX,isAppIconName}from"./components/AppIcon/index.js";export{textOf}from"./theme/index.js";
|
package/lib/module/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{PHONE_CHROME_INSETS}from"./canvasKit/index.js";export{Accordion,AccordionGroup,ALL_CALLING_CODES,AmountSlider,AnimatePresence,AppBar,AppLockOverlay,AsyncBlock,AuthedImage,Autocomplete,Avatar,AvatarGroup,authedImageCacheStats,Badge,Banner,BarChart,BottomNavigation,BottomSheet,Box,Button,buttonLabelInk,Calendar,Card,Carousel,Checkbox,Chip,ChoiceGroup,Composer,Confetti,ConfirmHost,clearAuthedImageCache,confirm,DatePicker,DateRangePicker,DateSeparator,DEFAULT_CALLING_CODES,DecimalInput,Descriptions,Dialog,Divider,Drawer,defineStatusMap,EmptyState,ErrorBoundary,FilePicker,FileViewer,FilterChipRow,FloatingActionButton,FloatingActionButtonGroup,ForceUpdateDialog,FormField,formatE164,formatFileSize,getAuthedImageCacheLimit,IconBadge,IconButton,ImageGallery,InlineSelect,Input,KeyboardAwareScrollView,KeyboardToolbar,ListItem,ListSection,LoaderOverlay,loader,Markdown,Menu,MessageBubble,MessageList,MODAL_DISMISS_GRACE_MS,Modal,NonModalBottomSheet,NumberInput,OnboardingPager,OptionSheet,OTPInput,OTPResendRow,PagedListFooter,PermissionPrompt,PhoneNumberInput,PickerTrigger,ProfileCompletion,ProfilePicker,ProgressBar,ProgressRing,Radio,RadioDot,RadioGroup,Rating,Repeater,RichTextEditor,Row,ScannerOverlay,Screen,SearchBar,SectionHeader,SegmentedControl,Select,SignaturePad,Skeleton,SkeletonCircle,SkeletonClockProvider,SkeletonContent,SkeletonList,SkeletonProvider,SkeletonSkip,SkeletonText,Slider,SliderField,SlideToConfirm,SortableList,Spacer,Sparkline,Spinner,SquircleImage,SquircleView,Stack,StatTile,StatusBadge,Stepper,Swipeable,Switch,setAuthedImageCacheLimit,Tabs,TagInput,Text,TextInkContext,Timeline,TimePicker,Toast,ToastHost,ToastProvider,Tooltip,Tour,TypingIndicator,toast,useBottomSheet,useErrorHandler,useRecentSearches,useTextInk,useToast,WheelPicker,withErrorBoundary,ZoomableImage}from"./components/index.js";export{AppIcon}from"./components/AppIcon/index.js";export{HookFormField,useHookFormField}from"./form/index.js";export{useDebounce,useFieldChain,useReducedMotion,useRefreshControl,useScrollDirection}from"./hooks/index.js";export{NetworkStatusBanner}from"./network/index.js";export{fontFor,KitThemeBridge,lightTheme,makeStyles,radiusOf,ThemeProvider,useTheme,useThemeMode}from"./theme/index.js";export{announce,configureFeedback,isFeedbackEnabled,setHapticImplementation,triggerHaptic}from"./utils/index.js";
|
|
1
|
+
"use strict";export{PHONE_CHROME_INSETS}from"./canvasKit/index.js";export{Accordion,AccordionGroup,ALL_CALLING_CODES,AmountSlider,AnimatePresence,AppBar,AppLockOverlay,AsyncBlock,AuthedImage,Autocomplete,Avatar,AvatarGroup,authedImageCacheStats,Badge,Banner,BarChart,BottomNavigation,BottomSheet,Box,Button,buttonLabelInk,Calendar,Card,Carousel,Checkbox,Chip,ChoiceGroup,Composer,Confetti,ConfirmHost,clearAuthedImageCache,confirm,DatePicker,DateRangePicker,DateSeparator,DEFAULT_CALLING_CODES,DecimalInput,Descriptions,Dialog,Divider,Drawer,defineStatusMap,EmptyState,ErrorBoundary,FilePicker,FileViewer,FilterChipRow,FloatingActionButton,FloatingActionButtonGroup,ForceUpdateDialog,FormField,formatE164,formatFileSize,getAuthedImageCacheLimit,IconBadge,IconButton,ImageGallery,InlineSelect,Input,KeyboardAwareScrollView,KeyboardToolbar,ListItem,ListSection,LoaderOverlay,loader,Markdown,Menu,MessageBubble,MessageList,MODAL_DISMISS_GRACE_MS,Modal,NonModalBottomSheet,NumberInput,OnboardingPager,OptionSheet,OTPInput,OTPResendRow,PagedListFooter,PermissionPrompt,PhoneNumberInput,PickerTrigger,ProfileCompletion,ProfilePicker,ProgressBar,ProgressRing,Radio,RadioDot,RadioGroup,Rating,Repeater,RichTextEditor,Row,ScannerOverlay,Screen,SearchBar,SectionHeader,SegmentedControl,Select,SignaturePad,Skeleton,SkeletonCircle,SkeletonClockProvider,SkeletonContent,SkeletonList,SkeletonProvider,SkeletonSkip,SkeletonText,Slider,SliderField,SlideToConfirm,SortableList,Spacer,Sparkline,Spinner,SquircleImage,SquircleView,Stack,StatTile,StatusBadge,Stepper,Swipeable,Switch,setAuthedImageCacheLimit,Tabs,TagInput,Text,TextInkContext,Timeline,TimePicker,Toast,ToastHost,ToastProvider,Tooltip,Tour,TypingIndicator,toast,useBottomSheet,useErrorHandler,useRecentSearches,useTextInk,useToast,WheelPicker,withErrorBoundary,ZoomableImage}from"./components/index.js";export{AppIcon,ICONSAX_SUFFIX,isAppIconName}from"./components/AppIcon/index.js";export{BUTTON_TONES,BUTTON_VARIANTS,isButtonTone,isButtonVariant}from"./components/Button/index.js";export{HookFormField,useHookFormField}from"./form/index.js";export{useDebounce,useFieldChain,useReducedMotion,useRefreshControl,useScrollDirection}from"./hooks/index.js";export{NetworkStatusBanner}from"./network/index.js";export{fontFor,KitThemeBridge,lightTheme,makeStyles,radiusOf,ThemeProvider,useTheme,useThemeMode}from"./theme/index.js";export{announce,configureFeedback,isFeedbackEnabled,setHapticImplementation,triggerHaptic}from"./utils/index.js";
|
|
@@ -38,6 +38,8 @@ export declare const ICONSAX_SUFFIX = "-iconsax";
|
|
|
38
38
|
export type IconsaxShadowedName = `${CuratedIconName}${typeof ICONSAX_SUFFIX}`;
|
|
39
39
|
/** Every name AppIcon draws: curated, catalogue, and the shadowed catalogue spellings. */
|
|
40
40
|
export type AppIconName = IconName | IconsaxShadowedName;
|
|
41
|
+
/** True for a name AppIcon draws: a catalogue name, or a curated name followed by ICONSAX_SUFFIX. */
|
|
42
|
+
export declare function isAppIconName(value: unknown): value is AppIconName;
|
|
41
43
|
/** `linear` is the default Iconsax style; the rest come from the lazy modules. */
|
|
42
44
|
export type IconVariant = "linear" | IconVariantName;
|
|
43
45
|
export type AppIconSize = Size;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { AppIconColor, AppIconName, AppIconProps, AppIconSize, CuratedIconName, IconName, IconsaxShadowedName, IconVariant, } from "./AppIcon";
|
|
2
|
-
export { APP_ICON_SIZES, AppIcon, buildIconXml, CURATED_ICON_NAMES, default, ICON_NAMES, ICONSAX_SUFFIX, resolveGlyph, } from "./AppIcon";
|
|
2
|
+
export { APP_ICON_SIZES, AppIcon, buildIconXml, CURATED_ICON_NAMES, default, ICON_NAMES, ICONSAX_SUFFIX, isAppIconName, resolveGlyph, } from "./AppIcon";
|
|
3
3
|
export { defaultIcons } from "./defaultIcons";
|
|
4
4
|
export type { SlotIcon, SlotIconRef, SlotIconState, SlotNode } from "./slotIcon";
|
|
5
5
|
export { renderSlotIcon } from "./slotIcon";
|
|
@@ -19,6 +19,10 @@ import type { SlotIcon } from "../AppIcon/slotIcon";
|
|
|
19
19
|
*/
|
|
20
20
|
export type ButtonVariant = FillVariant | "link" | "glass";
|
|
21
21
|
export type ButtonTone = Tone;
|
|
22
|
+
export declare const BUTTON_VARIANTS: readonly ["solid", "soft", "outline", "ghost", "link", "glass"];
|
|
23
|
+
export declare const BUTTON_TONES: readonly ["primary", "success", "warning", "danger", "info", "neutral"];
|
|
24
|
+
export declare function isButtonVariant(value: unknown): value is ButtonVariant;
|
|
25
|
+
export declare function isButtonTone(value: unknown): value is ButtonTone;
|
|
22
26
|
export type ButtonSize = Size;
|
|
23
27
|
/** The text a Button draws for its own states. */
|
|
24
28
|
export interface ButtonLabels {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { ButtonLabels, ButtonProps, ButtonSize, ButtonTone, ButtonVariant } from "./Button";
|
|
2
|
-
export { Button, buttonLabelInk, default } from "./Button";
|
|
2
|
+
export { BUTTON_TONES, BUTTON_VARIANTS, Button, buttonLabelInk, default, isButtonTone, isButtonVariant } from "./Button";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -16,10 +16,13 @@ export interface CheckboxProps extends Omit<PressableProps, "style" | "children"
|
|
|
16
16
|
* explicit `accessibilityLabel` (the checkbox's screen-reader name).
|
|
17
17
|
*/
|
|
18
18
|
label?: React.ReactNode | undefined;
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A muted hint directly under the label: a string, or a node for a symbol with a
|
|
21
|
+
* subscript. A string is the accessibility hint; for a node pass `accessibilityHint`.
|
|
22
|
+
*/
|
|
23
|
+
helperText?: React.ReactNode | undefined;
|
|
24
|
+
/** Secondary line under the helper text: a string or a node. */
|
|
25
|
+
description?: React.ReactNode | undefined;
|
|
23
26
|
/**
|
|
24
27
|
* Error line under the label, helper text and description; also draws the box in the error colour.
|
|
25
28
|
* `true` shows the error state without a message.
|
|
@@ -126,17 +126,21 @@ interface BaseChoiceGroupProps<T = ChoiceOption> {
|
|
|
126
126
|
min?: number | undefined;
|
|
127
127
|
/** Multiple mode only: most options that can be selected. At this count the unselected options are disabled. Default no limit. */
|
|
128
128
|
max?: number | undefined;
|
|
129
|
-
/** A line of text drawn above the options. */
|
|
130
|
-
description?:
|
|
131
|
-
/** A hint drawn under the options; hidden while `error` is set. */
|
|
132
|
-
helperText?:
|
|
129
|
+
/** A line of text drawn above the options: a string, or a node for a symbol with a subscript. */
|
|
130
|
+
description?: React.ReactNode | undefined;
|
|
131
|
+
/** A hint drawn under the options, a string or a node; hidden while `error` is set. */
|
|
132
|
+
helperText?: React.ReactNode | undefined;
|
|
133
133
|
/** `true` marks the group invalid; a string is drawn under the options in place of `helperText`. */
|
|
134
134
|
error?: string | boolean | undefined;
|
|
135
135
|
testID?: string | undefined;
|
|
136
136
|
}
|
|
137
137
|
export interface SingleChoiceGroupProps<T = ChoiceOption> extends BaseChoiceGroupProps<T> {
|
|
138
138
|
selectionMode?: "single" | undefined;
|
|
139
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* Controlled selected value. The group is controlled whenever this prop is
|
|
141
|
+
* present: pass `value={undefined}` for "controlled, nothing selected".
|
|
142
|
+
* Leave the prop out for an uncontrolled group.
|
|
143
|
+
*/
|
|
140
144
|
value?: RadioValue | undefined;
|
|
141
145
|
/** Uncontrolled initial value. */
|
|
142
146
|
defaultValue?: RadioValue | undefined;
|
|
@@ -149,7 +153,11 @@ export interface MultipleChoiceGroupProps<T = ChoiceOption> extends BaseChoiceGr
|
|
|
149
153
|
* `defaultValue` and `onChange` carry arrays of values.
|
|
150
154
|
*/
|
|
151
155
|
selectionMode: "multiple";
|
|
152
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Controlled selected values. The group is controlled whenever this prop is
|
|
158
|
+
* present; `value={undefined}` and `[]` both mean nothing selected. Leave the
|
|
159
|
+
* prop out for an uncontrolled group.
|
|
160
|
+
*/
|
|
153
161
|
value?: RadioValue[] | undefined;
|
|
154
162
|
/** Uncontrolled initial values. Default none. */
|
|
155
163
|
defaultValue?: RadioValue[] | undefined;
|
|
@@ -9,9 +9,10 @@ import type { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
|
9
9
|
export interface ChoiceTextProps {
|
|
10
10
|
/** A string, or a node (a symbol with a subscript). */
|
|
11
11
|
label?: React.ReactNode | undefined;
|
|
12
|
-
/** A muted hint directly under the label. */
|
|
13
|
-
helperText?:
|
|
14
|
-
|
|
12
|
+
/** A muted hint directly under the label: a string or a node. */
|
|
13
|
+
helperText?: React.ReactNode | undefined;
|
|
14
|
+
/** A string or a node. */
|
|
15
|
+
description?: React.ReactNode | undefined;
|
|
15
16
|
error?: string | undefined;
|
|
16
17
|
disabled?: boolean | undefined;
|
|
17
18
|
style?: StyleProp<ViewStyle> | undefined;
|
|
@@ -19,9 +20,9 @@ export interface ChoiceTextProps {
|
|
|
19
20
|
}
|
|
20
21
|
/** True when the control has a second line, so it aligns to the label's first line. */
|
|
21
22
|
export declare const hasChoiceDetail: ({ description, error, helperText, }: {
|
|
22
|
-
description?:
|
|
23
|
+
description?: React.ReactNode | undefined;
|
|
23
24
|
error?: string | undefined;
|
|
24
|
-
helperText?:
|
|
25
|
+
helperText?: React.ReactNode | undefined;
|
|
25
26
|
}) => boolean;
|
|
26
27
|
export declare const ChoiceText: React.FC<ChoiceTextProps>;
|
|
27
28
|
//# sourceMappingURL=ChoiceText.d.ts.map
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* (compression, EXIF strip, local copy) before it lands in `files` —
|
|
21
21
|
* plug the app's image pipeline in there.
|
|
22
22
|
*/
|
|
23
|
-
import type { PickerSource } from "@webority/mobile-core/pickers";
|
|
23
|
+
import type { PickedFile, PickerSource } from "@webority/mobile-core/pickers";
|
|
24
24
|
import type React from "react";
|
|
25
25
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
26
26
|
import type { HapticType } from "../../utils";
|
|
@@ -50,7 +50,7 @@ export interface FilePickerFile {
|
|
|
50
50
|
meta?: Record<string, unknown> | undefined;
|
|
51
51
|
}
|
|
52
52
|
/** Launch native picking through `pick()`: resolve `[]` for user-cancel, throw for real failures. */
|
|
53
|
-
export interface FilePickerSource extends PickerSource {
|
|
53
|
+
export interface FilePickerSource<F extends PickedFile = PickedFile> extends PickerSource<F> {
|
|
54
54
|
icon?: React.ReactNode | undefined;
|
|
55
55
|
}
|
|
56
56
|
/** Everything a custom `renderFile` template needs to paint one file. */
|
|
@@ -47,15 +47,16 @@ export interface ProfilePickerLabels {
|
|
|
47
47
|
errorWrongType: string;
|
|
48
48
|
}
|
|
49
49
|
export declare const DEFAULT_PROFILE_PICKER_LABELS: Readonly<ProfilePickerLabels>;
|
|
50
|
-
|
|
50
|
+
/** `F` is the file type the `sources` resolve; `onPick` receives that same object. */
|
|
51
|
+
export interface ProfilePickerProps<F extends PickedFile = PickedFile> {
|
|
51
52
|
/** Current photo URL or local URI, or null for none. */
|
|
52
53
|
value?: string | null | undefined;
|
|
53
54
|
/** Person's name: drives the initials shown when there is no photo. */
|
|
54
55
|
name?: string | undefined;
|
|
55
56
|
/** Native picking adapters (same shape as FilePicker's). One launches directly; several open a chooser. */
|
|
56
|
-
sources: ReadonlyArray<FilePickerSource
|
|
57
|
-
/** Receives the validated pick. Upload it and pass the resulting URL back as `value`. */
|
|
58
|
-
onPick?: ((file:
|
|
57
|
+
sources: ReadonlyArray<FilePickerSource<F>>;
|
|
58
|
+
/** Receives the validated pick, as its source returned it. Upload it and pass the resulting URL back as `value`. */
|
|
59
|
+
onPick?: ((file: F) => void) | undefined;
|
|
59
60
|
/**
|
|
60
61
|
* Clears the photo. Removal is a row at the end of the sheet: a just-picked
|
|
61
62
|
* photo always offers it; an existing `value` offers it only when this is
|
|
@@ -103,10 +104,10 @@ export interface ProfilePickerProps {
|
|
|
103
104
|
/** App-supplied error; wins over a rejected pick's own message. */
|
|
104
105
|
error?: React.ReactNode | undefined;
|
|
105
106
|
layout?: ProfilePickerLayout | undefined;
|
|
106
|
-
/** Bold primary text beside / beneath the photo (inline and profile layouts). */
|
|
107
|
-
title?:
|
|
108
|
-
/** Muted secondary text beside / beneath the photo (inline and profile layouts). */
|
|
109
|
-
subtitle?:
|
|
107
|
+
/** Bold primary text beside / beneath the photo (inline and profile layouts): a string or a node. */
|
|
108
|
+
title?: React.ReactNode | undefined;
|
|
109
|
+
/** Muted secondary text beside / beneath the photo (inline and profile layouts): a string or a node. */
|
|
110
|
+
subtitle?: React.ReactNode | undefined;
|
|
110
111
|
/** Renders the photo, e.g. an authenticated image loader (see Avatar). */
|
|
111
112
|
ImageComponent?: React.ComponentType<AvatarImageProps> | undefined;
|
|
112
113
|
labels?: Partial<ProfilePickerLabels> | undefined;
|
|
@@ -118,7 +119,12 @@ export interface ProfilePickerProps {
|
|
|
118
119
|
style?: StyleProp<ViewStyle> | undefined;
|
|
119
120
|
testID?: string | undefined;
|
|
120
121
|
}
|
|
121
|
-
declare
|
|
122
|
+
declare function ProfilePicker<F extends PickedFile = PickedFile>(props: ProfilePickerProps<F> & {
|
|
123
|
+
ref?: React.Ref<HostInstance> | undefined;
|
|
124
|
+
}): React.ReactElement;
|
|
125
|
+
declare namespace ProfilePicker {
|
|
126
|
+
var displayName: string;
|
|
127
|
+
}
|
|
122
128
|
export { ProfilePicker };
|
|
123
129
|
export default ProfilePicker;
|
|
124
130
|
//# sourceMappingURL=ProfilePicker.d.ts.map
|
|
@@ -24,10 +24,13 @@ export interface RadioProps extends Omit<PressableProps, "style" | "children" |
|
|
|
24
24
|
* explicit `accessibilityLabel` (the radio's screen-reader name).
|
|
25
25
|
*/
|
|
26
26
|
label?: ReactNode | undefined;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
/**
|
|
28
|
+
* A muted hint directly under the label: a string, or a node for a symbol with a
|
|
29
|
+
* subscript. A string is the accessibility hint; for a node pass `accessibilityHint`.
|
|
30
|
+
*/
|
|
31
|
+
helperText?: ReactNode | undefined;
|
|
32
|
+
/** Secondary line under the helper text: a string or a node. */
|
|
33
|
+
description?: ReactNode | undefined;
|
|
31
34
|
/**
|
|
32
35
|
* Error line under the label, helper text and description; also draws the empty ring in the error colour.
|
|
33
36
|
* `true` shows the error state without a message.
|
|
@@ -2,6 +2,11 @@ import type React from "react";
|
|
|
2
2
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import type { RadioValue } from "./Radio";
|
|
4
4
|
export interface RadioGroupProps {
|
|
5
|
+
/**
|
|
6
|
+
* Controlled selected value. The group is controlled whenever this prop is
|
|
7
|
+
* present: pass `value={undefined}` for "controlled, nothing selected".
|
|
8
|
+
* Leave the prop out for an uncontrolled group.
|
|
9
|
+
*/
|
|
5
10
|
value?: RadioValue | undefined;
|
|
6
11
|
defaultValue?: RadioValue | undefined;
|
|
7
12
|
onChange?: ((value: RadioValue) => void) | undefined;
|
|
@@ -18,10 +18,10 @@ export interface SwitchProps extends Omit<PressableProps, "style" | "children" |
|
|
|
18
18
|
* explicit `accessibilityLabel` (the switch's screen-reader name).
|
|
19
19
|
*/
|
|
20
20
|
label?: ReactNode | undefined;
|
|
21
|
-
/** Secondary line under the label. */
|
|
22
|
-
description?:
|
|
23
|
-
/** A hint under the label, description and error. */
|
|
24
|
-
helperText?:
|
|
21
|
+
/** Secondary line under the label: a string, or a node for a symbol with a subscript. */
|
|
22
|
+
description?: ReactNode | undefined;
|
|
23
|
+
/** A hint under the label, description and error: a string or a node. */
|
|
24
|
+
helperText?: ReactNode | undefined;
|
|
25
25
|
/**
|
|
26
26
|
* Error line under the label (and description); also outlines the off track in the error colour.
|
|
27
27
|
* `true` shows the error state without a message.
|
|
@@ -1,17 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
/** Controlled value. When `undefined`, the hook manages state internally. */
|
|
3
|
-
value?: T | undefined;
|
|
1
|
+
interface ControllableStateBase<T> {
|
|
4
2
|
/** Initial value used in uncontrolled mode. */
|
|
5
3
|
defaultValue: T;
|
|
6
4
|
/** Called on every change (both modes). */
|
|
7
5
|
onChange?: ((value: T) => void) | undefined;
|
|
8
6
|
}
|
|
7
|
+
/** The mode follows the value: a first `value` that is not `undefined` makes it controlled. */
|
|
8
|
+
interface ControlledByValue<T> extends ControllableStateBase<T> {
|
|
9
|
+
/** Controlled value. When `undefined`, the hook manages state internally. */
|
|
10
|
+
value?: T | undefined;
|
|
11
|
+
controlled?: undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The caller names the mode, for a value whose `undefined` is itself a controlled
|
|
15
|
+
* state (a choice group with nothing selected). The caller passes whether its
|
|
16
|
+
* `value` prop is present; in controlled mode `value` is returned as is.
|
|
17
|
+
*/
|
|
18
|
+
interface ControlledByPresence<T> extends ControllableStateBase<T> {
|
|
19
|
+
controlled: boolean;
|
|
20
|
+
value: T;
|
|
21
|
+
}
|
|
22
|
+
export type UseControllableStateOptions<T> = ControlledByValue<T> | ControlledByPresence<T>;
|
|
9
23
|
/**
|
|
10
24
|
* Bridges controlled and uncontrolled usage for a value+onChange pair. When
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
25
|
+
* the component is controlled the hook just forwards `value` and calls
|
|
26
|
+
* `onChange`; otherwise the hook owns the state, seeded from `defaultValue`.
|
|
27
|
+
* The controlled/uncontrolled decision is locked on first render so a
|
|
28
|
+
* component never flips modes mid-life.
|
|
15
29
|
*/
|
|
16
|
-
export declare function useControllableState<T>(
|
|
30
|
+
export declare function useControllableState<T>(options: UseControllableStateOptions<T>): [T, (next: T) => void];
|
|
31
|
+
export {};
|
|
17
32
|
//# sourceMappingURL=useControllableState.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CURATED_ICON_NAMES, defaultIcons, ICON_NAMES } from "./components/AppIcon";
|
|
1
|
+
export { CURATED_ICON_NAMES, defaultIcons, ICON_NAMES, ICONSAX_SUFFIX, isAppIconName } from "./components/AppIcon";
|
|
2
2
|
export { textOf } from "./theme";
|
|
3
3
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -2,7 +2,8 @@ export { PHONE_CHROME_INSETS } from "./canvasKit";
|
|
|
2
2
|
export type * from "./components";
|
|
3
3
|
export { Accordion, AccordionGroup, ALL_CALLING_CODES, AmountSlider, AnimatePresence, AppBar, AppLockOverlay, AsyncBlock, AuthedImage, Autocomplete, Avatar, AvatarGroup, authedImageCacheStats, Badge, Banner, BarChart, BottomNavigation, BottomSheet, Box, Button, buttonLabelInk, Calendar, Card, Carousel, Checkbox, Chip, ChoiceGroup, Composer, Confetti, ConfirmHost, clearAuthedImageCache, confirm, DatePicker, DateRangePicker, DateSeparator, DEFAULT_CALLING_CODES, DecimalInput, Descriptions, Dialog, Divider, Drawer, defineStatusMap, EmptyState, ErrorBoundary, FilePicker, FileViewer, FilterChipRow, FloatingActionButton, FloatingActionButtonGroup, ForceUpdateDialog, FormField, formatE164, formatFileSize, getAuthedImageCacheLimit, IconBadge, IconButton, ImageGallery, InlineSelect, Input, KeyboardAwareScrollView, KeyboardToolbar, ListItem, ListSection, LoaderOverlay, loader, Markdown, Menu, MessageBubble, MessageList, MODAL_DISMISS_GRACE_MS, Modal, NonModalBottomSheet, NumberInput, OnboardingPager, OptionSheet, OTPInput, OTPResendRow, PagedListFooter, PermissionPrompt, PhoneNumberInput, PickerTrigger, ProfileCompletion, ProfilePicker, ProgressBar, ProgressRing, Radio, RadioDot, RadioGroup, Rating, Repeater, RichTextEditor, Row, ScannerOverlay, Screen, SearchBar, SectionHeader, SegmentedControl, Select, SignaturePad, Skeleton, SkeletonCircle, SkeletonClockProvider, SkeletonContent, SkeletonList, SkeletonProvider, SkeletonSkip, SkeletonText, Slider, SliderField, SlideToConfirm, SortableList, Spacer, Sparkline, Spinner, SquircleImage, SquircleView, Stack, StatTile, StatusBadge, Stepper, Swipeable, Switch, setAuthedImageCacheLimit, Tabs, TagInput, Text, TextInkContext, Timeline, TimePicker, Toast, ToastHost, ToastProvider, Tooltip, Tour, TypingIndicator, toast, useBottomSheet, useErrorHandler, useRecentSearches, useTextInk, useToast, WheelPicker, withErrorBoundary, ZoomableImage, } from "./components";
|
|
4
4
|
export type { AppIconColor, AppIconName, AppIconProps, AppIconSize, CuratedIconName, IconName, IconsaxShadowedName, IconVariant, SlotIcon, SlotIconRef, SlotIconState, SlotNode, } from "./components/AppIcon";
|
|
5
|
-
export { AppIcon } from "./components/AppIcon";
|
|
5
|
+
export { AppIcon, ICONSAX_SUFFIX, isAppIconName } from "./components/AppIcon";
|
|
6
|
+
export { BUTTON_TONES, BUTTON_VARIANTS, isButtonTone, isButtonVariant } from "./components/Button";
|
|
6
7
|
export type { FormCompletion, HookFieldProps, HookFormFieldProps, UseFormCompletionOptions } from "./form";
|
|
7
8
|
export { HookFormField, useHookFormField } from "./form";
|
|
8
9
|
export type { FieldChain, FieldChainProps, FieldErrorRegistry, MotionDurationKey, PresenceMotion, PressAnimationPreset, ScrollDirection, UseControllableStateOptions, UseFieldErrorScrollOptions, UseFieldErrorScrollResult, UsePressAnimationOptions, UsePressAnimationResult, UseRefreshControlLabels, UseRefreshControlOptions, UseRefreshControlResult, UseResendCountdownOptions, UseResendCountdownResult, UseScrollDirectionOptions, UseScrollDirectionResult, UseToggleResult, } from "./hooks";
|
|
@@ -38,6 +38,8 @@ export declare const ICONSAX_SUFFIX = "-iconsax";
|
|
|
38
38
|
export type IconsaxShadowedName = `${CuratedIconName}${typeof ICONSAX_SUFFIX}`;
|
|
39
39
|
/** Every name AppIcon draws: curated, catalogue, and the shadowed catalogue spellings. */
|
|
40
40
|
export type AppIconName = IconName | IconsaxShadowedName;
|
|
41
|
+
/** True for a name AppIcon draws: a catalogue name, or a curated name followed by ICONSAX_SUFFIX. */
|
|
42
|
+
export declare function isAppIconName(value: unknown): value is AppIconName;
|
|
41
43
|
/** `linear` is the default Iconsax style; the rest come from the lazy modules. */
|
|
42
44
|
export type IconVariant = "linear" | IconVariantName;
|
|
43
45
|
export type AppIconSize = Size;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { AppIconColor, AppIconName, AppIconProps, AppIconSize, CuratedIconName, IconName, IconsaxShadowedName, IconVariant, } from "./AppIcon.js";
|
|
2
|
-
export { APP_ICON_SIZES, AppIcon, buildIconXml, CURATED_ICON_NAMES, default, ICON_NAMES, ICONSAX_SUFFIX, resolveGlyph, } from "./AppIcon.js";
|
|
2
|
+
export { APP_ICON_SIZES, AppIcon, buildIconXml, CURATED_ICON_NAMES, default, ICON_NAMES, ICONSAX_SUFFIX, isAppIconName, resolveGlyph, } from "./AppIcon.js";
|
|
3
3
|
export { defaultIcons } from "./defaultIcons.js";
|
|
4
4
|
export type { SlotIcon, SlotIconRef, SlotIconState, SlotNode } from "./slotIcon.js";
|
|
5
5
|
export { renderSlotIcon } from "./slotIcon.js";
|
|
@@ -19,6 +19,10 @@ import type { SlotIcon } from "../AppIcon/slotIcon.js";
|
|
|
19
19
|
*/
|
|
20
20
|
export type ButtonVariant = FillVariant | "link" | "glass";
|
|
21
21
|
export type ButtonTone = Tone;
|
|
22
|
+
export declare const BUTTON_VARIANTS: readonly ["solid", "soft", "outline", "ghost", "link", "glass"];
|
|
23
|
+
export declare const BUTTON_TONES: readonly ["primary", "success", "warning", "danger", "info", "neutral"];
|
|
24
|
+
export declare function isButtonVariant(value: unknown): value is ButtonVariant;
|
|
25
|
+
export declare function isButtonTone(value: unknown): value is ButtonTone;
|
|
22
26
|
export type ButtonSize = Size;
|
|
23
27
|
/** The text a Button draws for its own states. */
|
|
24
28
|
export interface ButtonLabels {
|