@mirai/ui 1.0.9 → 1.0.12

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 (201) hide show
  1. package/README.md +106 -16
  2. package/package.json +1 -1
  3. package/build/components/Button/Button.js +0 -45
  4. package/build/components/Button/Button.js.map +0 -1
  5. package/build/components/Button/Button.module.css +0 -83
  6. package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +0 -113
  7. package/build/components/Button/index.js +0 -19
  8. package/build/components/Button/index.js.map +0 -1
  9. package/build/components/Calendar/Calendar.Month.js +0 -100
  10. package/build/components/Calendar/Calendar.Month.js.map +0 -1
  11. package/build/components/Calendar/Calendar.Week.js +0 -143
  12. package/build/components/Calendar/Calendar.Week.js.map +0 -1
  13. package/build/components/Calendar/Calendar.Weekdays.js +0 -40
  14. package/build/components/Calendar/Calendar.Weekdays.js.map +0 -1
  15. package/build/components/Calendar/Calendar.constants.js +0 -11
  16. package/build/components/Calendar/Calendar.constants.js.map +0 -1
  17. package/build/components/Calendar/Calendar.js +0 -151
  18. package/build/components/Calendar/Calendar.js.map +0 -1
  19. package/build/components/Calendar/Calendar.module.css +0 -110
  20. package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +0 -20357
  21. package/build/components/Calendar/helpers/getFirstDateOfMonth.js +0 -16
  22. package/build/components/Calendar/helpers/getFirstDateOfMonth.js.map +0 -1
  23. package/build/components/Calendar/helpers/getFirstDateOfWeek.js +0 -20
  24. package/build/components/Calendar/helpers/getFirstDateOfWeek.js.map +0 -1
  25. package/build/components/Calendar/helpers/getHeader.js +0 -23
  26. package/build/components/Calendar/helpers/getHeader.js.map +0 -1
  27. package/build/components/Calendar/helpers/getToday.js +0 -15
  28. package/build/components/Calendar/helpers/getToday.js.map +0 -1
  29. package/build/components/Calendar/helpers/getWeekNumber.js +0 -17
  30. package/build/components/Calendar/helpers/getWeekNumber.js.map +0 -1
  31. package/build/components/Calendar/helpers/getWeekdays.js +0 -27
  32. package/build/components/Calendar/helpers/getWeekdays.js.map +0 -1
  33. package/build/components/Calendar/helpers/index.js +0 -97
  34. package/build/components/Calendar/helpers/index.js.map +0 -1
  35. package/build/components/Calendar/helpers/isJest.js +0 -9
  36. package/build/components/Calendar/helpers/isJest.js.map +0 -1
  37. package/build/components/Calendar/index.js +0 -19
  38. package/build/components/Calendar/index.js.map +0 -1
  39. package/build/components/Form/Form.js +0 -184
  40. package/build/components/Form/Form.js.map +0 -1
  41. package/build/components/Form/__tests__/__snapshots__/Form.test.jsx.snap +0 -47
  42. package/build/components/Form/helpers/getChildrenErrors.js +0 -47
  43. package/build/components/Form/helpers/getChildrenErrors.js.map +0 -1
  44. package/build/components/Form/helpers/getChildrenValues.js +0 -46
  45. package/build/components/Form/helpers/getChildrenValues.js.map +0 -1
  46. package/build/components/Form/helpers/getField.js +0 -17
  47. package/build/components/Form/helpers/getField.js.map +0 -1
  48. package/build/components/Form/helpers/groupState.js +0 -29
  49. package/build/components/Form/helpers/groupState.js.map +0 -1
  50. package/build/components/Form/helpers/index.js +0 -58
  51. package/build/components/Form/helpers/index.js.map +0 -1
  52. package/build/components/Form/index.js +0 -19
  53. package/build/components/Form/index.js.map +0 -1
  54. package/build/components/InputNumber/InputNumber.js +0 -71
  55. package/build/components/InputNumber/InputNumber.js.map +0 -1
  56. package/build/components/InputNumber/InputNumber.module.css +0 -13
  57. package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +0 -621
  58. package/build/components/InputNumber/index.js +0 -19
  59. package/build/components/InputNumber/index.js.map +0 -1
  60. package/build/components/InputOption/InputOption.constants.js +0 -13
  61. package/build/components/InputOption/InputOption.constants.js.map +0 -1
  62. package/build/components/InputOption/InputOption.js +0 -63
  63. package/build/components/InputOption/InputOption.js.map +0 -1
  64. package/build/components/InputOption/InputOption.module.css +0 -38
  65. package/build/components/InputOption/__tests__/__snapshots__/InputOption.test.js.snap +0 -232
  66. package/build/components/InputOption/index.js +0 -19
  67. package/build/components/InputOption/index.js.map +0 -1
  68. package/build/components/InputSelect/InputSelect.js +0 -93
  69. package/build/components/InputSelect/InputSelect.js.map +0 -1
  70. package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +0 -490
  71. package/build/components/InputSelect/index.js +0 -19
  72. package/build/components/InputSelect/index.js.map +0 -1
  73. package/build/components/InputText/InputText.js +0 -108
  74. package/build/components/InputText/InputText.js.map +0 -1
  75. package/build/components/InputText/InputText.module.css +0 -89
  76. package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +0 -255
  77. package/build/components/InputText/index.js +0 -19
  78. package/build/components/InputText/index.js.map +0 -1
  79. package/build/components/Modal/Modal.js +0 -50
  80. package/build/components/Modal/Modal.js.map +0 -1
  81. package/build/components/Modal/Modal.module.css +0 -70
  82. package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +0 -150
  83. package/build/components/Modal/index.js +0 -19
  84. package/build/components/Modal/index.js.map +0 -1
  85. package/build/components/Table/Table.Row.js +0 -76
  86. package/build/components/Table/Table.Row.js.map +0 -1
  87. package/build/components/Table/Table.js +0 -92
  88. package/build/components/Table/Table.js.map +0 -1
  89. package/build/components/Table/Table.module.css +0 -76
  90. package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +0 -2285
  91. package/build/components/Table/helpers/index.js +0 -19
  92. package/build/components/Table/helpers/index.js.map +0 -1
  93. package/build/components/Table/helpers/select.js +0 -29
  94. package/build/components/Table/helpers/select.js.map +0 -1
  95. package/build/components/Table/index.js +0 -19
  96. package/build/components/Table/index.js.map +0 -1
  97. package/build/components/index.js +0 -123
  98. package/build/components/index.js.map +0 -1
  99. package/build/helpers/getInputErrors.js +0 -45
  100. package/build/helpers/getInputErrors.js.map +0 -1
  101. package/build/helpers/index.js +0 -32
  102. package/build/helpers/index.js.map +0 -1
  103. package/build/helpers/isValidDate.js +0 -58
  104. package/build/helpers/isValidDate.js.map +0 -1
  105. package/build/helpers/isValidEmail.js +0 -15
  106. package/build/helpers/isValidEmail.js.map +0 -1
  107. package/build/helpers/isValidPhone.js +0 -25
  108. package/build/helpers/isValidPhone.js.map +0 -1
  109. package/build/helpers/styles.js +0 -21
  110. package/build/helpers/styles.js.map +0 -1
  111. package/build/hooks/helpers/getNavigator.js +0 -33
  112. package/build/hooks/helpers/getNavigator.js.map +0 -1
  113. package/build/hooks/helpers/getResolution.js +0 -22
  114. package/build/hooks/helpers/getResolution.js.map +0 -1
  115. package/build/hooks/helpers/index.js +0 -32
  116. package/build/hooks/helpers/index.js.map +0 -1
  117. package/build/hooks/index.js +0 -19
  118. package/build/hooks/index.js.map +0 -1
  119. package/build/hooks/useDevice.js +0 -48
  120. package/build/hooks/useDevice.js.map +0 -1
  121. package/build/index.js +0 -71
  122. package/build/index.js.map +0 -1
  123. package/build/primitives/Checkbox/Checkbox.js +0 -52
  124. package/build/primitives/Checkbox/Checkbox.js.map +0 -1
  125. package/build/primitives/Checkbox/Checkbox.module.css +0 -45
  126. package/build/primitives/Checkbox/__tests__/__snapshots__/Checkbox.test.js.snap +0 -127
  127. package/build/primitives/Checkbox/index.js +0 -19
  128. package/build/primitives/Checkbox/index.js.map +0 -1
  129. package/build/primitives/Icon/Icon.constants.js +0 -29
  130. package/build/primitives/Icon/Icon.constants.js.map +0 -1
  131. package/build/primitives/Icon/Icon.js +0 -34
  132. package/build/primitives/Icon/Icon.js.map +0 -1
  133. package/build/primitives/Icon/Icon.module.css +0 -11
  134. package/build/primitives/Icon/__tests__/__snapshots__/Icon.test.js.snap +0 -133
  135. package/build/primitives/Icon/index.js +0 -31
  136. package/build/primitives/Icon/index.js.map +0 -1
  137. package/build/primitives/Input/Input.js +0 -66
  138. package/build/primitives/Input/Input.js.map +0 -1
  139. package/build/primitives/Input/Input.module.css +0 -24
  140. package/build/primitives/Input/__tests__/__snapshots__/Input.test.js.snap +0 -74
  141. package/build/primitives/Input/helpers/index.js +0 -19
  142. package/build/primitives/Input/helpers/index.js.map +0 -1
  143. package/build/primitives/Input/helpers/parseValue.js +0 -17
  144. package/build/primitives/Input/helpers/parseValue.js.map +0 -1
  145. package/build/primitives/Input/index.js +0 -19
  146. package/build/primitives/Input/index.js.map +0 -1
  147. package/build/primitives/Pressable/Pressable.constants.js +0 -9
  148. package/build/primitives/Pressable/Pressable.constants.js.map +0 -1
  149. package/build/primitives/Pressable/Pressable.js +0 -50
  150. package/build/primitives/Pressable/Pressable.js.map +0 -1
  151. package/build/primitives/Pressable/Pressable.module.css +0 -18
  152. package/build/primitives/Pressable/__tests__/__snapshots__/Pressable.test.js.snap +0 -53
  153. package/build/primitives/Pressable/index.js +0 -19
  154. package/build/primitives/Pressable/index.js.map +0 -1
  155. package/build/primitives/Radio/Radio.js +0 -49
  156. package/build/primitives/Radio/Radio.js.map +0 -1
  157. package/build/primitives/Radio/Radio.module.css +0 -59
  158. package/build/primitives/Radio/__tests__/__snapshots__/Radio.test.js.snap +0 -126
  159. package/build/primitives/Radio/index.js +0 -19
  160. package/build/primitives/Radio/index.js.map +0 -1
  161. package/build/primitives/ScrollView/ScrollView.js +0 -89
  162. package/build/primitives/ScrollView/ScrollView.js.map +0 -1
  163. package/build/primitives/ScrollView/ScrollView.module.css +0 -35
  164. package/build/primitives/ScrollView/__tests__/__snapshots__/ScrollView.test.js.snap +0 -535
  165. package/build/primitives/ScrollView/index.js +0 -19
  166. package/build/primitives/ScrollView/index.js.map +0 -1
  167. package/build/primitives/Select/Select.js +0 -70
  168. package/build/primitives/Select/Select.js.map +0 -1
  169. package/build/primitives/Select/Select.module.css +0 -25
  170. package/build/primitives/Select/__tests__/__snapshots__/Select.test.js.snap +0 -178
  171. package/build/primitives/Select/index.js +0 -19
  172. package/build/primitives/Select/index.js.map +0 -1
  173. package/build/primitives/Switch/Switch.js +0 -50
  174. package/build/primitives/Switch/Switch.js.map +0 -1
  175. package/build/primitives/Switch/Switch.module.css +0 -57
  176. package/build/primitives/Switch/__tests__/__snapshots__/Switch.test.js.snap +0 -109
  177. package/build/primitives/Switch/index.js +0 -19
  178. package/build/primitives/Switch/index.js.map +0 -1
  179. package/build/primitives/Text/Text.js +0 -40
  180. package/build/primitives/Text/Text.js.map +0 -1
  181. package/build/primitives/Text/Text.module.css +0 -36
  182. package/build/primitives/Text/__tests__/__snapshots__/Text.test.js.snap +0 -102
  183. package/build/primitives/Text/index.js +0 -19
  184. package/build/primitives/Text/index.js.map +0 -1
  185. package/build/primitives/View/View.js +0 -36
  186. package/build/primitives/View/View.js.map +0 -1
  187. package/build/primitives/View/View.module.css +0 -17
  188. package/build/primitives/View/__tests__/__snapshots__/View.test.js.snap +0 -62
  189. package/build/primitives/View/index.js +0 -19
  190. package/build/primitives/View/index.js.map +0 -1
  191. package/build/primitives/index.js +0 -136
  192. package/build/primitives/index.js.map +0 -1
  193. package/build/theme/default.theme.css +0 -39
  194. package/build/theme/helpers/camelcase.js +0 -16
  195. package/build/theme/helpers/camelcase.js.map +0 -1
  196. package/build/theme/helpers/index.js +0 -19
  197. package/build/theme/helpers/index.js.map +0 -1
  198. package/build/theme/index.js +0 -19
  199. package/build/theme/index.js.map +0 -1
  200. package/build/theme/theme.js +0 -43
  201. package/build/theme/theme.js.map +0 -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 = () => (
@@ -81,6 +81,34 @@ const MyComponent = () => (
81
81
  );
82
82
  ```
83
83
 
84
+ ### Layer
85
+
86
+ This primitive returns an element that displays with relative position to other element based on the following props:
87
+
88
+ - `children:node` two children elements are accepted, the first one is the element to be displayed and the second one is the LayerContent that wraps the element to be displayed if the visible prop is true
89
+ - `visible:boolean` showing or hiding the layer
90
+
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
+
93
+ ```jsx
94
+ import { Button, Calendar, Layer, LayerContent } from '@mirai/ui';
95
+
96
+ const MyComponent = () => {
97
+ const [visible, setVisible] = useState(false);
98
+
99
+ return (
100
+ <Layer visible={visible}>
101
+ <Button style={{ position: 'absolute', left: '500px', top: '100px' }} onPress={() => setVisible(!visible)}>
102
+ {visible ? 'close' : 'open'}
103
+ </Button>
104
+ <LayerContent>
105
+ <Calendar months={2} range />
106
+ </LayerContent>
107
+ </Layer>
108
+ );
109
+ };
110
+ ```
111
+
84
112
  ### Pressable
85
113
 
86
114
  This primitive returns pressable elements based on the following properties:
@@ -92,7 +120,7 @@ This primitive returns pressable elements based on the following properties:
92
120
  - `onLeave:function` executed once the user hovers away
93
121
  - `onPress:function` executed on mouse click on the element
94
122
 
95
- ```js
123
+ ```jsx
96
124
  import { Icon, Pressable, View } from '@mirai/ui';
97
125
 
98
126
  const MyComponent = () => (
@@ -113,7 +141,7 @@ This primitive returns a radio button based on the following properties:
113
141
  - `name:string` input name
114
142
  - `onChange:function` executed when input value changes
115
143
 
116
- ```js
144
+ ```jsx
117
145
  import { Radio, View } from '@mirai/ui';
118
146
 
119
147
  const MyComponent = () => (
@@ -143,7 +171,7 @@ This primitive is used to make vertically scrollable views and receives the foll
143
171
  - `width:number` width value
144
172
  - `onscroll:function` executed when user scrolls over the element
145
173
 
146
- ```js
174
+ ```jsx
147
175
  import { ScrollView, View } from '@mirai/ui';
148
176
 
149
177
  const MyComponent = ({ isDesktop }) => (
@@ -162,12 +190,11 @@ A primitive for displaying text. It receives the following props:
162
190
  - `bold:boolean` modifying font-weight
163
191
  - `children:string`
164
192
  - `headline:boolean` modifying font-size
165
- - `lighten:boolean` modifying text color
166
193
  - `upperCase:boolean` switching text to upper case
167
194
  - `small:boolean` modifying font-size
168
195
  - `tag:string` html tag of resulting element
169
196
 
170
- ```js
197
+ ```jsx
171
198
  import { Text, View } from '@mirai/ui';
172
199
 
173
200
  const MyComponent = ({ headerText }) => (
@@ -188,7 +215,7 @@ This primitive works as a container for displaying layout. It receives the follo
188
215
  - `row:boolean` sets flex-direction as 'row' if true
189
216
  - `tag:string` html tag of resulting element
190
217
 
191
- ```js
218
+ ```jsx
192
219
  import { Text, View } from '@mirai/ui';
193
220
 
194
221
  const MyComponent = ({ headerText }) => (
@@ -219,7 +246,7 @@ A button component that receives the following props:
219
246
  - `onLeave:function` executed when the user hovers away
220
247
  - `onPress:function` executed on mouse click on the element
221
248
 
222
- ```js
249
+ ```jsx
223
250
  import { Button } from '@mirai/ui';
224
251
 
225
252
  const MyComponent = (props) => {
@@ -254,7 +281,7 @@ A calendar component that receives the following props:
254
281
  - `onChange:function` executed when input value changes
255
282
  - `onFocus:function` executed on calendar cell hover
256
283
 
257
- ```js
284
+ ```jsx
258
285
  import { Calendar } from '@mirai/ui';
259
286
 
260
287
  const MyComponent = props => {
@@ -293,7 +320,7 @@ Input number component controlling the value with 2 buttons. Receives the follow
293
320
  - `value:number` input value
294
321
  - `onChange:function` executed when input value changes
295
322
 
296
- ```js
323
+ ```jsx
297
324
  import { InputNumber } from '@mirai/ui';
298
325
 
299
326
  const MyComponent = (props) => {
@@ -316,7 +343,7 @@ This component is used to display a radio button or checkbox base on a mandatory
316
343
  - `value:number` input value
317
344
  - `onChange:function` executed when input value changes
318
345
 
319
- ```js
346
+ ```jsx
320
347
  import { InputOption, View } from '@mirai/ui';
321
348
 
322
349
  const MyComponent = () => {
@@ -372,7 +399,7 @@ Text input component receiving the following props:
372
399
  - `onEnter:function` executed when user clicks on input
373
400
  - `onLeave:function` executed on click outside the input
374
401
 
375
- ```js
402
+ ```jsx
376
403
  import { InputText } from '@mirai/ui';
377
404
 
378
405
  const MyComponent = (props) => {
@@ -392,6 +419,48 @@ const MyComponent = (props) => {
392
419
  };
393
420
  ```
394
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
+
395
464
  ### Modal
396
465
 
397
466
  A modal component receiving the following props:
@@ -400,7 +469,7 @@ A modal component receiving the following props:
400
469
  - `visible:boolean` if true modal is shown
401
470
  - `onClose:function` executed once modal close button is clicked
402
471
 
403
- ```js
472
+ ```jsx
404
473
  import { Modal, View } from '@mirai/ui';
405
474
 
406
475
  const MyComponent = (props) => {
@@ -414,6 +483,27 @@ const MyComponent = (props) => {
414
483
  };
415
484
  ```
416
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
+
417
507
  ## Theme
418
508
 
419
509
  Styles can be customised by using Theme utility.
@@ -426,7 +516,7 @@ This method returns current theme settings (variables with values). This method
426
516
 
427
517
  This method sets a value of the variable passed as a parameter.
428
518
 
429
- ```js
519
+ ```jsx
430
520
  import { Button, Text, Theme } from '../../src';
431
521
 
432
522
  export default () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/ui",
3
- "version": "1.0.9",
3
+ "version": "1.0.12",
4
4
  "repository": "git@gitlab.com:miraicorp/dev/frontend/ui.git",
5
5
  "author": "JΛVI <hello@soyjavi.com>",
6
6
  "license": "MIT",
@@ -1,45 +0,0 @@
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.Button = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
-
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
13
-
14
- var _react = _interopRequireDefault(require("react"));
15
-
16
- var _helpers = require("../../helpers");
17
-
18
- var _primitives = require("../../primitives");
19
-
20
- var _ButtonModule = _interopRequireDefault(require("./Button.module.css"));
21
-
22
- var _excluded = ["children", "disabled", "large", "outlined", "rounded", "small", "squared", "tag"];
23
-
24
- var Button = function Button(_ref) {
25
- var children = _ref.children,
26
- disabled = _ref.disabled,
27
- large = _ref.large,
28
- outlined = _ref.outlined,
29
- rounded = _ref.rounded,
30
- small = _ref.small,
31
- _ref$squared = _ref.squared,
32
- squared = _ref$squared === void 0 ? false : _ref$squared,
33
- _ref$tag = _ref.tag,
34
- tag = _ref$tag === void 0 ? 'button' : _ref$tag,
35
- others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
36
- return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, others), {}, {
37
- disabled: disabled,
38
- tag: tag,
39
- className: (0, _helpers.styles)(_ButtonModule.default.button, large && _ButtonModule.default.large, small && _ButtonModule.default.small, rounded && _ButtonModule.default.rounded, squared && _ButtonModule.default.squared, outlined && !disabled && _ButtonModule.default.outlined, others.className)
40
- }), children);
41
- };
42
-
43
- exports.Button = Button;
44
- Button.displayName = 'Component:Button';
45
- //# sourceMappingURL=Button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.js","names":["Button","children","disabled","large","outlined","rounded","small","squared","tag","others","React","createElement","Pressable","className","style","button","displayName"],"sources":["../../../src/components/Button/Button.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Pressable } from '../../primitives';\nimport style from './Button.module.css';\n\nconst Button = ({ children, disabled, large, outlined, rounded, small, squared = false, tag = 'button', ...others }) =>\n React.createElement(\n Pressable,\n {\n ...others,\n disabled,\n tag,\n className: styles(\n style.button,\n large && style.large,\n small && style.small,\n rounded && style.rounded,\n squared && style.squared,\n outlined && !disabled && style.outlined,\n others.className,\n ),\n },\n children,\n );\n\nButton.displayName = 'Component:Button';\n\nButton.propTypes = {\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":";;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS;EAAA,IAAGC,QAAH,QAAGA,QAAH;EAAA,IAAaC,QAAb,QAAaA,QAAb;EAAA,IAAuBC,KAAvB,QAAuBA,KAAvB;EAAA,IAA8BC,QAA9B,QAA8BA,QAA9B;EAAA,IAAwCC,OAAxC,QAAwCA,OAAxC;EAAA,IAAiDC,KAAjD,QAAiDA,KAAjD;EAAA,wBAAwDC,OAAxD;EAAA,IAAwDA,OAAxD,6BAAkE,KAAlE;EAAA,oBAAyEC,GAAzE;EAAA,IAAyEA,GAAzE,yBAA+E,QAA/E;EAAA,IAA4FC,MAA5F;EAAA,oBACbC,eAAMC,aAAN,CACEC,qBADF,8DAGOH,MAHP;IAIIP,QAAQ,EAARA,QAJJ;IAKIM,GAAG,EAAHA,GALJ;IAMIK,SAAS,EAAE,qBACTC,sBAAMC,MADG,EAETZ,KAAK,IAAIW,sBAAMX,KAFN,EAGTG,KAAK,IAAIQ,sBAAMR,KAHN,EAITD,OAAO,IAAIS,sBAAMT,OAJR,EAKTE,OAAO,IAAIO,sBAAMP,OALR,EAMTH,QAAQ,IAAI,CAACF,QAAb,IAAyBY,sBAAMV,QANtB,EAOTK,MAAM,CAACI,SAPE;EANf,IAgBEZ,QAhBF,CADa;AAAA,CAAf;;;AAoBAD,MAAM,CAACgB,WAAP,GAAqB,kBAArB"}
@@ -1,83 +0,0 @@
1
- :root {
2
- --mirai-ui-button-color: var(--mirai-ui-accent);
3
- --mirai-ui-button-color-active: rgba(255, 255, 255, 0.2);
4
- --mirai-ui-button-color-focus: var(--mirai-ui-content);
5
- --mirai-ui-button-color-text: var(--mirai-ui-base);
6
- --mirai-ui-button-radius: var(--mirai-ui-border-radius);
7
- }
8
-
9
- .button {
10
- align-items: center;
11
- background-color: var(--mirai-ui-button-color);
12
- border-radius: var(--mirai-ui-button-radius);
13
- color: var(--mirai-ui-button-color-text);
14
- display: flex;
15
- font-family: var(--mirai-ui-font);
16
- font-size: var(--mirai-ui-font-size-action);
17
- font-weight: var(--mirai-ui-font-bold-weight);
18
- justify-content: center;
19
- padding: var(--mirai-ui-space-S) var(--mirai-ui-space-L);
20
- transition: background-color var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
21
- box-shadow var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
22
- color var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
23
- width: fit-content;
24
- }
25
-
26
- .button:disabled {
27
- background-color: var(--mirai-ui-disabled);
28
- color: var(--mirai-ui-lighten);
29
- }
30
-
31
- .outlined {
32
- border: solid 1px var(--mirai-ui-button-color);
33
- background-color: var(--mirai-ui-base);
34
- color: var(--mirai-ui-button-color);
35
- }
36
-
37
- .button:not(:disabled):active {
38
- box-shadow: inset 0 0 var(--mirai-ui-space-XXL) var(--mirai-ui-space-XXL) var(--mirai-ui-button-color-active);
39
- }
40
-
41
- .large:not(.squared) {
42
- font-size: var(--mirai-ui-font-size-headline);
43
- padding: var(--mirai-ui-space-M) var(--mirai-ui-space-XL);
44
- }
45
-
46
- .small:not(.squared) {
47
- font-size: var(--mirai-ui-font-size-small);
48
- padding: var(--mirai-ui-space-XS) var(--mirai-ui-space-S);
49
- }
50
-
51
- .rounded {
52
- border-radius: 50%;
53
- }
54
-
55
- .squared {
56
- padding: 0;
57
- height: var(--mirai-ui-space-XL);
58
- width: var(--mirai-ui-space-XL);
59
- }
60
-
61
- .squared.small {
62
- height: var(--mirai-ui-space-L);
63
- width: var(--mirai-ui-space-L);
64
- }
65
-
66
- .squared.large {
67
- height: var(--mirai-ui-space-XXL);
68
- width: var(--mirai-ui-space-XXL);
69
- }
70
-
71
- @media only screen and (max-width: 600px) {
72
- }
73
-
74
- @media only screen and (min-width: 600px) {
75
- .button:not(:disabled).outlined:hover {
76
- border-color: var(--mirai-ui-button-color-hover);
77
- color: var(--mirai-ui-button-color-focus);
78
- }
79
-
80
- .button:not(:disabled):not(.outlined):hover {
81
- background-color: var(--mirai-ui-button-color-focus);
82
- }
83
- }
@@ -1,113 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[` 1`] = `
4
- <DocumentFragment>
5
- <button
6
- class="pressable button squared"
7
- >
8
- children
9
- </button>
10
- </DocumentFragment>
11
- `;
12
-
13
- exports[`component:<Button> inherit:className 1`] = `
14
- <DocumentFragment>
15
- <button
16
- class="pressable button mirai"
17
- >
18
- children
19
- </button>
20
- </DocumentFragment>
21
- `;
22
-
23
- exports[`component:<Button> prop:disabled 1`] = `
24
- <DocumentFragment>
25
- <button
26
- class="pressable button"
27
- disabled=""
28
- >
29
- children
30
- </button>
31
- </DocumentFragment>
32
- `;
33
-
34
- exports[`component:<Button> prop:large 1`] = `
35
- <DocumentFragment>
36
- <button
37
- class="pressable button large"
38
- >
39
- children
40
- </button>
41
- </DocumentFragment>
42
- `;
43
-
44
- exports[`component:<Button> prop:outlined 1`] = `
45
- <DocumentFragment>
46
- <button
47
- class="pressable button outlined"
48
- >
49
- children
50
- </button>
51
- </DocumentFragment>
52
- `;
53
-
54
- exports[`component:<Button> prop:small 1`] = `
55
- <DocumentFragment>
56
- <button
57
- class="pressable button small"
58
- >
59
- children
60
- </button>
61
- </DocumentFragment>
62
- `;
63
-
64
- exports[`component:<Button> prop:squared & large 1`] = `
65
- <DocumentFragment>
66
- <button
67
- class="pressable button large squared"
68
- >
69
- children
70
- </button>
71
- </DocumentFragment>
72
- `;
73
-
74
- exports[`component:<Button> prop:squared & small 1`] = `
75
- <DocumentFragment>
76
- <button
77
- class="pressable button small squared"
78
- >
79
- children
80
- </button>
81
- </DocumentFragment>
82
- `;
83
-
84
- exports[`component:<Button> prop:tag 1`] = `
85
- <DocumentFragment>
86
- <a
87
- class="pressable button"
88
- >
89
- children
90
- </a>
91
- </DocumentFragment>
92
- `;
93
-
94
- exports[`component:<Button> renders 1`] = `
95
- <DocumentFragment>
96
- <button
97
- class="pressable button"
98
- >
99
- children
100
- </button>
101
- </DocumentFragment>
102
- `;
103
-
104
- exports[`component:<Button> testID 1`] = `
105
- <DocumentFragment>
106
- <button
107
- class="pressable button"
108
- data-testid="mirai"
109
- >
110
- children
111
- </button>
112
- </DocumentFragment>
113
- `;
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _Button = require("./Button");
8
-
9
- Object.keys(_Button).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _Button[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function get() {
15
- return _Button[key];
16
- }
17
- });
18
- });
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Button/index.js"],"sourcesContent":["export * from './Button';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -1,100 +0,0 @@
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.Month = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
-
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
13
-
14
- var _react = _interopRequireDefault(require("react"));
15
-
16
- var _helpers = require("../../helpers");
17
-
18
- var _hooks = require("../../hooks");
19
-
20
- var _primitives = require("../../primitives");
21
-
22
- var _Calendar = require("./Calendar.constants");
23
-
24
- var _CalendarModule = _interopRequireDefault(require("./Calendar.module.css"));
25
-
26
- var _Calendar2 = require("./Calendar.Week");
27
-
28
- var _Calendar3 = require("./Calendar.Weekdays");
29
-
30
- var _helpers2 = require("./helpers");
31
-
32
- var _excluded = ["focus", "instance", "selected", "disabledPast", "format", "from", "locale", "range", "to", "onChange", "onFocus", "onNext", "onPrevious"];
33
-
34
- var Month = function Month(_ref) {
35
- var focus = _ref.focus,
36
- instance = _ref.instance,
37
- selected = _ref.selected,
38
- _ref$disabledPast = _ref.disabledPast,
39
- disabledPast = _ref$disabledPast === void 0 ? true : _ref$disabledPast,
40
- format = _ref.format,
41
- from = _ref.from,
42
- locale = _ref.locale,
43
- _ref$range = _ref.range,
44
- range = _ref$range === void 0 ? false : _ref$range,
45
- to = _ref.to,
46
- _ref$onChange = _ref.onChange,
47
- onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
48
- _ref$onFocus = _ref.onFocus,
49
- onFocus = _ref$onFocus === void 0 ? function () {} : _ref$onFocus,
50
- onNext = _ref.onNext,
51
- onPrevious = _ref.onPrevious,
52
- others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
53
-
54
- var _useDevice = (0, _hooks.useDevice)(),
55
- isDesktop = _useDevice.isDesktop;
56
-
57
- var weekNumber = (0, _helpers2.getWeekNumber)(instance);
58
- return /*#__PURE__*/_react.default.createElement(_primitives.View, {
59
- className: (0, _helpers.styles)(_CalendarModule.default.month, others.className)
60
- }, /*#__PURE__*/_react.default.createElement(_primitives.View, {
61
- row: true,
62
- className: _CalendarModule.default.header
63
- }, onPrevious && /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
64
- onPress: onPrevious
65
- }, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
66
- name: "Left"
67
- })), /*#__PURE__*/_react.default.createElement(_primitives.Text, {
68
- bold: true,
69
- upperCase: true,
70
- className: _CalendarModule.default.title
71
- }, (0, _helpers2.getHeader)(instance, locale)), onNext && /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
72
- onPress: onNext
73
- }, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
74
- name: "Right"
75
- }))), isDesktop && /*#__PURE__*/_react.default.createElement(_Calendar3.Weekdays, {
76
- locale: locale
77
- }), _Calendar.VISIBLE_WEEKS.map(function (week) {
78
- return /*#__PURE__*/_react.default.createElement(_Calendar2.Week, Object.assign({}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, others), {}, {
79
- disabledPast: disabledPast,
80
- focus: focus,
81
- format: format,
82
- from: from,
83
- locale: locale,
84
- to: to,
85
- range: range,
86
- selected: selected
87
- }), {
88
- key: week,
89
- month: instance.getMonth(),
90
- number: weekNumber + week,
91
- year: instance.getFullYear(),
92
- onFocus: onFocus,
93
- onPress: onChange
94
- }));
95
- }));
96
- };
97
-
98
- exports.Month = Month;
99
- Month.displayName = 'Component:Calendar:Month';
100
- //# sourceMappingURL=Calendar.Month.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Calendar.Month.js","names":["Month","focus","instance","selected","disabledPast","format","from","locale","range","to","onChange","onFocus","onNext","onPrevious","others","isDesktop","weekNumber","style","month","className","header","title","VISIBLE_WEEKS","map","week","getMonth","getFullYear","displayName"],"sources":["../../../src/components/Calendar/Calendar.Month.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, Pressable, Text, View } from '../../primitives';\nimport { VISIBLE_WEEKS } from './Calendar.constants';\nimport style from './Calendar.module.css';\nimport { Week } from './Calendar.Week';\nimport { Weekdays } from './Calendar.Weekdays';\nimport { getHeader, getWeekNumber } from './helpers';\n\nexport const Month = ({\n focus,\n instance,\n selected,\n disabledPast = true,\n format,\n from,\n locale,\n range = false,\n to,\n onChange = () => {},\n onFocus = () => {},\n onNext,\n onPrevious,\n ...others\n}) => {\n const { isDesktop } = useDevice();\n const weekNumber = getWeekNumber(instance);\n\n return (\n <View className={styles(style.month, others.className)}>\n <View row className={style.header}>\n {onPrevious && (\n <Pressable onPress={onPrevious}>\n <Icon name=\"Left\" />\n </Pressable>\n )}\n <Text bold upperCase className={style.title}>\n {getHeader(instance, locale)}\n </Text>\n {onNext && (\n <Pressable onPress={onNext}>\n <Icon name=\"Right\" />\n </Pressable>\n )}\n </View>\n\n {isDesktop && <Weekdays locale={locale} />}\n\n {VISIBLE_WEEKS.map((week) => (\n <Week\n {...{\n ...others,\n disabledPast,\n focus,\n format,\n from,\n locale,\n to,\n range,\n selected,\n }}\n key={week}\n month={instance.getMonth()}\n number={weekNumber + week}\n year={instance.getFullYear()}\n onFocus={onFocus}\n onPress={onChange}\n />\n ))}\n </View>\n );\n};\n\nMonth.displayName = 'Component:Calendar:Month';\n\nMonth.propTypes = {\n captions: PropTypes.shape({}),\n focus: PropTypes.any,\n instance: PropTypes.any,\n selected: PropTypes.any,\n disabledDates: PropTypes.arrayOf(PropTypes.string),\n disabledPast: PropTypes.bool,\n disabledWeekends: PropTypes.bool,\n format: PropTypes.string,\n from: PropTypes.instanceOf(Date),\n locale: PropTypes.string,\n range: PropTypes.bool,\n to: PropTypes.instanceOf(Date),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),\n onChange: PropTypes.func,\n onFocus: PropTypes.func,\n onNext: PropTypes.func,\n onPrevious: PropTypes.func,\n};\n"],"mappings":";;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEO,IAAMA,KAAK,GAAG,SAARA,KAAQ,OAef;EAAA,IAdJC,KAcI,QAdJA,KAcI;EAAA,IAbJC,QAaI,QAbJA,QAaI;EAAA,IAZJC,QAYI,QAZJA,QAYI;EAAA,6BAXJC,YAWI;EAAA,IAXJA,YAWI,kCAXW,IAWX;EAAA,IAVJC,MAUI,QAVJA,MAUI;EAAA,IATJC,IASI,QATJA,IASI;EAAA,IARJC,MAQI,QARJA,MAQI;EAAA,sBAPJC,KAOI;EAAA,IAPJA,KAOI,2BAPI,KAOJ;EAAA,IANJC,EAMI,QANJA,EAMI;EAAA,yBALJC,QAKI;EAAA,IALJA,QAKI,8BALO,YAAM,CAAE,CAKf;EAAA,wBAJJC,OAII;EAAA,IAJJA,OAII,6BAJM,YAAM,CAAE,CAId;EAAA,IAHJC,MAGI,QAHJA,MAGI;EAAA,IAFJC,UAEI,QAFJA,UAEI;EAAA,IADDC,MACC;;EACJ,iBAAsB,uBAAtB;EAAA,IAAQC,SAAR,cAAQA,SAAR;;EACA,IAAMC,UAAU,GAAG,6BAAcd,QAAd,CAAnB;EAEA,oBACE,6BAAC,gBAAD;IAAM,SAAS,EAAE,qBAAOe,wBAAMC,KAAb,EAAoBJ,MAAM,CAACK,SAA3B;EAAjB,gBACE,6BAAC,gBAAD;IAAM,GAAG,MAAT;IAAU,SAAS,EAAEF,wBAAMG;EAA3B,GACGP,UAAU,iBACT,6BAAC,qBAAD;IAAW,OAAO,EAAEA;EAApB,gBACE,6BAAC,gBAAD;IAAM,IAAI,EAAC;EAAX,EADF,CAFJ,eAME,6BAAC,gBAAD;IAAM,IAAI,MAAV;IAAW,SAAS,MAApB;IAAqB,SAAS,EAAEI,wBAAMI;EAAtC,GACG,yBAAUnB,QAAV,EAAoBK,MAApB,CADH,CANF,EASGK,MAAM,iBACL,6BAAC,qBAAD;IAAW,OAAO,EAAEA;EAApB,gBACE,6BAAC,gBAAD;IAAM,IAAI,EAAC;EAAX,EADF,CAVJ,CADF,EAiBGG,SAAS,iBAAI,6BAAC,mBAAD;IAAU,MAAM,EAAER;EAAlB,EAjBhB,EAmBGe,wBAAcC,GAAd,CAAkB,UAACC,IAAD;IAAA,oBACjB,6BAAC,eAAD,gFAEOV,MAFP;MAGIV,YAAY,EAAZA,YAHJ;MAIIH,KAAK,EAALA,KAJJ;MAKII,MAAM,EAANA,MALJ;MAMIC,IAAI,EAAJA,IANJ;MAOIC,MAAM,EAANA,MAPJ;MAQIE,EAAE,EAAFA,EARJ;MASID,KAAK,EAALA,KATJ;MAUIL,QAAQ,EAARA;IAVJ;MAYE,GAAG,EAAEqB,IAZP;MAaE,KAAK,EAAEtB,QAAQ,CAACuB,QAAT,EAbT;MAcE,MAAM,EAAET,UAAU,GAAGQ,IAdvB;MAeE,IAAI,EAAEtB,QAAQ,CAACwB,WAAT,EAfR;MAgBE,OAAO,EAAEf,OAhBX;MAiBE,OAAO,EAAED;IAjBX,GADiB;EAAA,CAAlB,CAnBH,CADF;AA2CD,CA9DM;;;AAgEPV,KAAK,CAAC2B,WAAN,GAAoB,0BAApB"}