@mirai/ui 1.0.10 → 1.0.11

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.
Files changed (35) hide show
  1. package/README.md +79 -16
  2. package/build/components/InputSelect/InputSelect.js +1 -1
  3. package/build/components/InputSelect/InputSelect.js.map +1 -1
  4. package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +46 -46
  5. package/build/components/InputText/InputText.module.css +2 -1
  6. package/build/components/Menu/Menu.Option.js +42 -0
  7. package/build/components/Menu/Menu.Option.js.map +1 -0
  8. package/build/components/Menu/Menu.js +52 -0
  9. package/build/components/Menu/Menu.js.map +1 -0
  10. package/build/components/Menu/Menu.module.css +50 -0
  11. package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +178 -0
  12. package/build/components/Menu/index.js +19 -0
  13. package/build/components/Menu/index.js.map +1 -0
  14. package/build/components/Tooltip/Tooltip.js +65 -0
  15. package/build/components/Tooltip/Tooltip.js.map +1 -0
  16. package/build/components/Tooltip/Tooltip.module.css +26 -0
  17. package/build/components/Tooltip/__tests__/__snapshots__/Tooltip.test.jsx.snap +117 -0
  18. package/build/components/Tooltip/index.js +19 -0
  19. package/build/components/Tooltip/index.js.map +1 -0
  20. package/build/components/index.js +26 -0
  21. package/build/components/index.js.map +1 -1
  22. package/build/primitives/Icon/Icon.constants.js +1 -0
  23. package/build/primitives/Icon/Icon.constants.js.map +1 -1
  24. package/build/primitives/Layer/Layer.js +32 -34
  25. package/build/primitives/Layer/Layer.js.map +1 -1
  26. package/build/primitives/Layer/Layer.module.css +1 -1
  27. package/build/primitives/Layer/LayerContent.js +1 -1
  28. package/build/primitives/Layer/LayerContent.js.map +1 -1
  29. package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +51 -17
  30. package/build/primitives/Layer/helpers/getLayerPosition.js +2 -0
  31. package/build/primitives/Layer/helpers/getLayerPosition.js.map +1 -1
  32. package/build/primitives/Select/Select.js +1 -1
  33. package/build/primitives/Select/Select.js.map +1 -1
  34. package/build/primitives/Select/__tests__/__snapshots__/Select.test.js.snap +25 -25
  35. package/package.json +1 -1
package/README.md CHANGED
@@ -21,7 +21,7 @@ This primitive returns a checkbox button based on the following properties:
21
21
  - `name:string` input name
22
22
  - `onChange:function` executed when input value changes
23
23
 
24
- ```js
24
+ ```jsx
25
25
  import { Checkbox, View } from '@mirai/ui';
26
26
 
27
27
  const MyComponent = () => (
@@ -40,7 +40,7 @@ const MyComponent = () => (
40
40
 
41
41
  This primitive returns a span with an icon based on a mandatory string prop `name` with one of the following possible values: Left, Right, Up, Down, Close, CloseArrow, Plus, Minus, EyeOpen, EyeClose.
42
42
 
43
- ```js
43
+ ```jsx
44
44
  import { Icon, View } from '@mirai/ui';
45
45
 
46
46
  const MyComponent = () => (
@@ -63,7 +63,7 @@ This primitive returns an input or a textarea based on the following props:
63
63
  - `onError:function` executed once an error event fires
64
64
  - `onLeave:function` executed on click outside the input
65
65
 
66
- ```js
66
+ ```jsx
67
67
  import { Input, View } from '@mirai/ui';
68
68
 
69
69
  const MyComponent = () => (
@@ -90,7 +90,7 @@ This primitive returns an element that displays with relative position to other
90
90
 
91
91
  The position of the layer is based on the position of the element to be displayed. If the layer can show on right or left because have a gap in this direction, the layer will be shown on the right or left of the element to be displayed. If the layer can open on top or bottom because have a gap in this direction, the layer will be shown on the top or bottom of the element to be displayed
92
92
 
93
- ```js
93
+ ```jsx
94
94
  import { Button, Calendar, Layer, LayerContent } from '@mirai/ui';
95
95
 
96
96
  const MyComponent = () => {
@@ -120,7 +120,7 @@ This primitive returns pressable elements based on the following properties:
120
120
  - `onLeave:function` executed once the user hovers away
121
121
  - `onPress:function` executed on mouse click on the element
122
122
 
123
- ```js
123
+ ```jsx
124
124
  import { Icon, Pressable, View } from '@mirai/ui';
125
125
 
126
126
  const MyComponent = () => (
@@ -141,7 +141,7 @@ This primitive returns a radio button based on the following properties:
141
141
  - `name:string` input name
142
142
  - `onChange:function` executed when input value changes
143
143
 
144
- ```js
144
+ ```jsx
145
145
  import { Radio, View } from '@mirai/ui';
146
146
 
147
147
  const MyComponent = () => (
@@ -171,7 +171,7 @@ This primitive is used to make vertically scrollable views and receives the foll
171
171
  - `width:number` width value
172
172
  - `onscroll:function` executed when user scrolls over the element
173
173
 
174
- ```js
174
+ ```jsx
175
175
  import { ScrollView, View } from '@mirai/ui';
176
176
 
177
177
  const MyComponent = ({ isDesktop }) => (
@@ -194,7 +194,7 @@ A primitive for displaying text. It receives the following props:
194
194
  - `small:boolean` modifying font-size
195
195
  - `tag:string` html tag of resulting element
196
196
 
197
- ```js
197
+ ```jsx
198
198
  import { Text, View } from '@mirai/ui';
199
199
 
200
200
  const MyComponent = ({ headerText }) => (
@@ -215,7 +215,7 @@ This primitive works as a container for displaying layout. It receives the follo
215
215
  - `row:boolean` sets flex-direction as 'row' if true
216
216
  - `tag:string` html tag of resulting element
217
217
 
218
- ```js
218
+ ```jsx
219
219
  import { Text, View } from '@mirai/ui';
220
220
 
221
221
  const MyComponent = ({ headerText }) => (
@@ -246,7 +246,7 @@ A button component that receives the following props:
246
246
  - `onLeave:function` executed when the user hovers away
247
247
  - `onPress:function` executed on mouse click on the element
248
248
 
249
- ```js
249
+ ```jsx
250
250
  import { Button } from '@mirai/ui';
251
251
 
252
252
  const MyComponent = (props) => {
@@ -281,7 +281,7 @@ A calendar component that receives the following props:
281
281
  - `onChange:function` executed when input value changes
282
282
  - `onFocus:function` executed on calendar cell hover
283
283
 
284
- ```js
284
+ ```jsx
285
285
  import { Calendar } from '@mirai/ui';
286
286
 
287
287
  const MyComponent = props => {
@@ -320,7 +320,7 @@ Input number component controlling the value with 2 buttons. Receives the follow
320
320
  - `value:number` input value
321
321
  - `onChange:function` executed when input value changes
322
322
 
323
- ```js
323
+ ```jsx
324
324
  import { InputNumber } from '@mirai/ui';
325
325
 
326
326
  const MyComponent = (props) => {
@@ -343,7 +343,7 @@ This component is used to display a radio button or checkbox base on a mandatory
343
343
  - `value:number` input value
344
344
  - `onChange:function` executed when input value changes
345
345
 
346
- ```js
346
+ ```jsx
347
347
  import { InputOption, View } from '@mirai/ui';
348
348
 
349
349
  const MyComponent = () => {
@@ -399,7 +399,7 @@ Text input component receiving the following props:
399
399
  - `onEnter:function` executed when user clicks on input
400
400
  - `onLeave:function` executed on click outside the input
401
401
 
402
- ```js
402
+ ```jsx
403
403
  import { InputText } from '@mirai/ui';
404
404
 
405
405
  const MyComponent = (props) => {
@@ -419,6 +419,48 @@ const MyComponent = (props) => {
419
419
  };
420
420
  ```
421
421
 
422
+ ### Menu
423
+
424
+ This component helps you to create a menu over a determinate component receiving the following props:
425
+
426
+ - `children:node` The element which we will use as reference for display the menu.
427
+ - `options:arrayOf(Option:shape)`
428
+ - `Template:node` if you don't want use the default option scaffold.
429
+ - `visible:boolean` showing or hiding the menu
430
+ - `onPress:func` callback when we click on a determinate _option_.
431
+
432
+ Before learning how to instantiate `<Menu>` let's look at the properties of our _shape_ `Option`:
433
+
434
+ - `children:node` If you wanna add a component in the right side of your option.
435
+ - `disabled:boolean` disables the option
436
+ - `divider:boolean` if you wanna show a divider in the bottom of the option
437
+ - `icon:string` If you want instantiate a primitive `<Icon>`
438
+ - `label:string` label of the option
439
+ - `value:string|number` this property will dispatch as identificator in the callback `onPress:func`
440
+
441
+ ```jsx
442
+ import { Button, Icon, Menu } from '@mirai/ui';
443
+
444
+ const MyComponent = () => {
445
+ const [visible, setVisible] = useState(false);
446
+
447
+ <Menu
448
+ options={[
449
+ { icon: 'EyeOpen', label: 'Show results', value: 1 },
450
+ { icon: 'Plus', label: 'Add item', disabled: true, value: 2 },
451
+ { icon: 'Minus', label: 'Subtract item', divider: true, value: 'three' },
452
+ { label: 'Using child', children: <Button small>Add</Button>, value: 'four' },
453
+ ]}
454
+ visible={visible}
455
+ onPress={(value, event) => console.log('<Menu>::onPress', value, event)}
456
+ >
457
+ <Button squared outlined onPress={() => setVisible(!visible)}>
458
+ <Icon name="Plus" />
459
+ </Button>
460
+ </Menu>;
461
+ };
462
+ ```
463
+
422
464
  ### Modal
423
465
 
424
466
  A modal component receiving the following props:
@@ -427,7 +469,7 @@ A modal component receiving the following props:
427
469
  - `visible:boolean` if true modal is shown
428
470
  - `onClose:function` executed once modal close button is clicked
429
471
 
430
- ```js
472
+ ```jsx
431
473
  import { Modal, View } from '@mirai/ui';
432
474
 
433
475
  const MyComponent = (props) => {
@@ -441,6 +483,27 @@ const MyComponent = (props) => {
441
483
  };
442
484
  ```
443
485
 
486
+ ### Tooltip
487
+
488
+ This component helps you to create a tooltip over a determinate component receiving the following props:
489
+
490
+ - `children:node` The element which we will use as reference for display the menu.
491
+ - `Template:node` if you don't want use the default scaffold.
492
+ - `text:string` text it will appears when hover on `children`
493
+ - `visible:boolean` the default state of visibility of the instance.
494
+
495
+ ```jsx
496
+ import { Text, Tooltip } from '@mirai/ui';
497
+
498
+ const MyComponent = () => {
499
+ const [visible, setVisible] = useState(false);
500
+
501
+ <Tooltip text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. ">
502
+ <Text bold>hover me</Text>
503
+ </Tooltip>;
504
+ };
505
+ ```
506
+
444
507
  ## Theme
445
508
 
446
509
  Styles can be customised by using Theme utility.
@@ -453,7 +516,7 @@ This method returns current theme settings (variables with values). This method
453
516
 
454
517
  This method sets a value of the variable passed as a parameter.
455
518
 
456
- ```js
519
+ ```jsx
457
520
  import { Button, Text, Theme } from '../../src';
458
521
 
459
522
  export default () => {
@@ -74,7 +74,7 @@ var InputSelect = function InputSelect(_ref) {
74
74
  }, /*#__PURE__*/_react.default.createElement(_primitives.Select, Object.assign({}, others, {
75
75
  disabled: disabled,
76
76
  value: others.value || '',
77
- className: (0, _helpers.styles)(_InputTextModule.default.input, _InputTextModule.default.iconRight, !(focus || error || has.value) && _InputTextModule.default.empty),
77
+ className: (0, _helpers.styles)(_InputTextModule.default.input, _InputTextModule.default.iconRight, !!label && !(focus || error || has.value) && _InputTextModule.default.empty),
78
78
  style: undefined,
79
79
  onChange: handleChange,
80
80
  onEnter: handleEnter,
@@ -1 +1 @@
1
- {"version":3,"file":"InputSelect.js","names":["InputSelect","disabled","error","hint","label","onChange","onEnter","onLeave","others","focus","setFocus","handleChange","value","event","target","blur","handleEnter","handleLeave","has","undefined","length","style","inputContainer","className","text","inputBorder","input","iconRight","empty","icon","right","displayName"],"sources":["../../../src/components/InputSelect/InputSelect.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Select, Text, View } from '../../primitives';\nimport style from '../InputText/InputText.module.css';\n\nconst InputSelect = ({\n disabled,\n error,\n hint,\n label,\n onChange = () => {},\n onEnter = () => {},\n onLeave = () => {},\n ...others\n}) => {\n const [focus, setFocus] = useState(false);\n\n const handleChange = (value, event) => {\n onChange(value, event);\n event.target?.blur();\n };\n\n const handleEnter = (event) => {\n setFocus(true);\n onEnter(event);\n };\n\n const handleLeave = (event) => {\n setFocus(false);\n onLeave(event);\n };\n\n const has = {\n value: others.value !== undefined && others.value?.length > 0,\n };\n\n return (\n <View className={styles(style.inputContainer, others.className)} style={others.style}>\n {label && (\n <Text\n className={styles(\n style.text,\n style.label,\n disabled && style.disabled,\n error && style.error,\n focus && style.focus,\n (focus || error || has.value) && style.value,\n )}\n >\n {label}\n </Text>\n )}\n\n <View\n row\n className={styles(\n style.inputBorder,\n disabled && style.disabled,\n focus && !error && style.focus,\n error && style.error,\n )}\n >\n <Select\n {...others}\n disabled={disabled}\n value={others.value || ''}\n className={styles(style.input, style.iconRight, !(focus || error || has.value) && style.empty)}\n style={undefined}\n onChange={handleChange}\n onEnter={handleEnter}\n onLeave={handleLeave}\n />\n {!disabled && <Icon name=\"CloseArrow\" className={[style.icon, style.right]} />}\n </View>\n\n {hint && (\n <Text small className={styles(style.text, style.hint, disabled && style.disabled, error && style.error)}>\n {hint}\n </Text>\n )}\n </View>\n );\n};\n\nInputSelect.displayName = 'Component:InputSelect';\n\nInputSelect.propTypes = {\n disabled: PropTypes.bool,\n error: PropTypes.bool,\n hint: PropTypes.string,\n label: PropTypes.string,\n name: PropTypes.string.isRequired,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { InputSelect };\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;;;AAEA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OASd;EAAA;;EAAA,IARJC,QAQI,QARJA,QAQI;EAAA,IAPJC,KAOI,QAPJA,KAOI;EAAA,IANJC,IAMI,QANJA,IAMI;EAAA,IALJC,KAKI,QALJA,KAKI;EAAA,yBAJJC,QAII;EAAA,IAJJA,QAII,8BAJO,YAAM,CAAE,CAIf;EAAA,wBAHJC,OAGI;EAAA,IAHJA,OAGI,6BAHM,YAAM,CAAE,CAGd;EAAA,wBAFJC,OAEI;EAAA,IAFJA,OAEI,6BAFM,YAAM,CAAE,CAEd;EAAA,IADDC,MACC;;EACJ,gBAA0B,qBAAS,KAAT,CAA1B;EAAA;EAAA,IAAOC,KAAP;EAAA,IAAcC,QAAd;;EAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAQC,KAAR,EAAkB;IAAA;;IACrCR,QAAQ,CAACO,KAAD,EAAQC,KAAR,CAAR;IACA,iBAAAA,KAAK,CAACC,MAAN,gEAAcC,IAAd;EACD,CAHD;;EAKA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACH,KAAD,EAAW;IAC7BH,QAAQ,CAAC,IAAD,CAAR;IACAJ,OAAO,CAACO,KAAD,CAAP;EACD,CAHD;;EAKA,IAAMI,WAAW,GAAG,SAAdA,WAAc,CAACJ,KAAD,EAAW;IAC7BH,QAAQ,CAAC,KAAD,CAAR;IACAH,OAAO,CAACM,KAAD,CAAP;EACD,CAHD;;EAKA,IAAMK,GAAG,GAAG;IACVN,KAAK,EAAEJ,MAAM,CAACI,KAAP,KAAiBO,SAAjB,IAA8B,kBAAAX,MAAM,CAACI,KAAP,g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sCG3B,IAAI,iBACH,6BAAC,gBAAD;IAAM,KAAK,MAAX;IAAY,SAAS,EAAE,qBAAOkB,yBAAMG,IAAb,EAAmBH,yBAAMlB,IAAzB,EAA+BF,QAAQ,IAAIoB,yBAAMpB,QAAjD,EAA2DC,KAAK,IAAImB,yBAAMnB,KAA1E;EAAvB,GACGC,IADH,CAvCJ,CADF;AA8CD,CA7ED;;;AA+EAH,WAAW,CAAC+B,WAAZ,GAA0B,uBAA1B"}
1
+ {"version":3,"file":"InputSelect.js","names":["InputSelect","disabled","error","hint","label","onChange","onEnter","onLeave","others","focus","setFocus","handleChange","value","event","target","blur","handleEnter","handleLeave","has","undefined","length","style","inputContainer","className","text","inputBorder","input","iconRight","empty","icon","right","displayName"],"sources":["../../../src/components/InputSelect/InputSelect.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Select, Text, View } from '../../primitives';\nimport style from '../InputText/InputText.module.css';\n\nconst InputSelect = ({\n disabled,\n error,\n hint,\n label,\n onChange = () => {},\n onEnter = () => {},\n onLeave = () => {},\n ...others\n}) => {\n const [focus, setFocus] = useState(false);\n\n const handleChange = (value, event) => {\n onChange(value, event);\n event.target?.blur();\n };\n\n const handleEnter = (event) => {\n setFocus(true);\n onEnter(event);\n };\n\n const handleLeave = (event) => {\n setFocus(false);\n onLeave(event);\n };\n\n const has = {\n value: others.value !== undefined && others.value?.length > 0,\n };\n\n return (\n <View className={styles(style.inputContainer, others.className)} style={others.style}>\n {label && (\n <Text\n className={styles(\n style.text,\n style.label,\n disabled && style.disabled,\n error && style.error,\n focus && style.focus,\n (focus || error || has.value) && style.value,\n )}\n >\n {label}\n </Text>\n )}\n\n <View\n row\n className={styles(\n style.inputBorder,\n disabled && style.disabled,\n focus && !error && style.focus,\n error && style.error,\n )}\n >\n <Select\n {...others}\n disabled={disabled}\n value={others.value || ''}\n className={styles(style.input, style.iconRight, !!label && !(focus || error || has.value) && style.empty)}\n style={undefined}\n onChange={handleChange}\n onEnter={handleEnter}\n onLeave={handleLeave}\n />\n {!disabled && <Icon name=\"CloseArrow\" className={[style.icon, style.right]} />}\n </View>\n\n {hint && (\n <Text small className={styles(style.text, style.hint, disabled && style.disabled, error && style.error)}>\n {hint}\n </Text>\n )}\n </View>\n );\n};\n\nInputSelect.displayName = 'Component:InputSelect';\n\nInputSelect.propTypes = {\n disabled: PropTypes.bool,\n error: PropTypes.bool,\n hint: PropTypes.string,\n label: PropTypes.string,\n name: PropTypes.string.isRequired,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { InputSelect };\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;;;AAEA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OASd;EAAA;;EAAA,IARJC,QAQI,QARJA,QAQI;EAAA,IAPJC,KAOI,QAPJA,KAOI;EAAA,IANJC,IAMI,QANJA,IAMI;EAAA,IALJC,KAKI,QALJA,KAKI;EAAA,yBAJJC,QAII;EAAA,IAJJA,QAII,8BAJO,YAAM,CAAE,CAIf;EAAA,wBAHJC,OAGI;EAAA,IAHJA,OAGI,6BAHM,YAAM,CAAE,CAGd;EAAA,wBAFJC,OAEI;EAAA,IAFJA,OAEI,6BAFM,YAAM,CAAE,CAEd;EAAA,IADDC,MACC;;EACJ,gBAA0B,qBAAS,KAAT,CAA1B;EAAA;EAAA,IAAOC,KAAP;EAAA,IAAcC,QAAd;;EAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAQC,KAAR,EAAkB;IAAA;;IACrCR,QAAQ,CAACO,KAAD,EAAQC,KAAR,CAAR;IACA,iBAAAA,KAAK,CAACC,MAAN,gEAAcC,IAAd;EACD,CAHD;;EAKA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACH,KAAD,EAAW;IAC7BH,QAAQ,CAAC,IAAD,CAAR;IACAJ,OAAO,CAACO,KAAD,CAAP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AAX,IAA6CS,yBAAMO,KAAxF,CAJb;IAKE,KAAK,EAAET,SALT;IAME,QAAQ,EAAER,YANZ;IAOE,OAAO,EAAEK,WAPX;IAQE,OAAO,EAAEC;EARX,GATF,EAmBG,CAAChB,QAAD,iBAAa,6BAAC,gBAAD;IAAM,IAAI,EAAC,YAAX;IAAwB,SAAS,EAAE,CAACoB,yBAAMQ,IAAP,EAAaR,yBAAMS,KAAnB;EAAnC,EAnBhB,CAhBF,EAsCG3B,IAAI,iBACH,6BAAC,gBAAD;IAAM,KAAK,MAAX;IAAY,SAAS,EAAE,qBAAOkB,yBAAMG,IAAb,EAAmBH,yBAAMlB,IAAzB,EAA+BF,QAAQ,IAAIoB,yBAAMpB,QAAjD,EAA2DC,KAAK,IAAImB,yBAAMnB,KAA1E;EAAvB,GACGC,IADH,CAvCJ,CADF;AA8CD,CA7ED;;;AA+EAH,WAAW,CAAC+B,WAAZ,GAA0B,uBAA1B"}
@@ -9,31 +9,31 @@ exports[`component:<InputSelect> inherit:className 1`] = `
9
9
  class="view row inputBorder"
10
10
  >
11
11
  <select
12
- class="select empty input iconRight empty"
12
+ class="select empty input iconRight"
13
13
  name="name"
14
14
  >
15
15
  <option
16
- svalue="one"
16
+ value="one"
17
17
  >
18
18
  one
19
19
  </option>
20
20
  <option
21
- svalue="two"
21
+ value="two"
22
22
  >
23
23
  two
24
24
  </option>
25
25
  <option
26
- svalue="three"
26
+ value="three"
27
27
  >
28
28
  three
29
29
  </option>
30
30
  <option
31
- svalue="four"
31
+ value="four"
32
32
  >
33
33
  four
34
34
  </option>
35
35
  <option
36
- svalue="five"
36
+ value="five"
37
37
  >
38
38
  five
39
39
  </option>
@@ -71,32 +71,32 @@ exports[`component:<InputSelect> prop:disabled 1`] = `
71
71
  class="view row inputBorder disabled"
72
72
  >
73
73
  <select
74
- class="select empty input iconRight empty"
74
+ class="select empty input iconRight"
75
75
  disabled=""
76
76
  name="name"
77
77
  >
78
78
  <option
79
- svalue="one"
79
+ value="one"
80
80
  >
81
81
  one
82
82
  </option>
83
83
  <option
84
- svalue="two"
84
+ value="two"
85
85
  >
86
86
  two
87
87
  </option>
88
88
  <option
89
- svalue="three"
89
+ value="three"
90
90
  >
91
91
  three
92
92
  </option>
93
93
  <option
94
- svalue="four"
94
+ value="four"
95
95
  >
96
96
  four
97
97
  </option>
98
98
  <option
99
- svalue="five"
99
+ value="five"
100
100
  >
101
101
  five
102
102
  </option>
@@ -115,31 +115,31 @@ exports[`component:<InputSelect> prop:error 1`] = `
115
115
  class="view row inputBorder"
116
116
  >
117
117
  <select
118
- class="select empty input iconRight empty"
118
+ class="select empty input iconRight"
119
119
  name="name"
120
120
  >
121
121
  <option
122
- svalue="one"
122
+ value="one"
123
123
  >
124
124
  one
125
125
  </option>
126
126
  <option
127
- svalue="two"
127
+ value="two"
128
128
  >
129
129
  two
130
130
  </option>
131
131
  <option
132
- svalue="three"
132
+ value="three"
133
133
  >
134
134
  three
135
135
  </option>
136
136
  <option
137
- svalue="four"
137
+ value="four"
138
138
  >
139
139
  four
140
140
  </option>
141
141
  <option
142
- svalue="five"
142
+ value="five"
143
143
  >
144
144
  five
145
145
  </option>
@@ -177,31 +177,31 @@ exports[`component:<InputSelect> prop:hint 1`] = `
177
177
  class="view row inputBorder"
178
178
  >
179
179
  <select
180
- class="select empty input iconRight empty"
180
+ class="select empty input iconRight"
181
181
  name="name"
182
182
  >
183
183
  <option
184
- svalue="one"
184
+ value="one"
185
185
  >
186
186
  one
187
187
  </option>
188
188
  <option
189
- svalue="two"
189
+ value="two"
190
190
  >
191
191
  two
192
192
  </option>
193
193
  <option
194
- svalue="three"
194
+ value="three"
195
195
  >
196
196
  three
197
197
  </option>
198
198
  <option
199
- svalue="four"
199
+ value="four"
200
200
  >
201
201
  four
202
202
  </option>
203
203
  <option
204
- svalue="five"
204
+ value="five"
205
205
  >
206
206
  five
207
207
  </option>
@@ -253,27 +253,27 @@ exports[`component:<InputSelect> prop:label 1`] = `
253
253
  name="name"
254
254
  >
255
255
  <option
256
- svalue="one"
256
+ value="one"
257
257
  >
258
258
  one
259
259
  </option>
260
260
  <option
261
- svalue="two"
261
+ value="two"
262
262
  >
263
263
  two
264
264
  </option>
265
265
  <option
266
- svalue="three"
266
+ value="three"
267
267
  >
268
268
  three
269
269
  </option>
270
270
  <option
271
- svalue="four"
271
+ value="four"
272
272
  >
273
273
  four
274
274
  </option>
275
275
  <option
276
- svalue="five"
276
+ value="five"
277
277
  >
278
278
  five
279
279
  </option>
@@ -315,27 +315,27 @@ exports[`component:<InputSelect> prop:label 2`] = `
315
315
  name="name"
316
316
  >
317
317
  <option
318
- svalue="one"
318
+ value="one"
319
319
  >
320
320
  one
321
321
  </option>
322
322
  <option
323
- svalue="two"
323
+ value="two"
324
324
  >
325
325
  two
326
326
  </option>
327
327
  <option
328
- svalue="three"
328
+ value="three"
329
329
  >
330
330
  three
331
331
  </option>
332
332
  <option
333
- svalue="four"
333
+ value="four"
334
334
  >
335
335
  four
336
336
  </option>
337
337
  <option
338
- svalue="five"
338
+ value="five"
339
339
  >
340
340
  five
341
341
  </option>
@@ -373,31 +373,31 @@ exports[`component:<InputSelect> renders 1`] = `
373
373
  class="view row inputBorder"
374
374
  >
375
375
  <select
376
- class="select empty input iconRight empty"
376
+ class="select empty input iconRight"
377
377
  name="name"
378
378
  >
379
379
  <option
380
- svalue="one"
380
+ value="one"
381
381
  >
382
382
  one
383
383
  </option>
384
384
  <option
385
- svalue="two"
385
+ value="two"
386
386
  >
387
387
  two
388
388
  </option>
389
389
  <option
390
- svalue="three"
390
+ value="three"
391
391
  >
392
392
  three
393
393
  </option>
394
394
  <option
395
- svalue="four"
395
+ value="four"
396
396
  >
397
397
  four
398
398
  </option>
399
399
  <option
400
- svalue="five"
400
+ value="five"
401
401
  >
402
402
  five
403
403
  </option>
@@ -435,32 +435,32 @@ exports[`component:<InputSelect> testID 1`] = `
435
435
  class="view row inputBorder"
436
436
  >
437
437
  <select
438
- class="select empty input iconRight empty"
438
+ class="select empty input iconRight"
439
439
  data-testid="mirai"
440
440
  name="name"
441
441
  >
442
442
  <option
443
- svalue="one"
443
+ value="one"
444
444
  >
445
445
  one
446
446
  </option>
447
447
  <option
448
- svalue="two"
448
+ value="two"
449
449
  >
450
450
  two
451
451
  </option>
452
452
  <option
453
- svalue="three"
453
+ value="three"
454
454
  >
455
455
  three
456
456
  </option>
457
457
  <option
458
- svalue="four"
458
+ value="four"
459
459
  >
460
460
  four
461
461
  </option>
462
462
  <option
463
- svalue="five"
463
+ value="five"
464
464
  >
465
465
  five
466
466
  </option>
@@ -80,7 +80,8 @@
80
80
  pointer-events: none;
81
81
  position: absolute;
82
82
  top: var(--mirai-ui-input-text-padding-y);
83
- transition: all var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
83
+ transition: font-size var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
84
+ top var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
84
85
  z-index: 1;
85
86
  }
86
87
 
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Option = void 0;
9
+
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _helpers = require("../../helpers");
15
+
16
+ var _primitives = require("../../primitives");
17
+
18
+ var _MenuModule = _interopRequireDefault(require("./Menu.module.css"));
19
+
20
+ var _excluded = ["children", "disabled", "divider", "icon", "label"];
21
+
22
+ var Option = function Option(_ref) {
23
+ var children = _ref.children,
24
+ disabled = _ref.disabled,
25
+ divider = _ref.divider,
26
+ icon = _ref.icon,
27
+ label = _ref.label,
28
+ others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
29
+ return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, Object.assign({}, others, {
30
+ tag: "div",
31
+ className: (0, _helpers.styles)(_MenuModule.default.option, divider && _MenuModule.default.divider, disabled && _MenuModule.default.disabled)
32
+ }), icon && /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
33
+ name: icon,
34
+ className: (0, _helpers.styles)(_MenuModule.default.icon, disabled && _MenuModule.default.disabled)
35
+ }), /*#__PURE__*/_react.default.createElement(_primitives.Text, {
36
+ className: (0, _helpers.styles)(_MenuModule.default.label, disabled && _MenuModule.default.disabled)
37
+ }, label), children);
38
+ };
39
+
40
+ exports.Option = Option;
41
+ Option.displayName = 'Component:Menu:Option';
42
+ //# sourceMappingURL=Menu.Option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.Option.js","names":["Option","children","disabled","divider","icon","label","others","style","option","displayName"],"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":";;;;;;;;;;;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,oBACMA,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"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Menu = void 0;
9
+
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _helpers = require("../../helpers");
15
+
16
+ var _primitives = require("../../primitives");
17
+
18
+ var _MenuModule = _interopRequireDefault(require("./Menu.module.css"));
19
+
20
+ var _Menu = require("./Menu.Option");
21
+
22
+ var _excluded = ["children", "options", "Template", "visible", "onPress"];
23
+
24
+ var Menu = function Menu(_ref) {
25
+ var children = _ref.children,
26
+ _ref$options = _ref.options,
27
+ options = _ref$options === void 0 ? [] : _ref$options,
28
+ _ref$Template = _ref.Template,
29
+ Template = _ref$Template === void 0 ? _Menu.Option : _ref$Template,
30
+ visible = _ref.visible,
31
+ _ref$onPress = _ref.onPress,
32
+ onPress = _ref$onPress === void 0 ? function () {} : _ref$onPress,
33
+ others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
34
+ return /*#__PURE__*/_react.default.createElement(_primitives.Layer, Object.assign({}, others, {
35
+ className: (0, _helpers.styles)(_MenuModule.default.menu, visible && _MenuModule.default.visible, others.className),
36
+ visible: visible
37
+ }), children, /*#__PURE__*/_react.default.createElement(_primitives.LayerContent, null, options.map(function () {
38
+ var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
39
+ var index = arguments.length > 1 ? arguments[1] : undefined;
40
+ return /*#__PURE__*/_react.default.createElement(Template, Object.assign({}, option, {
41
+ "data-testid": others['data-testid'] ? "".concat(others['data-testid'], "-").concat(index) : undefined,
42
+ key: index,
43
+ onPress: !option.disabled ? function (event) {
44
+ return onPress(option.value, event);
45
+ } : undefined
46
+ }));
47
+ })));
48
+ };
49
+
50
+ exports.Menu = Menu;
51
+ Menu.displayName = 'Component:Menu';
52
+ //# sourceMappingURL=Menu.js.map
@@ -0,0 +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"],"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 {...others} className={styles(style.menu, visible && style.visible, others.className)} visible={visible}>\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":";;;;;;;;;;;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,wBAApCC,OAAoC;EAAA,IAApCA,OAAoC,6BAA1B,YAAM,CAAE,CAAkB;EAAA,IAAbC,MAAa;EACtG,oBACE,6BAAC,iBAAD,oBAAWA,MAAX;IAAmB,SAAS,EAAE,qBAAOC,oBAAMC,IAAb,EAAmBJ,OAAO,IAAIG,oBAAMH,OAApC,EAA6CE,MAAM,CAACG,SAApD,CAA9B;IAA8F,OAAO,EAAEL;EAAvG,IACGJ,QADH,eAEE,6BAAC,wBAAD,QACGC,OAAO,CAACS,GAAR,CAAY;IAAA,IAACC,MAAD,uEAAU,EAAV;IAAA,IAAcC,KAAd;IAAA,oBACX,6BAAC,QAAD,oBACMD,MADN;MAEE,eAAaL,MAAM,CAAC,aAAD,CAAN,aAA2BA,MAAM,CAAC,aAAD,CAAjC,cAAoDM,KAApD,IAA8DC,SAF7E;MAGE,GAAG,EAAED,KAHP;MAIE,OAAO,EAAE,CAACD,MAAM,CAACG,QAAR,GAAmB,UAACC,KAAD;QAAA,OAAWV,OAAO,CAACM,MAAM,CAACK,KAAR,EAAeD,KAAf,CAAlB;MAAA,CAAnB,GAA6DF;IAJxE,GADW;EAAA,CAAZ,CADH,CAFF,CADF;AAeD,CAhBD;;;AAkBAd,IAAI,CAACkB,WAAL,GAAmB,gBAAnB"}