@os-design-mobile/menu 1.0.88 → 1.0.89
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Menu.js +1 -1
- package/dist/Menu.js.map +1 -1
- package/dist/MenuDivider.js +1 -1
- package/dist/MenuDivider.js.map +1 -1
- package/dist/MenuGroup.js +1 -1
- package/dist/MenuGroup.js.map +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/MenuItem.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/Menu.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _modal=_interopRequireDefault(require("@os-design-mobile/modal"));var _menuUtils=require("@os-design/menu-utils");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _native=_interopRequireDefault(require("@emotion/native"));var _theming=require("@os-design-mobile/theming");var _MenuGroup=_interopRequireDefault(require("./MenuGroup"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["closeOnSelect","onClose","children"];function _getRequireWildcardCache(
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _modal=_interopRequireDefault(require("@os-design-mobile/modal"));var _menuUtils=require("@os-design/menu-utils");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _native=_interopRequireDefault(require("@emotion/native"));var _theming=require("@os-design-mobile/theming");var _MenuGroup=_interopRequireDefault(require("./MenuGroup"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["closeOnSelect","onClose","children"];function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var StyledModal=(0,_native.default)(_modal.default)({paddingLeft:0,paddingRight:0});var Menu=(0,_react.forwardRef)(function(_ref,ref){var _ref$closeOnSelect=_ref.closeOnSelect,closeOnSelect=_ref$closeOnSelect===void 0?true:_ref$closeOnSelect,_ref$onClose=_ref.onClose,onClose=_ref$onClose===void 0?function(){}:_ref$onClose,children=_ref.children,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _useTheme=(0,_theming.useTheme)(),theme=_useTheme.theme;var childrenCount=(0,_react.useMemo)(function(){return _react.default.Children.count(children);},[children]);var menuContext=(0,_react.useMemo)(function(){return{closeOnSelect:closeOnSelect,onClose:onClose};},[closeOnSelect,onClose]);return(0,_jsxRuntime.jsx)(_menuUtils.MenuContext.Provider,{value:menuContext,children:(0,_jsxRuntime.jsx)(StyledModal,Object.assign({footer:null,onClose:onClose},rest,{ref:ref,children:(0,_jsxRuntime.jsx)(_reactNativeSafeAreaContext.SafeAreaProvider,{children:_react.default.Children.map(children,function(child,index){if(!_react.default.isValidElement(child)||child.type!==_MenuGroup.default)return child;var style={};if(index<childrenCount-1){style={paddingBottom:0.4*theme.fontSize,borderBottomWidth:1,borderBottomColor:(0,_theming.clr)(theme.menuGroupColorDivider)};}if(index>0){style={marginTop:theme.modalBodyPaddingVertical*theme.fontSize};}return _react.default.cloneElement(child,{style:style});})})}))});});Menu.displayName='Menu';var _default=exports.default=Menu;
|
2
2
|
//# sourceMappingURL=Menu.js.map
|
package/dist/Menu.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Menu.js","names":["_react","_interopRequireWildcard","require","_modal","_interopRequireDefault","_menuUtils","_reactNativeSafeAreaContext","_native","_theming","_MenuGroup","_jsxRuntime","_excluded","_getRequireWildcardCache","
|
1
|
+
{"version":3,"file":"Menu.js","names":["_react","_interopRequireWildcard","require","_modal","_interopRequireDefault","_menuUtils","_reactNativeSafeAreaContext","_native","_theming","_MenuGroup","_jsxRuntime","_excluded","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","StyledModal","styled","Modal","paddingLeft","paddingRight","Menu","forwardRef","_ref","ref","_ref$closeOnSelect","closeOnSelect","_ref$onClose","onClose","children","rest","_objectWithoutProperties2","_useTheme","useTheme","theme","childrenCount","useMemo","React","Children","count","menuContext","jsx","MenuContext","Provider","value","assign","footer","SafeAreaProvider","map","child","index","isValidElement","type","MenuGroup","style","paddingBottom","fontSize","borderBottomWidth","borderBottomColor","clr","menuGroupColorDivider","marginTop","modalBodyPaddingVertical","cloneElement","displayName","_default","exports"],"sources":["../src/Menu.tsx"],"sourcesContent":["import React, { forwardRef, PropsWithChildren, useMemo } from 'react';\nimport { View } from 'react-native';\nimport Modal, { ModalProps } from '@os-design-mobile/modal';\nimport { MenuContext } from '@os-design/menu-utils';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\nimport styled from '@emotion/native';\nimport { clr, useTheme } from '@os-design-mobile/theming';\nimport MenuGroup from './MenuGroup';\n\nexport interface MenuProps extends PropsWithChildren<ModalProps> {\n /**\n * Whether the menu closes when the user selects a menu item.\n * @default true\n */\n closeOnSelect?: boolean;\n}\n\nconst StyledModal = styled(Modal)({\n paddingLeft: 0,\n paddingRight: 0,\n});\n\n/**\n * The dropdown menu.\n */\nconst Menu = forwardRef<View, MenuProps>(\n ({ closeOnSelect = true, onClose = () => {}, children, ...rest }, ref) => {\n const { theme } = useTheme();\n const childrenCount = useMemo(\n () => React.Children.count(children),\n [children]\n );\n const menuContext = useMemo(\n () => ({ closeOnSelect, onClose }),\n [closeOnSelect, onClose]\n );\n\n return (\n <MenuContext.Provider value={menuContext}>\n <StyledModal footer={null} onClose={onClose} {...rest} ref={ref}>\n <SafeAreaProvider>\n {React.Children.map(children, (child, index) => {\n if (!React.isValidElement(child) || child.type !== MenuGroup)\n return child;\n let style = {};\n if (index < childrenCount - 1) {\n style = {\n paddingBottom: 0.4 * theme.fontSize,\n borderBottomWidth: 1,\n borderBottomColor: clr(theme.menuGroupColorDivider),\n };\n }\n if (index > 0) {\n style = {\n marginTop: theme.modalBodyPaddingVertical * theme.fontSize,\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return React.cloneElement<any>(child, { style });\n })}\n </SafeAreaProvider>\n </StyledModal>\n </MenuContext.Provider>\n );\n }\n);\n\nMenu.displayName = 'Menu';\n\nexport default Menu;\n"],"mappings":"mRAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WAEA,IAAAC,MAAA,CAAAC,sBAAA,CAAAF,OAAA,6BACA,IAAAG,UAAA,CAAAH,OAAA,0BACA,IAAAI,2BAAA,CAAAJ,OAAA,mCACA,IAAAK,OAAA,CAAAH,sBAAA,CAAAF,OAAA,qBACA,IAAAM,QAAA,CAAAN,OAAA,8BACA,IAAAO,UAAA,CAAAL,sBAAA,CAAAF,OAAA,iBAAoC,IAAAQ,WAAA,CAAAR,OAAA,0BAAAS,SAAA,iDAAAC,yBAAAC,CAAA,wBAAAC,OAAA,iBAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAF,wBAAA,UAAAA,yBAAAC,CAAA,SAAAA,CAAA,CAAAG,CAAA,CAAAD,CAAA,IAAAF,CAAA,YAAAZ,wBAAAY,CAAA,CAAAE,CAAA,MAAAA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AAGf,aAAa,CAAG,CAAC,CAAE,CAC7BmB,KAAK,CAAG,CACNC,aAAa,CAAE,GAAG,CAAGrB,KAAK,CAACsB,QAAQ,CACnCC,iBAAiB,CAAE,CAAC,CACpBC,iBAAiB,CAAE,GAAAC,YAAG,EAACzB,KAAK,CAAC0B,qBAAqB,CACpD,CAAC,CACH,CACA,GAAIV,KAAK,CAAG,CAAC,CAAE,CACbI,KAAK,CAAG,CACNO,SAAS,CAAE3B,KAAK,CAAC4B,wBAAwB,CAAG5B,KAAK,CAACsB,QACpD,CAAC,CACH,CAEA,MAAO,CAAAnB,cAAK,CAAC0B,YAAY,CAAMd,KAAK,CAAE,CAAEK,KAAK,CAALA,KAAM,CAAC,CAAC,CAClD,CAAC,CAAC,CACc,CAAC,EACR,CAAC,CACM,CAAC,CAE3B,CACF,CAAC,CAEDjC,IAAI,CAAC2C,WAAW,CAAG,MAAM,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAjE,OAAA,CAEXoB,IAAI"}
|
package/dist/MenuDivider.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireWildcard(require("react"));var _native=_interopRequireDefault(require("@emotion/native"));var _theming=require("@os-design-mobile/theming");var _jsxRuntime=require("react/jsx-runtime");function _getRequireWildcardCache(
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireWildcard(require("react"));var _native=_interopRequireDefault(require("@emotion/native"));var _theming=require("@os-design-mobile/theming");var _jsxRuntime=require("react/jsx-runtime");function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var StyledView=_native.default.View(function(p){return{paddingTop:p.theme.menuDividerIndent*p.theme.fontSize,borderBottomWidth:1,borderBottomColor:(0,_theming.clr)(p.theme.menuDividerColor),marginBottom:p.theme.menuDividerIndent*p.theme.fontSize};});var MenuDivider=(0,_react.forwardRef)(function(props,ref){return(0,_jsxRuntime.jsx)(StyledView,Object.assign({},props,{ref:ref}));});MenuDivider.displayName='MenuDivider';var _default=exports.default=MenuDivider;
|
2
2
|
//# sourceMappingURL=MenuDivider.js.map
|
package/dist/MenuDivider.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuDivider.js","names":["_react","_interopRequireWildcard","require","_native","_interopRequireDefault","_theming","_jsxRuntime","_getRequireWildcardCache","
|
1
|
+
{"version":3,"file":"MenuDivider.js","names":["_react","_interopRequireWildcard","require","_native","_interopRequireDefault","_theming","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","StyledView","styled","View","p","paddingTop","theme","menuDividerIndent","fontSize","borderBottomWidth","borderBottomColor","clr","menuDividerColor","marginBottom","MenuDivider","forwardRef","props","ref","jsx","assign","displayName","_default","exports"],"sources":["../src/MenuDivider.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { View, ViewProps } from 'react-native';\nimport styled from '@emotion/native';\nimport { clr } from '@os-design-mobile/theming';\n\nexport type MenuDividerProps = ViewProps;\n\nconst StyledView = styled.View((p) => ({\n paddingTop: p.theme.menuDividerIndent * p.theme.fontSize,\n borderBottomWidth: 1,\n borderBottomColor: clr(p.theme.menuDividerColor),\n marginBottom: p.theme.menuDividerIndent * p.theme.fontSize,\n}));\n\n/**\n * The divider of menu items.\n */\nconst MenuDivider = forwardRef<View, MenuDividerProps>((props, ref) => (\n <StyledView {...props} ref={ref} />\n));\n\nMenuDivider.displayName = 'MenuDivider';\n\nexport default MenuDivider;\n"],"mappings":"mKAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WAEA,IAAAC,OAAA,CAAAC,sBAAA,CAAAF,OAAA,qBACA,IAAAG,QAAA,CAAAH,OAAA,8BAAgD,IAAAI,WAAA,CAAAJ,OAAA,+BAAAK,yBAAAC,CAAA,wBAAAC,OAAA,iBAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAF,wBAAA,UAAAA,yBAAAC,CAAA,SAAAA,CAAA,CAAAG,CAAA,CAAAD,CAAA,IAAAF,CAAA,YAAAP,wBAAAO,CAAA,CAAAE,CAAA,MAAAA,CAAA,EAAAF,CAAA,EAAAA,CAAA,CAAAI,UAAA,QAAAJ,CAAA,WAAAA,CAAA,mBAAAA,CAAA,qBAAAA,CAAA,QAAAK,OAAA,CAAAL,CAAA,MAAAG,CAAA,CAAAJ,wBAAA,CAAAG,CAAA,KAAAC,CAAA,EAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,SAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,MAAAQ,CAAA,EAAAC,SAAA,OAAAC,CAAA,CAAAC,MAAA,CAAAC,cAAA,EAAAD,MAAA,CAAAE,wBAAA,SAAAC,CAAA,IAAAd,CAAA,gBAAAc,CAAA,EAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,CAAAc,CAAA,OAAAI,CAAA,CAAAR,CAAA,CAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,CAAAc,CAAA,OAAAI,CAAA,GAAAA,CAAA,CAAAX,GAAA,EAAAW,CAAA,CAAAC,GAAA,EAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,CAAAM,CAAA,CAAAI,CAAA,EAAAV,CAAA,CAAAM,CAAA,EAAAd,CAAA,CAAAc,CAAA,UAAAN,CAAA,CAAAH,OAAA,CAAAL,CAAA,CAAAG,CAAA,EAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,CAAAQ,CAAA,EAAAA,CAAA,EAIhD,GAAM,CAAAY,UAAU,CAAGC,eAAM,CAACC,IAAI,CAAC,SAACC,CAAC,QAAM,CACrCC,UAAU,CAAED,CAAC,CAACE,KAAK,CAACC,iBAAiB,CAAGH,CAAC,CAACE,KAAK,CAACE,QAAQ,CACxDC,iBAAiB,CAAE,CAAC,CACpBC,iBAAiB,CAAE,GAAAC,YAAG,EAACP,CAAC,CAACE,KAAK,CAACM,gBAAgB,CAAC,CAChDC,YAAY,CAAET,CAAC,CAACE,KAAK,CAACC,iBAAiB,CAAGH,CAAC,CAACE,KAAK,CAACE,QACpD,CAAC,EAAC,CAAC,CAKH,GAAM,CAAAM,WAAW,CAAG,GAAAC,iBAAU,EAAyB,SAACC,KAAK,CAAEC,GAAG,QAChE,GAAAtC,WAAA,CAAAuC,GAAA,EAACjB,UAAU,CAAAT,MAAA,CAAA2B,MAAA,IAAKH,KAAK,EAAEC,GAAG,CAAEA,GAAI,EAAE,CAAC,EACpC,CAAC,CAEFH,WAAW,CAACM,WAAW,CAAG,aAAa,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAApC,OAAA,CAEzB4B,WAAW"}
|
package/dist/MenuGroup.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _native=_interopRequireDefault(require("@emotion/native"));var _theming=require("@os-design-mobile/theming");var _useForwardedState3=_interopRequireDefault(require("@os-design/use-forwarded-state"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _MenuItem=_interopRequireDefault(require("./MenuItem"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["title","multiple","maxSelectedItems","value","defaultValue","onChange","children"];function _getRequireWildcardCache(
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _native=_interopRequireDefault(require("@emotion/native"));var _theming=require("@os-design-mobile/theming");var _useForwardedState3=_interopRequireDefault(require("@os-design/use-forwarded-state"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _MenuItem=_interopRequireDefault(require("./MenuItem"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["title","multiple","maxSelectedItems","value","defaultValue","onChange","children"];function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var Title=_native.default.Text(function(p){return{fontWeight:'500',fontSize:p.theme.sizes.small*p.theme.fontSize,color:(0,_theming.clr)(p.theme.menuGroupColorTitle),marginBottom:0.4*p.theme.fontSize,paddingHorizontal:p.theme.modalBodyPaddingHorizontal*p.theme.fontSize};});var MenuGroup=(0,_react.forwardRef)(function(_ref,ref){var title=_ref.title,_ref$multiple=_ref.multiple,multiple=_ref$multiple===void 0?false:_ref$multiple,_ref$maxSelectedItems=_ref.maxSelectedItems,maxSelectedItems=_ref$maxSelectedItems===void 0?0:_ref$maxSelectedItems,value=_ref.value,defaultValue=_ref.defaultValue,_ref$onChange=_ref.onChange,onChange=_ref$onChange===void 0?function(){}:_ref$onChange,children=_ref.children,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _useForwardedState=(0,_useForwardedState3.default)({value:value,defaultValue:defaultValue,onChange:onChange}),_useForwardedState2=(0,_slicedToArray2.default)(_useForwardedState,2),forwardedValue=_useForwardedState2[0],setForwardedValue=_useForwardedState2[1];var safeAreaInsets=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)();var onSelect=(0,_react.useCallback)(function(v){if(multiple){if((forwardedValue||[]).includes(v)){setForwardedValue((forwardedValue||[]).filter(function(item){return item!==v;}));return;}if(maxSelectedItems===0||(forwardedValue||[]).length<maxSelectedItems){setForwardedValue([].concat((0,_toConsumableArray2.default)(forwardedValue||[]),[v]));return;}return;}setForwardedValue(v);},[forwardedValue,maxSelectedItems,multiple,setForwardedValue]);var menuItems=(0,_react.useMemo)(function(){return _react.default.Children.map(children,function(child){if(!_react.default.isValidElement(child)||child.type!==_MenuItem.default)return child;var _child$props=child.props,childValue=_child$props.value,childOnPress=_child$props.onPress;var selected=multiple&&(forwardedValue||[]).includes(childValue)||!multiple&&forwardedValue===childValue;return _react.default.cloneElement(child,{key:childValue,selected:selected,onPress:function onPress(e){if(!childValue)return;onSelect(childValue);if(childOnPress)childOnPress(e);}});});},[children,forwardedValue,multiple,onSelect]);return(0,_jsxRuntime.jsxs)(_reactNative.View,Object.assign({},rest,{ref:ref,children:[title&&(0,_jsxRuntime.jsx)(Title,{numberOfLines:1,style:Object.assign({},safeAreaInsets.left>0?{paddingLeft:safeAreaInsets.left}:{},safeAreaInsets.right>0?{paddingRight:safeAreaInsets.right}:{}),children:title}),menuItems]}));});MenuGroup.displayName='MenuGroup';var _default=exports.default=MenuGroup;
|
2
2
|
//# sourceMappingURL=MenuGroup.js.map
|
package/dist/MenuGroup.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuGroup.js","names":["_native","_interopRequireDefault","require","_theming","_useForwardedState3","_react","_interopRequireWildcard","_reactNative","_reactNativeSafeAreaContext","_MenuItem","_jsxRuntime","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Title","styled","Text","p","fontWeight","fontSize","theme","sizes","small","color","clr","menuGroupColorTitle","marginBottom","paddingHorizontal","modalBodyPaddingHorizontal","MenuGroup","forwardRef","_ref","ref","title","_ref$multiple","multiple","_ref$maxSelectedItems","maxSelectedItems","value","defaultValue","_ref$onChange","onChange","children","rest","_objectWithoutProperties2","_useForwardedState","useForwardedState","_useForwardedState2","_slicedToArray2","forwardedValue","setForwardedValue","safeAreaInsets","useSafeAreaInsets","onSelect","useCallback","v","includes","filter","item","length","concat","_toConsumableArray2","menuItems","useMemo","React","Children","map","child","isValidElement","type","MenuItem","_child$props","props","childValue","childOnPress","onPress","selected","cloneElement","e","jsxs","View","assign","jsx","numberOfLines","style","left","paddingLeft","right","paddingRight","displayName","_default","exports"],"sources":["../src/MenuGroup.tsx"],"sourcesContent":["import styled from '@emotion/native';\nimport { clr } from '@os-design-mobile/theming';\nimport useForwardedState from '@os-design/use-forwarded-state';\nimport React, {\n forwardRef,\n PropsWithChildren,\n useCallback,\n useMemo,\n} from 'react';\nimport { View, ViewProps } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport MenuItem from './MenuItem';\n\ninterface BaseMenuGroupProps<T> extends PropsWithChildren<ViewProps> {\n /**\n * The title of the menu group.\n * @default undefined\n */\n title?: string;\n /**\n * The max number of options that the user can select. Zero means unlimited.\n * Works only when multiple is true.\n * @default 0\n */\n maxSelectedItems?: number;\n /**\n * Selected menu items.\n * @default undefined\n */\n value?: T;\n /**\n * The default value.\n * @default undefined\n */\n defaultValue?: T;\n /**\n * The change event handler.\n * @default undefined\n */\n onChange?: (value: T) => void;\n}\ninterface MenuGroupNotMultipleProps extends BaseMenuGroupProps<string | null> {\n /**\n * Is it possible to select multiple values.\n * @default false\n */\n multiple?: false;\n}\ninterface MenuGroupMultipleProps extends BaseMenuGroupProps<string[]> {\n /**\n * Is it possible to select multiple values.\n * @default false\n */\n multiple: true;\n}\nexport type MenuGroupProps = MenuGroupNotMultipleProps | MenuGroupMultipleProps;\n\nconst Title = styled.Text((p) => ({\n fontWeight: '500',\n fontSize: p.theme.sizes.small * p.theme.fontSize,\n color: clr(p.theme.menuGroupColorTitle),\n marginBottom: 0.4 * p.theme.fontSize,\n paddingHorizontal: p.theme.modalBodyPaddingHorizontal * p.theme.fontSize,\n}));\n\n/**\n * The group of menu items.\n */\nconst MenuGroup = forwardRef<View, MenuGroupProps>(\n (\n {\n title,\n multiple = false,\n maxSelectedItems = 0,\n value,\n defaultValue,\n onChange = () => {},\n children,\n ...rest\n },\n ref\n ) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const [forwardedValue, setForwardedValue] = useForwardedState<any>({\n value,\n defaultValue,\n onChange,\n });\n const safeAreaInsets = useSafeAreaInsets();\n\n const onSelect = useCallback(\n (v: string) => {\n if (multiple) {\n // Delete the value because it was already selected\n if ((forwardedValue || []).includes(v)) {\n setForwardedValue(\n (forwardedValue || []).filter((item) => item !== v)\n );\n return;\n }\n\n // Add a new value if the number of selected items is less than max\n if (\n maxSelectedItems === 0 ||\n (forwardedValue || []).length < maxSelectedItems\n ) {\n setForwardedValue([...(forwardedValue || []), v]);\n return;\n }\n return;\n }\n setForwardedValue(v);\n },\n [forwardedValue, maxSelectedItems, multiple, setForwardedValue]\n );\n\n const menuItems = useMemo(\n () =>\n React.Children.map(children, (child) => {\n if (!React.isValidElement(child) || child.type !== MenuItem)\n return child;\n const { value: childValue, onPress: childOnPress } = child.props;\n const selected =\n (multiple && (forwardedValue || []).includes(childValue)) ||\n (!multiple && forwardedValue === childValue);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return React.cloneElement<any>(child, {\n key: childValue,\n selected,\n onPress: (e) => {\n if (!childValue) return;\n onSelect(childValue);\n if (childOnPress) childOnPress(e);\n },\n });\n }),\n [children, forwardedValue, multiple, onSelect]\n );\n\n return (\n <View {...rest} ref={ref}>\n {title && (\n <Title\n numberOfLines={1}\n style={{\n ...(safeAreaInsets.left > 0\n ? { paddingLeft: safeAreaInsets.left }\n : {}),\n ...(safeAreaInsets.right > 0\n ? { paddingRight: safeAreaInsets.right }\n : {}),\n }}\n >\n {title}\n </Title>\n )}\n {menuItems}\n </View>\n );\n }\n);\n\nMenuGroup.displayName = 'MenuGroup';\n\nexport default MenuGroup;\n"],"mappings":"mdAAA,IAAAA,OAAA,CAAAC,sBAAA,CAAAC,OAAA,qBACA,IAAAC,QAAA,CAAAD,OAAA,8BACA,IAAAE,mBAAA,CAAAH,sBAAA,CAAAC,OAAA,oCACA,IAAAG,MAAA,CAAAC,uBAAA,CAAAJ,OAAA,WAMA,IAAAK,YAAA,CAAAL,OAAA,iBACA,IAAAM,2BAAA,CAAAN,OAAA,mCACA,IAAAO,SAAA,CAAAR,sBAAA,CAAAC,OAAA,gBAAkC,IAAAQ,WAAA,CAAAR,OAAA,0BAAAS,SAAA,+FAAAC,yBAAAC,WAAA,YAAAC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AG,CAAEiE,UAAU,CACfG,QAAQ,CAARA,QAAQ,CACRD,OAAO,CAAE,SAAAA,QAACG,CAAC,CAAK,CACd,GAAI,CAACL,UAAU,CAAE,OACjBpB,QAAQ,CAACoB,UAAU,CAAC,CACpB,GAAIC,YAAY,CAAEA,YAAY,CAACI,CAAC,CAAC,CACnC,CACF,CAAC,CAAC,CACJ,CAAC,CAAC,GACJ,CAACpC,QAAQ,CAAEO,cAAc,CAAEd,QAAQ,CAAEkB,QAAQ,CAC/C,CAAC,CAED,MACE,GAAA/D,WAAA,CAAAyF,IAAA,EAAC5F,YAAA,CAAA6F,IAAI,CAAA3E,MAAA,CAAA4E,MAAA,IAAKtC,IAAI,EAAEX,GAAG,CAAEA,GAAI,CAAAU,QAAA,EACtBT,KAAK,EACJ,GAAA3C,WAAA,CAAA4F,GAAA,EAACpE,KAAK,EACJqE,aAAa,CAAE,CAAE,CACjBC,KAAK,CAAA/E,MAAA,CAAA4E,MAAA,IACC9B,cAAc,CAACkC,IAAI,CAAG,CAAC,CACvB,CAAEC,WAAW,CAAEnC,cAAc,CAACkC,IAAK,CAAC,CACpC,CAAC,CAAC,CACFlC,cAAc,CAACoC,KAAK,CAAG,CAAC,CACxB,CAAEC,YAAY,CAAErC,cAAc,CAACoC,KAAM,CAAC,CACtC,CAAC,CAAC,CACN,CAAA7C,QAAA,CAEDT,KAAK,CACD,CACR,CACA6B,SAAS,GACN,CAAC,CAEX,CACF,CAAC,CAEDjC,SAAS,CAAC4D,WAAW,CAAG,WAAW,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAA5F,OAAA,CAErB8B,SAAS"}
|
1
|
+
{"version":3,"file":"MenuGroup.js","names":["_native","_interopRequireDefault","require","_theming","_useForwardedState3","_react","_interopRequireWildcard","_reactNative","_reactNativeSafeAreaContext","_MenuItem","_jsxRuntime","_excluded","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Title","styled","Text","p","fontWeight","fontSize","theme","sizes","small","color","clr","menuGroupColorTitle","marginBottom","paddingHorizontal","modalBodyPaddingHorizontal","MenuGroup","forwardRef","_ref","ref","title","_ref$multiple","multiple","_ref$maxSelectedItems","maxSelectedItems","value","defaultValue","_ref$onChange","onChange","children","rest","_objectWithoutProperties2","_useForwardedState","useForwardedState","_useForwardedState2","_slicedToArray2","forwardedValue","setForwardedValue","safeAreaInsets","useSafeAreaInsets","onSelect","useCallback","v","includes","filter","item","length","concat","_toConsumableArray2","menuItems","useMemo","React","Children","map","child","isValidElement","type","MenuItem","_child$props","props","childValue","childOnPress","onPress","selected","cloneElement","key","jsxs","View","assign","jsx","numberOfLines","style","left","paddingLeft","right","paddingRight","displayName","_default","exports"],"sources":["../src/MenuGroup.tsx"],"sourcesContent":["import styled from '@emotion/native';\nimport { clr } from '@os-design-mobile/theming';\nimport useForwardedState from '@os-design/use-forwarded-state';\nimport React, {\n forwardRef,\n PropsWithChildren,\n useCallback,\n useMemo,\n} from 'react';\nimport { View, ViewProps } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport MenuItem from './MenuItem';\n\ninterface BaseMenuGroupProps<T> extends PropsWithChildren<ViewProps> {\n /**\n * The title of the menu group.\n * @default undefined\n */\n title?: string;\n /**\n * The max number of options that the user can select. Zero means unlimited.\n * Works only when multiple is true.\n * @default 0\n */\n maxSelectedItems?: number;\n /**\n * Selected menu items.\n * @default undefined\n */\n value?: T;\n /**\n * The default value.\n * @default undefined\n */\n defaultValue?: T;\n /**\n * The change event handler.\n * @default undefined\n */\n onChange?: (value: T) => void;\n}\ninterface MenuGroupNotMultipleProps extends BaseMenuGroupProps<string | null> {\n /**\n * Is it possible to select multiple values.\n * @default false\n */\n multiple?: false;\n}\ninterface MenuGroupMultipleProps extends BaseMenuGroupProps<string[]> {\n /**\n * Is it possible to select multiple values.\n * @default false\n */\n multiple: true;\n}\nexport type MenuGroupProps = MenuGroupNotMultipleProps | MenuGroupMultipleProps;\n\nconst Title = styled.Text((p) => ({\n fontWeight: '500',\n fontSize: p.theme.sizes.small * p.theme.fontSize,\n color: clr(p.theme.menuGroupColorTitle),\n marginBottom: 0.4 * p.theme.fontSize,\n paddingHorizontal: p.theme.modalBodyPaddingHorizontal * p.theme.fontSize,\n}));\n\n/**\n * The group of menu items.\n */\nconst MenuGroup = forwardRef<View, MenuGroupProps>(\n (\n {\n title,\n multiple = false,\n maxSelectedItems = 0,\n value,\n defaultValue,\n onChange = () => {},\n children,\n ...rest\n },\n ref\n ) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const [forwardedValue, setForwardedValue] = useForwardedState<any>({\n value,\n defaultValue,\n onChange,\n });\n const safeAreaInsets = useSafeAreaInsets();\n\n const onSelect = useCallback(\n (v: string) => {\n if (multiple) {\n // Delete the value because it was already selected\n if ((forwardedValue || []).includes(v)) {\n setForwardedValue(\n (forwardedValue || []).filter((item) => item !== v)\n );\n return;\n }\n\n // Add a new value if the number of selected items is less than max\n if (\n maxSelectedItems === 0 ||\n (forwardedValue || []).length < maxSelectedItems\n ) {\n setForwardedValue([...(forwardedValue || []), v]);\n return;\n }\n return;\n }\n setForwardedValue(v);\n },\n [forwardedValue, maxSelectedItems, multiple, setForwardedValue]\n );\n\n const menuItems = useMemo(\n () =>\n React.Children.map(children, (child) => {\n if (!React.isValidElement(child) || child.type !== MenuItem)\n return child;\n const { value: childValue, onPress: childOnPress } = child.props;\n const selected =\n (multiple && (forwardedValue || []).includes(childValue)) ||\n (!multiple && forwardedValue === childValue);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return React.cloneElement<any>(child, {\n key: childValue,\n selected,\n onPress: (e) => {\n if (!childValue) return;\n onSelect(childValue);\n if (childOnPress) childOnPress(e);\n },\n });\n }),\n [children, forwardedValue, multiple, onSelect]\n );\n\n return (\n <View {...rest} ref={ref}>\n {title && (\n <Title\n numberOfLines={1}\n style={{\n ...(safeAreaInsets.left > 0\n ? { paddingLeft: safeAreaInsets.left }\n : {}),\n ...(safeAreaInsets.right > 0\n ? { paddingRight: safeAreaInsets.right }\n : {}),\n }}\n >\n {title}\n </Title>\n )}\n {menuItems}\n </View>\n );\n }\n);\n\nMenuGroup.displayName = 'MenuGroup';\n\nexport default MenuGroup;\n"],"mappings":"mdAAA,IAAAA,OAAA,CAAAC,sBAAA,CAAAC,OAAA,qBACA,IAAAC,QAAA,CAAAD,OAAA,8BACA,IAAAE,mBAAA,CAAAH,sBAAA,CAAAC,OAAA,oCACA,IAAAG,MAAA,CAAAC,uBAAA,CAAAJ,OAAA,WAMA,IAAAK,YAAA,CAAAL,OAAA,iBACA,IAAAM,2BAAA,CAAAN,OAAA,mCACA,IAAAO,SAAA,CAAAR,sBAAA,CAAAC,OAAA,gBAAkC,IAAAQ,WAAA,CAAAR,OAAA,0BAAAS,SAAA,+FAAAC,yBAAAC,CAAA,wBAAAC,OAAA,iBAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAF,wBAAA,UAAAA,yBAAAC,CAAA,SAAAA,CAAA,CAAAG,CAAA,CAAAD,CAAA,IAAAF,CAAA,YAAAP,wBAAAO,CAAA,CAAAE,CAAA,MAAAA,CAAA,EAAAF,CAAA,EAAAA,CAAA,CAAAI,UAAA,QAAAJ,CAAA,WAAAA,CAAA,mBAAAA,CAAA,qBAAAA,CAAA,QAAAK,OAAA,CAAAL,CAAA,MAAAG,CAAA,CAAAJ,wBAAA,CAAAG,CAAA,KAAAC,CAAA,EAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,SAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,MAAAQ,CAAA,EAAAC,SAAA,OAAAC,CAAA,CAAAC,MAAA,CAAAC,cAAA,EAAAD,MAAA,CAAAE,wBAAA,SAAAC,CAAA,IAAAd,CAAA,gBAAAc,CAAA,EAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,CAAA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WAAW,CAAEnC,cAAc,CAACkC,IAAK,CAAC,CACpC,CAAC,CAAC,CACFlC,cAAc,CAACoC,KAAK,CAAG,CAAC,CACxB,CAAEC,YAAY,CAAErC,cAAc,CAACoC,KAAM,CAAC,CACtC,CAAC,CAAC,CACN,CAAA7C,QAAA,CAEDT,KAAK,CACD,CACR,CACA6B,SAAS,GACN,CAAC,CAEX,CACF,CAAC,CAEDjC,SAAS,CAAC4D,WAAW,CAAG,WAAW,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAA5F,OAAA,CAErB8B,SAAS"}
|
package/dist/MenuItem.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _theming=require("@os-design-mobile/theming");var _icons=require("@os-design-mobile/icons");var _button=_interopRequireDefault(require("@os-design-mobile/button"));var _native=_interopRequireDefault(require("@emotion/native"));var _menuUtils=require("@os-design/menu-utils");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["selected","value","right","viewProps","textProps","onPress"];function _getRequireWildcardCache(
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _theming=require("@os-design-mobile/theming");var _icons=require("@os-design-mobile/icons");var _button=_interopRequireDefault(require("@os-design-mobile/button"));var _native=_interopRequireDefault(require("@emotion/native"));var _menuUtils=require("@os-design/menu-utils");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["selected","value","right","viewProps","textProps","onPress"];function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var selectedStyles=function selectedStyles(p){return p.selected?{backgroundColor:(0,_theming.clr)(p.theme.menuItemSelectedColorBg)}:{};};var StyledButton=(0,_native.default)(_button.default)(selectedStyles);var MenuItem=(0,_react.forwardRef)(function(_ref,ref){var _ref$selected=_ref.selected,selected=_ref$selected===void 0?false:_ref$selected,value=_ref.value,right=_ref.right,_ref$viewProps=_ref.viewProps,viewProps=_ref$viewProps===void 0?{}:_ref$viewProps,_ref$textProps=_ref.textProps,textProps=_ref$textProps===void 0?{}:_ref$textProps,_ref$onPress=_ref.onPress,onPress=_ref$onPress===void 0?function(){}:_ref$onPress,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _useContext=(0,_react.useContext)(_menuUtils.MenuContext),closeOnSelect=_useContext.closeOnSelect,onClose=_useContext.onClose;var onPressRef=(0,_react.useRef)();var _useTheme=(0,_theming.useTheme)(),theme=_useTheme.theme;var safeAreaInsets=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)();(0,_react.useEffect)(function(){onPressRef.current=onPress;},[onPress]);var clickHandler=(0,_react.useCallback)(function(e){if(onPressRef.current)onPressRef.current(e);if(closeOnSelect)onClose();},[closeOnSelect,onClose]);return(0,_jsxRuntime.jsx)(_theming.ThemeOverrider,{overrides:function overrides(t){return{buttonGhostColorText:t.colorText,borderRadius:0,buttonHeight:theme.menuItemHeight,buttonPaddingHorizontal:theme.menuItemPaddingHorizontal};},children:(0,_jsxRuntime.jsx)(StyledButton,Object.assign({selected:selected,right:selected?(0,_jsxRuntime.jsx)(_theming.ThemeOverrider,{overrides:function overrides(t){return{colorText:t.menuItemSelectedColorIcon};},children:(0,_jsxRuntime.jsx)(_icons.Check,{})}):right,type:"ghost",onPress:clickHandler,viewProps:Object.assign({},viewProps,{style:Object.assign({},safeAreaInsets.left>0?{paddingLeft:safeAreaInsets.left}:{},safeAreaInsets.right>0?{paddingRight:safeAreaInsets.right}:{},typeof(viewProps==null?void 0:viewProps.style)==='object'?viewProps.style:{})}),textProps:Object.assign({},textProps,{style:Object.assign({flex:1,textAlign:'left',fontWeight:'normal'},typeof(textProps==null?void 0:textProps.style)==='object'?textProps.style:{})})},rest,{ref:ref}))});});MenuItem.displayName='MenuItem';var _default=exports.default=MenuItem;
|
2
2
|
//# sourceMappingURL=MenuItem.js.map
|
package/dist/MenuItem.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuItem.js","names":["_react","_interopRequireWildcard","require","_theming","_icons","_button","_interopRequireDefault","_native","_menuUtils","_reactNativeSafeAreaContext","_jsxRuntime","_excluded","_getRequireWildcardCache","
|
1
|
+
{"version":3,"file":"MenuItem.js","names":["_react","_interopRequireWildcard","require","_theming","_icons","_button","_interopRequireDefault","_native","_menuUtils","_reactNativeSafeAreaContext","_jsxRuntime","_excluded","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","selectedStyles","p","selected","backgroundColor","clr","theme","menuItemSelectedColorBg","StyledButton","styled","Button","MenuItem","forwardRef","_ref","ref","_ref$selected","value","right","_ref$viewProps","viewProps","_ref$textProps","textProps","_ref$onPress","onPress","rest","_objectWithoutProperties2","_useContext","useContext","MenuContext","closeOnSelect","onClose","onPressRef","useRef","_useTheme","useTheme","safeAreaInsets","useSafeAreaInsets","useEffect","current","clickHandler","useCallback","jsx","ThemeOverrider","overrides","buttonGhostColorText","colorText","borderRadius","buttonHeight","menuItemHeight","buttonPaddingHorizontal","menuItemPaddingHorizontal","children","assign","menuItemSelectedColorIcon","Check","type","style","left","paddingLeft","paddingRight","flex","textAlign","fontWeight","displayName","_default","exports"],"sources":["../src/MenuItem.tsx"],"sourcesContent":["import React, {\n forwardRef,\n PropsWithChildren,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react';\nimport { clr, ThemeOverrider, useTheme } from '@os-design-mobile/theming';\nimport { Check } from '@os-design-mobile/icons';\nimport Button, { ButtonProps } from '@os-design-mobile/button';\nimport { RectButton } from 'react-native-gesture-handler';\nimport styled from '@emotion/native';\nimport { MenuContext } from '@os-design/menu-utils';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nexport interface MenuItemProps\n extends PropsWithChildren<Omit<ButtonProps, 'type' | 'size'>> {\n /**\n * Whether the menu item is selected.\n * @default false\n */\n selected?: boolean;\n /**\n * The value of the menu item.\n * @default undefined\n */\n value?: string;\n}\n\nconst selectedStyles = (p) =>\n p.selected\n ? {\n backgroundColor: clr(p.theme.menuItemSelectedColorBg),\n }\n : {};\n\ntype StyledButtonProps = Required<Pick<MenuItemProps, 'selected'>>;\nconst StyledButton = styled(Button)<StyledButtonProps>(selectedStyles);\n\n/**\n * The base menu item.\n */\nconst MenuItem = forwardRef<RectButton, MenuItemProps>(\n (\n {\n selected = false,\n value,\n right,\n viewProps = {},\n textProps = {},\n onPress = () => {},\n ...rest\n },\n ref\n ) => {\n const { closeOnSelect, onClose } = useContext(MenuContext);\n const onPressRef = useRef<MenuItemProps['onPress']>();\n const { theme } = useTheme();\n const safeAreaInsets = useSafeAreaInsets();\n\n useEffect(() => {\n onPressRef.current = onPress;\n }, [onPress]);\n\n const clickHandler = useCallback(\n (e) => {\n if (onPressRef.current) onPressRef.current(e);\n if (closeOnSelect) onClose();\n },\n [closeOnSelect, onClose]\n );\n\n return (\n <ThemeOverrider\n overrides={(t) => ({\n buttonGhostColorText: t.colorText,\n borderRadius: 0,\n buttonHeight: theme.menuItemHeight,\n buttonPaddingHorizontal: theme.menuItemPaddingHorizontal,\n })}\n >\n <StyledButton\n selected={selected}\n right={\n selected ? (\n <ThemeOverrider\n overrides={(t) => ({ colorText: t.menuItemSelectedColorIcon })}\n >\n <Check />\n </ThemeOverrider>\n ) : (\n right\n )\n }\n type='ghost'\n onPress={clickHandler}\n viewProps={{\n ...viewProps,\n style: {\n ...(safeAreaInsets.left > 0\n ? { paddingLeft: safeAreaInsets.left }\n : {}),\n ...(safeAreaInsets.right > 0\n ? { paddingRight: safeAreaInsets.right }\n : {}),\n ...(typeof viewProps?.style === 'object' ? viewProps.style : {}),\n },\n }}\n textProps={{\n ...textProps,\n style: {\n flex: 1,\n textAlign: 'left',\n fontWeight: 'normal',\n ...(typeof textProps?.style === 'object' ? textProps.style : {}),\n },\n }}\n {...rest}\n ref={ref}\n />\n </ThemeOverrider>\n );\n }\n);\n\nMenuItem.displayName = 'MenuItem';\n\nexport default MenuItem;\n"],"mappings":"mRAAA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,WAQA,IAAAC,QAAA,CAAAD,OAAA,8BACA,IAAAE,MAAA,CAAAF,OAAA,4BACA,IAAAG,OAAA,CAAAC,sBAAA,CAAAJ,OAAA,8BAEA,IAAAK,OAAA,CAAAD,sBAAA,CAAAJ,OAAA,qBACA,IAAAM,UAAA,CAAAN,OAAA,0BACA,IAAAO,2BAAA,CAAAP,OAAA,mCAAmE,IAAAQ,WAAA,CAAAR,OAAA,0BAAAS,SAAA,yEAAAC,yBAAAC,CAAA,wBAAAC,OAAA,iBAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAF,wBAAA,UAAAA,yBAAAC,CAAA,SAAAA,CAAA,CAAAG,CAAA,CAAAD,CAAA,IAAAF,CAAA,YAAAZ,wBAAAY,CAAA,CA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CAChE,EACD,CACFnC,SAAS,CAAA7B,MAAA,CAAA4D,MAAA,IACJ/B,SAAS,EACZmC,KAAK,CAAAhE,MAAA,CAAA4D,MAAA,EACHQ,IAAI,CAAE,CAAC,CACPC,SAAS,CAAE,MAAM,CACjBC,UAAU,CAAE,QAAQ,EAChB,OAAOzC,SAAS,cAATA,SAAS,CAAEmC,KAAK,IAAK,QAAQ,CAAGnC,SAAS,CAACmC,KAAK,CAAG,CAAC,CAAC,CAChE,EACD,EACEhC,IAAI,EACRV,GAAG,CAAEA,GAAI,EACV,CAAC,CACY,CAAC,CAErB,CACF,CAAC,CAEDH,QAAQ,CAACoD,WAAW,CAAG,UAAU,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAA/E,OAAA,CAEnByB,QAAQ"}
|
package/dist/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={Menu:true,MenuDivider:true,MenuGroup:true,MenuItem:true};Object.defineProperty(exports,"Menu",{enumerable:true,get:function get(){return _Menu.default;}});Object.defineProperty(exports,"MenuDivider",{enumerable:true,get:function get(){return _MenuDivider.default;}});Object.defineProperty(exports,"MenuGroup",{enumerable:true,get:function get(){return _MenuGroup.default;}});Object.defineProperty(exports,"MenuItem",{enumerable:true,get:function get(){return _MenuItem.default;}});var _Menu=_interopRequireWildcard(require("./Menu"));Object.keys(_Menu).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_Menu[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _Menu[key];}});});var _MenuDivider=_interopRequireWildcard(require("./MenuDivider"));Object.keys(_MenuDivider).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_MenuDivider[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _MenuDivider[key];}});});var _MenuGroup=_interopRequireWildcard(require("./MenuGroup"));Object.keys(_MenuGroup).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_MenuGroup[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _MenuGroup[key];}});});var _MenuItem=_interopRequireWildcard(require("./MenuItem"));Object.keys(_MenuItem).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_MenuItem[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _MenuItem[key];}});});function _getRequireWildcardCache(
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={Menu:true,MenuDivider:true,MenuGroup:true,MenuItem:true};Object.defineProperty(exports,"Menu",{enumerable:true,get:function get(){return _Menu.default;}});Object.defineProperty(exports,"MenuDivider",{enumerable:true,get:function get(){return _MenuDivider.default;}});Object.defineProperty(exports,"MenuGroup",{enumerable:true,get:function get(){return _MenuGroup.default;}});Object.defineProperty(exports,"MenuItem",{enumerable:true,get:function get(){return _MenuItem.default;}});var _Menu=_interopRequireWildcard(require("./Menu"));Object.keys(_Menu).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_Menu[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _Menu[key];}});});var _MenuDivider=_interopRequireWildcard(require("./MenuDivider"));Object.keys(_MenuDivider).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_MenuDivider[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _MenuDivider[key];}});});var _MenuGroup=_interopRequireWildcard(require("./MenuGroup"));Object.keys(_MenuGroup).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_MenuGroup[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _MenuGroup[key];}});});var _MenuItem=_interopRequireWildcard(require("./MenuItem"));Object.keys(_MenuItem).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_MenuItem[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _MenuItem[key];}});});function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Menu","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_MenuDivider","_MenuGroup","_MenuItem","_getRequireWildcardCache","
|
1
|
+
{"version":3,"file":"index.js","names":["_Menu","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_MenuDivider","_MenuGroup","_MenuItem","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set"],"sources":["../src/index.ts"],"sourcesContent":["export { default as Menu } from './Menu';\nexport { default as MenuDivider } from './MenuDivider';\nexport { default as MenuGroup } from './MenuGroup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,CAAAC,IAAA,CAAAU,CAAA,CAAAW,CAAA,OAAAC,CAAA,CAAAH,CAAA,CAAAzB,MAAA,CAAA0B,wBAAA,CAAAV,CAAA,CAAAW,CAAA,OAAAC,CAAA,GAAAA,CAAA,CAAAjB,GAAA,EAAAiB,CAAA,CAAAC,GAAA,EAAA7B,MAAA,CAAAS,cAAA,CAAAc,CAAA,CAAAI,CAAA,CAAAC,CAAA,EAAAL,CAAA,CAAAI,CAAA,EAAAX,CAAA,CAAAW,CAAA,UAAAJ,CAAA,CAAAF,OAAA,CAAAL,CAAA,CAAAG,CAAA,EAAAA,CAAA,CAAAU,GAAA,CAAAb,CAAA,CAAAO,CAAA,EAAAA,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@os-design-mobile/menu",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.89",
|
4
4
|
"license": "UNLICENSED",
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design-mobile.git",
|
6
6
|
"main": "dist/index.js",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"dependencies": {
|
31
31
|
"@os-design-mobile/button": "^1.0.58",
|
32
32
|
"@os-design-mobile/icons": "^1.0.56",
|
33
|
-
"@os-design-mobile/modal": "^1.0.
|
33
|
+
"@os-design-mobile/modal": "^1.0.93",
|
34
34
|
"@os-design-mobile/theming": "^1.0.41",
|
35
35
|
"@os-design/menu-utils": "^1.0.20",
|
36
36
|
"@os-design/use-forwarded-state": "^1.0.21"
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"react-native-safe-area-context": ">=3",
|
49
49
|
"react-native-svg": ">=12"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "6722ce0e05d2cfefa3e21a8bdcbe67c23efe64cb"
|
52
52
|
}
|