@os-design-mobile/menu 1.0.102 → 1.0.104
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/MenuDivider.d.ts +2 -1
- package/dist/MenuDivider.d.ts.map +1 -1
- package/dist/MenuDivider.js +1 -1
- package/dist/MenuDivider.js.map +1 -1
- package/dist/MenuItem.d.ts +2 -2
- package/dist/MenuItem.d.ts.map +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/MenuItem.js.map +1 -1
- package/package.json +9 -10
- package/src/MenuDivider.tsx +1 -1
- package/src/MenuItem.tsx +1 -1
package/dist/MenuDivider.d.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
import { View, type ViewProps } from 'react-native';
|
2
3
|
export type MenuDividerProps = ViewProps;
|
3
4
|
/**
|
4
5
|
* The divider of menu items.
|
5
6
|
*/
|
6
|
-
declare const MenuDivider:
|
7
|
+
declare const MenuDivider: React.ForwardRefExoticComponent<ViewProps & React.RefAttributes<View>>;
|
7
8
|
export default MenuDivider;
|
8
9
|
//# sourceMappingURL=MenuDivider.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuDivider.d.ts","sourceRoot":"","sources":["../src/MenuDivider.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"MenuDivider.d.ts","sourceRoot":"","sources":["../src/MenuDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpD,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC;AASzC;;GAEG;AACH,QAAA,MAAM,WAAW,wEAEf,CAAC;AAIH,eAAe,WAAW,CAAC"}
|
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=require("react");var _native=_interopRequireDefault(require("@emotion/native"));var _theming=require("@os-design-mobile/theming");var _jsxRuntime=require("react/jsx-runtime");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;
|
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&&{}.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","require","_native","_interopRequireDefault","_theming","_jsxRuntime","StyledView","styled","View","p","paddingTop","theme","menuDividerIndent","fontSize","borderBottomWidth","borderBottomColor","clr","menuDividerColor","marginBottom","MenuDivider","forwardRef","props","ref","jsx","
|
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","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, type 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,wBAAA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pBC,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,GAAArC,WAAA,CAAAsC,GAAA,EAACjB,UAAU,CAAAR,MAAA,CAAA0B,MAAA,IAAKH,KAAK,EAAEC,GAAG,CAAEA,GAAI,EAAE,CAAC,EACpC,CAAC,CAEFH,WAAW,CAACM,WAAW,CAAG,aAAa,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAnC,OAAA,CAEzB2B,WAAW","ignoreList":[]}
|
package/dist/MenuItem.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type PropsWithChildren } from 'react';
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
2
2
|
import { type ButtonProps } from '@os-design-mobile/button';
|
3
3
|
export interface MenuItemProps extends PropsWithChildren<Omit<ButtonProps, 'type' | 'size'>> {
|
4
4
|
/**
|
@@ -15,6 +15,6 @@ export interface MenuItemProps extends PropsWithChildren<Omit<ButtonProps, 'type
|
|
15
15
|
/**
|
16
16
|
* The base menu item.
|
17
17
|
*/
|
18
|
-
declare const MenuItem:
|
18
|
+
declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<React.ForwardRefExoticComponent<Omit<import("react-native-gesture-handler").RectButtonProps, "innerRef"> & React.RefAttributes<any>>>>;
|
19
19
|
export default MenuItem;
|
20
20
|
//# sourceMappingURL=MenuItem.d.ts.map
|
package/dist/MenuItem.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../src/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../src/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAGf,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAMpE,MAAM,WAAW,aACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7D;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAYD;;GAEG;AACH,QAAA,MAAM,QAAQ,4MAiFb,CAAC;AAIF,eAAe,QAAQ,CAAC"}
|
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=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"];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;
|
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&&{}.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","require","_theming","_icons","_button","_interopRequireDefault","_native","_menuUtils","_reactNativeSafeAreaContext","_jsxRuntime","_excluded","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","
|
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","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 type 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, { type 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<typeof 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,IA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,KAAK,CAAA/D,MAAA,CAAA2D,MAAA,IACCjB,cAAc,CAACsB,IAAI,CAAG,CAAC,CACvB,CAAEC,WAAW,CAAEvB,cAAc,CAACsB,IAAK,CAAC,CACpC,CAAC,CAAC,CACFtB,cAAc,CAAClB,KAAK,CAAG,CAAC,CACxB,CAAE0C,YAAY,CAAExB,cAAc,CAAClB,KAAM,CAAC,CACtC,CAAC,CAAC,CACF,OAAOE,SAAS,cAATA,SAAS,CAAEqC,KAAK,IAAK,QAAQ,CAAGrC,SAAS,CAACqC,KAAK,CAAG,CAAC,CAAC,CAChE,EACD,CACFnC,SAAS,CAAA5B,MAAA,CAAA2D,MAAA,IACJ/B,SAAS,EACZmC,KAAK,CAAA/D,MAAA,CAAA2D,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,CAAA9E,OAAA,CAEnBwB,QAAQ","ignoreList":[]}
|
package/package.json
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"name": "@os-design-mobile/menu",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.104",
|
4
4
|
"license": "UNLICENSED",
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design-mobile.git",
|
6
|
-
"type": "module",
|
7
6
|
"main": "./dist/index.js",
|
8
7
|
"types": "./dist/index.d.ts",
|
9
8
|
"react-native": "./src/index.ts",
|
@@ -29,15 +28,15 @@
|
|
29
28
|
"access": "public"
|
30
29
|
},
|
31
30
|
"dependencies": {
|
32
|
-
"@os-design-mobile/button": "^1.0.
|
33
|
-
"@os-design-mobile/icons": "^1.0.
|
34
|
-
"@os-design-mobile/modal": "^1.0.
|
35
|
-
"@os-design-mobile/theming": "^1.0.
|
36
|
-
"@os-design/menu-utils": "^1.0.
|
37
|
-
"@os-design/use-forwarded-state": "^1.0.
|
31
|
+
"@os-design-mobile/button": "^1.0.72",
|
32
|
+
"@os-design-mobile/icons": "^1.0.68",
|
33
|
+
"@os-design-mobile/modal": "^1.0.108",
|
34
|
+
"@os-design-mobile/theming": "^1.0.50",
|
35
|
+
"@os-design/menu-utils": "^1.0.26",
|
36
|
+
"@os-design/use-forwarded-state": "^1.0.28"
|
38
37
|
},
|
39
38
|
"devDependencies": {
|
40
|
-
"@os-design-mobile/text": "^1.0.
|
39
|
+
"@os-design-mobile/text": "^1.0.66"
|
41
40
|
},
|
42
41
|
"peerDependencies": {
|
43
42
|
"@emotion/native": ">=11",
|
@@ -49,5 +48,5 @@
|
|
49
48
|
"react-native-safe-area-context": ">=3",
|
50
49
|
"react-native-svg": ">=12"
|
51
50
|
},
|
52
|
-
"gitHead": "
|
51
|
+
"gitHead": "3f5eaf89a48cc5ab19a2e24f38187c6da69a022f"
|
53
52
|
}
|
package/src/MenuDivider.tsx
CHANGED
package/src/MenuItem.tsx
CHANGED