@mirai/ui 1.0.48 → 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
@@ -17,8 +17,10 @@ yarn add @mirai/ui
17
17
  This primitive returns a checkbox button based on the following properties:
18
18
 
19
19
  - `checked:boolean` if true, the checkbox button is checked
20
+ - `children:node`
20
21
  - `disabled:boolean` applying 'disabled' attribute
21
- - `name:string` input name
22
+ - `name:string` input name (required)
23
+ - `value:string` input value
22
24
  - `onChange:function` executed when input value changes
23
25
 
24
26
  ```jsx
@@ -30,8 +32,8 @@ const MyComponent = () => (
30
32
  name="checkbox"
31
33
  checked={false}
32
34
  disabled={false}
33
- value={primitive}
34
- onChange={() => console.log('change')
35
+ value="primitive"
36
+ onChange={() => console.log('change')}
35
37
  />
36
38
  </View>
37
39
  ```
@@ -50,6 +52,8 @@ const MyComponent = () => (
50
52
  );
51
53
  ```
52
54
 
55
+ > ℹ️ Current available names: Empty, Account, Left, Right, Up, Down, Close, CloseArrow, Plus, Minus, EyeOpen, EyeClose, Check, Error, Info, Success, Warning, Bed, Calendar, List, Lock, Person
56
+
53
57
  ### Input
54
58
 
55
59
  This primitive returns an input or a textarea based on the following props:
@@ -85,7 +89,13 @@ const MyComponent = () => (
85
89
 
86
90
  This primitive returns an element that displays with relative position to other element based on the following props:
87
91
 
92
+ - `bottom:bool` if you want open the content below the reference component.
93
+ - `centered:bool` if you want center the content using screen as parent.
88
94
  - `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
95
+ - `forceRender:bool` if you want render content children even if `visible` is _falsy_, by default is `true`.
96
+ - `left:bool` if you want open the content on the left of the reference component.
97
+ - `right:bool` if you want open the content on the right of the reference component.
98
+ - `top:bool` if you want open the content above the reference component.
89
99
  - `visible:boolean` showing or hiding the layer
90
100
 
91
101
  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
@@ -115,6 +125,7 @@ This primitive returns pressable elements based on the following properties:
115
125
 
116
126
  - `children:node`
117
127
  - `disabled:boolean` disable attribute
128
+ - `preventDefault:boolean` if you want stop the event tunneling.
118
129
  - `tag:string` html tag applied to a primitive
119
130
  - `onEnter:function` executed once the user hovers over the element
120
131
  - `onLeave:function` executed once the user hovers away
@@ -139,6 +150,7 @@ This primitive returns a radio button based on the following properties:
139
150
  - `checked:boolean` if true, the radio button is checked
140
151
  - `disabled:boolean` applying 'disabled' attribute
141
152
  - `name:string` input name
153
+ - `value:string` input value
142
154
  - `onChange:function` executed when input value changes
143
155
 
144
156
  ```jsx
@@ -167,6 +179,7 @@ This primitive is used to make vertically scrollable views and receives the foll
167
179
  - `scrollEventThrottle:number` scroll timeout value
168
180
  - `scrollIndicator:boolean` if true the scroll indicator is shown
169
181
  - `scrollTo:number` coordinate to scroll to
182
+ - `snap:bool` if you want use the CSS feature `scroll-snap`
170
183
  - `tag:string` html tag of resulting element
171
184
  - `width:number` width value
172
185
  - `onscroll:function` executed when user scrolls over the element
@@ -190,9 +203,10 @@ A primitive for displaying text. It receives the following props:
190
203
  - `bold:boolean` modifying font-weight
191
204
  - `children:string`
192
205
  - `headline:boolean` modifying font-size
193
- - `upperCase:boolean` switching text to upper case
194
206
  - `small:boolean` modifying font-size
207
+ - `subheadline:boolean` modifying font-size
195
208
  - `tag:string` html tag of resulting element
209
+ - `upperCase:boolean` switching text to upper case
196
210
 
197
211
  ```jsx
198
212
  import { Text, View } from '@mirai/ui';
@@ -236,12 +250,16 @@ React components assembled with primitives.
236
250
 
237
251
  A button component that receives the following props:
238
252
 
253
+ - `busy:bool` if `true` will disable button and give feedback as something is processing.
239
254
  - `children:node|string`
240
255
  - `disabled:boolean` applying 'disabled' attribute
241
256
  - `large:boolean` modifying the button size
257
+ - `outlined:boolean` modifying the button appearance using an outlined line
258
+ - `rounded:boolean` if true will use the theme border-radius variable for round the corners
242
259
  - `small:boolean` modifying the button size
243
260
  - `squared:boolean` if true gives rectangular shape to the button (false by default)
244
261
  - `tag:string` html tag of resulting element ('button' by default)
262
+ - `wide:bool` modifying the button to full-width
245
263
  - `onEnter:function` executed when the user hovers over
246
264
  - `onLeave:function` executed when the user hovers away
247
265
  - `onPress:function` executed on mouse click on the element
@@ -267,12 +285,11 @@ A calendar component that receives the following props:
267
285
  - `captions:object` captions to be placed into calendar cells
268
286
  - `disabledDates:[string]` dates to be shown as unavailable and can't be selected
269
287
  - `disabledPast:boolean` past dates to be shown as unavailable and can't be selected
270
- - `disabledWeekends` boolean: weekends to be shown as unavailable and can't be selected
271
288
  - `format:string` date display format (e.g. "DD/MM/YYYY")
272
289
  - `from:string` date in specific format (e.g. "31/03/2022")
273
290
  - `highlights:[string]` highlights a determinate group of dates
274
- - `months:number` number of months to be visible
275
291
  - `locale:string` locale value
292
+ - `months:number` number of months to be visible
276
293
  - `range:boolean` Enable range selection
277
294
  - `rangeMaxDays:number` Maximum days in a range
278
295
  - `rangeMinDays:number` Minimum days in a range
@@ -280,6 +297,8 @@ A calendar component that receives the following props:
280
297
  - `value:string|[string]`
281
298
  - `onChange:function` executed when input value changes
282
299
  - `onFocus:function` executed on calendar cell hover
300
+ - `onNavigation:function` executed when move to the next/previous months
301
+ - `onScroll:function` executed when user scrolls the calendars container (only available in mobile environments)
283
302
 
284
303
  ```jsx
285
304
  import { Calendar } from '@mirai/ui';
@@ -311,11 +330,13 @@ const MyComponent = props => {
311
330
 
312
331
  Input number component controlling the value with 2 buttons. Receives the following props:
313
332
 
333
+ - `disabled:bool` applying 'disabled' attribute
314
334
  - `hint:string` brief message
315
335
  - `label:string` input label
316
336
  - `max:number` maximum input value
317
337
  - `min:number` minimum input value
318
338
  - `name:string` input name attribute (required)
339
+ - `rounded:bool` if you want use the `rounded` property of `<Button>`
319
340
  - `step:number` to be added/subtracted from value on each button click
320
341
  - `value:number` input value
321
342
  - `onChange:function` executed when input value changes
@@ -334,11 +355,11 @@ const MyComponent = (props) => {
334
355
 
335
356
  This component is used to display a radio button or checkbox base on a mandatory string prop `type`. It receives the following props:
336
357
 
337
- - `reverse:boolean` if true the label is placed on the left side of the input element (false by default)
338
358
  - `checked:boolean` if true, the input is checked
339
359
  - `disabled:boolean` applying 'disabled' attribute
340
360
  - `label:string` input label
341
361
  - `name:string` input name
362
+ - `reverse:boolean` if true the label is placed on the left side of the input element (false by default)
342
363
  - `type:string` type of input (radio or checkbox)
343
364
  - `value:number` input value
344
365
  - `onChange:function` executed when input value changes
@@ -391,6 +412,7 @@ Text input component receiving the following props:
391
412
  - `disabled:boolean` applying 'disabled' attribute
392
413
  - `error:boolean` true if error event fired
393
414
  - `hint:string` brief message
415
+ - `icon:string` if you want use an `<Icon>` within the component
394
416
  - `label:string` input label
395
417
  - `multiline:boolean` : if true returning textarea
396
418
  - `name:string` : input name (required)
@@ -466,8 +488,12 @@ const MyComponent = () => {
466
488
  A modal component receiving the following props:
467
489
 
468
490
  - `children:node`
491
+ - `portal:bool` if you want use _portal feature_ of React API
492
+ - `overflow:bool` wraps all modal in a semi-transparent layer
493
+ - `title:string` shows a title for the modal
469
494
  - `visible:boolean` if true modal is shown
470
- - `onClose:function` executed once modal close button is clicked
495
+ - `onBack:function` executed once back button is clicked
496
+ - `onClose:function` executed once close button is clicked
471
497
 
472
498
  ```jsx
473
499
  import { Modal, View } from '@mirai/ui';
@@ -512,7 +538,7 @@ Styles can be customised by using Theme utility.
512
538
 
513
539
  This method returns current theme settings (variables with values). This method receives as an optional parameter a string with a prefix (domain) to specify the scope ('--mirai-ui-' by default);
514
540
 
515
- ### set(variable, value, domain)
541
+ ### setVariable(variable, value, domain)
516
542
 
517
543
  This method sets a value of the variable passed as a parameter.
518
544
 
@@ -541,3 +567,51 @@ export default () => {
541
567
  );
542
568
  };
543
569
  ```
570
+
571
+ ### shadeColors
572
+
573
+ This method helps you to create a color palette for the `accent` color of your theme. For example if in our theme we have `--mirai-ui-accent: #3978c5`:
574
+
575
+ ```js
576
+ Theme.shadeColors()
577
+ >> ACCENT:400 #61a0ed
578
+ ACCENT:300 #89c8ff
579
+ ACCENT:200 #edffff
580
+ ```
581
+
582
+ ## Hooks
583
+
584
+ a repository of hooks which will help you create simpler solutions.
585
+
586
+ ### useDevice
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:
589
+
590
+ <!-- screen -->
591
+
592
+ - `height:number` height resolution of device
593
+ - `width:number` width resolution of device
594
+ <!-- navigator -->
595
+ - `userAgent:string` type of browser's user agent
596
+ - `chrome:bool` using chrome browser
597
+ - `firefox:bool` using firefox browser
598
+ - `inApp:bool` using an application browser such as Facebook, Twitter..
599
+ - `mobile:bool` using a mobile browser
600
+ - `safari:bool` using safari browser
601
+ - `touch:bool` touch screen capability
602
+ <!-- orientation -->
603
+ - `isLandscape:bool` orientation is landscape
604
+ - `isPortrait:bool` orientation is portrait
605
+ <!-- type -->
606
+ - `isMobile:bool` is in the mobile breakpoint (<600px)
607
+ - `isDesktop:bool` in in the desktop breakpoint (>=600px)
608
+
609
+ Let's see a simple use of the hook:
610
+
611
+ ```jsx
612
+ const component = () => {
613
+ const { isPortrait, isDesktop } = useDevice();
614
+
615
+ return <div classname={styles(style.container, isPortrait && isDesktop && style.mobileApp)} />;
616
+ };
617
+ ```
@@ -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,CACE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AVF;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,I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EAEjBvB,QAAQ,EAAEsB,mBAAUE,SAAV,CAAoB,CAACF,mBAAUG,MAAX,EAAmBH,mBAAUI,IAA7B,CAApB,CAFO;EAGjBzB,QAAQ,EAAEqB,mBAAUC,IAHH;EAIjBrB,KAAK,EAAEoB,mBAAUC,IAJA;EAKjBpB,QAAQ,EAAEmB,mBAAUC,IALH;EAMjBnB,OAAO,EAAEkB,mBAAUC,IANF;EAOjBlB,KAAK,EAAEiB,mBAAUC,IAPA;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;;AAC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QAAQ,EAAEmB,mBAAUC,IADN;IAEdN,QAAQ,EAAEK,mBAAUI,IAFN;IAGdC,OAAO,EAAEL,mBAAUI,IAHL;IAIdE,IAAI,EAAEN,mBAAUO,MAJF;IAKdC,KAAK,EAAER,mBAAUO,MALH;IAMdV,KAAK,EAAEG,mBAAUS,SAAV,CAAoB,CAACT,mBAAUO,MAAX,EAAmBP,mBAAUU,MAA7B,CAApB,EAA0DC;EANnD,CAAhB,CADO,CAFM;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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,mBAAUE,OAAV,CACPF,mBAAUG,KAAV,CAAgB;IACdrB,QAAQ,EAAEkB,mBAAUC,IADN;IAEdG,QAAQ,EAAEJ,mBAAUK,IAFN;IAGdC,OAAO,EAAEN,mBAAUK,IAHL;IAIdE,IAAI,EAAEP,mBAAUQ,MAJF;IAKdC,KAAK,EAAET,mBAAUQ,MALH;IAMdX,KAAK,EAAEG,mBAAUU,SAAV,CAAoB,CAACV,mBAAUQ,MAAX,EAAmBR,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/build/index.js CHANGED
@@ -17,19 +17,6 @@ Object.keys(_components).forEach(function (key) {
17
17
  });
18
18
  });
19
19
 
20
- var _helpers = require("./helpers");
21
-
22
- Object.keys(_helpers).forEach(function (key) {
23
- if (key === "default" || key === "__esModule") return;
24
- if (key in exports && exports[key] === _helpers[key]) return;
25
- Object.defineProperty(exports, key, {
26
- enumerable: true,
27
- get: function get() {
28
- return _helpers[key];
29
- }
30
- });
31
- });
32
-
33
20
  var _hooks = require("./hooks");
34
21
 
35
22
  Object.keys(_hooks).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.js"],"sourcesContent":["export * from './components';\nexport * from './helpers';\nexport * from './hooks';\nexport * from './primitives';\nexport * from './theme';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.js"],"sourcesContent":["export * from './components';\nexport * from './hooks';\nexport * from './primitives';\nexport * from './theme';\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -21,7 +21,7 @@ var _LayerModule = _interopRequireDefault(require("./Layer.module.css"));
21
21
 
22
22
  var _LayerContent = require("./LayerContent");
23
23
 
24
- var _excluded = ["centered", "forceRender", "bottom", "left", "right", "top", "visible"];
24
+ var _excluded = ["bottom", "centered", "forceRender", "left", "right", "top", "visible"];
25
25
 
26
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
27
 
@@ -52,10 +52,10 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
52
52
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
53
53
 
54
54
  var Layer = function Layer(_ref) {
55
- var centered = _ref.centered,
55
+ var forceBottom = _ref.bottom,
56
+ centered = _ref.centered,
56
57
  _ref$forceRender = _ref.forceRender,
57
58
  forceRender = _ref$forceRender === void 0 ? true : _ref$forceRender,
58
- forceBottom = _ref.bottom,
59
59
  forceLeft = _ref.left,
60
60
  forceRight = _ref.right,
61
61
  forceTop = _ref.top,
@@ -1 +1 @@
1
- {"version":3,"file":"Layer.js","names":["Layer","centered","forceRender","forceBottom","bottom","forceLeft","left","forceRight","right","forceTop","top","visible","others","device","componentRef","contentRef","position","setPosition","current","componentEl","firstChild","contentEl","componentLayout","contentLayout","children","React","Children","map","child","find","name","type","LayerContent","style","layer","hidden","className","propTypes","PropTypes","bool","node"],"sources":["../../../src/primitives/Layer/Layer.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { getElementLayout, getLayerPosition } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n centered,\n forceRender = true,\n bottom: forceBottom,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n visible,\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = getElementLayout(componentEl);\n const contentLayout = getElementLayout(contentEl);\n const { left = 0, top = 0 } = getLayerPosition(componentLayout, contentLayout, device, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setPosition({ left: `${left}px`, top: `${top}px` });\n }, [centered, device, forceBottom, forceLeft, forceRight, forceTop, visible]);\n\n const children = React.Children.map(others.children || [], (child) => child);\n\n return (\n <>\n <span data-testid={others['data-testid']} ref={componentRef}>\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </span>\n\n {(forceRender || visible) && (\n <div\n ref={contentRef}\n className={styles(style.layer, !visible && style.hidden, others.className)}\n style={{ ...others.style, ...position }}\n >\n {children?.find(({ type: { name } }) => name === LayerContent.name)}\n </div>\n )}\n </>\n );\n};\n\nLayer.propTypes = {\n bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,KAAK,GAAG,SAARA,KAAQ,OASR;EAAA,IARJC,QAQI,QARJA,QAQI;EAAA,4BAPJC,WAOI;EAAA,IAPJA,WAOI,iCAPU,IAOV;EAAA,IANIC,WAMJ,QANJC,MAMI;EAAA,IALEC,SAKF,QALJC,IAKI;EAAA,IAJGC,UAIH,QAJJC,KAII;EAAA,IAHCC,QAGD,QAHJC,GAGI;EAAA,IAFJC,OAEI,QAFJA,OAEI;EAAA,IADDC,MACC;;EACJ,IAAMC,MAAM,GAAG,uBAAf;EACA,IAAMC,YAAY,GAAG,oBAArB;EACA,IAAMC,UAAU,GAAG,oBAAnB;;EAEA,gBAAgC,sBAAhC;EAAA;EAAA,IAAOC,QAAP;EAAA,IAAiBC,WAAjB;;EAEA,4BAAgB,YAAM;IACpB,4BAAsDH,YAAtD,CAAQI,OAAR;IAAA,2DAA+C,EAA/C;IAAA,IAA+BC,WAA/B,yBAAmBC,UAAnB;IACA,IAAiBC,SAAjB,GAA+BN,UAA/B,CAAQG,OAAR;IAEA,IAAI,CAACC,WAAD,IAAgB,CAACE,SAArB,EAAgC,OAAOJ,WAAW,EAAlB;IAEhC,IAAMK,eAAe,GAAG,gCAAiBH,WAAjB,CAAxB;IACA,IAAMI,aAAa,GAAG,gCAAiBF,SAAjB,CAAtB;;IACA,wBAA8B,gCAAiBC,eAAjB,EAAkCC,aAAlC,EAAiDV,MAAjD,EAAyD;MACrFZ,QAAQ,EAARA,QADqF;MAErFE,WAAW,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A9C;EAAA,CAAf,CALH,CANJ,CADF;AAiBD,CAtDD;;;AAwDA9B,KAAK,CAACqC,SAAN,GAAkB;EAChBjC,MAAM,EAAEkC,mBAAUC,IADF;EAEhBtC,QAAQ,EAAEqC,mBAAUC,IAFJ;EAGhBf,QAAQ,EAAEc,mBAAUE,IAHJ;EAIhBtC,WAAW,EAAEoC,mBAAUC,IAJP;EAKhBjC,IAAI,EAAEgC,mBAAUC,IALA;EAMhB/B,KAAK,EAAE8B,mBAAUC,IAND;EAOhB7B,GAAG,EAAE4B,mBAAUC,IAPC;EAQhB5B,OAAO,EAAE2B,mBAAUC;AARH,CAAlB"}
1
+ {"version":3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","forceRender","forceLeft","left","forceRight","right","forceTop","top","visible","others","device","componentRef","contentRef","position","setPosition","current","componentEl","firstChild","contentEl","componentLayout","contentLayout","children","React","Children","map","child","find","name","type","LayerContent","style","layer","hidden","className","propTypes","PropTypes","bool","node"],"sources":["../../../src/primitives/Layer/Layer.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { getElementLayout, getLayerPosition } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n bottom: forceBottom,\n centered,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n visible,\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = getElementLayout(componentEl);\n const contentLayout = getElementLayout(contentEl);\n const { left = 0, top = 0 } = getLayerPosition(componentLayout, contentLayout, device, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setPosition({ left: `${left}px`, top: `${top}px` });\n }, [centered, device, forceBottom, forceLeft, forceRight, forceTop, visible]);\n\n const children = React.Children.map(others.children || [], (child) => child);\n\n return (\n <>\n <span data-testid={others['data-testid']} ref={componentRef}>\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </span>\n\n {(forceRender || visible) && (\n <div\n ref={contentRef}\n className={styles(style.layer, !visible && style.hidden, others.className)}\n style={{ ...others.style, ...position }}\n >\n {children?.find(({ type: { name } }) => name === LayerContent.name)}\n </div>\n )}\n </>\n );\n};\n\nLayer.propTypes = {\n bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,KAAK,GAAG,SAARA,KAAQ,OASR;EAAA,IARIC,WAQJ,QARJC,MAQI;EAAA,IAPJC,QAOI,QAPJA,QAOI;EAAA,4BANJC,WAMI;EAAA,IANJA,WAMI,iCANU,IAMV;EAAA,IALEC,SAKF,QALJC,IAKI;EAAA,IAJGC,UAIH,QAJJC,KAII;EAAA,IAHCC,QAGD,QAHJC,GAGI;EAAA,IAFJC,OAEI,QAFJA,OAEI;EAAA,IADDC,MACC;;EACJ,IAAMC,MAAM,GAAG,uBAAf;EACA,IAAMC,YAAY,GAAG,oBAArB;EACA,IAAMC,UAAU,GAAG,oBAAnB;;EAEA,gBAAgC,sBAAhC;EAAA;EAAA,IAAOC,QAAP;EAAA,IAAiBC,WAAjB;;EAEA,4BAAgB,YAAM;IACpB,4BAAsDH,YAAtD,CAAQI,OAAR;IAAA,2DAA+C,EAA/C;IAAA,IAA+BC,WAA/B,yBAAmBC,UAAnB;IACA,IAAiBC,SAAjB,GAA+BN,UAA/B,CAAQG,OA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AAoB,CAACvB,OAAD,IAAYsB,qBAAME,MAAtC,EAA8CvB,MAAM,CAACwB,SAArD,CAFb;IAGE,KAAK,kCAAOxB,MAAM,CAACqB,KAAd,GAAwBjB,QAAxB;EAHP,GAKGQ,QALH,aAKGA,QALH,uBAKGA,QAAQ,CAAEK,IAAV,CAAe;IAAA,IAAWC,IAAX,SAAGC,IAAH,CAAWD,IAAX;IAAA,OAAwBA,IAAI,KAAKE,2BAAaF,IAA9C;EAAA,CAAf,CALH,CANJ,CADF;AAiBD,CAtDD;;;AAwDA9B,KAAK,CAACqC,SAAN,GAAkB;EAChBnC,MAAM,EAAEoC,mBAAUC,IADF;EAEhBpC,QAAQ,EAAEmC,mBAAUC,IAFJ;EAGhBf,QAAQ,EAAEc,mBAAUE,IAHJ;EAIhBpC,WAAW,EAAEkC,mBAAUC,IAJP;EAKhBjC,IAAI,EAAEgC,mBAAUC,IALA;EAMhB/B,KAAK,EAAE8B,mBAAUC,IAND;EAOhB7B,GAAG,EAAE4B,mBAAUC,IAPC;EAQhB5B,OAAO,EAAE2B,mBAAUC;AARH,CAAlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/ui",
3
- "version": "1.0.48",
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",