@os-design-mobile/menu 1.0.32 → 1.0.33
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +1 -1
- package/dist/Menu.js.map +1 -1
- package/package.json +3 -3
package/dist/Menu.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../src/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAO5D,MAAM,WAAW,SAAU,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAK9D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAUD,QAAA,MAAM,IAAI,
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../src/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAO5D,MAAM,WAAW,SAAU,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAK9D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAUD,QAAA,MAAM,IAAI,wEAuCT,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
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 _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));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 _excluded=["closeOnSelect","onClose","children"];function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}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 childrenCount=(0,_react.useMemo)(function(){return _react.default.Children.count(children);},[children]);var
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));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 _excluded=["closeOnSelect","onClose","children"];function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}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 _react.default.createElement(_menuUtils.MenuContext.Provider,{value:menuContext},_react.default.createElement(StyledModal,(0,_extends2.default)({footer:null,onClose:onClose},rest,{ref:ref}),_react.default.createElement(_reactNativeSafeAreaContext.SafeAreaProvider,null,_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=Menu;exports.default=_default;
|
2
2
|
//# sourceMappingURL=Menu.js.map
|
package/dist/Menu.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/Menu.tsx"],"names":["StyledModal","Modal","paddingLeft","paddingRight","Menu","ref","closeOnSelect","onClose","children","rest","childrenCount","React","Children","count","
|
1
|
+
{"version":3,"sources":["../src/Menu.tsx"],"names":["StyledModal","Modal","paddingLeft","paddingRight","Menu","ref","closeOnSelect","onClose","children","rest","theme","childrenCount","React","Children","count","menuContext","map","child","index","isValidElement","type","MenuGroup","style","paddingBottom","fontSize","borderBottomWidth","borderBottomColor","menuGroupColorDivider","marginTop","modalBodyPaddingVertical","cloneElement","displayName"],"mappings":"mWAAA,qDAEA,sEACA,gDACA,0EACA,+DACA,kDACA,8D,+iCAUA,GAAMA,CAAAA,WAAW,CAAG,oBAAOC,cAAP,EAAc,CAChCC,WAAW,CAAE,CADmB,CAEhCC,YAAY,CAAE,CAFkB,CAAd,CAApB,CAQA,GAAMC,CAAAA,IAAI,CAAG,sBACX,cAAkEC,GAAlE,CAA0E,6BAAvEC,aAAuE,CAAvEA,aAAuE,6BAAvD,IAAuD,sCAAjDC,OAAiD,CAAjDA,OAAiD,uB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B,YAAN,CAAmBb,KAAnB,CAA0B,CAAEK,KAAK,CAALA,KAAF,CAA1B,CAAP,CACD,CAjBA,CADH,CADF,CADF,CADF,CA0BD,CAtCU,CAAb,CAyCAlB,IAAI,CAAC2B,WAAL,CAAmB,MAAnB,C,aAEe3B,I","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 return React.cloneElement(child, { style });\n })}\n </SafeAreaProvider>\n </StyledModal>\n </MenuContext.Provider>\n );\n }\n);\n\nMenu.displayName = 'Menu';\n\nexport default Menu;\n"],"file":"Menu.js"}
|
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.33",
|
4
4
|
"license": "UNLICENSED",
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design-mobile.git",
|
6
6
|
"main": "dist/index.js",
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"dependencies": {
|
22
22
|
"@os-design-mobile/button": "^1.0.25",
|
23
23
|
"@os-design-mobile/icons": "^1.0.24",
|
24
|
-
"@os-design-mobile/modal": "^1.0.
|
24
|
+
"@os-design-mobile/modal": "^1.0.37",
|
25
25
|
"@os-design-mobile/theming": "^1.0.18",
|
26
26
|
"@os-design/menu-utils": "^1.0.3",
|
27
27
|
"@os-design/use-forwarded-state": "^1.0.4"
|
@@ -38,5 +38,5 @@
|
|
38
38
|
"react-native-safe-area-context": ">=3",
|
39
39
|
"react-native-svg": ">=12"
|
40
40
|
},
|
41
|
-
"gitHead": "
|
41
|
+
"gitHead": "7232e69ba80b10373e161ff6ee282c13c1f4a9cf"
|
42
42
|
}
|