@mirai/ui 1.0.49 → 1.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -259,6 +259,7 @@ A button component that receives the following props:
259
259
  - `small:boolean` modifying the button size
260
260
  - `squared:boolean` if true gives rectangular shape to the button (false by default)
261
261
  - `tag:string` html tag of resulting element ('button' by default)
262
+ - `wide:bool` modifying the button to full-width
262
263
  - `onEnter:function` executed when the user hovers over
263
264
  - `onLeave:function` executed when the user hovers away
264
265
  - `onPress:function` executed on mouse click on the element
@@ -587,6 +588,7 @@ a repository of hooks which will help you create simpler solutions.
587
588
  This _hook_ can help you know what type of device your application or component is running on. Lets see the properties that this _hook_ is going to expose for you:
588
589
 
589
590
  <!-- screen -->
591
+
590
592
  - `height:number` height resolution of device
591
593
  - `width:number` width resolution of device
592
594
  <!-- navigator -->
@@ -15,7 +15,7 @@ var _primitives = require("../../primitives");
15
15
 
16
16
  var _ButtonModule = _interopRequireDefault(require("./Button.module.css"));
17
17
 
18
- var _excluded = ["busy", "children", "disabled", "large", "outlined", "rounded", "small", "squared", "tag", "onPress"];
18
+ var _excluded = ["busy", "children", "disabled", "large", "outlined", "rounded", "small", "squared", "tag", "wide", "onPress"];
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
@@ -41,13 +41,14 @@ var Button = function Button(_ref) {
41
41
  squared = _ref$squared === void 0 ? false : _ref$squared,
42
42
  _ref$tag = _ref.tag,
43
43
  tag = _ref$tag === void 0 ? 'button' : _ref$tag,
44
+ wide = _ref.wide,
44
45
  onPress = _ref.onPress,
45
46
  others = _objectWithoutProperties(_ref, _excluded);
46
47
 
47
48
  return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, _objectSpread(_objectSpread({}, others), {}, {
48
49
  disabled: disabled || busy,
49
50
  tag: tag,
50
- className: (0, _helpers.styles)(_ButtonModule.default.button, busy && _ButtonModule.default.busy, large && _ButtonModule.default.large, small && _ButtonModule.default.small, rounded && _ButtonModule.default.rounded, squared && _ButtonModule.default.squared, outlined && _ButtonModule.default.outlined, outlined && (disabled || busy) && _ButtonModule.default.disabled, others.className),
51
+ className: (0, _helpers.styles)(_ButtonModule.default.button, busy && _ButtonModule.default.busy, large && _ButtonModule.default.large, small && _ButtonModule.default.small, rounded && _ButtonModule.default.rounded, squared && _ButtonModule.default.squared, outlined && _ButtonModule.default.outlined, outlined && (disabled || busy) && _ButtonModule.default.disabled, wide && _ButtonModule.default.wide, others.className),
51
52
  onPress: !disabled && !busy ? onPress : undefined
52
53
  }), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, busy !== undefined && /*#__PURE__*/_react.default.createElement(_primitives.View, {
53
54
  className: (0, _helpers.styles)(_ButtonModule.default.busyProgress, busy && _ButtonModule.default.active)
@@ -66,6 +67,7 @@ Button.propTypes = {
66
67
  small: _propTypes.default.bool,
67
68
  squared: _propTypes.default.bool,
68
69
  tag: _propTypes.default.string,
70
+ wide: _propTypes.default.bool,
69
71
  onEnter: _propTypes.default.func,
70
72
  onLeave: _propTypes.default.func,
71
73
  onPress: _propTypes.default.func
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["Button","busy","children","disabled","large","outlined","rounded","small","squared","tag","onPress","others","React","createElement","Pressable","className","style","button","undefined","busyProgress","active","displayName","propTypes","PropTypes","bool","oneOfType","string","node","onEnter","func","onLeave"],"sources":["../../../src/components/Button/Button.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Pressable, View } from '../../primitives';\nimport style from './Button.module.css';\n\nconst Button = ({\n busy,\n children,\n disabled,\n large,\n outlined,\n rounded,\n small,\n squared = false,\n tag = 'button',\n onPress,\n ...others\n}) =>\n React.createElement(\n Pressable,\n {\n ...others,\n disabled: disabled || busy,\n tag,\n className: styles(\n style.button,\n busy && style.busy,\n large && style.large,\n small && style.small,\n rounded && style.rounded,\n squared && style.squared,\n outlined && style.outlined,\n outlined && (disabled || busy) && style.disabled,\n others.className,\n ),\n onPress: !disabled && !busy ? onPress : undefined,\n },\n <>\n {busy !== undefined && <View className={styles(style.busyProgress, busy && style.active)} />}\n {children}\n </>,\n );\n\nButton.displayName = 'Component:Button';\n\nButton.propTypes = {\n busy: PropTypes.bool,\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n disabled: PropTypes.bool,\n large: PropTypes.bool,\n outlined: PropTypes.bool,\n rounded: PropTypes.bool,\n small: PropTypes.bool,\n squared: PropTypes.bool,\n tag: PropTypes.string,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport { Button };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS;EAAA,IACbC,IADa,QACbA,IADa;EAAA,IAEbC,QAFa,QAEbA,QAFa;EAAA,IAGbC,QAHa,QAGbA,QAHa;EAAA,IAIbC,KAJa,QAIbA,KAJa;EAAA,IAKbC,QALa,QAKbA,QALa;EAAA,IAMbC,OANa,QAMbA,OANa;EAAA,IAObC,KAPa,QAObA,KAPa;EAAA,wBAQbC,OARa;EAAA,IAQbA,OARa,6BAQH,KARG;EAAA,oBASbC,GATa;EAAA,IASbA,GATa,yBASP,QATO;EAAA,IAUbC,OAVa,QAUbA,OAVa;EAAA,IAWVC,MAXU;;EAAA,oBAabC,eAAMC,aAAN,CACEC,qBADF,kCAGOH,MAHP;IAIIR,QAAQ,EAAEA,QAAQ,IAAIF,IAJ1B;IAKIQ,GAAG,EAAHA,GALJ;IAMIM,SAAS,EAAE,qBACTC,sBAAMC,MADG,EAEThB,IAAI,IAAIe,sBAAMf,IAFL,EAGTG,KAAK,IAAIY,sBAAMZ,KAHN,EAITG,KAAK,IAAIS,sBAAMT,KAJN,EAKTD,OAAO,IAAIU,sBAAMV,OALR,EAMTE,OAAO,IAAIQ,sBAAMR,OANR,EAOTH,QAAQ,IAAIW,sBAAMX,QAPT,EAQTA,QAAQ,KAAKF,QAAQ,IAAIF,IAAjB,CAAR,IAAkCe,sBAAMb,QAR/B,EASTQ,MAAM,CAACI,SATE,CANf;IAiBIL,OAAO,EAAE,CAACP,QAAD,IAAa,CAACF,IAAd,GAAqBS,OAArB,GAA+BQ;EAjB5C,iBAmBE,4DACGjB,IAAI,KAAKiB,SAAT,iBAAsB,6BAAC,gBAAD;IAAM,SAAS,EAAE,qBAAOF,sBAAMG,YAAb,EAA2BlB,IAAI,IAAIe,sBAAMI,MAAzC;EAAjB,EADzB,EAEGlB,QAFH,CAnBF,CAba;AAAA,CAAf;;;AAsCAF,MAAM,CAACqB,WAAP,GAAqB,kBAArB;AAEArB,MAAM,CAACsB,SAAP,GAAmB;EACjBrB,IAAI,EAAEsB,mBAAUC,IADC;EAEjBtB,QAAQ,EAAEqB,mBAAUE,SAAV,CAAoB,CAACF,mBAAUG,MAAX,EAAmBH,mBAAUI,IAA7B,CAApB,CAFO;EAGjBxB,QAAQ,EAAEoB,mBAAUC,IAHH;EAIjBpB,KAAK,EAAEmB,mBAAUC,IAJA;EAKjBnB,QAAQ,EAAEkB,mBAAUC,IALH;EAMjBlB,OAAO,EAAEiB,mBAAUC,IANF;EAOjBjB,KAAK,EAAEgB,mBAAUC,IAPA;EAQjBhB,OAAO,EAAEe,mBAAUC,IARF;EASjBf,GAAG,EAAEc,mBAAUG,MATE;EAUjBE,OAAO,EAAEL,mBAAUM,IAVF;EAWjBC,OAAO,EAAEP,mBAAUM,IAXF;EAYjBnB,OAAO,EAAEa,mBAAUM;AAZF,CAAnB"}
1
+ {"version":3,"file":"Button.js","names":["Button","busy","children","disabled","large","outlined","rounded","small","squared","tag","wide","onPress","others","React","createElement","Pressable","className","style","button","undefined","busyProgress","active","displayName","propTypes","PropTypes","bool","oneOfType","string","node","onEnter","func","onLeave"],"sources":["../../../src/components/Button/Button.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Pressable, View } from '../../primitives';\nimport style from './Button.module.css';\n\nconst Button = ({\n busy,\n children,\n disabled,\n large,\n outlined,\n rounded,\n small,\n squared = false,\n tag = 'button',\n wide,\n onPress,\n ...others\n}) =>\n React.createElement(\n Pressable,\n {\n ...others,\n disabled: disabled || busy,\n tag,\n className: styles(\n style.button,\n busy && style.busy,\n large && style.large,\n small && style.small,\n rounded && style.rounded,\n squared && style.squared,\n outlined && style.outlined,\n outlined && (disabled || busy) && style.disabled,\n wide && style.wide,\n others.className,\n ),\n onPress: !disabled && !busy ? onPress : undefined,\n },\n <>\n {busy !== undefined && <View className={styles(style.busyProgress, busy && style.active)} />}\n {children}\n </>,\n );\n\nButton.displayName = 'Component:Button';\n\nButton.propTypes = {\n busy: PropTypes.bool,\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n disabled: PropTypes.bool,\n large: PropTypes.bool,\n outlined: PropTypes.bool,\n rounded: PropTypes.bool,\n small: PropTypes.bool,\n squared: PropTypes.bool,\n tag: PropTypes.string,\n wide: PropTypes.bool,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport { Button };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS;EAAA,IACbC,IADa,QACbA,IADa;EAAA,IAEbC,QAFa,QAEbA,QAFa;EAAA,IAGbC,QAHa,QAGbA,QAHa;EAAA,IAIbC,KAJa,QAIbA,KAJa;EAAA,IAKbC,QALa,QAKbA,QALa;EAAA,IAMbC,OANa,QAMbA,OANa;EAAA,IAObC,KAPa,QAObA,KAPa;EAAA,wBAQbC,OARa;EAAA,IAQbA,OARa,6BAQH,KARG;EAAA,oBASbC,GATa;EAAA,IASbA,GATa,yBASP,QATO;EAAA,IAUbC,IAVa,QAUbA,IAVa;EAAA,IAWbC,OAX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PA;EAQjBjB,OAAO,EAAEgB,mBAAUC,IARF;EASjBhB,GAAG,EAAEe,mBAAUG,MATE;EAUjBjB,IAAI,EAAEc,mBAAUC,IAVC;EAWjBI,OAAO,EAAEL,mBAAUM,IAXF;EAYjBC,OAAO,EAAEP,mBAAUM,IAZF;EAajBnB,OAAO,EAAEa,mBAAUM;AAbF,CAAnB"}
@@ -104,6 +104,10 @@
104
104
  width: var(--mirai-ui-button-squared);
105
105
  }
106
106
 
107
+ .wide {
108
+ width: 100%;
109
+ }
110
+
107
111
  @media only screen and (max-width: 600px) {
108
112
  }
109
113
 
@@ -99,6 +99,16 @@ exports[`component:<Button> prop:tag 1`] = `
99
99
  </DocumentFragment>
100
100
  `;
101
101
 
102
+ exports[`component:<Button> prop:wide 1`] = `
103
+ <DocumentFragment>
104
+ <button
105
+ class="pressable button wide"
106
+ >
107
+ children
108
+ </button>
109
+ </DocumentFragment>
110
+ `;
111
+
102
112
  exports[`component:<Button> renders 1`] = `
103
113
  <DocumentFragment>
104
114
  <button
@@ -15,7 +15,7 @@ var _primitives = require("../../primitives");
15
15
 
16
16
  var _MenuModule = _interopRequireDefault(require("./Menu.module.css"));
17
17
 
18
- var _excluded = ["children", "disabled", "divider", "icon", "label"];
18
+ var _excluded = ["children", "disabled", "divider", "icon", "label", "value", "onPress"];
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
@@ -31,16 +31,20 @@ var Option = function Option(_ref) {
31
31
  divider = _ref.divider,
32
32
  icon = _ref.icon,
33
33
  label = _ref.label,
34
+ value = _ref.value,
35
+ onPress = _ref.onPress,
34
36
  others = _objectWithoutProperties(_ref, _excluded);
35
37
 
36
38
  return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, _extends({}, others, {
39
+ preventDefault: false,
37
40
  tag: "div",
38
- className: (0, _helpers.styles)(_MenuModule.default.option, divider && _MenuModule.default.divider, disabled && _MenuModule.default.disabled)
41
+ className: (0, _helpers.styles)(_MenuModule.default.option, value && _MenuModule.default.value, divider && _MenuModule.default.divider, disabled && _MenuModule.default.disabled),
42
+ onPress: !disabled && value ? onPress : undefined
39
43
  }), icon && /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
40
44
  name: icon,
41
- className: (0, _helpers.styles)(_MenuModule.default.icon, disabled && _MenuModule.default.disabled)
42
- }), /*#__PURE__*/_react.default.createElement(_primitives.Text, {
43
- className: (0, _helpers.styles)(_MenuModule.default.label, disabled && _MenuModule.default.disabled)
45
+ className: _MenuModule.default.icon
46
+ }), label && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
47
+ className: _MenuModule.default.label
44
48
  }, label), children);
45
49
  };
46
50
 
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.Option.js","names":["Option","children","disabled","divider","icon","label","others","style","option","displayName","propTypes","PropTypes","node","bool","string","value","oneOfType","number","isRequired","onPress","func"],"sources":["../../../src/components/Menu/Menu.Option.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Pressable, Text } from '../../primitives';\nimport style from './Menu.module.css';\n\nconst Option = ({ children, disabled, divider, icon, label, ...others }) => (\n <Pressable\n {...others}\n tag=\"div\"\n className={styles(style.option, divider && style.divider, disabled && style.disabled)}\n >\n {icon && <Icon name={icon} className={styles(style.icon, disabled && style.disabled)} />}\n <Text className={styles(style.label, disabled && style.disabled)}>{label}</Text>\n {children}\n </Pressable>\n);\n\nOption.displayName = 'Component:Menu:Option';\n\nOption.propTypes = {\n children: PropTypes.node,\n disabled: PropTypes.bool,\n divider: PropTypes.bool,\n icon: PropTypes.string,\n label: PropTypes.string,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n onPress: PropTypes.func,\n};\n\nexport { Option };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS;EAAA,IAAGC,QAAH,QAAGA,QAAH;EAAA,IAAaC,QAAb,QAAaA,QAAb;EAAA,IAAuBC,OAAvB,QAAuBA,OAAvB;EAAA,IAAgCC,IAAhC,QAAgCA,IAAhC;EAAA,IAAsCC,KAAtC,QAAsCA,KAAtC;EAAA,IAAgDC,MAAhD;;EAAA,oBACb,6BAAC,qBAAD,eACMA,MADN;IAEE,GAAG,EAAC,KAFN;IAGE,SAAS,EAAE,qBAAOC,oBAAMC,MAAb,EAAqBL,OAAO,IAAII,oBAAMJ,OAAtC,EAA+CD,QAAQ,IAAIK,oBAAML,QAAjE;EAHb,IAKGE,IAAI,iBAAI,6BAAC,gBAAD;IAAM,IAAI,EAAEA,IAAZ;IAAkB,SAAS,EAAE,qBAAOG,oBAAMH,IAAb,EAAmBF,QAAQ,IAAIK,oBAAML,QAArC;EAA7B,EALX,eAME,6BAAC,gBAAD;IAAM,SAAS,EAAE,qBAAOK,oBAAMF,KAAb,EAAoBH,QAAQ,IAAIK,oBAAML,QAAtC;EAAjB,GAAmEG,KAAnE,CANF,EAOGJ,QAPH,CADa;AAAA,CAAf;;;AAYAD,MAAM,CAACS,WAAP,GAAqB,uBAArB;AAEAT,MAAM,CAACU,SAAP,GAAmB;EACjBT,QAAQ,EAAEU,mBAAUC,IADH;EAEjBV,QAAQ,EAAES,mBAAUE,IAFH;EAGjBV,OAAO,EAAEQ,mBAAUE,IAHF;EAIjBT,IAAI,EAAEO,mBAAUG,MAJC;EAKjBT,KAAK,EAAEM,mBAAUG,MALA;EAMjBC,KAAK,EAAEJ,mBAAUK,SAAV,CAAoB,CAACL,mBAAUG,MAAX,EAAmBH,mBAAUM,MAA7B,CAApB,EAA0DC,UANhD;EAOjBC,OAAO,EAAER,mBAAUS;AAPF,CAAnB"}
1
+ {"version":3,"file":"Menu.Option.js","names":["Option","children","disabled","divider","icon","label","value","onPress","others","style","option","undefined","displayName","propTypes","PropTypes","node","bool","string","oneOfType","number","isRequired","func"],"sources":["../../../src/components/Menu/Menu.Option.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Pressable, Text } from '../../primitives';\nimport style from './Menu.module.css';\n\nconst Option = ({ children, disabled, divider, icon, label, value, onPress, ...others }) => (\n <Pressable\n {...others}\n preventDefault={false}\n tag=\"div\"\n className={styles(style.option, value && style.value, divider && style.divider, disabled && style.disabled)}\n onPress={!disabled && value ? onPress : undefined}\n >\n {icon && <Icon name={icon} className={style.icon} />}\n {label && <Text className={style.label}>{label}</Text>}\n {children}\n </Pressable>\n);\n\nOption.displayName = 'Component:Menu:Option';\n\nOption.propTypes = {\n children: PropTypes.node,\n disabled: PropTypes.bool,\n divider: PropTypes.bool,\n icon: PropTypes.string,\n label: PropTypes.string,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n onPress: PropTypes.func,\n};\n\nexport { Option };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS;EAAA,IAAGC,QAAH,QAAGA,QAAH;EAAA,IAAaC,QAAb,QAAaA,QAAb;EAAA,IAAuBC,OAAvB,QAAuBA,OAAvB;EAAA,IAAgCC,IAAhC,QAAgCA,IAAhC;EAAA,IAAsCC,KAAtC,QAAsCA,KAAtC;EAAA,IAA6CC,KAA7C,QAA6CA,KAA7C;EAAA,IAAoDC,OAApD,QAAoDA,OAApD;EAAA,IAAgEC,MAAhE;;EAAA,oBACb,6BAAC,qBAAD,eACMA,MADN;IAEE,cAAc,EAAE,KAFlB;IAGE,GAAG,EAAC,KAHN;IAIE,SAAS,EAAE,qBAAOC,oBAAMC,MAAb,EAAqBJ,KAAK,IAAIG,oBAAMH,KAApC,EAA2CH,OAAO,IAAIM,oBAAMN,OAA5D,EAAqED,QAAQ,IAAIO,oBAAMP,QAAvF,CAJb;IAKE,OAAO,EAAE,CAACA,QAAD,IAAaI,KAAb,GAAqBC,OAArB,GAA+BI;EAL1C,IAOGP,IAAI,iBAAI,6BAAC,gBAAD;IAAM,IAAI,EAAEA,IAAZ;IAAkB,SAAS,EAAEK,oBAAML;EAAnC,EAPX,EAQGC,KAAK,iBAAI,6BAAC,gBAAD;IAAM,SAAS,EAAEI,oBAAMJ;EAAvB,GAA+BA,KAA/B,CARZ,EASGJ,QATH,CADa;AAAA,CAAf;;;AAcAD,MAAM,CAACY,WAAP,GAAqB,uBAArB;AAEAZ,MAAM,CAACa,SAAP,GAAmB;EACjBZ,QAAQ,EAAEa,mBAAUC,IADH;EAEjBb,QAAQ,EAAEY,mBAAUE,IAFH;EAGjBb,OAAO,EAAEW,mBAAUE,IAHF;EAIjBZ,IAAI,EAAEU,mBAAUG,MAJC;EAKjBZ,KAAK,EAAES,mBAAUG,MALA;EAMjBX,KAAK,EAAEQ,mBAAUI,SAAV,CAAoB,CAACJ,mBAAUG,MAAX,EAAmBH,mBAAUK,MAA7B,CAApB,EAA0DC,UANhD;EAOjBb,OAAO,EAAEO,mBAAUO;AAPF,CAAnB"}
@@ -35,7 +35,7 @@ var Menu = function Menu(_ref) {
35
35
  Template = _ref$Template === void 0 ? _Menu.Option : _ref$Template,
36
36
  visible = _ref.visible,
37
37
  _ref$onPress = _ref.onPress,
38
- onPress = _ref$onPress === void 0 ? function () {} : _ref$onPress,
38
+ _onPress = _ref$onPress === void 0 ? function () {} : _ref$onPress,
39
39
  others = _objectWithoutProperties(_ref, _excluded);
40
40
 
41
41
  return /*#__PURE__*/_react.default.createElement(_primitives.Layer, _extends({
@@ -49,9 +49,9 @@ var Menu = function Menu(_ref) {
49
49
  return /*#__PURE__*/_react.default.createElement(Template, _extends({}, option, {
50
50
  "data-testid": others['data-testid'] ? "".concat(others['data-testid'], "-").concat(index) : undefined,
51
51
  key: index,
52
- onPress: !option.disabled ? function (event) {
53
- return onPress(option.value, event);
54
- } : undefined
52
+ onPress: function onPress(event) {
53
+ return _onPress(option.value, event);
54
+ }
55
55
  }));
56
56
  })));
57
57
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","names":["Menu","children","options","Template","Option","visible","onPress","others","style","menu","className","map","option","index","undefined","disabled","event","value","displayName","propTypes","PropTypes","node","arrayOf","shape","bool","divider","icon","string","label","oneOfType","number","isRequired","func"],"sources":["../../../src/components/Menu/Menu.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Layer, LayerContent } from '../../primitives';\nimport style from './Menu.module.css';\nimport { Option } from './Menu.Option';\n\nconst Menu = ({ children, options = [], Template = Option, visible, onPress = () => {}, ...others }) => {\n return (\n <Layer\n forceRender={false}\n {...others}\n className={styles(style.menu, visible && style.visible, others.className)}\n visible={visible}\n >\n {children}\n <LayerContent>\n {options.map((option = {}, index) => (\n <Template\n {...option}\n data-testid={others['data-testid'] ? `${others['data-testid']}-${index}` : undefined}\n key={index}\n onPress={!option.disabled ? (event) => onPress(option.value, event) : undefined}\n />\n ))}\n </LayerContent>\n </Layer>\n );\n};\n\nMenu.displayName = 'Component:Menu';\n\nMenu.propTypes = {\n children: PropTypes.node,\n options: PropTypes.arrayOf(\n PropTypes.shape({\n children: PropTypes.node,\n disabled: PropTypes.bool,\n divider: PropTypes.bool,\n icon: PropTypes.string,\n label: PropTypes.string,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n }),\n ),\n Template: PropTypes.node,\n visible: PropTypes.bool,\n onPress: PropTypes.func,\n};\n\nexport { Menu };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,IAAI,GAAG,SAAPA,IAAO,OAA2F;EAAA,IAAxFC,QAAwF,QAAxFA,QAAwF;EAAA,wBAA9EC,OAA8E;EAAA,IAA9EA,OAA8E,6BAApE,EAAoE;EAAA,yBAAhEC,QAAgE;EAAA,IAAhEA,QAAgE,8BAArDC,YAAqD;EAAA,IAA7CC,OAA6C,QAA7CA,OAA6C;EAAA,wBAApC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EAYf5B,QAAQ,EAAEiB,mBAAUC,IAZL;EAafhB,OAAO,EAAEe,mBAAUI,IAbJ;EAcflB,OAAO,EAAEc,mBAAUY;AAdJ,CAAjB"}
1
+ {"version":3,"file":"Menu.js","names":["Menu","children","options","Template","Option","visible","onPress","others","style","menu","className","map","option","index","undefined","event","value","displayName","propTypes","PropTypes","node","arrayOf","shape","disabled","bool","divider","icon","string","label","oneOfType","number","isRequired","func"],"sources":["../../../src/components/Menu/Menu.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Layer, LayerContent } from '../../primitives';\nimport style from './Menu.module.css';\nimport { Option } from './Menu.Option';\n\nconst Menu = ({ children, options = [], Template = Option, visible, onPress = () => {}, ...others }) => {\n return (\n <Layer\n forceRender={false}\n {...others}\n className={styles(style.menu, visible && style.visible, others.className)}\n visible={visible}\n >\n {children}\n <LayerContent>\n {options.map((option = {}, index) => (\n <Template\n {...option}\n data-testid={others['data-testid'] ? `${others['data-testid']}-${index}` : undefined}\n key={index}\n onPress={(event) => onPress(option.value, event)}\n />\n ))}\n </LayerContent>\n </Layer>\n );\n};\n\nMenu.displayName = 'Component:Menu';\n\nMenu.propTypes = {\n children: PropTypes.node,\n options: PropTypes.arrayOf(\n PropTypes.shape({\n children: PropTypes.node,\n disabled: PropTypes.bool,\n divider: PropTypes.bool,\n icon: PropTypes.string,\n label: PropTypes.string,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n }),\n ),\n Template: PropTypes.node,\n visible: PropTypes.bool,\n onPress: PropTypes.func,\n};\n\nexport { Menu };\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,IAAI,GAAG,SAAPA,IAAO,OAA2F;EAAA,IAAxFC,QAAwF,QAAxFA,QAAwF;EAAA,wBAA9EC,OAA8E;EAAA,IAA9EA,OAA8E,6BAApE,EAAoE;EAAA,yBAAh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,mBAAUW,MAA7B,CAApB,EAA0DC;EANnD,CAAhB,CADO,CAFM;EAYf5B,QAAQ,EAAEgB,mBAAUC,IAZL;EAaff,OAAO,EAAEc,mBAAUK,IAbJ;EAcflB,OAAO,EAAEa,mBAAUa;AAdJ,CAAjB"}
@@ -1,11 +1,12 @@
1
1
  :root {
2
2
  --mirai-ui-menu-base: var(--mirai-ui-base);
3
3
  --mirai-ui-menu-border-radius: var(--mirai-ui-border-radius);
4
- --mirai-ui-menu-min-width: 200px;
4
+ --mirai-ui-menu-min-width: 192px;
5
5
  --mirai-ui-menu-shadow: var(--mirai-ui-shadow);
6
- --mirai-ui-menu-option-padding: var(--mirai-ui-space-M);
7
6
  --mirai-ui-menu-option-disabled: var(--mirai-ui-content-border);
8
- --mirai-ui-menu-option-hover: var(--mirai-ui-accent-background);
7
+ --mirai-ui-menu-option-hover-background: var(--mirai-ui-accent);
8
+ --mirai-ui-menu-option-hover-color: var(--mirai-ui-base);
9
+ --mirai-ui-menu-option-padding: var(--mirai-ui-space-M);
9
10
  }
10
11
 
11
12
  .menu {
@@ -17,17 +18,28 @@
17
18
  }
18
19
 
19
20
  .menu .option {
21
+ align-items: center;
20
22
  box-sizing: border-box;
21
23
  display: flex;
24
+ cursor: default;
25
+ flex: 1;
22
26
  flex-direction: row;
23
27
  padding: var(--mirai-ui-menu-option-padding);
24
- align-items: center;
25
- flex: 1;
26
28
  width: 100%;
27
29
  }
28
30
 
29
- .menu .option:hover:not(.disabled) {
30
- background-color: var(--mirai-ui-menu-option-hover);
31
+ .menu .option.value:hover:not(.disabled) {
32
+ background-color: var(--mirai-ui-menu-option-hover-background);
33
+ }
34
+
35
+ .menu .option.value:hover:not(.disabled) .icon,
36
+ .menu .option.value:hover:not(.disabled) .label {
37
+ color: var(--mirai-ui-menu-option-hover-color);
38
+ cursor: pointer;
39
+ }
40
+
41
+ .menu .divider {
42
+ box-shadow: inset 0 -1px var(--mirai-ui-menu-option-disabled);
31
43
  }
32
44
 
33
45
  .menu .icon {
@@ -38,13 +50,13 @@
38
50
  flex: 1;
39
51
  text-align: left;
40
52
  padding-right: var(--mirai-ui-menu-option-padding);
53
+ overflow: hidden;
54
+ text-overflow: ellipsis;
55
+ white-space: nowrap;
41
56
  }
42
57
 
43
- .menu .divider {
44
- box-shadow: inset 0 -1px var(--mirai-ui-menu-option-disabled);
45
- }
46
-
47
- .menu .disabled {
58
+ .menu .option.disabled .icon,
59
+ .menu .option.disabled .label {
48
60
  color: var(--mirai-ui-menu-option-disabled);
49
61
  cursor: default;
50
62
  }
@@ -58,8 +58,16 @@ exports[`component:<Menu> w/ options & visible 1`] = `
58
58
  style="left: 0px; top: 0px;"
59
59
  >
60
60
  <div
61
- class="pressable option"
62
- value="one"
61
+ class="pressable option divider"
62
+ >
63
+ <span
64
+ class="text paragraph label"
65
+ >
66
+ Lorem Ipsum...
67
+ </span>
68
+ </div>
69
+ <div
70
+ class="pressable option value"
63
71
  >
64
72
  <span
65
73
  class="icon icon"
@@ -96,11 +104,10 @@ exports[`component:<Menu> w/ options & visible 1`] = `
96
104
  </span>
97
105
  </div>
98
106
  <div
99
- class="pressable option disabled"
100
- value="two"
107
+ class="pressable option value disabled"
101
108
  >
102
109
  <span
103
- class="icon icon disabled"
110
+ class="icon icon"
104
111
  >
105
112
  <svg
106
113
  fill="none"
@@ -128,14 +135,13 @@ exports[`component:<Menu> w/ options & visible 1`] = `
128
135
  </svg>
129
136
  </span>
130
137
  <span
131
- class="text paragraph label disabled"
138
+ class="text paragraph label"
132
139
  >
133
140
  Item 2
134
141
  </span>
135
142
  </div>
136
143
  <div
137
- class="pressable option divider"
138
- value="three"
144
+ class="pressable option value divider"
139
145
  >
140
146
  <span
141
147
  class="icon icon"
@@ -147,8 +153,7 @@ exports[`component:<Menu> w/ options & visible 1`] = `
147
153
  </span>
148
154
  </div>
149
155
  <div
150
- class="pressable option"
151
- value="four"
156
+ class="pressable option value"
152
157
  >
153
158
  <span
154
159
  class="text paragraph label"
@@ -161,6 +166,15 @@ exports[`component:<Menu> w/ options & visible 1`] = `
161
166
  Add
162
167
  </button>
163
168
  </div>
169
+ <div
170
+ class="pressable option"
171
+ >
172
+ <button
173
+ class="pressable button"
174
+ >
175
+ Add
176
+ </button>
177
+ </div>
164
178
  </div>
165
179
  </DocumentFragment>
166
180
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/ui",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "repository": "git@gitlab.com:miraicorp/dev/frontend/ui.git",
5
5
  "author": "JΛVI <hello@soyjavi.com>",
6
6
  "license": "MIT",