@os-design-mobile/menu 1.0.94 → 1.0.96
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/@types/emotion.d.js.map +1 -1
- package/dist/Menu.d.ts +9 -2
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +1 -1
- package/dist/Menu.js.map +1 -1
- package/dist/MenuDivider.d.ts +5 -3
- package/dist/MenuDivider.d.ts.map +1 -1
- package/dist/MenuDivider.js +1 -1
- package/dist/MenuDivider.js.map +1 -1
- package/dist/MenuGroup.d.ts +34 -2
- package/dist/MenuGroup.d.ts.map +1 -1
- package/dist/MenuGroup.js +1 -1
- package/dist/MenuGroup.js.map +1 -1
- package/dist/MenuItem.d.ts +14 -4
- package/dist/MenuItem.d.ts.map +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/MenuItem.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
- package/src/@types/emotion.d.ts +1 -1
- package/src/Menu.tsx +3 -3
- package/src/MenuDivider.tsx +2 -2
- package/src/MenuGroup.tsx +3 -3
- package/src/MenuItem.tsx +4 -4
- package/src/index.ts +8 -8
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"emotion.d.js","names":["require"],"sources":["../../src/@types/emotion.d.ts"],"sourcesContent":["import '@emotion/react';\nimport { Theme as BaseTheme } from '@os-design-mobile/theming';\n\ndeclare module '@emotion/react' {\n // eslint-disable-next-line @typescript-eslint/no-empty-
|
1
|
+
{"version":3,"file":"emotion.d.js","names":["require"],"sources":["../../src/@types/emotion.d.ts"],"sourcesContent":["import '@emotion/react';\nimport { Theme as BaseTheme } from '@os-design-mobile/theming';\n\ndeclare module '@emotion/react' {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n export interface Theme extends BaseTheme {}\n}\n"],"mappings":"AAAAA,OAAA","ignoreList":[]}
|
package/dist/Menu.d.ts
CHANGED
@@ -1,9 +1,16 @@
|
|
1
|
-
import React, { PropsWithChildren } from 'react';
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
2
2
|
import { View } from 'react-native';
|
3
|
-
import { ModalProps } from '@os-design-mobile/modal';
|
3
|
+
import { type ModalProps } from '@os-design-mobile/modal';
|
4
4
|
export interface MenuProps extends PropsWithChildren<ModalProps> {
|
5
|
+
/**
|
6
|
+
* Whether the menu closes when the user selects a menu item.
|
7
|
+
* @default true
|
8
|
+
*/
|
5
9
|
closeOnSelect?: boolean;
|
6
10
|
}
|
11
|
+
/**
|
12
|
+
* The dropdown menu.
|
13
|
+
*/
|
7
14
|
declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<View>>;
|
8
15
|
export default Menu;
|
9
16
|
//# sourceMappingURL=Menu.d.ts.map
|
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;
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../src/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,KAAK,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAc,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAOjE,MAAM,WAAW,SAAU,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAC9D;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAOD;;GAEG;AACH,QAAA,MAAM,IAAI,wEAwCT,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 _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&&{}.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;
|
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.js"));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&&{}.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","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","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,
|
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","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, type PropsWithChildren, useMemo } from 'react';\nimport { View } from 'react-native';\nimport Modal, { type 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.js';\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,oBAAuC,IAAAQ,WAAA,CAAAR,OAAA,0BAAAS,SAAA,iDAAAC,yBAAAC,CAAA,wBAAAC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,cAAK,CAACc,cAAc,CAACF,KAAK,CAAC,EAAIA,KAAK,CAACG,IAAI,GAAKC,kBAAS,CAC1D,MAAO,CAAAJ,KAAK,CACd,GAAI,CAAAK,KAAK,CAAG,CAAC,CAAC,CACd,GAAIJ,KAAK,CAAGf,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,CAAAhE,OAAA,CAEXmB,IAAI","ignoreList":[]}
|
package/dist/MenuDivider.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
import
|
2
|
-
import { View, ViewProps } from 'react-native';
|
1
|
+
import { View, type ViewProps } from 'react-native';
|
3
2
|
export type MenuDividerProps = ViewProps;
|
4
|
-
|
3
|
+
/**
|
4
|
+
* The divider of menu items.
|
5
|
+
*/
|
6
|
+
declare const MenuDivider: import("react").ForwardRefExoticComponent<ViewProps & import("react").RefAttributes<View>>;
|
5
7
|
export default MenuDivider;
|
6
8
|
//# 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":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpD,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC;AASzC;;GAEG;AACH,QAAA,MAAM,WAAW,4FAEf,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=
|
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;
|
2
2
|
//# sourceMappingURL=MenuDivider.js.map
|
package/dist/MenuDivider.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuDivider.js","names":["_react","
|
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","Object","assign","displayName","_default","exports","default"],"sources":["../src/MenuDivider.tsx"],"sourcesContent":["import { 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,OAAA,UAEA,IAAAC,OAAA,CAAAC,sBAAA,CAAAF,OAAA,qBACA,IAAAG,QAAA,CAAAH,OAAA,8BAAgD,IAAAI,WAAA,CAAAJ,OAAA,sBAIhD,GAAM,CAAAK,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,GAAAjB,WAAA,CAAAkB,GAAA,EAACjB,UAAU,CAAAkB,MAAA,CAAAC,MAAA,IAAKJ,KAAK,EAAEC,GAAG,CAAEA,GAAI,EAAE,CAAC,EACpC,CAAC,CAEFH,WAAW,CAACO,WAAW,CAAG,aAAa,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAAC,OAAA,CAEzBV,WAAW","ignoreList":[]}
|
package/dist/MenuGroup.d.ts
CHANGED
@@ -1,19 +1,51 @@
|
|
1
|
-
import React, { PropsWithChildren } from 'react';
|
2
|
-
import { View, ViewProps } from 'react-native';
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
2
|
+
import { View, type ViewProps } from 'react-native';
|
3
3
|
interface BaseMenuGroupProps<T> extends PropsWithChildren<ViewProps> {
|
4
|
+
/**
|
5
|
+
* The title of the menu group.
|
6
|
+
* @default undefined
|
7
|
+
*/
|
4
8
|
title?: string;
|
9
|
+
/**
|
10
|
+
* The max number of options that the user can select. Zero means unlimited.
|
11
|
+
* Works only when multiple is true.
|
12
|
+
* @default 0
|
13
|
+
*/
|
5
14
|
maxSelectedItems?: number;
|
15
|
+
/**
|
16
|
+
* Selected menu items.
|
17
|
+
* @default undefined
|
18
|
+
*/
|
6
19
|
value?: T;
|
20
|
+
/**
|
21
|
+
* The default value.
|
22
|
+
* @default undefined
|
23
|
+
*/
|
7
24
|
defaultValue?: T;
|
25
|
+
/**
|
26
|
+
* The change event handler.
|
27
|
+
* @default undefined
|
28
|
+
*/
|
8
29
|
onChange?: (value: T) => void;
|
9
30
|
}
|
10
31
|
interface MenuGroupNotMultipleProps extends BaseMenuGroupProps<string | null> {
|
32
|
+
/**
|
33
|
+
* Is it possible to select multiple values.
|
34
|
+
* @default false
|
35
|
+
*/
|
11
36
|
multiple?: false;
|
12
37
|
}
|
13
38
|
interface MenuGroupMultipleProps extends BaseMenuGroupProps<string[]> {
|
39
|
+
/**
|
40
|
+
* Is it possible to select multiple values.
|
41
|
+
* @default false
|
42
|
+
*/
|
14
43
|
multiple: true;
|
15
44
|
}
|
16
45
|
export type MenuGroupProps = MenuGroupNotMultipleProps | MenuGroupMultipleProps;
|
46
|
+
/**
|
47
|
+
* The group of menu items.
|
48
|
+
*/
|
17
49
|
declare const MenuGroup: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<View>>;
|
18
50
|
export default MenuGroup;
|
19
51
|
//# sourceMappingURL=MenuGroup.d.ts.map
|
package/dist/MenuGroup.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuGroup.d.ts","sourceRoot":"","sources":["../src/MenuGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAEZ,iBAAiB,
|
1
|
+
{"version":3,"file":"MenuGroup.d.ts","sourceRoot":"","sources":["../src/MenuGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAEZ,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpD,UAAU,kBAAkB,CAAC,CAAC,CAAE,SAAQ,iBAAiB,CAAC,SAAS,CAAC;IAClE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B;AACD,UAAU,yBAA0B,SAAQ,kBAAkB,CAAC,MAAM,GAAG,IAAI,CAAC;IAC3E;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AACD,UAAU,sBAAuB,SAAQ,kBAAkB,CAAC,MAAM,EAAE,CAAC;IACnE;;;OAGG;IACH,QAAQ,EAAE,IAAI,CAAC;CAChB;AACD,MAAM,MAAM,cAAc,GAAG,yBAAyB,GAAG,sBAAsB,CAAC;AAUhF;;GAEG;AACH,QAAA,MAAM,SAAS,6EA4Fd,CAAC;AAIF,eAAe,SAAS,CAAC"}
|
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(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 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;
|
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.js"));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&&{}.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","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","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,CAA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AAEA,GAAI,CAAAU,QAAA,EACtBT,KAAK,EACJ,GAAAzC,WAAA,CAAA0F,GAAA,EAACpE,KAAK,EACJqE,aAAa,CAAE,CAAE,CACjBC,KAAK,CAAA9E,MAAA,CAAA2E,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,CAAA3F,OAAA,CAErB6B,SAAS","ignoreList":[]}
|
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","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 type PropsWithChildren,\n useCallback,\n useMemo,\n} from 'react';\nimport { View, type ViewProps } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport MenuItem from './MenuItem.js';\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,O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from '@os-design-mobile/button';
|
3
|
-
import { RectButton } from 'react-native-gesture-handler';
|
1
|
+
import { type PropsWithChildren } from 'react';
|
2
|
+
import { type ButtonProps } from '@os-design-mobile/button';
|
4
3
|
export interface MenuItemProps extends PropsWithChildren<Omit<ButtonProps, 'type' | 'size'>> {
|
4
|
+
/**
|
5
|
+
* Whether the menu item is selected.
|
6
|
+
* @default false
|
7
|
+
*/
|
5
8
|
selected?: boolean;
|
9
|
+
/**
|
10
|
+
* The value of the menu item.
|
11
|
+
* @default undefined
|
12
|
+
*/
|
6
13
|
value?: string;
|
7
14
|
}
|
8
|
-
|
15
|
+
/**
|
16
|
+
* The base menu item.
|
17
|
+
*/
|
18
|
+
declare const MenuItem: import("react").ForwardRefExoticComponent<MenuItemProps & import("react").RefAttributes<import("react").ForwardRefExoticComponent<Omit<import("react-native-gesture-handler").RectButtonProps, "innerRef"> & import("react").RefAttributes<any>>>>;
|
9
19
|
export default MenuItem;
|
10
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,KAAK,
|
1
|
+
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../src/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,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,oPAiFb,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=
|
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;
|
2
2
|
//# sourceMappingURL=MenuItem.js.map
|
package/dist/MenuItem.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"MenuItem.js","names":["_react","
|
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","default","_useContext","useContext","MenuContext","closeOnSelect","onClose","onPressRef","useRef","_useTheme","useTheme","safeAreaInsets","useSafeAreaInsets","useEffect","current","clickHandler","useCallback","e","jsx","ThemeOverrider","overrides","t","buttonGhostColorText","colorText","borderRadius","buttonHeight","menuItemHeight","buttonPaddingHorizontal","menuItemPaddingHorizontal","children","Object","assign","menuItemSelectedColorIcon","Check","type","style","left","paddingLeft","paddingRight","flex","textAlign","fontWeight","displayName","_default","exports"],"sources":["../src/MenuItem.tsx"],"sourcesContent":["import {\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,OAAA,UAQA,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,gEAgBnE,GAAM,CAAAC,cAAc,CAAG,QAAjB,CAAAA,cAAcA,CAAIC,CAAC,QACvB,CAAAA,CAAC,CAACC,QAAQ,CACN,CACEC,eAAe,CAAE,GAAAC,YAAG,EAACH,CAAC,CAACI,KAAK,CAACC,uBAAuB,CACtD,CAAC,CACD,CAAC,CAAC,GAGR,GAAM,CAAAC,YAAY,CAAG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C,CAAC,CACF,OAAOE,SAAS,cAATA,SAAS,CAAEyC,KAAK,IAAK,QAAQ,CAAGzC,SAAS,CAACyC,KAAK,CAAG,CAAC,CAAC,CAChE,EACD,CACFvC,SAAS,CAAAkC,MAAA,CAAAC,MAAA,IACJnC,SAAS,EACZuC,KAAK,CAAAL,MAAA,CAAAC,MAAA,EACHQ,IAAI,CAAE,CAAC,CACPC,SAAS,CAAE,MAAM,CACjBC,UAAU,CAAE,QAAQ,EAChB,OAAO7C,SAAS,cAATA,SAAS,CAAEuC,KAAK,IAAK,QAAQ,CAAGvC,SAAS,CAACuC,KAAK,CAAG,CAAC,CAAC,CAChE,EACD,EACEpC,IAAI,EACRV,GAAG,CAAEA,GAAI,EACV,CAAC,CACY,CAAC,CAErB,CACF,CAAC,CAEDH,QAAQ,CAACwD,WAAW,CAAG,UAAU,CAAC,IAAAC,QAAA,CAAAC,OAAA,CAAA3C,OAAA,CAEnBf,QAAQ","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
export { default as Menu } from './Menu';
|
2
|
-
export { default as MenuDivider } from './MenuDivider';
|
3
|
-
export { default as MenuGroup } from './MenuGroup';
|
4
|
-
export { default as MenuItem } from './MenuItem';
|
5
|
-
export * from './Menu';
|
6
|
-
export * from './MenuDivider';
|
7
|
-
export * from './MenuGroup';
|
8
|
-
export * from './MenuItem';
|
1
|
+
export { default as Menu } from './Menu.js';
|
2
|
+
export { default as MenuDivider } from './MenuDivider.js';
|
3
|
+
export { default as MenuGroup } from './MenuGroup.js';
|
4
|
+
export { default as MenuItem } from './MenuItem.js';
|
5
|
+
export * from './Menu.js';
|
6
|
+
export * from './MenuDivider.js';
|
7
|
+
export * from './MenuGroup.js';
|
8
|
+
export * from './MenuItem.js';
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEpD,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
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(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;}
|
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.js"));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.js"));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.js"));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.js"));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&&{}.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","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';\nexport { default as MenuItem } from './MenuItem';\n\nexport * from './Menu';\nexport * from './MenuDivider';\nexport * from './MenuGroup';\nexport * from './MenuItem';\n"],"mappings":"4iBAAA,IAAAA,KAAA,CAAAC,uBAAA,CAAAC,OAAA,
|
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.js';\nexport { default as MenuDivider } from './MenuDivider.js';\nexport { default as MenuGroup } from './MenuGroup.js';\nexport { default as MenuItem } from './MenuItem.js';\n\nexport * from './Menu.js';\nexport * from './MenuDivider.js';\nexport * from './MenuGroup.js';\nexport * from './MenuItem.js';\n"],"mappings":"4iBAAA,IAAAA,KAAA,CAAAC,uBAAA,CAAAC,OAAA,eAKAC,MAAA,CAAAC,IAAA,CAAAJ,KAAA,EAAAK,OAAA,UAAAC,GAAA,KAAAA,GAAA,cAAAA,GAAA,0BAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,CAAAJ,GAAA,YAAAA,GAAA,IAAAK,OAAA,EAAAA,OAAA,CAAAL,GAAA,IAAAN,KAAA,CAAAM,GAAA,SAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,CAAAL,GAAA,EAAA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
{
|
2
2
|
"name": "@os-design-mobile/menu",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.96",
|
4
4
|
"license": "UNLICENSED",
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design-mobile.git",
|
6
|
+
"type": "module",
|
6
7
|
"main": "dist/index.js",
|
7
8
|
"types": "dist/index.d.ts",
|
8
9
|
"react-native": "src/index.ts",
|
@@ -28,25 +29,25 @@
|
|
28
29
|
"access": "public"
|
29
30
|
},
|
30
31
|
"dependencies": {
|
31
|
-
"@os-design-mobile/button": "^1.0.
|
32
|
-
"@os-design-mobile/icons": "^1.0.
|
33
|
-
"@os-design-mobile/modal": "^1.0.
|
34
|
-
"@os-design-mobile/theming": "^1.0.
|
35
|
-
"@os-design/menu-utils": "^1.0.
|
36
|
-
"@os-design/use-forwarded-state": "^1.0.
|
32
|
+
"@os-design-mobile/button": "^1.0.64",
|
33
|
+
"@os-design-mobile/icons": "^1.0.61",
|
34
|
+
"@os-design-mobile/modal": "^1.0.100",
|
35
|
+
"@os-design-mobile/theming": "^1.0.44",
|
36
|
+
"@os-design/menu-utils": "^1.0.24",
|
37
|
+
"@os-design/use-forwarded-state": "^1.0.26"
|
37
38
|
},
|
38
39
|
"devDependencies": {
|
39
|
-
"@os-design-mobile/text": "^1.0.
|
40
|
+
"@os-design-mobile/text": "^1.0.59"
|
40
41
|
},
|
41
42
|
"peerDependencies": {
|
42
43
|
"@emotion/native": ">=11",
|
43
44
|
"@emotion/react": ">=11",
|
44
45
|
"@react-native-async-storage/async-storage": ">=1",
|
45
46
|
"react": "18.2.0",
|
46
|
-
"react-native": "0.
|
47
|
+
"react-native": "0.76.2",
|
47
48
|
"react-native-gesture-handler": ">=2",
|
48
49
|
"react-native-safe-area-context": ">=3",
|
49
50
|
"react-native-svg": ">=12"
|
50
51
|
},
|
51
|
-
"gitHead": "
|
52
|
+
"gitHead": "d6689353e25c337e13873307a615ddb28389aad8"
|
52
53
|
}
|
package/src/@types/emotion.d.ts
CHANGED
@@ -2,6 +2,6 @@ import '@emotion/react';
|
|
2
2
|
import { Theme as BaseTheme } from '@os-design-mobile/theming';
|
3
3
|
|
4
4
|
declare module '@emotion/react' {
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
6
6
|
export interface Theme extends BaseTheme {}
|
7
7
|
}
|
package/src/Menu.tsx
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import React, { forwardRef, PropsWithChildren, useMemo } from 'react';
|
1
|
+
import React, { forwardRef, type PropsWithChildren, useMemo } from 'react';
|
2
2
|
import { View } from 'react-native';
|
3
|
-
import Modal, { ModalProps } from '@os-design-mobile/modal';
|
3
|
+
import Modal, { type ModalProps } from '@os-design-mobile/modal';
|
4
4
|
import { MenuContext } from '@os-design/menu-utils';
|
5
5
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
6
6
|
import styled from '@emotion/native';
|
7
7
|
import { clr, useTheme } from '@os-design-mobile/theming';
|
8
|
-
import MenuGroup from './MenuGroup';
|
8
|
+
import MenuGroup from './MenuGroup.js';
|
9
9
|
|
10
10
|
export interface MenuProps extends PropsWithChildren<ModalProps> {
|
11
11
|
/**
|
package/src/MenuDivider.tsx
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import
|
2
|
-
import { View, ViewProps } from 'react-native';
|
1
|
+
import { forwardRef } from 'react';
|
2
|
+
import { View, type ViewProps } from 'react-native';
|
3
3
|
import styled from '@emotion/native';
|
4
4
|
import { clr } from '@os-design-mobile/theming';
|
5
5
|
|
package/src/MenuGroup.tsx
CHANGED
@@ -3,13 +3,13 @@ import { clr } from '@os-design-mobile/theming';
|
|
3
3
|
import useForwardedState from '@os-design/use-forwarded-state';
|
4
4
|
import React, {
|
5
5
|
forwardRef,
|
6
|
-
PropsWithChildren,
|
6
|
+
type PropsWithChildren,
|
7
7
|
useCallback,
|
8
8
|
useMemo,
|
9
9
|
} from 'react';
|
10
|
-
import { View, ViewProps } from 'react-native';
|
10
|
+
import { View, type ViewProps } from 'react-native';
|
11
11
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
12
|
-
import MenuItem from './MenuItem';
|
12
|
+
import MenuItem from './MenuItem.js';
|
13
13
|
|
14
14
|
interface BaseMenuGroupProps<T> extends PropsWithChildren<ViewProps> {
|
15
15
|
/**
|
package/src/MenuItem.tsx
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import
|
1
|
+
import {
|
2
2
|
forwardRef,
|
3
|
-
PropsWithChildren,
|
3
|
+
type PropsWithChildren,
|
4
4
|
useCallback,
|
5
5
|
useContext,
|
6
6
|
useEffect,
|
@@ -8,7 +8,7 @@ import React, {
|
|
8
8
|
} from 'react';
|
9
9
|
import { clr, ThemeOverrider, useTheme } from '@os-design-mobile/theming';
|
10
10
|
import { Check } from '@os-design-mobile/icons';
|
11
|
-
import Button, { ButtonProps } from '@os-design-mobile/button';
|
11
|
+
import Button, { type ButtonProps } from '@os-design-mobile/button';
|
12
12
|
import { RectButton } from 'react-native-gesture-handler';
|
13
13
|
import styled from '@emotion/native';
|
14
14
|
import { MenuContext } from '@os-design/menu-utils';
|
@@ -41,7 +41,7 @@ const StyledButton = styled(Button)<StyledButtonProps>(selectedStyles);
|
|
41
41
|
/**
|
42
42
|
* The base menu item.
|
43
43
|
*/
|
44
|
-
const MenuItem = forwardRef<RectButton, MenuItemProps>(
|
44
|
+
const MenuItem = forwardRef<typeof RectButton, MenuItemProps>(
|
45
45
|
(
|
46
46
|
{
|
47
47
|
selected = false,
|
package/src/index.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
export { default as Menu } from './Menu';
|
2
|
-
export { default as MenuDivider } from './MenuDivider';
|
3
|
-
export { default as MenuGroup } from './MenuGroup';
|
4
|
-
export { default as MenuItem } from './MenuItem';
|
1
|
+
export { default as Menu } from './Menu.js';
|
2
|
+
export { default as MenuDivider } from './MenuDivider.js';
|
3
|
+
export { default as MenuGroup } from './MenuGroup.js';
|
4
|
+
export { default as MenuItem } from './MenuItem.js';
|
5
5
|
|
6
|
-
export * from './Menu';
|
7
|
-
export * from './MenuDivider';
|
8
|
-
export * from './MenuGroup';
|
9
|
-
export * from './MenuItem';
|
6
|
+
export * from './Menu.js';
|
7
|
+
export * from './MenuDivider.js';
|
8
|
+
export * from './MenuGroup.js';
|
9
|
+
export * from './MenuItem.js';
|