@reillymc/react-native-components 0.11.6 → 0.11.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/container/anchoredContainer/AnchoredContainer.ios.js +1 -0
- package/lib/components/container/anchoredContainer/AnchoredContainer.js +1 -0
- package/lib/components/container/anchoredContainer/AnchoredContainer.styles.js +1 -0
- package/lib/components/container/anchoredContainer/AnchoredContainer.web.js +1 -0
- package/lib/components/container/anchoredContainer/InlineMount.js +1 -0
- package/lib/components/container/anchoredContainer/OverlayMount.js +1 -0
- package/lib/components/container/anchoredContainer/helpers.js +1 -0
- package/lib/components/container/anchoredContainer/index.js +1 -0
- package/lib/components/container/anchoredContainer/useAnchoredContainerPosition.js +1 -0
- package/lib/components/container/index.js +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/input/CounterInput.js +1 -1
- package/lib/components/input/NumberInput.js +1 -1
- package/lib/components/input/SelectionInput.js +1 -1
- package/lib/components/input/TimeInput.js +1 -1
- package/lib/components/input/dropdownInput/DropdownBlurGuard.js +1 -0
- package/lib/components/input/dropdownInput/DropdownBlurGuard.web.js +1 -0
- package/lib/components/input/dropdownInput/DropdownInput.js +1 -0
- package/lib/components/input/dropdownInput/DropdownInputBase.js +1 -0
- package/lib/components/input/dropdownInput/helpers.js +1 -0
- package/lib/components/input/dropdownInput/index.js +1 -0
- package/lib/components/input/dropdownInput/useDropdownController.js +1 -0
- package/lib/components/input/index.js +1 -1
- package/lib/components/menu/Menu.js +1 -1
- package/lib/components/menu/Menu.styles.js +1 -1
- package/lib/components/menu/MenuItem.js +1 -1
- package/lib/components/toast/Toast.js +1 -1
- package/lib/components/toast/Toast.styles.js +1 -1
- package/lib/hooks/index.js +1 -1
- package/lib/hooks/useControlledState.js +1 -0
- package/lib/hooks/usePersistentKeyboardHeight.js +1 -1
- package/lib/hooks/useTheme.js +1 -1
- package/lib/hooks/useThemedStyles.js +1 -1
- package/lib/providers/ThemeContext.js +1 -1
- package/lib/providers/ThemeProvider.js +1 -1
- package/lib/theme/index.js +1 -1
- package/lib/theme/styles.js +1 -1
- package/lib/theme/theme.js +1 -1
- package/lib/types/components/container/anchoredContainer/AnchoredContainer.d.ts +48 -0
- package/lib/types/components/container/anchoredContainer/AnchoredContainer.d.ts.map +1 -0
- package/lib/types/components/container/anchoredContainer/AnchoredContainer.ios.d.ts +4 -0
- package/lib/types/components/container/anchoredContainer/AnchoredContainer.ios.d.ts.map +1 -0
- package/lib/types/components/container/anchoredContainer/AnchoredContainer.styles.d.ts +4 -0
- package/lib/types/components/container/anchoredContainer/AnchoredContainer.styles.d.ts.map +1 -0
- package/lib/types/components/container/anchoredContainer/AnchoredContainer.web.d.ts +4 -0
- package/lib/types/components/container/anchoredContainer/AnchoredContainer.web.d.ts.map +1 -0
- package/lib/types/components/container/anchoredContainer/InlineMount.d.ts +8 -0
- package/lib/types/components/container/anchoredContainer/InlineMount.d.ts.map +1 -0
- package/lib/types/components/container/anchoredContainer/OverlayMount.d.ts +10 -0
- package/lib/types/components/container/anchoredContainer/OverlayMount.d.ts.map +1 -0
- package/lib/types/components/container/anchoredContainer/helpers.d.ts +5 -0
- package/lib/types/components/container/anchoredContainer/helpers.d.ts.map +1 -0
- package/lib/types/components/container/anchoredContainer/index.d.ts +3 -0
- package/lib/types/components/container/anchoredContainer/index.d.ts.map +1 -0
- package/lib/types/components/container/anchoredContainer/useAnchoredContainerPosition.d.ts +29 -0
- package/lib/types/components/container/anchoredContainer/useAnchoredContainerPosition.d.ts.map +1 -0
- package/lib/types/components/container/index.d.ts +2 -1
- package/lib/types/components/container/index.d.ts.map +1 -1
- package/lib/types/components/index.d.ts +4 -4
- package/lib/types/components/index.d.ts.map +1 -1
- package/lib/types/components/input/CounterInput.d.ts +3 -1
- package/lib/types/components/input/CounterInput.d.ts.map +1 -1
- package/lib/types/components/input/InputBase.d.ts +2 -2
- package/lib/types/components/input/InputBase.d.ts.map +1 -1
- package/lib/types/components/input/NumberInput.d.ts +12 -4
- package/lib/types/components/input/NumberInput.d.ts.map +1 -1
- package/lib/types/components/input/NumberInputBase.d.ts +2 -2
- package/lib/types/components/input/NumberInputBase.d.ts.map +1 -1
- package/lib/types/components/input/SelectionInput.d.ts +5 -5
- package/lib/types/components/input/SelectionInput.d.ts.map +1 -1
- package/lib/types/components/input/TimeInput.d.ts +5 -2
- package/lib/types/components/input/TimeInput.d.ts.map +1 -1
- package/lib/types/components/input/dropdownInput/DropdownBlurGuard.d.ts +8 -0
- package/lib/types/components/input/dropdownInput/DropdownBlurGuard.d.ts.map +1 -0
- package/lib/types/components/input/dropdownInput/DropdownBlurGuard.web.d.ts +9 -0
- package/lib/types/components/input/dropdownInput/DropdownBlurGuard.web.d.ts.map +1 -0
- package/lib/types/components/input/dropdownInput/DropdownInput.d.ts +8 -0
- package/lib/types/components/input/dropdownInput/DropdownInput.d.ts.map +1 -0
- package/lib/types/components/input/{DropdownInput.styles.d.ts → dropdownInput/DropdownInput.styles.d.ts} +1 -1
- package/lib/types/components/input/dropdownInput/DropdownInput.styles.d.ts.map +1 -0
- package/lib/types/components/input/dropdownInput/DropdownInputBase.d.ts +72 -0
- package/lib/types/components/input/dropdownInput/DropdownInputBase.d.ts.map +1 -0
- package/lib/types/components/input/dropdownInput/helpers.d.ts +13 -0
- package/lib/types/components/input/dropdownInput/helpers.d.ts.map +1 -0
- package/lib/types/components/input/dropdownInput/index.d.ts +4 -0
- package/lib/types/components/input/dropdownInput/index.d.ts.map +1 -0
- package/lib/types/components/input/dropdownInput/useDropdownController.d.ts +43 -0
- package/lib/types/components/input/dropdownInput/useDropdownController.d.ts.map +1 -0
- package/lib/types/components/input/index.d.ts +3 -5
- package/lib/types/components/input/index.d.ts.map +1 -1
- package/lib/types/components/menu/Menu.d.ts +17 -6
- package/lib/types/components/menu/Menu.d.ts.map +1 -1
- package/lib/types/components/menu/Menu.styles.d.ts.map +1 -1
- package/lib/types/components/menu/MenuItem.d.ts +1 -0
- package/lib/types/components/menu/MenuItem.d.ts.map +1 -1
- package/lib/types/components/toast/Toast.d.ts +6 -3
- package/lib/types/components/toast/Toast.d.ts.map +1 -1
- package/lib/types/components/toast/Toast.styles.d.ts +1 -1
- package/lib/types/components/toast/Toast.styles.d.ts.map +1 -1
- package/lib/types/hooks/index.d.ts +1 -0
- package/lib/types/hooks/index.d.ts.map +1 -1
- package/lib/types/hooks/useControlledState.d.ts +8 -0
- package/lib/types/hooks/useControlledState.d.ts.map +1 -0
- package/lib/types/hooks/usePersistentKeyboardHeight.d.ts.map +1 -1
- package/lib/types/hooks/useTheme.d.ts +6 -1
- package/lib/types/hooks/useTheme.d.ts.map +1 -1
- package/lib/types/hooks/useThemedStyles.d.ts +4 -3
- package/lib/types/hooks/useThemedStyles.d.ts.map +1 -1
- package/lib/types/providers/ThemeContext.d.ts +4 -4
- package/lib/types/providers/ThemeContext.d.ts.map +1 -1
- package/lib/types/providers/ThemeProvider.d.ts +9 -6
- package/lib/types/providers/ThemeProvider.d.ts.map +1 -1
- package/lib/types/theme/index.d.ts +3 -3
- package/lib/types/theme/index.d.ts.map +1 -1
- package/lib/types/theme/styles.d.ts +7 -2
- package/lib/types/theme/styles.d.ts.map +1 -1
- package/lib/types/theme/theme.d.ts +6 -7
- package/lib/types/theme/theme.d.ts.map +1 -1
- package/package.json +3 -2
- package/lib/components/container/FloatingContainer.js +0 -1
- package/lib/components/container/FloatingContainer.styles.js +0 -1
- package/lib/components/container/FloatingContainer.web.js +0 -1
- package/lib/components/input/DropdownInput.js +0 -1
- package/lib/components/input/DropdownInputBase.js +0 -1
- package/lib/types/components/container/FloatingContainer.d.ts +0 -22
- package/lib/types/components/container/FloatingContainer.d.ts.map +0 -1
- package/lib/types/components/container/FloatingContainer.styles.d.ts +0 -4
- package/lib/types/components/container/FloatingContainer.styles.d.ts.map +0 -1
- package/lib/types/components/container/FloatingContainer.web.d.ts +0 -4
- package/lib/types/components/container/FloatingContainer.web.d.ts.map +0 -1
- package/lib/types/components/input/DropdownInput.d.ts +0 -8
- package/lib/types/components/input/DropdownInput.d.ts.map +0 -1
- package/lib/types/components/input/DropdownInput.styles.d.ts.map +0 -1
- package/lib/types/components/input/DropdownInputBase.d.ts +0 -38
- package/lib/types/components/input/DropdownInputBase.d.ts.map +0 -1
- /package/lib/components/input/{DropdownInput.styles.js → dropdownInput/DropdownInput.styles.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/container/anchoredContainer/AnchoredContainer.ios.tsx";import{c as _c}from"react/compiler-runtime";import{InlineMount}from"./InlineMount";import{OverlayMount}from"./OverlayMount";import{useAnchoredContainerPosition}from"./useAnchoredContainerPosition";import{jsx as _jsx}from"react/jsx-runtime";export var AnchoredContainer=t0=>{var $=_c(19);var parentRef=t0.parentRef,anchorRef=t0.anchorRef,show=t0.show,position=t0.position,gap=t0.gap,onInvertedChange=t0.onInvertedChange,containerStyle=t0.containerStyle,children=t0.children;var t1;if($[0]!==gap||$[1]!==onInvertedChange||$[2]!==parentRef||$[3]!==position||$[4]!==show){t1={parentRef,show,position,gap,onInvertedChange};$[0]=gap;$[1]=onInvertedChange;$[2]=parentRef;$[3]=position;$[4]=show;$[5]=t1;}else{t1=$[5];}var _useAnchoredContainer=useAnchoredContainerPosition(t1),geometry=_useAnchoredContainer.geometry,inlineStyle=_useAnchoredContainer.inlineStyle,margin=_useAnchoredContainer.margin,onLayout=_useAnchoredContainer.onLayout;if(!show){return null;}if(!anchorRef){var _t;if($[6]!==children||$[7]!==containerStyle||$[8]!==geometry||$[9]!==inlineStyle||$[10]!==onLayout){_t=_jsx(InlineMount,{geometry:geometry,style:inlineStyle,onLayout:onLayout,containerStyle:containerStyle,children:children});$[6]=children;$[7]=containerStyle;$[8]=geometry;$[9]=inlineStyle;$[10]=onLayout;$[11]=_t;}else{_t=$[11];}return _t;}var t2;if($[12]!==anchorRef||$[13]!==children||$[14]!==containerStyle||$[15]!==geometry||$[16]!==margin||$[17]!==onLayout){t2=_jsx(OverlayMount,{anchorRef:anchorRef,geometry:geometry,margin:margin,onLayout:onLayout,containerStyle:containerStyle,children:children});$[12]=anchorRef;$[13]=children;$[14]=containerStyle;$[15]=geometry;$[16]=margin;$[17]=onLayout;$[18]=t2;}else{t2=$[18];}return t2;};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/container/anchoredContainer/AnchoredContainer.tsx";import{c as _c}from"react/compiler-runtime";import{InlineMount}from"./InlineMount";import{useAnchoredContainerPosition}from"./useAnchoredContainerPosition";import{jsx as _jsx}from"react/jsx-runtime";export var AnchoredContainer=t0=>{var $=_c(12);var parentRef=t0.parentRef,show=t0.show,position=t0.position,gap=t0.gap,onInvertedChange=t0.onInvertedChange,containerStyle=t0.containerStyle,children=t0.children;var t1;if($[0]!==gap||$[1]!==onInvertedChange||$[2]!==parentRef||$[3]!==position||$[4]!==show){t1={parentRef,show,position,gap,onInvertedChange};$[0]=gap;$[1]=onInvertedChange;$[2]=parentRef;$[3]=position;$[4]=show;$[5]=t1;}else{t1=$[5];}var _useAnchoredContainer=useAnchoredContainerPosition(t1),geometry=_useAnchoredContainer.geometry,inlineStyle=_useAnchoredContainer.inlineStyle,onLayout=_useAnchoredContainer.onLayout;if(!show){return null;}var t2;if($[6]!==children||$[7]!==containerStyle||$[8]!==geometry||$[9]!==inlineStyle||$[10]!==onLayout){t2=_jsx(InlineMount,{geometry:geometry,style:inlineStyle,onLayout:onLayout,containerStyle:containerStyle,children:children});$[6]=children;$[7]=containerStyle;$[8]=geometry;$[9]=inlineStyle;$[10]=onLayout;$[11]=t2;}else{t2=$[11];}return t2;};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var defaultAnchoredContainerStyles=({spacing})=>({parentMargin:spacing.small});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/container/anchoredContainer/AnchoredContainer.web.tsx";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{useCallback,useEffect,useRef,useState}from"react";import{createPortal}from"react-dom";import{StyleSheet,useWindowDimensions,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useThemedStyles}from"../../../hooks";import{getContainerPlacement}from"./helpers";import{jsx as _jsx}from"react/jsx-runtime";var FIXED_POSITION="fixed";export var AnchoredContainer=t0=>{var $=_c(38);var parentRef=t0.parentRef,show=t0.show,t1=t0.position,gap=t0.gap,onInvertedChange=t0.onInvertedChange,containerStyle=t0.containerStyle,children=t0.children;var position=t1===undefined?"auto":t1;var _useState=useState(),_useState2=_slicedToArray(_useState,2),geometry=_useState2[0],setGeometry=_useState2[1];var _useThemedStyles=useThemedStyles("anchoredContainer",createStyles),_useThemedStyles2=_slicedToArray(_useThemedStyles,1),styles=_useThemedStyles2[0];var _useThemedStyles3=useThemedStyles("anchoredContainer",_temp),_useThemedStyles4=_slicedToArray(_useThemedStyles3,1),t2=_useThemedStyles4[0];var parentMargin=t2.parentMargin;var margin=gap??parentMargin;var inverted=geometry?.inverted;var t3;var t4;if($[0]!==inverted||$[1]!==onInvertedChange){t3=()=>{if(inverted!==undefined){onInvertedChange?.(inverted);}};t4=[inverted,onInvertedChange];$[0]=inverted;$[1]=onInvertedChange;$[2]=t3;$[3]=t4;}else{t3=$[2];t4=$[3];}useEffect(t3,t4);var _useWindowDimensions=useWindowDimensions(),windowHeight=_useWindowDimensions.height;var _useSafeAreaInsets=useSafeAreaInsets(),top=_useSafeAreaInsets.top,bottom=_useSafeAreaInsets.bottom;var anchorRef=useRef(undefined);var contentHeightRef=useRef(0);var t5;if($[4]!==bottom||$[5]!==margin||$[6]!==position||$[7]!==top||$[8]!==windowHeight){t5=()=>{var anchor=anchorRef.current;var contentHeight=contentHeightRef.current;if(!(anchor&&contentHeight)){return;}var viewportTop=top;var viewportBottom=windowHeight-bottom;var availableBelow=viewportBottom-(anchor.y+anchor.height);var availableAbove=anchor.y-viewportTop;var inverted_0=position==="above"||availableBelow<contentHeight+margin&&availableAbove>availableBelow;setGeometry({parentY:anchor.y,parentX:anchor.x,parentWidth:anchor.width,parentHeight:anchor.height,offsetY:anchor.y,contentHeight,inverted:inverted_0,visibleAreaHeight:viewportBottom-viewportTop,maxHeight:Math.max(0,(inverted_0?availableAbove:availableBelow)-margin)});};$[4]=bottom;$[5]=margin;$[6]=position;$[7]=top;$[8]=windowHeight;$[9]=t5;}else{t5=$[9];}var recompute=t5;var t6;if($[10]!==parentRef||$[11]!==recompute){t6=()=>{var node=parentRef.current;if(node?.getBoundingClientRect){var rect=node.getBoundingClientRect();anchorRef.current={x:rect.left,y:rect.top,width:rect.width,height:rect.height};}recompute();};$[10]=parentRef;$[11]=recompute;$[12]=t6;}else{t6=$[12];}var updateAnchor=t6;var t7;var t8;if($[13]!==parentRef||$[14]!==show||$[15]!==updateAnchor){t7=()=>{if(!show||typeof document==="undefined"){return;}updateAnchor();var frame=0;var schedule=()=>{cancelAnimationFrame(frame);frame=requestAnimationFrame(updateAnchor);};window.addEventListener("scroll",schedule,true);window.addEventListener("resize",schedule);var node_0=parentRef.current;var observer;if(node_0&&typeof ResizeObserver!=="undefined"){observer=new ResizeObserver(schedule);observer.observe(node_0);}return()=>{cancelAnimationFrame(frame);window.removeEventListener("scroll",schedule,true);window.removeEventListener("resize",schedule);observer?.disconnect();};};t8=[show,updateAnchor,parentRef];$[13]=parentRef;$[14]=show;$[15]=updateAnchor;$[16]=t7;$[17]=t8;}else{t7=$[16];t8=$[17];}useEffect(t7,t8);var t10;var t9;if($[18]!==show){t9=()=>{if(!show){setGeometry(undefined);anchorRef.current=undefined;contentHeightRef.current=0;}};t10=[show];$[18]=show;$[19]=t10;$[20]=t9;}else{t10=$[19];t9=$[20];}useEffect(t9,t10);var t11;if($[21]!==recompute){t11=e=>{var height=e.nativeEvent.layout.height;if(height!==contentHeightRef.current){contentHeightRef.current=height;recompute();}};$[21]=recompute;$[22]=t11;}else{t11=$[22];}var onLayout=t11;if(!show||typeof document==="undefined"){return null;}var t12;if($[23]!==geometry||$[24]!==margin||$[25]!==styles.hidden){t12=geometry?{left:geometry.parentX,width:geometry.parentWidth,top:geometry.inverted?geometry.parentY-geometry.contentHeight-margin:geometry.parentY+geometry.parentHeight+margin}:styles.hidden;$[23]=geometry;$[24]=margin;$[25]=styles.hidden;$[26]=t12;}else{t12=$[26];}var t13;if($[27]!==containerStyle||$[28]!==styles.container||$[29]!==t12){t13=[styles.container,t12,containerStyle];$[27]=containerStyle;$[28]=styles.container;$[29]=t12;$[30]=t13;}else{t13=$[30];}var t14;if($[31]!==children||$[32]!==geometry){t14=typeof children==="function"?children(getContainerPlacement(geometry)):children;$[31]=children;$[32]=geometry;$[33]=t14;}else{t14=$[33];}var t15;if($[34]!==onLayout||$[35]!==t13||$[36]!==t14){t15=createPortal(_jsx(View,{onLayout:onLayout,style:t13,children:t14}),document.body);$[34]=onLayout;$[35]=t13;$[36]=t14;$[37]=t15;}else{t15=$[37];}return t15;};var createStyles=_themed=>StyleSheet.create({container:{position:FIXED_POSITION,zIndex:9999},hidden:{position:FIXED_POSITION,zIndex:9999,opacity:0,pointerEvents:"none"}});function _temp(t0){var t1=t0.styles;var anchoredContainer=t1.anchoredContainer;return{parentMargin:anchoredContainer.parentMargin};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/container/anchoredContainer/InlineMount.tsx";import{c as _c}from"react/compiler-runtime";import{View}from"react-native";import{getContainerPlacement}from"./helpers";import{jsx as _jsx}from"react/jsx-runtime";export var InlineMount=t0=>{var $=_c(10);var geometry=t0.geometry,style=t0.style,onLayout=t0.onLayout,containerStyle=t0.containerStyle,children=t0.children;var t1;if($[0]!==containerStyle||$[1]!==style){t1=[style,containerStyle];$[0]=containerStyle;$[1]=style;$[2]=t1;}else{t1=$[2];}var t2;if($[3]!==children||$[4]!==geometry){t2=typeof children==="function"?children(getContainerPlacement(geometry)):children;$[3]=children;$[4]=geometry;$[5]=t2;}else{t2=$[5];}var t3;if($[6]!==onLayout||$[7]!==t1||$[8]!==t2){t3=_jsx(View,{onLayout:onLayout,style:t1,children:t2});$[6]=onLayout;$[7]=t1;$[8]=t2;$[9]=t3;}else{t3=$[9];}return t3;};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/container/anchoredContainer/OverlayMount.tsx";import{useCallback}from"react";import{StyleSheet,View}from"react-native";import Animated,{measure,useAnimatedStyle,useFrameCallback,useSharedValue}from"react-native-reanimated";import{FullWindowOverlay}from"react-native-screens";import{getContainerPlacement}from"./helpers";import{jsx as _jsx}from"react/jsx-runtime";export var OverlayMount=({anchorRef,geometry,margin,onLayout,containerStyle,children})=>{var anchorX=useSharedValue(0);var anchorY=useSharedValue(0);var anchorWidth=useSharedValue(0);var anchorHeight=useSharedValue(0);var trackAnchor=useCallback(()=>{"worklet";var measured=measure(anchorRef);if(!measured)return;anchorX.value=measured.pageX;anchorY.value=measured.pageY;anchorWidth.value=measured.width;anchorHeight.value=measured.height;},[anchorRef,anchorX,anchorY,anchorWidth,anchorHeight]);useFrameCallback(trackAnchor,true);var inverted=geometry?.inverted??false;var contentHeight=geometry?.contentHeight??0;var overlayStyle=useAnimatedStyle(()=>({width:anchorWidth.value,opacity:anchorWidth.value>0&&contentHeight>0?1:0,transform:[{translateX:anchorX.value},{translateY:inverted?anchorY.value-contentHeight-margin:anchorY.value+anchorHeight.value+margin}]}));return _jsx(FullWindowOverlay,{children:_jsx(View,{style:StyleSheet.absoluteFill,pointerEvents:"box-none",children:_jsx(Animated.View,{onLayout:onLayout,pointerEvents:"auto",style:[overlayStyles.container,overlayStyle,containerStyle],children:typeof children==="function"?children(getContainerPlacement(geometry)):children})})});};var overlayStyles=StyleSheet.create({container:{position:"absolute",left:0,top:0}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var EMPTY_CONTAINER_GEOMETRY={parentY:0,parentHeight:0,offsetY:0,contentHeight:0,inverted:false,visibleAreaHeight:0,maxHeight:Number.POSITIVE_INFINITY};export var EMPTY_PLACEMENT={inverted:false,maxHeight:Number.POSITIVE_INFINITY};export var getContainerPlacement=geometry=>geometry?{inverted:geometry.inverted,maxHeight:geometry.maxHeight}:EMPTY_PLACEMENT;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{AnchoredContainer}from"./AnchoredContainer";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{useCallback,useEffect,useRef,useState}from"react";import{Platform,StyleSheet,useWindowDimensions}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{usePersistentKeyboardHeight,useThemedStyles}from"../../../hooks";export var useAnchoredContainerPosition=t0=>{var $=_c(26);var parentRef=t0.parentRef,show=t0.show,t1=t0.position,gap=t0.gap,onInvertedChange=t0.onInvertedChange;var position=t1===undefined?"auto":t1;var _useState=useState(),_useState2=_slicedToArray(_useState,2),geometry=_useState2[0],setGeometry=_useState2[1];var t2;if($[0]!==gap||$[1]!==geometry){t2={props:{geometry,gap}};$[0]=gap;$[1]=geometry;$[2]=t2;}else{t2=$[2];}var _useThemedStyles=useThemedStyles("anchoredContainer",createStyles,t2),_useThemedStyles2=_slicedToArray(_useThemedStyles,1),styles=_useThemedStyles2[0];var _useThemedStyles3=useThemedStyles("anchoredContainer",_temp),_useThemedStyles4=_slicedToArray(_useThemedStyles3,1),t3=_useThemedStyles4[0];var parentMargin=t3.parentMargin;var margin=gap??parentMargin;var _useWindowDimensions=useWindowDimensions(),screenHeight=_useWindowDimensions.height;var _useSafeAreaInsets=useSafeAreaInsets(),top=_useSafeAreaInsets.top,bottom=_useSafeAreaInsets.bottom;var _usePersistentKeyboar=usePersistentKeyboardHeight(),keyboardHeight=_usePersistentKeyboar.keyboardHeight;var keyboardInset=Platform.OS==="ios"?keyboardHeight:0;var contentHeightRef=useRef(0);var t4;if($[3]!==bottom||$[4]!==keyboardInset||$[5]!==margin||$[6]!==parentRef||$[7]!==position||$[8]!==screenHeight||$[9]!==top){t4=()=>{var contentHeight=contentHeightRef.current;if(!contentHeight){return;}parentRef.current?.measure((_x,offsetY,_w,height)=>{parentRef.current?.measureInWindow((_windowX,windowY,_windowWidth,_windowHeight)=>{var viewportTop=top;var viewportBottom=screenHeight-keyboardInset-bottom;var availableBelow=viewportBottom-(windowY+height);var availableAbove=windowY-viewportTop;var inverted=position==="above"||availableBelow<contentHeight+margin&&availableAbove>availableBelow;setGeometry({parentY:windowY,parentHeight:height,offsetY,contentHeight,inverted,visibleAreaHeight:viewportBottom-viewportTop,maxHeight:Math.max(0,(inverted?availableAbove:availableBelow)-margin)});});});};$[3]=bottom;$[4]=keyboardInset;$[5]=margin;$[6]=parentRef;$[7]=position;$[8]=screenHeight;$[9]=top;$[10]=t4;}else{t4=$[10];}var measure=t4;var t5;if($[11]!==measure){t5=e=>{contentHeightRef.current=e.nativeEvent.layout.height;measure();};$[11]=measure;$[12]=t5;}else{t5=$[12];}var onLayout=t5;var t6;var t7;if($[13]!==measure||$[14]!==show){t6=()=>{if(!show){contentHeightRef.current=0;setGeometry(undefined);return;}measure();};t7=[show,measure];$[13]=measure;$[14]=show;$[15]=t6;$[16]=t7;}else{t6=$[15];t7=$[16];}useEffect(t6,t7);var inverted_0=geometry?.inverted;var t8;var t9;if($[17]!==inverted_0||$[18]!==onInvertedChange){t8=()=>{if(inverted_0!==undefined){onInvertedChange?.(inverted_0);}};t9=[inverted_0,onInvertedChange];$[17]=inverted_0;$[18]=onInvertedChange;$[19]=t8;$[20]=t9;}else{t8=$[19];t9=$[20];}useEffect(t8,t9);var t10;if($[21]!==geometry||$[22]!==margin||$[23]!==onLayout||$[24]!==styles.container){t10={geometry,inlineStyle:styles.container,margin,onLayout};$[21]=geometry;$[22]=margin;$[23]=onLayout;$[24]=styles.container;$[25]=t10;}else{t10=$[25];}return t10;};var createStyles=({styles:{anchoredContainer}},{geometry,gap})=>{var margin=gap??anchoredContainer.parentMargin;return StyleSheet.create({container:geometry?{position:"absolute",zIndex:10,elevation:8,left:0,right:0,top:geometry.inverted?geometry.offsetY-geometry.contentHeight-margin:geometry.offsetY+geometry.parentHeight+margin}:{position:"absolute",opacity:0,pointerEvents:"none"}});};function _temp(t0){var t1=t0.styles;var anchoredContainer=t1.anchoredContainer;return{parentMargin:anchoredContainer.parentMargin};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{AnchoredContainer}from"./anchoredContainer";export{FormContainer}from"./FormContainer";export{FormRow}from"./FormRow";export{Panel}from"./Panel";
|
package/lib/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Action,ActionBase,IconAction,IconActionBase}from"./action";export{AlertIndicator}from"./alert";export{Avatar}from"./avatar";export{Button,ButtonBase,IconButton,IconButtonBase}from"./button";export{
|
|
1
|
+
export{Action,ActionBase,IconAction,IconActionBase}from"./action";export{AlertIndicator}from"./alert";export{Avatar}from"./avatar";export{Button,ButtonBase,IconButton,IconButtonBase}from"./button";export{AnchoredContainer,FormContainer,FormRow,Panel}from"./container";export{Icon,IconBase}from"./icon";export{CounterInput,DropdownInput,InputAction,InputBase,InputRowContainer,InputScaffold,NumberInput,RatingInput,SelectionInput,TextInput,TimeInput,ToggleInput}from"./input";export{ListItem,ListItemAlert,ListItemAvatar,ListItemFooter,ListItemRow}from"./listItem";export{Menu,MenuItem}from"./menu";export{getRatingIcons,Rating,ratingToValue,valueToRating}from"./rating";export{SwipeAction,SwipeableContainer}from"./swipe";export{Tag,TagIcon}from"./tag";export{HighlightedText,Text}from"./text";export{Toast}from"./toast";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/CounterInput.tsx";var _excluded=["
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/CounterInput.tsx";var _excluded=["value","onChange","label","helpText","mandatory","hasError","disableKeyboardInput","disabled","variant","containerStyle","interval"];function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}import{c as _c}from"react/compiler-runtime";import{StyleSheet}from"react-native";import{useThemedStyles}from"../../hooks";import{InputAction}from"./InputAction";import{InputRowContainer}from"./InputRowContainer";import{InputScaffold}from"./InputScaffold";import{NumberInputBase}from"./NumberInputBase";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export var CounterInput=t0=>{var $=_c(57);var containerStyle;var disableKeyboardInput;var disabledProp;var hasError;var helpText;var label;var mandatory;var onChange;var props;var t1;var t2;var value;if($[0]!==t0){value=t0.value;onChange=t0.onChange;label=t0.label;helpText=t0.helpText;mandatory=t0.mandatory;hasError=t0.hasError;disableKeyboardInput=t0.disableKeyboardInput;disabledProp=t0.disabled;t1=t0.variant;containerStyle=t0.containerStyle;t2=t0.interval;props=_objectWithoutProperties(t0,_excluded);$[0]=t0;$[1]=containerStyle;$[2]=disableKeyboardInput;$[3]=disabledProp;$[4]=hasError;$[5]=helpText;$[6]=label;$[7]=mandatory;$[8]=onChange;$[9]=props;$[10]=t1;$[11]=t2;$[12]=value;}else{containerStyle=$[1];disableKeyboardInput=$[2];disabledProp=$[3];hasError=$[4];helpText=$[5];label=$[6];mandatory=$[7];onChange=$[8];props=$[9];t1=$[10];t2=$[11];value=$[12];}var variant=t1===undefined?"regular":t1;var interval=t2===undefined?1:t2;var _useThemedStyles=useThemedStyles("counterInput",createStyles),_useThemedStyles2=_slicedToArray(_useThemedStyles,2),styles=_useThemedStyles2[0],t3=_useThemedStyles2[1];var icons=t3.icons;var disabled=disabledProp||!onChange;var t4;if($[13]!==value){t4=Number.parseFloat(value??"0")||0;$[13]=value;$[14]=t4;}else{t4=$[14];}var numericValue=t4;var t5;if($[15]!==interval||$[16]!==numericValue||$[17]!==onChange||$[18]!==props){t5=()=>onChange?.(Math.max(numericValue-interval,props.min??0).toString());$[15]=interval;$[16]=numericValue;$[17]=onChange;$[18]=props;$[19]=t5;}else{t5=$[19];}var t6;if($[20]!==disabled||$[21]!==icons.decrease||$[22]!==t5||$[23]!==variant){t6=_jsx(InputAction,{...icons.decrease,variant:variant,disabled:disabled,onPress:t5});$[20]=disabled;$[21]=icons.decrease;$[22]=t5;$[23]=variant;$[24]=t6;}else{t6=$[24];}var t7;if($[25]!==onChange||$[26]!==props){t7=newValue=>{if(!newValue){onChange?.("");return;}onChange?.(Math.min(Math.max(Number.parseFloat(newValue??"0"),props.min??0),props.max??Number.MAX_VALUE).toString());};$[25]=onChange;$[26]=props;$[27]=t7;}else{t7=$[27];}var t8=disabled||disableKeyboardInput;var t9;if($[28]!==props||$[29]!==styles.input||$[30]!==t7||$[31]!==t8||$[32]!==value||$[33]!==variant){t9=_jsx(NumberInputBase,{clearButtonMode:"never",...props,value:value,variant:variant,onChangeText:t7,disabled:t8,inputStyle:styles.input});$[28]=props;$[29]=styles.input;$[30]=t7;$[31]=t8;$[32]=value;$[33]=variant;$[34]=t9;}else{t9=$[34];}var t10;if($[35]!==interval||$[36]!==numericValue||$[37]!==onChange||$[38]!==props){t10=()=>onChange?.(Math.min(numericValue+interval,props.max??Number.MAX_VALUE).toString());$[35]=interval;$[36]=numericValue;$[37]=onChange;$[38]=props;$[39]=t10;}else{t10=$[39];}var t11;if($[40]!==disabled||$[41]!==icons.increase||$[42]!==t10||$[43]!==variant){t11=_jsx(InputAction,{...icons.increase,disabled:disabled,variant:variant,onPress:t10});$[40]=disabled;$[41]=icons.increase;$[42]=t10;$[43]=variant;$[44]=t11;}else{t11=$[44];}var t12;if($[45]!==disabled||$[46]!==t11||$[47]!==t6||$[48]!==t9){t12=_jsxs(InputRowContainer,{disabled:disabled,children:[t6,t9,t11]});$[45]=disabled;$[46]=t11;$[47]=t6;$[48]=t9;$[49]=t12;}else{t12=$[49];}var t13;if($[50]!==containerStyle||$[51]!==hasError||$[52]!==helpText||$[53]!==label||$[54]!==mandatory||$[55]!==t12){t13=_jsx(InputScaffold,{label:label,helpText:helpText,mandatory:mandatory,hasError:hasError,containerStyle:containerStyle,children:t12});$[50]=containerStyle;$[51]=hasError;$[52]=helpText;$[53]=label;$[54]=mandatory;$[55]=t12;$[56]=t13;}else{t13=$[56];}return t13;};var createStyles=({styles:{inputBase}})=>StyleSheet.create({input:{flexGrow:1,flexBasis:0,textAlign:"center",backgroundColor:inputBase.container.backgroundColor.enabled}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/NumberInput.tsx";var _excluded=["keyboardType","enabledRepresentations","disabled","clearButtonMode","placeholder","placeholder2","maxLength","value","variant","onChange","onSubmitEditing","ref"];function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}import{c as _c}from"react/compiler-runtime";import{StyleSheet,View}from"react-native";import{useThemedStyles}from"../../hooks";import{Text}from"../text";import{InputAction}from"./InputAction";import{InputRowContainer}from"./InputRowContainer";import{InputScaffold}from"./InputScaffold";import{NumberInputBase}from"./NumberInputBase";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";var getNextMode=(enabledRepresentations,current)=>{var currentIndex=enabledRepresentations.indexOf(current);var nextIndex=currentIndex+1>=enabledRepresentations.length?0:currentIndex+1;return enabledRepresentations[nextIndex];};var getNextValue=(nextMode,{value,representation})=>{if(nextMode===representation)return undefined;switch(nextMode){case"number":return{representation:"number",value:value?.[0]??""};case"fraction":return{representation:"fraction",value:[value?.[0]??(typeof value==="string"?value:""),"",""]};case"range":return{representation:"range",value:[value?.[0]??(typeof value==="string"?value:""),""]};}};var DEFAULT_ENABLED_REPRESENTATIONS=["number","fraction","range"];var DEFAULT_VALUE={representation:"number",value:""};export var NumberInput=t0=>{var $=_c(79);var baseProps;var clearButtonMode;var maxLength;var onChange;var onSubmitEditing;var placeholder;var placeholder2;var ref;var t1;var t2;var t3;var t4;var t5;if($[0]!==t0){t1=t0.keyboardType;t2=t0.enabledRepresentations;t3=t0.disabled;clearButtonMode=t0.clearButtonMode;placeholder=t0.placeholder;placeholder2=t0.placeholder2;maxLength=t0.maxLength;t4=t0.value;t5=t0.variant;onChange=t0.onChange;onSubmitEditing=t0.onSubmitEditing;ref=t0.ref;baseProps=_objectWithoutProperties(t0,_excluded);$[0]=t0;$[1]=baseProps;$[2]=clearButtonMode;$[3]=maxLength;$[4]=onChange;$[5]=onSubmitEditing;$[6]=placeholder;$[7]=placeholder2;$[8]=ref;$[9]=t1;$[10]=t2;$[11]=t3;$[12]=t4;$[13]=t5;}else{baseProps=$[1];clearButtonMode=$[2];maxLength=$[3];onChange=$[4];onSubmitEditing=$[5];placeholder=$[6];placeholder2=$[7];ref=$[8];t1=$[9];t2=$[10];t3=$[11];t4=$[12];t5=$[13];}var keyboardType=t1===undefined?"number-pad":t1;var enabledRepresentations=t2===undefined?DEFAULT_ENABLED_REPRESENTATIONS:t2;var disabled=t3===undefined?false:t3;var value=t4===undefined?DEFAULT_VALUE:t4;var variant=t5===undefined?"regular":t5;var t6;if($[14]!==value){t6={props:{value}};$[14]=value;$[15]=t6;}else{t6=$[15];}var _useThemedStyles=useThemedStyles("numberInput",createStyles,t6),_useThemedStyles2=_slicedToArray(_useThemedStyles,2),styles=_useThemedStyles2[0],t7=_useThemedStyles2[1];var icons=t7.icons;var icon=icons[value.representation];var t8;if($[16]!==enabledRepresentations||$[17]!==onChange||$[18]!==value){t8=()=>{var nextMode=getNextMode(enabledRepresentations,value.representation);if(!nextMode){return;}var nextValue=getNextValue(nextMode,value);if(!nextValue){return;}onChange?.(nextValue);};$[16]=enabledRepresentations;$[17]=onChange;$[18]=value;$[19]=t8;}else{t8=$[19];}var handleChangeMode=t8;var t9;if($[20]!==onChange||$[21]!==value.representation||$[22]!==value.value?.[1]||$[23]!==value.value?.[2]){t9=text=>{bb33:switch(value.representation){case"number":{onChange?.({representation:value.representation,value:text});break bb33;}case"fraction":{onChange?.({representation:value.representation,value:[text,value.value?.[1]??"",value.value?.[2]??""]});break bb33;}case"range":{onChange?.({representation:value.representation,value:[text,value.value?.[1]??""]});}}};$[20]=onChange;$[21]=value.representation;$[22]=value.value?.[1];$[23]=value.value?.[2];$[24]=t9;}else{t9=$[24];}var handlePrimaryInputChangeText=t9;var t10=enabledRepresentations.length>1?handleChangeMode:undefined;var t11;if($[25]!==disabled||$[26]!==icon||$[27]!==t10||$[28]!==variant){t11=_jsx(InputAction,{disabled:disabled,variant:variant,...icon,onPress:t10});$[25]=disabled;$[26]=icon;$[27]=t10;$[28]=variant;$[29]=t11;}else{t11=$[29];}var t12=value.representation==="range"?placeholder2:placeholder;var t13=value.representation==="number"?value.value:value.value?.[0];var t14=value.representation==="fraction"?"number-pad":keyboardType;var t15=value.representation==="number"?onSubmitEditing:undefined;var t16;if($[30]!==clearButtonMode||$[31]!==disabled||$[32]!==handlePrimaryInputChangeText||$[33]!==maxLength||$[34]!==ref||$[35]!==styles.input||$[36]!==t12||$[37]!==t13||$[38]!==t14||$[39]!==t15||$[40]!==variant){t16=_jsx(NumberInputBase,{ref:ref,disabled:disabled,variant:variant,placeholder:t12,maxLength:maxLength,clearButtonMode:clearButtonMode,value:t13,keyboardType:t14,inputStyle:styles.input,onChangeText:handlePrimaryInputChangeText,onSubmitEditing:t15});$[30]=clearButtonMode;$[31]=disabled;$[32]=handlePrimaryInputChangeText;$[33]=maxLength;$[34]=ref;$[35]=styles.input;$[36]=t12;$[37]=t13;$[38]=t14;$[39]=t15;$[40]=variant;$[41]=t16;}else{t16=$[41];}var t17;if($[42]!==clearButtonMode||$[43]!==disabled||$[44]!==maxLength||$[45]!==onChange||$[46]!==onSubmitEditing||$[47]!==placeholder2||$[48]!==styles.input||$[49]!==value.representation||$[50]!==value.value?.[0]||$[51]!==value.value?.[1]||$[52]!==value.value?.[2]||$[53]!==variant){t17=value.representation==="fraction"&&_jsx(NumberInputBase,{disabled:disabled,variant:variant,placeholder:placeholder2,value:value.value?.[1],maxLength:maxLength,clearButtonMode:clearButtonMode,keyboardType:"number-pad",inputStyle:styles.input,onChangeText:text_0=>onChange?.({representation:value.representation,value:[value.value?.[0]??"",text_0,value.value?.[2]??""]}),onSubmitEditing:onSubmitEditing});$[42]=clearButtonMode;$[43]=disabled;$[44]=maxLength;$[45]=onChange;$[46]=onSubmitEditing;$[47]=placeholder2;$[48]=styles.input;$[49]=value.representation;$[50]=value.value?.[0];$[51]=value.value?.[1];$[52]=value.value?.[2];$[53]=variant;$[54]=t17;}else{t17=$[54];}var t18;if($[55]!==clearButtonMode||$[56]!==disabled||$[57]!==keyboardType||$[58]!==maxLength||$[59]!==onChange||$[60]!==onSubmitEditing||$[61]!==placeholder2||$[62]!==styles.input||$[63]!==styles.separator||$[64]!==value.representation||$[65]!==value.value?.[0]||$[66]!==value.value?.[1]||$[67]!==value.value?.[2]||$[68]!==variant){t18=value.representation!=="number"&&_jsxs(_Fragment,{children:[_jsx(View,{style:styles.separator,children:_jsx(Text,{variant:"title",children:value.representation==="fraction"?"/":"\u2212"})}),_jsx(NumberInputBase,{disabled:disabled,variant:variant,placeholder:placeholder2,value:value.representation==="fraction"?value.value?.[2]:value.value?.[1],maxLength:maxLength,clearButtonMode:clearButtonMode,keyboardType:value.representation==="fraction"?"number-pad":keyboardType,inputStyle:styles.input,onChangeText:text_1=>{if(value.representation==="fraction"){onChange?.({representation:value.representation,value:[value.value?.[0]??"",value.value?.[1]??"",text_1]});return;}onChange?.({representation:value.representation,value:[value.value?.[0]??"",text_1]});},onSubmitEditing:onSubmitEditing})]});$[55]=clearButtonMode;$[56]=disabled;$[57]=keyboardType;$[58]=maxLength;$[59]=onChange;$[60]=onSubmitEditing;$[61]=placeholder2;$[62]=styles.input;$[63]=styles.separator;$[64]=value.representation;$[65]=value.value?.[0];$[66]=value.value?.[1];$[67]=value.value?.[2];$[68]=variant;$[69]=t18;}else{t18=$[69];}var t19;if($[70]!==disabled||$[71]!==t11||$[72]!==t16||$[73]!==t17||$[74]!==t18){t19=_jsxs(InputRowContainer,{disabled:disabled,children:[t11,t16,t17,t18]});$[70]=disabled;$[71]=t11;$[72]=t16;$[73]=t17;$[74]=t18;$[75]=t19;}else{t19=$[75];}var t20;if($[76]!==baseProps||$[77]!==t19){t20=_jsx(InputScaffold,{...baseProps,children:t19});$[76]=baseProps;$[77]=t19;$[78]=t20;}else{t20=$[78];}return t20;};var createStyles=(_,{value})=>StyleSheet.create({input:{flexGrow:1,flexBasis:0,textAlign:value.representation==="number"?"auto":"center"},separator:{justifyContent:"center"}});
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/NumberInput.tsx";var _excluded=["keyboardType","enabledRepresentations","disabled","clearButtonMode","placeholder","maxLength","value","variant","onChange","onSubmitEditing","ref"];function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}import{c as _c}from"react/compiler-runtime";import{StyleSheet,View}from"react-native";import{useThemedStyles}from"../../hooks";import{Text}from"../text";import{InputAction}from"./InputAction";import{InputRowContainer}from"./InputRowContainer";import{InputScaffold}from"./InputScaffold";import{NumberInputBase}from"./NumberInputBase";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";var getNextMode=(enabledRepresentations,current)=>{var currentIndex=enabledRepresentations.indexOf(current);var nextIndex=currentIndex+1>=enabledRepresentations.length?0:currentIndex+1;return enabledRepresentations[nextIndex];};var getNextValue=(nextMode,{value,representation})=>{if(nextMode===representation)return undefined;switch(nextMode){case"number":return{representation:"number",value:value?.[0]??""};case"fraction":return{representation:"fraction",value:[value?.[0]??(typeof value==="string"?value:""),"",""]};case"range":return{representation:"range",value:[value?.[0]??(typeof value==="string"?value:""),""]};}};var DEFAULT_ENABLED_REPRESENTATIONS=["number","fraction","range"];var DEFAULT_VALUE={representation:"number",value:""};export var NumberInput=t0=>{var $=_c(83);var baseProps;var clearButtonMode;var maxLength;var onChange;var onSubmitEditing;var placeholder;var ref;var t1;var t2;var t3;var t4;var t5;if($[0]!==t0){t1=t0.keyboardType;t2=t0.enabledRepresentations;t3=t0.disabled;clearButtonMode=t0.clearButtonMode;placeholder=t0.placeholder;maxLength=t0.maxLength;t4=t0.value;t5=t0.variant;onChange=t0.onChange;onSubmitEditing=t0.onSubmitEditing;ref=t0.ref;baseProps=_objectWithoutProperties(t0,_excluded);$[0]=t0;$[1]=baseProps;$[2]=clearButtonMode;$[3]=maxLength;$[4]=onChange;$[5]=onSubmitEditing;$[6]=placeholder;$[7]=ref;$[8]=t1;$[9]=t2;$[10]=t3;$[11]=t4;$[12]=t5;}else{baseProps=$[1];clearButtonMode=$[2];maxLength=$[3];onChange=$[4];onSubmitEditing=$[5];placeholder=$[6];ref=$[7];t1=$[8];t2=$[9];t3=$[10];t4=$[11];t5=$[12];}var keyboardType=t1===undefined?"number-pad":t1;var enabledRepresentations=t2===undefined?DEFAULT_ENABLED_REPRESENTATIONS:t2;var disabled=t3===undefined?false:t3;var value=t4===undefined?DEFAULT_VALUE:t4;var variant=t5===undefined?"regular":t5;var t6;if($[13]!==placeholder){t6=key=>placeholder?.[key]??placeholder?.value;$[13]=placeholder;$[14]=t6;}else{t6=$[14];}var getPlaceholder=t6;var t7;if($[15]!==value){t7={props:{value}};$[15]=value;$[16]=t7;}else{t7=$[16];}var _useThemedStyles=useThemedStyles("numberInput",createStyles,t7),_useThemedStyles2=_slicedToArray(_useThemedStyles,2),styles=_useThemedStyles2[0],t8=_useThemedStyles2[1];var icons=t8.icons;var icon=icons[value.representation];var t9;if($[17]!==enabledRepresentations||$[18]!==onChange||$[19]!==value){t9=()=>{var nextMode=getNextMode(enabledRepresentations,value.representation);if(!nextMode){return;}var nextValue=getNextValue(nextMode,value);if(!nextValue){return;}onChange?.(nextValue);};$[17]=enabledRepresentations;$[18]=onChange;$[19]=value;$[20]=t9;}else{t9=$[20];}var handleChangeMode=t9;var t10;if($[21]!==onChange||$[22]!==value.representation||$[23]!==value.value?.[1]||$[24]!==value.value?.[2]){t10=text=>{bb47:switch(value.representation){case"number":{onChange?.({representation:value.representation,value:text});break bb47;}case"fraction":{onChange?.({representation:value.representation,value:[text,value.value?.[1]??"",value.value?.[2]??""]});break bb47;}case"range":{onChange?.({representation:value.representation,value:[text,value.value?.[1]??""]});}}};$[21]=onChange;$[22]=value.representation;$[23]=value.value?.[1];$[24]=value.value?.[2];$[25]=t10;}else{t10=$[25];}var handlePrimaryInputChangeText=t10;var t11=enabledRepresentations.length>1?handleChangeMode:undefined;var t12;if($[26]!==disabled||$[27]!==icon||$[28]!==t11||$[29]!==variant){t12=_jsx(InputAction,{disabled:disabled,variant:variant,...icon,onPress:t11});$[26]=disabled;$[27]=icon;$[28]=t11;$[29]=variant;$[30]=t12;}else{t12=$[30];}var t13;if($[31]!==getPlaceholder||$[32]!==value.representation){t13=value.representation==="range"?getPlaceholder("start"):value.representation==="fraction"?getPlaceholder("whole"):getPlaceholder("value");$[31]=getPlaceholder;$[32]=value.representation;$[33]=t13;}else{t13=$[33];}var t14=value.representation==="number"?value.value:value.value?.[0];var t15=value.representation==="fraction"?"number-pad":keyboardType;var t16=value.representation==="number"?onSubmitEditing:undefined;var t17;if($[34]!==clearButtonMode||$[35]!==disabled||$[36]!==handlePrimaryInputChangeText||$[37]!==maxLength||$[38]!==ref||$[39]!==styles.input||$[40]!==t13||$[41]!==t14||$[42]!==t15||$[43]!==t16||$[44]!==variant){t17=_jsx(NumberInputBase,{ref:ref,disabled:disabled,variant:variant,placeholder:t13,maxLength:maxLength,clearButtonMode:clearButtonMode,value:t14,keyboardType:t15,inputStyle:styles.input,onChangeText:handlePrimaryInputChangeText,onSubmitEditing:t16});$[34]=clearButtonMode;$[35]=disabled;$[36]=handlePrimaryInputChangeText;$[37]=maxLength;$[38]=ref;$[39]=styles.input;$[40]=t13;$[41]=t14;$[42]=t15;$[43]=t16;$[44]=variant;$[45]=t17;}else{t17=$[45];}var t18;if($[46]!==clearButtonMode||$[47]!==disabled||$[48]!==getPlaceholder||$[49]!==maxLength||$[50]!==onChange||$[51]!==onSubmitEditing||$[52]!==styles.input||$[53]!==value.representation||$[54]!==value.value?.[0]||$[55]!==value.value?.[1]||$[56]!==value.value?.[2]||$[57]!==variant){t18=value.representation==="fraction"&&_jsx(NumberInputBase,{disabled:disabled,variant:variant,placeholder:getPlaceholder("numerator"),value:value.value?.[1],maxLength:maxLength,clearButtonMode:clearButtonMode,keyboardType:"number-pad",inputStyle:styles.input,onChangeText:text_0=>onChange?.({representation:value.representation,value:[value.value?.[0]??"",text_0,value.value?.[2]??""]}),onSubmitEditing:onSubmitEditing});$[46]=clearButtonMode;$[47]=disabled;$[48]=getPlaceholder;$[49]=maxLength;$[50]=onChange;$[51]=onSubmitEditing;$[52]=styles.input;$[53]=value.representation;$[54]=value.value?.[0];$[55]=value.value?.[1];$[56]=value.value?.[2];$[57]=variant;$[58]=t18;}else{t18=$[58];}var t19;if($[59]!==clearButtonMode||$[60]!==disabled||$[61]!==getPlaceholder||$[62]!==keyboardType||$[63]!==maxLength||$[64]!==onChange||$[65]!==onSubmitEditing||$[66]!==styles.input||$[67]!==styles.separator||$[68]!==value.representation||$[69]!==value.value?.[0]||$[70]!==value.value?.[1]||$[71]!==value.value?.[2]||$[72]!==variant){t19=value.representation!=="number"&&_jsxs(_Fragment,{children:[_jsx(View,{style:styles.separator,children:_jsx(Text,{variant:"title",children:value.representation==="fraction"?"/":"\u2212"})}),_jsx(NumberInputBase,{disabled:disabled,variant:variant,placeholder:value.representation==="fraction"?getPlaceholder("denominator"):getPlaceholder("end"),value:value.representation==="fraction"?value.value?.[2]:value.value?.[1],maxLength:maxLength,clearButtonMode:clearButtonMode,keyboardType:value.representation==="fraction"?"number-pad":keyboardType,inputStyle:styles.input,onChangeText:text_1=>{if(value.representation==="fraction"){onChange?.({representation:value.representation,value:[value.value?.[0]??"",value.value?.[1]??"",text_1]});return;}onChange?.({representation:value.representation,value:[value.value?.[0]??"",text_1]});},onSubmitEditing:onSubmitEditing})]});$[59]=clearButtonMode;$[60]=disabled;$[61]=getPlaceholder;$[62]=keyboardType;$[63]=maxLength;$[64]=onChange;$[65]=onSubmitEditing;$[66]=styles.input;$[67]=styles.separator;$[68]=value.representation;$[69]=value.value?.[0];$[70]=value.value?.[1];$[71]=value.value?.[2];$[72]=variant;$[73]=t19;}else{t19=$[73];}var t20;if($[74]!==disabled||$[75]!==t12||$[76]!==t17||$[77]!==t18||$[78]!==t19){t20=_jsxs(InputRowContainer,{disabled:disabled,children:[t12,t17,t18,t19]});$[74]=disabled;$[75]=t12;$[76]=t17;$[77]=t18;$[78]=t19;$[79]=t20;}else{t20=$[79];}var t21;if($[80]!==baseProps||$[81]!==t20){t21=_jsx(InputScaffold,{...baseProps,children:t20});$[80]=baseProps;$[81]=t20;$[82]=t21;}else{t21=$[82];}return t21;};var createStyles=(_,{value})=>StyleSheet.create({input:{flexGrow:1,flexBasis:0,textAlign:value.representation==="number"?"auto":"center"},separator:{justifyContent:"center"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/SelectionInput.tsx";var _excluded=["label","disabled","placeholder","hideLabel","selectionMode","
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/SelectionInput.tsx";var _excluded=["label","disabled","placeholder","hideLabel","selectionMode","value","style","variant","onOpen","onChange"];function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}import{c as _c}from"react/compiler-runtime";import{StyleSheet,View}from"react-native";import{useThemedStyles}from"../../hooks";import{ActionBase}from"../action";import{InteractiveIcon}from"../icon";import{Tag}from"../tag";import{Text}from"../text";import{InputScaffold}from"./InputScaffold";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";var getItemKey=item=>"id"in item?item.id:item.value;export var SelectionInput=t0=>{var $=_c(50);var disabledProp;var hideLabel;var label;var onChange;var onOpen;var placeholder;var props;var selectionMode;var styleOverrides;var t1;var value;if($[0]!==t0){label=t0.label;disabledProp=t0.disabled;placeholder=t0.placeholder;hideLabel=t0.hideLabel;selectionMode=t0.selectionMode;value=t0.value;styleOverrides=t0.style;t1=t0.variant;onOpen=t0.onOpen;onChange=t0.onChange;props=_objectWithoutProperties(t0,_excluded);$[0]=t0;$[1]=disabledProp;$[2]=hideLabel;$[3]=label;$[4]=onChange;$[5]=onOpen;$[6]=placeholder;$[7]=props;$[8]=selectionMode;$[9]=styleOverrides;$[10]=t1;$[11]=value;}else{disabledProp=$[1];hideLabel=$[2];label=$[3];onChange=$[4];onOpen=$[5];placeholder=$[6];props=$[7];selectionMode=$[8];styleOverrides=$[9];t1=$[10];value=$[11];}var variant=t1===undefined?"regular":t1;var disabled=disabledProp||!onOpen;var t2;if($[12]!==styleOverrides){t2={selectionInput:styleOverrides};$[12]=styleOverrides;$[13]=t2;}else{t2=$[13];}var t3;if($[14]!==disabled||$[15]!==variant){t3={disabled,variant};$[14]=disabled;$[15]=variant;$[16]=t3;}else{t3=$[16];}var t4;if($[17]!==t2||$[18]!==t3){t4={styles:t2,props:t3};$[17]=t2;$[18]=t3;$[19]=t4;}else{t4=$[19];}var _useThemedStyles=useThemedStyles("selectionInput",createStyles,t4),_useThemedStyles2=_slicedToArray(_useThemedStyles,2),styles=_useThemedStyles2[0],t5=_useThemedStyles2[1];var style=t5.style,icons=t5.icons;var hasSelection=selectionMode==="single"?!!value:!!value?.length;var t6;if($[20]!==onChange||$[21]!==selectionMode||$[22]!==value){t6=item=>{if(!onChange){return;}if(selectionMode==="single"){onChange(undefined);return;}if(Array.isArray(value)){onChange(value.filter(selectedItem=>getItemKey(selectedItem)!==getItemKey(item)));}};$[20]=onChange;$[21]=selectionMode;$[22]=value;$[23]=t6;}else{t6=$[23];}var handleRemove=t6;var t7=!hideLabel&&label;var t8;if($[24]!==styles.container||$[25]!==styles.containerPressed){t8=t9=>{var pressed=t9.pressed;return[styles.container,pressed&&styles.containerPressed];};$[24]=styles.container;$[25]=styles.containerPressed;$[26]=t8;}else{t8=$[26];}var t9;if($[27]!==disabled||$[28]!==handleRemove||$[29]!==hasSelection||$[30]!==icons.showOptions||$[31]!==onChange||$[32]!==placeholder||$[33]!==selectionMode||$[34]!==style.icon||$[35]!==styles.iconContainer||$[36]!==styles.placeholderText||$[37]!==styles.selectionContainer||$[38]!==styles.selectionItemLabel||$[39]!==value){t9=pressableState=>_jsxs(_Fragment,{children:[_jsxs(View,{style:styles.selectionContainer,children:[selectionMode==="single"&&!!value&&_jsx(Text,{style:styles.selectionItemLabel,children:value.label}),selectionMode==="multi"&&!!value?.length&&value.map(item_0=>_jsx(Tag,{label:item_0.label,onPress:onChange?()=>handleRemove(item_0):undefined},getItemKey(item_0))),!hasSelection&&_jsx(Text,{style:styles.placeholderText,children:placeholder})]}),_jsx(View,{style:styles.iconContainer,children:_jsx(InteractiveIcon,{...icons.showOptions,disabled:disabled,style:style.icon,...pressableState})})]});$[27]=disabled;$[28]=handleRemove;$[29]=hasSelection;$[30]=icons.showOptions;$[31]=onChange;$[32]=placeholder;$[33]=selectionMode;$[34]=style.icon;$[35]=styles.iconContainer;$[36]=styles.placeholderText;$[37]=styles.selectionContainer;$[38]=styles.selectionItemLabel;$[39]=value;$[40]=t9;}else{t9=$[40];}var t10;if($[41]!==disabled||$[42]!==onOpen||$[43]!==t8||$[44]!==t9){t10=_jsx(ActionBase,{disabled:disabled,containerStyle:t8,onPress:onOpen,children:t9});$[41]=disabled;$[42]=onOpen;$[43]=t8;$[44]=t9;$[45]=t10;}else{t10=$[45];}var t11;if($[46]!==props||$[47]!==t10||$[48]!==t7){t11=_jsx(InputScaffold,{label:t7,...props,children:t10});$[46]=props;$[47]=t10;$[48]=t7;$[49]=t11;}else{t11=$[49];}return t11;};SelectionInput.displayName="SelectionInput";var createStyles=({styles:{inputBase,selectionInput}},{disabled,variant})=>{var _inputBase$container=inputBase.container,borderRadius=_inputBase$container.borderRadius,padding=_inputBase$container.padding,height=_inputBase$container.height;return StyleSheet.create({container:{flexDirection:"row",alignItems:"center",justifyContent:"center",minHeight:height[variant],borderRadius,backgroundColor:inputBase.container.backgroundColor[disabled?"disabled":"enabled"]},containerPressed:{backgroundColor:selectionInput.container.backgroundColor.pressed},selectionContainer:{flex:1,minWidth:0,flexDirection:"row",flexWrap:"wrap",gap:selectionInput.selectionContainer.gap,paddingStart:padding,marginVertical:padding},selectionItemLabel:{color:inputBase.text.color[disabled?"disabled":"enabled"]},placeholderText:{color:inputBase.text.placeholderColor},iconContainer:{width:height[variant],height:height[variant],alignItems:"center",justifyContent:"center"}});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/TimeInput.tsx";var _excluded=["disabled","clearButtonMode","
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/TimeInput.tsx";var _excluded=["disabled","clearButtonMode","placeholder","variant","value","onChange","onSubmitEditing"];function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}import{c as _c}from"react/compiler-runtime";import{useRef,useState}from"react";import{Pressable,StyleSheet}from"react-native";import{useThemedStyles}from"../../hooks";import{Text}from"../text";import{InputAction}from"./InputAction";import{InputBase}from"./InputBase";import{InputRowContainer}from"./InputRowContainer";import{InputScaffold}from"./InputScaffold";import{NumberInputBase}from"./NumberInputBase";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";var DEFAULT_TIME_VALUE={hours:"",minutes:""};export var TimeInput=t0=>{var $=_c(72);var baseProps;var clearButtonMode;var disabledProp;var onChange;var onSubmitEditing;var placeholder;var t1;var t2;if($[0]!==t0){disabledProp=t0.disabled;clearButtonMode=t0.clearButtonMode;placeholder=t0.placeholder;t1=t0.variant;t2=t0.value;onChange=t0.onChange;onSubmitEditing=t0.onSubmitEditing;baseProps=_objectWithoutProperties(t0,_excluded);$[0]=t0;$[1]=baseProps;$[2]=clearButtonMode;$[3]=disabledProp;$[4]=onChange;$[5]=onSubmitEditing;$[6]=placeholder;$[7]=t1;$[8]=t2;}else{baseProps=$[1];clearButtonMode=$[2];disabledProp=$[3];onChange=$[4];onSubmitEditing=$[5];placeholder=$[6];t1=$[7];t2=$[8];}var variant=t1===undefined?"regular":t1;var value=t2===undefined?DEFAULT_TIME_VALUE:t2;var disabled=disabledProp||!onChange;var hoursRef=useRef(null);var minutesRef=useRef(null);var t3;if($[9]!==variant){t3={props:{variant}};$[9]=variant;$[10]=t3;}else{t3=$[10];}var _useThemedStyles=useThemedStyles("timeInput",createStyles,t3),_useThemedStyles2=_slicedToArray(_useThemedStyles,2),styles=_useThemedStyles2[0],t4=_useThemedStyles2[1];var icons=t4.icons;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isFocused=_useState2[0],setIsFocused=_useState2[1];var t5;if($[11]===Symbol.for("react.memo_cache_sentinel")){t5=()=>hoursRef.current?.focus();$[11]=t5;}else{t5=$[11];}var t6;if($[12]!==disabled||$[13]!==icons.time||$[14]!==variant){t6=_jsx(InputAction,{...icons.time,variant:variant,disabled:disabled,onPress:t5});$[12]=disabled;$[13]=icons.time;$[14]=variant;$[15]=t6;}else{t6=$[15];}var t7=placeholder?.hours;var t8=value?.hours;var t9;if($[16]!==onChange||$[17]!==value){t9=text=>onChange?.({...value,hours:text});$[16]=onChange;$[17]=value;$[18]=t9;}else{t9=$[18];}var t10;var t11;var t12;if($[19]===Symbol.for("react.memo_cache_sentinel")){t10=()=>setIsFocused(true);t11=()=>setIsFocused(false);t12=()=>minutesRef.current?.focus();$[19]=t10;$[20]=t11;$[21]=t12;}else{t10=$[19];t11=$[20];t12=$[21];}var t13;if($[22]!==clearButtonMode||$[23]!==disabled||$[24]!==styles.input||$[25]!==t7||$[26]!==t8||$[27]!==t9||$[28]!==variant){t13=_jsx(NumberInputBase,{ref:hoursRef,disabled:disabled,placeholder:t7,maxLength:2,clearButtonMode:clearButtonMode,value:t8,variant:variant,keyboardType:"number-pad",submitBehavior:"submit",returnKeyType:"next",inputStyle:styles.input,onChangeText:t9,onFocus:t10,onBlur:t11,onSubmitEditing:t12});$[22]=clearButtonMode;$[23]=disabled;$[24]=styles.input;$[25]=t7;$[26]=t8;$[27]=t9;$[28]=variant;$[29]=t13;}else{t13=$[29];}var t14;if($[30]===Symbol.for("react.memo_cache_sentinel")){t14=()=>hoursRef.current?.focus();$[30]=t14;}else{t14=$[30];}var t15;if($[31]===Symbol.for("react.memo_cache_sentinel")){t15=_jsx(Text,{variant:"body",children:"h"});$[31]=t15;}else{t15=$[31];}var t16;if($[32]!==styles.timeLabel){t16=_jsx(Pressable,{onPress:t14,style:styles.timeLabel,children:t15});$[32]=styles.timeLabel;$[33]=t16;}else{t16=$[33];}var t17=placeholder?.minutes;var t18;if($[34]!==onChange||$[35]!==value){t18=text_0=>{var addToHours=text_0?Math.floor(Number.parseInt(text_0,10)/60):undefined;var remainingMinutes=text_0?Number.parseInt(text_0,10)%60:text_0;onChange?.({...value,hours:value.hours?(Number.parseInt(value.hours,10)+(addToHours??0)).toString():addToHours?.toString()??"",minutes:remainingMinutes.toString()});};$[34]=onChange;$[35]=value;$[36]=t18;}else{t18=$[36];}var t19;var t20;if($[37]===Symbol.for("react.memo_cache_sentinel")){t19=()=>setIsFocused(true);t20=()=>setIsFocused(false);$[37]=t19;$[38]=t20;}else{t19=$[37];t20=$[38];}var t21;if($[39]!==clearButtonMode||$[40]!==disabled||$[41]!==onSubmitEditing||$[42]!==styles.input||$[43]!==t17||$[44]!==t18||$[45]!==value.minutes||$[46]!==variant){t21=_jsx(NumberInputBase,{ref:minutesRef,disabled:disabled,placeholder:t17,value:value.minutes,maxLength:2,clearButtonMode:clearButtonMode,variant:variant,keyboardType:"number-pad",returnKeyType:"done",inputStyle:styles.input,onChangeText:t18,onFocus:t19,onBlur:t20,onSubmitEditing:onSubmitEditing});$[39]=clearButtonMode;$[40]=disabled;$[41]=onSubmitEditing;$[42]=styles.input;$[43]=t17;$[44]=t18;$[45]=value.minutes;$[46]=variant;$[47]=t21;}else{t21=$[47];}var t22;var t23;if($[48]===Symbol.for("react.memo_cache_sentinel")){t22=()=>minutesRef.current?.focus();t23=_jsx(Text,{variant:"body",children:"m"});$[48]=t22;$[49]=t23;}else{t22=$[48];t23=$[49];}var t24;if($[50]!==styles.timeLabel){t24=_jsx(Pressable,{style:styles.timeLabel,onPress:t22,children:t23});$[50]=styles.timeLabel;$[51]=t24;}else{t24=$[51];}var t25=disabled||!isFocused?"never":"always";var t26=value.hours!==""||value.minutes!==""?" ":"";var t27;if($[52]!==onChange){t27=()=>onChange?.({hours:"",minutes:""});$[52]=onChange;$[53]=t27;}else{t27=$[53];}var t28;if($[54]!==disabled||$[55]!==styles.clearInput||$[56]!==t25||$[57]!==t26||$[58]!==t27||$[59]!==variant){t28=_jsx(InputBase,{clearButtonMode:t25,value:t26,selectionColor:"transparent",focusable:false,autoComplete:"off",variant:variant,caretHidden:true,contextMenuHidden:true,disabled:disabled,showSoftInputOnFocus:false,inputStyle:styles.clearInput,onFocus:t27});$[54]=disabled;$[55]=styles.clearInput;$[56]=t25;$[57]=t26;$[58]=t27;$[59]=variant;$[60]=t28;}else{t28=$[60];}var t29;if($[61]!==disabled||$[62]!==t13||$[63]!==t16||$[64]!==t21||$[65]!==t24||$[66]!==t28||$[67]!==t6){t29=_jsxs(InputRowContainer,{disabled:disabled,children:[t6,t13,t16,t21,t24,t28]});$[61]=disabled;$[62]=t13;$[63]=t16;$[64]=t21;$[65]=t24;$[66]=t28;$[67]=t6;$[68]=t29;}else{t29=$[68];}var t30;if($[69]!==baseProps||$[70]!==t29){t30=_jsx(InputScaffold,{...baseProps,children:t29});$[69]=baseProps;$[70]=t29;$[71]=t30;}else{t30=$[71];}return t30;};var createStyles=({styles:{inputBase}},{variant})=>StyleSheet.create({input:{flexGrow:1,flexBasis:0,textAlign:"right"},clearInput:{flexShrink:1,marginStart:inputBase.container.padding},timeLabel:{minHeight:inputBase.container.height[variant],justifyContent:"center"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var DropdownBlurGuard=({children})=>children;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/dropdownInput/DropdownBlurGuard.web.tsx";import{c as _c}from"react/compiler-runtime";import{View}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";var preventBlur={onMouseDown:event=>{event.preventDefault();}};export var DropdownBlurGuard=t0=>{var $=_c(2);var children=t0.children;var t1;if($[0]!==children){t1=_jsx(View,{...preventBlur,children:children});$[0]=children;$[1]=t1;}else{t1=$[1];}return t1;};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/dropdownInput/DropdownInput.tsx";var _excluded=["label","helpText","hasError","mandatory","containerStyle"];function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}import{c as _c}from"react/compiler-runtime";import{InputScaffold}from"../InputScaffold";import{DropdownInputBase}from"./DropdownInputBase";import{jsx as _jsx}from"react/jsx-runtime";export var DropdownInput=t0=>{var $=_c(16);var containerStyle;var hasError;var helpText;var label;var mandatory;var props;if($[0]!==t0){label=t0.label;helpText=t0.helpText;hasError=t0.hasError;mandatory=t0.mandatory;containerStyle=t0.containerStyle;props=_objectWithoutProperties(t0,_excluded);$[0]=t0;$[1]=containerStyle;$[2]=hasError;$[3]=helpText;$[4]=label;$[5]=mandatory;$[6]=props;}else{containerStyle=$[1];hasError=$[2];helpText=$[3];label=$[4];mandatory=$[5];props=$[6];}var t1;if($[7]!==props){t1=_jsx(DropdownInputBase,{...props});$[7]=props;$[8]=t1;}else{t1=$[8];}var t2;if($[9]!==containerStyle||$[10]!==hasError||$[11]!==helpText||$[12]!==label||$[13]!==mandatory||$[14]!==t1){t2=_jsx(InputScaffold,{label:label,helpText:helpText,mandatory:mandatory,hasError:hasError,containerStyle:containerStyle,children:t1});$[9]=containerStyle;$[10]=hasError;$[11]=helpText;$[12]=label;$[13]=mandatory;$[14]=t1;$[15]=t2;}else{t2=$[15];}return t2;};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/input/dropdownInput/DropdownInputBase.tsx";var _excluded=["items","value","defaultValue","onChange","onChangeText","controllerRef","openOnFocus","allowsCustomValue","blurOnSelect","filterItems","minimumSearchLength","maxSuggestionCount","maxContainerHeight","containerPosition","disabled","onBlur","onFocus","onKeyPress","onSubmitEditing","ref"];function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],-1===t.indexOf(o)&&{}.propertyIsEnumerable.call(e,o)&&(i[o]=e[o]);}return i;}function _objectWithoutPropertiesLoose(r,e){if(null==r)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==e.indexOf(n))continue;t[n]=r[n];}return t;}import{c as _c}from"react/compiler-runtime";import{useImperativeHandle,useState}from"react";import{StyleSheet}from"react-native";import Animated,{useAnimatedRef}from"react-native-reanimated";import{useForwardedRef,useThemedStyles}from"../../../hooks";import{AnchoredContainer}from"../../container";import{Menu,MenuItem}from"../../menu";import{InputBase}from"../InputBase";import{DropdownBlurGuard}from"./DropdownBlurGuard";import{getItemKey}from"./helpers";import{useDropdownController}from"./useDropdownController";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";var EMPTY_ITEMS=[];export var DropdownInputBase=props=>{var $=_c(76);var containerPosition;var controllerRef;var defaultValue;var disabledProp;var filterItems;var inputProps;var maxContainerHeight;var maxSuggestionCount;var onBlur;var onChange;var onChangeText;var onFocus;var onKeyPress;var onSubmitEditing;var ref;var t0;var t1;var t2;var t3;var t4;var value;if($[0]!==props){t0=props.items;value=props.value;defaultValue=props.defaultValue;onChange=props.onChange;onChangeText=props.onChangeText;controllerRef=props.controllerRef;t1=props.openOnFocus;t2=props.allowsCustomValue;t3=props.blurOnSelect;filterItems=props.filterItems;t4=props.minimumSearchLength;maxSuggestionCount=props.maxSuggestionCount;maxContainerHeight=props.maxContainerHeight;containerPosition=props.containerPosition;disabledProp=props.disabled;onBlur=props.onBlur;onFocus=props.onFocus;onKeyPress=props.onKeyPress;onSubmitEditing=props.onSubmitEditing;ref=props.ref;inputProps=_objectWithoutProperties(props,_excluded);$[0]=props;$[1]=containerPosition;$[2]=controllerRef;$[3]=defaultValue;$[4]=disabledProp;$[5]=filterItems;$[6]=inputProps;$[7]=maxContainerHeight;$[8]=maxSuggestionCount;$[9]=onBlur;$[10]=onChange;$[11]=onChangeText;$[12]=onFocus;$[13]=onKeyPress;$[14]=onSubmitEditing;$[15]=ref;$[16]=t0;$[17]=t1;$[18]=t2;$[19]=t3;$[20]=t4;$[21]=value;}else{containerPosition=$[1];controllerRef=$[2];defaultValue=$[3];disabledProp=$[4];filterItems=$[5];inputProps=$[6];maxContainerHeight=$[7];maxSuggestionCount=$[8];onBlur=$[9];onChange=$[10];onChangeText=$[11];onFocus=$[12];onKeyPress=$[13];onSubmitEditing=$[14];ref=$[15];t0=$[16];t1=$[17];t2=$[18];t3=$[19];t4=$[20];value=$[21];}var items=t0===undefined?EMPTY_ITEMS:t0;var openOnFocus=t1===undefined?true:t1;var allowsCustomValue=t2===undefined?false:t2;var blurOnSelect=t3===undefined?true:t3;var minimumSearchLength=t4===undefined?1:t4;var isValueControlled="value"in props;var disabled=disabledProp||!onChange;var inputRef=useForwardedRef(ref);var anchorRef=useAnimatedRef();var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isMenuInverted=_useState2[0],setIsMenuInverted=_useState2[1];var _useThemedStyles=useThemedStyles("dropdownInput",_temp),_useThemedStyles2=_slicedToArray(_useThemedStyles,1),t5=_useThemedStyles2[0];var containerGap=t5.containerGap;var _useThemedStyles3=useThemedStyles("menu",_temp2),_useThemedStyles4=_slicedToArray(_useThemedStyles3,1),t6=_useThemedStyles4[0];var menuMaxHeight=t6.menuMaxHeight;var t7;if($[22]!==allowsCustomValue||$[23]!==blurOnSelect||$[24]!==defaultValue||$[25]!==filterItems||$[26]!==inputRef||$[27]!==isMenuInverted||$[28]!==isValueControlled||$[29]!==items||$[30]!==maxSuggestionCount||$[31]!==minimumSearchLength||$[32]!==onBlur||$[33]!==onChange||$[34]!==onChangeText||$[35]!==onFocus||$[36]!==onKeyPress||$[37]!==onSubmitEditing||$[38]!==openOnFocus||$[39]!==value){t7={items,value,defaultValue,isValueControlled,onChange,onChangeText,onFocus,onBlur,onKeyPress,onSubmitEditing,openOnFocus,allowsCustomValue,blurOnSelect,filterItems,minimumSearchLength,maxSuggestionCount,inputRef,isMenuInverted};$[22]=allowsCustomValue;$[23]=blurOnSelect;$[24]=defaultValue;$[25]=filterItems;$[26]=inputRef;$[27]=isMenuInverted;$[28]=isValueControlled;$[29]=items;$[30]=maxSuggestionCount;$[31]=minimumSearchLength;$[32]=onBlur;$[33]=onChange;$[34]=onChangeText;$[35]=onFocus;$[36]=onKeyPress;$[37]=onSubmitEditing;$[38]=openOnFocus;$[39]=value;$[40]=t7;}else{t7=$[40];}var _useDropdownControlle=useDropdownController(t7),displayText=_useDropdownControlle.displayText,query=_useDropdownControlle.query,filteredItems=_useDropdownControlle.filteredItems,showContainer=_useDropdownControlle.showContainer,activeIndex=_useDropdownControlle.activeIndex,handleFocus=_useDropdownControlle.handleFocus,handleBlur=_useDropdownControlle.handleBlur,handleChangeText=_useDropdownControlle.handleChangeText,handleKeyPress=_useDropdownControlle.handleKeyPress,handleSubmitEditing=_useDropdownControlle.handleSubmitEditing,selectItem=_useDropdownControlle.selectItem,setInputValue=_useDropdownControlle.setInputValue,clear=_useDropdownControlle.clear,open=_useDropdownControlle.open,close=_useDropdownControlle.close;var t8;var t9;if($[41]!==clear||$[42]!==close||$[43]!==inputRef||$[44]!==open||$[45]!==setInputValue){t8=()=>({setInputValue,clear,open,close,focus:()=>inputRef.current?.focus(),blur:()=>inputRef.current?.blur()});t9=[setInputValue,clear,open,close,inputRef];$[41]=clear;$[42]=close;$[43]=inputRef;$[44]=open;$[45]=setInputValue;$[46]=t8;$[47]=t9;}else{t8=$[46];t9=$[47];}useImperativeHandle(controllerRef,t8,t9);var t10;if($[48]!==disabled||$[49]!==displayText||$[50]!==handleBlur||$[51]!==handleChangeText||$[52]!==handleFocus||$[53]!==handleKeyPress||$[54]!==handleSubmitEditing||$[55]!==inputProps||$[56]!==inputRef){t10=_jsx(InputBase,{...inputProps,ref:inputRef,disabled:disabled,value:displayText,submitBehavior:"submit",onFocus:handleFocus,onBlur:handleBlur,onKeyPress:handleKeyPress,onSubmitEditing:handleSubmitEditing,onChangeText:handleChangeText,autoCorrect:false,spellCheck:false});$[48]=disabled;$[49]=displayText;$[50]=handleBlur;$[51]=handleChangeText;$[52]=handleFocus;$[53]=handleKeyPress;$[54]=handleSubmitEditing;$[55]=inputProps;$[56]=inputRef;$[57]=t10;}else{t10=$[57];}var t11;if($[58]!==activeIndex||$[59]!==filteredItems||$[60]!==maxContainerHeight||$[61]!==menuMaxHeight||$[62]!==query||$[63]!==selectItem){t11=t12=>{var inverted=t12.inverted,maxHeight=t12.maxHeight;return _jsx(DropdownBlurGuard,{children:_jsx(Menu,{data:filteredItems,reverse:inverted,maxHeight:Math.min(maxContainerHeight??menuMaxHeight,maxHeight),keyExtractor:_temp3,renderItem:t13=>{var item_0=t13.item,index=t13.index;return _jsx(MenuItem,{label:item_0.label,description:item_0.description,searchValue:query,active:index===activeIndex,onPress:()=>selectItem(item_0)});}})});};$[58]=activeIndex;$[59]=filteredItems;$[60]=maxContainerHeight;$[61]=menuMaxHeight;$[62]=query;$[63]=selectItem;$[64]=t11;}else{t11=$[64];}var t12;if($[65]!==anchorRef||$[66]!==containerGap||$[67]!==containerPosition||$[68]!==inputRef||$[69]!==showContainer||$[70]!==t11){t12=_jsx(AnchoredContainer,{parentRef:inputRef,anchorRef:anchorRef,show:showContainer,position:containerPosition,gap:containerGap,onInvertedChange:setIsMenuInverted,children:t11});$[65]=anchorRef;$[66]=containerGap;$[67]=containerPosition;$[68]=inputRef;$[69]=showContainer;$[70]=t11;$[71]=t12;}else{t12=$[71];}var t13;if($[72]!==anchorRef||$[73]!==t10||$[74]!==t12){t13=_jsxs(Animated.View,{ref:anchorRef,collapsable:false,style:styles.anchor,children:[t10,t12]});$[72]=anchorRef;$[73]=t10;$[74]=t12;$[75]=t13;}else{t13=$[75];}return t13;};var styles=StyleSheet.create({anchor:{alignSelf:"stretch"}});function _temp(t0){var t1=t0.styles;var dropdownInput=t1.dropdownInput;return{containerGap:dropdownInput.panelGap};}function _temp2(t0){var t1=t0.styles;var menu=t1.menu;return{menuMaxHeight:menu.maxHeight};}function _temp3(item){return String(getItemKey(item));}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var getItemKey=item=>"id"in item?item.id:item.value;export var filterDropdownItems=(items,query,{filterItems,maxSuggestionCount,minimumSearchLength=1})=>{var search=query.toLowerCase();var filteredItems=[];for(var item of items){if(maxSuggestionCount!==undefined&&filteredItems.length>=maxSuggestionCount){break;}if(!search){filteredItems.push(item);continue;}var matches=filterItems?filterItems(item,query):item.label.toLowerCase().includes(search)||!!item.description?.toLowerCase().includes(search);if(matches){filteredItems.push(item);}}return{filteredItems,meetsMinimum:search.length===0||search.length>=minimumSearchLength};};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{DropdownInput}from"./DropdownInput";export{DropdownInputBase}from"./DropdownInputBase";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{useRef,useState}from"react";import{useControlledState}from"../../../hooks";import{filterDropdownItems,getItemKey}from"./helpers";export var useDropdownController=t0=>{var $=_c(94);var items=t0.items,value=t0.value,defaultValue=t0.defaultValue,isValueControlled=t0.isValueControlled,onChange=t0.onChange,onChangeText=t0.onChangeText,onFocus=t0.onFocus,onBlur=t0.onBlur,onKeyPress=t0.onKeyPress,onSubmitEditing=t0.onSubmitEditing,openOnFocus=t0.openOnFocus,allowsCustomValue=t0.allowsCustomValue,blurOnSelect=t0.blurOnSelect,filterItems=t0.filterItems,minimumSearchLength=t0.minimumSearchLength,maxSuggestionCount=t0.maxSuggestionCount,inputRef=t0.inputRef,isMenuInverted=t0.isMenuInverted;var _useControlledState=useControlledState(isValueControlled,value,defaultValue),_useControlledState2=_slicedToArray(_useControlledState,2),selectedKey=_useControlledState2[0],setSelectedKey=_useControlledState2[1];var _useState=useState(),_useState2=_slicedToArray(_useState,2),edit=_useState2[0],setEdit=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isOpen=_useState4[0],setIsOpen=_useState4[1];var _useState5=useState(-1),_useState6=_slicedToArray(_useState5,2),activeIndex=_useState6[0],setActiveIndex=_useState6[1];var skipBlurRef=useRef(false);var t1;if($[0]!==items||$[1]!==selectedKey){var _t;if($[3]!==selectedKey){_t=item=>getItemKey(item)===selectedKey;$[3]=selectedKey;$[4]=_t;}else{_t=$[4];}t1=items.find(_t);$[0]=items;$[1]=selectedKey;$[2]=t1;}else{t1=$[2];}var selectedItem=t1;var activeEdit=edit!==undefined&&edit.key===selectedKey?edit:undefined;var query=activeEdit?.text??"";var displayText=activeEdit?activeEdit.text:selectedItem?.label??"";var t2;if($[5]!==filterItems||$[6]!==items||$[7]!==maxSuggestionCount||$[8]!==minimumSearchLength||$[9]!==query){t2=filterDropdownItems(items,query,{filterItems,maxSuggestionCount,minimumSearchLength});$[5]=filterItems;$[6]=items;$[7]=maxSuggestionCount;$[8]=minimumSearchLength;$[9]=query;$[10]=t2;}else{t2=$[10];}var _t2=t2,filteredItems=_t2.filteredItems,meetsMinimum=_t2.meetsMinimum;var showContainer=isOpen&&meetsMinimum&&filteredItems.length>0;var t3;if($[11]!==onChangeText||$[12]!==selectedItem?.label){t3=()=>{setEdit(undefined);onChangeText?.(selectedItem?.label??"");};$[11]=onChangeText;$[12]=selectedItem?.label;$[13]=t3;}else{t3=$[13];}var revertText=t3;var commitCustomValue;var selectItem;var settleText;if($[14]!==allowsCustomValue||$[15]!==blurOnSelect||$[16]!==inputRef||$[17]!==onChange||$[18]!==query||$[19]!==revertText||$[20]!==selectedItem?.label||$[21]!==setSelectedKey){settleText=()=>{if(allowsCustomValue&&query&&query!==selectedItem?.label){commitCustomValue(query);return;}revertText();};var _t3;if($[25]!==blurOnSelect||$[26]!==inputRef||$[27]!==onChange||$[28]!==setSelectedKey){_t3=item_0=>{setSelectedKey(getItemKey(item_0));onChange?.(item_0,item_0.label);setEdit(undefined);skipBlurRef.current=blurOnSelect;setActiveIndex(-1);setIsOpen(false);if(blurOnSelect){inputRef.current?.blur();}};$[25]=blurOnSelect;$[26]=inputRef;$[27]=onChange;$[28]=setSelectedKey;$[29]=_t3;}else{_t3=$[29];}selectItem=_t3;commitCustomValue=typed=>{setSelectedKey(undefined);onChange?.(undefined,typed);setEdit({text:typed,key:undefined});setActiveIndex(-1);setIsOpen(false);};$[14]=allowsCustomValue;$[15]=blurOnSelect;$[16]=inputRef;$[17]=onChange;$[18]=query;$[19]=revertText;$[20]=selectedItem?.label;$[21]=setSelectedKey;$[22]=commitCustomValue;$[23]=selectItem;$[24]=settleText;}else{commitCustomValue=$[22];selectItem=$[23];settleText=$[24];}var t4;if($[30]!==onFocus||$[31]!==openOnFocus){t4=e=>{skipBlurRef.current=false;setIsOpen(openOnFocus);onFocus?.(e);};$[30]=onFocus;$[31]=openOnFocus;$[32]=t4;}else{t4=$[32];}var handleFocus=t4;var t5;if($[33]!==onBlur||$[34]!==settleText){t5=e_0=>{setIsOpen(false);setActiveIndex(-1);if(skipBlurRef.current){skipBlurRef.current=false;onBlur?.(e_0);return;}settleText();onBlur?.(e_0);};$[33]=onBlur;$[34]=settleText;$[35]=t5;}else{t5=$[35];}var handleBlur=t5;var t6;if($[36]!==onChange||$[37]!==onChangeText||$[38]!==selectedItem?.label||$[39]!==selectedKey||$[40]!==setSelectedKey){t6=next=>{skipBlurRef.current=false;setIsOpen(true);setActiveIndex(-1);onChangeText?.(next);var diverged=selectedKey!==undefined&&next!==selectedItem?.label;if(diverged){setSelectedKey(undefined);onChange?.(undefined,next);}setEdit({text:next,key:diverged?undefined:selectedKey});};$[36]=onChange;$[37]=onChangeText;$[38]=selectedItem?.label;$[39]=selectedKey;$[40]=setSelectedKey;$[41]=t6;}else{t6=$[41];}var handleChangeText=t6;var t7;if($[42]!==filteredItems||$[43]!==isMenuInverted||$[44]!==meetsMinimum||$[45]!==showContainer){t7=e_1=>{e_1.preventDefault?.();var itemCount=filteredItems.length;if(!showContainer){if(itemCount>0&&meetsMinimum){setIsOpen(true);setActiveIndex(0);}return;}setActiveIndex(prev=>Math.min(Math.max(prev+(isMenuInverted?-1:1),0),itemCount-1));};$[42]=filteredItems;$[43]=isMenuInverted;$[44]=meetsMinimum;$[45]=showContainer;$[46]=t7;}else{t7=$[46];}var handleArrowDown=t7;var t8;if($[47]!==filteredItems||$[48]!==isMenuInverted||$[49]!==showContainer){t8=e_2=>{e_2.preventDefault?.();if(!showContainer){return;}var itemCount_0=filteredItems.length;var step=isMenuInverted?1:-1;setActiveIndex(prev_0=>Math.min(Math.max(prev_0+step,0),itemCount_0-1));};$[47]=filteredItems;$[48]=isMenuInverted;$[49]=showContainer;$[50]=t8;}else{t8=$[50];}var handleArrowUp=t8;var t9;if($[51]!==handleArrowDown||$[52]!==handleArrowUp||$[53]!==onKeyPress||$[54]!==revertText){t9=e_3=>{switch(e_3.nativeEvent.key){case"ArrowDown":{handleArrowDown(e_3);return;}case"ArrowUp":{handleArrowUp(e_3);return;}case"Escape":{setIsOpen(false);setActiveIndex(-1);revertText();return;}default:{onKeyPress?.(e_3);}}};$[51]=handleArrowDown;$[52]=handleArrowUp;$[53]=onKeyPress;$[54]=revertText;$[55]=t9;}else{t9=$[55];}var handleKeyPress=t9;var t10;if($[56]!==inputRef){t10=()=>{skipBlurRef.current=true;inputRef.current?.blur();};$[56]=inputRef;$[57]=t10;}else{t10=$[57];}var blurInput=t10;var t11;if($[58]!==activeIndex||$[59]!==allowsCustomValue||$[60]!==blurInput||$[61]!==blurOnSelect||$[62]!==commitCustomValue||$[63]!==filteredItems||$[64]!==inputRef||$[65]!==onSubmitEditing||$[66]!==query||$[67]!==selectItem||$[68]!==selectedItem?.label||$[69]!==showContainer){t11=e_4=>{var item_1=showContainer&&activeIndex>=0?filteredItems[activeIndex]:undefined;if(item_1){selectItem(item_1);if(!blurOnSelect){blurInput();}return;}if(allowsCustomValue&&query&&query!==selectedItem?.label){commitCustomValue(query);blurInput();return;}onSubmitEditing?.(e_4);inputRef.current?.blur();};$[58]=activeIndex;$[59]=allowsCustomValue;$[60]=blurInput;$[61]=blurOnSelect;$[62]=commitCustomValue;$[63]=filteredItems;$[64]=inputRef;$[65]=onSubmitEditing;$[66]=query;$[67]=selectItem;$[68]=selectedItem?.label;$[69]=showContainer;$[70]=t11;}else{t11=$[70];}var handleSubmitEditing=t11;var t12;if($[71]!==onChangeText||$[72]!==selectedKey){t12=next_0=>{skipBlurRef.current=false;setEdit({text:next_0,key:selectedKey});setIsOpen(true);setActiveIndex(-1);onChangeText?.(next_0);};$[71]=onChangeText;$[72]=selectedKey;$[73]=t12;}else{t12=$[73];}var setInputValue=t12;var t13;if($[74]!==onChange||$[75]!==onChangeText||$[76]!==setSelectedKey){t13=()=>{setEdit(undefined);setIsOpen(false);setActiveIndex(-1);setSelectedKey(undefined);onChange?.(undefined,"");onChangeText?.("");};$[74]=onChange;$[75]=onChangeText;$[76]=setSelectedKey;$[77]=t13;}else{t13=$[77];}var clear=t13;var t14;var t15;if($[78]===Symbol.for("react.memo_cache_sentinel")){t14=()=>setIsOpen(true);t15=()=>{setIsOpen(false);setActiveIndex(-1);};$[78]=t14;$[79]=t15;}else{t14=$[78];t15=$[79];}var t16;if($[80]!==activeIndex||$[81]!==clear||$[82]!==displayText||$[83]!==filteredItems||$[84]!==handleBlur||$[85]!==handleChangeText||$[86]!==handleFocus||$[87]!==handleKeyPress||$[88]!==handleSubmitEditing||$[89]!==query||$[90]!==selectItem||$[91]!==setInputValue||$[92]!==showContainer){t16={displayText,query,filteredItems,showContainer,activeIndex,handleFocus,handleBlur,handleChangeText,handleKeyPress,handleSubmitEditing,selectItem,setInputValue,clear,open:t14,close:t15};$[80]=activeIndex;$[81]=clear;$[82]=displayText;$[83]=filteredItems;$[84]=handleBlur;$[85]=handleChangeText;$[86]=handleFocus;$[87]=handleKeyPress;$[88]=handleSubmitEditing;$[89]=query;$[90]=selectItem;$[91]=setInputValue;$[92]=showContainer;$[93]=t16;}else{t16=$[93];}return t16;};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{CounterInput}from"./CounterInput";export{DropdownInput}from"./
|
|
1
|
+
export{CounterInput}from"./CounterInput";export{DropdownInput}from"./dropdownInput";export{InputAction}from"./InputAction";export{InputBase}from"./InputBase";export{InputRowContainer}from"./InputRowContainer";export{InputScaffold}from"./InputScaffold";export{NumberInput}from"./NumberInput";export{RatingInput}from"./RatingInput";export{SelectionInput}from"./SelectionInput";export{TextInput}from"./TextInput";export{TimeInput}from"./TimeInput";export{ToggleInput}from"./ToggleInput";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/menu/Menu.tsx";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{StyleSheet,View}from"react-native";import{useThemedStyles}from"../../hooks";import{jsx as _jsx}from"react/jsx-runtime";export var Menu=t0=>{var $=_c(
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/menu/Menu.tsx";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{FlatList,StyleSheet,View}from"react-native";import{useThemedStyles}from"../../hooks";import{jsx as _jsx}from"react/jsx-runtime";export var Menu=t0=>{var $=_c(20);var data=t0.data,renderItem=t0.renderItem,keyExtractor=t0.keyExtractor,reverse=t0.reverse,maxHeight=t0.maxHeight,onScroll=t0.onScroll,showsScrollIndicator=t0.showsScrollIndicator,style=t0.style,listProps=t0.listProps;var t1;if($[0]!==style){t1={menu:style};$[0]=style;$[1]=t1;}else{t1=$[1];}var t2;if($[2]!==maxHeight){t2={maxHeight};$[2]=maxHeight;$[3]=t2;}else{t2=$[3];}var t3;if($[4]!==t1||$[5]!==t2){t3={styles:t1,props:t2};$[4]=t1;$[5]=t2;$[6]=t3;}else{t3=$[6];}var _useThemedStyles=useThemedStyles("menu",createStyles,t3),_useThemedStyles2=_slicedToArray(_useThemedStyles,1),styles=_useThemedStyles2[0];var t4;if($[7]!==data||$[8]!==keyExtractor||$[9]!==listProps||$[10]!==onScroll||$[11]!==renderItem||$[12]!==reverse||$[13]!==showsScrollIndicator||$[14]!==styles.content||$[15]!==styles.scroll){t4=_jsx(FlatList,{...listProps,data:data,renderItem:renderItem,keyExtractor:keyExtractor,inverted:reverse,onScroll:onScroll,scrollEventThrottle:16,keyboardShouldPersistTaps:"handled",keyboardDismissMode:"none",showsVerticalScrollIndicator:showsScrollIndicator,style:styles.scroll,contentContainerStyle:styles.content});$[7]=data;$[8]=keyExtractor;$[9]=listProps;$[10]=onScroll;$[11]=renderItem;$[12]=reverse;$[13]=showsScrollIndicator;$[14]=styles.content;$[15]=styles.scroll;$[16]=t4;}else{t4=$[16];}var t5;if($[17]!==styles.container||$[18]!==t4){t5=_jsx(View,{style:styles.container,children:t4});$[17]=styles.container;$[18]=t4;$[19]=t5;}else{t5=$[19];}return t5;};var createStyles=({styles:{menu}},{maxHeight})=>StyleSheet.create({container:{backgroundColor:menu.backgroundColor,borderRadius:menu.borderRadius},scroll:{maxHeight:maxHeight??menu.maxHeight},content:{padding:menu.padding,gap:menu.gap}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defaultInputBaseStyles}from"../input/InputBase.styles";export var defaultMenuStyles=theme=>{var inputBase=defaultInputBaseStyles(theme);return{backgroundColor:theme.color.inputBackground,borderRadius:inputBase.container.borderRadius,gap:theme.spacing.tiny,padding:theme.spacing.tiny,parentMargin:theme.spacing.medium};};
|
|
1
|
+
import{defaultInputBaseStyles}from"../input/InputBase.styles";export var defaultMenuStyles=theme=>{var inputBase=defaultInputBaseStyles(theme);return{backgroundColor:theme.color.inputBackground,borderRadius:inputBase.container.borderRadius,gap:theme.spacing.tiny,padding:theme.spacing.tiny,parentMargin:theme.spacing.medium,maxHeight:240};};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/menu/MenuItem.tsx";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{StyleSheet}from"react-native";import{useTheme,useThemedStyles}from"../../hooks";import{ActionBase}from"../action";import{HighlightedText}from"../text";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export var MenuItem=t0=>{var $=_c(
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/menu/MenuItem.tsx";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{StyleSheet}from"react-native";import{useTheme,useThemedStyles}from"../../hooks";import{ActionBase}from"../action";import{HighlightedText}from"../text";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export var MenuItem=t0=>{var $=_c(15);var label=t0.label,description=t0.description,searchValue=t0.searchValue,active=t0.active,onPress=t0.onPress;var _useTheme=useTheme(),t1=_useTheme.theme;var color=t1.color;var _useThemedStyles=useThemedStyles("menuItem",createStyles),_useThemedStyles2=_slicedToArray(_useThemedStyles,1),styles=_useThemedStyles2[0];var t2;if($[0]!==active||$[1]!==color||$[2]!==styles.dropdownItem){t2=t3=>{var pressed=t3.pressed;return[styles.dropdownItem,pressed&&{backgroundColor:color.pressOverlay},active&&{backgroundColor:color.pressOverlay}];};$[0]=active;$[1]=color;$[2]=styles.dropdownItem;$[3]=t2;}else{t2=$[3];}var t3;if($[4]!==label||$[5]!==searchValue){t3=_jsx(HighlightedText,{text:label,highlight:searchValue});$[4]=label;$[5]=searchValue;$[6]=t3;}else{t3=$[6];}var t4;if($[7]!==description||$[8]!==searchValue){t4=!!description&&_jsx(HighlightedText,{variant:"caption",text:description,highlight:searchValue});$[7]=description;$[8]=searchValue;$[9]=t4;}else{t4=$[9];}var t5;if($[10]!==onPress||$[11]!==t2||$[12]!==t3||$[13]!==t4){t5=_jsxs(ActionBase,{hitSlop:0,onPress:onPress,containerStyle:t2,children:[t3,t4]});$[10]=onPress;$[11]=t2;$[12]=t3;$[13]=t4;$[14]=t5;}else{t5=$[14];}return t5;};MenuItem.displayName="MenuItem";var createStyles=({styles:{menuItem}})=>StyleSheet.create({dropdownItem:menuItem});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/toast/Toast.tsx";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{StyleSheet,View}from"react-native";import Animated,{LinearTransition,SlideInDown,SlideOutDown}from"react-native-reanimated";import{useThemedStyles}from"../../hooks";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";var TOAST_ENTERING=SlideInDown.springify().mass(0.5);var TOAST_EXITING=SlideOutDown.springify().mass(0.5);var TOAST_LAYOUT=LinearTransition.springify().mass(0.5);export var Toast=t0=>{var $=_c(17);var action=t0.action,containerStyle=t0.containerStyle,children=t0.children;var _useThemedStyles=useThemedStyles("toast",createStyles),_useThemedStyles2=_slicedToArray(_useThemedStyles,1),styles=_useThemedStyles2[0];var t1;if($[0]!==containerStyle||$[1]!==styles.container){t1=[styles.container,containerStyle];$[0]=containerStyle;$[1]=styles.container;$[2]=t1;}else{t1=$[2];}var t2;if($[3]!==children||$[4]!==styles.contentContainer){t2=_jsx(View,{style:styles.contentContainer,children:children});$[3]=children;$[4]=styles.contentContainer;$[5]=t2;}else{t2=$[5];}var t3;if($[6]!==action||$[7]!==styles.actionContainer||$[8]!==styles.separator){t3=action&&_jsxs(View,{style:styles.actionContainer,children:[_jsx(Animated.View,{layout:TOAST_LAYOUT,style:styles.separator}),action]});$[6]=action;$[7]=styles.actionContainer;$[8]=styles.separator;$[9]=t3;}else{t3=$[9];}var t4;if($[10]!==styles.innerContainer||$[11]!==t2||$[12]!==t3){t4=_jsxs(View,{style:styles.innerContainer,children:[t2,t3]});$[10]=styles.innerContainer;$[11]=t2;$[12]=t3;$[13]=t4;}else{t4=$[13];}var t5;if($[14]!==t1||$[15]!==t4){t5=_jsx(Animated.View,{style:t1,entering:TOAST_ENTERING,exiting:TOAST_EXITING,layout:TOAST_LAYOUT,children:t4});$[14]=t1;$[15]=t4;$[16]=t5;}else{t5=$[16];}return t5;};var createStyles=({theme:{color,spacing
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/components/toast/Toast.tsx";function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{StyleSheet,View}from"react-native";import Animated,{LinearTransition,SlideInDown,SlideOutDown}from"react-native-reanimated";import{useThemedStyles}from"../../hooks";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";var TOAST_ENTERING=SlideInDown.springify().mass(0.5);var TOAST_EXITING=SlideOutDown.springify().mass(0.5);var TOAST_LAYOUT=LinearTransition.springify().mass(0.5);export var Toast=t0=>{var $=_c(17);var action=t0.action,containerStyle=t0.containerStyle,children=t0.children;var _useThemedStyles=useThemedStyles("toast",createStyles),_useThemedStyles2=_slicedToArray(_useThemedStyles,1),styles=_useThemedStyles2[0];var t1;if($[0]!==containerStyle||$[1]!==styles.container){t1=[styles.container,containerStyle];$[0]=containerStyle;$[1]=styles.container;$[2]=t1;}else{t1=$[2];}var t2;if($[3]!==children||$[4]!==styles.contentContainer){t2=_jsx(View,{style:styles.contentContainer,children:children});$[3]=children;$[4]=styles.contentContainer;$[5]=t2;}else{t2=$[5];}var t3;if($[6]!==action||$[7]!==styles.actionContainer||$[8]!==styles.separator){t3=action&&_jsxs(View,{style:styles.actionContainer,children:[_jsx(Animated.View,{layout:TOAST_LAYOUT,style:styles.separator}),action]});$[6]=action;$[7]=styles.actionContainer;$[8]=styles.separator;$[9]=t3;}else{t3=$[9];}var t4;if($[10]!==styles.innerContainer||$[11]!==t2||$[12]!==t3){t4=_jsxs(View,{style:styles.innerContainer,children:[t2,t3]});$[10]=styles.innerContainer;$[11]=t2;$[12]=t3;$[13]=t4;}else{t4=$[13];}var t5;if($[14]!==t1||$[15]!==t4){t5=_jsx(Animated.View,{style:t1,entering:TOAST_ENTERING,exiting:TOAST_EXITING,layout:TOAST_LAYOUT,children:t4});$[14]=t1;$[15]=t4;$[16]=t5;}else{t5=$[16];}return t5;};var createStyles=({theme:{color,spacing},styles:{toast}})=>StyleSheet.create({container:{backgroundColor:toast.container.backgroundColor,padding:toast.container.padding,borderRadius:toast.container.borderRadius},innerContainer:{flexDirection:"row",justifyContent:"space-between"},contentContainer:{flex:1},actionContainer:{flex:0,alignItems:"center",flexDirection:"row",height:"100%"},separator:{borderStartWidth:StyleSheet.hairlineWidth,borderStartColor:color.textSecondary,height:"100%",marginHorizontal:spacing.medium}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var defaultToastStyles=({spacing})=>({
|
|
1
|
+
export var defaultToastStyles=({color,spacing,border})=>({container:{backgroundColor:color.backgroundHighlight,padding:spacing.medium,borderRadius:border.radius.loose}});
|
package/lib/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useForwardedRef}from"./useForwardedRef";export{usePersistentKeyboardHeight}from"./usePersistentKeyboardHeight";export{useTheme}from"./useTheme";export{useStyles,useThemedStyles}from"./useThemedStyles";
|
|
1
|
+
export{useControlledState}from"./useControlledState";export{useForwardedRef}from"./useForwardedRef";export{usePersistentKeyboardHeight}from"./usePersistentKeyboardHeight";export{useTheme}from"./useTheme";export{useStyles,useThemedStyles}from"./useThemedStyles";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{useState}from"react";export var useControlledState=(isControlled,value,defaultValue)=>{var $=_c(5);var _useState=useState(defaultValue),_useState2=_slicedToArray(_useState,2),internalValue=_useState2[0],setInternalValue=_useState2[1];var currentValue=isControlled?value:internalValue;var t0;if($[0]!==isControlled){t0=nextValue=>{if(!isControlled){setInternalValue(nextValue);}};$[0]=isControlled;$[1]=t0;}else{t0=$[1];}var setValue=t0;var t1;if($[2]!==currentValue||$[3]!==setValue){t1=[currentValue,setValue];$[2]=currentValue;$[3]=setValue;$[4]=t1;}else{t1=$[4];}return t1;};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{useEffect,useState}from"react";import{Keyboard,Platform}from"react-native";var isIos=Platform.OS==="ios";export var usePersistentKeyboardHeight=()=>{var $=_c(4);var _useState=useState(0),_useState2=_slicedToArray(_useState,2),keyboardHeight=_useState2[0],setKeyboardHeight=_useState2[1];var t0;var t1;if($[0]===Symbol.for("react.memo_cache_sentinel")){t0=()=>{var
|
|
1
|
+
function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}import{c as _c}from"react/compiler-runtime";import{useEffect,useState}from"react";import{Keyboard,Platform}from"react-native";var isIos=Platform.OS==="ios";var showEvent=isIos?"keyboardWillShow":"keyboardDidShow";var hideEvent="keyboardDidHide";export var usePersistentKeyboardHeight=()=>{var $=_c(4);var _useState=useState(0),_useState2=_slicedToArray(_useState,2),keyboardHeight=_useState2[0],setKeyboardHeight=_useState2[1];var t0;var t1;if($[0]===Symbol.for("react.memo_cache_sentinel")){t0=()=>{var showListener=Keyboard.addListener(showEvent,e=>{setKeyboardHeight(e.endCoordinates.height);});var hideListener=Keyboard.addListener(hideEvent,()=>{setKeyboardHeight(0);});return()=>{showListener.remove();hideListener.remove();};};t1=[];$[0]=t0;$[1]=t1;}else{t0=$[0];t1=$[1];}useEffect(t0,t1);var t2;if($[2]!==keyboardHeight){t2={keyboardHeight};$[2]=keyboardHeight;$[3]=t2;}else{t2=$[3];}return t2;};
|
package/lib/hooks/useTheme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{use}from"react";import{ThemeContext}from"../providers";export
|
|
1
|
+
import{use}from"react";import{ThemeContext}from"../providers";export function useTheme(){return use(ThemeContext);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as _c}from"react/compiler-runtime";import{MergeStyleSlice}from"../theme/styles";import{useTheme}from"./useTheme";function hasKey(obj,key){return key in obj;}var EMPTY_OPTIONS={};var mergeStylesForComponent=(styles,name,override)=>{if(!hasKey(styles,name)){return{config:undefined,styles};}var base=styles[name];var config=MergeStyleSlice(base,override);return{config,styles:config===base?styles:{...styles,[name]:config}};};var buildComponentResult=(styles,icons,name,config)=>{var hasStyle=hasKey(styles,name);var hasIcons=hasKey(icons,name);if(hasStyle&&hasIcons){return{style:config,icons:icons[name]};}if(hasStyle){return{style:config};}if(hasIcons){return{icons:icons[name]};}return{};};export function useThemedStyles(...t0){var $=_c(10);var args=t0;var first=args[0];var isComponent=typeof first==="string";var componentName=isComponent?first:undefined;var generator=isComponent?args[1]:first;var options=(isComponent?args[2]:args[1])??EMPTY_OPTIONS;var hasProps="props"in options;var componentProps=hasProps?options.props:undefined;var componentStyles="styles"in options?options.styles:undefined;var _useTheme=useTheme(),theme=_useTheme.theme,styles=_useTheme.styles,icons=_useTheme.icons;var name=componentName;var t1;if($[0]!==componentProps||$[1]!==componentStyles||$[2]!==generator||$[3]!==hasProps||$[4]!==icons||$[5]!==isComponent||$[6]!==name||$[7]!==styles||$[8]!==theme){var _ref=isComponent?mergeStylesForComponent(styles,name,componentStyles?.[name]):{config:undefined,styles},config=_ref.config,stylesForGenerator=_ref.styles;var
|
|
1
|
+
import{c as _c}from"react/compiler-runtime";import{MergeStyleSlice}from"../theme/styles";import{useTheme}from"./useTheme";function hasKey(obj,key){return key in obj;}var EMPTY_OPTIONS={};var mergeStylesForComponent=(styles,name,override)=>{if(!hasKey(styles,name)){return{config:undefined,styles};}var base=styles[name];var config=MergeStyleSlice(base,override);return{config,styles:config===base?styles:{...styles,[name]:config}};};var buildComponentResult=(styles,icons,name,config)=>{var hasStyle=hasKey(styles,name);var hasIcons=hasKey(icons,name);if(hasStyle&&hasIcons){return{style:config,icons:icons[name]};}if(hasStyle){return{style:config};}if(hasIcons){return{icons:icons[name]};}return{};};export function useThemedStyles(...t0){var $=_c(10);var args=t0;var first=args[0];var isComponent=typeof first==="string";var componentName=isComponent?first:undefined;var generator=isComponent?args[1]:first;var options=(isComponent?args[2]:args[1])??EMPTY_OPTIONS;var hasProps="props"in options;var componentProps=hasProps?options.props:undefined;var componentStyles="styles"in options?options.styles:undefined;var _useTheme=useTheme(),theme=_useTheme.theme,styles=_useTheme.styles,icons=_useTheme.icons;var name=componentName;var t1;if($[0]!==componentProps||$[1]!==componentStyles||$[2]!==generator||$[3]!==hasProps||$[4]!==icons||$[5]!==isComponent||$[6]!==name||$[7]!==styles||$[8]!==theme){var _ref=isComponent?mergeStylesForComponent(styles,name,componentStyles?.[name]):{config:undefined,styles},config=_ref.config,stylesForGenerator=_ref.styles;var generatorInput={theme,styles:stylesForGenerator,icons};var _generated=hasProps?generator(generatorInput,componentProps):generator(generatorInput);t1=isComponent?[_generated,buildComponentResult(styles,icons,name,config)]:_generated;$[0]=componentProps;$[1]=componentStyles;$[2]=generator;$[3]=hasProps;$[4]=icons;$[5]=isComponent;$[6]=name;$[7]=styles;$[8]=theme;$[9]=t1;}else{t1=$[9];}return t1;}export var useStyles=componentStyles=>{var $=_c(7);var _useTheme2=useTheme(),styles=_useTheme2.styles;var merged=styles;var t0;if($[0]!==componentStyles){t0=Object.keys(componentStyles);$[0]=componentStyles;$[1]=t0;}else{t0=$[1];}var t1=t0;if($[2]!==componentStyles||$[3]!==merged||$[4]!==styles||$[5]!==t1){for(var key of t1){var override=componentStyles[key];if(override===undefined){continue;}var base=styles[key];var next=MergeStyleSlice(base,override);if(next!==base){merged={...merged,[key]:next};}}$[2]=componentStyles;$[3]=merged;$[4]=styles;$[5]=t1;$[6]=merged;}else{merged=$[6];}return merged;};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext}from"react";import{
|
|
1
|
+
import{createContext}from"react";import{DefaultIcons}from"../theme/icons";import{createStyles}from"../theme/styles";import{DefaultTheme}from"../theme/theme";export var ThemeContext=createContext({theme:DefaultTheme,styles:createStyles(DefaultTheme),icons:DefaultIcons});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/providers/ThemeProvider.tsx";import{c as _c}from"react/compiler-runtime";import{
|
|
1
|
+
var _jsxFileName="/home/runner/work/ReactNativeComponents/ReactNativeComponents/src/providers/ThemeProvider.tsx";import{c as _c}from"react/compiler-runtime";import{createStyles}from"../theme";import{MergeIcons}from"../theme/icons";import{MergeTheme}from"../theme/theme";import{ThemeContext}from"./ThemeContext";import{jsx as _jsx}from"react/jsx-runtime";export var ThemeProvider=t0=>{var $=_c(13);var initialTheme=t0.theme,initialStyles=t0.styles,initialIcons=t0.icons,children=t0.children;var t1;var theme;if($[0]!==initialStyles||$[1]!==initialTheme){theme=MergeTheme(initialTheme);t1=createStyles(theme,initialStyles);$[0]=initialStyles;$[1]=initialTheme;$[2]=t1;$[3]=theme;}else{t1=$[2];theme=$[3];}var styles=t1;var t2;if($[4]!==initialIcons){t2=MergeIcons(initialIcons);$[4]=initialIcons;$[5]=t2;}else{t2=$[5];}var icons=t2;var t3;if($[6]!==icons||$[7]!==styles||$[8]!==theme){t3={theme,styles,icons};$[6]=icons;$[7]=styles;$[8]=theme;$[9]=t3;}else{t3=$[9];}var value=t3;var t4;if($[10]!==children||$[11]!==value){t4=_jsx(ThemeContext.Provider,{value:value,children:children});$[10]=children;$[11]=value;$[12]=t4;}else{t4=$[12];}return t4;};
|
package/lib/theme/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{createStyles}from"./styles";export{createTheme}from"./theme";
|
package/lib/theme/styles.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import merge from"lodash.merge";import{defaultActionStyles}from"../components/action/Action.styles";import{defaultIconActionStyles}from"../components/action/IconAction.styles";import{defaultIconActionBaseStyles}from"../components/action/IconActionBase.styles";import{defaultAlertIndicatorStyles}from"../components/alert/AlertIndicator.styles";import{defaultAvatarStyles}from"../components/avatar/Avatar.styles";import{defaultButtonStyles}from"../components/button/Button.styles";import{defaultButtonBaseStyles}from"../components/button/ButtonBase.styles";import{defaultIconButtonStyles}from"../components/button/IconButton.styles";import{defaultIconButtonBaseStyles}from"../components/button/IconButtonBase.styles";import{
|
|
1
|
+
import merge from"lodash.merge";import{defaultActionStyles}from"../components/action/Action.styles";import{defaultIconActionStyles}from"../components/action/IconAction.styles";import{defaultIconActionBaseStyles}from"../components/action/IconActionBase.styles";import{defaultAlertIndicatorStyles}from"../components/alert/AlertIndicator.styles";import{defaultAvatarStyles}from"../components/avatar/Avatar.styles";import{defaultButtonStyles}from"../components/button/Button.styles";import{defaultButtonBaseStyles}from"../components/button/ButtonBase.styles";import{defaultIconButtonStyles}from"../components/button/IconButton.styles";import{defaultIconButtonBaseStyles}from"../components/button/IconButtonBase.styles";import{defaultAnchoredContainerStyles}from"../components/container/anchoredContainer/AnchoredContainer.styles";import{defaultIconStyles}from"../components/icon/Icon.styles";import{defaultIconBaseStyles}from"../components/icon/IconBase.styles";import{defaultInteractiveIconStyles}from"../components/icon/InteractiveIcon.styles";import{defaultDropdownInputStyles}from"../components/input/dropdownInput/DropdownInput.styles";import{defaultInputActionStyles}from"../components/input/InputAction.styles";import{defaultInputBaseStyles}from"../components/input/InputBase.styles";import{defaultInputScaffoldStyles}from"../components/input/InputScaffold.styles";import{defaultSelectionInputStyles}from"../components/input/SelectionInput.styles";import{defaultToggleInputStyles}from"../components/input/ToggleInput.styles";import{defaultListItemStyles}from"../components/listItem/ListItem.styles";import{defaultMenuStyles}from"../components/menu/Menu.styles";import{defaultMenuItemStyles}from"../components/menu/MenuItem.styles";import{defaultRatingStyles}from"../components/rating/Rating.styles";import{defaultSwipeActionStyles}from"../components/swipe/SwipeAction.styles";import{defaultTagStyles}from"../components/tag/Tag.styles";import{defaultHighlightedTextStyles}from"../components/text/HighlightedText.styles";import{defaultInteractiveTextStyles}from"../components/text/InteractiveText.styles";import{defaultTextStyles}from"../components/text/Text.styles";import{defaultToastStyles}from"../components/toast/Toast.styles";export var createDefaultStyles=theme=>({interactiveText:defaultInteractiveTextStyles(theme),highlightedText:defaultHighlightedTextStyles(),iconBase:defaultIconBaseStyles(theme),icon:defaultIconStyles(theme),interactiveIcon:defaultInteractiveIconStyles(theme),action:defaultActionStyles(theme),iconActionBase:defaultIconActionBaseStyles(theme),iconAction:defaultIconActionStyles(theme),buttonBase:defaultButtonBaseStyles(theme),button:defaultButtonStyles(theme),iconButtonBase:defaultIconButtonBaseStyles(theme),iconButton:defaultIconButtonStyles(theme),inputBase:defaultInputBaseStyles(theme),inputScaffold:defaultInputScaffoldStyles(theme),inputAction:defaultInputActionStyles(theme),selectionInput:defaultSelectionInputStyles(theme),ratingInput:null,swipeAction:defaultSwipeActionStyles(theme),anchoredContainer:defaultAnchoredContainerStyles(theme),menu:defaultMenuStyles(theme),menuItem:defaultMenuItemStyles(theme),rating:defaultRatingStyles(theme),alertIndicator:defaultAlertIndicatorStyles(theme),tag:defaultTagStyles(theme),common:{action:{fontSize:{...theme.font.size}}},text:defaultTextStyles(theme),dropdownInput:defaultDropdownInputStyles(theme),toggleInput:defaultToggleInputStyles(theme),listItem:defaultListItemStyles(theme),avatar:defaultAvatarStyles(theme),toast:defaultToastStyles(theme)});export var MergeStyles=(styles,overrides={})=>merge({},styles,overrides);export var createStyles=(theme,overrides)=>MergeStyles(createDefaultStyles(theme),overrides);export var MergeStyleSlice=(base,override)=>override===undefined?base:merge({},base,override);
|
package/lib/theme/theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Platform}from"react-native";export var DefaultTheme={font:{family:{sans:Platform.select({ios:"System",android:"sans-serif",default:"system-ui"}),mono:Platform.select({ios:"Menlo",android:"monospace",default:"monospace"})},size:{tiny:10,small:12,regular:14,large:16,xLarge:20,xxLarge:28}},color:{primary:"#FF4242",primaryDark:"#ff8585",primaryLight:"#ffbdbd",secondary:"#12263A",secondaryHighlight:"#718191",secondaryDisabled:"#B5EAD7",tertiary:"#06bcc1",destructive:"#ff382e",destructiveHighlight:"#ff9e96",light:"#F4EDEA",white:"#ffffff",black:"#000000",red:"#FF9AA2",orange:"#FFDAC1",green:"#E2F0CB",blue:"#B5EAD7",purple:"#C7CEEA",textPrimary:"#12263A",textSecondary:"#22476D",textHighlight:"#30669c",textInverted:"#F4EDEA",textDisabled:"#B5EAD7",textOnPrimary:"#F4EDEA",textOnSecondary:"#F4EDEA",textOnDestructive:"#F4EDEA",background:"#F4EDEA",backgroundHighlight:"#f7f3f2",foreground:"#ffffff",foregroundHighlight:"#B5EAD7",backgroundOverlay:"#000",shadow:"#555",border:"#E2E8F0",inputBackground:"#e4d8d4",inputBackgroundDisabled:"#f0e9e2ff",inputText:"#12263A",pressOverlay:"rgba(0, 0, 0, 0.1)",alert:"#d63333",error:"#d63333",success:"#4ed633",warning:"#f5c61d"},spacing:{
|
|
1
|
+
import{Platform}from"react-native";import merge from"lodash.merge";export var DefaultTheme={font:{family:{sans:Platform.select({ios:"System",android:"sans-serif",default:"system-ui"}),mono:Platform.select({ios:"Menlo",android:"monospace",default:"monospace"})},size:{tiny:10,small:12,regular:14,large:16,xLarge:20,xxLarge:28}},color:{primary:"#FF4242",primaryDark:"#ff8585",primaryLight:"#ffbdbd",secondary:"#12263A",secondaryHighlight:"#718191",secondaryDisabled:"#B5EAD7",tertiary:"#06bcc1",destructive:"#ff382e",destructiveHighlight:"#ff9e96",light:"#F4EDEA",white:"#ffffff",black:"#000000",red:"#FF9AA2",orange:"#FFDAC1",green:"#E2F0CB",blue:"#B5EAD7",purple:"#C7CEEA",textPrimary:"#12263A",textSecondary:"#22476D",textHighlight:"#30669c",textInverted:"#F4EDEA",textDisabled:"#B5EAD7",textOnPrimary:"#F4EDEA",textOnSecondary:"#F4EDEA",textOnDestructive:"#F4EDEA",background:"#F4EDEA",backgroundHighlight:"#f7f3f2",foreground:"#ffffff",foregroundHighlight:"#B5EAD7",backgroundOverlay:"#000",shadow:"#555",border:"#E2E8F0",inputBackground:"#e4d8d4",inputBackgroundDisabled:"#f0e9e2ff",inputText:"#12263A",pressOverlay:"rgba(0, 0, 0, 0.1)",alert:"#d63333",error:"#d63333",success:"#4ed633",warning:"#f5c61d"},spacing:{large:24,medium:16,small:8,tiny:4},border:{radius:{tight:4,regular:8,loose:16},width:{thick:4,regular:2,thin:1}}};export var MergeTheme=(first,second)=>merge({},DefaultTheme,first??{},second??{});export var createTheme=(overrides,createExtras)=>{var base=MergeTheme(overrides);return createExtras?merge({},base,createExtras(base)):base;};
|